| java.lang.Object org.apache.catalina.ha.ClusterListener org.apache.catalina.ha.deploy.FarmWarDeployer
FarmWarDeployer | public class FarmWarDeployer extends ClusterListener implements ClusterDeployer,FileChangeListener(Code) | |
A farm war deployer is a class that is able to deploy/undeploy web
applications in WAR form within the cluster.
Any host can act as the admin, and will have three directories
- deployDir - the directory where we watch for changes
- applicationDir - the directory where we install applications
- tempDir - a temporaryDirectory to store binary data when downloading a
war from the cluster
Currently we only support deployment of WAR files since they are easier to
send across the wire.
author: Filip Hanik author: Peter Rossbach version: $Revision: 516438 $ |
Method Summary | |
public boolean | accept(ClusterMessage msg) Before the cluster invokes messageReceived the cluster will ask the
receiver to accept or decline the message, In the future, when messages
get big, the accept method will only take a message header
Parameters: msg - ClusterMessage boolean - returns true to indicate that messageReceived should beinvoked. | protected void | addServiced(String name) Invoke the check method on the deployer. | public void | backgroundProcess() | protected void | check(String name) Invoke the check method on the deployer. | public void | cleanDeployDir() | protected boolean | copy(File from, File to) Copy a file to the specified temp directory. | public boolean | equals(Object listener) | public void | fileModified(File newWar) | public void | fileRemoved(File removeWar) | protected File | getAppBase() Return a File object representing the "application root" directory for
our associated Host. | public CatalinaCluster | getCluster() | protected String | getConfigFile(String path) Given a context path, get the config file name. | protected String | getContextName(File war) | public String | getDeployDir() | protected String | getDocBase(String path) Given a context path, get the config file name. | public synchronized FileMessageFactory | getFactory(FileMessage msg) | public String | getInfo() Return descriptive information about this deployer implementation and the
corresponding version number, in the format
<description>/<version> . | public int | getProcessDeployFrequency() Return the frequency of watcher checks. | public String | getTempDir() | public String | getWatchDir() | public boolean | getWatchEnabled() | public int | hashCode() | public void | install(String contextPath, URL war) Install a new web application, whose web application archive is at the
specified URL, into this container and all the other members of the
cluster with the specified context path. | protected boolean | isServiced(String name) Invoke the check method on the deployer. | public boolean | isWatchEnabled() | public void | messageReceived(ClusterMessage msg) Callback from the cluster, when a message is received, The cluster will
broadcast it invoking the messageReceived on the receiver. | public void | remove(String contextPath, boolean undeploy) Remove an existing web application, attached to the specified context
path. | protected void | remove(String path) Invoke the remove method on the deployer. | public void | removeFactory(FileMessage msg) | protected void | removeServiced(String name) Invoke the check method on the deployer. | public void | setCluster(CatalinaCluster cluster) | public void | setDeployDir(String deployDir) | public void | setProcessDeployFrequency(int processExpiresFrequency) Set the watcher checks frequency. | public void | setTempDir(String tempDir) | public void | setWatchDir(String watchDir) | public void | setWatchEnabled(boolean watchEnabled) | public void | start() | public void | stop() | protected void | undeployDir(File dir) Delete the specified directory, including all of its contents and
subdirectories recursively. |
appBase | protected File appBase(Code) | | The host appBase.
|
configBase | protected File configBase(Code) | | Path where context descriptors should be deployed.
|
host | protected Host host(Code) | | The associated host.
|
processDeployFrequency | protected int processDeployFrequency(Code) | | Frequency of the Farm watchDir check. Cluster wide deployment will be
done once for the specified amount of backgrondProcess calls (ie, the
lower the amount, the most often the checks will occur).
|
started | protected boolean started(Code) | | |
watchEnabled | protected boolean watchEnabled(Code) | | |
FarmWarDeployer | public FarmWarDeployer()(Code) | | |
accept | public boolean accept(ClusterMessage msg)(Code) | | Before the cluster invokes messageReceived the cluster will ask the
receiver to accept or decline the message, In the future, when messages
get big, the accept method will only take a message header
Parameters: msg - ClusterMessage boolean - returns true to indicate that messageReceived should beinvoked. If false is returned, the messageReceived method willnot be invoked. |
addServiced | protected void addServiced(String name) throws Exception(Code) | | Invoke the check method on the deployer.
|
backgroundProcess | public void backgroundProcess()(Code) | | |
cleanDeployDir | public void cleanDeployDir()(Code) | | |
copy | protected boolean copy(File from, File to)(Code) | | Copy a file to the specified temp directory.
Parameters: from - copy from temp Parameters: to - to host appBase directory true, copy successful |
fileModified | public void fileModified(File newWar)(Code) | | |
fileRemoved | public void fileRemoved(File removeWar)(Code) | | |
getAppBase | protected File getAppBase()(Code) | | Return a File object representing the "application root" directory for
our associated Host.
|
getConfigFile | protected String getConfigFile(String path)(Code) | | Given a context path, get the config file name.
|
getContextName | protected String getContextName(File war)(Code) | | Create a context path from war
Parameters: war - War filename '/filename' or if war name is ROOT.war context name is empty string '' |
getDocBase | protected String getDocBase(String path)(Code) | | Given a context path, get the config file name.
|
getInfo | public String getInfo()(Code) | | Return descriptive information about this deployer implementation and the
corresponding version number, in the format
<description>/<version> .
|
getProcessDeployFrequency | public int getProcessDeployFrequency()(Code) | | Return the frequency of watcher checks.
|
getWatchEnabled | public boolean getWatchEnabled()(Code) | | |
hashCode | public int hashCode()(Code) | | |
install | public void install(String contextPath, URL war) throws IOException(Code) | | Install a new web application, whose web application archive is at the
specified URL, into this container and all the other members of the
cluster with the specified context path. A context path of "" (the empty
string) should be used for the root application for this container.
Otherwise, the context path must start with a slash.
If this application is successfully installed locally, a ContainerEvent
of type INSTALL_EVENT will be sent to all registered
listeners, with the newly created Context as an argument.
Parameters: contextPath - The context path to which this application should be installed(must be unique) Parameters: war - A URL of type "jar:" that points to a WAR file, or type"file:" that points to an unpacked directory structurecontaining the web application to be installed exception: IllegalArgumentException - if the specified context path is malformed (it must be ""or start with a slash) exception: IllegalStateException - if the specified context path is already attached to anexisting web application exception: IOException - if an input/output error was encountered duringinstallation |
isServiced | protected boolean isServiced(String name) throws Exception(Code) | | Invoke the check method on the deployer.
|
isWatchEnabled | public boolean isWatchEnabled()(Code) | | |
messageReceived | public void messageReceived(ClusterMessage msg)(Code) | | Callback from the cluster, when a message is received, The cluster will
broadcast it invoking the messageReceived on the receiver.
Parameters: msg - ClusterMessage - the message received from the cluster |
remove | public void remove(String contextPath, boolean undeploy) throws IOException(Code) | | Remove an existing web application, attached to the specified context
path. If this application is successfully removed, a ContainerEvent of
type REMOVE_EVENT will be sent to all registered
listeners, with the removed Context as an argument.
Deletes the web application war file and/or directory if they exist in
the Host's appBase.
Parameters: contextPath - The context path of the application to be removed Parameters: undeploy - boolean flag to remove web application from server exception: IllegalArgumentException - if the specified context path is malformed (it must be ""or start with a slash) exception: IllegalArgumentException - if the specified context path does not identify acurrently installed web application exception: IOException - if an input/output error occurs during removal |
remove | protected void remove(String path) throws Exception(Code) | | Invoke the remove method on the deployer.
|
removeFactory | public void removeFactory(FileMessage msg)(Code) | | Remove file (war) from messages)
Parameters: msg - |
removeServiced | protected void removeServiced(String name) throws Exception(Code) | | Invoke the check method on the deployer.
|
setDeployDir | public void setDeployDir(String deployDir)(Code) | | |
setProcessDeployFrequency | public void setProcessDeployFrequency(int processExpiresFrequency)(Code) | | Set the watcher checks frequency.
Parameters: processExpiresFrequency - the new manager checks frequency |
setWatchEnabled | public void setWatchEnabled(boolean watchEnabled)(Code) | | |
undeployDir | protected void undeployDir(File dir)(Code) | | Delete the specified directory, including all of its contents and
subdirectories recursively.
Parameters: dir - File object representing the directory to be deleted |
|
|