From 00988f5180558c94a961c8ed38163192c9b9eb5c Mon Sep 17 00:00:00 2001 From: Erik Hatcher Date: Wed, 27 Mar 2002 14:32:19 +0000 Subject: [PATCH] Refactoring of server deployment task. Renamed from to . Moved to new j2ee package so its not EJB-centric. Submitted by Christopher A. Longo - cal@cloud9.net git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272053 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 +- docs/manual/OptionalTasks/ejb.html | 1 - docs/manual/OptionalTasks/ejbdeploy.html | 145 ----------- docs/manual/OptionalTasks/serverdeploy.html | 201 +++++++++++++++ docs/manual/optionaltasklist.html | 1 + .../tools/ant/taskdefs/defaults.properties | 2 +- .../ejb/AbstractEjbHotDeploymentTool.java | 158 ------------ .../j2ee/AbstractHotDeploymentTool.java | 232 ++++++++++++++++++ .../j2ee/GenericHotDeploymentTool.java | 163 ++++++++++++ .../HotDeploymentTool.java} | 54 ++-- .../EjbDeploy.java => j2ee/ServerDeploy.java} | 175 ++++--------- .../WebLogicHotDeploymentTool.java | 124 ++++------ 12 files changed, 728 insertions(+), 530 deletions(-) delete mode 100644 docs/manual/OptionalTasks/ejbdeploy.html create mode 100644 docs/manual/OptionalTasks/serverdeploy.html delete mode 100644 src/main/org/apache/tools/ant/taskdefs/optional/ejb/AbstractEjbHotDeploymentTool.java create mode 100644 src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java create mode 100644 src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java rename src/main/org/apache/tools/ant/taskdefs/optional/{ejb/EjbHotDeploymentTool.java => j2ee/HotDeploymentTool.java} (69%) rename src/main/org/apache/tools/ant/taskdefs/optional/{ejb/EjbDeploy.java => j2ee/ServerDeploy.java} (54%) rename src/main/org/apache/tools/ant/taskdefs/optional/{ejb => j2ee}/WebLogicHotDeploymentTool.java (74%) diff --git a/WHATSNEW b/WHATSNEW index 0b10ef7b4..a7a6d4183 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -242,7 +242,7 @@ Other changes: "site chmod", as well as set the umask before transferring files, if the server supports "site umask". -* New "optional" task. +* New "optional" task. * now supports nested patternsets. diff --git a/docs/manual/OptionalTasks/ejb.html b/docs/manual/OptionalTasks/ejb.html index 409715658..39d07dd44 100644 --- a/docs/manual/OptionalTasks/ejb.html +++ b/docs/manual/OptionalTasks/ejb.html @@ -62,7 +62,6 @@ In general these tasks are specific to the particular vendor's EJB Server.

blgenclientBorland Application Server 4.5 ddcreatorWeblogic 4.5.1 ejbcWeblogic 4.5.1 - ejbdeployEJB hot server deployment iplanet-ejbciPlanet Application Server 6.0 ejbjarNested Elements borlandBorland Application Server 4.5 diff --git a/docs/manual/OptionalTasks/ejbdeploy.html b/docs/manual/OptionalTasks/ejbdeploy.html deleted file mode 100644 index d2b57c1c4..000000000 --- a/docs/manual/OptionalTasks/ejbdeploy.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - -EjbDeploy Task - - - - - -

ejbdeploy

-

Description:

- -

The ejbdeploy task is used to run a "hot" deployment tool for -vendor-specific J2EE server. The task runs the tool in a separate JVM. The -task requires nested elements which define the attributes of the -vendor-specific deployment tool being executed. -

- -

Parameters:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
actionThis is the action to be performed. For most cases this - will be "deploy". Some tools support additional actions, such as "delete", "list", - "undeploy", "update"...Yes
classpathThe classpath to be passed to the JVM running the tool. - The classpath may also be supplied as a nested element.No
serverUrlThe URL for the server where the component will be deployed.No
usernameThe user with privileges to deploy applications to the server.No
passwordThe password of the user with privileges to deploy - applications to the server.Yes
sourceA fully qualified path/filename of the component to be deployed. - This may be a EAR, JAR, WAR, or any other type that is supported by the server. - No
- -

Nested Elements

- -

The ejbdeploy task supports a nested <classpath> -element to set the classpath.

- -

Vendor-specific nested elements

- -

Also supported are nested vendor-specific elements.

- -

WebLogic element

-

-The WebLogic element contains additional parameters to run the -weblogic.deploy deployment tool. -

Valid actions for the tool are deploy, undeploy, -list, update, and delete. -

If the action is deploy or update, -the application and source attributes must be set. -If the action is undeploy or delete, -the application attribute must be set. -

- - - - - - - - - - - - - - - - - - - - - -
AttributeDescriptionRequired
applicationThis is the name of the application being deployedYes
componentThis is the component string for deployment targets. - It is in the form <component>:<target1>,<target2>... - Where component is the archive name (minus the .jar, .ear, .war - extension). Targets are the servers where the components will be deployedYes
debugIf set to true, additional information will be - printed during the deployment process.No
- - -

Examples

- -

This example shows the use of ejbdeploy to deploy a component to a WebLogic server:

- -
-    <ejbdeploy action="deploy"
-           serverUrl="t3://myserver:7001"
-           classpath="${classpath}"
-           username="${user.name}"
-           password="${user.password}"
-           source="${lib.dir}/ejb_myApp.ear">
-               <weblogic application="myapp"
-                   component="ejb_foobar:myserver,productionserver"
-                   debug="true"/>
-    </ejbdeploy>
-
- -

This example shows ejbdeploy being used to delete a component from a -WebLogic server:

- -
-    <ejbdeploy action="delete"
-           serverUrl="t3://myserver:7001"
-           classpath="${classpath}"
-           username="${user.name}"
-           password="${user.password}">
-               <weblogic application="myapp"/>
-    </ejbdeploy>
-
-
-

Copyright © 2002 Apache Software Foundation. All rights Reserved.

- - diff --git a/docs/manual/OptionalTasks/serverdeploy.html b/docs/manual/OptionalTasks/serverdeploy.html new file mode 100644 index 000000000..a268a2e59 --- /dev/null +++ b/docs/manual/OptionalTasks/serverdeploy.html @@ -0,0 +1,201 @@ + + + + +ServerDeploy Task + + + + + +

serverdeploy

+

Description:

+ +

The serverdeploy task is used to run a "hot" deployment tool for +vendor-specific J2EE server. The task requires nested elements which define +the attributes of the vendor-specific deployment tool being executed. +Vendor-specific deployment tools elements may enforce rules for which +attributes are required, depending on the tool. +

+ +

Parameters:

+ + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
actionThis is the action to be performed. For most cases this + will be "deploy". Some tools support additional actions, such as "delete", "list", + "undeploy", "update"...Yes
sourceA fully qualified path/filename of the component to be deployed. + This may be an .ear, .jar, .war, or any other type that is supported by the server. + Tool dependant
+ +

Nested Elements

+ +

The serverdeploy task supports a nested classpath element to set the classpath.

+ +

Vendor-specific nested elements

+ +

Parameters used for all tools:

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
classpathThe classpath to be passed to the JVM running the tool. + The classpath may also be supplied as a nested element.Tool dependant
serverThe address or URL for the server where the component will be deployed.Tool dependant
usernameThe user with privileges to deploy applications to the server.Tool dependant
passwordThe password of the user with privileges to deploy applications to the server.Tool dependant
+ +

Also supported are nested vendor-specific elements.

+ +

Generic element

+This element is provided for generic Java-based deployment tools. +The generic task accepts (but does not require) nested arg +and jvmarg elements. +A JVM will be spawned with the provided attributes. It is recommended +that a vendor-specific element be used over the generic one if at all +possible. +

The following attributes are supported by the generic element.

+

+ + + + + + + + + + + +
AttributeDescriptionRequired
classnameThis is the fully qualified classname of the Java based + deployment tool to execute.Yes
+

+ +

Nested Elements

+

The generic element supports nested <arg> and <jvmarg> elements.

+ +

Example

+ +

This example shows the use of generic deploy element to deploy a component +using a Java based deploy tool:

+ +
+    <serverdeploy action="deploy" source="${lib.dir}/ejb_myApp.ear">
+        <generic classname="com.yamato.j2ee.tools.deploy.DeployTool"
+            classpath="${classpath}"
+            username="${user.name}"
+            password="${user.password}">
+            <arg value="-component=WildStar"/>
+            <arg value="-force"/>
+            <jvmarg value="-ms64m"/>
+            <jvmarg value="-mx128m"/>
+        </generic>
+    </serverdeploy>
+
+ + +

WebLogic element

+

+The WebLogic element contains additional attributes to run the +weblogic.deploy deployment tool. +

Valid actions for the tool are deploy, undeploy, +list, update, and delete. +

If the action is deploy or update, +the application and source attributes must be set. +If the action is undeploy or delete, +the application attribute must be set. If the username +attribute is omitted, it defaults to "system". The password attribute is +required for all actions. +

+ + + + + + + + + + + + + + + + + + + + + +
AttributeDescriptionRequired
applicationThis is the name of the application being deployedYes
componentThis is the component string for deployment targets. + It is in the form <component>:<target1>,<target2>... + Where component is the archive name (minus the .jar, .ear, .war + extension). Targets are the servers where the components will be deployedYes
debugIf set to true, additional information will be + printed during the deployment process.No
+ + +

