Class OBasicCommandContext
java.lang.Object
com.orientechnologies.orient.core.command.OBasicCommandContext
- All Implemented Interfaces:
OCommandContext
- Direct Known Subclasses:
OBasicServerCommandContext,OETLContext
Basic implementation of OCommandContext interface that stores variables in a map. Supports
parent/child context to build a tree of contexts. If a variable is not found on current object
the search is applied recursively on child contexts.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.command.OCommandContext
OCommandContext.TIMEOUT_STRATEGY -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OCommandContextprotected ODatabaseSessionstatic final Stringstatic final Stringprotected OCommandContextprotected booleanprotected AtomicLongstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginExecution(long iTimeout, OCommandContext.TIMEOUT_STRATEGY iStrategy) booleanCheck if timeout is elapsed, if defined.copy()Creates a copy of execution context.voiddeclareScriptVariable(String varName) voidvoidgetLocalVariable(String name) returns the number of results processed.getSimpleVariable(String name) getVariable(String iName) getVariable(String iName, Object iDefault) protected ObjectgetVariableFromParentHierarchy(String varName) Returns a read-only map with all the variables.booleanhasLocalVariable(String name) incrementVariable(String iName) booleanbooleanbooleanisScriptVariableDeclared(String varName) voidmerge(OCommandContext iContext) Merges a context with current one.voidsetArrayParameters(Object[] args) setChild(OCommandContext iContext) Set the inherited context avoiding to copy all the values every time.voidsetCurrent(OResult result) voidsetCurrentIfMissing(OResult result) voidsetDatabase(ODatabaseSession database) setDynamicVariable(String iName, ODynamicVariable iValue) voidsetInputParameters(Map<Object, Object> inputParameters) voidsetLocalVariable(String name, Object value) setParent(OCommandContext iParentContext) setParentWithoutOverridingChild(OCommandContext iParentContext) setRecordingMetrics(boolean recordMetrics) setVariable(String iName, Object iValue) voidtoString()longupdateMetric(String iName, long iValue) Updates a counter.voidupdateProfilerIndex(List<OIndexStreamStat> stats)
-
Field Details
-
EXECUTION_BEGUN
- See Also:
-
TIMEOUT_MS
- See Also:
-
TIMEOUT_STRATEGY
- See Also:
-
INVALID_COMPARE_COUNT
- See Also:
-
database
-
recordMetrics
protected boolean recordMetrics -
parent
-
child
-
variables
-
inputParameters
-
declaredScriptVariables
-
resultsProcessed
-
-
Constructor Details
-
OBasicCommandContext
public OBasicCommandContext() -
OBasicCommandContext
-
-
Method Details
-
getCurrent
- Specified by:
getCurrentin interfaceOCommandContext
-
setCurrentIfMissing
- Specified by:
setCurrentIfMissingin interfaceOCommandContext
-
setCurrent
- Specified by:
setCurrentin interfaceOCommandContext
-
getVariable
- Specified by:
getVariablein interfaceOCommandContext
-
getVariable
- Specified by:
getVariablein interfaceOCommandContext
-
getVariableFromParentHierarchy
-
setDynamicVariable
-
setVariable
- Specified by:
setVariablein interfaceOCommandContext
-
getLocalVariable
-
setLocalVariable
-
hasLocalVariable
-
getSimpleVariable
-
incrementVariable
- Specified by:
incrementVariablein interfaceOCommandContext
-
updateMetric
Description copied from interface:OCommandContextUpdates a counter. Used to record metrics.- Specified by:
updateMetricin interfaceOCommandContext- Parameters:
iName- Metric's nameiValue- delta to add or subtract- Returns:
-
getVariables
Returns a read-only map with all the variables.- Specified by:
getVariablesin interfaceOCommandContext
-
setChild
Set the inherited context avoiding to copy all the values every time.- Specified by:
setChildin interfaceOCommandContext- Returns:
-
getParent
- Specified by:
getParentin interfaceOCommandContext
-
setParent
- Specified by:
setParentin interfaceOCommandContext
-
setParentWithoutOverridingChild
-
toString
-
isRecordingMetrics
public boolean isRecordingMetrics()- Specified by:
isRecordingMetricsin interfaceOCommandContext
-
setRecordingMetrics
- Specified by:
setRecordingMetricsin interfaceOCommandContext
-
beginExecution
- Specified by:
beginExecutionin interfaceOCommandContext
-
checkTimeout
public boolean checkTimeout()Description copied from interface:OCommandContextCheck if timeout is elapsed, if defined.- Specified by:
checkTimeoutin interfaceOCommandContext- Returns:
- false if it the timeout is elapsed and strategy is "return"
-
copy
Description copied from interface:OCommandContextCreates a copy of execution context.- Specified by:
copyin interfaceOCommandContext
-
merge
Description copied from interface:OCommandContextMerges a context with current one.- Specified by:
mergein interfaceOCommandContext
-
getInputParameters
- Specified by:
getInputParametersin interfaceOCommandContext
-
setInputParameters
- Specified by:
setInputParametersin interfaceOCommandContext
-
setArrayParameters
-
getResultsProcessed
returns the number of results processed. This is intended to be used with LIMIT in SQL statements- Returns:
-
getDatabase
- Specified by:
getDatabasein interfaceOCommandContext
-
setDatabase
-
declareScriptVariable
- Specified by:
declareScriptVariablein interfaceOCommandContext
-
isScriptVariableDeclared
- Specified by:
isScriptVariableDeclaredin interfaceOCommandContext
-
startProfiling
- Specified by:
startProfilingin interfaceOCommandContext
-
endProfiling
- Specified by:
endProfilingin interfaceOCommandContext
-
getStats
- Specified by:
getStatsin interfaceOCommandContext
-
updateProfilerIndex
-
enableProfiling
public void enableProfiling() -
isProfiling
public boolean isProfiling()- Specified by:
isProfilingin interfaceOCommandContext
-