org.ow2.clif.scenario.multithread
Class MTScenario

java.lang.Object
  extended by org.ow2.clif.scenario.multithread.MTScenario
All Implemented Interfaces:
org.objectweb.fractal.api.control.BindingController, org.objectweb.fractal.api.control.LifeCycleController, ActivityControl, BladeControl

public abstract class MTScenario
extends java.lang.Object
implements BladeControl, org.objectweb.fractal.api.control.BindingController, org.objectweb.fractal.api.control.LifeCycleController

Abstract implementation of a multi-thread based scenario component. Method newSession() should be implemented by a derived class in order to provide actual action to be performed. Each session loops on calling its action() method, animated by its own thread. MTscenario must be given an argument line (as a single String) beginning with 3 integer parameters:

The trailing characters of the argument String is passed as argument to the newSession() method.

Author:
Bruno Dillenseger
See Also:
newSession(int, String), setArgument(String)

Field Summary
protected  java.lang.String scenarioId
           
protected  java.io.Serializable testId
           
 
Fields inherited from interface org.ow2.clif.server.api.BladeControl
BLADE_CONTROL, BLADE_INSERT_CONTROL
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
MTScenario()
           
 
Method Summary
 void bindFc(java.lang.String clientItfName, java.lang.Object serverItf)
           
 void changeParameter(java.lang.String parameter, java.io.Serializable value)
          Sets the parameter parameter of this blade with the value value.
 java.util.Map getCurrentParameters()
          Returns a Map which maps the defined parameters to their values.
 java.lang.String getFcState()
           
 java.lang.String getId()
           
 void init(java.io.Serializable testId)
          initializes a new test, creating and starting the given number of activity threads, and returns as soon as every thread has been actually started
 void join()
          Waits until the end of the activity
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String clientItfName)
           
abstract  MTScenarioSession newSession(int sessionId, java.lang.String arg)
           
 void resume()
          Resume the activity (if suspended)
 void setArgument(java.lang.String arg)
          Sets number of threads and test duration parameters
 void setId(java.lang.String id)
          Sets this scenario's unique identifier
 void start()
          releases every activity thread
 void startFc()
           
 void stop()
          Final stop of the activity
 void stopFc()
           
 void suspend()
          Suspend the activity
 void unbindFc(java.lang.String clientItfName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

testId

protected java.io.Serializable testId

scenarioId

protected java.lang.String scenarioId
Constructor Detail

MTScenario

public MTScenario()
Method Detail

newSession

public abstract MTScenarioSession newSession(int sessionId,
                                             java.lang.String arg)
                                      throws ClifException
Throws:
ClifException

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

init

public void init(java.io.Serializable testId)
          throws ClifException
initializes a new test, creating and starting the given number of activity threads, and returns as soon as every thread has been actually started

Specified by:
init in interface ActivityControl
Parameters:
testId - unique identifier of the new test
Throws:
ClifException

start

public void start()
releases every activity thread

Specified by:
start in interface ActivityControl

stop

public void stop()
Description copied from interface: ActivityControl
Final stop of the activity

Specified by:
stop in interface ActivityControl

suspend

public void suspend()
Description copied from interface: ActivityControl
Suspend the activity

Specified by:
suspend in interface ActivityControl

resume

public void resume()
Description copied from interface: ActivityControl
Resume the activity (if suspended)

Specified by:
resume in interface ActivityControl

join

public void join()
Description copied from interface: ActivityControl
Waits until the end of the activity

Specified by:
join in interface ActivityControl

setArgument

public void setArgument(java.lang.String arg)
Sets number of threads and test duration parameters

Specified by:
setArgument in interface BladeControl
Parameters:
arg - should begin with 2 integer parameters (separated with usual separators) setting (1) the number of threads and (2) the test duration (in seconds). The trailing String will be used as an argument when creating sessions.
See Also:
newSession(int, String)

setId

public void setId(java.lang.String id)
Sets this scenario's unique identifier

Specified by:
setId in interface BladeControl

getId

public java.lang.String getId()
Specified by:
getId in interface BladeControl
Returns:
the scenario/blade identifier

changeParameter

public void changeParameter(java.lang.String parameter,
                            java.io.Serializable value)
                     throws ClifException
Description copied from interface: BladeControl
Sets the parameter parameter of this blade with the value value. This method allows to change parameters independently of the activity of the blade. However, some parameters can depend on the state of the blade.

Specified by:
changeParameter in interface BladeControl
Throws:
ClifException

getCurrentParameters

public java.util.Map getCurrentParameters()
Description copied from interface: BladeControl
Returns a Map which maps the defined parameters to their values.

Specified by:
getCurrentParameters in interface BladeControl