Package com.illumon.iris.db.util
Class InteractiveConsoleQuerySession
java.lang.Object
com.illumon.iris.db.util.InteractiveConsoleQuerySession
- All Implemented Interfaces:
ScriptSession
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInteractiveConsoleQuerySession
(ScriptSession wrappedSession, boolean isPrimarySession, boolean isViewOnly) -
Method Summary
Modifier and TypeMethodDescriptionstatic int
activeClientCount
(long terminationDelay) void
Removes the currently configured script path loader from this script.void
Evaluates command in the context of the current ScriptSession.void
Evaluates command in the context of the current ScriptSession.getVariable
(String name) Retrieve a variable from the script session's bindings.<T> T
getVariable
(String name, T defaultValue) Retrieve a variable from the script session's bindings.Retrieves all of the variable names present in the session's scopeRetrieves all of the variables present in the session's scope (e.g., Groovy binding, Python globals()).boolean
hasVariableName
(String name) Check if the scope has the given variable namestatic boolean
heartbeat
(ExportedObjectClient client) boolean
Identifies if the session is an interactive/shared console which allows multiple clients to share a single query-scopevoid
onPersistentQueryInitializationBegin
(Supplier<ScriptPathLoader> pathLoader, ScriptPathLoaderState scriptLoaderState) Called before PersistentQuery initialization, should setup sourcing from the controller (as required).void
Called after PersistentQuery initialization.static int
void
setScriptPathLoader
(Supplier<ScriptPathLoader> scriptPathLoader, boolean caching) Sets the scriptPathLoader that is in use for this session.boolean
setUseOriginalScriptLoaderState
(boolean useOriginal) Informs the session whether or not we should be using the original ScriptLoaderState for source commands.void
setVariable
(String name, Object value) Inserts a value into the script's scope.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.util.ScriptSession
sanitizeThrowable
-
Field Details
-
INTERACTIVE_CONSOLE_QUERY_ATTACHMENT_RESULTS
-
HEARTBEAT_INTERVAL
public static long HEARTBEAT_INTERVAL -
HEARTBEAT_POLL_INTERVAL
public static long HEARTBEAT_POLL_INTERVAL -
TERMINATION_DELAY
public static long TERMINATION_DELAY
-
-
Constructor Details
-
InteractiveConsoleQuerySession
public InteractiveConsoleQuerySession(ScriptSession wrappedSession, boolean isPrimarySession, boolean isViewOnly)
-
-
Method Details
-
getVariable
Description copied from interface:ScriptSession
Retrieve a variable from the script session's bindings.- Specified by:
getVariable
in interfaceScriptSession
- Parameters:
name
- the variable to retrieve- Returns:
- the variable
- Throws:
QueryScope.MissingVariableException
- if the variable does not exist
-
getVariable
Description copied from interface:ScriptSession
Retrieve a variable from the script session's bindings. If the variable is not present, return defaultValue. If the variable is present, but is not of type (T), a ClassCastException may result.- Specified by:
getVariable
in interfaceScriptSession
- Type Parameters:
T
- the type of the variable- Parameters:
name
- the variable to retrievedefaultValue
- the value to use when no value is present in the session's scope- Returns:
- the value of the variable, or defaultValue if not present
-
evaluate
Description copied from interface:ScriptSession
Evaluates command in the context of the current ScriptSession.- Specified by:
evaluate
in interfaceScriptSession
- Parameters:
command
- the command to evaluate
-
evaluate
Description copied from interface:ScriptSession
Evaluates command in the context of the current ScriptSession.- Specified by:
evaluate
in interfaceScriptSession
- Parameters:
command
- the command to evaluatescriptName
- an optional script name, which may be ignored by the implementation, or used improve error messages or for other internal purposes
-
getVariables
Description copied from interface:ScriptSession
Retrieves all of the variables present in the session's scope (e.g., Groovy binding, Python globals()).- Specified by:
getVariables
in interfaceScriptSession
- Returns:
- an unmodifiable map with variable names as the keys, and the Objects as the result
-
getVariableNames
Description copied from interface:ScriptSession
Retrieves all of the variable names present in the session's scope- Specified by:
getVariableNames
in interfaceScriptSession
- Returns:
- an unmodifiable set of variable names
-
hasVariableName
Description copied from interface:ScriptSession
Check if the scope has the given variable name- Specified by:
hasVariableName
in interfaceScriptSession
- Parameters:
name
- the variable name- Returns:
- True iff the scope has the given variable name
-
setVariable
Description copied from interface:ScriptSession
Inserts a value into the script's scope.- Specified by:
setVariable
in interfaceScriptSession
- Parameters:
name
- the variable name to setvalue
- the new value of the variable
-
scriptType
- Specified by:
scriptType
in interfaceScriptSession
- Returns:
- a textual description of this script session's language for use in messages.
-
onPersistentQueryInitializationBegin
public void onPersistentQueryInitializationBegin(Supplier<ScriptPathLoader> pathLoader, ScriptPathLoaderState scriptLoaderState) Description copied from interface:ScriptSession
Called before PersistentQuery initialization, should setup sourcing from the controller (as required).- Specified by:
onPersistentQueryInitializationBegin
in interfaceScriptSession
-
onPersistentQueryInitializationEnd
public void onPersistentQueryInitializationEnd()Description copied from interface:ScriptSession
Called after PersistentQuery initialization.- Specified by:
onPersistentQueryInitializationEnd
in interfaceScriptSession
-
setScriptPathLoader
Description copied from interface:ScriptSession
Sets the scriptPathLoader that is in use for this session.- Specified by:
setScriptPathLoader
in interfaceScriptSession
- Parameters:
scriptPathLoader
- a supplier of a script path loadercaching
- whether the source operation should cache results
-
clearScriptPathLoader
public void clearScriptPathLoader()Description copied from interface:ScriptSession
Removes the currently configured script path loader from this script.- Specified by:
clearScriptPathLoader
in interfaceScriptSession
-
setUseOriginalScriptLoaderState
public boolean setUseOriginalScriptLoaderState(boolean useOriginal) Description copied from interface:ScriptSession
Informs the session whether or not we should be using the original ScriptLoaderState for source commands.- Specified by:
setUseOriginalScriptLoaderState
in interfaceScriptSession
- Parameters:
useOriginal
- whether to use the script loader state at persistent query initialization
-
isInteractiveConsoleSession
public boolean isInteractiveConsoleSession()Description copied from interface:ScriptSession
Identifies if the session is an interactive/shared console which allows multiple clients to share a single query-scope- Specified by:
isInteractiveConsoleSession
in interfaceScriptSession
- Returns:
- true if the session is an interactive console
-
getWrappedSession
- Specified by:
getWrappedSession
in interfaceScriptSession
-
heartbeat
-
activeClientCount
public static int activeClientCount(long terminationDelay) -
removeActiveClient
-