Examples

+ +

This example shows the use of serverdeploy to deploy a component to a WebLogic server:

+ +
+    <serverdeploy action="deploy" source="${lib.dir}/ejb_myApp.ear">
+        <weblogic application="myapp"
+            server="t3://myserver:7001"
+            classpath="${weblogic.home}/lib/weblogic.jar"
+            username="${user.name}"
+            password="${user.password}"
+            component="ejb_foobar:myserver,productionserver"
+            debug="true"/>
+    </serverdeploy>
+
+ +

This example shows serverdeploy being used to delete a component from a +WebLogic server:

+ +
+    <serverdeploy action="delete">/
+        <weblogic application="myapp"
+            server="t3://myserver:7001"
+            classpath="${weblogic.home}/lib/weblogic.jar"
+            username="${user.name}"
+            password="${user.password}"/>
+    </serverdeploy>
+
+
+

Copyright © 2002 Apache Software Foundation. All rights Reserved.

+ + diff --git a/docs/manual/optionaltasklist.html b/docs/manual/optionaltasklist.html index a3677e680..b9ce8c038 100644 --- a/docs/manual/optionaltasklist.html +++ b/docs/manual/optionaltasklist.html @@ -44,6 +44,7 @@ RenameExtensions
ReplaceRegExp
Rpm
+ServerDeploy
Script
Sound
SourceOffSite
diff --git a/src/main/org/apache/tools/ant/taskdefs/defaults.properties b/src/main/org/apache/tools/ant/taskdefs/defaults.properties index 9384085b2..b030e8283 100644 --- a/src/main/org/apache/tools/ant/taskdefs/defaults.properties +++ b/src/main/org/apache/tools/ant/taskdefs/defaults.properties @@ -151,7 +151,7 @@ soscheckout=org.apache.tools.ant.taskdefs.optional.sos.SOSCheckout soslabel=org.apache.tools.ant.taskdefs.optional.sos.SOSLabel echoproperties=org.apache.tools.ant.taskdefs.optional.EchoProperties splash=org.apache.tools.ant.taskdefs.optional.splash.SplashTask -ejbdeploy=org.apache.tools.ant.taskdefs.optional.ejb.EjbDeploy +serverdeploy=org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy # deprecated ant tasks (kept for back compatibility) starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/AbstractEjbHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/AbstractEjbHotDeploymentTool.java deleted file mode 100644 index 83c4ba7cf..000000000 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/AbstractEjbHotDeploymentTool.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.taskdefs.optional.ejb; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; - -/** - * Abstract class to support vendor-specific hot deployment tools. - * This class will validate boilerplate attributes. - * - * Subclassing this class for a vendor specific tool involves the - * following. - *
    - *
  1. Implement the getClassName() method to supply the - * super-task class name of the vendor specific deployment tool to run. - *
  2. Implement the getArguments() method to supply the - * super-task the command line to pass for the vendor specific deployment - * tool. - *
  3. Implement the isActionValid() method to insure the - * action supplied as the "action" attribute of EjbDeploy is valid. - *
  4. Implement the validateAttributes() method to insure - * all required attributes are supplied, and are in the correct format. - *
  5. Add a create<TOOL> method to the EjbDeploy - * class. This method will be called when Ant encounters a - * create<TOOL> task nested in the - * ejbdeploy task. - * - * @author Christopher A. Longo - cal@cloud9.net - * - * @see EjbHotDeploymentTool - * @see EjbDeploy - */ -public abstract class AbstractEjbHotDeploymentTool - extends Task - implements EjbHotDeploymentTool -{ - /** The super-task **/ - private EjbDeploy deploy; - - /** - * Constructor. - * @param deploy The super-task which wraps this one. - */ - public AbstractEjbHotDeploymentTool(EjbDeploy deploy) { - this.deploy = deploy; - } - - /** - * Returns the class name of the weblogic.deploy tool to the super-task. - *

    This is called by the super-task, EjbDeploy. - *

    Subclasses should return the fully qualified class name of the - * vendor tool to run. IE: "com.foobar.tools.DeployTool" - * @return A String representing the classname of the deployment tool to run - */ - public abstract String getClassName(); - - /** - * Returns a String containing the runtime commandline arguments - * of the deployment tool. - *

    Subclasses should return the appropriate string from that - * vendor's tool. IE: "-url=http://myserver:31337 -user=foo -passsword=bar" - * @return a String containing the runtime commandline arguments - * of the deployment tool. - */ - public abstract String getArguments(); - - /** - * Validates the passed in attributes. - * Subclasses should chain to this super-method to insure - * validation of boilerplate attributes. - *

    Only the "action" and "password" attributes are required in the - * base class. Subclasses should check attributes accordingly. - * @exception BuildException if the attributes are invalid or incomplete - */ - public void validateAttributes() throws BuildException { - String action = deploy.getAction(); - - if(action == null) - throw new BuildException("The \"action\" attribute must be set"); - - if(!isActionValid()) - throw new BuildException("Invalid action \"" + action + "\" passed"); - - if(deploy.getPassword() == null) - throw new BuildException("The WebLogic system password must be set"); - } - - /** - * Determines if the "action" attribute defines a valid action. - *

    Subclasses should determine if the action passed in is - * supported by the vendor's deployment tool. - *

    Actions may by "deploy", "delete", etc... It all depends - * on the tool. - * @return true if the "action" attribute is valid, false if not. - */ - protected abstract boolean isActionValid(); - - /** - * Returns the super-task. - * @return An EjbDeploy object representing the super-task. - */ - protected EjbDeploy getDeploy() { - return deploy; - } -} diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java new file mode 100644 index 000000000..7c478aebc --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/AbstractHotDeploymentTool.java @@ -0,0 +1,232 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.j2ee; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy; + +/** + * Abstract class to support vendor-specific hot deployment tools. + * This class will validate boilerplate attributes. + * + * Subclassing this class for a vendor specific tool involves the + * following. + *

    1. Implement the isActionValid() method to insure the + * action supplied as the "action" attribute of ServerDeploy is valid. + *
    2. Implement the validateAttributes() method to insure + * all required attributes are supplied, and are in the correct format. + *
    3. Add a add<TOOL> method to the ServerDeploy + * class. This method will be called when Ant encounters a + * add<TOOL> task nested in the + * serverdeploy task. + *
    4. Define the deploy method. This method should perform + * whatever task it takes to hot-deploy the component. IE: spawn a JVM and + * run class, exec a native executable, run Java code... + * + * @author Christopher A. Longo - cal@cloud9.net + * + * @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy + */ +public abstract class AbstractHotDeploymentTool implements HotDeploymentTool +{ + /** The parent task **/ + private ServerDeploy task; + + /** The classpath passed to the JVM on execution. **/ + private Path classpath; + + /** The username for the deployment server. **/ + private String userName; + + /** The password for the deployment server. **/ + private String password; + + /** The address of the deployment server **/ + private String server; + + /** + * Add a classpath. Used to handle the nested classpath + * element. + * @return A Path object representing the classpath to be used. + */ + public Path createClasspath() { + if(classpath == null) + classpath = new Path(task.getProject()); + + return classpath.createPath(); + } + + /** + * Determines if the "action" attribute defines a valid action. + *

      Subclasses should determine if the action passed in is + * supported by the vendor's deployment tool. + *

      Actions may by "deploy", "delete", etc... It all depends + * on the tool. + * @return true if the "action" attribute is valid, false if not. + */ + protected abstract boolean isActionValid(); + + /** + * Validates the passed in attributes. + * Subclasses should chain to this super-method to insure + * validation of boilerplate attributes. + *

      Only the "action" attribute is required in the + * base class. Subclasses should check attributes accordingly. + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. + */ + public void validateAttributes() throws BuildException { + if (task.getAction() == null) + throw new BuildException("The \"action\" attribute must be set"); + + if (!isActionValid()) + throw new BuildException("Invalid action \"" + task.getAction() + "\" passed"); + + if (classpath == null) + throw new BuildException("The classpath attribute must be set"); + } + + /** + * Perform the actual deployment.
      + * It's up to the subclasses to implement the actual behavior. + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. + */ + public abstract void deploy() throws BuildException; + + /** + * Sets the parent task. + * @param task a ServerDeploy object representing the parent task. + */ + public void setTask(ServerDeploy task) { + this.task = task; + } + + /** + * Returns the task field, a ServerDeploy object. + * @return An ServerDeploy representing the parent task. + */ + protected ServerDeploy getTask() { + return task; + } + + /** + * gets the classpath field. + * @return A Path representing the "classpath" attribute. + */ + public Path getClasspath() { + return classpath; + } + + /** + * Sets the classpath field. + * This is a required attribute. + * @param classpath A Path object representing the "classpath" attribute. + */ + public void setClasspath(Path classpath) { + this.classpath = classpath; + } + + /** + * Returns the userName field. + * @return A String representing the "userName" attribute. + */ + public String getUserName() { + return userName; + } + + /** + * Sets the userName field. + * This is a not required attribute. + * @param userName A String representing the "userName" attribute. + */ + public void setUserName(String userName) { + this.userName = userName; + } + + /** + * Returns the password field. + * @return A String representing the "password" attribute. + */ + public String getPassword() { + return password; + } + + /** + * Set the password field. + * This is a not required attribute. + * @param password A String representing the "password" attribute. + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * Returns the server field. + * @return A String representing the "server" attribute. + */ + public String getServer() { + return server; + } + + /** + * Sets the server field. + * This is not a required attribute. + * @param server A String representing the "server" attribute. + */ + public void setServer(String server) { + this.server = server; + } +} diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java new file mode 100644 index 000000000..6b8ed2c70 --- /dev/null +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java @@ -0,0 +1,163 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.j2ee; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.types.Commandline; +import org.apache.tools.ant.taskdefs.Java; +import org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy; +import org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool; + +/** + * A generic tool for J2EE server hot deployment. + *

      The simple implementation spawns a JVM with the supplied + * class name, jvm args, and arguments. + * + * @author Christopher A. Longo - cal@cloud9.net + * + * @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy + */ +public class GenericHotDeploymentTool extends AbstractHotDeploymentTool +{ + /** A Java task used to run the deployment tool **/ + private Java java; + + /** The fully qualified class name of the deployment tool **/ + private String className; + + /** List of valid actions **/ + private static final String[] VALID_ACTIONS = { ACTION_DEPLOY }; + + /** + * Creates a nested arg element. + * @return A Commandline.Argument object representing the + * command line argument being passed when the deployment + * tool is run. IE: "-user=mark", "-password=venture"... + */ + public Commandline.Argument createArg() { + return java.createArg(); + } + + /** + * Creates a nested jvmarg element. + * Creates a nested arg element. + * @return A Commandline.Argument object representing the + * JVM command line argument being passed when the deployment + * tool is run. IE: "-ms64m", "-mx128m"... + */ + public Commandline.Argument createJvmarg() { + return java.createJvmarg(); + } + + /** + * Determines if the "action" attribute defines a valid action. + *

      Subclasses should determine if the action passed in is + * supported by the vendor's deployment tool. + * For this generic implementation, the only valid action is "deploy" + * @return true if the "action" attribute is valid, false if not. + */ + protected boolean isActionValid() { + return(getTask().getAction().equals(VALID_ACTIONS[0])); + } + + /** + * Sets the parent task. + * @param task An ServerDeploy object representing the parent task. + */ + public void setTask(ServerDeploy task) { + super.setTask(task); + java = (Java)task.getProject().createTask("java"); + } + + /** + * Perform the actual deployment.
      + * For this generic implementation, a JVM is spawned using the + * supplied classpath, classname, JVM args, and command line arguments. + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. + */ + public void deploy() throws BuildException { + java.setClassname(className); + java.setClasspath(getClasspath()); + java.setFork(true); + java.setFailonerror(true); + java.execute(); + } + + /** + * Validates the passed in attributes. + * Ensures the className and arguments attribute have been set. + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. + */ + public void validateAttributes() throws BuildException { + super.validateAttributes(); + + if(className == null) + throw new BuildException("The classname attribute must be set"); + } + + /** + * Sets the className field. + *

      The className is the name of the class to execute to perfom + * deployment. IE: "com.foobar.tools.deploy.DeployTool" + * This is a required attribute. + * @param className The fully qualified class name of the class + * to perform deployment. + */ + public void setClassName(String className) { + this.className = className; + } +} diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/HotDeploymentTool.java similarity index 69% rename from src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbHotDeploymentTool.java rename to src/main/org/apache/tools/ant/taskdefs/optional/j2ee/HotDeploymentTool.java index 1ca6d28b0..b276e3132 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbHotDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/HotDeploymentTool.java @@ -51,47 +51,51 @@ * information on the Apache Software Foundation, please see * . */ -package org.apache.tools.ant.taskdefs.optional.ejb; +package org.apache.tools.ant.taskdefs.optional.j2ee; import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy; /** * An interface for vendor-specific "hot" deployment tools. * * @author Christopher A. Longo - cal@cloud9.net * - * @see AbstractEjbHotDeploymentTool - * @see EjbDeploy + * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy */ -public interface EjbHotDeploymentTool +public interface HotDeploymentTool { - /** - * Returns the class name of the weblogic.deploy tool to the super-task. - *

      This is called by the super-task, EjbDeploy. - *

      Subclasses should return the fully qualified class name of the - * vendor tool to run. IE: "com.foobar.tools.DeployTool" - * @return A String representing the classname of the deployment tool to run - */ - public String getClassName(); + /** The delete action String **/ + public static final String ACTION_DELETE = "delete"; + + /** The deploy action String **/ + public static final String ACTION_DEPLOY = "deploy"; + + /** The list action String **/ + public static final String ACTION_LIST = "list"; + + /** The undeploy action String **/ + public static final String ACTION_UNDEPLOY = "undeploy"; + + /** The update action String **/ + public static final String ACTION_UPDATE = "update"; /** * Validates the passed in attributes. - *

      The rules are: - *

      1. If action is "deploy" or "update" the "application" and "source" - * attributes must be supplied. - *
      2. If action is "delete" or "undeploy" the "application" attribute must - * be supplied. - * @exception BuildException if the attributes are invalid or incomplete + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. */ public void validateAttributes() throws BuildException; /** - * Returns a String containing the runtime commandline arguments - * of the deployment tool. - *

        Subclasses should return the appropriate string from that - * vendor's tool. IE: "-url=http://myserver:31337 -user=foo -passsword=bar" - * @return a String containing the runtime commandline arguments - * of the deployment tool. + * Perform the actual deployment.
        + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. + */ + public void deploy() throws BuildException; + + /** + * Sets the parent task. + * @param task A ServerDeploy object representing the parent task. */ - public String getArguments() throws BuildException; + public void setTask(ServerDeploy task); } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbDeploy.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java similarity index 54% rename from src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbDeploy.java rename to src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java index ffefcaa7d..a90b77230 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbDeploy.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/ServerDeploy.java @@ -52,61 +52,38 @@ * . */ -package org.apache.tools.ant.taskdefs.optional.ejb; +package org.apache.tools.ant.taskdefs.optional.j2ee; import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; -import org.apache.tools.ant.taskdefs.Java; -import org.apache.tools.ant.types.Path; /** - * A task to support "hot" deployment tools for J2EE servers. + * A task to support hot deployment tools for J2EE servers. * * This class is used as a framework for the creation of vendor specific - * "hot" deployment tools. + * hot deployment tools. * * @author Christopher A. Longo - cal@cloud9.net * - * @see EjbHotDeploymentTool - * @see AbstractEjbHotDeploymentTool - * @see WebLogicHotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.GenericHotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.WebLogicHotDeploymentTool */ -public class EjbDeploy extends Task +public class ServerDeploy extends Task { /** The action to be performed. IE: "deploy", "delete", etc... **/ private String action; - /** The classpath passed to the JVM on execution. **/ - private Path classpath; - - /** The username for the deployment server. **/ - private String userName; - - /** The password for the deployment server. **/ - private String password; - - /** The URL of the deployment server **/ - private String serverUrl; - /** The source (fully-qualified path) to the component being deployed **/ private File source; /** The vendor specific tool for deploying the component **/ - private EjbHotDeploymentTool vendorTool; - - /** - * Creates a classpath. Used to handle the nested classpath - * element. - * @return A Path object representing the classpath to be used. - */ - public Path createClasspath() { - if(classpath == null) - classpath = new Path(project); - - return classpath.createPath(); - } + private ArrayList vendorTools = new ArrayList(); /////////////////////////////////////////////////////////////////////////// // @@ -114,41 +91,48 @@ public class EjbDeploy extends Task // /////////////////////////////////////////////////////////////////////////// + /** + * Creates a generic deployment tool. + *

        Ant calls this method on creation to handle embedded "generic" elements + * in the ServerDeploy task. + * @param tool An instance of GenericHotDeployment tool, passed in by Ant. + */ + public void addGeneric(GenericHotDeploymentTool tool) { + tool.setTask(this); + vendorTools.add(tool); + } + /** * Creates a WebLogic deployment tool, for deployment to WebLogic servers. - *

        Ant calls this method on creation to handle embedded "weblogic" tags - * in the EjbDeploy task. - * @return An instance of WebLogicHotDeployment tool. + *

        Ant calls this method on creation to handle embedded "weblogic" elements + * in the ServerDeploy task. + * @param tool An instance of WebLogicHotDeployment tool, passed in by Ant. */ - public WebLogicHotDeploymentTool createWeblogic() { - WebLogicHotDeploymentTool weblogic = new WebLogicHotDeploymentTool(this); - vendorTool = (EjbHotDeploymentTool)weblogic; - return weblogic; + public void addWeblogic(WebLogicHotDeploymentTool tool) { + tool.setTask(this); + vendorTools.add(tool); } + /////////////////////////////////////////////////////////////////////////// + // + // Execute method + // + /////////////////////////////////////////////////////////////////////////// + /** * Execute the task. - *

        This will fork a JVM and run the vendor-specific deployment tool. - * The process will fail if the tool returns an error. - * @exception BuildException if the attributes are invalid or incomplete + *

        This method calls the deploy() method on each of the vendor-specific tools + * in the vendorTools collection. This performs the actual + * process of deployment on each tool. + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete, or + * a failure occurs in the deployment process. */ public void execute() throws BuildException { - if (vendorTool == null) { - throw new BuildException("No vendor tool specified"); + for (Iterator iterator = vendorTools.iterator(); iterator.hasNext();) { + HotDeploymentTool tool = (HotDeploymentTool) iterator.next(); + tool.validateAttributes(); + tool.deploy(); } - - vendorTool.validateAttributes(); - - Java deploy = (Java)project.createTask("java"); - deploy.setFork(true); - deploy.setFailonerror(true); - deploy.setClasspath(classpath); - - deploy.setClassname(vendorTool.getClassName()); - deploy.createArg().setLine(vendorTool.getArguments()); - deploy.execute(); - - deploy = null; } /////////////////////////////////////////////////////////////////////////// @@ -174,74 +158,6 @@ public class EjbDeploy extends Task this.action = action; } - /** - * gets the classpath field. - * @return A Path representing the "classpath" attribute. - */ - public Path getClasspath() { - return classpath; - } - - /** - * Sets the classpath field. - * This is not a required attribute. - * @param classpath A Path object representing the "classpath" attribute. - */ - public void setClasspath(Path classpath) { - this.classpath = classpath; - } - - /** - * Returns the userName field. - * @return A String representing the "userName" attribute. - */ - public String getUserName() { - return userName; - } - - /** - * Sets the userName field. - * This is not a required attribute. - * @param userName A String representing the "userName" attribute. - */ - public void setUserName(String userName) { - this.userName = userName; - } - - /** - * Returns the password field. - * @return A String representing the "password" attribute. - */ - public String getPassword() { - return password; - } - - /** - * Set the password field. - * This is a required attribute. - * @param A String representing the "password" attribute. - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * Returns the serverUrl field. - * @return A String representing the "serverUrl" attribute. - */ - public String getServerUrl() { - return serverUrl; - } - - /** - * Sets the serverUrl field. - * This is not a required attribute. - * @param serverUrl A String representing the "serverUrl" attribute. - */ - public void setServerUrl(String serverUrl) { - this.serverUrl = serverUrl; - } - /** * Returns the source field (the path/filename of the component to be * deployed. @@ -254,10 +170,11 @@ public class EjbDeploy extends Task /** * Sets the source field (the path/filename of the component to be * deployed. - * This is not a required attribute. - * @param A String representing the "source" attribute. + * This is not a required attribute. + * @param source String representing the "source" attribute. */ public void setSource(File source) { this.source = source; } } + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebLogicHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java similarity index 74% rename from src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebLogicHotDeploymentTool.java rename to src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java index 772feed11..c8600b6e8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebLogicHotDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java @@ -52,9 +52,13 @@ * . */ -package org.apache.tools.ant.taskdefs.optional.ejb; +package org.apache.tools.ant.taskdefs.optional.j2ee; import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.taskdefs.Java; +import org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy; +import org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool; +import org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool; /** * An Ant wrapper task for the weblogic.deploy tool. This is used to @@ -62,35 +66,17 @@ import org.apache.tools.ant.BuildException; * This is not the same as creating the application archive. * This task assumes the archive (EAR, JAR, or WAR) file has been * assembled and is supplied as the "source" attribute. - *

        - * In the end, this task assembles the commadline parameters - * to run the weblogic.deploy tool. + *

        In the end, this task assembles the commadline parameters + * and runs the weblogic.deploy tool in a seperate JVM. * * @author Christopher A. Longo - cal@cloud9.net * - * @see EjbHotDeploymentTool - * @see AbstractEjbHotDeploymentTool - * @see EjbDeploy + * @see org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool + * @see org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy */ -public class WebLogicHotDeploymentTool - extends AbstractEjbHotDeploymentTool - implements EjbHotDeploymentTool +public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool implements HotDeploymentTool { - /** The delete action String **/ - public static final String ACTION_DELETE = "delete"; - - /** The deploy action String **/ - public static final String ACTION_DEPLOY = "deploy"; - - /** The list action String **/ - public static final String ACTION_LIST = "list"; - - /** The undeploy action String **/ - public static final String ACTION_UNDEPLOY = "undeploy"; - - /** The update action String **/ - public static final String ACTION_UPDATE = "update"; - /** The classname of the tool to run **/ private static final String WEBLOGIC_DEPLOY_CLASS_NAME = "weblogic.deploy"; @@ -99,29 +85,30 @@ public class WebLogicHotDeploymentTool {ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE}; /** Represents the "-debug" flag from weblogic.deploy **/ - public boolean debug; + private boolean debug; /** The application name that is being deployed **/ - public String application; + private String application; /** The component name:target(s) for the "-component" argument of weblogic.deploy **/ - public String component; - - /** - * Constructor - * @param deploy - The super-task which wraps this task - */ - public WebLogicHotDeploymentTool(EjbDeploy deploy) { - super(deploy); - } + private String component; /** - * Returns the class name of the weblogic.deploy tool to the super-task. - *

        This is called by the super-task, EjbDeploy. - * @return A String representing the classname of the deployment tool to run + * Perform the actual deployment.
        + * For this implementation, a JVM is spawned and the weblogic.deploy + * tools is executed. + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. */ - public String getClassName() { - return WEBLOGIC_DEPLOY_CLASS_NAME; + public void deploy() + { + Java java = (Java)getTask().getProject().createTask("java"); + java.setFork(true); + java.setFailonerror(true); + java.setClasspath(getClasspath()); + + java.setClassname(WEBLOGIC_DEPLOY_CLASS_NAME); + java.createArg().setLine(getArguments()); + java.execute(); } /** @@ -131,30 +118,28 @@ public class WebLogicHotDeploymentTool * attributes must be supplied. *

      3. If action is "delete" or "undeploy" the "application" attribute must * be supplied. - * @exception BuildException if the attributes are invalid or incomplete + * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete */ public void validateAttributes() throws BuildException { super.validateAttributes(); - String action = getDeploy().getAction(); + String action = getTask().getAction(); + + // check that the password has been set + if((getPassword() == null)) + throw new BuildException("The password attribute must be set."); // check for missing application on deploy & update - if((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) - && application == null) - throw new BuildException( - "The application attribute must be set if action = " + action); + if((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) && application == null) + throw new BuildException("The application attribute must be set if action = " + action); // check for missing source on deploy & update - if((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) - && getDeploy().getSource() == null) - throw new BuildException( - "The source attribute must be set if action = " + action); + if((action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) && getTask().getSource() == null) + throw new BuildException("The source attribute must be set if action = " + action); // check for missing application on delete & undeploy - if((action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) - && application == null) - throw new BuildException( - "The application attribute must be set if action = " + action); + if((action.equals(ACTION_DELETE) || action.equals(ACTION_UNDEPLOY)) && application == null) + throw new BuildException("The application attribute must be set if action = " + action); } /** @@ -163,7 +148,7 @@ public class WebLogicHotDeploymentTool * @return A String containing the arguments for the weblogic.deploy tool. */ public String getArguments() throws BuildException { - String action = getDeploy().getAction(); + String action = getTask().getAction(); String args = null; if(action.equals(ACTION_DEPLOY) || action.equals(ACTION_UPDATE)) @@ -184,7 +169,7 @@ public class WebLogicHotDeploymentTool protected boolean isActionValid() { boolean valid = false; - String action = getDeploy().getAction(); + String action = getTask().getAction(); for(int i = 0; i < VALID_ACTIONS.length; i++) { if(action.equals(VALID_ACTIONS[i])) { @@ -203,22 +188,21 @@ public class WebLogicHotDeploymentTool * The action-specific build methods will append to this StringBuffer. */ protected StringBuffer buildArgsPrefix() { - EjbDeploy deploy = getDeploy(); - + ServerDeploy task = getTask(); // constructs the "-url -debug " portion // of the commmand line return new StringBuffer(1024) - .append((deploy.getServerUrl() != null) - ? "-url " + deploy.getServerUrl() - : "") + .append((getServer() != null) + ? "-url " + getServer() + : "") .append(" ") .append(debug ? "-debug " : "") - .append((deploy.getUserName() != null) - ? "-username " + deploy.getUserName() - : "") + .append((getUserName() != null) + ? "-username " + getUserName() + : "") .append(" ") - .append(deploy.getAction()).append(" ") - .append(deploy.getPassword()).append(" "); + .append(task.getAction()).append(" ") + .append(getPassword()).append(" "); } /** @@ -229,7 +213,7 @@ public class WebLogicHotDeploymentTool protected String buildDeployArgs() { String args = buildArgsPrefix() .append(application).append(" ") - .append(getDeploy().getSource()) + .append(getTask().getSource()) .toString(); if(component != null) @@ -260,7 +244,7 @@ public class WebLogicHotDeploymentTool /** * Sets the debug field. - *

        This attribute is not a required attribute. + *

        This is not a required attribute. * @param debug A boolean representing weblogic.deploy "-debug" flag. */ public void setDebug(boolean debug) { @@ -269,7 +253,7 @@ public class WebLogicHotDeploymentTool /** * Sets the application field. - *

        This attribute is a required attribute. + *

        This is a required attribute. * @param application A String representing the application portion of the * weblogic.deploy command line. */