Code and docs diffs are attached. These is also a new java file. See
next message.
Index: ejbdeploy.html
===================================================================
RCS file: /home/cvspublic/jakarta-ant/docs/manual/OptionalTasks/ejbdeploy.html,v
retrieving revision 1.1
diff -r1.1 ejbdeploy.html
15,17c15,18
< 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.
---
> 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.
38c39
< <td>No</td>
---
> <td>Tool dependant</td>
41,43c42,44
< <td valign="top">serverUrl</td>
< <td valign="top">The URL for the server where the component will be
deployed.</td>
< <td>No</td>
---
> <td valign="top">server</td>
> <td valign="top">The address or URL for the server where the component
> will be deployed.</td>
> <td>Tool dependant</td>
48c49
< <td>No</td>
---
> <td>Tool dependant</td>
52,54c53,54
< <td valign="top">The password of the user with privileges to deploy
< applications to the server.</td>
< <td>Yes</td>
---
> <td valign="top">The password of the user with privileges to deploy
> applications to the server.</td>
> <td>Tool dependant</td>
59c59
< This may be a EAR, JAR, WAR, or any other type that is supported by the
server.
---
> This may be an .ear, .jar, .war, or any other type that is supported by
> the server.
61c61
< <td>No</td>
---
> <td>Tool dependant</td>
67,68c67
< <p>The ejbdeploy task supports a nested <classpath>
< element to set the classpath.</p>
---
> <p>The ejbdeploy task supports a nested <code>classpath</code> element to set
> the classpath.</p>
73a73,120
> <h3>Generic element</h3>
> This element is provided for generic Java-based deployment tools.
> The generic task accepts (but does not require) nested <code>arg</code>
> and <code>jvmarg</code> 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.
> <p>The following attributes are supported by the generic element.</p>
> <p>
> <table border="1" cellpadding="2" cellspacing="0">
> <tr>
> <td valign="top"><b>Attribute</b></td>
> <td valign="top"><b>Description</b></td>
> <td valign="top"><b>Required</b></td>
> </tr>
> <tr>
> <td valign="top">classname</td>
> <td valign="top">This is the fully qualified classname of the Java based
> deployment tool to execute.</td>
> <td>Yes</td>
> </tr>
> </table>
> </p>
>
> <h3>Nested Elements</h3>
> <p>The generic element supports nested <arg> and <jvmarg>
> elements.</p>
>
> <h3>Example</h3>
>
> <p>This example shows the use of generic deploy element to deploy a component
> using a Java based deploy tool:</p>
>
> <pre>
> <ejbdeploy action="deploy"
> classpath="${classpath}"
> username="${user.name}"
> password="${user.password}"
> source="${lib.dir}/ejb_myApp.ear">
> <generic
> classname="com.yamato.ejb.tools.deploy.DeployTool">
> <arg value="-component=WildStar"/>
> <arg value="-force"/>
> <jvmarg value="-ms64m"/>
> <jvmarg value="-mx128m"/>
> </generic>
> </ejbdeploy>
> </pre>
>
>
76c123
< The WebLogic element contains additional parameters to run the
---
> The WebLogic element contains additional attributes to run the
83c130,132
< the <code>application</code> attribute must be set.
---
> the <code>application</code> attribute must be set. If the
> <code>username</code>
> attribute is omitted, it defaults to "system". The <code>password</code>
> attribute is
> required for all actions.
119c168
< serverUrl="t3://myserver:7001"
---
> server="t3://myserver:7001"
135c184
< serverUrl="t3://myserver:7001"
---
> server="t3://myserver:7001"Index: WebLogicHotDeploymentTool.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebLogicHotDeploymentTool.java,v
retrieving revision 1.1
diff -r1.1 WebLogicHotDeploymentTool.java
57a58
> import org.apache.tools.ant.taskdefs.Java;
65,67c66,67
< * <p>
< * In the end, this task assembles the commadline parameters
< * to run the weblogic.deploy tool.
---
> * <p>In the end, this task assembles the commadline parameters
> * and runs the weblogic.deploy tool in a seperate JVM.
75,77c75
< public class WebLogicHotDeploymentTool
< extends AbstractEjbHotDeploymentTool
< implements EjbHotDeploymentTool
---
> public class WebLogicHotDeploymentTool extends AbstractEjbHotDeploymentTool
> implements EjbHotDeploymentTool
110,124c108,117
< /**
< * Constructor
< * @param deploy - The super-task which wraps this task
< */
< public WebLogicHotDeploymentTool(EjbDeploy deploy) {
< super(deploy);
< }
<
< /**
< * Returns the class name of the weblogic.deploy tool to the super-task.
< * <p>This is called by the super-task, EjbDeploy.
< * @return A String representing the classname of the deployment tool to
run
< */
< 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(getTask().getClasspath());
>
> java.setClassname(WEBLOGIC_DEPLOY_CLASS_NAME);
> java.createArg().setLine(getArguments());
> java.execute();
139c132,136
< String action = getDeploy().getAction();
---
> String action = getTask().getAction();
>
> // check that the password has been set
> if((getTask().getPassword() == null))
> throw new BuildException("The password attribute must be set.");
142,145c139,140
< 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);
148,151c143,144
< 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);
154,157c147,148
< 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);
166c157
< String action = getDeploy().getAction();
---
> String action = getTask().getAction();
187c178
< String action = getDeploy().getAction();
---
> String action = getTask().getAction();
206,207c197
< EjbDeploy deploy = getDeploy();
<
---
> EjbDeploy task = getTask();
211,213c201,203
< .append((deploy.getServerUrl() != null)
< ? "-url " + deploy.getServerUrl()
< : "")
---
> .append((task.getServer() != null)
> ? "-url " + task.getServer()
> : "")
216,218c206,208
< .append((deploy.getUserName() != null)
< ? "-username " + deploy.getUserName()
< : "")
---
> .append((task.getUserName() != null)
> ? "-username " + task.getUserName()
> : "")
220,221c210,211
< .append(deploy.getAction()).append(" ")
< .append(deploy.getPassword()).append(" ");
---
> .append(task.getAction()).append(" ")
> .append(task.getPassword()).append(" ");
232c222
< .append(getDeploy().getSource())
---
> .append(getTask().getSource())
263c253
< * <p>This attribute is not a required attribute.
---
> * <p>This is not a required attribute.
272c262
< * <p>This attribute is a required attribute.
---
> * <p>This is a required attribute.
Index: EjbHotDeploymentTool.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbHotDeploymentTool.java,v
retrieving revision 1.1
diff -r1.1 EjbHotDeploymentTool.java
69,73c69,70
< * Returns the class name of the weblogic.deploy tool to the super-task.
< * <p>This is called by the super-task, EjbDeploy.
< * <p>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
---
> * Validates the passed in attributes.
> * @exception BuildException if the attributes are invalid or incomplete.
75c72
< public String getClassName();
---
> public void validateAttributes() throws BuildException;
78,84c75,76
< * Validates the passed in attributes.
< * <p>The rules are:
< * <ol><li>If action is "deploy" or "update" the "application" and
"source"
< * attributes must be supplied.
< * <li>If action is "delete" or "undeploy" the "application" attribute
must
< * be supplied.
< * @exception BuildException if the attributes are invalid or incomplete
---
> * Perform the actual deployment.<br>
> * @exception BuildException if the attributes are invalid or incomplete.
86c78
< public void validateAttributes() throws BuildException;
---
> public void deploy() throws BuildException;
89,94c81,82
< * Returns a String containing the runtime commandline arguments
< * of the deployment tool.
< * <p>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.
---
> * Sets the parent task.
> * @param task An EjbDeploy object representing the parent task.
96c84
< public String getArguments() throws BuildException;
---
> public void setTask(EjbDeploy task);
Index: EjbDeploy.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbDeploy.java,v
retrieving revision 1.1
diff -r1.1 EjbDeploy.java
57a58,59
> import java.util.ArrayList;
> import java.util.Iterator;
61d62
< import org.apache.tools.ant.taskdefs.Java;
73a75
> * @see GenericHotDeploymentTool
91c93
< private String serverUrl;
---
> private String server;
97c99
< private EjbHotDeploymentTool vendorTool;
---
> private ArrayList vendorTools = new ArrayList();
100c102
< * Creates a classpath. Used to handle the nested classpath
---
> * Add a classpath. Used to handle the nested classpath
117a120,130
> * Creates a generic deployment tool.
> * <p>Ant calls this method on creation to handle embedded "generic"
> elements
> * in the EjbDeploy task.
> * @param tool An instance of GenericHotDeployment tool, passed in by
> Ant.
> */
> public void addGeneric(GenericHotDeploymentTool tool) {
> tool.setTask(this);
> vendorTools.add(tool);
> }
>
> /**
119c132
< * <p>Ant calls this method on creation to handle embedded "weblogic"
tags
---
> * <p>Ant calls this method on creation to handle embedded "weblogic"
> elements
121c134
< * @return An instance of WebLogicHotDeployment tool.
---
> * @param tool An instance of WebLogicHotDeployment tool, passed in by
> Ant.
123,126c136,138
< public WebLogicHotDeploymentTool createWeblogic() {
< WebLogicHotDeploymentTool weblogic = new
WebLogicHotDeploymentTool(this);
< vendorTool = (EjbHotDeploymentTool)weblogic;
< return weblogic;
---
> public void addWeblogic(WebLogicHotDeploymentTool tool) {
> tool.setTask(this);
> vendorTools.add(tool);
128a141,146
>
> ///////////////////////////////////////////////////////////////////////////
> //
> // Execute method
> //
>
> ///////////////////////////////////////////////////////////////////////////
>
131,133c149,153
< * <p>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
---
> * <p>This method calls the deploy() method on each of the
> vendor-specific tools
> * in the <code>vendorTools</code> collection. This performs the actual
> * process of deployment on each tool.
> * @exception BuildException if the attributes are invalid or
> incomplete, or
> * a failure occurs in the deployment process.
136,137c156,159
< if (vendorTool == null) {
< throw new BuildException("No vendor tool specified");
---
> for (Iterator iterator = vendorTools.iterator(); iterator.hasNext();)
> {
> EjbHotDeploymentTool tool = (EjbHotDeploymentTool)
> iterator.next();
> tool.validateAttributes();
> tool.deploy();
139,151d160
<
< 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;
187c196
< * This is not a required attribute.
---
> * This is a required attribute.
204c213
< * This is not a required attribute.
---
> * This is a <b>not</b> required attribute.
221,222c230,231
< * This is a required attribute.
< * @param A String representing the "password" attribute.
---
> * This is a <b>not</b> required attribute.
> * @param password A String representing the "password" attribute.
229c238
< * Returns the serverUrl field.
---
> * Returns the server field.
232,233c241,242
< public String getServerUrl() {
< return serverUrl;
---
> public String getServer() {
> return server;
237,239c246,248
< * Sets the serverUrl field.
< * This is not a required attribute.
< * @param serverUrl A String representing the "serverUrl" attribute.
---
> * Sets the server field.
> * This is <b>not</b> a required attribute.
> * @param server A String representing the "serverUrl" attribute.
241,242c250,251
< public void setServerUrl(String serverUrl) {
< this.serverUrl = serverUrl;
---
> public void setServer(String server) {
> this.server = server;
257,258c266,267
< * This is not a required attribute.
< * @param A String representing the "source" attribute.
---
> * This is <b>not</b> a required attribute.
> * @param source String representing the "source" attribute.
263a273
>
Index: AbstractEjbHotDeploymentTool.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/AbstractEjbHotDeploymentTool.java,v
retrieving revision 1.1
diff -r1.1 AbstractEjbHotDeploymentTool.java
58d57
< import org.apache.tools.ant.Task;
66,72c65
< * <ol>
< * <li>Implement the <code>getClassName()</code> method to supply the
< * super-task class name of the vendor specific deployment tool to run.
< * <li>Implement the <code>getArguments()</code> method to supply the
< * super-task the command line to pass for the vendor specific deployment
< * tool.
< * <li>Implement the <code>isActionValid()<code> method to insure the
---
> * <ol><li>Implement the <code>isActionValid()<code> method to insure the
76c69
< * <li>Add a <code>create<TOOL></code> method to the EjbDeploy
---
> * <li>Add a <code>add<TOOL></code> method to the EjbDeploy
78c71
< * <code>create<TOOL></code> task nested in the
---
> * <code>add<TOOL></code> task nested in the
79a73,75
> * <li>Define the <code>deploy</code> 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...
86,88c82
< public abstract class AbstractEjbHotDeploymentTool
< extends Task
< implements EjbHotDeploymentTool
---
> public abstract class AbstractEjbHotDeploymentTool implements
> EjbHotDeploymentTool
90,91c84,85
< /** The super-task **/
< private EjbDeploy deploy;
---
> /** The parent task **/
> private EjbDeploy task;
94,116c88,93
< * 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.
< * <p>This is called by the super-task, EjbDeploy.
< * <p>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.
< * <p>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.
---
> * Determines if the "action" attribute defines a valid action.
> * <p>Subclasses should determine if the action passed in is
> * supported by the vendor's deployment tool.
> * <p>Actions may by "deploy", "delete", etc... It all depends
> * on the tool.
> * @return true if the "action" attribute is valid, false if not.
118c95
< public abstract String getArguments();
---
> protected abstract boolean isActionValid();
124c101
< * <p>Only the "action" and "password" attributes are required in the
---
> * <p>Only the "action" attribute is required in the
126c103
< * @exception BuildException if the attributes are invalid or incomplete
---
> * @exception BuildException if the attributes are invalid or incomplete.
129,131c106
< String action = deploy.getAction();
<
< if(action == null)
---
> if (task.getAction() == null)
134,135c109,110
< if(!isActionValid())
< throw new BuildException("Invalid action \"" + action + "\"
passed");
---
> if (!isActionValid())
> throw new BuildException("Invalid action \"" + task.getAction() +
> "\" passed");
137,138c112,113
< if(deploy.getPassword() == null)
< throw new BuildException("The WebLogic system password must be
set");
---
> if (task.getClasspath() == null)
> throw new BuildException("The classpath attribute must be set");
142,147c117,119
< * Determines if the "action" attribute defines a valid action.
< * <p>Subclasses should determine if the action passed in is
< * supported by the vendor's deployment tool.
< * <p>Actions may by "deploy", "delete", etc... It all depends
< * on the tool.
< * @return true if the "action" attribute is valid, false if not.
---
> * Perform the actual deployment.<br>
> * It's up to the subclasses to implement the actual behavior.
> * @exception BuildException if the attributes are invalid or incomplete.
149c121,129
< protected abstract boolean isActionValid();
---
> public abstract void deploy() throws BuildException;
>
> /**
> * Sets the parent task.
> * @param task An EjbDeploy object representing the parent task.
> */
> public void setTask(EjbDeploy task) {
> this.task = task;
> }
152,153c132,133
< * Returns the super-task.
< * @return An EjbDeploy object representing the super-task.
---
> * Returns the task field, a EjbDeploy object.
> * @return An EjbDeploy representing the parent task.
155,156c135,136
< protected EjbDeploy getDeploy() {
< return deploy;
---
> protected EjbDeploy getTask() {
> return task;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>