## org.apache.catalina.startup
Class HostConfig

    java.lang.Object
      org.apache.catalina.startup.HostConfig

All Implemented Interfaces:
  LifecycleListener, java.lang.Runnable

public class HostConfig
extends java.lang.Object
implements LifecycleListener, java.lang.Runnable

Startup event listener for a Host that configures the properties of that Host, and the associated defined contexts.

Version:
  $Revision: 1.25 $ $Date: 2004/08/26 21:41:41 $
Author:
  Craig R. McClanahan, Remy Maucherat

Field Summary
`protected java.lang.String` `configClass` The Java class name of the Context configuration class we should use.
`protected java.lang.String` `contextClass` The Java class name of the Context implementation we should use.
`protected int` `debug` The debugging detail level for this component.
`protected java.util.ArrayList` `deployed` The names of applications that we have auto-deployed (to avoid double deployment attempts).
`protected Host` `host` The Host we are associated with.
`protected static StringManager` `sm` The string resources for this package.

Constructor Summary
`HostConfig()`

Method Summary
`protected java.io.File` `appBase()` Return a File object representing the "application root" directory for our associated Host.
`protected void` `checkWebXmlLastModified()` Check deployment descriptors last modified date.
`protected void` `deployApps()` Deploy applications for any directories or WAR files that are found in our "application root" directory.
`protected void` `deployDescriptors(java.io.File appBase, java.lang.String[] files)` Deploy XML context descriptors.
`protected void` `deployDirectories(java.io.File appBase, java.lang.String[] files)` Deploy directories.
`protected void` `deployWARs(java.io.File appBase, java.lang.String[] files)` Deploy WAR files.
`protected void` `expand(java.io.InputStream input, java.io.File docBase, java.lang.String name)` Expand the specified input stream into the specified directory, creating a file named from the specified relative path.
`protected java.lang.String` `expand(java.net.URL war)` Expand the WAR file found at the specified URL into an unpacked directory structure, and return the absolute pathname to the expanded directory.
`java.lang.String` `getConfigClass()` Return the Context configuration class name.
`java.lang.String` `getContextClass()` Return the Context implementation class name.
`int` `getDebug()` Return the debugging detail level for this component.
`boolean` `isDeployXML()` Return the deploy XML config file flag for this component.
`boolean` `isLiveDeploy()` Return the live deploy flag for this component.
`boolean` `isUnpackWARs()` Return the unpack WARs flag.
`void` `lifecycleEvent(LifecycleEvent event)` Process the START event for an associated Host.
`protected void` `log(java.lang.String message)` Log a message on the Logger associated with our Host (if any)
`protected void` `log(java.lang.String message, java.lang.Throwable throwable)` Log a message on the Logger associated with our Host (if any)
`void` `run()` The background thread that checks for web application autoDeploy and changes to the web.xml config.
`void` `setConfigClass(java.lang.String configClass)` Set the Context configuration class name.
`void` `setContextClass(java.lang.String contextClass)` Set the Context implementation class name.
`void` `setDebug(int debug)` Set the debugging detail level for this component.
`void` `setDeployXML(boolean deployXML)` Set the deploy XML config file flag for this component.
`void` `setLiveDeploy(boolean liveDeploy)` Set the live deploy flag for this component.
`void` `setUnpackWARs(boolean unpackWARs)` Set the unpack WARs flag.
`protected void` `start()` Process a "start" event for this Host.
`protected void` `stop()` Process a "stop" event for this Host.
`protected void` `threadSleep()` Sleep for the duration specified by the `checkInterval` property.
`protected void` `threadStart()` Start the background thread that will periodically check for web application autoDeploy and changes to the web.xml config.
`protected void` `threadStop()` Stop the background thread that is periodically checking for for web application autoDeploy and changes to the web.xml config.
`protected void` `undeployApps()` Undeploy all deployed applications.

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

Field Detail

### configClass

    protected java.lang.String configClass

  The Java class name of the Context configuration class we should use.

### contextClass

    protected java.lang.String contextClass

  The Java class name of the Context implementation we should use.

### debug

    protected int debug

  The debugging detail level for this component.

### deployed

    protected java.util.ArrayList deployed

  The names of applications that we have auto-deployed (to avoid double deployment attempts).

### host

    protected Host host

  The Host we are associated with.

### sm

    protected static final StringManager sm

  The string resources for this package.

Constructor Detail

### HostConfig

    public HostConfig()

Method Detail

### getConfigClass

    public java.lang.String getConfigClass()

  Return the Context configuration class name.

