Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » catalina » ha » deploy » [javadoc | source]
org.apache.catalina.ha.deploy
public class: FarmWarDeployer [javadoc | source]
java.lang.Object
   org.apache.catalina.ha.ClusterListener
      org.apache.catalina.ha.deploy.FarmWarDeployer

All Implemented Interfaces:
    ClusterDeployer, FileChangeListener, ChannelListener

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 Currently we only support deployment of WAR files since they are easier to send across the wire.
Field Summary
public static  Log log     
protected  CatalinaCluster cluster     
protected  boolean started     
protected  HashMap fileFactories     
protected  String deployDir     
protected  String tempDir     
protected  String watchDir     
protected  boolean watchEnabled     
protected  WarWatcher watcher     
protected  int processDeployFrequency    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). 
protected  File configBase    Path where context descriptors should be deployed. 
protected  Host host    The associated host. 
protected  File appBase    The host appBase. 
protected  MBeanServer mBeanServer    MBean server. 
protected  ObjectName oname    The associated deployer ObjectName. 
Fields inherited from org.apache.catalina.ha.ClusterListener:
log,  sm,  cluster
Constructor:
 public FarmWarDeployer() 
Method from org.apache.catalina.ha.deploy.FarmWarDeployer Summary:
accept,   addServiced,   backgroundProcess,   check,   cleanDeployDir,   copy,   equals,   fileModified,   fileRemoved,   getAppBase,   getCluster,   getConfigFile,   getContextName,   getDeployDir,   getDocBase,   getFactory,   getInfo,   getProcessDeployFrequency,   getTempDir,   getWatchDir,   getWatchEnabled,   hashCode,   install,   isServiced,   isWatchEnabled,   messageReceived,   remove,   remove,   removeFactory,   removeServiced,   setCluster,   setDeployDir,   setProcessDeployFrequency,   setTempDir,   setWatchDir,   setWatchEnabled,   start,   stop,   undeployDir
Methods from org.apache.catalina.ha.ClusterListener:
accept,   accept,   equals,   getCluster,   hashCode,   messageReceived,   messageReceived,   setCluster
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.ha.deploy.FarmWarDeployer Detail:
 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
 protected  void addServiced(String name) throws Exception 
    Invoke the check method on the deployer.
 public  void backgroundProcess() 
 protected  void check(String name) throws Exception 
    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) 
    Create a context path from war
 public String getDeployDir() 
 protected String getDocBase(String path) 
    Given a context path, get the config file name.
 public synchronized FileMessageFactory getFactory(FileMessage msg) throws FileNotFoundException, IOException 
    create factory for all transported war files
 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) throws IOException 
    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.

 protected boolean isServiced(String name) throws Exception 
    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.
 protected  void remove(String path) throws Exception 
    Invoke the remove method on the deployer.
 public  void remove(String contextPath,
    boolean undeploy) throws IOException 
    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.
 public  void removeFactory(FileMessage msg) 
    Remove file (war) from messages)
 protected  void removeServiced(String name) throws Exception 
    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() throws Exception 
 public  void stop() throws LifecycleException 
 protected  void undeployDir(File dir) 
    Delete the specified directory, including all of its contents and subdirectories recursively.