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
           
protected static int _traceCount
           
protected static TraceabilitymodelFactory _traceFactory
           
protected static TraceModel _traceModel
           
protected static TraceabilitymodelPackage _tracePackage
           
 java.util.Hashtable _variablesRefValues
           
static boolean coarseTramde
           
static java.lang.reflect.Method createCoarseTramdeTrace
           
static java.lang.reflect.Method createTramdeTrace
           
 ITraceEstablisher ite
           
protected static java.lang.String tramdeEstablisherClass
           
static boolean useTramde
           
 
Fields inherited from class org.eclipse.mofscript.runtime.ExecutionEnvironment
_currentStream, _inPrintAction, _inputobjects, _lineNumber, _objectId, _offsets, _openFileUri, _parentEnv, _printStreams, _streamContexts, _streams, _traceValue
 
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()
           
 ITraceEstablisher getIte()
           
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.
protected  void loadTraceabilityModel()
          Load the traceablity model from file?
 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
 void setIte(ITraceEstablisher ite)
           
 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
addBreakPoint, addInputObject, addModelVariables, addOutputStream, addVariable, addVariables, assignVariableValue, assignVariableValue, clean, cleanLocal, cleanResources, clearInputObject, clearReferenceCache, contDebug, finalize, findVariable, getAssignValue, getCachedReference, getContDebug, getCurrentPrintStream, getCurrentStream, getCurrentStreamUri, getFileModel, getIndent, getInputObject, getIteratorCount, getIteratorPosition, getLineNumber, getOutputStream, getOutputStreamForContext, getParentEnvironment, getPrintStreamForContext, getResources, getStepDebug, getStopDebug, getTrace, getUseFileModel, getUseLog, getVariable, getVariableImplementation, getVariableImplementation, getVariables, increaseIteratorCount, increaseIteratorPosition, increaseLineNumber, indent, initIteratorCounters, isBreakPoint, isDebugging, isInPrintAction, isUnprotectedBlock, log, notifyError, notifyMessage, println, removeBreakPointAt, removeBreakPoints, removeVariable, resetBlockCounter, resetDebug, saveTargetModel, setCachedReference, setCurrentStream, setCurrentStream, setDebug, setInPrintAction, setOwnerStack, setParentEnvironment, setPrintContext, setRootDirectory, setStepDebug, setTrace, setTypeForVariable, setUnprotectedBlock, setUseFileModel, setUseLog, setUseParentCache, setVariable, stopDebug, storeFiles, storeResource, storeResource, undent, useIndent
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tracePackage

protected static TraceabilitymodelPackage _tracePackage

_traceFactory

protected static TraceabilitymodelFactory _traceFactory

_traceModel

protected static TraceModel _traceModel

_traceCount

protected static int _traceCount

ite

public ITraceEstablisher ite

tramdeEstablisherClass

protected static final java.lang.String tramdeEstablisherClass
See Also:
Constant Field Values

_tempObject

public java.lang.Object _tempObject

_tempRef

public java.lang.String _tempRef

_variablesRefValues

public java.util.Hashtable _variablesRefValues

useTramde

public static boolean useTramde

coarseTramde

public static boolean coarseTramde

createTramdeTrace

public static java.lang.reflect.Method createTramdeTrace

createCoarseTramdeTrace

public static java.lang.reflect.Method createCoarseTramdeTrace
Constructor Detail

TraceabilityEnvironment

public TraceabilityEnvironment()
Default constructor

Method Detail

getIte

public ITraceEstablisher getIte()

setIte

public void setIte(ITraceEstablisher ite)

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)

loadTraceabilityModel

protected void loadTraceabilityModel()
Load the traceablity model from file? Or create a new traceability model


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: