org.apache.catalina.startup
Class Embedded

java.lang.Object
  |
  +--org.apache.catalina.startup.Embedded
All Implemented Interfaces:
Lifecycle

public class Embedded
extends java.lang.Object
implements Lifecycle

Convenience class to embed a Catalina servlet container environment inside another application. You must call the methods of this class in the following order to ensure correct operation.

After normal operations have begun, you can add and remove Connectors, Engines, Hosts, and Contexts on the fly. However, once you have removed a particular component, it must be thrown away -- you can create a new one with the same characteristics if you merely want to do a restart.

To initiate a normal shutdown, call the stop() method of this object.

IMPLEMENTATION NOTE: The main() method of this class is a simple example that exercizes the features of dynamically starting and stopping various components. You can execute this by executing the following steps (on a Unix platform):

   cd $CATALINA_HOME
   ./bin/catalina.sh embedded
 

Version:
$Revision: 1.11.2.1 $ $Date: 2001/10/11 23:13:00 $
Author:
Craig R. McClanahan

Field Summary
protected  Connector[] connectors
          The set of Connectors that have been deployed in this server.
protected  int debug
          The debugging detail level for this component.
protected  Engine[] engines
          The set of Engines that have been deployed in this server.
protected static java.lang.String info
          Descriptive information about this server implementation.
protected  LifecycleSupport lifecycle
          The lifecycle event support for this component.
protected  Logger logger
          The default logger to be used by this component itself.
protected  Realm realm
          The default realm to be used by all containers associated with this compoennt.
protected static StringManager sm
          The string manager for this package.
protected  java.lang.String socketFactory
          The socket factory that will be used when a secure Connector is created.
protected  boolean started
          Has this component been started yet?
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
protected  boolean useNaming
          Is naming enabled ?
 
Fields inherited from interface org.apache.catalina.Lifecycle
START_EVENT, STOP_EVENT
 
Constructor Summary
Embedded()
          Construct a new instance of this class with default properties.
Embedded(Logger logger, Realm realm)
          Construct a new instance of this class with specified properties.
 
Method Summary
 void addConnector(Connector connector)
          Add a new Connector to the set of defined Connectors.
 void addEngine(Engine engine)
          Add a new Engine to the set of defined Engines.
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 Connector createConnector(java.net.InetAddress address, int port, boolean secure)
          Create, configure, and return a new TCP/IP socket connector based on the specified properties.
 Context createContext(java.lang.String path, java.lang.String docBase)
          Create, configure, and return a Context that will process all HTTP requests received from one of the associated Connectors, and directed to the specified context path on the virtual host to which this Context is connected.
 Engine createEngine()
          Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties.
 Host createHost(java.lang.String name, java.lang.String appBase)
          Create, configure, and return a Host that will process all HTTP requests received from one of the associated Connectors, and directed to the specified virtual host.
 Loader createLoader(java.lang.ClassLoader parent)
          Create and return a class loader manager that can be customized, and then attached to a Context, before it is started.
 int getDebug()
          Return the debugging detail level for this component.
 java.lang.String getInfo()
          Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.
 Logger getLogger()
          Return the Logger for this component.
 Realm getRealm()
          Return the default Realm for our Containers.
 java.lang.String getSocketFactory()
          Return the secure socket factory class name.
 boolean isUseNaming()
          Return true if naming is enabled.
static void main(java.lang.String[] args)
          This main program is a unit test to exercize the various methods of the Embedded class.
 void removeConnector(Connector connector)
          Remove the specified Connector from the set of defined Connectors.
 void removeContext(Context context)
          Remove the specified Context from the set of defined Contexts for its associated Host.
 void removeEngine(Engine engine)
          Remove the specified Engine from the set of defined Engines, along with all of its related Hosts and Contexts.
 void removeHost(Host host)
          Remove the specified Host, a" VALIGN=bsp;Engine[]
engines
          The set of Engines that have been deployed in this server.
protected static java.lang.String info
          Descriptive information about this server implementation.
protected  LifecycleSupport lifecycle
          The lifecycle event support for this component.