### setConfigClass

    public void setConfigClass(java.lang.String configClass)

  Set the Context configuration class name.

  Parameters:
    `configClass` - The new Context configuration class name.

### getContextClass

    public java.lang.String getContextClass()

  Return the Context implementation class name.

### setContextClass

    public void setContextClass(java.lang.String contextClass)

  Set the Context implementation class name.

  Parameters:
    `contextClass` - The new Context implementation class name.

### getDebug

    public int getDebug()

  Return the debugging detail level for this component.

### setDebug

    public void setDebug(int debug)

  Set the debugging detail level for this component.

  Parameters:
    `debug` - The new debugging detail level

### isDeployXML

    public boolean isDeployXML()

  Return the deploy XML config file flag for this component.

### setDeployXML

    public void setDeployXML(boolean deployXML)

  Set the deploy XML config file flag for this component.

  Parameters:
    `deployXML` - The new deploy XML flag

### isLiveDeploy

    public boolean isLiveDeploy()

  Return the live deploy flag for this component.

### setLiveDeploy

    public void setLiveDeploy(boolean liveDeploy)

  Set the live deploy flag for this component.

  Parameters:
    `liveDeploy` - The new live deploy flag

### isUnpackWARs

    public boolean isUnpackWARs()

  Return the unpack WARs flag.

### setUnpackWARs

    public void setUnpackWARs(boolean unpackWARs)

  Set the unpack WARs flag.

  Parameters:
    `unpackWARs` - The new unpack WARs flag

### lifecycleEvent

    public void lifecycleEvent(LifecycleEvent event)

  Process the START event for an associated Host.

  Specified by:
    `lifecycleEvent` in interface `LifecycleListener`
  Parameters:
    `event` - The lifecycle event that has occurred

### appBase

    protected java.io.File appBase()

  Return a File object representing the "application root" directory for our associated Host.

### deployApps

    protected void deployApps()

  Deploy applications for any directories or WAR files that are found in our "application root" directory.

### deployDescriptors

    protected void deployDescriptors(java.io.File appBase,
                                     java.lang.String[] files)

  Deploy XML context descriptors.

### deployWARs

    protected void deployWARs(java.io.File appBase,
                              java.lang.String[] files)

  Deploy WAR files.

### deployDirectories

    protected void deployDirectories(java.io.File appBase,
                                     java.lang.String[] files)

  Deploy directories.

### checkWebXmlLastModified

    protected void checkWebXmlLastModified()

  Check deployment descriptors last modified date.

### expand

    protected java.lang.String expand(java.net.URL war)
                               throws java.io.IOException

  Expand the WAR file found at the specified URL into an unpacked directory structure, and return the absolute pathname to the expanded directory.

  Parameters:
    `war` - URL of the web application archive to be expanded (must start with "jar:")
  Throws:
    `java.lang.IllegalArgumentException` - if this is not a "jar:" URL
    `java.io.IOException` - if an input/output error was encountered during expansion

### expand

    protected void expand(java.io.InputStream input,
                          java.io.File docBase,
                          java.lang.String name)
                   throws java.io.IOException

  Expand the specified input stream into the specified directory, creating a file named from the specified relative path.

  Parameters:
    `input` - InputStream to be copied
    `docBase` - Document base directory into which we are expanding
    `name` - Relative pathname of the file to be created
  Throws:
    `java.io.IOException` - if an input/output error occurs

### log

    protected void log(java.lang.String message)

  Log a message on the Logger associated with our Host (if any)

  Parameters:
    `message` - Message to be logged

### log

    protected void log(java.lang.String message,
                       java.lang.Throwable throwable)

  Log a message on the Logger associated with our Host (if any)

  Parameters:
    `message` - Message to be logged
    `throwable` - Associated exception

### start

    protected void start()

  Process a "start" event for this Host.

### stop

    protected void stop()

  Process a "stop" event for this Host.

### undeployApps

    protected void undeployApps()

  Undeploy all deployed applications.

### threadStart

    protected void threadStart()

  Start the background thread that will periodically check for web application autoDeploy and changes to the web.xml config.

  Throws:
    `java.lang.IllegalStateException` - if we should not be starting a background thread now

### threadStop

    protected void threadStop()

  Stop the background thread that is periodically checking for for web application autoDeploy and changes to the web.xml config.

### threadSleep

    protected void threadSleep()

  Sleep for the duration specified by the `checkInterval` property.

### run

    public void run()

  The background thread that checks for web application autoDeploy and changes to the web.xml config.

  Specified by:
    `run` in interface `java.lang.Runnable`

Copyright ? 2000-2002 Apache Software Foundation. All Rights Reserved.