com.caucho.env.deploy
Class ExpandDeployGenerator<E extends ExpandDeployController<?>>

java.lang.Object
  extended by com.caucho.env.deploy.DeployGenerator<E>
      extended by com.caucho.env.deploy.ExpandDeployGenerator<E>
All Implemented Interfaces:
DeployUpdateListener, RepositoryTagListener, EnvironmentListener, AlarmListener, Dependency, java.util.EventListener
Direct Known Subclasses:
EarDeployGenerator, HostExpandDeployGenerator, WebAppExpandDeployGenerator

public abstract class ExpandDeployGenerator<E extends ExpandDeployController<?>>
extends DeployGenerator<E>
implements AlarmListener, DeployUpdateListener, RepositoryTagListener

The generator for the deploy


Constructor Summary
ExpandDeployGenerator(java.lang.String id, DeployContainer<E> container, Path containerRootDirectory)
          Creates the deploy.
 
Method Summary
 void addExpandCleanupFileset(FileSetType fileSet)
          Sets the expand remove file set.
 void addExpandPreserveFileset(FileSetType fileSet)
          Sets the expand remove file set.
 void addRequireFile(java.lang.String file)
          Adds a required file in the expansion.
protected  void afterUpdate()
           
protected abstract  E createController(ExpandVersion version)
          Creates a new entry.
 boolean deploy(java.lang.String key)
          Deploy the archive.
 boolean equals(java.lang.Object o)
          Tests for equality.
protected  void fillDeployedNames(java.util.Set<java.lang.String> names)
          Returns the deployed keys.
 void generateController(java.lang.String name, java.util.ArrayList<E> controllerList)
          Finds the matching entry.
 Path getArchiveDirectory()
          Gets the war expand directory.
 Path getArchivePath(java.lang.String name)
          Returns the location for deploying an archive with the specified name.
 java.lang.Throwable getConfigException(java.lang.String name)
          Returns an exception for the named archive or null if there is no exception
 long getDependencyCheckInterval()
           
 Path getExpandDirectory()
          Gets the war expand directory.
 Path getExpandPath(java.lang.String key)
          Returns the location of an expanded archive, or null if no archive with the passed name is deployed.
 java.lang.String getExpandPrefix()
          Gets the expand prefix.
 java.lang.String getExpandSuffix()
          Gets the expand suffix.
 java.lang.String getExtension()
          Returns the extension.
 java.lang.String getId()
           
protected  java.util.logging.Logger getLog()
          Returns the log.
 java.lang.String[] getNames()
           
 Path getPath()
          Gets the default path.
 ExpandVersion getPrimaryVersion(java.lang.String key)
           
 Repository getRepository()
          The repository
 void handleAlarm(Alarm alarm)
          Checks for updates.
protected  void initImpl()
          Configuration checks on init.
protected  boolean isDeployedKey(java.lang.String key)
          Return true for a matching key.
 boolean isModified()
          Returns true if the deployment has modified.
 boolean isVersioning()
          Sets true to enable versioning
protected  java.lang.String keyToName(java.lang.String key)
           
 boolean logModified(java.util.logging.Logger log)
          Log the reason for modification
protected  java.lang.String nameToKey(java.lang.String name)
           
 void onTagChange(java.lang.String tag)
           
 void onUpdate(java.lang.String tag)
          Notification of an update.
 void setArchiveDirectory(Path path)
          Sets the war expand dir to check for new archive files.
 void setDependencyCheckInterval(Period period)
          Sets the dependency check interval.
 void setEntryNamePrefix(java.lang.String entryNamePrefix)
           
 void setExpandDirectory(Path path)
          Sets the war expand dir to check for new applications.
 void setExpandPath(Path path)
          Sets the war expand dir to check for new applications.
 void setExpandPrefix(java.lang.String prefix)
          Sets the expand prefix to check for new applications.
 void setExpandSuffix(java.lang.String suffix)
          Sets the expand suffix to check for new applications.
 void setExtension(java.lang.String extension)
          Sets the extension.
 void setMultiversionRouting(boolean isVersioning)
          Sets true to enable versioning
 void setPath(Path path)
          Sets the deploy directory.
 void setVersioning(boolean isVersioning)
          Sets true to enable versioning
 boolean start(java.lang.String name)
          Start the archive.
protected  void startImpl()
          Starts the deploy.
 boolean stop(java.lang.String name)
          Stop the archive.
protected  void stopImpl()
          Stops the deploy.
 java.lang.String toString()
           
 boolean undeploy(java.lang.String name)
          Undeploy the archive.
 void update()
          Deploys the objects.
 void updateIfModified()
          Redeploys if modified.
 void updateIfModifiedNow()
          Redeploys if modified.
 
Methods inherited from class com.caucho.env.deploy.DeployGenerator
destroy, destroyImpl, environmentBind, environmentConfigure, environmentStart, environmentStop, getConfigException, getDeployContainer, getParentClassLoader, getRedeployMode, getStartupMode, getState, init, isActive, isDestroyed, mergeController, setRedeployMode, setStartupMode, start, stop
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpandDeployGenerator

public ExpandDeployGenerator(java.lang.String id,
                             DeployContainer<E> container,
                             Path containerRootDirectory)
Creates the deploy.

Method Detail

getId

public java.lang.String getId()

setArchiveDirectory

public void setArchiveDirectory(Path path)
Sets the war expand dir to check for new archive files.


getArchiveDirectory

public Path getArchiveDirectory()
Gets the war expand directory.


getArchivePath

public Path getArchivePath(java.lang.String name)
Returns the location for deploying an archive with the specified name.

Parameters:
name - a name, without an extension

setExpandPath

