org.apache.cactus.integration.ant.container
Class GenericContainer

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.cactus.integration.ant.container.AbstractContainer
          extended byorg.apache.cactus.integration.ant.container.GenericContainer
All Implemented Interfaces:
Container

public final class GenericContainer
extends AbstractContainer

A generic container that can be nested in the CactusTask to support complete customization of the container lifecycle from a build file.

Version:
$Id: GenericContainer.java,v 1.6.2.3 2003/10/23 18:20:43 vmassol Exp $
Author:
Christopher Lenz

Nested Class Summary
 class GenericContainer.Hook
          Class that represents the nested 'startup' and 'shutdown' elements.
 
Constructor Summary
GenericContainer()
           
 
Method Summary
 GenericContainer.Hook createShutDown()
          Creates a nested 'shutdown' element.
 GenericContainer.Hook createStartUp()
          Creates a nested 'startup' element.
 java.lang.String getName()
          Returns a displayable name of the container for logging purposes.
 int getPort()
          Returns the port to which the container should listen.
 boolean isShutDownSet()
          Returns whether a way to start the container has already been set, either as a target, or as a nested task container.
 boolean isStartUpSet()
          Returns whether a way to stop the container has already been set, either as a target, or as a nested task container.
 void setName(java.lang.String theName)
          Sets the name of the container for logging purposes.
 void setPort(int thePort)
          Sets the port to which the container should listen.
 void setShutDownTarget(java.lang.String theShutDownTarget)
          Sets the target to call to stop the server.
 void setStartUpTarget(java.lang.String theStartUpTarget)
          Sets the target to call to start the server.
 void shutDown()
          Shuts down the container by delegating to the shutdown hook.
 void startUp()
          Starts up the container by delegating to the startup hook.
 
Methods inherited from class org.apache.cactus.integration.ant.container.AbstractContainer
createExclude, getExcludePatterns, getStartUpWait, getSystemProperties, getToDir, init, isEnabled, isExcluded, setAntTaskFactory, setDeployableFile, setIf, setLog, setStartUpWait, setSystemProperties, setToDir, setUnless
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, log, log, setProject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericContainer

public GenericContainer()
Method Detail

createStartUp

public GenericContainer.Hook createStartUp()
                                    throws org.apache.tools.ant.BuildException
Creates a nested 'startup' element.

Returns:
The new hook element
Throws:
org.apache.tools.ant.BuildException - If a startup hook has already been added

createShutDown

public GenericContainer.Hook createShutDown()
                                     throws org.apache.tools.ant.BuildException
Creates a nested 'shutdown' element.

Returns:
The new hook element
Throws:
org.apache.tools.ant.BuildException - If a shutdown hook has already been added

isShutDownSet

public boolean isShutDownSet()
Returns whether a way to start the container has already been set, either as a target, or as a nested task container.

Returns:
true if the shut down procedure has been set

isStartUpSet

public boolean isStartUpSet()
Returns whether a way to stop the container has already been set, either as a target, or as a nested task container.

Returns:
true if the start up procedure has been set

setName

public void setName(java.lang.String theName)
Sets the name of the container for logging purposes.

Parameters:
theName - The container name

setPort

public void setPort(int thePort)
Sets the port to which the container should listen.

Parameters:
thePort - The port to set

setStartUpTarget

public void setStartUpTarget(java.lang.String theStartUpTarget)
Sets the target to call to start the server.

Parameters:
theStartUpTarget - the Ant target to call

setShutDownTarget

public void setShutDownTarget(java.lang.String theShutDownTarget)
Sets the target to call to stop the server.

Parameters:
theShutDownTarget - the Ant target to call

getName

public java.lang.String getName()
Description copied from interface: Container
Returns a displayable name of the container for logging purposes.

Returns:
The container name
See Also:
Container.getName()

getPort

public int getPort()
Returns the port to which the container should listen.

Returns:
The port

startUp

public void startUp()
             throws org.apache.tools.ant.BuildException
Starts up the container by delegating to the startup hook.

Throws:
org.apache.tools.ant.BuildException - If thrown by the startup hook

shutDown

public void shutDown()
              throws org.apache.tools.ant.BuildException
Shuts down the container by delegating to the shutdown hook.

Throws:
org.apache.tools.ant.BuildException - If thrown by the shutdown hook


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.