## org.apache.catalina.core
Class StandardHostDeployer

    java.lang.Object
      org.apache.catalina.core.StandardHostDeployer

All Implemented Interfaces:
  Deployer

public class StandardHostDeployer
extends java.lang.Object
implements Deployer

Implementation of Deployer that is delegated to by the `StandardHost` implementation class.

Version:
  $Revision: 1.23 $ $Date: 2004/04/12 22:05:15 $
Author:
  Craig R. McClanahan

Field Summary
`protected StandardHost` `host` The `StandardHost` instance we are associated with.
`protected static StringManager` `sm` The string manager for this package.

Fields inherited from interface org.apache.catalina.Deployer
`INSTALL_EVENT, PRE_INSTALL_EVENT, REMOVE_EVENT`

Constructor Summary
`StandardHostDeployer()`
`StandardHostDeployer(StandardHost host)` Create a new StandardHostDeployer associated with the specified StandardHost.

Method Summary
`void` `addChild(Container child)` Delegate a request to add a child Context to our associated Host.
`protected org.apache.commons.digester.Digester` `createDigester()` Create (if necessary) and return a Digester configured to process the context configuration descriptor for an application.
`Context` `findDeployedApp(java.lang.String contextPath)` Return the Context for the deployed application that is associated with the specified context path (if any); otherwise return `null`.
`java.lang.String[]` `findDeployedApps()` Return the context paths of all deployed web applications in this Container.
`Host` `getHost()`
`java.lang.String` `getName()` Return the name of the Container with which this Deployer is associated.
`java.lang.ClassLoader` `getParentClassLoader()` Delegate a request for the parent class loader to our associated Host.
`void` `install(java.lang.String contextPath, java.net.URL war)` Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path.
`void` `install(java.lang.String contextPath, java.net.URL war, java.lang.String configFile)` Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path.
`void` `install(java.net.URL war)` Installs a new web application from the web application archive at the specified URL, which must contain a META-INF/context.xml context configuration file (consisting of a `<Context>` element).
`void` `install(java.net.URL config, java.net.URL war)` Install a new web application, whose context configuration file (consisting of a `<Context>` element) and (optional) web application archive are at the specified URLs.
`boolean` `isDeployXML()` Returns true if context.xml config files are supported.
`void` `remove(java.lang.String contextPath)` Remove an existing web application, attached to the specified context path.
`void` `remove(java.lang.String contextPath, boolean undeploy)` Remove an existing web application, attached to the specified context path.
`void` `setHost(Host host)`
`void` `start(java.lang.String contextPath)` Start an existing web application, attached to the specified context path.
`void` `stop(java.lang.String contextPath)` Stop an existing web application, attached to the specified context path.

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

Field Detail

### host

    protected StandardHost host

  The `StandardHost` instance we are associated with.

### sm

    protected static StringManager sm

  The string manager for this package.

Constructor Detail

### StandardHostDeployer

    public StandardHostDeployer()

### StandardHostDeployer

    public StandardHostDeployer(StandardHost host)

  Create a new StandardHostDeployer associated with the specified StandardHost.

Parameters:
  `host` - The StandardHost we are associated with

Method Detail

### getHost

    public Host getHost()

### setHost

    public void setHost(Host host)

### getName

    public java.lang.String getName()

  Return the name of the Container with which this Deployer is associated.

  Specified by:
    `getName` in interface `Deployer`

### install

    public void install(java.lang.String contextPath,
                        java.net.URL war)
                 throws java.io.IOException

  Install a new web application, whose web application archive is at the specified URL, into this container 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, a ContainerEvent of type `PRE_INSTALL_EVENT` will be sent to registered listeners before the associated Context is started, and a ContainerEvent of type `INSTALL_EVENT` will be sent to all registered listeners after the associated Context is started, with the newly created `Context` as an argument.

  Specified by:
    `install` in interface `Deployer`
  Parameters:
    `contextPath` - The context path to which this application should be installed (must be unique)
    `war` - A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installed
  Throws:
    `java.lang.IllegalArgumentException` - if the specified context path is malformed (it must be "" or start with a slash)
    `java.lang.IllegalStateException` - if the specified context path is already attached to an existing web application
    `java.io.IOException` - if an input/output error was encountered during installation

### install

    public void install(java.lang.String contextPath,
                        java.net.URL war,
                        java.lang.String configFile)
                 throws java.io.IOException

  Install a new web application, whose web application archive is at the specified URL, into this container 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, a ContainerEvent of type `PRE_INSTALL_EVENT` will be sent to registered listeners before the associated Context is started, and a ContainerEvent of type `INSTALL_EVENT` will be sent to all registered listeners after the associated Context is started, with the newly created `Context` as an argument.

  Parameters:
    `contextPath` - The context path to which this application should be installed (must be unique)
    `war` - A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installed
    `configFile` - The path to a file to save the Context information. If configFile is null, the Context information is saved in server.xml; if it is NOT null, the Context information is saved in configFile.
  Throws:
    `java.lang.IllegalArgumentException` - if the specified context path is malformed (it must be "" or start with a slash)
    `java.lang.IllegalStateException` - if the specified context path is already attached to an existing web application
    `java.io.IOException` - if an input/output error was encountered during installation