public void setExpandPath(Path path)
Sets the war expand dir to check for new applications.


setExpandDirectory

public void setExpandDirectory(Path path)
Sets the war expand dir to check for new applications.


getExpandDirectory

public Path getExpandDirectory()
Gets the war expand directory.


setDependencyCheckInterval

public void setDependencyCheckInterval(Period period)
Sets the dependency check interval.


getDependencyCheckInterval

public long getDependencyCheckInterval()

addExpandCleanupFileset

public void addExpandCleanupFileset(FileSetType fileSet)
Sets the expand remove file set.


addExpandPreserveFileset

public void addExpandPreserveFileset(FileSetType fileSet)
Sets the expand remove file set.


setExtension

public void setExtension(java.lang.String extension)
                  throws ConfigException
Sets the extension.

Throws:
ConfigException

getExtension

public java.lang.String getExtension()
Returns the extension.


setExpandPrefix

public void setExpandPrefix(java.lang.String prefix)
                     throws ConfigException
Sets the expand prefix to check for new applications.

Throws:
ConfigException

getExpandPrefix

public java.lang.String getExpandPrefix()
Gets the expand prefix.


setExpandSuffix

public void setExpandSuffix(java.lang.String suffix)
                     throws ConfigException
Sets the expand suffix to check for new applications.

Throws:
ConfigException

getExpandSuffix

public java.lang.String getExpandSuffix()
Gets the expand suffix.


getRepository

public Repository getRepository()
The repository


setEntryNamePrefix

public void setEntryNamePrefix(java.lang.String entryNamePrefix)

getPath

public Path getPath()
Gets the default path.


setPath

public void setPath(Path path)
Sets the deploy directory.


addRequireFile

public void addRequireFile(java.lang.String file)
                    throws ConfigException
Adds a required file in the expansion.

Throws:
ConfigException

setVersioning

public void setVersioning(boolean isVersioning)
Sets true to enable versioning


setMultiversionRouting

public void setMultiversionRouting(boolean isVersioning)
Sets true to enable versioning


isVersioning

public boolean isVersioning()
Sets true to enable versioning


getLog

protected java.util.logging.Logger getLog()
Returns the log.

Overrides:
getLog in class DeployGenerator<E extends ExpandDeployController<?>>

initImpl

protected void initImpl()
                 throws ConfigException
Configuration checks on init.

Overrides:
initImpl in class DeployGenerator<E extends ExpandDeployController<?>>
Throws:
ConfigException

startImpl

protected void startImpl()
Starts the deploy.

Overrides:
startImpl in class DeployGenerator<E extends ExpandDeployController<?>>

getExpandPath

public Path getExpandPath(java.lang.String key)
Returns the location of an expanded archive, or null if no archive with the passed name is deployed.

Parameters:
name - a name, without an extension

isModified

public boolean isModified()
Returns true if the deployment has modified.

Specified by:
isModified in interface Dependency
Overrides:
isModified in class DeployGenerator<E extends ExpandDeployController<?>>

logModified

public boolean logModified(java.util.logging.Logger log)
Log the reason for modification

Specified by:
logModified in interface Dependency
Overrides:
logModified in class DeployGenerator<E extends ExpandDeployController<?>>

fillDeployedNames

protected void fillDeployedNames(java.util.Set<java.lang.String> names)
Returns the deployed keys.

Overrides:
fillDeployedNames in class DeployGenerator<E extends ExpandDeployController<?>>

isDeployedKey

protected boolean isDeployedKey(java.lang.String key)
Return true for a matching key.


createController

protected abstract E createController(ExpandVersion version)
Creates a new entry.


keyToName

protected java.lang.String keyToName(java.lang.String key)

nameToKey

protected java.lang.String nameToKey(java.lang.String name)

updateIfModified

public void updateIfModified()
Redeploys if modified.

Overrides:
updateIfModified in class DeployGenerator<E extends ExpandDeployController<?>>

updateIfModifiedNow

public void updateIfModifiedNow()
Redeploys if modified.


update

public final void update()
Deploys the objects.

Overrides:
update in class DeployGenerator<E extends ExpandDeployController<?>>

afterUpdate

protected void afterUpdate()

getPrimaryVersion

public ExpandVersion getPrimaryVersion(java.lang.String key)

generateController

public final void generateController(java.lang.String name,
                                     java.util.ArrayList<E> controllerList)
Finds the matching entry.

Overrides:
generateController in class DeployGenerator<E extends ExpandDeployController<?>>

onUpdate

public void onUpdate(java.lang.String tag)
Description copied from interface: DeployUpdateListener
Notification of an update. If the tag is null, all tags are updated.

Specified by:
onUpdate in interface DeployUpdateListener

getNames

public java.lang.String[] getNames()

deploy

public boolean deploy(java.lang.String key)
Deploy the archive.


start

public boolean start(java.lang.String name)
Start the archive.


getConfigException

public java.lang.Throwable getConfigException(java.lang.String name)
Returns an exception for the named archive or null if there is no exception


stop

public boolean stop(java.lang.String name)
Stop the archive.


undeploy

public boolean undeploy(java.lang.String name)
Undeploy the archive.


onTagChange

public void onTagChange(java.lang.String tag)
Specified by:
onTagChange in interface RepositoryTagListener

handleAlarm

public void handleAlarm(Alarm alarm)
Checks for updates.

Specified by:
handleAlarm in interface AlarmListener

stopImpl

protected void stopImpl()
Stops the deploy.

Overrides:
stopImpl in class DeployGenerator<E extends ExpandDeployController<?>>

equals

public boolean equals(java.lang.Object o)
Tests for equality.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class DeployGenerator<E extends ExpandDeployController<?>>