org.ow2.clif.supervisor.lib
Class SupervisorImpl

java.lang.Object
  extended by java.util.Observable
      extended by org.ow2.clif.supervisor.lib.SupervisorImpl
All Implemented Interfaces:
org.objectweb.fractal.api.control.BindingController, org.objectweb.fractal.api.control.LifeCycleController, ActivityControl, SupervisorInfo, TestControl

public class SupervisorImpl
extends java.util.Observable
implements TestControl, SupervisorInfo, org.objectweb.fractal.api.control.BindingController, org.objectweb.fractal.api.control.LifeCycleController

Supervisor implementation, used to deploy and control test plans among CLIF servers. It relies on a FractalRMI registry to find CLIF servers. This class extends the Observable class in order to provide feedback information about the state of the test plan's blades and the occurrence of alarms.

Author:
Julien Buret, Nicolas Droze, Bruno Dillenseger, Joan Chaumont
See Also:
AlarmEvent, BladeObservation

Field Summary
 
Fields inherited from interface org.ow2.clif.supervisor.api.TestControl
TEST_CONTROL
 
Fields inherited from interface org.ow2.clif.supervisor.api.SupervisorInfo
SUPERVISOR_INFO
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
SupervisorImpl()
          Constructor.
 
Method Summary
 void alarm(java.lang.String bladeId, AlarmEvent alarm)
          Forwards the alarm event to observers
 void bindFc(java.lang.String clientItfName, java.lang.Object serverItf)
           
 void changeParameter(java.lang.String bladeId, java.lang.String name, java.io.Serializable value)
           
 void collect(java.lang.String[] selBladesId, CollectListener listener)
          Collects latest test data for selected blades
 java.util.Map getCurrentParameters(java.lang.String bladeId)
          Return current changeable parameters
 java.util.Map getDefinitions()
           
 java.lang.String getFcState()
           
 BladeState getGlobalState(java.lang.String[] selBladesId)
          Get global state for these blades.
 java.lang.String[] getStatLabels(java.lang.String bladeId)
          Retrieve the ActionStat of a specific host.
 long[] getStats(java.lang.String bladeId)
          Retrieve the execution statistics of a specific blade.
 void init(java.io.Serializable testId)
          Initialize the test for every blade
 void join()
          Waits for the end of the test
 void join(java.lang.String[] selBladesId)
          Waits for the end of the test for selected blades
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String clientItfName)
           
 void resume()
          Resume the test (if suspended)
 void resume(java.lang.String[] selBladesId)
          Resume the test (if suspended) for selected blades
 void setBladeState(java.lang.String id, BladeState state)
          Inform that the state of a host has changed.
 void setDefinitions(java.util.Map definitions)
           
 void start()
          Starts the test plan (i.e. all blades)
 void start(java.lang.String[] selBladesId)
          Starts the test plan for selected blades
 void startFc()
           
 void stop()
          Final stop of the test
 void stop(java.lang.String[] selBladesId)
          Final stop of the test for selected blades
 void stopFc()
           
 void suspend()
          Suspend the test
 void suspend(java.lang.String[] selBladesId)
          Suspend the test for selected blades
 void unbindFc(java.lang.String clientItfName)
           
 void waitEndOfRun(java.lang.String[] selBladesId)
          Wait until blades stop or complete.
 boolean waitForState(java.lang.String[] selBladesId, BladeState state)
          Wait until the state is goaled.
 void waitStationaryState(java.lang.String[] selBladesId)
          Wait until blades are stationary.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ow2.clif.supervisor.api.TestControl
addObserver, deleteObservers
 

Constructor Detail

SupervisorImpl

public SupervisorImpl()
Constructor.

Method Detail

startFc

public void startFc()
Specified by:
startFc in interface org.objectweb.fractal.api.control.LifeCycleController

stopFc

public void stopFc()
Specified by:
stopFc in interface org.objectweb.fractal.api.control.LifeCycleController

getFcState

public java.lang.String getFcState()
Specified by:
getFcState in interface org.objectweb.fractal.api.control.LifeCycleController

lookupFc

public java.lang.Object lookupFc(java.lang.String clientItfName)
Specified by:
lookupFc in interface org.objectweb.fractal.api.control.BindingController

bindFc

public void bindFc(java.lang.String clientItfName,
                   java.lang.Object serverItf)
Specified by:
bindFc in interface org.objectweb.fractal.api.control.BindingController

unbindFc

public void unbindFc(java.lang.String clientItfName)
Specified by:
unbindFc in interface org.objectweb.fractal.api.control.BindingController

listFc

public java.lang.String[] listFc()
Specified by:
listFc in interface org.objectweb.fractal.api.control.BindingController

