org.objectweb.dream
Class AbstractComponent

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
All Implemented Interfaces:
ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, BindingController, LifeCycleController
Direct Known Subclasses:
AbstractDelegatingMessageCodecImpl, AbstractSchedulerManager, CodecManagerImpl, CodecRepositoryImpl, MessageCreatorBasicImpl, MessageManagerImpl, MetaSchedulerManagerImpl, ObjectPoolDebugImpl, ObjectPoolImpl, ObjectPoolSoftReferenceImpl, PushToPush1Impl, TaskManagerImpl, ThreadManagerImpl

public abstract class AbstractComponent
extends Object
implements LifeCycleController, NeedAsyncStartController, PrepareStopLifeCycleController, ContextualBindingController, Loggable

Base implementation of Dream components. This class is provided for convenience. It is not mandatory for a component implementation to be a subclass of this class.
This class provides implementation of BindingController methods. Bindings are stored in a Map. When a component has client interfaces, it is recommended to override (at least) the bindFc method.


Field Summary
protected  Logger bindingLogger
          the controller logger associated with the binding controller of this component
protected  boolean fcNeedAsyncStart
           
protected  String fcState
          this attribute give the state of Dream Component.
protected  Logger lifeCycleLogger
          the controller logger associated with the life cycle controller of this component
protected  Logger logger
          the functional logger of this component
 Component weaveableC
          the Componentcontroller interface reference of this component
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractComponent()
          Constructor method create the hashtable of bindings and initialize fcState to LifeCycleController.STOPPED.
 
Method Summary
protected  void beforeFirstStart(Component componentItf)
          This method is called the first time the component is started.
 void bindFc(String clientItfName, Object serverItf)
           
 void bindFc(String clientItfName, Object serverItf, Object hints)
          Binds the client interface whose name is given to a server interface.
 boolean getFcNeedAsyncStart()
          Returns true if the component should be started asynchronously.
 String getFcState()
           
protected  void initComponent()
          Initializes this component.
 Object lookupFc(String clientItfName)
           
 void prepareStopFc()
          Method called when the component enter in the "STOPPING" state.
 void setLogger(String name, Logger l)
          Gives the logger.
 void startFc()
           
 void stopFc()
           
 void unbindFc(String clientItfName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.fractal.api.control.BindingController
listFc
 

Field Detail

weaveableC

public Component weaveableC
the Componentcontroller interface reference of this component


logger

protected Logger logger
the functional logger of this component


lifeCycleLogger

protected Logger lifeCycleLogger
the controller logger associated with the life cycle controller of this component


bindingLogger

protected Logger bindingLogger
the controller logger associated with the binding controller of this component


fcNeedAsyncStart

protected boolean fcNeedAsyncStart

fcState

protected String fcState
this attribute give the state of Dream Component.
the fcSstate value is LifeCycleController.STARTED LifeCycleController.STOPPED

Constructor Detail

AbstractComponent

public AbstractComponent()
Constructor method create the hashtable of bindings and initialize fcState to LifeCycleController.STOPPED.

Method Detail

initComponent

protected void initComponent()
                      throws InitializationException
Initializes this component. This method is called during initialization of the component controllers.
This method can be overridden by sub classes as follows:
  
   
   protected void initComponent
   {
     super.initComponent;
     // initialization code here ...
   }
   
   
   
 

Throws:
InitializationException - if an error occurs.

beforeFirstStart

protected void beforeFirstStart(Component componentItf)
                         throws IllegalLifeCycleException
This method is called the first time the component is started.

Parameters:
componentItf - the Componentinterface of this component.
Throws:
IllegalLifeCycleException

setLogger

public void setLogger(String name,
                      Logger l)
Description copied from interface: Loggable
Gives the logger.

Specified by:
setLogger in interface Loggable
Parameters:
name - the registration name.
l - the logger.
See Also:
Loggable.setLogger(String, Logger)

getFcNeedAsyncStart

public boolean getFcNeedAsyncStart()
Description copied from interface: NeedAsyncStartController
Returns true if the component should be started asynchronously.

Specified by:
getFcNeedAsyncStart in interface NeedAsyncStartController
Returns:
true if the component should be started asynchronously.
See Also:
NeedAsyncStartController.getFcNeedAsyncStart()

prepareStopFc

public void prepareStopFc()
                   throws IllegalLifeCycleException
Description copied from interface: PrepareStopLifeCycleController
Method called when the component enter in the "STOPPING" state.

Specified by:
prepareStopFc in interface PrepareStopLifeCycleController
Throws:
IllegalLifeCycleException
See Also:
PrepareStopLifeCycleController.prepareStopFc()

getFcState

public String getFcState()
Specified by:
getFcState in interface LifeCycleController
See Also:
LifeCycleController.getFcState()

stopFc

public void stopFc()
            throws IllegalLifeCycleException
Specified by:
stopFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.stopFc()

startFc

public void startFc()
             throws IllegalLifeCycleException
Specified by:
startFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.startFc()

lookupFc

public Object lookupFc(String clientItfName)
                throws NoSuchInterfaceException
Specified by:
lookupFc in interface BindingController
Throws:
NoSuchInterfaceException
See Also:
BindingController.lookupFc(String)

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)

bindFc

public void bindFc(String clientItfName,
                   Object serverItf,
                   Object hints)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Description copied from interface: ContextualBindingController
Binds the client interface whose name is given to a server interface. More precisely, binds the client interface of the component to which this interface belongs, and whose name is equal to the given name, to the given server interface. The given server interface must be in the same address space as the client interface. Contextual information can be given using the hints parameter.

Specified by:
bindFc in interface ContextualBindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.
serverItf - a server interface.
hints - contextual information.
Throws:
NoSuchInterfaceException - if there is no such client interface.
IllegalBindingException - if the binding cannot be created.
IllegalLifeCycleException - if this component has a LifeCycleController interface, but it is not in an appropriate state to perform this operation.
See Also:
ContextualBindingController.bindFc(String, Object, Object)

unbindFc

public void unbindFc(String clientItfName)
              throws NoSuchInterfaceException,
                     IllegalBindingException,
                     IllegalLifeCycleException
Specified by:
unbindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.unbindFc(String)


Copyright © 2003, 2005 - INRIA Rhone-Alpes - All Rights Reserved.