public class ContextDeployer
extends org.mortbay.component.AbstractLifeCycle
setConfigurationDir(String)
for the appearance/disappearance or
changes to xml configuration files. The scan is performed at startup and at
an optional hot deployment frequency specified by
setScanInterval(int)
. By default, the scanning is NOT recursive,
but can be made so by setRecursive(boolean)
.
Each configuration file is in XmlConfiguration
format and represents
the configuration of a instance of ContextHandler
(or a subclass
specified by the XML Configure
element).
The xml should configure the context and the instance is deployed to the
ContextHandlerCollection
specified by #setContexts(Server)
.
Similarly, when one of these existing files is removed, the corresponding
context is undeployed; when one of these files is changed, the corresponding
context is undeployed, the (changed) xml config file reapplied to it, and
then (re)deployed.
Note that the context itself is NOT copied into the hot deploy directory. The
webapp directory or war file can exist anywhere. It is the xml config file
that points to it's location and deploys it from there.
It means, for example, that you can keep a "read-only" copy of your webapp
somewhere, and apply different configurations to it simply by dropping
different xml configuration files into the configuration directory.Modifier and Type | Class and Description |
---|---|
protected class |
ContextDeployer.ScannerListener |
Constructor and Description |
---|
ContextDeployer()
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
doStart()
Start the hot deployer looking for webapps to deploy/undeploy
|
protected void |
doStop()
Stop the hot deployer.
|
Resource |
getConfigurationDir() |
ConfigurationManager |
getConfigurationManager() |
ContextHandlerCollection |
getContexts() |
String |
getDirectory() |
boolean |
getRecursive() |
int |
getScanInterval() |
boolean |
isRecursive() |
void |
setConfigurationDir(File file) |
void |
setConfigurationDir(Resource resource) |
void |
setConfigurationDir(String dir) |
void |
setConfigurationManager(ConfigurationManager configMgr) |
void |
setContexts(ContextHandlerCollection contexts)
Associate with a
ContextHandlerCollection . |
void |
setDirectory(String directory) |
void |
setRecursive(boolean recursive) |
void |
setScanInterval(int seconds) |
public static final String NAME
public ContextHandlerCollection getContexts()
public void setContexts(ContextHandlerCollection contexts)
ContextHandlerCollection
.contexts
- the ContextHandlerColletion to which to deploy the contextspublic void setScanInterval(int seconds)
seconds
- The period in second between scans for changed configuration
files. A zero or negative interval disables hot deploymentpublic int getScanInterval()
public void setConfigurationDir(String dir) throws Exception
dir
- Exception
public void setConfigurationDir(File file) throws Exception
file
- Exception
public void setConfigurationDir(Resource resource)
resource
- public void setDirectory(String directory) throws Exception
directory
- Exception
public String getDirectory()
public Resource getConfigurationDir()
public void setConfigurationManager(ConfigurationManager configMgr)
configMgr
- public ConfigurationManager getConfigurationManager()
public void setRecursive(boolean recursive)
public boolean getRecursive()
public boolean isRecursive()
protected void doStart() throws Exception
doStart
in class org.mortbay.component.AbstractLifeCycle
Exception
AbstractLifeCycle.doStart()
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.