org.objectweb.fractal.aokell.lib.control.factory
Class FactoryControllerImpl

java.lang.Object
  extended by org.objectweb.fractal.aokell.lib.control.factory.FactoryControllerImpl
All Implemented Interfaces:
Controller, Factory, org.objectweb.fractal.julia.factory.Template

public class FactoryControllerImpl
extends Object
implements org.objectweb.fractal.julia.factory.Template, Controller

Implementation of the Factory controller.

Author:
Lionel Seinturier

Field Summary
protected  Component compctrl
           
 
Constructor Summary
FactoryControllerImpl()
           
 
Method Summary
 void cloneFcCtrl(Component dst, Object hints)
          Clone the controller state from the current component to another one.
protected  void cloneFcMembrane(Map newContent, Class[] order)
          Clone the membrane of newly created components.
 Object getFcContentDesc()
           
 Object getFcControllerDesc()
           
 Type getFcInstanceType()
           
 void initFcCtrl()
          Initialize the controller.
 Component newFcControllerInstance()
          Instantiates only the controller part of the component normally instantiated by this template.
 Component newFcInstance()
           
 void setFcCompCtrl(Component compctrl)
          Set the reference towards the component controller associated to this controller.
 
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

FactoryControllerImpl

public FactoryControllerImpl()
Method Detail

getFcControllerDesc

public Object getFcControllerDesc()
Specified by:
getFcControllerDesc in interface Factory

getFcContentDesc

public Object getFcContentDesc()
Specified by:
getFcContentDesc in interface Factory

getFcInstanceType

public Type getFcInstanceType()
Specified by:
getFcInstanceType in interface Factory

newFcInstance

public Component newFcInstance()
                        throws InstantiationException
Specified by:
newFcInstance in interface Factory
Throws:
InstantiationException

newFcControllerInstance

public Component newFcControllerInstance()
                                  throws InstantiationException
Instantiates only the controller part of the component normally instantiated by this template. Because of component sharing, the newFcInstance method cannot be implemented by just calling itself recursively on the sub templates of this template (otherwise some sub templates may be instantiated several times). Hence this method.

Specified by:
newFcControllerInstance in interface org.objectweb.fractal.julia.factory.Template
Returns:
the instantiated component.
Throws:
InstantiationException - if the component controller cannot be instantiated.

cloneFcMembrane

protected void cloneFcMembrane(Map newContent,
                               Class[] order)
                        throws InstantiationException
Clone the membrane of newly created components. Controllers contained in the membrane are cloned according to the order specified in the second parameter which is an array of controller types. First, all controllers are cloned, except the ones specified in the array of controller types. Next, the controllers are cloned in the order in which they appear in the array. The rationale for this method lies in the fact that with composite templates, the binding controllers must be cloned last.

Parameters:
newContent - the map associating old and new components
order - the order for cloning controllers. This parameter is an array of controller types.
Throws:
InstantiationException

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