getStats

public long[] getStats(java.lang.String bladeId)
Retrieve the execution statistics of a specific blade.

Specified by:
getStats in interface TestControl
Parameters:
bladeId - The blade identifier to get the report from
Returns:
An array containing execution statistics for the given blade

getStatLabels

public java.lang.String[] getStatLabels(java.lang.String bladeId)
Retrieve the ActionStat of a specific host.

Specified by:
getStatLabels in interface TestControl
Parameters:
bladeId - The blade identifier to get the statistics labels from
Returns:
An array containing some informations about the test for this host

getCurrentParameters

public java.util.Map getCurrentParameters(java.lang.String bladeId)
Description copied from interface: TestControl
Return current changeable parameters

Specified by:
getCurrentParameters in interface TestControl
Parameters:
bladeId - The identifier of the target blade

changeParameter

public void changeParameter(java.lang.String bladeId,
                            java.lang.String name,
                            java.io.Serializable value)
                     throws ClifException
Specified by:
changeParameter in interface TestControl
Throws:
ClifException

collect

public void collect(java.lang.String[] selBladesId,
                    CollectListener listener)
Collects latest test data for selected blades

Specified by:
collect in interface TestControl
Parameters:
selBladesId - selected blades ids as a String[]
listener - the listener receives progress information and it is given the opportunity to cancel the collection. Ignored if null.

init

public void init(java.io.Serializable testId)
          throws ClifException
Initialize the test for every blade

Specified by:
init in interface ActivityControl
Parameters:
testId - the new test's name
Throws:
ClifException

start

public void start()
Starts the test plan (i.e. all blades)

Specified by:
start in interface ActivityControl

start

public void start(java.lang.String[] selBladesId)
Starts the test plan for selected blades

Specified by:
start in interface TestControl
Parameters:
selBladesId - selected blades ids

stop

public void stop()
Final stop of the test

Specified by:
stop in interface ActivityControl

stop

public void stop(java.lang.String[] selBladesId)
Final stop of the test for selected blades

Specified by:
stop in interface TestControl
Parameters:
selBladesId - selected blades ids

suspend

public void suspend()
Suspend the test

Specified by:
suspend in interface ActivityControl

suspend

public void suspend(java.lang.String[] selBladesId)
Suspend the test for selected blades

Specified by:
suspend in interface TestControl
Parameters:
selBladesId - selected blades ids

resume

public void resume()
Resume the test (if suspended)

Specified by:
resume in interface ActivityControl

resume

public void resume(java.lang.String[] selBladesId)
Resume the test (if suspended) for selected blades

Specified by:
resume in interface TestControl
Parameters:
selBladesId - selected blades ids

join

public void join()
Waits for the end of the test

Specified by:
join in interface ActivityControl

join

public void join(java.lang.String[] selBladesId)
Waits for the end of the test for selected blades

Specified by:
join in interface TestControl
Parameters:
selBladesId - selected blades ids

alarm

public void alarm(java.lang.String bladeId,
                  AlarmEvent alarm)
Forwards the alarm event to observers

Specified by:
alarm in interface SupervisorInfo
Parameters:
bladeId - blade identifier of the event source
alarm - alarm event

setBladeState

public void setBladeState(java.lang.String id,
                          BladeState state)
Inform that the state of a host has changed.

Specified by:
setBladeState in interface SupervisorInfo
Parameters:
id - the scenario globally unique identifier object
state - The new state of the blade

waitStationaryState

public void waitStationaryState(java.lang.String[] selBladesId)
Wait until blades are stationary.

Specified by:
waitStationaryState in interface SupervisorInfo
Parameters:
selBladesId - Ids of the blades to test

waitForState

public boolean waitForState(java.lang.String[] selBladesId,
                            BladeState state)
Description copied from interface: SupervisorInfo
Wait until the state is goaled.

Specified by:
waitForState in interface SupervisorInfo

getGlobalState

public BladeState getGlobalState(java.lang.String[] selBladesId)
Get global state for these blades.

Specified by:
getGlobalState in interface SupervisorInfo
Parameters:
selBladesId - Ids of the blades to test
Returns:
the global state.

waitEndOfRun

public void waitEndOfRun(java.lang.String[] selBladesId)
Wait until blades stop or complete.

Specified by:
waitEndOfRun in interface SupervisorInfo
Parameters:
selBladesId - Ids of the blades to test

setDefinitions

public void setDefinitions(java.util.Map definitions)
Specified by:
setDefinitions in interface SupervisorInfo

getDefinitions

public java.util.Map getDefinitions()
Specified by:
getDefinitions in interface SupervisorInfo