Class Script

java.lang.Object
org.eclipse.ease.Script

public class Script
extends Object
Scriptable object. Consists of scriptable data and a result container.
  • Constructor Details

    • Script

      public Script​(String title, Object command, boolean isShell)
      Constructor.
      Parameters:
      title - name of script object
      command - command (sequence) to be executed
      isShell - true if the script originated from a shell/interactive session
    • Script

      public Script​(String title, Object command)
      Constructor.
      Parameters:
      title - name of script object
      command - command (sequence) to be executed
    • Script

      public Script​(Object command)
      Constructor. Using no title for this script
      Parameters:
      command - command (sequence) to be executed
  • Method Details

    • getCodeStream

      public InputStream getCodeStream() throws Exception
      Get the scriptable data as InputStream. The caller needs to close the stream when it is not used anymore. Calling this method multiple times will return different streams with the same text content.
      Returns:
      scriptable data
      Throws:
      Exception - when stream cannot be established
    • getCode

      public String getCode() throws Exception
      Get the scriptable data as String.
      Returns:
      scriptable data
      Throws:
      Exception - when code cannot be read from source
    • getCommand

      public final Object getCommand()
      Returns the command object of this script.
      Returns:
      command object
    • getResult

      public final ScriptResult getResult()
      Get execution result.
      Returns:
      execution result.
    • setResult

      public final void setResult​(Object result)
      Set the execution result.
      Parameters:
      result - execution result
    • setException

      public final void setException​(ScriptExecutionException e)
      Set an execution exception.
      Parameters:
      e - exception
    • getFile

      public Object getFile()
      Returns the file instance, if the current command is backed by a file.
      Returns:
      IFile, File or null
    • isDynamic

      public boolean isDynamic()
      Check if this script is defined by dynamically generated code. Generated code might be hidden while debugging.
      Returns:
      true when not a file and not an URL
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTitle

      public String getTitle()
      Get the title of this script. Title has to be set by the caller via the constructor. Typically this is used for dynamic code to indicate its purpose. If no title is set we try to extract the name of the executed resource.
      Returns:
      script title or null
    • isShellMode

      public boolean isShellMode()
      Script originated from interactive input or shell, as opposed to a source file. A script engine may decide to process a script originating in the shell differently than one originating in a source file.
      Returns:
      true origin is interactive input or shell, or false if origin is a source file.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object obj)
      Overrides:
      equals in class Object