ContextDeployer (Jetty :: Aggregate :: All core Jetty 7.6.8.v20121106 API)
Date: 2012-11-06

org.eclipse.jetty.deploy

## Class ContextDeployer

- java.lang.Object
- - org.eclipse.jetty.util.component.AbstractLifeCycle
  - - org.eclipse.jetty.deploy.ContextDeployer

- All Implemented Interfaces:
    LifeCycle

  Deprecated.
  replaced with `ContextProvider` from the `DeploymentManager`

      @Deprecated
      public class ContextDeployer
      extends AbstractLifeCycle

  Legacy Context Deployer.

  Note: The WebAppDeployer is being phased out of Jetty in favor of the `DeploymentManager` and `ContextProvider` implementation.

  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 `HandlerWrapper.setHandler(org.eclipse.jetty.server.Handler)`.

  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.

  See Also:
    `DeploymentManager`, `ScanningAppProvider`
  Apache XBean:
    element="hotDeployer" description="Creates a hot deployer to watch a directory for changes at a configurable interval."

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `ContextDeployer.ScannerListener` Deprecated.

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `AbstractLifeCycle.AbstractLifeCycleListener`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

      `LifeCycle.Listener`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContextDeployer()` Deprecated. Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doStart()` Deprecated. Start the hot deployer looking for webapps to deploy/undeploy
    `protected void` | `doStop()` Deprecated. Stop the hot deployer.
    `Object` | `getAttribute(String name)` Deprecated. Get a contextAttribute that will be set for every Context deployed by this deployer.
    `Resource` | `getConfigurationDir()` Deprecated. use `setContextsDir(String)`
    `ConfigurationManager` | `getConfigurationManager()` Deprecated.
    `ContextHandlerCollection` | `getContexts()` Deprecated.
    `String` | `getContextsDir()` Deprecated.
    `String` | `getDirectory()` Deprecated. use `setContextsDir(String)`
    `boolean` | `getRecursive()` Deprecated.
    `int` | `getScanInterval()` Deprecated.
    `boolean` | `isRecursive()` Deprecated.
    `void` | `removeAttribute(String name)` Deprecated. Remove a contextAttribute that will be set for every Context deployed by this deployer.
    `void` | `setAttribute(String name, Object value)` Deprecated. Set a contextAttribute that will be set for every Context deployed by this deployer.
    `void` | `setConfigurationDir(File file)` Deprecated. use `setContextsDir(String)`
    `void` | `setConfigurationDir(Resource resource)` Deprecated. use `setContextsDir(String)`
    `void` | `setConfigurationDir(String dir)` Deprecated. use `setContextsDir(String)`
    `void` | `setConfigurationManager(ConfigurationManager configMgr)` Deprecated.
    `void` | `setContexts(ContextHandlerCollection contexts)` Deprecated. Associate with a `ContextHandlerCollection`.
    `void` | `setContextsDir(String dir)` Deprecated.
    `void` | `setDirectory(String directory)` Deprecated. use `setContextsDir(String)`
    `void` | `setRecursive(boolean recursive)` Deprecated.
    `void` | `setScanInterval(int seconds)` Deprecated.

    - ### Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

      `addLifeCycleListener, getState, getState, 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`

- - ### Constructor Detail

    - #### ContextDeployer

          public ContextDeployer()

      Deprecated.
      Constructor

  - ### Method Detail

    - #### getContexts

          public ContextHandlerCollection getContexts()

      Deprecated.
      Returns:
        the ContextHandlerColletion to which to deploy the contexts

    - #### setContexts

          public void setContexts(ContextHandlerCollection contexts)

      Deprecated.
      Associate with a `ContextHandlerCollection`.
      Parameters:
        `contexts` - the ContextHandlerColletion to which to deploy the contexts

    - #### setScanInterval

          public void setScanInterval(int seconds)

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

    - #### getScanInterval

          public int getScanInterval()

      Deprecated.

    - #### setContextsDir

          public void setContextsDir(String dir)

      Deprecated.
      Parameters:
        `dir` - Directory to scan for context descriptors

    - #### getContextsDir

          public String getContextsDir()

      Deprecated.

    - #### setConfigurationDir

          @Deprecated
          public void setConfigurationDir(String dir)
                                   throws Exception

      Deprecated. use `setContextsDir(String)`
      Parameters:
        `dir` -
      Throws:
        `Exception`

    - #### setConfigurationDir

          @Deprecated
          public void setConfigurationDir(File file)
                                   throws Exception

      Deprecated. use `setContextsDir(String)`
      Parameters:
        `file` -
      Throws:
        `Exception`

    - #### setConfigurationDir

          @Deprecated
          public void setConfigurationDir(Resource resource)

      Deprecated. use `setContextsDir(String)`
      Parameters:
        `resource` -

    - #### setDirectory

          @Deprecated
          public void setDirectory(String directory)
                            throws Exception

      Deprecated. use `setContextsDir(String)`
      Parameters:
        `directory` -
      Throws:
        `Exception`

    - #### getDirectory

          @Deprecated
          public String getDirectory()

      Deprecated. use `setContextsDir(String)`
      Returns:
        the directory

    - #### getConfigurationDir

          @Deprecated
          public Resource getConfigurationDir()

      Deprecated. use `setContextsDir(String)`
      Returns:
        the configuration directory

    - #### setConfigurationManager

          public void setConfigurationManager(ConfigurationManager configMgr)

      Deprecated.
      Parameters:
        `configMgr` -

    - #### getConfigurationManager

          public ConfigurationManager getConfigurationManager()

      Deprecated.
      Returns:
        the configuration manager

    - #### setRecursive

          public void setRecursive(boolean recursive)

      Deprecated.

    - #### getRecursive

          public boolean getRecursive()

      Deprecated.

    - #### isRecursive

          public boolean isRecursive()

      Deprecated.

    - #### setAttribute

          public void setAttribute(String name,
                          Object value)

      Deprecated.
      Set a contextAttribute that will be set for every Context deployed by this deployer.
      Parameters:
        `name` -
        `value` -

    - #### getAttribute

          public Object getAttribute(String name)

      Deprecated.
      Get a contextAttribute that will be set for every Context deployed by this deployer.
      Parameters:
        `name` -
      Returns:
        the attribute value

    - #### removeAttribute

          public void removeAttribute(String name)

      Deprecated.
      Remove a contextAttribute that will be set for every Context deployed by this deployer.
      Parameters:
        `name` -

    - #### doStart

          protected void doStart()
                          throws Exception

      Deprecated.
      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

      Deprecated.
      Stop the hot deployer.
      Overrides:
        `doStop` in class `AbstractLifeCycle`
      Throws:
        `Exception`
      See Also:
        `AbstractLifeCycle.doStop()`

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