Package org.ow2.clif.supervisor.lib
Class SupervisorImpl
- java.lang.Object
-
- java.util.Observable
-
- org.ow2.clif.supervisor.lib.SupervisorImpl
-
- All Implemented Interfaces:
org.objectweb.fractal.api.control.BindingController,ActivityControl,SupervisorInfo,TestControl
public class SupervisorImpl extends java.util.Observable implements TestControl, SupervisorInfo, org.objectweb.fractal.api.control.BindingController
Supervisor implementation, used to control a deployed test plan (i.e. a set of blades). 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 Modifier and Type Field Description protected java.io.SerializablecurrentTestIdThe current test ID-
Fields inherited from interface org.ow2.clif.supervisor.api.SupervisorInfo
SUPERVISOR_INFO
-
Fields inherited from interface org.ow2.clif.supervisor.api.TestControl
TEST_CONTROL
-
-
Constructor Summary
Constructors Constructor Description SupervisorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalarm(java.lang.String bladeId, AlarmEvent alarm)Forwards the alarm event to observersvoidbindFc(java.lang.String clientItfName, java.lang.Object serverItf)voidchangeParameter(java.lang.String bladeId, java.lang.String name, java.io.Serializable value)Changes a blade parameter value.voidcollect(java.lang.String[] selBladesId, CollectListener listener)Collects latest test data for selected bladesjava.lang.String[]getBladesIds()Get the identifiers of all blades that are currently under control (i.e.java.util.Map<java.lang.String,java.io.Serializable>getCurrentParameters(java.lang.String bladeId)Gets a Map of blade parameters and their associated values.java.lang.StringgetCurrentTestId()Retrieves current test identifier.java.util.Map<java.lang.String,ClifDeployDefinition>getDefinitions()Gets current test plan definitionBladeStategetGlobalState(java.lang.String[] selBladesId)Get global state for some blades.java.lang.String[]getStatLabels(java.lang.String bladeId)Gets labels describing statistics delivered by a bladelong[]getStats(java.lang.String bladeId)Retrieve the execution statistics of a blade.voidinit(java.io.Serializable testId)Initializes a new test for every blade in the deployed test plan.voidjoin()Waits for the end of activity of all blades of currently deployed test plan.voidjoin(java.lang.String[] selBladesId)Waits for the end of execution of a selection of blades from currently deployed test plan.java.lang.String[]listFc()java.lang.ObjectlookupFc(java.lang.String clientItfName)voidresume()Resumes all blades of currently deployed test plan.voidresume(java.lang.String[] selBladesId)Resumes a selection of blades from currently deployed test plan.voidsetBladeState(java.lang.String id, BladeState state)Inform that the state of a blade has changed.voidsetDefinitions(java.util.Map<java.lang.String,ClifDeployDefinition> definitions)Sets the test plan definition.voidstart()Starts all blades of the currently deployed test plan.voidstart(java.lang.String[] selBladesId)Starts a selection of blades of currently deployed test plan.voidstop()Stops all blades of currently deployed test plan.voidstop(java.lang.String[] selBladesId)Stops a selection of blades from currently deployed test plan.voidsuspend()Suspends all blades of currently deployed test plan.voidsuspend(java.lang.String[] selBladesId)Suspends a selection of blades from currently deployed test plan.voidunbindFc(java.lang.String clientItfName)voidwaitEndOfRun(java.lang.String[] selBladesId)Wait until blades are stopped, completed or aborted.booleanwaitForState(java.lang.String[] selBladesId, BladeState state)Waits until blades are all in a given state.voidwaitStationaryState(java.lang.String[] selBladesId)Waits until blades are all in a stationary state.-
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
-
-
-
-
Method Detail
-
lookupFc
public java.lang.Object lookupFc(java.lang.String clientItfName)
- Specified by:
lookupFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
bindFc
public void bindFc(java.lang.String clientItfName, java.lang.Object serverItf)- Specified by:
bindFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
unbindFc
public void unbindFc(java.lang.String clientItfName)
- Specified by:
unbindFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
listFc
public java.lang.String[] listFc()
- Specified by:
listFcin interfaceorg.objectweb.fractal.api.control.BindingController
-
getBladesIds
public java.lang.String[] getBladesIds()
Get the identifiers of all blades that are currently under control (i.e. deployed).- Specified by:
getBladesIdsin interfaceTestControl- Returns:
- an array containing the identifiers of all blades bound to this supervisor.
-
getStats
public long[] getStats(java.lang.String bladeId)
Retrieve the execution statistics of a blade.- Specified by:
getStatsin interfaceTestControl- Parameters:
bladeId- The blade identifier to get the statistics from- Returns:
- An array containing execution statistics for the given blade
- See Also:
getStatLabels(String)
-
getStatLabels
public java.lang.String[] getStatLabels(java.lang.String bladeId)
Gets labels describing statistics delivered by a blade- Specified by:
getStatLabelsin interfaceTestControl- Parameters:
bladeId- the blade identifier- Returns:
- An array of string labels describing the statistics delivered by the designated blade
- See Also:
getStats(String)
-
getCurrentParameters
public java.util.Map<java.lang.String,java.io.Serializable> getCurrentParameters(java.lang.String bladeId)
Gets a Map of blade parameters and their associated values.- Specified by:
getCurrentParametersin interfaceTestControl- Parameters:
bladeId- the blade identifier- Returns:
- parameters of the designated blade if found, null otherwise
-
changeParameter
public void changeParameter(java.lang.String bladeId, java.lang.String name, java.io.Serializable value) throws ClifExceptionChanges a blade parameter value.- Specified by:
changeParameterin interfaceTestControl- Parameters:
bladeId- the blade identifiername- the parameter namevalue- the new parameter value- Throws:
ClifException
-
collect
public void collect(java.lang.String[] selBladesId, CollectListener listener)Collects latest test data for selected blades- Specified by:
collectin interfaceTestControl- Parameters:
selBladesId- selected blades identifiers 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 ClifExceptionInitializes a new test for every blade in the deployed test plan.setDefinitions(Map)must be called before to test the currently deployed test plan definition.- Specified by:
initin interfaceActivityControl- Parameters:
testId- the new test's name- Throws:
ClifException
-
start
public void start()
Starts all blades of the currently deployed test plan.- Specified by:
startin interfaceActivityControl
-
start
public void start(java.lang.String[] selBladesId)
Starts a selection of blades of currently deployed test plan. Does not complain if any blade identifier is not known.- Specified by:
startin interfaceTestControl- Parameters:
selBladesId- identifiers of blades to be started, or null for starting all blades.
-
stop
public void stop()
Stops all blades of currently deployed test plan.- Specified by:
stopin interfaceActivityControl
-
stop
public void stop(java.lang.String[] selBladesId)
Stops a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.- Specified by:
stopin interfaceTestControl- Parameters:
selBladesId- array of target blades identifiers, or null for designating all blades
-
suspend
public void suspend()
Suspends all blades of currently deployed test plan.- Specified by:
suspendin interfaceActivityControl
-
suspend
public void suspend(java.lang.String[] selBladesId)
Suspends a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.- Specified by:
suspendin interfaceTestControl- Parameters:
selBladesId- array of target blades identifiers, or null for designating all blades
-
resume
public void resume()
Resumes all blades of currently deployed test plan.- Specified by:
resumein interfaceActivityControl
-
resume
public void resume(java.lang.String[] selBladesId)
Resumes a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.- Specified by:
resumein interfaceTestControl- Parameters:
selBladesId- array of target blades identifiers, or null for designating all blades
-
join
public void join()
Waits for the end of activity of all blades of currently deployed test plan.- Specified by:
joinin interfaceActivityControl
-
join
public void join(java.lang.String[] selBladesId)
Waits for the end of execution of a selection of blades from currently deployed test plan. Does not complain if any blade identifier is not known.- Specified by:
joinin interfaceTestControl- Parameters:
selBladesId- array of target blades identifiers, or null for designating all blades
-
alarm
public void alarm(java.lang.String bladeId, AlarmEvent alarm)Forwards the alarm event to observers- Specified by:
alarmin interfaceSupervisorInfo- Parameters:
bladeId- blade identifier of the event sourcealarm- alarm event
-
setBladeState
public void setBladeState(java.lang.String id, BladeState state)Inform that the state of a blade has changed.- Specified by:
setBladeStatein interfaceSupervisorInfo- Parameters:
id- the globally unique blade identifierstate- The new state of the blade
-
waitStationaryState
public void waitStationaryState(java.lang.String[] selBladesId) throws java.lang.InterruptedExceptionWaits until blades are all in a stationary state.- Specified by:
waitStationaryStatein interfaceSupervisorInfo- Parameters:
selBladesId- array of identifiers of target blades, or null for designating all blades of currently deployed test plan.- Throws:
java.lang.InterruptedException
-
waitForState
public boolean waitForState(java.lang.String[] selBladesId, BladeState state) throws java.lang.InterruptedExceptionWaits until blades are all in a given state.- Specified by:
waitForStatein interfaceSupervisorInfo- Parameters:
selBladesId- array of identifiers of target blades, or null for designating all blades of currently deployed test plan.state- the requested blade state- Returns:
- true if current state is actually the requested state, false otherwise.
- Throws:
java.lang.InterruptedException
-
getGlobalState
public BladeState getGlobalState(java.lang.String[] selBladesId)
Get global state for some blades.- Specified by:
getGlobalStatein interfaceSupervisorInfo- Parameters:
selBladesId- identifiers of target blades, or null for designating all blades- Returns:
- the global state.
-
waitEndOfRun
public void waitEndOfRun(java.lang.String[] selBladesId) throws java.lang.InterruptedExceptionWait until blades are stopped, completed or aborted.- Specified by:
waitEndOfRunin interfaceSupervisorInfo- Parameters:
selBladesId- identifiers of target blades, or null for designating all blades- Throws:
java.lang.InterruptedException
-
setDefinitions
public void setDefinitions(java.util.Map<java.lang.String,ClifDeployDefinition> definitions)
Sets the test plan definition. Must be set before callinginit(Serializable).- Specified by:
setDefinitionsin interfaceSupervisorInfo
-
getDefinitions
public java.util.Map<java.lang.String,ClifDeployDefinition> getDefinitions()
Gets current test plan definition- Specified by:
getDefinitionsin interfaceSupervisorInfo- Returns:
- current test plan definition
-
getCurrentTestId
public java.lang.String getCurrentTestId()
Retrieves current test identifier.- Specified by:
getCurrentTestIdin interfaceTestControl- Returns:
- A string composed of the test name, and the date and time of its initialization
-
-