public class HostConfig extends java.lang.Object implements LifecycleListener
Modifier and Type | Class and Description |
---|---|
protected static class |
HostConfig.DeployedApplication
This class represents the state of a deployed application, as well as
the monitored resources.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
contextClass
The Java class name of the Context implementation we should use.
|
protected boolean |
copyXML
Should XML files be copied to
$CATALINA_BASE/conf/<engine>/<host> by default when
a web application is deployed?
|
protected java.util.Map<java.lang.String,HostConfig.DeployedApplication> |
deployed
Map of deployed applications.
|
protected boolean |
deployXML
Should we deploy XML Context config files packaged with WAR files and
directories?
|
protected Digester |
digester
The
Digester instance used to parse context descriptors. |
protected static long |
FILE_MODIFICATION_RESOLUTION_MS
The resolution, in milliseconds, of file modification times.
|
protected Host |
host
The Host we are associated with.
|
protected java.util.Set<java.lang.String> |
invalidWars
The list of Wars in the appBase to be ignored because they are invalid
(e.g. contain /../ sequences).
|
protected javax.management.ObjectName |
oname
The JMX ObjectName of this component.
|
protected java.util.ArrayList<java.lang.String> |
serviced
List of applications which are being serviced, and shouldn't be
deployed/undeployed/redeployed at the moment.
|
protected static StringManager |
sm
The string resources for this package.
|
protected boolean |
unpackWARs
Should we unpack WAR files when auto-deploying applications in the
appBase directory? |
Constructor and Description |
---|
HostConfig() |
Modifier and Type | Method and Description |
---|---|
protected void |
addGlobalRedeployResources(HostConfig.DeployedApplication app) |
void |
addServiced(java.lang.String name)
Add a serviced application to the list.
|
protected void |
addWatchedResources(HostConfig.DeployedApplication app,
java.lang.String docBase,
Context context)
Add watched resources to the specified Context.
|
void |
beforeStart() |
protected void |
check()
Check status of all webapps.
|
void |
check(java.lang.String name)
Check status of a specific web application and reload, redeploy or deploy
it as necessary.
|
protected void |
checkResources(HostConfig.DeployedApplication app)
Deprecated.
Use
checkResources(DeployedApplication, boolean) .
Will be removed in Tomcat 8.5.x |
protected void |
checkResources(HostConfig.DeployedApplication app,
boolean skipFileModificationResolutionCheck)
Check resources for redeployment and reloading.
|
void |
checkUndeploy()
Check for old versions of applications using parallel deployment that are
now unused (have no active sessions) and undeploy any that are found.
|
protected static Digester |
createDigester(java.lang.String contextClassName)
Create the digester which will be used to parse context config files.
|
protected void |
deployApps()
Deploy applications for any directories or WAR files that are found
in our "application root" directory.
|
protected void |
deployApps(java.lang.String name)
Deploy applications for any directories or WAR files that are found
in our "application root" directory.
|
protected void |
deployDescriptor(ContextName cn,
java.io.File contextXml) |
protected void |
deployDescriptors(java.io.File configBase,
java.lang.String[] files)
Deploy XML context descriptors.
|
protected void |
deployDirectories(java.io.File appBase,
java.lang.String[] files)
Deploy directories.
|
protected void |
deployDirectory(ContextName cn,
java.io.File dir) |
protected boolean |
deploymentExists(java.lang.String contextName)
Check if a webapp is already deployed in this host.
|
protected void |
deployWAR(ContextName cn,
java.io.File war) |
protected void |
deployWARs(java.io.File appBase,
java.lang.String[] files)
Deploy WAR files.
|
protected java.lang.String[] |
filterAppPaths(java.lang.String[] unfilteredAppPaths)
Filter the list of application file paths to remove those that match
the regular expression defined by
Host.getDeployIgnore() . |
java.lang.String |
getConfigBaseName()
Get the name of the configBase.
|
java.lang.String |
getContextClass()
Return the Context implementation class name.
|
long |
getDeploymentTime(java.lang.String name)
Get the instant where an application was deployed.
|
boolean |
isCopyXML()
Return the copy XML config file flag for this component.
|
boolean |
isDeployed(java.lang.String name)
Has the specified application been deployed?
|
boolean |
isDeployXML()
Return the deploy XML config file flag for this component.
|
boolean |
isServiced(java.lang.String name)
Is application serviced ?
|
boolean |
isUnpackWARs()
Return the unpack WARs flag.
|
void |
lifecycleEvent(LifecycleEvent event)
Process the START event for an associated Host.
|
void |
manageApp(Context context)
Add a new Context to be managed by us.
|
void |
removeServiced(java.lang.String name)
Removed a serviced application from the list.
|
protected java.io.File |
returnCanonicalPath(java.lang.String path) |
void |
setContextClass(java.lang.String contextClass)
Set the Context implementation class name.
|
void |
setCopyXML(boolean copyXML)
Set the copy XML config file flag 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 |
start()
Process a "start" event for this Host.
|
void |
stop()
Process a "stop" event for this Host.
|
void |
unmanageApp(java.lang.String contextName)
Remove a webapp from our control.
|
protected static final long FILE_MODIFICATION_RESOLUTION_MS
protected java.lang.String contextClass
protected Host host
protected javax.management.ObjectName oname
protected static final StringManager sm
protected boolean deployXML
protected boolean copyXML
protected boolean unpackWARs
appBase
directory?protected final java.util.Map<java.lang.String,HostConfig.DeployedApplication> deployed
protected final java.util.ArrayList<java.lang.String> serviced
protected Digester digester
Digester
instance used to parse context descriptors.protected final java.util.Set<java.lang.String> invalidWars
public java.lang.String getContextClass()
public void setContextClass(java.lang.String contextClass)
contextClass
- The new Context implementation class name.public boolean isDeployXML()
public void setDeployXML(boolean deployXML)
deployXML
- The new deploy XML flagpublic boolean isCopyXML()
public void setCopyXML(boolean copyXML)
copyXML
- The new copy XML flagpublic boolean isUnpackWARs()
public void setUnpackWARs(boolean unpackWARs)
unpackWARs
- The new unpack WARs flagpublic void lifecycleEvent(LifecycleEvent event)
lifecycleEvent
in interface LifecycleListener
event
- The lifecycle event that has occurredpublic void addServiced(java.lang.String name)
public boolean isServiced(java.lang.String name)
public void removeServiced(java.lang.String name)
public long getDeploymentTime(java.lang.String name)
public boolean isDeployed(java.lang.String name)
true
if the application has been deployed and
false
if the application has not been deployed or does not
existprotected static Digester createDigester(java.lang.String contextClassName)
protected java.io.File returnCanonicalPath(java.lang.String path)
public java.lang.String getConfigBaseName()
protected void deployApps()
protected java.lang.String[] filterAppPaths(java.lang.String[] unfilteredAppPaths)
Host.getDeployIgnore()
.unfilteredAppPaths
- The list of application paths to filterprotected void deployApps(java.lang.String name)
protected void deployDescriptors(java.io.File configBase, java.lang.String[] files)
protected void deployDescriptor(ContextName cn, java.io.File contextXml)
cn
- contextXml
- protected void deployWARs(java.io.File appBase, java.lang.String[] files)
protected void deployWAR(ContextName cn, java.io.File war)
cn
- war
- protected void deployDirectories(java.io.File appBase, java.lang.String[] files)
protected void deployDirectory(ContextName cn, java.io.File dir)
cn
- dir
- protected boolean deploymentExists(java.lang.String contextName)
contextName
- of the context which will be checkedprotected void addWatchedResources(HostConfig.DeployedApplication app, java.lang.String docBase, Context context)
app
- HostConfig deployed appdocBase
- web app docBasecontext
- web application contextprotected void addGlobalRedeployResources(HostConfig.DeployedApplication app)
@Deprecated protected void checkResources(HostConfig.DeployedApplication app)
checkResources(DeployedApplication, boolean)
.
Will be removed in Tomcat 8.5.xprotected void checkResources(HostConfig.DeployedApplication app, boolean skipFileModificationResolutionCheck)
app
- The web application to checkskipFileModificationResolutionCheck
- When checking files for modification should the check that
requires that any file modification must have occurred at
least as long ago as the resolution of the file time stamp
be skippedpublic void beforeStart()
public void start()
public void stop()
protected void check()
public void check(java.lang.String name)
name
- The name of the web application to checkpublic void checkUndeploy()
public void manageApp(Context context)
public void unmanageApp(java.lang.String contextName)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.