Class ParameterSession
java.lang.Object
com.illumon.util.referencecounting.ReferenceCounted
com.illumon.iris.db.util.liveness.ReferenceCountedLivenessNode
com.illumon.iris.db.util.liveness.LivenessArtifact
io.deephaven.query.parameterized.impl.ParameterSession
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,LivenessManager,LivenessNode,LivenessReferent,ScriptSession,ParameterScope,Serializable
A self-contained "parallel universe" for
ParameterizedQuery instances
to operate within.
User provided methods must interact with one of these to retrieve parameters and assign computational results.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves the currently configured script path loader from this script.protected voiddestroy()Attempt to release (destructively when necessary) resources held by this object.voidEvaluates command in the context of the current ScriptSession.voidEvaluates command in the context of the current ScriptSession.fetchTableHistorical(Database database, String namespace, String tableName) Retrieve a historical table from within the willDo scope of a ParameterizedQuery.fetchTableIntraday(Database database, String namespace, String tableName) Retrieve an intraday table from within the willDo scope of a ParameterizedQuery.getAllResultNamesOf(Class<T> type) Retrieve all result names for the specified type.Convenience method to return the authenticated user of the UserContext directly.booleangetBoolean(String name) Get the named parameter as a booleangetDateTime(String name) Get the named parameter as aDBDateTimegetDateTimeSet(String name) Get the named parameter as an array ofDBDateTimesdoubleGet the named parameter as a doubledouble[]getDoubleSet(String name) Get the named parameter as an array of doublesConvenience method to return the effective user of the UserContext directly.longGet the named parameter as a longlong[]getLongSet(String name) Get the named parameter as an array of longsGets the PermissionFilterProvider associated with the user running the ParameterizedQuery.Get the named parameter as a StringString[]getStringSet(String name) Get the named parameter as an array of StringsGets the UserContext, which has the authenticated and effective user ids.getVariable(String name) Retrieve a variable from the script session's bindings.<T> TgetVariable(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()).booleanhasVariableName(String name) Check if the scope has the given variable namebooleanCheck if the specified parameter has been assigned a value.voidonPersistentQueryInitializationBegin(Supplier<ScriptPathLoader> pathLoader, ScriptPathLoaderState scriptLoaderState) Called before PersistentQuery initialization, should setup sourcing from the controller (as required).voidCalled after PersistentQuery initialization.voidsetPermissionFilterProvider(PermissionFilterProvider permissionFilterProvider) <T> voidSet the value of a named result.voidsetScriptPathLoader(Supplier<ScriptPathLoader> scriptPathLoader, boolean caching) Sets the scriptPathLoader that is in use for this session.booleansetUseOriginalScriptLoaderState(boolean useOriginal) Informs the session whether or not we should be using the original ScriptLoaderState for source commands.voidsetVariable(String name, Object value) Inserts a value into the script's scope.Methods inherited from class com.illumon.iris.db.util.liveness.LivenessArtifact
manageWithCurrentScope, unmanage, unmanageMethods inherited from class com.illumon.iris.db.util.liveness.ReferenceCountedLivenessNode
dropReference, getWeakReference, initializeTransientFieldsForLiveness, onReferenceCountAtZero, tryManage, tryRetainReferenceMethods inherited from class com.illumon.util.referencecounting.ReferenceCounted
append, decrementReferenceCount, incrementReferenceCount, resetReferenceCount, toString, tryDecrementReferenceCount, tryIncrementReferenceCountMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manageMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
getReferentDescription, retainReferenceMethods inherited from interface com.illumon.iris.db.util.ScriptSession
getWrappedSession, isInteractiveConsoleSession, sanitizeThrowable
-
Constructor Details
-
ParameterSession
-
-
Method Details
-
getLong
Description copied from interface:ParameterScopeGet the named parameter as a long- Specified by:
getLongin interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value of the named parameter as a long.
-
getLongSet
Description copied from interface:ParameterScopeGet the named parameter as an array of longs- Specified by:
getLongSetin interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value as an array of longs
-
getDouble
Description copied from interface:ParameterScopeGet the named parameter as a double- Specified by:
getDoublein interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value of the named parameter as a double.
-
getDoubleSet
Description copied from interface:ParameterScopeGet the named parameter as an array of doubles- Specified by:
getDoubleSetin interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value as an array of doubles
-
getString
Description copied from interface:ParameterScopeGet the named parameter as a String- Specified by:
getStringin interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value of the named parameter as an int.
-
getStringSet
Description copied from interface:ParameterScopeGet the named parameter as an array of Strings- Specified by:
getStringSetin interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value as an array of Strings
-
getDateTime
Description copied from interface:ParameterScopeGet the named parameter as aDBDateTime- Specified by:
getDateTimein interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value of the named parameter as a
DBDateTime.
-
getDateTimeSet
Description copied from interface:ParameterScopeGet the named parameter as an array ofDBDateTimes- Specified by:
getDateTimeSetin interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value as an array of
DBDateTimes
-
getBoolean
Description copied from interface:ParameterScopeGet the named parameter as a boolean- Specified by:
getBooleanin interfaceParameterScope- Parameters:
name- the name of the parameter- Returns:
- the value of the named parameter as an boolean.
-
isPresent
Description copied from interface:ParameterScopeCheck if the specified parameter has been assigned a value.- Specified by:
isPresentin interfaceParameterScope- Parameters:
name- the parameter name- Returns:
- true if the parameter has been given a value, false otherwise.
-
getPermissionFilterProvider
Description copied from interface:ParameterScopeGets the PermissionFilterProvider associated with the user running the ParameterizedQuery.- Specified by:
getPermissionFilterProviderin interfaceParameterScope- Returns:
- The PermissionFilterProvider.
-
getUserContext
Description copied from interface:ParameterScopeGets the UserContext, which has the authenticated and effective user ids.- Specified by:
getUserContextin interfaceParameterScope- Returns:
- UserContext for the parameterized query.
-
getAuthenticatedUser
Description copied from interface:ParameterScopeConvenience method to return the authenticated user of the UserContext directly.- Specified by:
getAuthenticatedUserin interfaceParameterScope- Returns:
- The authenticated user
-
getEffectiveUser
Description copied from interface:ParameterScopeConvenience method to return the effective user of the UserContext directly.- Specified by:
getEffectiveUserin interfaceParameterScope- Returns:
- The authenticated user
-
fetchTableIntraday
Description copied from interface:ParameterScopeRetrieve an intraday table from within the willDo scope of a ParameterizedQuery. The table is retrieved from the underlying data store with the UserContext of the query’s owner. After the owner’s row and column ACL application, the executing user’s context are applied. This results in the resulting table having only data that both the query’s owner and the executing user may see.- Specified by:
fetchTableIntradayin interfaceParameterScope- Parameters:
database- The database of a Deephaven console session, exposed asdb.namespace- The namespace of the table to be retrieved.tableName- The name of the table to be retrieved.- Returns:
- The intraday table subject to ACL constraints described above.
-
fetchTableHistorical
Description copied from interface:ParameterScopeRetrieve a historical table from within the willDo scope of a ParameterizedQuery. The table is retrieved from the underlying data store with the UserContext of the query’s owner. After the owner’s row and column ACL application, the executing user’s context are applied. This results in the resulting table having only data that both the query’s owner and the executing user may see.- Specified by:
fetchTableHistoricalin interfaceParameterScope- Parameters:
database- The database of a Deephaven console session, exposed asdb.namespace- The namespace of the table to be retrieved.tableName- The name of the table to be retrieved.- Returns:
- The historical table subject to ACL constraints described above.
-
setResult
Set the value of a named result. These may not overwrite parameter values- Specified by:
setResultin interfaceParameterScope- Type Parameters:
T- the type.- Parameters:
name- the name of the resultvalue- the value to set it to.
-
getAllResultNamesOf
Retrieve all result names for the specified type.- Type Parameters:
T- the type parameter to cast back to- Parameters:
type- the type- Returns:
- a list of all of the result names of the specified type.
-
destroy
protected void destroy()Description copied from class:ReferenceCountedLivenessNodeAttempt to release (destructively when necessary) resources held by this object. This may render the object unusable for subsequent operations. Implementations should be sure to call super.destroy().
This is intended to only ever be used as a side effect of decreasing the reference count to 0.
- Overrides:
destroyin classReferenceCountedLivenessNode
-
getVariable
Description copied from interface:ScriptSessionRetrieve a variable from the script session's bindings.- Specified by:
getVariablein interfaceScriptSession- Parameters:
name- the variable to retrieve- Returns:
- the variable
- Throws:
QueryScope.MissingVariableException- if the variable does not exist
-
getVariable
Description copied from interface:ScriptSessionRetrieve 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:
getVariablein 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:ScriptSessionEvaluates command in the context of the current ScriptSession.- Specified by:
evaluatein interfaceScriptSession- Parameters:
command- the command to evaluate
-
evaluate
Description copied from interface:ScriptSessionEvaluates command in the context of the current ScriptSession.- Specified by:
evaluatein 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:ScriptSessionRetrieves all of the variables present in the session's scope (e.g., Groovy binding, Python globals()).- Specified by:
getVariablesin interfaceScriptSession- Returns:
- an unmodifiable map with variable names as the keys, and the Objects as the result
-
getVariableNames
Description copied from interface:ScriptSessionRetrieves all of the variable names present in the session's scope- Specified by:
getVariableNamesin interfaceScriptSession- Returns:
- an unmodifiable set of variable names
-
hasVariableName
Description copied from interface:ScriptSessionCheck if the scope has the given variable name- Specified by:
hasVariableNamein interfaceScriptSession- Parameters:
name- the variable name- Returns:
- True iff the scope has the given variable name
-
setVariable
Description copied from interface:ScriptSessionInserts a value into the script's scope.- Specified by:
setVariablein interfaceScriptSession- Parameters:
name- the variable name to setvalue- the new value of the variable
-
scriptType
- Specified by:
scriptTypein 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:ScriptSessionCalled before PersistentQuery initialization, should setup sourcing from the controller (as required).- Specified by:
onPersistentQueryInitializationBeginin interfaceScriptSession
-
onPersistentQueryInitializationEnd
public void onPersistentQueryInitializationEnd()Description copied from interface:ScriptSessionCalled after PersistentQuery initialization.- Specified by:
onPersistentQueryInitializationEndin interfaceScriptSession
-
setScriptPathLoader
Description copied from interface:ScriptSessionSets the scriptPathLoader that is in use for this session.- Specified by:
setScriptPathLoaderin 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:ScriptSessionRemoves the currently configured script path loader from this script.- Specified by:
clearScriptPathLoaderin interfaceScriptSession
-
setUseOriginalScriptLoaderState
public boolean setUseOriginalScriptLoaderState(boolean useOriginal) Description copied from interface:ScriptSessionInforms the session whether or not we should be using the original ScriptLoaderState for source commands.- Specified by:
setUseOriginalScriptLoaderStatein interfaceScriptSession- Parameters:
useOriginal- whether to use the script loader state at persistent query initialization
-
setPermissionFilterProvider
-