Source Code Cross Referenced for Resource.java in  » Test-Coverage » GroboUtils » net » sourceforge » groboutils » codecoverage » v2 » ant » zip » 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 » Test Coverage » GroboUtils » net.sourceforge.groboutils.codecoverage.v2.ant.zip 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright  2003-2004 The Apache Software Foundation
003:         *
004:         *  Licensed under the Apache License, Version 2.0 (the "License");
005:         *  you may not use this file except in compliance with the License.
006:         *  You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         *  Unless required by applicable law or agreed to in writing, software
011:         *  distributed under the License is distributed on an "AS IS" BASIS,
012:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         *  See the License for the specific language governing permissions and
014:         *  limitations under the License.
015:         *
016:         */
017:        package net.sourceforge.groboutils.codecoverage.v2.ant.zip;
018:
019:        /**
020:         * describes a File or a ZipEntry
021:         *
022:         * this class is meant to be used by classes needing to record path
023:         * and date/time information about a file, a zip entry or some similar
024:         * resource (URL, archive in a version control repository, ...)
025:         *
026:         * @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a>
027:         * @since Ant 1.5.2
028:         */
029:        public class Resource implements  Cloneable, Comparable {
030:            private String name = null;
031:            private boolean exists = true;
032:            private long lastmodified = 0;
033:            private boolean directory = false;
034:
035:            /**
036:             * default constructor
037:             */
038:            public Resource() {
039:            }
040:
041:            /**
042:             * only sets the name.
043:             *
044:             * <p>This is a dummy, used for not existing resources.</p>
045:             *
046:             * @param name relative path of the resource.  Expects
047:             * &quot;/&quot; to be used as the directory separator.
048:             */
049:            public Resource(String name) {
050:                this (name, false, 0, false);
051:            }
052:
053:            /**
054:             * sets the name, lastmodified flag, and exists flag
055:             *
056:             * @param name relative path of the resource.  Expects
057:             * &quot;/&quot; to be used as the directory separator.
058:             */
059:            public Resource(String name, boolean exists, long lastmodified) {
060:                this (name, exists, lastmodified, false);
061:            }
062:
063:            /**
064:             * @param name relative path of the resource.  Expects
065:             * &quot;/&quot; to be used as the directory separator.
066:             */
067:            public Resource(String name, boolean exists, long lastmodified,
068:                    boolean directory) {
069:                this .name = name;
070:                this .exists = exists;
071:                this .lastmodified = lastmodified;
072:                this .directory = directory;
073:            }
074:
075:            /**
076:             * name attribute will contain the path of a file relative to the
077:             * root directory of its fileset or the recorded path of a zip
078:             * entry.
079:             *
080:             * <p>example for a file with fullpath /var/opt/adm/resource.txt
081:             * in a file set with root dir /var/opt it will be
082:             * adm/resource.txt.</p>
083:             *
084:             * <p>&quot;/&quot; will be used as the directory separator.</p>
085:             */
086:            public String getName() {
087:                return name;
088:            }
089:
090:            /**
091:             * @param name relative path of the resource.  Expects
092:             * &quot;/&quot; to be used as the directory separator.
093:             */
094:            public void setName(String name) {
095:                this .name = name;
096:            }
097:
098:            /**
099:             * the exists attribute tells whether a file exists
100:             */
101:            public boolean isExists() {
102:                return exists;
103:            }
104:
105:            public void setExists(boolean exists) {
106:                this .exists = exists;
107:            }
108:
109:            /**
110:             * tells the modification time in milliseconds since 01.01.1970 of
111:             *
112:             * @return 0 if the resource does not exist to mirror the behavior
113:             * of {@link java.io.File File}.
114:             */
115:            public long getLastModified() {
116:                return !exists || lastmodified < 0 ? 0 : lastmodified;
117:            }
118:
119:            public void setLastModified(long lastmodified) {
120:                this .lastmodified = lastmodified;
121:            }
122:
123:            /**
124:             * tells if the resource is a directory
125:             * @return boolean flag indicating if the resource is a directory
126:             */
127:            public boolean isDirectory() {
128:                return directory;
129:            }
130:
131:            public void setDirectory(boolean directory) {
132:                this .directory = directory;
133:            }
134:
135:            /**
136:             * @return copy of this
137:             */
138:            public Object clone() {
139:                try {
140:                    return super .clone();
141:                } catch (CloneNotSupportedException e) {
142:                    throw new Error("CloneNotSupportedException for a "
143:                            + "Clonable Resource caught?");
144:                }
145:            }
146:
147:            /**
148:             * delegates to a comparison of names.
149:             *
150:             * @since Ant 1.6
151:             */
152:            public int compareTo(Object other) {
153:                if (!(other instanceof  Resource)) {
154:                    throw new IllegalArgumentException(
155:                            "Can only be compared with " + "Resources");
156:                }
157:                Resource r = (Resource) other;
158:                return getName().compareTo(r.getName());
159:            }
160:        }
ww_w._ja_va_2___s__.co___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.