Source Code Cross Referenced for PathResolver.java in  » Code-Analyzer » GenJar » org » apache » tools » ant » taskdefs » optional » genjar » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Code Analyzer » GenJar » org.apache.tools.ant.taskdefs.optional.genjar 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Apache Software License, Version 1.1
003:         *
004:         * Copyright © 2002 Jesse Stockall.  All rights reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         *
010:         * 1. Redistributions of source code must retain the above copyright
011:         *    notice, this list of conditions and the following disclaimer.
012:         *
013:         * 2. Redistributions in binary form must reproduce the above copyright
014:         *    notice, this list of conditions and the following disclaimer in
015:         *    the documentation and/or other materials provided with the
016:         *    distribution.
017:         *
018:         * 3. The end-user documentation included with the redistribution, if
019:         *    any, must include the following acknowlegement:
020:         *       "This product includes software developed by the
021:         *        Apache Software Foundation (http://www.apache.org/)."
022:         *    Alternately, this acknowlegement may appear in the software itself,
023:         *    if and wherever such third-party acknowlegements normally appear.
024:         *
025:         * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
026:         *    Foundation" must not be used to endorse or promote products derived
027:         *    from this software without prior written permission. For written
028:         *    permission, please contact apache@apache.org.
029:         *
030:         * 5. Products derived from this software may not be called "Apache"
031:         *    nor may "Apache" appear in their names without prior written
032:         *    permission of the Apache Group.
033:         *
034:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
035:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
036:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
037:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
038:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
039:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
040:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
041:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
042:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
043:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
044:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
045:         * SUCH DAMAGE.
046:         * ====================================================================
047:         *
048:         * This software consists of voluntary contributions made by many
049:         * individuals on behalf of the Apache Software Foundation.  For more
050:         * information on the Apache Software Foundation, please see
051:         * <http://www.apache.org/>.
052:         */
053:        package org.apache.tools.ant.taskdefs.optional.genjar;
054:
055:        import java.io.IOException;
056:        import java.io.InputStream;
057:        import java.text.SimpleDateFormat;
058:        import java.util.Date;
059:        import java.util.Locale;
060:
061:        /**
062:         * <p>
063:         *
064:         * A PathResolver is used for each component of the classpath.</p> <p>
065:         *
066:         * Each type of component is a specialization of this base class. For example, a jar file
067:         * encountered in the classpath causes a JarResolver to be instantiated. A JarResolver knows how to
068:         * search within jar files for specific files. </p> <p>
069:         *
070:         * This approach is taken for two reasons:
071:         * <ol>
072:         *   <li> To encapsulate the specifics of fetching streams and what attributes are set on a jar
073:         *   entry's manifest entry. </li>
074:         *   <li> To provide an association between the <i>source</i> of a class (or resource) and the
075:         *   repository from which it came. This info is priceless when trying to figure out why the wrong
076:         *   classes are being included in your jar. </li>
077:         * </ol>
078:         * </p>
079:         *
080:         * @author    Original Code: <a href="mailto:jake@riggshill.com">John W. Kohler </a>
081:         * @author    Jesse Stockall
082:         * @version   $Revision: 1.2 $ $Date: 2003/02/23 10:06:10 $
083:         */
084:        abstract class PathResolver {
085:            /** name of attribute for content's original location (path) */
086:            static final String CONTENT_LOC = "Content-Location";
087:            /** name of attribute for original content's modification time */
088:            static final String LAST_MOD = "Last-Modified";
089:            /** format string for RFC1123 date */
090:            static final String RFC1123 = "EEE, dd MMM yyyy HH:mm:ss zzz";
091:
092:            /** Description of the Field */
093:            protected Logger log;
094:            private static SimpleDateFormat dateFmt = null;
095:
096:            /**
097:             * Constructor for the PathResolver object
098:             *
099:             * @param log  Description of the Parameter
100:             */
101:            PathResolver(Logger log) {
102:                this .log = log;
103:                if (dateFmt == null) {
104:                    dateFmt = new SimpleDateFormat(RFC1123, Locale.getDefault());
105:                    //
106:                    // true conformance to rfc1123 would have us using GMT
107:                    // rather than local time - this doesn;t make sense to
108:                    // me since the biggest reason to use the time stamps
109:                    // is to compare against the source files - which are in
110:                    // local time
111:                    //
112:                    /*
113:                          dateFmt.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
114:                     */
115:                }
116:            }
117:
118:            /**
119:             * Given a JarEntrySpec, a path to the actual resource is generated and an input stream is
120:             * returned on the path.
121:             *
122:             * @param je               Description of the Parameter
123:             * @return                 IOStream opened on the file referenced
124:             * @exception IOException  if any errors are encountered
125:             */
126:            abstract InputStream resolve(JarEntrySpec je) throws IOException;
127:
128:            /**
129:             * Given a file name (possibly relative), an InputStream is opened on that file or an exception
130:             * is thrown.
131:             *
132:             * @param fname         Description of the Parameter
133:             * @return              IOStream opened on the named file
134:             * @throws IOException  Oops!
135:             */
136:            abstract InputStream resolve(String fname) throws IOException;
137:
138:            /**
139:             * Closes any resources opened by the resolver.
140:             *
141:             * @throws IOException  Oops!
142:             */
143:            abstract void close() throws IOException;
144:
145:            /**
146:             * Formats a date compatable with RFC1123. Well, close anyway. To be truly conformant the time
147:             * zone would always be GMT. This formats the date in local time.
148:             *
149:             * @param d  Description of the Parameter
150:             * @return   String representation of the date
151:             */
152:            protected String formatDate(Date d) {
153:                return dateFmt.format(d);
154:            }
155:
156:            /**
157:             * Description of the Method
158:             *
159:             * @param l  Description of the Parameter
160:             * @return   Description of the Return Value
161:             */
162:            protected String formatDate(long l) {
163:                return formatDate(new Date(l));
164:            }
165:        }
166:        // vi:set ts=4 sw=4:
w__w___w_.___j___a___v_a_2s.___c___om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.