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

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.kiem.automated.AbstractAutomatedComponent
              extended by de.cau.cs.kieler.sim.kiem.automated.AbstractAutomatedProducer
                  extended by de.cau.cs.kieler.sim.trace.TraceReader
All Implemented Interfaces:
IAutomatedComponent, IAutomatedProducer, IDataComponent, IJSONObjectDataComponent, IExecutableExtension

public class TraceReader
extends AbstractAutomatedProducer

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.automated.IAutomatedComponent
ITERATION, MODEL_FILE
 
Constructor Summary
TraceReader()
           
 
Method Summary
 String[] getSupportedExtensions()
          This component doesn't support any files.
 void initialize()
          Initialize.
 boolean isObserver()
          To check whether the DataComponent is an observer.
 boolean isProducer()
          To check whether the DataComponent is a producer.
 JSONObject provideInitialVariables()
          Provide (local) interface variables and possible initial values.
 KiemProperty[] provideProperties()
          Provide properties for this component.
 void setParameters(List<KiemProperty> properties)
          The default implementation only retrieves the model file and the current iteration index.
 JSONObject step(JSONObject input)
          Step method for a DataObserver and a DataPrroducer.
 int wantsMoreRuns()
          The default implementation doesn't need any runs.
 int wantsMoreSteps()
          The default implementation doesn't need any steps.
 void wrapup()
          Wrap-up.
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.automated.AbstractAutomatedProducer
produceInformation, produceModelFileInformation
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.automated.AbstractAutomatedComponent
getIteration, getModelFile
 
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, masterSetKIEMInstance, notifyEvent, provideEventOfInterest, provideFilterKeys, setConfigurationElemenet, setHistoryStep, setInitializationData, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceReader

public TraceReader()
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.

Parameters:
input - the concrete JSONObject of input data (if observer)
Returns:
the JSONObject with the output data (if producer)
Throws:
KiemExecutionException - a KiemExecutionException

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.

Throws:
KiemInitializationException

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.

Returns:
true, if is producer

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.

Returns:
true, if is observer

provideProperties

public KiemProperty[] provideProperties()
Description copied from class: AbstractDataComponent
Provide properties for this component. The component may create and publicize its properties with this method. They will be set/modified by the execution manager during the user edits them. Whenever the user decides to run/start the execution the properties are tested (see below) and the component may use there settings.

The following lists a simple example for such properties:
\ATOverride
public KiemProperty[] provideProperties() {
KiemProperty[] properties = new KiemProperty[7];
properties[0] = new KiemProperty(
"state name",
"state");
properties[1] = new KiemProperty(
"some bool",
true);
properties[2] = new KiemProperty(
"an integer",
2);
properties[3] = new KiemProperty(
"a file",
new KiemPropertyTypeFile(),
"c:/nothing.txt");
String[] items = {"trace 1","trace 2", "trace 3", "trace 4"};
properties[4] = new KiemProperty(
"a choice",
new KiemPropertyTypeChoice(items),
items[2]);
properties[5] = new KiemProperty(
"workspace file",
new KiemPropertyTypeWorkspaceFile(),
"/nothing.txt");
properties[6] = new KiemProperty(
"editor",
new KiemPropertyTypeEditor(),
"");
return properties;
}

These are built-in types that can always be extended using the KiemProperty class.

Overrides:
provideProperties in class AbstractDataComponent
Returns:
the KiemProperty[] or null if no properties are provided

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.


provideInitialVariables

public JSONObject provideInitialVariables()
                                   throws KiemInitializationException
Description copied from class: JSONObjectDataComponent
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

setParameters

public void setParameters(List<KiemProperty> properties)
                   throws KiemInitializationException
The default implementation only retrieves the model file and the current iteration index. Subclasses should extend this method.

Specified by:
setParameters in interface IAutomatedComponent
Overrides:
setParameters in class AbstractAutomatedComponent
Parameters:
properties - the properties passed before each execution
Throws:
KiemInitializationException

wantsMoreRuns

public int wantsMoreRuns()
The default implementation doesn't need any runs. Subclasses should override this method.

Specified by:
wantsMoreRuns in interface IAutomatedComponent
Overrides:
wantsMoreRuns in class AbstractAutomatedComponent
Returns:
0

wantsMoreSteps

public int wantsMoreSteps()
The default implementation doesn't need any steps. Subclasses should override this method.

Specified by:
wantsMoreSteps in interface IAutomatedComponent
Overrides:
wantsMoreSteps in class AbstractAutomatedComponent
Returns:
0

getSupportedExtensions

public String[] getSupportedExtensions()
This component doesn't support any files. Subclasses should override this to indicate which type of file they support.

Specified by:
getSupportedExtensions in interface IAutomatedComponent
Overrides:
getSupportedExtensions in class AbstractAutomatedComponent
Returns:
null