Class Catalina


  • public class Catalina
    extends java.lang.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 java.lang.String configFile
      Pathname to the server configuration file.
      protected boolean generateCode
      Generate Tomcat embedded code from configuration files.
      protected java.io.File generatedCodeLocation
      Location of generated sources.
      protected java.lang.String generatedCodeLocationParameter
      Value of the argument.
      protected java.lang.String generatedCodePackage
      Top package name for generated source.
      protected boolean loaded
      Prevent duplicate loads.
      protected java.lang.ClassLoader parentClassLoader
      The shared extensions class loader for this server.
      protected Server server
      The server component we are starting or stopping.
      static java.lang.String SERVER_XML
      Default path to the server configuration file.
      protected java.lang.Thread shutdownHook
      Shutdown hook.
      protected static StringManager sm
      The string manager for this package.
      protected boolean throwOnInitFailure
      Rethrow exceptions on init failure.
      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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean arguments​(java.lang.String[] args)
      Process the specified command line arguments.
      void await()
      Await and shutdown.
      protected java.io.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.
      java.lang.String getConfigFile()
      Return the pathname to the server configuration file.
      boolean getGenerateCode()
      Return whether code generation is enabled.
      java.io.File getGeneratedCodeLocation()
      Return the location of generated sources.
      java.lang.String getGeneratedCodePackage()
      Return the top package name for generated source.
      java.lang.ClassLoader getParentClassLoader()
      Return the shared extensions class loader.
      Server getServer()
      Return the server component.
      boolean getThrowOnInitFailure()
      Return whether an exception should be thrown if an error occurs during server init.
      boolean getUseGeneratedCode()
      Return whether generated code should be used.
      boolean getUseShutdownHook()
      Return whether a shutdown hook is used.
      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​(java.lang.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​(java.lang.String file)
      Set the pathname to the server configuration file.
      void setGenerateCode​(boolean generateCode)
      Set whether code generation is enabled.
      void setGeneratedCodeLocation​(java.io.File generatedCodeLocation)
      Set the location of generated sources.
      void setGeneratedCodePackage​(java.lang.String generatedCodePackage)
      Set the top package name for generated source.
      void setParentClassLoader​(java.lang.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 setThrowOnInitFailure​(boolean throwOnInitFailure)
      Set the behavior regarding errors that could occur during server init.
      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​(java.lang.String[] arguments)
      Stop the currently running server instance.
      protected void usage()
      Print usage information for this application.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
    • Constructor Detail

      • Catalina

        public Catalina()
        Default constructor.
    • 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:
        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 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:
        true if 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:
        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​(java.lang.String[] args)
        Process the specified command line arguments.
        Parameters:
        args - Command line arguments to process
        Returns:
        true if 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 - true if parsing for start, false if 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 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