Source Code Cross Referenced for JarEntrySpec.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 (c) 2000, 2001, 2002, 2003 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:         */
049:        package org.apache.tools.ant.taskdefs.optional.genjar;
050:
051:        import java.io.File;
052:        import java.util.Date;
053:        import java.util.Iterator;
054:        import java.util.jar.Attributes;
055:
056:        /**
057:         * Represents one object (file) that is to be placed into the jar.<p>
058:         *
059:         * This includes all &lt;class&gt; names specified in the project file, all
060:         * &lt;resource&gt; files specified in the project file and all generated class
061:         * references.<p>
062:         *
063:         *
064:         *
065:         * @author    Original Code: <a href="mailto:jake@riggshill.com">John W. Kohler
066:         *      </a>
067:         * @author    Jesse Stockall
068:         * @version   $Revision: 1.2 $ $Date: 2003/02/23 10:43:21 $
069:         */
070:        public class JarEntrySpec {
071:            Attributes atts;
072:            String jarName;
073:            File srcFile;
074:
075:            /** Constructor for the JarEntrySpec object */
076:            JarEntrySpec() {
077:                atts = new Attributes();
078:            }
079:
080:            /**
081:             * create a new jar entry given a name (jar path) and a fully qualified file
082:             * path.
083:             *
084:             * @param jarName  Description of the Parameter
085:             * @param srcFile  Description of the Parameter
086:             */
087:            JarEntrySpec(String jarName, File srcFile) {
088:                this .jarName = jarName.replace('\\', '/');
089:                this .srcFile = srcFile;
090:                atts = new Attributes();
091:
092:                if (srcFile != null) {
093:                    setAttribute("Content-Location", srcFile.getAbsolutePath());
094:                    setAttribute("Content-Length", srcFile.length());
095:                    setAttribute("Last-Modified", new Date(srcFile
096:                            .lastModified()));
097:                }
098:            }
099:
100:            /**
101:             * Gets the jarName attribute of the JarEntrySpec object
102:             *
103:             * @return   The jarName value
104:             */
105:            String getJarName() {
106:                return jarName;
107:            }
108:
109:            /**
110:             * Sets the jarName attribute of the JarEntrySpec object
111:             *
112:             * @param jn  The new jarName value
113:             */
114:            void setJarName(String jn) {
115:                jarName = jn;
116:            }
117:
118:            /**
119:             * Gets the sourceFile attribute of the JarEntrySpec object
120:             *
121:             * @return   The sourceFile value
122:             */
123:            File getSourceFile() {
124:                return srcFile;
125:            }
126:
127:            /**
128:             * Sets the sourceFile attribute of the JarEntrySpec object
129:             *
130:             * @param f  The new sourceFile value
131:             */
132:            void setSourceFile(File f) {
133:                srcFile = f;
134:            }
135:
136:            /**
137:             * Gets the attributes attribute of the JarEntrySpec object
138:             *
139:             * @return   The attributes value
140:             */
141:            Attributes getAttributes() {
142:                return atts;
143:            }
144:
145:            /**
146:             * copy an Attributes into this entry's attributs
147:             *
148:             * @param a  The feature to be added to the Attributes attribute
149:             */
150:            public void addAttributes(Attributes a) {
151:                if (a != null) {
152:                    for (Iterator it = a.keySet().iterator(); it.hasNext();) {
153:                        String key = it.next().toString();
154:                        atts.putValue(key, a.getValue(key));
155:                    }
156:                }
157:            }
158:
159:            /**
160:             * Sets the attribute attribute of the JarEntrySpec object
161:             *
162:             * @param name  The new attribute value
163:             * @param val   The new attribute value
164:             */
165:            void setAttribute(String name, int val) {
166:                setAttribute(name, Integer.toString(val));
167:            }
168:
169:            /**
170:             * Sets the attribute attribute of the JarEntrySpec object
171:             *
172:             * @param name  The new attribute value
173:             * @param val   The new attribute value
174:             */
175:            void setAttribute(String name, long val) {
176:                setAttribute(name, Long.toString(val));
177:            }
178:
179:            /**
180:             * Sets the attribute attribute of the JarEntrySpec object
181:             *
182:             * @param name  The new attribute value
183:             * @param val   The new attribute value
184:             */
185:            void setAttribute(String name, float val) {
186:                setAttribute(name, Float.toString(val));
187:            }
188:
189:            /**
190:             * Sets the attribute attribute of the JarEntrySpec object
191:             *
192:             * @param name  The new attribute value
193:             * @param val   The new attribute value
194:             */
195:            void setAttribute(String name, double val) {
196:                setAttribute(name, Double.toString(val));
197:            }
198:
199:            /**
200:             * Sets the attribute attribute of the JarEntrySpec object
201:             *
202:             * @param name  The new attribute value
203:             * @param d     The new attribute value
204:             */
205:            void setAttribute(String name, Date d) {
206:                atts.putValue(name, d.toString());
207:            }
208:
209:            /**
210:             * Sets the attribute attribute of the JarEntrySpec object
211:             *
212:             * @param name  The new attribute value
213:             * @param obj   The new attribute value
214:             */
215:            void setAttribute(String name, Object obj) {
216:                atts.putValue(name, obj.toString());
217:            }
218:
219:            /**
220:             * Description of the Method
221:             *
222:             * @param o  Description of the Parameter
223:             * @return   Description of the Return Value
224:             */
225:            public boolean equals(Object o) {
226:                if (o == null || !(o instanceof  JarEntrySpec)) {
227:                    return false;
228:                }
229:                return jarName.equals(((JarEntrySpec) o).jarName);
230:            }
231:
232:            /**
233:             * Description of the Method
234:             *
235:             * @return   Description of the Return Value
236:             */
237:            public String toString() {
238:                String key;
239:                StringBuffer sb = new StringBuffer("JarEntrySpec:");
240:
241:                sb.append("\n\tJar Name:");
242:                sb.append(jarName);
243:                sb.append("\n\tStream  :");
244:                if (srcFile == null) {
245:                    sb.append("** NOT RESOLVED **");
246:                } else {
247:                    sb.append(srcFile.getAbsolutePath());
248:                }
249:
250:                for (Iterator it = atts.keySet().iterator(); it.hasNext();) {
251:                    sb.append("\n\tAtt: ");
252:                    sb.append(key = it.next().toString());
253:                    sb.append(": ");
254:                    sb.append(atts.getValue(key));
255:                }
256:                return sb.toString();
257:            }
258:        }
ww__w._ja___v__a__2s_.__c___o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.