Class Catalina
java.lang.Object
org.apache.catalina.startup.Catalina
Startup/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 ClassesModifier and TypeClassDescriptionprotected classShutdown hook which will perform a clean shutdown of Catalina if needed.static interfaceInterface for generated server XML loading classes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanUse await.protected booleanPrevent duplicate log lines when clustering is unavailable.protected StringPathname to the server configuration file.protected booleanGenerate Tomcat embedded code from configuration files.protected FileLocation of generated sources.protected StringValue of the argument.protected StringTop package name for generated source.protected booleanPrevent duplicate loads.protected ClassLoaderThe shared extensions class loader for this server.protected ServerThe server component we are starting or stopping.static final StringDefault path to the server configuration file.protected ThreadShutdown hook.protected static final StringManagerThe string manager for this package.protected booleanRethrow exceptions on init failure.protected booleanUse generated code as a replacement for configuration files.protected booleanIs naming enabled ?protected booleanUse shutdown hook flag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanProcess the specified command line arguments.voidawait()Await and shutdown.protected FileReturn a File object representing our configuration file.protected DigesterCreate and configure the Digester we will be using for startup.protected DigesterCreate 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 voidGenerate the loader class for generated code.Return the pathname to the server configuration file.booleanReturn whether code generation is enabled.Return the location of generated sources.Return the top package name for generated source.Return the shared extensions class loader.Return the server component.booleanReturn whether an exception should be thrown if an error occurs during server init.booleanReturn whether generated code should be used.booleanReturn whether a shutdown hook is used.protected voidInitialize naming support.protected voidInitialize output stream redirection.booleanisAwait()Return the await flag.booleanReturn whether naming is enabled.voidload()Start a new server instance.voidLoad 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(String file) Set the pathname to the server configuration file.voidsetGenerateCode(boolean generateCode) Set whether code generation is enabled.voidsetGeneratedCodeLocation(File generatedCodeLocation) Set the location of generated sources.voidsetGeneratedCodePackage(String generatedCodePackage) Set the top package name for generated source.voidsetParentClassLoader(ClassLoader parentClassLoader) Set the shared extensions class loader.voidSet 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.voidStop the currently running server instance.voidstopServer(String[] arguments) Stop the currently running server instance.protected voidusage()Print usage information for this application.
-
Field Details
-
sm
The string manager for this package. -
SERVER_XML
-
await
protected boolean awaitUse await. -
configFile
Pathname to the server configuration file. -
parentClassLoader
The shared extensions class loader for this server. -
server
The server component we are starting or stopping. -
useShutdownHook
protected boolean useShutdownHookUse shutdown hook flag. -
shutdownHook
Shutdown hook. -
useNaming
protected boolean useNamingIs naming enabled ? -
loaded
protected boolean loadedPrevent duplicate loads. -
throwOnInitFailure
protected boolean throwOnInitFailureRethrow exceptions on init failure. -
generateCode
protected boolean generateCodeGenerate Tomcat embedded code from configuration files. -
generatedCodeLocation
Location of generated sources. -
generatedCodeLocationParameter
Value of the argument. -
generatedCodePackage
Top package name for generated source. -
useGeneratedCode
protected boolean useGeneratedCodeUse generated code as a replacement for configuration files.
-
-
Constructor Details
-
Catalina
public Catalina()Default constructor.
-
-
Method Details
-
setConfigFile
Set the pathname to the server configuration file.- Parameters:
file- The new configuration file path
-
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
Return the location of generated sources.- Returns:
- the generated code location
-
setGeneratedCodeLocation
Set the location of generated sources.- Parameters:
generatedCodeLocation- The new generated code location
-
getGeneratedCodePackage
Return the top package name for generated source.- Returns:
- the generated code package name
-
setGeneratedCodePackage
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
Set the shared extensions class loader.- Parameters:
parentClassLoader- The shared extensions class loader.
-
getParentClassLoader
Return the shared extensions class loader.- Returns:
- the shared extensions class loader
-
setServer
Set the server component.- Parameters:
server- The server component
-
getServer
-
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
Process the specified command line arguments.- Parameters:
args- Command line arguments to process- Returns:
trueif we should continue processing
-
configFile
Return a File object representing our configuration file.- Returns:
- the main configuration file
-
createStartDigester
Create and configure the Digester we will be using for startup.- Returns:
- the main digester to parse server.xml
-
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
Stop the currently running server instance.- Parameters:
arguments- Command line arguments
-
load
public void load()Start a new server instance. -
load
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. -
generateLoader
protected void generateLoader()Generate the loader class for generated code. -
generateClassHeader
Generate the class header for generated code.- Parameters:
digester- The digester instancestart-trueif generating start code,falseif generating stop code
-