public class MockTaskContext extends Object implements TaskContext
Constructor and Description |
---|
MockTaskContext()
Creates new instance.
|
MockTaskContext(ExecutionContext executionContext)
Creates new instance.
|
MockTaskContext(ExecutionContext executionContext,
com.whitestein.lsps.model.Task task,
long taskId,
Map<String,?> parameters)
Creates new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addExecutionTrace(ExecutionTrace et)
Adds ExecutionTrace to the context.
|
void |
addExecutionTraceElement(ExecutionTraceElement e)
Adds ExecutionTraceElement to the context.
|
void |
addSignal(Object signal)
Adds a signal to the signal queue.
|
void |
flushAll()
Flush of all sessions (core, org, human,...
|
CompiledContext |
getCompiled()
Returns compiled context.
|
CompiledContext |
getCompiled(String moduleName)
Returns compiled context of the module
|
ComponentService |
getComponentService()
Returns component service
|
long |
getContextId()
Returns the context id.
|
RuntimeToPersistentConverter |
getConverter()
Returns converter.
|
String |
getEvaluationLevel()
Returns evaluation level.
|
ExecutionTrace |
getExecutionTrace() |
Handle |
getHandle(ValueHolder valueHolder)
Returns a serializable handle for the given value-holder.
|
Identifier |
getIdentifier()
Returns the identifier of this task.
|
com.whitestein.lsps.model.ContextModelElement |
getModelElement()
Returns the corresponding context model element.
|
ModelInstance |
getModelInstance()
Returns the model instance.
|
ModelProvider |
getModelProvider()
Returns model provider.
|
Namespace |
getNamespace()
Returns namespace associated with this context.
|
Object |
getParameter(String name)
Returns a parameter by name.
|
Set<String> |
getParameterNames()
Returns a set of the task parameter names.
|
ExecutionContext |
getParentContext()
Returns the parent execution context or null if it does not exist.
|
String |
getPath()
Returns the full path to this context as a string.
|
QID |
getPathQID()
Returns the full path to this context as a QID.
|
ProcessInstance |
getProcessInstance()
Returns the process instance.
|
com.whitestein.lsps.model.ProcessModel |
getProcessModel()
Returns the process model.
|
String |
getProcessPath()
Returns the full path to model element that is bound to this context.
|
QID |
getProcessPathQID()
Returns the full path to model element that is bound to this context.
|
InterpreterStackTrace |
getStackTrace()
Returns the interpreter stack trace.
|
String[] |
getStackTraceInfo()
Returns the stack trace info from the interpreter stack trace.
|
com.whitestein.lsps.model.Task |
getTask()
Returns the task model element.
|
long |
getTaskId()
Returns the task instance id.
|
ValueHolder |
getValueHolder(Handle handle)
Returns a value-holder for the given handle.
|
Object |
getVariableValue(QID name)
Resolves variable for given name and returns its value.
|
Object |
getVariableValue(String name)
Deprecated.
|
Namespace |
resolveVariableNamespace(QID name)
Resolves variable for given name and returns its containing namespace.
|
Namespace |
resolveVariableNamespace(String name)
Deprecated.
|
void |
setCompiled(CompiledContext compiledContext)
Sets compiled context.
|
void |
setVariableValue(QID name,
Object value)
Resolves variable for given name and sets its value.
|
void |
setVariableValue(String name,
Object value)
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInLevel
public MockTaskContext()
public MockTaskContext(ExecutionContext executionContext)
executionContext
- public MockTaskContext(ExecutionContext executionContext, com.whitestein.lsps.model.Task task, long taskId, Map<String,?> parameters)
executionContext
- task
- taskId
- parameters
- public InterpreterStackTrace getStackTrace()
ExecutionContext
error exceptions
.
The method returns null
if the execution context is not a
JavaOperationExecutionContext
.
getStackTrace
in interface ExecutionContext
null
public String[] getStackTraceInfo()
ExecutionContext
Should be equivalent to
return getStackTrace() != null ? getStackTrace().getStackTraceInfo() : null;
getStackTraceInfo
in interface ExecutionContext
public com.whitestein.lsps.model.Task getTask()
TaskContext
getTask
in interface TaskContext
public long getTaskId()
TaskContext
getTaskId
in interface TaskContext
public Set<String> getParameterNames()
TaskContext
getParameterNames
in interface TaskContext
public Object getParameter(String name)
TaskContext
getParameter
in interface TaskContext
public Identifier getIdentifier()
TaskContext
getIdentifier
in interface TaskContext
public Namespace getNamespace()
ExecutionContext
getNamespace
in interface ExecutionContext
public Object getVariableValue(QID name)
ExecutionContext
Difference between this method and
Namespace.getVariableValue(String)
is that the latter return only value directly from
its namespace while this one does resolution of namespace and calls
Namespace.getVariableValue(String)
on the resolved namespace.
getVariableValue
in interface ExecutionContext
name
- a variable namepublic void setVariableValue(QID name, Object value)
ExecutionContext
Difference between this method and
Namespace.setVariableValue(String, Object)
is that the latter sets variable
directly from its namespace while this one does resolution of namespace and calls
Namespace.setVariableValue(String, Object)
on the resolved namespace.
setVariableValue
in interface ExecutionContext
name
- a variable namevalue
- a new variable valuepublic Namespace resolveVariableNamespace(QID name)
ExecutionContext
The resolution goes primarily into parents, if it fails then it looks in the imports.
The resolution throws IllegalArgumentException
if the variable is not found
or the name is ambiguous.
resolveVariableNamespace
in interface ExecutionContext
name
- variable name@Deprecated public Object getVariableValue(String name)
ExecutionContext
Difference between this method and
Namespace.getVariableValue(String)
is that the latter return only value directly from
its namespace while this one does resolution of namespace and calls
Namespace.getVariableValue(String)
on the resolved namespace.
Known issue: The name parameter should be unescaped name. The method may not work correctly if the variable name is a full name (i.e. with module prefix) and contains special characters.
getVariableValue
in interface ExecutionContext
name
- a variable name@Deprecated public void setVariableValue(String name, Object value)
ExecutionContext
Difference between this method and
Namespace.setVariableValue(String, Object)
is that the latter sets variable
directly from its namespace while this one does resolution of namespace and calls
Namespace.setVariableValue(String, Object)
on the resolved namespace.
Known issue: The name parameter should be unescaped name. The method may not work correctly if the variable name is a full name (i.e. with module prefix) and contains special characters.
setVariableValue
in interface ExecutionContext
name
- a variable namevalue
- a new variable value@Deprecated public Namespace resolveVariableNamespace(String name)
ExecutionContext
The resolution goes primarily into parents, if it fails then it looks in the imports.
The resolution throws IllegalArgumentException
if the variable is not found
or the name is ambiguous.
Known issue: The name parameter should be unescaped name. The method may not work correctly if the variable name is a full name (i.e. with module prefix) and contains special characters.
resolveVariableNamespace
in interface ExecutionContext
name
- variable namepublic void addSignal(Object signal)
ExecutionContext
addSignal
in interface ExecutionContext
public com.whitestein.lsps.model.ContextModelElement getModelElement()
ExecutionContext
getModelElement
in interface ExecutionContext
public long getContextId()
ExecutionContext
getContextId
in interface ExecutionContext
public ExecutionContext getParentContext()
ExecutionContext
getParentContext
in interface ExecutionContext
public Handle getHandle(ValueHolder valueHolder)
HandleResolver
HandleResolver.getValueHolder(Handle)
.getHandle
in interface HandleResolver
valueHolder
- the value-holderpublic ValueHolder getValueHolder(Handle handle)
HandleResolver
getValueHolder
in interface HandleResolver
handle
- the handlepublic String getPath()
ExecutionContext
getPath
in interface ExecutionContext
public QID getPathQID()
ExecutionContext
getPathQID
in interface ExecutionContext
public String getProcessPath()
ExecutionContext
getProcessPath
in interface ExecutionContext
public QID getProcessPathQID()
ExecutionContext
getProcessPathQID
in interface ExecutionContext
public ModelInstance getModelInstance()
ExecutionContext
getModelInstance
in interface ExecutionContext
public ProcessInstance getProcessInstance()
ExecutionContext
getProcessInstance
in interface ExecutionContext
public com.whitestein.lsps.model.ProcessModel getProcessModel()
ExecutionContext
getProcessModel
in interface ExecutionContext
public void flushAll()
ExecutionContext
flushAll
in interface ExecutionContext
public String getEvaluationLevel()
ExecutionContext
getEvaluationLevel
in interface ExecutionContext
public void addExecutionTraceElement(ExecutionTraceElement e)
TraceableExecution
ExecutionTrace
and
ExecutionTraceElement
.addExecutionTraceElement
in interface TraceableExecution
e
- ExecutionTraceElement to be added.public void addExecutionTrace(ExecutionTrace et)
TraceableExecution
ExecutionTrace
and
ExecutionTraceElement
.addExecutionTrace
in interface TraceableExecution
et
- ExecutionTrace to be added.public ExecutionTrace getExecutionTrace()
getExecutionTrace
in interface TraceableExecution
ExecutionTrace
and
ExecutionTraceElement
.public CompiledContext getCompiled()
ExecutionContext
getCompiled
in interface ExecutionContext
public void setCompiled(CompiledContext compiledContext)
ExecutionContext
setCompiled
in interface ExecutionContext
public CompiledContext getCompiled(String moduleName)
ExecutionContext
getCompiled
in interface ExecutionContext
public ModelProvider getModelProvider()
ExecutionContext
getModelProvider
in interface ExecutionContext
public ComponentService getComponentService()
ExecutionContext
getComponentService
in interface ExecutionContext
public RuntimeToPersistentConverter getConverter()
ExecutionContext
getConverter
in interface ExecutionContext
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.