### install

    public void install(java.net.URL config,
                        java.net.URL war)
                 throws java.io.IOException

  Install a new web application, whose context configuration file (consisting of a `<Context>` element) and (optional) web application archive are at the specified URLs.

  If this application is successfully installed, a ContainerEvent of type `PRE_INSTALL_EVENT` will be sent to registered listeners before the associated Context is started, and a ContainerEvent of type `INSTALL_EVENT` will be sent to all registered listeners after the associated Context is started, with the newly created `Context` as an argument.

  Specified by:
    `install` in interface `Deployer`
  Parameters:
    `config` - A URL that points to the context configuration descriptor to be used for configuring the new Context
    `war` - A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installed, or `null` to use the `docBase` attribute from the configuration descriptor
  Throws:
    `java.lang.IllegalArgumentException` - if one of the specified URLs is null
    `java.lang.IllegalStateException` - if the context path specified in the context configuration file is already attached to an existing web application
    `java.io.IOException` - if an input/output error was encountered during installation

### install

    public void install(java.net.URL war)
                 throws java.io.IOException

  Installs a new web application from the web application archive at the specified URL, which must contain a META-INF/context.xml context configuration file (consisting of a `<Context>` element).

  The web application is installed at the path specified inside the embedded META-INF/context.xml. The docBase (if any) specified inside the embedded META-INF/context.xml is overridden with the web application's location.

  If the installation succeeds, a ContainerEvent of type `INSTALL_EVENT` is sent to all registered listeners, with the newly created `Context` as its argument.

  Specified by:
    `install` in interface `Deployer`
  Parameters:
    `war` - URL pointing to web application location (WAR-packaged or unpacked directory)
  Throws:
    `java.lang.IllegalArgumentException` - if `war` is null, or if the deployment host does not support any context.xml configuration files
    `java.lang.IllegalStateException` - if the context path specified in the context configuration file is already in use by an existing web application
    `java.io.IOException` - if an input/output error was encountered during installation

### findDeployedApp

    public Context findDeployedApp(java.lang.String contextPath)

  Return the Context for the deployed application that is associated with the specified context path (if any); otherwise return `null`.

  Specified by:
    `findDeployedApp` in interface `Deployer`
  Parameters:
    `contextPath` - The context path of the requested web application

### findDeployedApps

    public java.lang.String[] findDeployedApps()

  Return the context paths of all deployed web applications in this Container. If there are no deployed applications, a zero-length array is returned.

  Specified by:
    `findDeployedApps` in interface `Deployer`

### remove

    public void remove(java.lang.String contextPath)
                throws java.io.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.

  Specified by:
    `remove` in interface `Deployer`
  Parameters:
    `contextPath` - The context path of the application to be removed
  Throws:
    `java.lang.IllegalArgumentException` - if the specified context path is malformed (it must be "" or start with a slash)
    `java.lang.IllegalArgumentException` - if the specified context path does not identify a currently installed web application
    `java.io.IOException` - if an input/output error occurs during removal

### remove

    public void remove(java.lang.String contextPath,
                       boolean undeploy)
                throws java.io.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.

  Specified by:
    `remove` in interface `Deployer`
  Parameters:
    `contextPath` - The context path of the application to be removed
    `undeploy` - boolean flag to remove web application from server
  Throws:
    `java.lang.IllegalArgumentException` - if the specified context path is malformed (it must be "" or start with a slash)
    `java.lang.IllegalArgumentException` - if the specified context path does not identify a currently installed web application
    `java.io.IOException` - if an input/output error occurs during removal

### start

    public void start(java.lang.String contextPath)
               throws java.io.IOException

  Start an existing web application, attached to the specified context path. Only starts a web application if it is not running.

  Specified by:
    `start` in interface `Deployer`
  Parameters:
    `contextPath` - The context path of the application to be started
  Throws:
    `java.lang.IllegalArgumentException` - if the specified context path is malformed (it must be "" or start with a slash)
    `java.lang.IllegalArgumentException` - if the specified context path does not identify a currently installed web application
    `java.io.IOException` - if an input/output error occurs during startup

### stop

    public void stop(java.lang.String contextPath)
              throws java.io.IOException

  Stop an existing web application, attached to the specified context path. Only stops a web application if it is running.

  Specified by:
    `stop` in interface `Deployer`
  Parameters:
    `contextPath` - The context path of the application to be stopped
  Throws:
    `java.lang.IllegalArgumentException` - if the specified context path is malformed (it must be "" or start with a slash)
    `java.lang.IllegalArgumentException` - if the specified context path does not identify a currently installed web application
    `java.io.IOException` - if an input/output error occurs while stopping the web application

### addChild

    public void addChild(Container child)

  Delegate a request to add a child Context to our associated Host.

  Parameters:
    `child` - The child Context to be added

### getParentClassLoader

    public java.lang.ClassLoader getParentClassLoader()

  Delegate a request for the parent class loader to our associated Host.

### isDeployXML

    public boolean isDeployXML()

  Returns true if context.xml config files are supported.

  Specified by:
    `isDeployXML` in interface `Deployer`
  Returns:
    true of context.xml config files are supported, false otherwise

### createDigester

    protected org.apache.commons.digester.Digester createDigester()

  Create (if necessary) and return a Digester configured to process the context configuration descriptor for an application.

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