Interface ScriptSession

All Superinterfaces:
LivenessManager, LivenessNode, LivenessReferent
All Known Implementing Classes:
AbstractScriptSession, DelegatingScriptSession, GroovyDeephavenSession, NoLanguageDeephavenSession, PythonDeephavenSession

public interface ScriptSession extends LivenessNode
Interface for interactive console script sessions.
  • Method Details

    • getQueryScope

      QueryScope getQueryScope()
      Provides access to the query scope defined by the state in this script session.
      Returns:
      an implementation defined QueryScope, allowing access to state in the script session
    • getExecutionContext

      ExecutionContext getExecutionContext()
      Obtain an ExecutionContext instance for the current script session. This is the execution context that is used when executing scripts.
    • observeScopeChanges

      void observeScopeChanges()
      Observe (and report via onScopeChanges) any changes to this ScriptSession's QueryScope that may have been made externally, rather than during script evaluation.
      ApiNote:
      This method should be regarded as an unstable API
    • evaluateScript

      default ScriptSession.Changes evaluateScript(String script)
      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.
      Parameters:
      script - the code to execute
      Returns:
      the changes made to the exportable objects
    • evaluateScript

      ScriptSession.Changes evaluateScript(String script, @Nullable @Nullable String scriptName)
      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.
      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

      ScriptSession.Changes evaluateScript(Path scriptPath)
      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.
      Parameters:
      scriptPath - the path to the script to execute
      Returns:
      the changes made to the exportable objects
    • scriptType

      String scriptType()
      Returns:
      a textual description of this script session's language for use in messages.
    • sanitizeThrowable

      default Throwable sanitizeThrowable(Throwable e)
      If this script session can throw unserializable exceptions, this method is responsible for turning those exceptions into something suitable for sending back to a client.
      Parameters:
      e - the exception to (possibly) sanitize
      Returns:
      the sanitized exception
    • unwrapObject

      default Object unwrapObject(@Nullable @Nullable Object object)
      Asks the session to remove any wrapping that exists on scoped objects so that clients can fetch them. Defaults to returning the object itself.
      Parameters:
      object - the scoped object
      Returns:
      an obj which can be consumed by a client