Source Code Cross Referenced for ExtensionAdapter.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » extension » 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.optional.extension 
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.taskdefs.optional.extension;
019:
020:        import org.apache.tools.ant.BuildException;
021:        import org.apache.tools.ant.types.DataType;
022:        import org.apache.tools.ant.types.Reference;
023:
024:        /**
025:         * Simple class that represents an Extension and conforms to Ants
026:         * patterns.
027:         *
028:         * @ant.datatype name="extension"
029:         */
030:        public class ExtensionAdapter extends DataType {
031:            /**
032:             * The name of the optional package being made available, or required.
033:             */
034:            private String extensionName;
035:
036:            /**
037:             * The version number (dotted decimal notation) of the specification
038:             * to which this optional package conforms.
039:             */
040:            private DeweyDecimal specificationVersion;
041:
042:            /**
043:             * The name of the company or organization that originated the
044:             * specification to which this optional package conforms.
045:             */
046:            private String specificationVendor;
047:
048:            /**
049:             * The unique identifier of the company that produced the optional
050:             * package contained in this JAR file.
051:             */
052:            private String implementationVendorID;
053:
054:            /**
055:             * The name of the company or organization that produced this
056:             * implementation of this optional package.
057:             */
058:            private String implementationVendor;
059:
060:            /**
061:             * The version number (dotted decimal notation) for this implementation
062:             * of the optional package.
063:             */
064:            private DeweyDecimal implementationVersion;
065:
066:            /**
067:             * The URL from which the most recent version of this optional package
068:             * can be obtained if it is not already installed.
069:             */
070:            private String implementationURL;
071:
072:            /**
073:             * Set the name of extension.
074:             *
075:             * @param extensionName the name of extension
076:             */
077:            public void setExtensionName(final String extensionName) {
078:                verifyNotAReference();
079:                this .extensionName = extensionName;
080:            }
081:
082:            /**
083:             * Set the specificationVersion of extension.
084:             *
085:             * @param specificationVersion the specificationVersion of extension
086:             */
087:            public void setSpecificationVersion(
088:                    final String specificationVersion) {
089:                verifyNotAReference();
090:                this .specificationVersion = new DeweyDecimal(
091:                        specificationVersion);
092:            }
093:
094:            /**
095:             * Set the specificationVendor of extension.
096:             *
097:             * @param specificationVendor the specificationVendor of extension
098:             */
099:            public void setSpecificationVendor(final String specificationVendor) {
100:                verifyNotAReference();
101:                this .specificationVendor = specificationVendor;
102:            }
103:
104:            /**
105:             * Set the implementationVendorID of extension.
106:             *
107:             * @param implementationVendorID the implementationVendorID of extension
108:             */
109:            public void setImplementationVendorId(
110:                    final String implementationVendorID) {
111:                verifyNotAReference();
112:                this .implementationVendorID = implementationVendorID;
113:            }
114:
115:            /**
116:             * Set the implementationVendor of extension.
117:             *
118:             * @param implementationVendor the implementationVendor of extension
119:             */
120:            public void setImplementationVendor(
121:                    final String implementationVendor) {
122:                verifyNotAReference();
123:                this .implementationVendor = implementationVendor;
124:            }
125:
126:            /**
127:             * Set the implementationVersion of extension.
128:             *
129:             * @param implementationVersion the implementationVersion of extension
130:             */
131:            public void setImplementationVersion(
132:                    final String implementationVersion) {
133:                verifyNotAReference();
134:                this .implementationVersion = new DeweyDecimal(
135:                        implementationVersion);
136:            }
137:
138:            /**
139:             * Set the implementationURL of extension.
140:             *
141:             * @param implementationURL the implementationURL of extension
142:             */
143:            public void setImplementationUrl(final String implementationURL) {
144:                verifyNotAReference();
145:                this .implementationURL = implementationURL;
146:            }
147:
148:            /**
149:             * Makes this instance in effect a reference to another ExtensionAdapter
150:             * instance.
151:             *
152:             * <p>You must not set another attribute or nest elements inside
153:             * this element if you make it a reference.</p>
154:             *
155:             * @param reference the reference to which this instance is associated
156:             * @exception BuildException if this instance already has been configured.
157:             */
158:            public void setRefid(final Reference reference)
159:                    throws BuildException {
160:                if (null != extensionName || null != specificationVersion
161:                        || null != specificationVendor
162:                        || null != implementationVersion
163:                        || null != implementationVendorID
164:                        || null != implementationVendor
165:                        || null != implementationURL) {
166:                    throw tooManyAttributes();
167:                }
168:                // change this to get the objects from the other reference
169:                Object o = reference.getReferencedObject(getProject());
170:                if (o instanceof  ExtensionAdapter) {
171:                    final ExtensionAdapter other = (ExtensionAdapter) o;
172:                    extensionName = other.extensionName;
173:                    specificationVersion = other.specificationVersion;
174:                    specificationVendor = other.specificationVendor;
175:                    implementationVersion = other.implementationVersion;
176:                    implementationVendorID = other.implementationVendorID;
177:                    implementationVendor = other.implementationVendor;
178:                    implementationURL = other.implementationURL;
179:                } else {
180:                    final String message = reference.getRefId()
181:                            + " doesn\'t refer to a Extension";
182:                    throw new BuildException(message);
183:                }
184:
185:                super .setRefid(reference);
186:            }
187:
188:            private void verifyNotAReference() throws BuildException {
189:                if (isReference()) {
190:                    throw tooManyAttributes();
191:                }
192:            }
193:
194:            /**
195:             * Convert this adpater object into an extension object.
196:             *
197:             * @return the extension object
198:             */
199:            Extension toExtension() throws BuildException {
200:                if (null == extensionName) {
201:                    final String message = "Extension is missing name.";
202:                    throw new BuildException(message);
203:                }
204:
205:                String specificationVersionString = null;
206:                if (null != specificationVersion) {
207:                    specificationVersionString = specificationVersion
208:                            .toString();
209:                }
210:                String implementationVersionString = null;
211:                if (null != implementationVersion) {
212:                    implementationVersionString = implementationVersion
213:                            .toString();
214:                }
215:                return new Extension(extensionName, specificationVersionString,
216:                        specificationVendor, implementationVersionString,
217:                        implementationVendor, implementationVendorID,
218:                        implementationURL);
219:            }
220:
221:            /**
222:             * a debug toString method.
223:             * @return the extension in a string.
224:             * @see java.lang.Object#toString()
225:             */
226:            public String toString() {
227:                return "{" + toExtension().toString() + "}";
228:            }
229:        }
w___w__w___._j_a_v___a2_s___.co_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.