org.objectweb.fractal.aokell.lib.control.binding
Class AbstractBindingControllerImpl

java.lang.Object
  extended by org.objectweb.fractal.aokell.lib.control.binding.AbstractBindingControllerImpl
All Implemented Interfaces:
Controller, BindingController
Direct Known Subclasses:
FlatBindingControllerImpl, PrimitiveBindingControllerImpl

public abstract class AbstractBindingControllerImpl
extends Object
implements BindingController, Controller

Root class for binding controllers implementations.

Author:
Lionel Seinturier

Field Summary
protected  Component compctrl
           
 
Constructor Summary
AbstractBindingControllerImpl()
           
 
Method Summary
 void bindFc(String arg0, Object arg1)
          Binds the client interface whose name is given to a server interface.
protected  void bindFcContent(String arg0, Object arg1)
          If the content and the component parts are separated, and if the content part implements the BindingController interface, invoke it.
 void cloneFcCtrl(Component dst, Object hints)
          Clone the controller state from the current component to another one.
protected  Object getFcBoundableInterface(String interfaceName)
           
protected  Object[] getFcInterfaces()
           
 void initFcCtrl()
          Initialize the controller.
 String[] listFc()
          Returns the names of the client interfaces of the component to which this interface belongs.
 Object lookupFc(String arg0)
          Returns the interface to which the given client interface is bound.
protected  Interface registerFcInterface(String interfaceName)
          Register a new interface with the component controller.
 void setFcCompCtrl(Component compctrl)
          Set the reference towards the component controller associated to this controller.
protected  void testLegalBinding(Interface srcItf, Object arg1)
          Test whether the given source interface can be bound to the given target interface.
protected  void testLifeCyleBeforeUnbinding(Component arg0)
          Test whether the component is stopped before performing an unbind operation.
protected static String toString(Interface src, Interface target)
          Return a string of the form source_component_name.source_interface_name -> target_component_name.target_interface_name describing the binding from a source interface to a target interface.
 void unbindFc(String arg0)
          Unbinds the given client interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compctrl

protected Component compctrl
Constructor Detail

AbstractBindingControllerImpl

public AbstractBindingControllerImpl()
Method Detail

listFc

public String[] listFc()
Returns the names of the client interfaces of the component to which this interface belongs.

Specified by:
listFc in interface BindingController
Returns:
the names of the client interfaces of the component to which this interface belongs.

lookupFc

public Object lookupFc(String arg0)
                throws NoSuchInterfaceException
Returns the interface to which the given client interface is bound. More precisely, returns the server interface to which the client interface whose name is given is bound. This server interface is necessarily in the same address space as the client interface.

Specified by:
lookupFc in interface BindingController
Parameters:
arg0 - the name of a client interface of the component to which this interface belongs.
Returns:
the server interface to which the given interface is bound, or null if it is not bound.
Throws:
NoSuchInterfaceException - if the component to which this interface belongs does not have a client interface whose name is equal to the given name.

bindFc

public void bindFc(String arg0,
                   Object arg1)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
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.

Specified by:
bindFc in interface BindingController
Parameters:
arg0 - the name of a client interface of the component to which this interface belongs.
arg1 - a server interface.
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.

bindFcContent

protected void bindFcContent(String arg0,
                             Object arg1)
If the content and the component parts are separated, and if the content part implements the BindingController interface, invoke it.


unbindFc

public void unbindFc(String arg0)
              throws NoSuchInterfaceException,
                     IllegalBindingException,
                     IllegalLifeCycleException
Unbinds the given client interface. More precisely, unbinds the client interface of the component to which this interface belongs, and whose name is equal to the given name.

Specified by:
unbindFc in interface BindingController
Parameters:
arg0 - the name of a client interface of the component to which this interface belongs.
Throws:
NoSuchInterfaceException - if there is no such client interface.
IllegalBindingException - if the binding cannot be removed.
IllegalLifeCycleException - if this component has a LifeCycleController interface, but it is not in an appropriate state to perform this operation.

testLifeCyleBeforeUnbinding

protected void testLifeCyleBeforeUnbinding(Component arg0)
                                    throws IllegalLifeCycleException
Test whether the component is stopped before performing an unbind operation. Implementations of the binding controller for templates override this method with an empty implementation (template membranes do not have a lifecycle controller.)

Throws:
IllegalLifeCycleException

testLegalBinding

protected void testLegalBinding(Interface srcItf,
                                Object arg1)
                         throws IllegalBindingException,
                                NoSuchInterfaceException
Test whether the given source interface can be bound to the given target interface.

Throws:
IllegalBindingException - if the binding is illegal
NoSuchInterfaceException

toString

protected static String toString(Interface src,
                                 Interface target)
Return a string of the form source_component_name.source_interface_name -> target_component_name.target_interface_name describing the binding from a source interface to a target interface.


getFcInterfaces

protected Object[] getFcInterfaces()

getFcBoundableInterface

protected Object getFcBoundableInterface(String interfaceName)
                                  throws NoSuchInterfaceException
Throws:
NoSuchInterfaceException

registerFcInterface

protected Interface registerFcInterface(String interfaceName)
                                 throws NoSuchInterfaceException
Register a new interface with the component controller. This method is used for registering new instances of a collection interface.

Throws:
NoSuchInterfaceException - if the interface is not a collection interface

setFcCompCtrl

public void setFcCompCtrl(Component compctrl)
Set the reference towards the component controller associated to this controller.

Specified by:
setFcCompCtrl in interface Controller

initFcCtrl

public void initFcCtrl()
Initialize the controller.

Specified by:
initFcCtrl in interface Controller

cloneFcCtrl

public void cloneFcCtrl(Component dst,
                        Object hints)
                 throws CloneCtrlException
Clone the controller state from the current component to another one. This method may receive some hints on how to do this, or provide some hints on how this has been done. For instance, the hints may be a map that is read and/or written by the controller. The raison d'etre of these hints is that when its state is cloned, a controller may produce results that are needed by other controllers.

Specified by:
cloneFcCtrl in interface Controller
Parameters:
dst - the destination component
hints - hints for performing the operation
Throws:
CloneCtrlException