Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mortbay.jetty.deployer
Class ContextDeployer

    java.lang.Object
      org.mortbay.component.AbstractLifeCycle
          org.mortbay.jetty.deployer.ContextDeployer

All Implemented Interfaces:
  LifeCycle

    public class ContextDeployer

extends AbstractLifeCycle

Context Deployer This deployer scans a designated directory by `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.

Nested Class Summary
`protected class` | `ContextDeployer.ScannerListener`

Nested classes/interfaces inherited from interface org.mortbay.component.LifeCycle
`LifeCycle.Listener`

Field Summary
`static String` | `NAME`

Fields inherited from class org.mortbay.component.AbstractLifeCycle
`_listeners`

Constructor Summary
`ContextDeployer()` Constructor

Method Summary
`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)`

Methods inherited from class org.mortbay.component.AbstractLifeCycle
`addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NAME

    public static final String NAME

See Also:
  Constant Field Values

Constructor Detail

### ContextDeployer

    public ContextDeployer()
                    throws Exception

  Constructor

  Throws:
    `Exception`

Method Detail

### getContexts

    public ContextHandlerCollection getContexts()

  Returns:
    the ContextHandlerColletion to which to deploy the contexts

### setContexts

    public void setContexts(ContextHandlerCollection contexts)

  Associate with a `ContextHandlerCollection`.

  Parameters:
    `contexts` - the ContextHandlerColletion to which to deploy the contexts

### setScanInterval

    public void setScanInterval(int seconds)

  Parameters:
    `seconds` - The period in second between scans for changed configuration files. A zero or negative interval disables hot deployment

### getScanInterval

    public int getScanInterval()

### setConfigurationDir

    public void setConfigurationDir(String dir)
                             throws Exception

  Parameters:
    `dir` -
  Throws:
    `Exception`

### setConfigurationDir

    public void setConfigurationDir(File file)
                             throws Exception

  Parameters:
    `file` -
  Throws:
    `Exception`

### setConfigurationDir

    public void setConfigurationDir(Resource resource)

  Parameters:
    `resource` -

### setDirectory

    public void setDirectory(String directory)
                      throws Exception

  Parameters:
    `directory` -
  Throws:
    `Exception`

### getDirectory

    public String getDirectory()

  Returns:

### getConfigurationDir

    public Resource getConfigurationDir()

  Returns:

### setConfigurationManager

    public void setConfigurationManager(ConfigurationManager configMgr)

  Parameters:
    `configMgr` -

### getConfigurationManager

    public ConfigurationManager getConfigurationManager()

  Returns:

### setRecursive

    public void setRecursive(boolean recursive)

### getRecursive

    public boolean getRecursive()

### isRecursive

    public boolean isRecursive()

### doStart

    protected void doStart()
                    throws Exception

  Start the hot deployer looking for webapps to deploy/undeploy

  Overrides:
    `doStart` in class `AbstractLifeCycle`
  Throws:
    `Exception`
  See Also:
    `AbstractLifeCycle.doStart()`

### doStop

    protected void doStop()
                   throws Exception

  Stop the hot deployer.

  Overrides:
    `doStop` in class `AbstractLifeCycle`
  Throws:
    `Exception`
  See Also:
    `AbstractLifeCycle.doStop()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1995-2008 Mort Bay Consulting. All Rights Reserved.