Package org.ow2.clif.deploy
Class ClifAppFacade
- java.lang.Object
-
- java.util.Observable
-
- org.ow2.clif.deploy.ClifAppFacade
-
- All Implemented Interfaces:
java.util.Observer
public class ClifAppFacade extends java.util.Observable implements java.util.ObserverThis class is responsible for creating the initial Clif application. Then, it provides test plan deployment.- Author:
- Bruno Dillenseger, Joan Chaumont, Florian Francheteau
-
-
Field Summary
Fields Modifier and Type Field Description protected org.objectweb.fractal.api.ComponentclifAppprotected org.objectweb.fractal.api.control.ContentControllerclifAppCcprotected java.lang.StringclifAppDefinitionprotected java.lang.StringclifAppNameprotected java.util.Map<java.lang.String,org.objectweb.fractal.api.Component>componentsclif application components indexed by their name (storage, supervisor, analyzer)protected java.io.SerializablecurrentTestIdprotected org.objectweb.fractal.api.Componentstorageprotected org.objectweb.fractal.api.control.BindingControllerstorageBcprotected org.objectweb.fractal.api.Componentsupervisorprotected org.objectweb.fractal.api.control.BindingControllersupervisorBc
-
Constructor Summary
Constructors Constructor Description ClifAppFacade(java.lang.String testName, java.lang.String appDefinition)Create new ClifAppFacade with all components of a ClifApplication : supervisor, storage...ClifAppFacade(org.objectweb.fractal.api.Component clifApp, java.lang.String name)Constructor for ClifAppFacade.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeParameter(java.lang.String bladeId, java.lang.String name, java.lang.String text)intcollect(java.lang.String[] selBladesId, CollectListener listener)Collect selected blades if global state is completed or stoppedvoiddeploy(java.util.Map<java.lang.String,ClifDeployDefinition> definitions, ClifRegistry registry)Asynchronously deploys blades among CLIF servers according to the given definitions.org.objectweb.fractal.api.ComponentgetClifApp()Get clifApp componentorg.objectweb.fractal.api.ComponentgetComponentByName(java.lang.String name)Get a component of the clifApplication by his Fractal namejava.util.Map<java.lang.String,java.io.Serializable>getCurrentParameters(java.lang.String id)java.lang.StringgetCurrentTestId()Retrieves current test identifier.BladeStategetGlobalState(java.lang.String[] selBladesId)Get global state for these blades.BladeStategetState(java.lang.String id)Get the state of a bladejava.lang.String[]getStatLabels(java.lang.String bladeId)Retrieve the ActionStat of a specific host.long[]getStats(java.lang.String bladeId)Retrieve the ActionStat of a specific host.voidinit(java.lang.String testId)Init selected blades if global state is deployedintjoin(java.lang.String[] selBladesId)Join selected blades if global state is runningintresume(java.lang.String[] selBladesId)Resume selected blades if global state is suspendedintstart(java.lang.String[] selBladesId)Start selected blades if global state is initializedvoidstartMonitoring(java.lang.String[] bladesId, long period)Start the monitoring of ActionStat of a specific host.intstop(java.lang.String[] selBladesId)Stop selected blades if global state is not stopped/completed/abortedintsuspend(java.lang.String[] selBladesId)Suspend selected blades if global state is runningvoidsyncDeploy(java.util.Map<java.lang.String,ClifDeployDefinition> definitions, ClifRegistry registry)Synchronous version of deploy method (returns when deployment is complete).voidupdate(java.util.Observable supervisor, java.lang.Object observation)intwaitForState(java.lang.String[] selBladesId, BladeState state)Waits until this state is reached
-
-
-
Field Detail
-
clifAppDefinition
protected java.lang.String clifAppDefinition
-
clifAppName
protected java.lang.String clifAppName
-
currentTestId
protected java.io.Serializable currentTestId
-
clifApp
protected org.objectweb.fractal.api.Component clifApp
-
storage
protected org.objectweb.fractal.api.Component storage
-
supervisor
protected org.objectweb.fractal.api.Component supervisor
-
components
protected java.util.Map<java.lang.String,org.objectweb.fractal.api.Component> components
clif application components indexed by their name (storage, supervisor, analyzer)
-
storageBc
protected org.objectweb.fractal.api.control.BindingController storageBc
-
supervisorBc
protected org.objectweb.fractal.api.control.BindingController supervisorBc
-
clifAppCc
protected org.objectweb.fractal.api.control.ContentController clifAppCc
-
-
Constructor Detail
-
ClifAppFacade
public ClifAppFacade(java.lang.String testName, java.lang.String appDefinition)Create new ClifAppFacade with all components of a ClifApplication : supervisor, storage...- Parameters:
testName- the name in the Registry to be associated with the resulting Clif Application.appDefinition- fully-qualified Fractal ADL definition file of the CLIF application to instantiate.- Throws:
java.lang.Error
-
ClifAppFacade
public ClifAppFacade(org.objectweb.fractal.api.Component clifApp, java.lang.String name)Constructor for ClifAppFacade. Get all sub-components from the clifApp- Parameters:
clifApp- the existing Clif application component
-
-
Method Detail
-
getComponentByName
public org.objectweb.fractal.api.Component getComponentByName(java.lang.String name)
Get a component of the clifApplication by his Fractal name- Parameters:
name- the name of the component to find- Returns:
- the reference of a component contained by the Clif Application whose name equals the String passed as parameter, or null if there is no such component.
-
getClifApp
public org.objectweb.fractal.api.Component getClifApp()
Get clifApp component- Returns:
- Returns the clifApp component.
-
deploy
public void deploy(java.util.Map<java.lang.String,ClifDeployDefinition> definitions, ClifRegistry registry) throws ClifException
Asynchronously deploys blades among CLIF servers according to the given definitions. First, a new CLIF code server is launched. Then, current CLIF application is stopped, reconfigured and started again. In case the CLIF application is doing wrong (typically one of its distributed parts is no longer available), a new one is instantiated. So, be careful to always callgetClifApp()from one deployment to another whenever you need to get the reference to the CLIF application component. Old blades that may have been previously deployed by this supervisor are removed, unless a new CLIF application is instantiated or previous blades became unreachable. DeployObservation objects will be send to Observers to inform about deployment success or failure. BladeObservation objects are also sent to notify blades state changes.- Parameters:
definitions- a Map containing test plan definitions, indexed by blades identifiersregistry- the CLIF registry to be used for getting CLIF servers references- Throws:
ClifException- when the CLIF code server could not be started, or when the test plan definition is null- See Also:
DeployDefinition,DeployObservation,BladeObservation,syncDeploy(Map, ClifRegistry)
-
syncDeploy
public void syncDeploy(java.util.Map<java.lang.String,ClifDeployDefinition> definitions, ClifRegistry registry) throws ClifException
Synchronous version of deploy method (returns when deployment is complete).- Parameters:
definitions- a Map containing test plan definitions, indexed by blades identifiersregistry- the CLIF registry to be used for getting CLIF servers references- Throws:
ClifException- See Also:
deploy(Map, ClifRegistry),DeployDefinition,DeployObservation
-
init
public void init(java.lang.String testId) throws ClifExceptionInit selected blades if global state is deployed- Parameters:
testId- selected blades ids- Throws:
ClifException
-
start
public int start(java.lang.String[] selBladesId)
Start selected blades if global state is initialized- Parameters:
selBladesId- selected blades ids- Returns:
- the int code return for exit info
-
stop
public int stop(java.lang.String[] selBladesId)
Stop selected blades if global state is not stopped/completed/aborted- Parameters:
selBladesId- selected blades ids- Returns:
- the int code return for exit info
-
suspend
public int suspend(java.lang.String[] selBladesId)
Suspend selected blades if global state is running- Parameters:
selBladesId- selected blades ids- Returns:
- the int code return for exit info
-
resume
public int resume(java.lang.String[] selBladesId)
Resume selected blades if global state is suspended- Parameters:
selBladesId- selected blades ids- Returns:
- the int code return for exit info
-
join
public int join(java.lang.String[] selBladesId)
Join selected blades if global state is running- Parameters:
selBladesId- selected blades ids- Returns:
- the int code return for exit info
-
collect
public int collect(java.lang.String[] selBladesId, CollectListener listener)Collect selected blades if global state is completed or stopped- Parameters:
selBladesId- selected blades ids- Returns:
- the int return code for exit information
-
getGlobalState
public BladeState getGlobalState(java.lang.String[] selBladesId)
Get global state for these blades.- Parameters:
selBladesId- the blades ids- Returns:
- BladeState the global state
-
getState
public BladeState getState(java.lang.String id)
Get the state of a blade- Parameters:
id- the bladeId tested- Returns:
- the blade state
-
waitForState
public int waitForState(java.lang.String[] selBladesId, BladeState state)Waits until this state is reached- Parameters:
selBladesId-state-- Returns:
- int return code
-
getStats
public long[] getStats(java.lang.String bladeId)
Retrieve the ActionStat of a specific host.- Parameters:
bladeId- The blade identifier to get the statistical data from- Returns:
- An array containing some informations about the test for this host
-
getStatLabels
public java.lang.String[] getStatLabels(java.lang.String bladeId)
Retrieve the ActionStat of a specific host.- Parameters:
bladeId- The blade identifier to get the statistics labels from- Returns:
- An array containing some informations about the test for this host
-
startMonitoring
public void startMonitoring(java.lang.String[] bladesId, long period)Start the monitoring of ActionStat of a specific host.- Parameters:
bladesId- The blade identifier to get the statistical data from (if null, get data for all blade)period- The monitoring period
-
getCurrentParameters
public java.util.Map<java.lang.String,java.io.Serializable> getCurrentParameters(java.lang.String id)
-
getCurrentTestId
public java.lang.String getCurrentTestId()
Retrieves current test identifier.- Returns:
- A string composed of the test name, and the date and time of its initialization
-
changeParameter
public void changeParameter(java.lang.String bladeId, java.lang.String name, java.lang.String text) throws ClifException- Throws:
ClifException
-
update
public void update(java.util.Observable supervisor, java.lang.Object observation)- Specified by:
updatein interfacejava.util.Observer
-
-