de.cau.cs.kieler.sim.trace
Class TraceValidator

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
      extended by de.cau.cs.kieler.sim.kiem.JSONObjectDataComponent
          extended by de.cau.cs.kieler.sim.trace.TraceValidator
All Implemented Interfaces:
IAutomatedComponent, IAutomatedProducer, IDataComponent, IJSONObjectDataComponent, IExecutableExtension

public class TraceValidator
extends JSONObjectDataComponent
implements IAutomatedProducer

Data-component to read traces in esi format.

Rating red

Field Summary
 
Fields inherited from class de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
MASTER_CMD_MACROSTEP, MASTER_CMD_PAUSE, MASTER_CMD_RUN, MASTER_CMD_STEP, MASTER_CMD_STEPBACK, MASTER_CMD_STOP
 
Fields inherited from interface de.cau.cs.kieler.sim.kiem.IAutomatedComponent
ITERATION, MODEL_FILE, STATUS
 
Constructor Summary
TraceValidator()
           
 
Method Summary
 String[] getSupportedExtensions()
          Getter for the list of model file extensions that are supported by the component.
 void initialize()
          Initialize.
 boolean isObserver()
          To check whether the DataComponent is an observer.
 boolean isProducer()
          To check whether the DataComponent is a producer.
 List<KiemProperty> produceInformation()
          Notifies the DataComponent that the schedule has finished and asks it to provide some information for evaluation.
 JSONObject provideInitialVariables()
          Provide (local) interface variables and possible initial values.
 void setParameters(List<KiemProperty> properties)
          Give the component information.
 JSONObject step(JSONObject input)
          Step method for a DataObserver and a DataPrroducer.
 int wantsMoreRuns()
          Ask the component if it wants to do more runs.
 int wantsMoreSteps()
          Ask the component if it wants to do more steps.
 void wrapup()
          Wrap-up.
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.JSONObjectDataComponent
getInitialVariables, provideFilterKeysJSON, setInitialVariables
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
checkProperties, finalize, getConfigurationElement, getDataComponentId, getName, getPluginId, getProperties, isDeltaObserver, isHistoryObserver, isHistoryStep, isInvisible, isMacroStepDone, isMaster, isMasterImplementingGUI, isMultiInstantiable, masterCommand, masterGetAimedStepDuration, masterGUI, masterGUIisEnabled, masterIsPaused, masterIsRunning, masterSetAimedStepDuration, masterSetKIEMInstances, notifyEvent, provideEventOfInterest, provideFilterKeys, provideProperties, setConfigurationElemenet, setHistoryStep, setInitializationData, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceValidator

public TraceValidator()
Method Detail

step

public JSONObject step(JSONObject input)
                throws KiemExecutionException
Step method for a DataObserver and a DataPrroducer.

For a producer only the argument will always be null. For an observer only this method will be called asynchronous. This may mean that in case the observer is slow, it may be skipped at some consecutive steps until it becomes ready again. If this is not desired and the observer MUST NOT be skipped, then the DataComponent should also be a DataProducer but return just null.

If an error occurs during the execution of the step method, a DataComponent should raise a KiemExecutionException that is then catched by the execution manager an brought to the user's attention.

Specified by:
step in interface IJSONObjectDataComponent
Parameters:
input - the concrete JSONObject of input data (if observer)
Returns:
the JSONObject with the output data (if producer)
Throws:
KiemExecutionException - a KiemExecutionException

provideInitialVariables

public JSONObject provideInitialVariables()
                                   throws KiemInitializationException
Provide (local) interface variables and possible initial values. This is an optional method that will provide some interface variable keys and values that can be used by other DataComponents within and after the initialization phase every DataComponent may receive the union of all those variable keys by calling the JSONObjectDataComponent.getInitialVariables() method.

Overrides:
provideInitialVariables in class JSONObjectDataComponent
Returns:
the local initial variables as a JSONObject
Throws:
KiemInitializationException - if a property prevents the execution of this DataComponent this error should be thrown

initialize

public void initialize()
                throws KiemInitializationException
Initialize. Do some initializing prior to execution. If an error occurs during initialization, the DataComponent should raise a KiemInitializationException.

Specified by:
initialize in interface IDataComponent
Throws:
KiemInitializationException - a KiemInitializationException

isObserver

public boolean isObserver()
To check whether the DataComponent is an observer. If the DataComponent is an observer the arguments in its step() method will be != null.

Specified by:
isObserver in interface IDataComponent
Returns:
true, if is observer

wrapup

public void wrapup()
Wrap-up. Do some wrapping-up after execution has finished. If an error occurs during wrap up, the DataComponent should raise a KiemInitializationException.

Specified by:
wrapup in interface IDataComponent

produceInformation

public List<KiemProperty> produceInformation()
Notifies the DataComponent that the schedule has finished and asks it to provide some information for evaluation. The number and order of properties has to be the same for all iterations that a particular execution file performs on all model files that should be simulated. This is necessary in order to construct a valid results table.

Specified by:
produceInformation in interface IAutomatedProducer
Returns:
information

setParameters

public void setParameters(List<KiemProperty> properties)
Give the component information. This at least contains the following properties: IAutomatedComponent.MODEL_FILE gotten from IPath.toOSString() IAutomatedComponent.ITERATION as an integer starting with 0 of course

Specified by:
setParameters in interface IAutomatedComponent
Parameters:
properties - some info

wantsMoreRuns

public int wantsMoreRuns()
Ask the component if it wants to do more runs. This causes the entire execution to be executed again as many times as the components specified.

Specified by:
wantsMoreRuns in interface IAutomatedComponent
Returns:
the number of additional runs

wantsMoreSteps

public int wantsMoreSteps()
Ask the component if it wants to do more steps. This causes the entire execution to perform at least as many steps as the components specified.

Specified by:
wantsMoreSteps in interface IAutomatedComponent
Returns:
the number of additional steps

getSupportedExtensions

public String[] getSupportedExtensions()
Getter for the list of model file extensions that are supported by the component. Combinations of model files with execution files that don't have at least one supporting component will not be executed.

Specified by:
getSupportedExtensions in interface IAutomatedComponent
Returns:
the list of supported model file extensions

isProducer

public boolean isProducer()
To check whether the DataComponent is a producer. If the DataComponent is a producer it should return != null in its step() method.

Specified by:
isProducer in interface IDataComponent
Returns:
true, if is producer