protected  Logger logger
          The default logger to be used by this component itself.
protected  Realm realm
          The default realm to be used by all containers associated with this compoennt.
protected static StringManager sm
          The string manager for this package.
protected  java.lang.String socketFactory
          The socket factory that will be used when a secure Connector is created.
protected  boolean started
          Has this component been started yet?
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
protected  boolean useNaming
          Is naming enabled ?
 
Fields inherited from interface org.apache.catalina.Lifecycle
START_EVENT, STOP_EVENT
 
Constructor Summary
Embedded()
          Construct a new instance of this class with default properties.
Embedded(Logger logger, Realm realm)
          Construct a new instance of this class with specified properties.
 
Method Summary
 void addConnector(Connector connector)
          Add a new Connector to the set of defined Connectors.
 void addEngine(Engine engine)
          Add a new Engine to the set of defined Engines.
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 Connector createConnector(java.net.InetAddress address, int port, boolean secure)
          Create, configure, and return a new TCP/IP socket connector based on the specified properties.
 Context createContext(java.lang.String path, java.lang.String docBase)
          Create, configure, and return a Context that will process all HTTP requests received from one of the associated Connectors, and directed to the specified context path on the virtual host to which this Context is connected.
 Engine createEngine()
          Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties.
 Host createHost(java.lang.String name, java.lang.String appBase)
          Create, configure, and return a Host that will process all HTTP requests received from one of the associated Connectors, and directed to the specified virtual host.
 Loader createLoader(java.lang.ClassLoader parent)
          Create and return a class loader manager that can be customized, and then attached to a Context, before it is started.
 int getDebug()
          Return the debugging detail level for this component.
 java.lang.String getInfo()
          Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.
 Logger getLogger()
          Return the Logger for this component.
 Realm getRealm()
          Return the default Realm for our Containers.
 java.lang.String getSocketFactory()
          Return the secure socket factory class name.
 boolean isUseNaming()
          Return true if naming is enabled.
static void main(java.lang.String[] args)
          This main program is a unit test to exercize the various methods of the Embedded class.
 void removeConnector(Connector connector)
          Remove the specified Connector from the set of defined Connectors.
 void removeContext(Context context)
          Remove the specified Context from the set of defined Contexts for its associated Host.
 void removeEngine(Engine engine)
          Remove the specified Engine from the set of defined Engines, along with all of its related Hosts and Contexts.
 void removeHost(Host host)
          Remove the specified Host, a" VALIGN=bsp;Engine[]
engines
          The set of Engines that have been deployed in this server.
protected static java.lang.String info
          Descriptive information about this server implementation.
protected  LifecycleSupport lifecycle
          The lifecycle event support for this component.
protected  Logger logger
          The default logger to be used by this component itself.
protected  Realm realm
          The default realm to be used by all containers associated with this compoennt.
protected static StringManager sm
          The string manager for this package.
protected  java.lang.String socketFactory
          The socket factory that will be used when a secure Connector is created.
protected  boolean started
          Has this component been started yet?
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
protected  boolean useNaming
          Is naming enabled ?
 
Fields inherited from interface org.apache.catalina.Lifecycle
START_EVENT, STOP_EVENT
 
Constructor Summary
Embedded()
          Construct a new instance of this class with default properties.
Embedded(Logger logger, Realm realm)
          Construct a new instance of this class with specified properties.
 
Method Summary
 void addConnector(Connector connector)
          Add a new Connector to the set of defined Connectors.
 void addEngine(Engine engine)
          Add a new Engine to the set of defined Engines.
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 Connector createConnector(java.net.InetAddress address, int port, boolean secure)
          Create, configure, and return a new TCP/IP socket connector based on the specified properties.
 Context createContext(java.lang.String path, java.lang.String docBase)
          Create, configure, and return a Context that will process all HTTP requests received from one of the associated Connectors, and directed to the specified context path on the virtual host to which this Context is connected.
 Engine createEngine()
          Create, configure, and return an Engine that will process all HTTP requests received fro