Source Code Cross Referenced for ConditionBase.java in  » Build » ANT » org » apache » tools » ant » taskdefs » condition » 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.taskdefs.condition 
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:
019:        package org.apache.tools.ant.taskdefs.condition;
020:
021:        import java.util.Enumeration;
022:        import java.util.Vector;
023:        import org.apache.tools.ant.Project;
024:        import org.apache.tools.ant.DynamicElement;
025:        import org.apache.tools.ant.ComponentHelper;
026:        import org.apache.tools.ant.ProjectComponent;
027:        import org.apache.tools.ant.taskdefs.Available;
028:        import org.apache.tools.ant.taskdefs.Checksum;
029:        import org.apache.tools.ant.taskdefs.UpToDate;
030:
031:        /**
032:         * Baseclass for the <condition> task as well as several
033:         * conditions - ensures that the types of conditions inside the task
034:         * and the "container" conditions are in sync.
035:         *
036:         * @since Ant 1.4
037:         */
038:        public abstract class ConditionBase extends ProjectComponent implements 
039:                DynamicElement {
040:
041:            private static final String CONDITION_ANTLIB = "antlib:org.apache.tools.ant.types.conditions:";
042:
043:            /**
044:             * name of the component
045:             */
046:            private String taskName = "condition";
047:
048:            /**
049:             *
050:             */
051:            private Vector conditions = new Vector();
052:
053:            /**
054:             * Simple constructor.
055:             */
056:            protected ConditionBase() {
057:                taskName = "component";
058:            }
059:
060:            /**
061:             * Constructor that takes the name of the task in the task name.
062:             * @param taskName the name of the task.
063:             * @since Ant 1.7
064:             */
065:            protected ConditionBase(String taskName) {
066:                this .taskName = taskName;
067:            }
068:
069:            /**
070:             * Count the conditions.
071:             *
072:             * @return the number of conditions in the container
073:             * @since 1.1
074:             */
075:            protected int countConditions() {
076:                return conditions.size();
077:            }
078:
079:            /**
080:             * Iterate through all conditions.
081:             *
082:             * @return an enumeration to use for iteration
083:             * @since 1.1
084:             */
085:            protected final Enumeration getConditions() {
086:                return conditions.elements();
087:            }
088:
089:            /**
090:             * Sets the name to use in logging messages.
091:             *
092:             * @param name The name to use in logging messages.
093:             *             Should not be <code>null</code>.
094:             * @since Ant 1.7
095:             */
096:            public void setTaskName(String name) {
097:                this .taskName = name;
098:            }
099:
100:            /**
101:             * Returns the name to use in logging messages.
102:             *
103:             * @return the name to use in logging messages.
104:             * @since Ant 1.7
105:             */
106:            public String getTaskName() {
107:                return taskName;
108:            }
109:
110:            /**
111:             * Add an &lt;available&gt; condition.
112:             * @param a an available condition
113:             * @since 1.1
114:             */
115:            public void addAvailable(Available a) {
116:                conditions.addElement(a);
117:            }
118:
119:            /**
120:             * Add an &lt;checksum&gt; condition.
121:             *
122:             * @param c a Checksum condition
123:             * @since 1.4, Ant 1.5
124:             */
125:            public void addChecksum(Checksum c) {
126:                conditions.addElement(c);
127:            }
128:
129:            /**
130:             * Add an &lt;uptodate&gt; condition.
131:             *
132:             * @param u an UpToDate condition
133:             * @since 1.1
134:             */
135:            public void addUptodate(UpToDate u) {
136:                conditions.addElement(u);
137:            }
138:
139:            /**
140:             * Add an &lt;not&gt; condition "container".
141:             *
142:             * @param n a Not condition
143:             * @since 1.1
144:             */
145:            public void addNot(Not n) {
146:                conditions.addElement(n);
147:            }
148:
149:            /**
150:             * Add an &lt;and&gt; condition "container".
151:             *
152:             * @param a an And condition
153:             * @since 1.1
154:             */
155:            public void addAnd(And a) {
156:                conditions.addElement(a);
157:            }
158:
159:            /**
160:             * Add an &lt;or&gt; condition "container".
161:             *
162:             * @param o an Or condition
163:             * @since 1.1
164:             */
165:            public void addOr(Or o) {
166:                conditions.addElement(o);
167:            }
168:
169:            /**
170:             * Add an &lt;equals&gt; condition.
171:             *
172:             * @param e an Equals condition
173:             * @since 1.1
174:             */
175:            public void addEquals(Equals e) {
176:                conditions.addElement(e);
177:            }
178:
179:            /**
180:             * Add an &lt;os&gt; condition.
181:             *
182:             * @param o an Os condition
183:             * @since 1.1
184:             */
185:            public void addOs(Os o) {
186:                conditions.addElement(o);
187:            }
188:
189:            /**
190:             * Add an &lt;isset&gt; condition.
191:             *
192:             * @param i an IsSet condition
193:             * @since Ant 1.5
194:             */
195:            public void addIsSet(IsSet i) {
196:                conditions.addElement(i);
197:            }
198:
199:            /**
200:             * Add an &lt;http&gt; condition.
201:             *
202:             * @param h an Http condition
203:             * @since Ant 1.5
204:             */
205:            public void addHttp(Http h) {
206:                conditions.addElement(h);
207:            }
208:
209:            /**
210:             * Add a &lt;socket&gt; condition.
211:             *
212:             * @param s a Socket condition
213:             * @since Ant 1.5
214:             */
215:            public void addSocket(Socket s) {
216:                conditions.addElement(s);
217:            }
218:
219:            /**
220:             * Add a &lt;filesmatch&gt; condition.
221:             *
222:             * @param test a FilesMatch condition
223:             * @since Ant 1.5
224:             */
225:            public void addFilesMatch(FilesMatch test) {
226:                conditions.addElement(test);
227:            }
228:
229:            /**
230:             * Add a &lt;contains&gt; condition.
231:             *
232:             * @param test a Contains condition
233:             * @since Ant 1.5
234:             */
235:            public void addContains(Contains test) {
236:                conditions.addElement(test);
237:            }
238:
239:            /**
240:             * Add a &lt;istrue&gt; condition.
241:             *
242:             * @param test an IsTrue condition
243:             * @since Ant 1.5
244:             */
245:            public void addIsTrue(IsTrue test) {
246:                conditions.addElement(test);
247:            }
248:
249:            /**
250:             * Add a &lt;isfalse&gt; condition.
251:             *
252:             * @param test an IsFalse condition
253:             * @since Ant 1.5
254:             */
255:            public void addIsFalse(IsFalse test) {
256:                conditions.addElement(test);
257:            }
258:
259:            /**
260:             * Add an &lt;isreference&gt; condition.
261:             *
262:             * @param i an IsReference condition
263:             * @since Ant 1.6
264:             */
265:            public void addIsReference(IsReference i) {
266:                conditions.addElement(i);
267:            }
268:
269:            /**
270:             * Add an &lt;isfileselected&gt; condition.
271:             * @param test the condition
272:             */
273:            public void addIsFileSelected(IsFileSelected test) {
274:                conditions.addElement(test);
275:            }
276:
277:            /**
278:             * Add an arbitrary condition
279:             * @param c a condition
280:             * @since Ant 1.6
281:             */
282:            public void add(Condition c) {
283:                conditions.addElement(c);
284:            }
285:
286:            /**
287:             * Create a dynamically discovered condition.  Built-in conditions can
288:             * be discovered from the org.apache.tools.ant.taskdefs.condition
289:             * antlib.
290:             * @param name the condition to create.
291:             * @return the dynamic condition if found, null otherwise.
292:             */
293:            public Object createDynamicElement(String name) {
294:                Object cond = ComponentHelper.getComponentHelper(getProject())
295:                        .createComponent(CONDITION_ANTLIB + name);
296:                if (!(cond instanceof  Condition)) {
297:                    return null;
298:                }
299:                log("Dynamically discovered '" + name + "' " + cond,
300:                        Project.MSG_DEBUG);
301:                add((Condition) cond);
302:                return cond;
303:            }
304:
305:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.