org.apache.catalina.ha.deploy
public class FarmWarDeployer extends ClusterListener implements ClusterDeployer, FileChangeListener
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 directoriesVersion: $Revision: 734560 $
Field Summary | |
---|---|
protected File | appBase
The host appBase. |
protected CatalinaCluster | cluster |
protected File | configBase
Path where context descriptors should be deployed. |
protected String | deployDir |
protected HashMap | fileFactories |
protected Host | host
The associated host. |
static Log | log |
protected MBeanServer | mBeanServer
MBean server. |
protected ObjectName | oname
The associated deployer ObjectName. |
protected int | processDeployFrequency
Frequency of the Farm watchDir check. |
protected boolean | started |
protected String | tempDir |
protected String | watchDir |
protected WarWatcher | watcher |
protected boolean | watchEnabled |
Constructor Summary | |
---|---|
FarmWarDeployer() |
Method Summary | |
---|---|
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
|
protected void | addServiced(String name)
Invoke the check method on the deployer. |
void | backgroundProcess() |
protected void | check(String name)
Invoke the check method on the deployer. |
void | cleanDeployDir() |
protected boolean | copy(File from, File to)
Copy a file to the specified temp directory. |
boolean | equals(Object listener) |
void | fileModified(File newWar) |
void | fileRemoved(File removeWar) |
protected File | getAppBase()
Return a File object representing the "application root" directory for
our associated Host. |
CatalinaCluster | getCluster() |
protected String | getConfigFile(String path)
Given a context path, get the config file name. |
protected String | getContextName(File war)
Create a context path from war |
String | getDeployDir() |
protected String | getDocBase(String path)
Given a context path, get the config file name. |
FileMessageFactory | getFactory(FileMessage msg)
create factory for all transported war files
|
String | getInfo()
Return descriptive information about this deployer implementation and the
corresponding version number, in the format
<description>/<version> . |
int | getProcessDeployFrequency()
Return the frequency of watcher checks. |
String | getTempDir() |
String | getWatchDir() |
boolean | getWatchEnabled() |
int | hashCode() |
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. |
boolean | isWatchEnabled() |
void | messageReceived(ClusterMessage msg)
Callback from the cluster, when a message is received, The cluster will
broadcast it invoking the messageReceived on the receiver.
|
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. |
void | removeFactory(FileMessage msg)
Remove file (war) from messages)
|
protected void | removeServiced(String name)
Invoke the check method on the deployer. |
void | setCluster(CatalinaCluster cluster) |
void | setDeployDir(String deployDir) |
void | setProcessDeployFrequency(int processExpiresFrequency)
Set the watcher checks frequency.
|
void | setTempDir(String tempDir) |
void | setWatchDir(String watchDir) |
void | setWatchEnabled(boolean watchEnabled) |
void | start() |
void | stop() |
protected void | undeployDir(File dir)
Delete the specified directory, including all of its contents and
subdirectories recursively.
|
Parameters: msg ClusterMessage
Returns: boolean - returns true to indicate that messageReceived should be invoked. If false is returned, the messageReceived method will not be invoked.
Parameters: from copy from temp to to host appBase directory
Returns: true, copy successful
Parameters: war War filename
Returns: '/filename' or if war name is ROOT.war context name is empty string ''
Parameters: msg
Returns: Factory for all app message (war files)
Throws: java.io.FileNotFoundException java.io.IOException
<description>/<version>
.
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) war A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installed
Throws: IllegalArgumentException if the specified context path is malformed (it must be "" or start with a slash) IllegalStateException if the specified context path is already attached to an existing web application IOException if an input/output error was encountered during installation
Parameters: msg ClusterMessage - the message received from the cluster
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 undeploy boolean flag to remove web application from server
Throws: IllegalArgumentException if the specified context path is malformed (it must be "" or start with a slash) IllegalArgumentException if the specified context path does not identify a currently installed web application IOException if an input/output error occurs during removal
Parameters: msg
Parameters: processExpiresFrequency the new manager checks frequency
Parameters: dir File object representing the directory to be deleted