Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » catalina » startup » [javadoc | source]
org.apache.catalina.startup
public class: Embedded [javadoc | source]
java.lang.Object
   org.apache.catalina.core.StandardService
      org.apache.catalina.startup.Embedded

All Implemented Interfaces:
    Lifecycle, Service, MBeanRegistration

Direct Known Subclasses:
    Catalina

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.

Field Summary
protected  boolean useNaming    Is naming enabled ? 
protected  boolean redirectStreams    Is standard streams redirection enabled ? 
protected  Engine[] engines    The set of Engines that have been deployed in this server. Normally there will only be one. 
protected  HashMap authenticators    Custom mappings of login methods to authenticators 
protected static final  String info    Descriptive information about this server implementation. 
protected  LifecycleSupport lifecycle    The lifecycle event support for this component. 
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  boolean started    Has this component been started yet? 
protected  boolean await    Use await. 
Fields inherited from org.apache.catalina.core.StandardService:
support,  connectors,  executors,  container,  initialized,  type,  domain,  suffix,  oname,  controller,  mserver
Constructor:
 public Embedded() 
 public Embedded(Realm realm) 
    Construct a new instance of this class with specified properties.
    Parameters:
    realm - Realm implementation to be inherited by all components (unless overridden further down the container hierarchy)
Method from org.apache.catalina.startup.Embedded Summary:
addAuthenticator,   addConnector,   addEngine,   addLifecycleListener,   createConnector,   createConnector,   createConnector,   createConnector,   createContext,   createEngine,   createHost,   createLoader,   findLifecycleListeners,   getCatalinaBase,   getCatalinaHome,   getInfo,   getRealm,   initDirs,   initNaming,   initStreams,   isAwait,   isRedirectStreams,   isUseNaming,   removeContext,   removeEngine,   removeHost,   removeLifecycleListener,   setAwait,   setCatalinaBase,   setCatalinaHome,   setRealm,   setRedirectStreams,   setSecurityProtection,   setUseNaming,   start,   stop
Methods from org.apache.catalina.core.StandardService:
addConnector,   addExecutor,   addLifecycleListener,   addPropertyChangeListener,   destroy,   findConnectors,   findExecutors,   findLifecycleListeners,   getConnectorNames,   getContainer,   getContainerName,   getDomain,   getExecutor,   getInfo,   getName,   getObjectName,   getServer,   init,   initialize,   postDeregister,   postRegister,   preDeregister,   preRegister,   removeConnector,   removeExecutor,   removeLifecycleListener,   removePropertyChangeListener,   setContainer,   setName,   setServer,   start,   stop,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.startup.Embedded Detail:
 public  void addAuthenticator(Authenticator authenticator,
    String loginMethod) 
 public synchronized  void addConnector(Connector connector) 
    Add a new Connector to the set of defined Connectors. The newly added Connector will be associated with the most recently added Engine.
 public synchronized  void addEngine(Engine engine) 
    Add a new Engine to the set of defined Engines.
 public  void addLifecycleListener(LifecycleListener listener) 
    Add a lifecycle event listener to this component.
 public Connector createConnector(InetAddress address,
    int port,
    boolean secure) 
    Create, configure, and return a new TCP/IP socket connector based on the specified properties.
 public Connector createConnector(String address,
    int port,
    boolean secure) 
 public Connector createConnector(InetAddress address,
    int port,
    String protocol) 
 public Connector createConnector(String address,
    int port,
    String protocol) 
 public Context createContext(String path,
    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.

    After you have customized the properties, listeners, and Valves for this Context, you must attach it to the corresponding Host by calling:

    host.addChild(context);
    
    which will also cause the Context to be started if the Host has already been started.
 public 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.
 public Host createHost(String name,
    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.

    After you have customized the properties, listeners, and Valves for this Host, you must attach it to the corresponding Engine by calling:

    engine.addChild(host);
    
    which will also cause the Host to be started if the Engine has already been started. If this is the default (or only) Host you will be defining, you may also tell the Engine to pass all requests not assigned to another virtual host to this one:
    engine.setDefaultHost(host.getName());
    
 public Loader createLoader(ClassLoader parent) 
    Create and return a class loader manager that can be customized, and then attached to a Context, before it is started.
 public LifecycleListener[] findLifecycleListeners() 
    Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.
 public String getCatalinaBase() 
 public String getCatalinaHome() 
 public String getInfo() 
    Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.
 public Realm getRealm() 
    Return the default Realm for our Containers.
 protected  void initDirs() 
 protected  void initNaming() 
    Initialize naming - this should only enable java:env and root naming. If tomcat is embeded in an application that already defines those - it shouldn't do it. XXX The 2 should be separated, you may want to enable java: but not the initial context and the reverse XXX Can we "guess" - i.e. lookup java: and if something is returned assume false ? XXX We have a major problem with the current setting for java: url
 protected  void initStreams() 
 public boolean isAwait() 
 public boolean isRedirectStreams() 
    Return true if redirction of standard streams is enabled.
 public boolean isUseNaming() 
    Return true if naming is enabled.
 public synchronized  void removeContext(Context context) 
    Remove the specified Context from the set of defined Contexts for its associated Host. If this is the last Context for this Host, the Host will also be removed.
 public synchronized  void removeEngine(Engine engine) 
    Remove the specified Engine from the set of defined Engines, along with all of its related Hosts and Contexts. All associated Connectors are also removed.
 public synchronized  void removeHost(Host host) 
    Remove the specified Host, along with all of its related Contexts, from the set of defined Hosts for its associated Engine. If this is the last Host for this Engine, the Engine will also be removed.
 public  void removeLifecycleListener(LifecycleListener listener) 
    Remove a lifecycle event listener from this component.
 public  void setAwait(boolean b) 
 public  void setCatalinaBase(String s) 
 public  void setCatalinaHome(String s) 
 public  void setRealm(Realm realm) 
    Set the default Realm for our Containers.
 public  void setRedirectStreams(boolean redirectStreams) 
    Enables or disables naming support.
 protected  void setSecurityProtection() 
    Set the security package access/protection.
 public  void setUseNaming(boolean useNaming) 
    Enables or disables naming support.
 public  void start() throws LifecycleException 
    Prepare for the beginning of active use of the public methods of this component. This method should be called after configure(), and before any of the public methods of the component are utilized.
 public  void stop() throws LifecycleException 
    Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.