com.ibm.wsspi.runtime.component
Class WsContainer

java.lang.Object
  extended by com.ibm.wsspi.runtime.component.WsComponentImpl
      extended by com.ibm.wsspi.runtime.component.WsContainer
All Implemented Interfaces:
WsComponent

public class WsContainer
extends WsComponentImpl

The base class for runtime framework containers.

A container (in the runtime framework sense), is a logical collection of components. This container implementation provides support for a plugin mechanism, by which components can associate themselves with a container and order their startup (and shutdown) relative to other components.


Field Summary
 
Fields inherited from class com.ibm.wsspi.runtime.component.WsComponentImpl
name, state
 
Fields inherited from interface com.ibm.wsspi.runtime.component.WsComponent
DESTROYED, DESTROYING, ERROR, INITIALIZED, INITIALIZING, STARTED, STARTING, STATE, STOPPED, STOPPING
 
Constructor Summary
protected WsContainer(java.lang.String pluginId)
          Constructs an instance of a WsContainer.
 
Method Summary
protected  boolean add(WsComponent o)
          Adds the component to the list of components managed by this container.
 void destroy()
          Destroys all components owned by this container.
protected  void destroyComponents()
          Destroys all components currently managed by this container.
 void initialize(java.lang.Object config)
          Initializes this container.
protected  void initializeComponents(org.eclipse.emf.ecore.EObject rootConfig, com.ibm.ws.runtime.config.ConfigLocator[] locators)
          Initializes all components that have plugged into this container.
protected  java.util.List loadComponents(java.lang.String extensionPointId)
          Constructs a sorted list of all components identified by the specified plugin file.
protected  boolean remove(WsComponent o)
          Removes the component from the list of components managed by this container.
 void start()
          Starts all components managed by this container.
protected  void startComponents()
          Starts all components current managed by this container.
 void stop()
          Stops all compoennts managed by this container.
protected  void stopComponents()
          Stops all components currently managed by this container.
 
Methods inherited from class com.ibm.wsspi.runtime.component.WsComponentImpl
_setStartupThreadPool, addPropertyChangeListener, deregisterMBean, deregisterMBean, deregisterMBeanViaQuery, expandVariable, firePropertyChange, getConfigId, getName, getPropertyChangeSupport, getState, inhibitAsynchBehavior, join, lookupMBeans, registerMBean, removePropertyChangeListener, runAsynchronousInitializer, runAsynchronousInitializer, setGlobalAsynchBehaviorInhibited, setName, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WsContainer

protected WsContainer(java.lang.String pluginId)
Constructs an instance of a WsContainer.

Method Detail

destroy

public void destroy()
Destroys all components owned by this container.

Specified by:
destroy in interface WsComponent
Overrides:
destroy in class WsComponentImpl
See Also:
WsComponent.destroy()

initialize

public void initialize(java.lang.Object config)
                throws ComponentDisabledException,
                       ConfigurationWarning,
                       ConfigurationError
Initializes this container.

Specified by:
initialize in interface WsComponent
Overrides:
initialize in class WsComponentImpl
Parameters:
config - The configuration data for the component. The value may be null or some other object if no configuration data is present. Note that this argument may be removed.
Throws:
ComponentDisabledException - Thrown if the component considers itself to be disabled. No further lifecycle methods will be called by the framework.
ConfigurationWarning - Thrown if the component has encountered some non-fatal configuration problem. Server startup will generally continue.
ConfigurationError - The component has severe configuration problem and cannot allow the server startup to proceed. Note that this exception will halt server startup.
See Also:
WsComponent.initialize(Object)

start

public void start()
           throws RuntimeError,
                  RuntimeWarning
Starts all components managed by this container.

Specified by:
start in interface WsComponent
Overrides:
start in class WsComponentImpl
Throws:
RuntimeError
RuntimeWarning
See Also:
WsComponent.start()

stop

public void stop()
Stops all compoennts managed by this container. Components are stopped in reverse order of startup.

Specified by:
stop in interface WsComponent
Overrides:
stop in class WsComponentImpl
See Also:
WsComponent.stop()

loadComponents

protected java.util.List loadComponents(java.lang.String extensionPointId)
                                 throws ConfigurationError
Constructs a sorted list of all components identified by the specified plugin file. Note that upon exit of this method the components are not yet necessarily instantiated, hence nor are they initialized or started.

Example: loadComponents("com.ibm.ws.runtime.MyExtensionPointId");

Parameters:
extensionPointId - specifies the name of the extension point that controls this container.
Returns:
List a list of components, sorted by startup order (as defined in the plugin).
Throws:
ConfigurationError

startComponents

protected void startComponents()
                        throws RuntimeWarning,
                               RuntimeError
Starts all components current managed by this container.

Throws:
RuntimeWarning
RuntimeError

stopComponents

protected void stopComponents()
Stops all components currently managed by this container. Note that components are stopped in the inverse order that they were started.


destroyComponents

protected void destroyComponents()
Destroys all components currently managed by this container.


initializeComponents

protected void initializeComponents(org.eclipse.emf.ecore.EObject rootConfig,
                                    com.ibm.ws.runtime.config.ConfigLocator[] locators)
                             throws ConfigurationWarning,
                                    ConfigurationError
Initializes all components that have plugged into this container. Initialization order is defined by the plugin file(s). Initializing means that each component is instantiated and then the component's initialize method will be invoked.

Parameters:
rootConfig -
locators -
Throws:
ConfigurationWarning
ConfigurationError - TODO: EMF (EObject) bleeds through this interface which is unintentional. Should this simply be Object?

add

protected boolean add(WsComponent o)
Adds the component to the list of components managed by this container.

Parameters:
o -
Returns:
true if the component was not already in the list.

remove

protected boolean remove(WsComponent o)
Removes the component from the list of components managed by this container.

Parameters:
o -