org.apache.catalina.startup

Class HostConfig

Implemented Interfaces:
LifecycleListener

public class HostConfig
extends java.lang.Object
implements LifecycleListener

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

Version:
$Revision: 1.31.2.1 $ $Date: 2004/08/21 19:14:28 $

Authors:
Craig R. McClanahan
Remy Maucherat

Field Summary

protected String
configClass
The Java class name of the Context configuration class we should use.
protected String
contextClass
The Java class name of the Context implementation we should use.
protected int
debug
The debugging detail level for this component.
protected 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.

Method Summary

protected File
appBase()
Return a File object representing the "application root" directory for our associated Host.
protected void
check()
Deploy webapps.
protected void
checkContextLastModified()
Check deployment descriptors last modified date.
protected void
checkRemoveApps()
Check remove wars, dir and context xml's
protected File
configBase()
Return a File object representing the "configuration root" directory for our associated Host.
protected void
deployApps()
Deploy applications for any directories or WAR files that are found in our "application root" directory.
protected void
deployDescriptors(File configBase, String[] files)
Deploy XML context descriptors.
protected void
deployDirectories(File appBase, String[] files)
Deploy directories.
protected void
deployWARs(File appBase, String[] files)
Deploy WAR files.
protected void
expand(InputStream input, File docBase, String name)
Expand the specified input stream into the specified directory, creating a file named from the specified relative path.
protected String
expand(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.
String
getConfigClass()
Return the Context configuration class name.
String
getContextClass()
Return the Context implementation class name.
int
getDebug()
Return the debugging detail level for this component.
boolean
getXmlNamespaceAware()
Get the server.xml attribute's xmlNamespaceAware.
boolean
getXmlValidation()
Get the server.xml attribute's xmlValidation.
boolean
isDeployXML()
Return the deploy XML config file 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(String message)
Log a message on the Logger associated with our Host (if any)
protected void
log(String message, Throwable throwable)
Log a message on the Logger associated with our Host (if any)
protected boolean
restartContext(Context context)
void
setConfigClass(String configClass)
Set the Context configuration class name.
void
setContextClass(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
setUnpackWARs(boolean unpackWARs)
Set the unpack WARs flag.
void
setXmlNamespaceAware(boolean xmlNamespaceAware)
Set the namespace aware feature of the XML parser used when parsing xml instances.
void
setXmlValidation(boolean xmlValidation)
Set the validation feature of the XML parser used when parsing xml instances.
void
start()
Process a "start" event for this Host.
void
stop()
Process a "stop" event for this Host.
protected void
undeployApps()
Undeploy all deployed applications.

Field Details

configClass

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


contextClass

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

Method Details

appBase

protected File appBase()
Return a File object representing the "application root" directory for our associated Host.


check

protected void check()
Deploy webapps.


checkContextLastModified

protected void checkContextLastModified()
Check deployment descriptors last modified date.


checkRemoveApps

protected void checkRemoveApps()
Check remove wars, dir and context xml's


configBase

protected File configBase()
Return a File object representing the "configuration 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(File configBase,
                                 String[] files)
Deploy XML context descriptors.


deployDirectories

protected void deployDirectories(File appBase,
                                 String[] files)
Deploy directories.

Parameters:
appBase - The Host appBase


deployWARs

protected void deployWARs(File appBase,
                          String[] files)
Deploy WAR files.


expand

protected void expand(InputStream input,
                      File docBase,
                      String name)
            throws 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


expand

protected String expand(URL war)
            throws 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:")


getConfigClass

public String getConfigClass()
Return the Context configuration class name.


getContextClass

public String getContextClass()
Return the Context implementation class name.


getDebug

public int getDebug()
Return the debugging detail level for this component.


getXmlNamespaceAware

public boolean getXmlNamespaceAware()
Get the server.xml attribute's xmlNamespaceAware.

Returns:
true if namespace awarenes is enabled.


getXmlValidation

public boolean getXmlValidation()
Get the server.xml attribute's xmlValidation.

Returns:
true if validation is enabled.


isDeployXML

public boolean isDeployXML()
Return the deploy XML config file flag for this component.


isUnpackWARs

public boolean isUnpackWARs()
Return the 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


log

protected void log(String message)
Log a message on the Logger associated with our Host (if any)

Parameters:
message - Message to be logged


log

protected void log(String message,
                   Throwable throwable)
Log a message on the Logger associated with our Host (if any)

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


restartContext

protected boolean restartContext(Context context)


setConfigClass

public void setConfigClass(String configClass)
Set the Context configuration class name.

Parameters:
configClass - The new Context configuration class name.


setContextClass

public void setContextClass(String contextClass)
Set the Context implementation class name.

Parameters:
contextClass - The new Context implementation class name.


setDebug

public void setDebug(int debug)
Set the debugging detail level for this component.

Parameters:
debug - The new debugging detail level


setDeployXML

public void setDeployXML(boolean deployXML)
Set the deploy XML config file flag for this component.

Parameters:
deployXML - The new deploy XML flag


setUnpackWARs

public void setUnpackWARs(boolean unpackWARs)
Set the unpack WARs flag.

Parameters:
unpackWARs - The new unpack WARs flag


setXmlNamespaceAware

public void setXmlNamespaceAware(boolean xmlNamespaceAware)
Set the namespace aware feature of the XML parser used when parsing xml instances.

Parameters:
xmlNamespaceAware - true to enable namespace awareness


setXmlValidation

public void setXmlValidation(boolean xmlValidation)
Set the validation feature of the XML parser used when parsing xml instances.

Parameters:
xmlValidation - true to enable xml instance validation


start

public void start()
Process a "start" event for this Host.


stop

public void stop()
Process a "stop" event for this Host.


undeployApps

protected void undeployApps()
Undeploy all deployed applications.


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.