de.cau.cs.kieler.synccharts.sim.sc
Class SCDataComponent

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.ui.datacomponent.JSONObjectSimulationDataComponent
              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.synccharts.sim.sc.SCDataComponent
All Implemented Interfaces:
IAutomatedComponent, IAutomatedProducer, IDataComponent, IJSONObjectDataComponent, IExecutableExtension

public class SCDataComponent
extends AbstractAutomatedProducer

This is the data component to handle the communication between KIEM and the external SC-Program.

Rating proposed yellow
(2010-06-14)

Nested Class Summary
 
Nested classes/interfaces inherited from class de.cau.cs.kieler.sim.kiem.ui.datacomponent.JSONObjectSimulationDataComponent
JSONObjectSimulationDataComponent.M2MProgressMonitor
 
Field Summary
 
Fields inherited from class de.cau.cs.kieler.sim.kiem.ui.datacomponent.JSONObjectSimulationDataComponent
activePage, activePageFlag, exception, modelEditor
 
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
ANY_TYPE, ANY_TYPE_ARRAY, ITERATION, MODEL_FILE
 
Constructor Summary
SCDataComponent()
           
 
Method Summary
 JSONObject doProvideInitialVariables()
          Performs the normal provide initial variables method.
 KiemProperty[] doProvideProperties()
           
 JSONObject doStep(JSONObject jSONObject)
          Implements the real step method for this simulation datacomponent.
 String[] getSupportedExtensions()
          This component doesn't support any files.
 void initialize()
          This method fetches the location of the used sc- and header files.
 boolean isObserver()
          To check whether the DataComponent is an observer.
 boolean isProducer()
          To check whether the DataComponent is a producer.
 List<KiemProperty> produceInformation()
          The default implementation produces no information.
 void setParameters(List<KiemProperty> properties)
          The default implementation only retrieves the model file and the current iteration index.
 void wrapup()
          On stopping the simulation the sc process will be destroyed (if it was not closed normally).
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.automated.AbstractAutomatedProducer
produceModelFileInformation
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.automated.AbstractAutomatedComponent
getIteration, getModelFile, getNumberOfAdditionalIterations, getNumberOfAdditionalSteps, wantsMoreRuns, wantsMoreSteps
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.ui.datacomponent.JSONObjectSimulationDataComponent
bringProblemsViewToFront, checkModelValidation, checkProperties, doModel2ModelTransform, getActivePage, getEditor, getInputEditor, getInputModel, getInputModelAsURI, getInputModelEObject, getInputResourceSet, getInputWorkspaceModel, getModelRootElement, getNotationElement, isTransformationCompleted, isTransformationError, provideFilterKeysJSON, provideInitialVariables, provideProperties, resolveBundelFile, step
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.JSONObjectDataComponent
getInitialVariables, setInitialVariables
 
Methods inherited from class de.cau.cs.kieler.sim.kiem.internal.AbstractDataComponent
finalize, getConfigurationElement, getCurrentComponentID, getDataComponentId, getName, getPluginId, getProperties, getShell, isDeltaObserver, isHistoryObserver, isHistoryStep, isInvisible, isMacroStepDone, isMaster, isMasterImplementingGUI, isMultiInstantiable, masterCommand, masterGetAimedStepDuration, masterGUI, masterGUIisEnabled, masterIsPaused, masterIsRunning, masterSetAimedStepDuration, masterSetKIEMInstance, notifyEvent, provideEventOfInterest, provideFilterKeys, setConfigurationElemenet, setCurrentComponentID, setHistoryStep, setInitializationData, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.cau.cs.kieler.sim.kiem.automated.IAutomatedComponent
getNumberOfAdditionalIterations, getNumberOfAdditionalSteps, wantsMoreRuns, wantsMoreSteps
 

Constructor Detail

SCDataComponent

public SCDataComponent()
Method Detail

initialize

public void initialize()
                throws KiemInitializationException
This method fetches the location of the used sc- and header files. With the resulting files and the folder for the output files it starts the compilation of the program. After compiling a process with the execution of the resulting program is started. 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
Overrides:
initialize in class JSONObjectSimulationDataComponent
Throws:
KiemInitializationException - a KiemInitializationException

doStep

public JSONObject doStep(JSONObject jSONObject)
                  throws KiemExecutionException
Implements the real step method for this simulation datacomponent. The step method handles the communication between the generated sc program and KIEM. For communication JSON Strings are exchanged via std. I/O.

Overrides:
doStep in class JSONObjectSimulationDataComponent
Parameters:
jSONObject - the j son object
Returns:
the jSON object
Throws:
KiemExecutionException - the kiem execution exception

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
Overrides:
isObserver in class JSONObjectSimulationDataComponent
Returns:
true, if is observer

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
Overrides:
isProducer in class JSONObjectSimulationDataComponent
Returns:
true, if is producer

doProvideProperties

public KiemProperty[] doProvideProperties()
Overrides:
doProvideProperties in class JSONObjectSimulationDataComponent

wrapup

public void wrapup()
            throws KiemInitializationException
On stopping the simulation the sc process will be destroyed (if it was not closed normally). If the simulation files are generated into a temp folder it will be deleted. Wrap-up. Do some wrapping-up after execution has finished. If an error occurs during wrap up, the DataComponent should raise a KiemInitializationException.

Throws:
KiemInitializationException - a KiemInitializationException

doProvideInitialVariables

public JSONObject doProvideInitialVariables()
Description copied from class: JSONObjectSimulationDataComponent
Performs the normal provide initial variables method.

Overrides:
doProvideInitialVariables in class JSONObjectSimulationDataComponent
Returns:
JSONObject the initial JSON object before the simulation could be started. A path for the output files will be determined. A differentiation between simulation or validation will be made. After these initializations the codegen process will be started.

produceInformation

public List<KiemProperty> produceInformation()
The default implementation produces no information. Subclasses should override this.

Specified by:
produceInformation in interface IAutomatedProducer
Overrides:
produceInformation in class AbstractAutomatedProducer
Returns:
null

getSupportedExtensions

public String[] getSupportedExtensions()
This component doesn't support any files. Subclasses should override this to indicate which type of file they support. Example: types = {"kixs", "strl}; types = IAutomatedComponent.ANY_TYPE;

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

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. Is called _before_ provideInitialVariables. Sets the flags for validation.

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