GenericHotDeploymentTool (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.j2ee, class: GenericHotDeploymentTool

# Class GenericHotDeploymentTool

java.lang.Object
org.apache.tools.ant.taskdefs.optional.j2ee.AbstractHotDeploymentTool
org.apache.tools.ant.taskdefs.optional.j2ee.GenericHotDeploymentTool

All Implemented Interfaces:
  `HotDeploymentTool`

Direct Known 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`

- ## Field Summary

  ### Fields inherited from interface HotDeploymentTool

  `ACTION_DELETE, ACTION_DEPLOY, ACTION_LIST, ACTION_UNDEPLOY, ACTION_UPDATE`
  Modifier and Type
  Field
  Description
  `static final String`
  `ACTION_DELETE`
  The delete action String
  `static final String`
  `ACTION_DEPLOY`
  The deploy action String
  `static final String`
  `ACTION_LIST`
  The list action String
  `static final String`
  `ACTION_UNDEPLOY`
  The undeploy action String
  `static final String`
  `ACTION_UPDATE`
  The update action String

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GenericHotDeploymentTool()`

- ## Method Summary

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

  ### Methods inherited from class AbstractHotDeploymentTool

  `createClasspath, getClasspath, getPassword, getServer, getTask, getUserName, setClasspath, setPassword, setServer, setUserName`
  Modifier and Type
  Method
  Description
  `Path`
  `createClasspath()`
  Add a classpath as a nested element.
  `Path`
  `getClasspath()`
  gets the classpath field.
  `String`
  `getPassword()`
  Returns the password field.
  `String`
  `getServer()`
  Returns the server field.
  `protected ServerDeploy`
  `getTask()`
  Returns the task field, a ServerDeploy object.
  `String`
  `getUserName()`
  Returns the userName field.
  `void`
  `setClasspath(Path classpath)`
  The classpath to be passed to the JVM running the tool; optional depending upon the tool.
  `void`
  `setPassword(String password)`
  The password of the user; optional.
  `void`
  `setServer(String server)`
  The address or URL for the server where the component will be deployed.
  `void`
  `setUserName(String userName)`
  The user with privileges to deploy applications to the server; optional.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### GenericHotDeploymentTool

    public GenericHotDeploymentTool()

- ## 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 argument 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"...

  - ### 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"

    Specified by:
      `isActionValid` in class `AbstractHotDeploymentTool`
    Returns:
      true if the "action" attribute is valid, false if not.

  - ### setTask

    public void setTask(ServerDeploy task)
    Sets the parent task.
    Specified by:
      `setTask` in interface `HotDeploymentTool`
    Overrides:
      `setTask` in class `AbstractHotDeploymentTool`
    Parameters:
      `task` - An ServerDeploy object representing the parent task.

  - ### 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.
    Throws:
      `BuildException` - if the attributes are invalid or incomplete.

  - ### 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 class `AbstractHotDeploymentTool`
    Throws:
      `BuildException` - if the attributes are invalid or incomplete.

  - ### setClassName

    public void setClassName(String className)
    The name of the class to execute to perform deployment; required. Example: "com.foobar.tools.deploy.DeployTool"
    Parameters:
      `className` - The fully qualified class name of the class to perform deployment.

  - ### getJava

    public Java getJava()
    get the java attribute.
    Returns:
      the java attribute.

  - ### getClassName

    public String getClassName()
    Get the classname attribute.
    Returns:
      the classname value.