Package org.apache.catalina.startup
Class HostConfig
- java.lang.Object
-
- org.apache.catalina.startup.HostConfig
-
- All Implemented Interfaces:
LifecycleListener
public class HostConfig extends Object implements LifecycleListener
Startup event listener for a Host that configures the properties of that Host, and the associated defined contexts.- Version:
- $Revision: 1.4 $ $Date: 2006/10/03 20:19:13 $
- Author:
- Craig R. McClanahan, Remy Maucherat
-
-
Field Summary
Fields Modifier and Type Field Description protected StringconfigClassThe Java class name of the Context configuration class we should use.protected StringcontextClassThe Java class name of the Context implementation we should use.protected intdebugThe debugging detail level for this component.protected List<String>deployedThe names of applications that we have auto-deployed (to avoid double deployment attempts).protected HosthostThe Host we are associated with.protected Set<String>invalidWarsThe list of Wars in the appBase to be ignored because they are invalid (e.g.
-
Constructor Summary
Constructors Constructor Description HostConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FileappBase()Return a File object representing the "application root" directory for our associated Host.protected voidcheck()Deploy webapps.protected voidcheckContextLastModified()Check deployment descriptors last modified date.protected FileconfigBase()Return a File object representing the "configuration root" directory for our associated Host.protected voiddeployApps()Deploy applications for any directories or WAR files that are found in our "application root" directory.protected voiddeployDescriptors(File configBase, String[] files)Deploy XML context descriptors.protected voiddeployDirectories(File appBase, String[] files)Deploy directories.protected voiddeployWARs(File appBase, String[] files)Deploy WAR files.protected voidexpand(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 Stringexpand(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.StringgetConfigClass()Return the Context configuration class name.StringgetContextClass()Return the Context implementation class name.intgetDebug()Return the debugging detail level for this component.booleangetXmlNamespaceAware()Get the server.xmlattribute's xmlNamespaceAware. booleangetXmlValidation()Get the server.xmlattribute's xmlValidation. booleanisDeployXML()Return the deploy XML config file flag for this component.booleanisUnpackWARs()Return the unpack WARs flag.voidlifecycleEvent(LifecycleEvent event)Process the START event for an associated Host.protected voidlog(String message)Log a message on the Logger associated with our Host (if any)protected voidlog(String message, Throwable throwable)Log a message on the Logger associated with our Host (if any)protected booleanrestartContext(Context context)voidsetConfigClass(String configClass)Set the Context configuration class name.voidsetContextClass(String contextClass)Set the Context implementation class name.voidsetDebug(int debug)Set the debugging detail level for this component.voidsetDeployXML(boolean deployXML)Set the deploy XML config file flag for this component.voidsetUnpackWARs(boolean unpackWARs)Set the unpack WARs flag.voidsetXmlNamespaceAware(boolean xmlNamespaceAware)Set the namespace aware feature of the XML parser used when parsing xml instances.voidsetXmlValidation(boolean xmlValidation)Set the validation feature of the XML parser used when parsing xml instances.voidstart()Process a "start" event for this Host.voidstop()Process a "stop" event for this Host.protected voidundeployApps()Undeploy all deployed applications.
-
-
-
Field Detail
-
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 List<String> 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.
-
-
Method Detail
-
getConfigClass
public String getConfigClass()
Return the Context configuration class name.
-
setConfigClass
public void setConfigClass(String configClass)
Set the Context configuration class name.- Parameters:
configClass- The new Context configuration class name.
-
getContextClass
public String getContextClass()
Return the Context implementation class name.
-
setContextClass
public void setContextClass(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
-
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
-
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
-
getXmlValidation
public boolean getXmlValidation()
Get the server.xmlattribute's xmlValidation. - Returns:
- true if validation is enabled.
-
getXmlNamespaceAware
public boolean getXmlNamespaceAware()
Get the server.xmlattribute's xmlNamespaceAware. - Returns:
- true if namespace awarenes is enabled.
-
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
-
lifecycleEvent
public void lifecycleEvent(LifecycleEvent event)
Process the START event for an associated Host.- Specified by:
lifecycleEventin interfaceLifecycleListener- Parameters:
event- The lifecycle event that has occurred
-
appBase
protected File appBase()
Return a File object representing the "application root" directory for our associated Host.
-
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.
-
checkContextLastModified
protected void checkContextLastModified()
Check deployment descriptors last modified date.
-
restartContext
protected boolean restartContext(Context context)
-
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:")- Throws:
IllegalArgumentException- if this is not a "jar:" URLIOException- if an input/output error was encountered during expansion
-
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 copieddocBase- Document base directory into which we are expandingname- Relative pathname of the file to be created- Throws:
IOException- if an input/output error occurs
-
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 loggedthrowable- Associated exception
-
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.
-
check
protected void check()
Deploy webapps.
-
-