Catalina (Apache Tomcat 9.0.121 API Documentation)
Description: declaration: package: org.apache.catalina.startup, class: Catalina

# Class Catalina

java.lang.Object
org.apache.catalina.startup.Catalina

public class Catalina extends Object
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 Classes
  Modifier and Type
  Class
  Description
  `protected class`
  `Catalina.CatalinaShutdownHook`
  Shutdown hook which will perform a clean shutdown of Catalina if needed.
  `static interface`
  `Catalina.ServerXml`
  Interface for generated server XML loading classes.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected boolean`
  `await`
  Use await.
  `protected boolean`
  `clusterUnavailabilityLogged`
  Prevent duplicate log lines when clustering is unavailable.
  `protected String`
  `configFile`
  Pathname to the server configuration file.
  `protected boolean`
  `generateCode`
  Generate Tomcat embedded code from configuration files.
  `protected File`
  `generatedCodeLocation`
  Location of generated sources.
  `protected String`
  `generatedCodeLocationParameter`
  Value of the argument.
  `protected String`
  `generatedCodePackage`
  Top package name for generated source.
  `protected boolean`
  `loaded`
  Prevent duplicate loads.
  `protected ClassLoader`
  `parentClassLoader`
  The shared extensions class loader for this server.
  `protected Server`
  `server`
  The server component we are starting or stopping.
  `static final String`
  `SERVER_XML`
  Default path to the server configuration file.
  `protected Thread`
  `shutdownHook`
  Shutdown hook.
  `protected static final StringManager`
  `sm`
  The string manager for this package.
  `protected boolean`
  `useGeneratedCode`
  Use generated code as a replacement for configuration files.
  `protected boolean`
  `useNaming`
  Is naming enabled ?
  `protected boolean`
  `useShutdownHook`
  Use shutdown hook flag.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Catalina()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `arguments(String[] args)`
  Process the specified command line arguments.
  `void`
  `await()`
  Await and shutdown.
  `protected File`
  `configFile()`
  Return a File object representing our configuration file.
  `protected Digester`
  `createStartDigester()`
  Create and configure the Digester we will be using for startup.
  `protected Digester`
  `createStopDigester()`
  Create and configure the Digester we will be using for shutdown.
  `protected void`
  `generateClassFooter(Digester digester)`
  Generate the class footer for generated code.
  `protected void`
  `generateClassHeader(Digester digester, boolean start)`
  Generate the class header for generated code.
  `protected void`
  `generateLoader()`
  Generate the loader class for generated code.
  `String`
  `getConfigFile()`
  Return the pathname to the server configuration file.
  `boolean`
  `getGenerateCode()`
  Return whether code generation is enabled.
  `File`
  `getGeneratedCodeLocation()`
  Return the location of generated sources.
  `String`
  `getGeneratedCodePackage()`
  Return the top package name for generated source.
  `ClassLoader`
  `getParentClassLoader()`
  Return the shared extensions class loader.
  `Server`
  `getServer()`
  Return the server component.
  `boolean`
  `getUseGeneratedCode()`
  Return whether generated code should be used.
  `boolean`
  `getUseShutdownHook()`
  Return whether a shutdown hook is used.
  `protected void`
  `initDirs()`
  Deprecated.
  unused.
  `protected void`
  `initNaming()`
  Initialize naming support.
  `protected void`
  `initStreams()`
  Initialize output stream redirection.
  `boolean`
  `isAwait()`
  Return the await flag.
  `boolean`
  `isUseNaming()`
  Return whether naming is enabled.
  `void`
  `load()`
  Start a new server instance.
  `void`
  `load(String[] args)`
  Load the server configuration and initialize the server using the specified command line arguments.
  `protected void`
  `parseServerXml(boolean start)`
  Parse the server.xml configuration file.
  `void`
  `setAwait(boolean b)`
  Set the await flag.
  `void`
  `setConfigFile(String file)`
  Set the pathname to the server configuration file.
  `void`
  `setGenerateCode(boolean generateCode)`
  Set whether code generation is enabled.
  `void`
  `setGeneratedCodeLocation(File generatedCodeLocation)`
  Set the location of generated sources.
  `void`
  `setGeneratedCodePackage(String generatedCodePackage)`
  Set the top package name for generated source.
  `void`
  `setParentClassLoader(ClassLoader parentClassLoader)`
  Set the shared extensions class loader.
  `protected void`
  `setSecurityProtection()`
  Set the security package access/protection.
  `void`
  `setServer(Server server)`
  Set the server component.
  `void`
  `setUseGeneratedCode(boolean useGeneratedCode)`
  Set whether generated code should be used.
  `void`
  `setUseNaming(boolean useNaming)`
  Enables or disables naming support.
  `void`
  `setUseShutdownHook(boolean useShutdownHook)`
  Set whether to use a shutdown hook.
  `void`
  `start()`
  Start a new server instance.
  `void`
  `stop()`
  Stop an existing server instance.
  `void`
  `stopServer()`
  Stop the currently running server instance.
  `void`
  `stopServer(String[] arguments)`
  Stop the currently running server instance.
  `protected void`
  `usage()`
  Print usage information for this application.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    The string manager for this package.

  - ### SERVER_XML

    public static final String SERVER_XML
    Default path to the server configuration file.
    See Also:
      - Constant Field Values

  - ### await

    protected boolean await
    Use await.

  - ### configFile

    protected String configFile
    Pathname to the server configuration file.

  - ### parentClassLoader

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

  - ### generateCode

    protected boolean generateCode
    Generate Tomcat embedded code from configuration files.

  - ### generatedCodeLocation

    protected File generatedCodeLocation
    Location of generated sources.

  - ### generatedCodeLocationParameter

    protected String generatedCodeLocationParameter
    Value of the argument.

  - ### generatedCodePackage

    protected String generatedCodePackage
    Top package name for generated source.

  - ### useGeneratedCode

    protected boolean useGeneratedCode
    Use generated code as a replacement for configuration files.

- ## Constructor Details

  - ### Catalina

    public Catalina()
    Default constructor.

- ## Method Details

  - ### setConfigFile

    public void setConfigFile(String file)
    Set the pathname to the server configuration file.
    Parameters:
      `file` - The new configuration file path

  - ### getConfigFile

    public 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:
      `true` if a shutdown hook is used

  - ### getGenerateCode

    public boolean getGenerateCode()
    Return whether code generation is enabled.
    Returns:
      `true` if 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:
      `true` if 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 File getGeneratedCodeLocation()
    Return the location of generated sources.
    Returns:
      the generated code location

  - ### setGeneratedCodeLocation

    public void setGeneratedCodeLocation(File generatedCodeLocation)
    Set the location of generated sources.
    Parameters:
      `generatedCodeLocation` - The new generated code location

  - ### getGeneratedCodePackage

    public String getGeneratedCodePackage()
    Return the top package name for generated source.
    Returns:
      the generated code package name

  - ### setGeneratedCodePackage

    public void setGeneratedCodePackage(String generatedCodePackage)
    Set the top package name for generated source.
    Parameters:
      `generatedCodePackage` - The new generated code package name

  - ### setParentClassLoader

    public void setParentClassLoader(ClassLoader parentClassLoader)
    Set the shared extensions class loader.
    Parameters:
      `parentClassLoader` - The shared extensions class loader.

  - ### getParentClassLoader

    public 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:
      `true` if 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:
      `true` if await is enabled

  - ### arguments

    protected boolean arguments(String[] args)
    Process the specified command line arguments.
    Parameters:
      `args` - Command line arguments to process
    Returns:
      `true` if we should continue processing

  - ### configFile

    protected 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` - `true` if parsing for start, `false` if parsing for stop

  - ### stopServer

    public void stopServer()
    Stop the currently running server instance.

  - ### stopServer

    public void stopServer(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(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.

  - ### initDirs

    @Deprecated protected void initDirs()
    Deprecated.
    unused. Will be removed in Tomcat 10 onwards.

  - ### 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 instance
      `start` - `true` if generating start code, `false` if generating stop code

  - ### generateClassFooter

    protected void generateClassFooter(Digester digester)
    Generate the class footer for generated code.
    Parameters:
      `digester` - The digester instance