org.eclipse.mofscript.runtime.traceability
Class TraceabilityEnvironment

java.lang.Object
  extended by org.eclipse.mofscript.runtime.ExecutionEnvironment
      extended by org.eclipse.mofscript.runtime.traceability.TraceabilityEnvironment

public class TraceabilityEnvironment
extends ExecutionEnvironment

The Traceability Environment is used to provide extra functionality to the environment when traceability is turned on.

Author:
jol, gko

Nested Class Summary
 class TraceabilityEnvironment.OffsetCounter
          Class to handle the counting of offset
 
Field Summary
 java.lang.Object _tempObject
           
 java.lang.String _tempRef
           
 java.util.Hashtable _variablesRefValues
           
 
Constructor Summary
TraceabilityEnvironment()
          Default constructor
 
Method Summary
 void addVariableInfo(java.lang.String refName, java.lang.String varName, java.lang.Object modelElement, java.lang.String value)
           
static void cleanTraceEnv()
           
 Trace createTrace(java.lang.String refValue, int offset, int refLength, org.eclipse.emf.ecore.EObject object, java.lang.String feature, RuleExecutor rExec, java.lang.String fullRefName)
          creates a trace
 void endUnprotectedBlock()
           
static java.lang.String getObjectId(org.eclipse.emf.ecore.EObject obj)
           
 org.eclipse.emf.ecore.EObject getVariableEObject(java.lang.String key)
          Gets the EObject that the variable is refering
 java.lang.Object getVariableInfo(java.lang.String key)
          Retrieves the variable information object TraceVariableInfo.
 java.lang.String getVariableRefName(java.lang.String key)
          Gets the ref name E.g self.name
 java.lang.String getVariableValue(java.lang.String key)
          Gets the value of self. ... e.g.
 void print(java.lang.String s, boolean println)
          Overrides the print function
 void removeVariableInfo(java.lang.String varName)
           
static void resetTraceCounter()
          Resets the trace counter Called from ExecutionManager when execution is finished
 boolean setVariableInfo(java.lang.String refName, java.lang.String varName, java.lang.Object modelElement, java.lang.String value)
          Inserts a variable that should be traced into the Hashtable _variablesRefValues
 void startUnprotectedBlock(java.lang.String objectUri)
           
 void storeInputObject(java.lang.Object ret)
          Gets an input object
 void storeTraceablityModel(java.lang.String traceGenDir)
          Stores the traceability model
 
Methods inherited from class org.eclipse.mofscript.runtime.ExecutionEnvironment
addInputObject, addLocalVariablesZZZ, addModelVariables, addVariable, addVariables, assignVariableValue, clean, cleanResources, clearInputObject, clearReferenceCache, contDebug, findVariable, getAssignValue, getCachedReference, getContDebug, getCurrentPrintStream, getCurrentStream, getDebug, getFileModel, getIndent, getInputObject, getIteratorCount, getIteratorPosition, getLineNumber, getOutputStream, getParentEnvironment, getResources, getStopDebug, getUseFileModel, getUseLog, getVariable, getVariableImplementation, getVariableImplementation, getVariables, increaseIteratorCount, increaseIteratorPosition, increaseLineNumber, indent, initIteratorCounters, isInPrintAction, isUnprotectedBlock, log, notifyError, notifyMessage, println, removeVariable, resetBlockCounter, resetDebug, saveTargetModel, setCachedReference, setCurrentStream, setCurrentStream, setDebug, setInPrintAction, setOwnerStack, setParentEnvironment, setPrintContext, setRootDirectory, setTrace, setTypeForVariable, setUnprotectedBlock, setUseFileModel, setUseLog, setUseParentCache, setVariable, stopDebug, storeFiles, undent, useIndent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tempObject

public java.lang.Object _tempObject

_tempRef

public java.lang.String _tempRef

_variablesRefValues

public java.util.Hashtable _variablesRefValues
Constructor Detail

TraceabilityEnvironment

public TraceabilityEnvironment()
Default constructor

Method Detail

print

public void print(java.lang.String s,
                  boolean println)
Overrides the print function

Overrides:
print in class ExecutionEnvironment
Parameters:
s -
println -

createTrace

public Trace createTrace(java.lang.String refValue,
                         int offset,
                         int refLength,
                         org.eclipse.emf.ecore.EObject object,
                         java.lang.String feature,
                         RuleExecutor rExec,
                         java.lang.String fullRefName)
creates a trace

Parameters:
offset -
object -
feature -
rExec -

getObjectId

public static java.lang.String getObjectId(org.eclipse.emf.ecore.EObject obj)

storeTraceablityModel

public void storeTraceablityModel(java.lang.String traceGenDir)
Stores the traceability model


resetTraceCounter

public static void resetTraceCounter()
Resets the trace counter Called from ExecutionManager when execution is finished


cleanTraceEnv

public static void cleanTraceEnv()

startUnprotectedBlock

public void startUnprotectedBlock(java.lang.String objectUri)
Overrides:
startUnprotectedBlock in class ExecutionEnvironment

endUnprotectedBlock

public void endUnprotectedBlock()
Overrides:
endUnprotectedBlock in class ExecutionEnvironment

storeInputObject

public void storeInputObject(java.lang.Object ret)
Gets an input object

Overrides:
storeInputObject in class ExecutionEnvironment
Parameters:
name -

setVariableInfo

public boolean setVariableInfo(java.lang.String refName,
                               java.lang.String varName,
                               java.lang.Object modelElement,
                               java.lang.String value)
Inserts a variable that should be traced into the Hashtable _variablesRefValues

Parameters:
refName -
varName -
modelElement -

addVariableInfo

public void addVariableInfo(java.lang.String refName,
                            java.lang.String varName,
                            java.lang.Object modelElement,
                            java.lang.String value)

removeVariableInfo

public void removeVariableInfo(java.lang.String varName)

getVariableInfo

public java.lang.Object getVariableInfo(java.lang.String key)
Retrieves the variable information object TraceVariableInfo.

Parameters:
key - The name of the variable
Returns:
The variable information needed for traceability

getVariableEObject

public org.eclipse.emf.ecore.EObject getVariableEObject(java.lang.String key)
Gets the EObject that the variable is refering

Parameters:
key - The name of the variable
Returns:

getVariableRefName

public java.lang.String getVariableRefName(java.lang.String key)
Gets the ref name E.g self.name

Parameters:
key - The name of the variable
Returns:

getVariableValue

public java.lang.String getVariableValue(java.lang.String key)
Gets the value of self. ... e.g. "MyClassName"

Overrides:
getVariableValue in class ExecutionEnvironment
Parameters:
key - The name of the variable
Returns: