Package org.apache.catalina.startup
Class Catalina
- java.lang.Object
-
- org.apache.catalina.startup.Catalina
-
public class Catalina extends java.lang.ObjectStartup/Shutdown shell program for Catalina. The following command line options are recognized:- -config {pathname} - Set the pathname of the configuration file to be processed. If a relative path is specified, it will be interpreted as relative to the directory pathname specified by the "catalina.base" system property. [conf/server.xml]
- -help - Display usage information.
- -nonaming - Disable naming support.
- configtest - Try to test the config
- start - Start an instance of Catalina.
- stop - Stop the currently running instance of Catalina.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classCatalina.CatalinaShutdownHookShutdown hook which will perform a clean shutdown of Catalina if needed.static interfaceCatalina.ServerXmlInterface for generated server XML loading classes.
-
Field Summary
Fields Modifier and Type Field Description protected booleanawaitUse await.protected booleanclusterUnavailabilityLoggedPrevent duplicate log lines when clustering is unavailable.protected java.lang.StringconfigFilePathname to the server configuration file.protected booleangenerateCodeGenerate Tomcat embedded code from configuration files.protected java.io.FilegeneratedCodeLocationLocation of generated sources.protected java.lang.StringgeneratedCodeLocationParameterValue of the argument.protected java.lang.StringgeneratedCodePackageTop package name for generated source.protected booleanloadedPrevent duplicate loads.protected java.lang.ClassLoaderparentClassLoaderThe shared extensions class loader for this server.protected ServerserverThe server component we are starting or stopping.static java.lang.StringSERVER_XMLDefault path to the server configuration file.protected java.lang.ThreadshutdownHookShutdown hook.protected static StringManagersmThe string manager for this package.protected booleanthrowOnInitFailureRethrow exceptions on init failure.protected booleanuseGeneratedCodeUse generated code as a replacement for configuration files.protected booleanuseNamingIs naming enabled ?protected booleanuseShutdownHookUse shutdown hook flag.
-
Constructor Summary
Constructors Constructor Description Catalina()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanarguments(java.lang.String[] args)Process the specified command line arguments.voidawait()Await and shutdown.protected java.io.FileconfigFile()Return a File object representing our configuration file.protected DigestercreateStartDigester()Create and configure the Digester we will be using for startup.protected DigestercreateStopDigester()Create and configure the Digester we will be using for shutdown.protected voidgenerateClassFooter(Digester digester)Generate the class footer for generated code.protected voidgenerateClassHeader(Digester digester, boolean start)Generate the class header for generated code.protected voidgenerateLoader()Generate the loader class for generated code.java.lang.StringgetConfigFile()Return the pathname to the server configuration file.booleangetGenerateCode()Return whether code generation is enabled.java.io.FilegetGeneratedCodeLocation()Return the location of generated sources.java.lang.StringgetGeneratedCodePackage()Return the top package name for generated source.java.lang.ClassLoadergetParentClassLoader()Return the shared extensions class loader.ServergetServer()Return the server component.booleangetThrowOnInitFailure()Return whether an exception should be thrown if an error occurs during server init.booleangetUseGeneratedCode()Return whether generated code should be used.booleangetUseShutdownHook()Return whether a shutdown hook is used.protected voidinitNaming()Initialize naming support.protected voidinitStreams()Initialize output stream redirection.booleanisAwait()Return the await flag.booleanisUseNaming()Return whether naming is enabled.voidload()Start a new server instance.voidload(java.lang.String[] args)Load the server configuration and initialize the server using the specified command line arguments.protected voidparseServerXml(boolean start)Parse the server.xml configuration file.voidsetAwait(boolean b)Set the await flag.voidsetConfigFile(java.lang.String file)Set the pathname to the server configuration file.voidsetGenerateCode(boolean generateCode)Set whether code generation is enabled.voidsetGeneratedCodeLocation(java.io.File generatedCodeLocation)Set the location of generated sources.voidsetGeneratedCodePackage(java.lang.String generatedCodePackage)Set the top package name for generated source.voidsetParentClassLoader(java.lang.ClassLoader parentClassLoader)Set the shared extensions class loader.protected voidsetSecurityProtection()Set the security package access/protection.voidsetServer(Server server)Set the server component.voidsetThrowOnInitFailure(boolean throwOnInitFailure)Set the behavior regarding errors that could occur during server init.voidsetUseGeneratedCode(boolean useGeneratedCode)Set whether generated code should be used.voidsetUseNaming(boolean useNaming)Enables or disables naming support.voidsetUseShutdownHook(boolean useShutdownHook)Set whether to use a shutdown hook.voidstart()Start a new server instance.voidstop()Stop an existing server instance.voidstopServer()Stop the currently running server instance.voidstopServer(java.lang.String[] arguments)Stop the currently running server instance.protected voidusage()Print usage information for this application.
-
-
-
Field Detail
-
sm
protected static final StringManager sm
The string manager for this package.
-
SERVER_XML
public static final java.lang.String SERVER_XML
Default path to the server configuration file.- See Also:
- Constant Field Values
-
await
protected boolean await
Use await.
-
configFile
protected java.lang.String configFile
Pathname to the server configuration file.
-
parentClassLoader
protected java.lang.ClassLoader parentClassLoader
The shared extensions class loader for this server.
-
server
protected Server server
The server component we are starting or stopping.
-
useShutdownHook
protected boolean useShutdownHook
Use shutdown hook flag.
-
shutdownHook
protected java.lang.Thread shutdownHook
Shutdown hook.
-
useNaming
protected boolean useNaming
Is naming enabled ?
-
loaded
protected boolean loaded
Prevent duplicate loads.
-
clusterUnavailabilityLogged
protected boolean clusterUnavailabilityLogged
Prevent duplicate log lines when clustering is unavailable.
-
throwOnInitFailure
protected boolean throwOnInitFailure
Rethrow exceptions on init failure.
-
generateCode
protected boolean generateCode
Generate Tomcat embedded code from configuration files.
-
generatedCodeLocation
protected java.io.File generatedCodeLocation
Location of generated sources.
-
generatedCodeLocationParameter
protected java.lang.String generatedCodeLocationParameter
Value of the argument.
-
generatedCodePackage
protected java.lang.String generatedCodePackage
Top package name for generated source.
-
useGeneratedCode
protected boolean useGeneratedCode
Use generated code as a replacement for configuration files.
-
-
Method Detail
-
setConfigFile
public void setConfigFile(java.lang.String file)
Set the pathname to the server configuration file.- Parameters:
file- The new configuration file path
-
getConfigFile
public java.lang.String getConfigFile()
Return the pathname to the server configuration file.- Returns:
- the configuration file path
-
setUseShutdownHook
public void setUseShutdownHook(boolean useShutdownHook)
Set whether to use a shutdown hook.- Parameters:
useShutdownHook- The new use shutdown hook value
-
getUseShutdownHook
public boolean getUseShutdownHook()
Return whether a shutdown hook is used.- Returns:
trueif a shutdown hook is used
-
getGenerateCode
public boolean getGenerateCode()
Return whether code generation is enabled.- Returns:
trueif code generation is enabled
-
setGenerateCode
public void setGenerateCode(boolean generateCode)
Set whether code generation is enabled.- Parameters:
generateCode- The new code generation value
-
getUseGeneratedCode
public boolean getUseGeneratedCode()
Return whether generated code should be used.- Returns:
trueif generated code should be used
-
setUseGeneratedCode
public void setUseGeneratedCode(boolean useGeneratedCode)
Set whether generated code should be used.- Parameters:
useGeneratedCode- The new use generated code value
-
getGeneratedCodeLocation
public java.io.File getGeneratedCodeLocation()
Return the location of generated sources.- Returns:
- the generated code location
-
setGeneratedCodeLocation
public void setGeneratedCodeLocation(java.io.File generatedCodeLocation)
Set the location of generated sources.- Parameters:
generatedCodeLocation- The new generated code location
-
getGeneratedCodePackage
public java.lang.String getGeneratedCodePackage()
Return the top package name for generated source.- Returns:
- the generated code package name
-
setGeneratedCodePackage
public void setGeneratedCodePackage(java.lang.String generatedCodePackage)
Set the top package name for generated source.- Parameters:
generatedCodePackage- The new generated code package name
-
getThrowOnInitFailure
public boolean getThrowOnInitFailure()
Return whether an exception should be thrown if an error occurs during server init.- Returns:
trueif an exception should be thrown if an error occurs during server init
-
setThrowOnInitFailure
public void setThrowOnInitFailure(boolean throwOnInitFailure)
Set the behavior regarding errors that could occur during server init.- Parameters:
throwOnInitFailure- the new flag value
-
setParentClassLoader
public void setParentClassLoader(java.lang.ClassLoader parentClassLoader)
Set the shared extensions class loader.- Parameters:
parentClassLoader- The shared extensions class loader.
-
getParentClassLoader
public java.lang.ClassLoader getParentClassLoader()
Return the shared extensions class loader.- Returns:
- the shared extensions class loader
-
setServer
public void setServer(Server server)
Set the server component.- Parameters:
server- The server component
-
getServer
public Server getServer()
Return the server component.- Returns:
- the server component
-
isUseNaming
public boolean isUseNaming()
Return whether naming is enabled.- Returns:
trueif naming is enabled.
-
setUseNaming
public void setUseNaming(boolean useNaming)
Enables or disables naming support.- Parameters:
useNaming- The new use naming value
-
setAwait
public void setAwait(boolean b)
Set the await flag.- Parameters:
b- The new await value
-
isAwait
public boolean isAwait()
Return the await flag.- Returns:
trueif await is enabled
-
arguments
protected boolean arguments(java.lang.String[] args)
Process the specified command line arguments.- Parameters:
args- Command line arguments to process- Returns:
trueif we should continue processing
-
configFile
protected java.io.File configFile()
Return a File object representing our configuration file.- Returns:
- the main configuration file
-
createStartDigester
protected Digester createStartDigester()
Create and configure the Digester we will be using for startup.- Returns:
- the main digester to parse server.xml
-
createStopDigester
protected Digester createStopDigester()
Create and configure the Digester we will be using for shutdown.- Returns:
- the digester to process the stop operation
-
parseServerXml
protected void parseServerXml(boolean start)
Parse the server.xml configuration file.- Parameters:
start-trueif parsing for start,falseif parsing for stop
-
stopServer
public void stopServer()
Stop the currently running server instance.
-
stopServer
public void stopServer(java.lang.String[] arguments)
Stop the currently running server instance.- Parameters:
arguments- Command line arguments
-
load
public void load()
Start a new server instance.
-
load
public void load(java.lang.String[] args)
Load the server configuration and initialize the server using the specified command line arguments.- Parameters:
args- Command line arguments
-
start
public void start()
Start a new server instance.
-
stop
public void stop()
Stop an existing server instance.
-
await
public void await()
Await and shutdown.
-
usage
protected void usage()
Print usage information for this application.
-
initStreams
protected void initStreams()
Initialize output stream redirection.
-
initNaming
protected void initNaming()
Initialize naming support.
-
setSecurityProtection
protected void setSecurityProtection()
Set the security package access/protection.
-
generateLoader
protected void generateLoader()
Generate the loader class for generated code.
-
generateClassHeader
protected void generateClassHeader(Digester digester, boolean start)
Generate the class header for generated code.- Parameters:
digester- The digester instancestart-trueif generating start code,falseif generating stop code
-
generateClassFooter
protected void generateClassFooter(Digester digester)
Generate the class footer for generated code.- Parameters:
digester- The digester instance
-
-