Class DelegatingScriptSession

java.lang.Object
io.deephaven.engine.util.DelegatingScriptSession
All Implemented Interfaces:
LivenessManager, LivenessNode, LivenessReferent, ScriptSession

public class DelegatingScriptSession extends Object implements ScriptSession
The delegating script session delegates all calls to another script session. When evaluating a script it massages the Changes to the QueryScope so that any modifications that are being seen for the first time by the api-client come across as new entries and not as modified entries.
  • Constructor Details

    • DelegatingScriptSession

      public DelegatingScriptSession(ScriptSession delegate)
  • Method Details

    • getExecutionContext

      public ExecutionContext getExecutionContext()
      Description copied from interface: ScriptSession
      Obtain an ExecutionContext instance for the current script session. This is the execution context that is used when executing scripts.
      Specified by:
      getExecutionContext in interface ScriptSession
    • observeScopeChanges

      public void observeScopeChanges()
      Description copied from interface: ScriptSession
      Observe (and report via onScopeChanges) any changes to this ScriptSession's QueryScope that may have been made externally, rather than during script evaluation.
      Specified by:
      observeScopeChanges in interface ScriptSession
    • getQueryScope

      public QueryScope getQueryScope()
      Description copied from interface: ScriptSession
      Provides access to the query scope defined by the state in this script session.
      Specified by:
      getQueryScope in interface ScriptSession
      Returns:
      an implementation defined QueryScope, allowing access to state in the script session
    • evaluateScript

      public ScriptSession.Changes evaluateScript(String script, @Nullable @Nullable String scriptName)
      Description copied from interface: ScriptSession
      Evaluates the script and manages liveness of objects that are exported to the user. This method should be called from the serial executor as it manipulates static state.
      Specified by:
      evaluateScript in interface ScriptSession
      Parameters:
      script - the code to execute
      scriptName - an optional script name, which may be ignored by the implementation, or used improve error messages or for other internal purposes
      Returns:
      the changes made to the exportable objects
    • evaluateScript

      public ScriptSession.Changes evaluateScript(Path scriptPath)
      Description copied from interface: ScriptSession
      Evaluates the script and manages liveness of objects that are exported to the user. This method should be called from the serial executor as it manipulates static state.
      Specified by:
      evaluateScript in interface ScriptSession
      Parameters:
      scriptPath - the path to the script to execute
      Returns:
      the changes made to the exportable objects
    • scriptType

      public String scriptType()
      Specified by:
      scriptType in interface ScriptSession
      Returns:
      a textual description of this script session's language for use in messages.
    • tryManage

      public boolean tryManage(@NotNull @NotNull LivenessReferent referent)
      Description copied from interface: LivenessManager
      Attempt to add referent to this manager. Will succeed if referent is live and if this manager is not a LivenessReferent or is live.
      Specified by:
      tryManage in interface LivenessManager
      Parameters:
      referent - The referent to add
      Returns:
      Whether the referent was in fact added
    • tryUnmanage

      public boolean tryUnmanage(@NotNull @NotNull LivenessReferent referent)
      Description copied from interface: LivenessNode
      If this node is still live and manages referent one or more times, drop one such reference.
      Specified by:
      tryUnmanage in interface LivenessNode
      Parameters:
      referent - The referent to drop
      Returns:
      Whether this node was live and thus in fact tried to drop a reference
    • tryUnmanage

      public boolean tryUnmanage(@NotNull @NotNull Stream<? extends LivenessReferent> referents)
      Description copied from interface: LivenessNode
      For each referent in referents, if this node is still live and manages referent one or more times, drop one such reference.
      Specified by:
      tryUnmanage in interface LivenessNode
      Parameters:
      referents - The referents to drop
      Returns:
      Whether this node was live and thus in fact tried to drop a reference
    • tryRetainReference

      public boolean tryRetainReference()
      Description copied from interface: LivenessReferent
      If this referent is "live", behave as LivenessReferent.retainReference() and return true. Otherwise, returns false rather than throwing an exception.
      Specified by:
      tryRetainReference in interface LivenessReferent
      Returns:
      True if this referent was retained, false otherwise
    • dropReference

      public void dropReference()
      Description copied from interface: LivenessReferent
      Drop a previously-retained reference to this referent.
      Specified by:
      dropReference in interface LivenessReferent
    • getWeakReference

      public WeakReference<? extends LivenessReferent> getWeakReference()
      Description copied from interface: LivenessReferent
      Get a WeakReference to this referent. This may be cached, or newly created.
      Specified by:
      getWeakReference in interface LivenessReferent
      Returns:
      A new or cached reference to this referent