Source Code Cross Referenced for ZipFileSet.java in  » Build » ANT » org » apache » tools » ant » types » 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 » Build » ANT » org.apache.tools.ant.types 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:        package org.apache.tools.ant.types;
019:
020:        import org.apache.tools.ant.BuildException;
021:        import org.apache.tools.ant.Project;
022:
023:        /**
024:         * A ZipFileSet is a FileSet with extra attributes useful in the context of
025:         * Zip/Jar tasks.
026:         *
027:         * A ZipFileSet extends FileSets with the ability to extract a subset of the
028:         * entries of a Zip file for inclusion in another Zip file.  It also includes
029:         * a prefix attribute which is prepended to each entry in the output Zip file.
030:         *
031:         * Since ant 1.6 ZipFileSet can be defined with an id and referenced in packaging tasks
032:         *
033:         */
034:        public class ZipFileSet extends ArchiveFileSet {
035:
036:            private String encoding = null;
037:
038:            /** Constructor for ZipFileSet */
039:            public ZipFileSet() {
040:                super ();
041:            }
042:
043:            /**
044:             * Constructor using a fileset arguement.
045:             * @param fileset the fileset to use
046:             */
047:            protected ZipFileSet(FileSet fileset) {
048:                super (fileset);
049:            }
050:
051:            /**
052:             * Constructor using a zipfileset arguement.
053:             * @param fileset the zipfileset to use
054:             */
055:            protected ZipFileSet(ZipFileSet fileset) {
056:                super (fileset);
057:                encoding = fileset.encoding;
058:            }
059:
060:            /**
061:             * Set the encoding used for this ZipFileSet.
062:             * @param enc encoding as String.
063:             * @since Ant 1.7
064:             */
065:            public void setEncoding(String enc) {
066:                checkZipFileSetAttributesAllowed();
067:                this .encoding = enc;
068:            }
069:
070:            /**
071:             * Get the encoding used for this ZipFileSet.
072:             * @return String encoding.
073:             * @since Ant 1.7
074:             */
075:            public String getEncoding() {
076:                if (isReference()) {
077:                    AbstractFileSet ref = getRef(getProject());
078:                    if (ref instanceof  ZipFileSet) {
079:                        return ((ZipFileSet) ref).getEncoding();
080:                    } else {
081:                        return null;
082:                    }
083:                }
084:                return encoding;
085:            }
086:
087:            /**
088:             * Return a new archive scanner based on this one.
089:             * @return a new ZipScanner with the same encoding as this one.
090:             */
091:            protected ArchiveScanner newArchiveScanner() {
092:                ZipScanner zs = new ZipScanner();
093:                zs.setEncoding(encoding);
094:                return zs;
095:            }
096:
097:            /**
098:             * A ZipFileset accepts another ZipFileSet or a FileSet as reference
099:             * FileSets are often used by the war task for the lib attribute
100:             * @param p the project to use
101:             * @return the abstract fileset instance
102:             */
103:            protected AbstractFileSet getRef(Project p) {
104:                dieOnCircularReference(p);
105:                Object o = getRefid().getReferencedObject(p);
106:                if (o instanceof  ZipFileSet) {
107:                    return (AbstractFileSet) o;
108:                } else if (o instanceof  FileSet) {
109:                    ZipFileSet zfs = new ZipFileSet((FileSet) o);
110:                    configureFileSet(zfs);
111:                    return zfs;
112:                } else {
113:                    String msg = getRefid().getRefId()
114:                            + " doesn\'t denote a zipfileset or a fileset";
115:                    throw new BuildException(msg);
116:                }
117:            }
118:
119:            /**
120:             * Return a ZipFileSet that has the same properties
121:             * as this one.
122:             * @return the cloned zipFileSet
123:             */
124:            public Object clone() {
125:                if (isReference()) {
126:                    return ((ZipFileSet) getRef(getProject())).clone();
127:                } else {
128:                    return super .clone();
129:                }
130:            }
131:
132:            /**
133:             * A check attributes for zipFileSet.
134:             * If there is a reference, and
135:             * it is a ZipFileSet, the zip fileset attributes
136:             * cannot be used.
137:             */
138:            private void checkZipFileSetAttributesAllowed() {
139:                if (getProject() == null
140:                        || (isReference() && (getRefid().getReferencedObject(
141:                                getProject()) instanceof  ZipFileSet))) {
142:                    checkAttributesAllowed();
143:                }
144:            }
145:
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.