|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.ha.ClusterListener org.apache.catalina.ha.deploy.FarmWarDeployer
public class FarmWarDeployer
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
Field Summary | |
---|---|
protected java.io.File |
appBase
The host appBase. |
protected CatalinaCluster |
cluster
|
protected java.io.File |
configBase
Path where context descriptors should be deployed. |
protected java.lang.String |
deployDir
|
protected java.util.HashMap |
fileFactories
|
protected Host |
host
The associated host. |
static Log |
log
|
protected javax.management.MBeanServer |
mBeanServer
MBean server. |
protected javax.management.ObjectName |
oname
The associated deployer ObjectName. |
protected int |
processDeployFrequency
Frequency of the Farm watchDir check. |
protected boolean |
started
|
protected java.lang.String |
tempDir
|
protected java.lang.String |
watchDir
|
protected boolean |
watchEnabled
|
protected WarWatcher |
watcher
|
Fields inherited from class org.apache.catalina.ha.ClusterListener |
---|
sm |
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(java.lang.String name)
Invoke the check method on the deployer. |
void |
backgroundProcess()
call from container Background Process |
protected void |
check(java.lang.String name)
Invoke the check method on the deployer. |
void |
cleanDeployDir()
|
protected boolean |
copy(java.io.File from,
java.io.File to)
Copy a file to the specified temp directory. |
boolean |
equals(java.lang.Object listener)
|
void |
fileModified(java.io.File newWar)
|
void |
fileRemoved(java.io.File removeWar)
|
protected java.io.File |
getAppBase()
Return a File object representing the "application root" directory for our associated Host. |
CatalinaCluster |
getCluster()
Returns the cluster the cluster deployer is associated with |
protected java.lang.String |
getConfigFile(java.lang.String path)
Given a context path, get the config file name. |
protected java.lang.String |
getContextName(java.io.File war)
Create a context path from war |
java.lang.String |
getDeployDir()
|
protected java.lang.String |
getDocBase(java.lang.String path)
Given a context path, get the config file name. |
FileMessageFactory |
getFactory(FileMessage msg)
create factory for all transported war files |
java.lang.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. |
java.lang.String |
getTempDir()
|
java.lang.String |
getWatchDir()
|
boolean |
getWatchEnabled()
|
int |
hashCode()
|
void |
install(java.lang.String contextPath,
java.net.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(java.lang.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. |
protected void |
remove(java.lang.String path)
Invoke the remove method on the deployer. |
void |
remove(java.lang.String contextPath,
boolean undeploy)
Remove an existing web application, attached to the specified context path. |
void |
removeFactory(FileMessage msg)
Remove file (war) from messages) |
protected void |
removeServiced(java.lang.String name)
Invoke the check method on the deployer. |
void |
setCluster(CatalinaCluster cluster)
Associates the cluster deployer with a cluster |
void |
setDeployDir(java.lang.String deployDir)
|
void |
setProcessDeployFrequency(int processExpiresFrequency)
Set the watcher checks frequency. |
void |
setTempDir(java.lang.String tempDir)
|
void |
setWatchDir(java.lang.String watchDir)
|
void |
setWatchEnabled(boolean watchEnabled)
|
void |
start()
Start the cluster deployer, the owning container will invoke this |
void |
stop()
Stops the cluster deployer, the owning container will invoke this |
protected void |
undeployDir(java.io.File dir)
Delete the specified directory, including all of its contents and subdirectories recursively. |
Methods inherited from class org.apache.catalina.ha.ClusterListener |
---|
accept, messageReceived |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.catalina.tribes.ChannelListener |
---|
accept, messageReceived |
Field Detail |
---|
public static Log log
protected CatalinaCluster cluster
protected boolean started
protected java.util.HashMap fileFactories
protected java.lang.String deployDir
protected java.lang.String tempDir
protected java.lang.String watchDir
protected boolean watchEnabled
protected WarWatcher watcher
protected int processDeployFrequency
protected java.io.File configBase
protected Host host
protected java.io.File appBase
protected javax.management.MBeanServer mBeanServer
protected javax.management.ObjectName oname
Constructor Detail |
---|
public FarmWarDeployer()
Method Detail |
---|
public java.lang.String getInfo()
<description>/<version>
.
public void start() throws java.lang.Exception
ClusterDeployer
start
in interface ClusterDeployer
java.lang.Exception
- - if failure to start clusterpublic void stop() throws LifecycleException
ClusterDeployer
stop
in interface ClusterDeployer
LifecycleException
public void cleanDeployDir()
public void messageReceived(ClusterMessage msg)
messageReceived
in class ClusterListener
msg
- ClusterMessage - the message received from the clusterpublic FileMessageFactory getFactory(FileMessage msg) throws java.io.FileNotFoundException, java.io.IOException
msg
-
java.io.FileNotFoundException
java.io.IOException
public void removeFactory(FileMessage msg)
msg
- public boolean accept(ClusterMessage msg)
accept
in class ClusterListener
msg
- ClusterMessage
public void install(java.lang.String contextPath, java.net.URL war) throws java.io.IOException
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.
install
in interface ClusterDeployer
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
java.lang.IllegalArgumentException
- if the specified context path is malformed (it must be ""
or start with a slash)
java.lang.IllegalStateException
- if the specified context path is already attached to an
existing web application
java.io.IOException
- if an input/output error was encountered during
installationpublic void remove(java.lang.String contextPath, boolean undeploy) throws java.io.IOException
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.
remove
in interface ClusterDeployer
contextPath
- The context path of the application to be removedundeploy
- boolean flag to remove web application from server
java.lang.IllegalArgumentException
- if the specified context path is malformed (it must be ""
or start with a slash)
java.lang.IllegalArgumentException
- if the specified context path does not identify a
currently installed web application
java.io.IOException
- if an input/output error occurs during removalpublic void fileModified(java.io.File newWar)
fileModified
in interface FileChangeListener
public void fileRemoved(java.io.File removeWar)
fileRemoved
in interface FileChangeListener
protected java.lang.String getContextName(java.io.File war)
war
- War filename
protected java.lang.String getConfigFile(java.lang.String path)
protected java.lang.String getDocBase(java.lang.String path)
protected java.io.File getAppBase()
protected void remove(java.lang.String path) throws java.lang.Exception
java.lang.Exception
protected void undeployDir(java.io.File dir)
dir
- File object representing the directory to be deletedpublic void backgroundProcess()
ClusterDeployer
backgroundProcess
in interface ClusterDeployer
protected void check(java.lang.String name) throws java.lang.Exception
java.lang.Exception
protected boolean isServiced(java.lang.String name) throws java.lang.Exception
java.lang.Exception
protected void addServiced(java.lang.String name) throws java.lang.Exception
java.lang.Exception
protected void removeServiced(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public CatalinaCluster getCluster()
ClusterDeployer
getCluster
in interface ClusterDeployer
getCluster
in class ClusterListener
public void setCluster(CatalinaCluster cluster)
ClusterDeployer
setCluster
in interface ClusterDeployer
setCluster
in class ClusterListener
cluster
- CatalinaClusterpublic boolean equals(java.lang.Object listener)
equals
in interface ChannelListener
equals
in class ClusterListener
listener
- Object
Object.equals(Object)
public int hashCode()
hashCode
in interface ChannelListener
hashCode
in class ClusterListener
Object.hashCode()
public java.lang.String getDeployDir()
public void setDeployDir(java.lang.String deployDir)
public java.lang.String getTempDir()
public void setTempDir(java.lang.String tempDir)
public java.lang.String getWatchDir()
public void setWatchDir(java.lang.String watchDir)
public boolean isWatchEnabled()
public boolean getWatchEnabled()
public void setWatchEnabled(boolean watchEnabled)
public int getProcessDeployFrequency()
public void setProcessDeployFrequency(int processExpiresFrequency)
processExpiresFrequency
- the new manager checks frequencyprotected boolean copy(java.io.File from, java.io.File to)
from
- copy from tempto
- to host appBase directory
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |