Source Code Cross Referenced for AbstractHotDeploymentTool.java in  » Build » ANT » org » apache » tools » ant » taskdefs » optional » j2ee » 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.j2ee 
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.optional.j2ee;
020:
021:        import org.apache.tools.ant.BuildException;
022:        import org.apache.tools.ant.types.Path;
023:
024:        /**
025:         *  Abstract class to support vendor-specific hot deployment tools.
026:         *  This class will validate boilerplate attributes.
027:         *
028:         *  Subclassing this class for a vendor specific tool involves the
029:         *  following.
030:         *  <ol><li>Implement the <code>isActionValid()<code> method to insure the
031:         *  action supplied as the "action" attribute of ServerDeploy is valid.
032:         *  <li>Implement the <code>validateAttributes()</code> method to insure
033:         *  all required attributes are supplied, and are in the correct format.
034:         *  <li>Add a <code>add&lt;TOOL&gt;</code> method to the ServerDeploy
035:         *  class.  This method will be called when Ant encounters a
036:         *  <code>add&lt;TOOL&gt;</code> task nested in the
037:         *  <code>serverdeploy</code> task.
038:         *  <li>Define the <code>deploy</code> method.  This method should perform
039:         *  whatever task it takes to hot-deploy the component.  IE: spawn a JVM and
040:         *  run class, exec a native executable, run Java code...
041:         *
042:         *  @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool
043:         *  @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy
044:         */
045:        public abstract class AbstractHotDeploymentTool implements 
046:                HotDeploymentTool {
047:            /** The parent task **/
048:            private ServerDeploy task;
049:
050:            /** The classpath passed to the JVM on execution. **/
051:            private Path classpath;
052:
053:            /** The username for the deployment server. **/
054:            private String userName;
055:
056:            /** The password for the deployment server. **/
057:            private String password;
058:
059:            /** The address of the deployment server **/
060:            private String server;
061:
062:            /**
063:             *  Add a classpath as a nested element.
064:             *  @return A Path object representing the classpath to be used.
065:             */
066:            public Path createClasspath() {
067:                if (classpath == null) {
068:                    classpath = new Path(task.getProject());
069:                }
070:                return classpath.createPath();
071:            }
072:
073:            /**
074:             *  Determines if the "action" attribute defines a valid action.
075:             *  <p>Subclasses should determine if the action passed in is
076:             *  supported by the vendor's deployment tool.
077:             *  <p>Actions may by "deploy", "delete", etc... It all depends
078:             *  on the tool.
079:             *  @return true if the "action" attribute is valid, false if not.
080:             */
081:            protected abstract boolean isActionValid();
082:
083:            /**
084:             *  Validates the passed in attributes.
085:             *  Subclasses should chain to this super-method to insure
086:             *  validation of boilerplate attributes.
087:             *  <p>Only the "action" attribute is required in the
088:             *  base class.  Subclasses should check attributes accordingly.
089:             *  @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
090:             */
091:            public void validateAttributes() throws BuildException {
092:                if (task.getAction() == null) {
093:                    throw new BuildException(
094:                            "The \"action\" attribute must be set");
095:                }
096:
097:                if (!isActionValid()) {
098:                    throw new BuildException("Invalid action \""
099:                            + task.getAction() + "\" passed");
100:                }
101:
102:                if (classpath == null) {
103:                    throw new BuildException(
104:                            "The classpath attribute must be set");
105:                }
106:            }
107:
108:            /**
109:             *  Perform the actual deployment.
110:             *  It's up to the subclasses to implement the actual behavior.
111:             *  @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete.
112:             */
113:            public abstract void deploy() throws BuildException;
114:
115:            /**
116:             *  Sets the parent task.
117:             *  @param task a ServerDeploy object representing the parent task.
118:             *  @ant.attribute ignore="true"
119:             */
120:            public void setTask(ServerDeploy task) {
121:                this .task = task;
122:            }
123:
124:            /**
125:             *  Returns the task field, a ServerDeploy object.
126:             *  @return An ServerDeploy representing the parent task.
127:             */
128:            protected ServerDeploy getTask() {
129:                return task;
130:            }
131:
132:            /**
133:             *  gets the classpath field.
134:             *  @return A Path representing the "classpath" attribute.
135:             */
136:            public Path getClasspath() {
137:                return classpath;
138:            }
139:
140:            /**
141:             *  The classpath to be passed to the JVM running the tool;
142:             *  optional depending upon the tool.
143:             *  The classpath may also be supplied as a nested element.
144:             *  @param classpath A Path object representing the "classpath" attribute.
145:             */
146:            public void setClasspath(Path classpath) {
147:                this .classpath = classpath;
148:            }
149:
150:            /**
151:             *  Returns the userName field.
152:             *  @return A String representing the "userName" attribute.
153:             */
154:            public String getUserName() {
155:                return userName;
156:            }
157:
158:            /**
159:             *  The user with privileges to deploy applications to the server; optional.
160:             *  @param userName A String representing the "userName" attribute.
161:             */
162:            public void setUserName(String userName) {
163:                this .userName = userName;
164:            }
165:
166:            /**
167:             *  Returns the password field.
168:             *  @return A String representing the "password" attribute.
169:             */
170:            public String getPassword() {
171:                return password;
172:            }
173:
174:            /**
175:             *  The password of the user; optional.
176:             *  @param password A String representing the "password" attribute.
177:             */
178:            public void setPassword(String password) {
179:                this .password = password;
180:            }
181:
182:            /**
183:             *  Returns the server field.
184:             *  @return A String representing the "server" attribute.
185:             */
186:            public String getServer() {
187:                return server;
188:            }
189:
190:            /**
191:             *  The address or URL for the server where the component will be deployed.
192:             *  @param server A String representing the "server" attribute.
193:             */
194:            public void setServer(String server) {
195:                this.server = server;
196:            }
197:        }
w_w___w__.j___a___v___a___2___s___.c_om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.