org.apache.geronimo.deployment.hot
Class DirectoryHotDeployer

java.lang.Object
  extended by org.apache.geronimo.deployment.hot.DirectoryHotDeployer
All Implemented Interfaces:
DirectoryMonitor.Listener, HotDeployer, GBeanLifecycle, DeploymentWatcher

public class DirectoryHotDeployer
extends Object
implements HotDeployer, DeploymentWatcher, GBeanLifecycle

A directory-scanning hot deployer


Field Summary
static GBeanInfo GBEAN_INFO
           
 
Constructor Summary
DirectoryHotDeployer(String path, int pollIntervalMillis, ServerInfo serverInfo, ConfigurationManager configManager, Kernel kernel)
           
 
Method Summary
 void deployed(Artifact id)
           
 void doFail()
          Fails the GBean.
 void doStart()
          Starts the GBean.
 void doStop()
          Stops the target.
 String fileAdded(File file)
           
 boolean fileRemoved(File file, String configId)
           
 String fileUpdated(File file, String configId)
           
 String getDeploymentPassword()
           
 long getDeploymentTime(File file, String configId)
          Called during initialization on previously deployed files.
 String getDeploymentURI()
           
 String getDeploymentUser()
           
static GBeanInfo getGBeanInfo()
           
 String getModuleId(String config)
          This method returns the module id of an application deployed in the default group.
 String getPath()
           
 int getPollIntervalMillis()
           
 ServerInfo getServerInfo()
           
 boolean isFileDeployed(File file, String configId)
          Checks if the file with same configID is already deployed
 boolean isServerRunning()
          The directory monitor doesn't take any action unless this method returns true (to avoid deploying before the deploy GBeans are running, etc.).
 void setDeploymentPassword(String deploymentPassword)
           
 void setDeploymentURI(String deploymentURI)
           
 void setDeploymentUser(String deploymentUser)
           
 void setPath(String path)
           
 void setPollIntervalMillis(int pollIntervalMillis)
           
 void setServerInfo(ServerInfo serverInfo)
           
 void started()
          Called to indicate that the monitor has fully initialized and will be doing normal deployment operations from now on.
 void undeployed(Artifact id)
           
 boolean validateFile(File file, String configId)
          Called to check whether a file passes the smell test before attempting to deploy it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GBEAN_INFO

public static final GBeanInfo GBEAN_INFO
Constructor Detail

DirectoryHotDeployer

public DirectoryHotDeployer(String path,
                            int pollIntervalMillis,
                            ServerInfo serverInfo,
                            ConfigurationManager configManager,
                            Kernel kernel)
Method Detail

deployed

public void deployed(Artifact id)
Specified by:
deployed in interface DeploymentWatcher

undeployed

public void undeployed(Artifact id)
Specified by:
undeployed in interface DeploymentWatcher

getPath

public String getPath()

setPath

public void setPath(String path)

getServerInfo

public ServerInfo getServerInfo()

setServerInfo

public void setServerInfo(ServerInfo serverInfo)

getPollIntervalMillis

public int getPollIntervalMillis()
Specified by:
getPollIntervalMillis in interface HotDeployer

setPollIntervalMillis

public void setPollIntervalMillis(int pollIntervalMillis)
Specified by:
setPollIntervalMillis in interface HotDeployer

getDeploymentURI

public String getDeploymentURI()

setDeploymentURI

public void setDeploymentURI(String deploymentURI)

getDeploymentUser

public String getDeploymentUser()

setDeploymentUser

public void setDeploymentUser(String deploymentUser)

getDeploymentPassword

public String getDeploymentPassword()

setDeploymentPassword

public void setDeploymentPassword(String deploymentPassword)

doStart

public void doStart()
             throws Exception
Description copied from interface: GBeanLifecycle
Starts the GBean. This informs the GBean that it is about to transition to the running state.

Specified by:
doStart in interface GBeanLifecycle
Throws:
Exception - if the target failed to start; this will cause a transition to the failed state

doStop

public void doStop()
            throws Exception
Description copied from interface: GBeanLifecycle
Stops the target. This informs the GBean that it is about to transition to the stopped state.

Specified by:
doStop in interface GBeanLifecycle
Throws:
Exception - if the target failed to stop; this will cause a transition to the failed state

doFail

public void doFail()
Description copied from interface: GBeanLifecycle
Fails the GBean. This informs the GBean that it is about to transition to the failed state.

Specified by:
doFail in interface GBeanLifecycle

isFileDeployed

public boolean isFileDeployed(File file,
                              String configId)
Description copied from interface: DirectoryMonitor.Listener
Checks if the file with same configID is already deployed

Specified by:
isFileDeployed in interface DirectoryMonitor.Listener
Returns:
true if the file in question is already available in the server, false if it should be deployed on the next pass.

isServerRunning

public boolean isServerRunning()
Description copied from interface: DirectoryMonitor.Listener
The directory monitor doesn't take any action unless this method returns true (to avoid deploying before the deploy GBeans are running, etc.).

Specified by:
isServerRunning in interface DirectoryMonitor.Listener

getDeploymentTime

public long getDeploymentTime(File file,
                              String configId)
Description copied from interface: DirectoryMonitor.Listener
Called during initialization on previously deployed files.

Specified by:
getDeploymentTime in interface DirectoryMonitor.Listener
Returns:
The time that the file was deployed. If the current version in the directory is newer, the file will be updated on the first pass.

started

public void started()
Description copied from interface: DirectoryMonitor.Listener
Called to indicate that the monitor has fully initialized and will be doing normal deployment operations from now on.

Specified by:
started in interface DirectoryMonitor.Listener

validateFile

public boolean validateFile(File file,
                            String configId)
Description copied from interface: DirectoryMonitor.Listener
Called to check whether a file passes the smell test before attempting to deploy it.

Specified by:
validateFile in interface DirectoryMonitor.Listener
Returns:
true if there's nothing obviously wrong with this file. false if there is (for example, it's clearly not deployable).

fileAdded

public String fileAdded(File file)
Specified by:
fileAdded in interface DirectoryMonitor.Listener
Returns:
A configId for the deployment if the addition was processed successfully (or an empty String if the addition was OK but the configId could not be determined). null if the addition failed, in which case the file will be added again next time it changes.

fileRemoved

public boolean fileRemoved(File file,
                           String configId)
Specified by:
fileRemoved in interface DirectoryMonitor.Listener
Returns:
true if the removal was processed successfully. If not the file will be removed again on the next pass.

getModuleId

public String getModuleId(String config)
Description copied from interface: DirectoryMonitor.Listener
This method returns the module id of an application deployed in the default group.

Specified by:
getModuleId in interface DirectoryMonitor.Listener
Returns:
String respresenting the ModuleId if the application is already deployed

fileUpdated

public String fileUpdated(File file,
                          String configId)
Specified by:
fileUpdated in interface DirectoryMonitor.Listener

getGBeanInfo

public static GBeanInfo getGBeanInfo()


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.