org.objectweb.fractal.aokell.lib.control.lifecycle
Class LifeCycleControllerImpl

java.lang.Object
  extended by org.objectweb.fractal.aokell.lib.control.lifecycle.LifeCycleControllerImpl
All Implemented Interfaces:
Controller, InvocationCounter, LifeCycleCoordinatorItf, LifeCycleController, org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator

public class LifeCycleControllerImpl
extends Object
implements LifeCycleCoordinatorItf, Controller

Implementation of the lifecycle controller for non composite components. This class originates from the Julia source code. Although this class is not present at this in the Julia source code, it has been generated from the existing mixin chunks.

Author:
Lionel Seinturier

Field Summary
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
LifeCycleControllerImpl()
           
 
Method Summary
 void cloneFcCtrl(Component dst, Object hints)
          Clone the controller state from the current component to another one.
 void decrementFcInvocationCounter()
          Decrements the number of currently executing method calls in this component.
 boolean fcActivated(org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator component)
           
 void fcInactivated(org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator component)
           
 String getFcState()
           
 void incrementFcInvocationCounter()
          Increments the number of currently executing method calls in this component.
 void initFcCtrl()
          Initialize the controller.
 void setFcCompCtrl(Component compctrl)
          Set the reference towards the component controller associated to this controller.
 boolean setFcStarted()
          Calls the overriden method and then calls the setFcContentState method.
 boolean setFcStopped()
          Calls the overriden method and then calls the setFcContentState method.
 void setFcStopping(org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator coordinator)
           
 void startFc()
          Checks the mandatory client interfaces of the component (and of all its sub components) and then calls the overriden method.
 void stopFc()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LifeCycleControllerImpl

public LifeCycleControllerImpl()
Method Detail

startFc

public void startFc()
             throws IllegalLifeCycleException
Checks the mandatory client interfaces of the component (and of all its sub components) and then calls the overriden method.

Specified by:
startFc in interface LifeCycleController
Throws:
IllegalLifeCycleException - if a problem occurs.

getFcState

public String getFcState()
Specified by:
getFcState in interface LifeCycleController

stopFc

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

fcActivated

public boolean fcActivated(org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator component)
Specified by:
fcActivated in interface org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator

fcInactivated

public void fcInactivated(org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator component)
Specified by:
fcInactivated in interface org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator

setFcStarted

public boolean setFcStarted()
                     throws IllegalLifeCycleException
Calls the overriden method and then calls the setFcContentState method.

Specified by:
setFcStarted in interface org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator
Returns:
true if the execution state has changed, or false if it had already the STARTED value.
Throws:
IllegalLifeCycleException - if a problem occurs.

setFcStopped

public boolean setFcStopped()
                     throws IllegalLifeCycleException
Calls the overriden method and then calls the setFcContentState method.

Specified by:
setFcStopped in interface org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator
Returns:
true if the execution state has changed, or false if it had already the STOPPED value.
Throws:
IllegalLifeCycleException - if a problem occurs.

setFcStopping

public void setFcStopping(org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator coordinator)
                   throws IllegalLifeCycleException
Specified by:
setFcStopping in interface org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator
Throws:
IllegalLifeCycleException

incrementFcInvocationCounter

public void incrementFcInvocationCounter()
Increments the number of currently executing method calls in this component. If the component is started this method just increments this counter. If the component is stopped, it waits until the component is restarted, and then increments the counter. Finally, if the component is stopping, there are two cases. If the counter is not null, it is just incremented. If it is null, this method asks the coordinator if the method call can be executed, or if it should be delayed until the component is restarted. The method then blocks or not, depending on the coordinator's response, before incrementing the counter.

Specified by:
incrementFcInvocationCounter in interface InvocationCounter

decrementFcInvocationCounter

public void decrementFcInvocationCounter()
Decrements the number of currently executing method calls in this component. If the component is stopping, and if the counter of currently executing method calls becomes null after being decremented, this method notifies the coordinator that the component has become inactive.

Specified by:
decrementFcInvocationCounter in interface InvocationCounter

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'être 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