org.apache.tools.ant.taskdefs.optional.j2ee

Class GenericHotDeploymentTool

Implemented Interfaces:
HotDeploymentTool
Known Direct Subclasses:
JonasHotDeploymentTool

public class GenericHotDeploymentTool
extends AbstractHotDeploymentTool

A generic tool for J2EE server hot deployment.

The simple implementation spawns a JVM with the supplied class name, jvm args, and arguments.

See Also:
HotDeploymentTool, AbstractHotDeploymentTool, ServerDeploy

Fields inherited from interface org.apache.tools.ant.taskdefs.optional.j2ee.HotDeploymentTool

ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE

Method Summary

Commandline.Argument
createArg()
Add a nested argument element to hand to the deployment tool; optional.
Commandline.Argument
createJvmarg()
Add a nested argment element to hand to the JVM running the deployment tool.
void
deploy()
Perform the actual deployment.
String
getClassName()
Java
getJava()
protected boolean
isActionValid()
Determines if the "action" attribute defines a valid action.
void
setClassName(String className)
The name of the class to execute to perfom deployment; required.
void
setTask(ServerDeploy task)
Sets the parent task.
void
validateAttributes()
Validates the passed in attributes.

Methods inherited from class org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool

createClasspath, deploy, getClasspath, getPassword, getServer, getTask, getUserName, isActionValid, setClasspath, setPassword, setServer, setTask, setUserName, validateAttributes

Method Details

createArg

public Commandline.Argument createArg()
Add a nested argument element to hand to the deployment tool; optional.

Returns:
A Commandline.Argument object representing the command line argument being passed when the deployment tool is run. IE: "-user=mark", "-password=venture"...


createJvmarg

public Commandline.Argument createJvmarg()
Add a nested argment element to hand to the JVM running the deployment tool. Creates a nested arg element.

Returns:
A Commandline.Argument object representing the JVM command line argument being passed when the deployment tool is run. IE: "-ms64m", "-mx128m"...


deploy

public void deploy()
            throws BuildException
Perform the actual deployment. For this generic implementation, a JVM is spawned using the supplied classpath, classname, JVM args, and command line arguments.
Specified by:
deploy in interface HotDeploymentTool
Overrides:
deploy in interface AbstractHotDeploymentTool

Throws:
BuildException - if the attributes are invalid or incomplete.


getClassName

public String getClassName()


getJava

public Java getJava()


isActionValid

protected boolean isActionValid()
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"

Overrides:
isActionValid in interface AbstractHotDeploymentTool

Returns:
true if the "action" attribute is valid, false if not.


setClassName

public void setClassName(String className)
The name of the class to execute to perfom deployment; required. Example: "com.foobar.tools.deploy.DeployTool"

Parameters:
className - The fully qualified class name of the class to perform deployment.


setTask

public void setTask(ServerDeploy task)
Sets the parent task.
Specified by:
setTask in interface HotDeploymentTool
Overrides:
setTask in interface AbstractHotDeploymentTool

Parameters:
task - An ServerDeploy object representing the parent task.


validateAttributes

public void validateAttributes()
            throws BuildException
Validates the passed in attributes. Ensures the className and arguments attribute have been set.
Specified by:
validateAttributes in interface HotDeploymentTool
Overrides:
validateAttributes in interface AbstractHotDeploymentTool

Throws:
BuildException - if the attributes are invalid or incomplete.


Copyright B) 2000-2005 Apache Software Foundation. All Rights Reserved.