Package org.eclipse.ease
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 Summary
-
Method Summary
Modifier and Type Method Description boolean
equals(Object obj)
String
getCode()
Get the scriptable data asString
.InputStream
getCodeStream()
Get the scriptable data asInputStream
.Object
getCommand()
Returns the command object of this script.Object
getFile()
Returns the file instance, if the current command is backed by a file.ScriptResult
getResult()
Get execution result.String
getTitle()
Get the title of this script.int
hashCode()
boolean
isDynamic()
Check if this script is defined by dynamically generated code.boolean
isShellMode()
Script originated from interactive input or shell, as opposed to a source file.void
setException(ScriptExecutionException e)
Set an execution exception.void
setResult(Object result)
Set the execution result.String
toString()
-
Constructor Details
-
Script
Constructor.- Parameters:
title
- name of script objectcommand
- command (sequence) to be executedisShell
-true
if the script originated from a shell/interactive session
-
Script
Constructor.- Parameters:
title
- name of script objectcommand
- command (sequence) to be executed
-
Script
Constructor. Using no title for this script- Parameters:
command
- command (sequence) to be executed
-
-
Method Details
-
getCodeStream
Get the scriptable data asInputStream
. 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:
IOException
- when stream cannot be established
-
getCode
Get the scriptable data asString
.- Returns:
- scriptable data
- Throws:
IOException
- when code cannot be read from source
-
getCommand
Returns the command object of this script.- Returns:
- command object
-
getResult
Get execution result.- Returns:
- execution result.
-
setResult
Set the execution result.- Parameters:
result
- execution result
-
setException
Set an execution exception.- Parameters:
e
- exception
-
getFile
Returns the file instance, if the current command is backed by a file.- Returns:
IFile
,File
ornull
-
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 anURL
-
toString
-
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, orfalse
if origin is a source file.
-
hashCode
public int hashCode() -
equals
-