public class Script extends Object implements DescriptionObject
| Constructor and Description |
|---|
Script()
Constructor for castor unmarshall
|
Script(String lang,
AgentProxy agent,
PrintStream out)
For consoles
|
Script(String name,
Integer version,
ItemPath path,
String xml)
For testing.
|
Script(String lang,
String expr)
Creates a script executor for the supplied expression, bypassing the xml parsing bit
Output class is forced to an object.
|
Script(String lang,
String expr,
Class<?> returnType)
Creates a script executor for the supplied expression, bypassing the xml parsing bit
|
Script(String lang,
String name,
String expr,
AgentProxy agent)
Creates a script executor requiring an agent to be set.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addIncludedInputParam(String name,
Class<?> type) |
protected void |
addInputParam(String name,
Class<?> type) |
protected void |
addInputParam(String name,
String type) |
protected void |
addOutput(String name,
Class<?> type) |
protected void |
addOutput(String name,
String type) |
Object |
evaluate(ItemPath itemPath,
CastorHashMap inputProps,
String actContext,
boolean actExecEnv,
Object locker)
Reads and evaluates input properties, set input parameters from those properties and executes the Script
|
Object |
evaluate(ItemPath itemPath,
CastorHashMap inputProps,
String actContext,
Object locker) |
Object |
execute()
Executes the script with the submitted parameters.
|
void |
export(Writer imports,
File dir,
boolean shallow) |
ScriptContext |
getContext() |
ArrayList<Include> |
getIncludes()
Method for castor marshall
|
String |
getItemID() |
static Script |
getScript(String name,
Integer version)
Resolves the Script object using its name and version.
|
String |
getScriptData() |
static void |
main(String[] args) |
CollectionArrayList |
makeDescCollections() |
void |
setContext(ScriptContext context) |
void |
setIncludes(ArrayList<Include> includes)
Method for castor unmarshall
|
boolean |
setInputParamValue(String name,
Object value)
Submits an input parameter to the script.
|
void |
setScriptData(String script) |
void |
setScriptEngine(String requestedLang)
Sets the language
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetItemPath, getName, getVersion, setItemPath, setName, setVersionpublic Script()
public Script(String name, Integer version, ItemPath path, String xml) throws ScriptParsingException, ParameterException
public Script(String lang, String expr, Class<?> returnType) throws ScriptingEngineException
lang - - script languageexpr - - the script to runreturnType - Class of the return of the ScriptScriptingEngineExceptionpublic Script(String lang, String name, String expr, AgentProxy agent) throws ScriptingEngineException
lang - - script languagename - - script name for debuggingexpr - - the script to runagent - - the agentproxy to pass into the script as 'agent'ScriptingEngineExceptionpublic Script(String lang, String expr) throws ScriptingEngineException
lang - - script languageexpr - - the script to runScriptingEngineExceptionpublic Script(String lang, AgentProxy agent, PrintStream out) throws Exception
lang - - script languageagent - - Proxy of the console Agent(user)out - - the output PrintStream for reporting results that don't go to the logExceptionpublic void setScriptEngine(String requestedLang) throws ScriptingEngineException
requestedLang - the languageScriptingEngineExceptionpublic void setContext(ScriptContext context)
context - ScriptContextpublic ScriptContext getContext()
ScriptContextprotected void addInputParam(String name, String type) throws ParameterException
name - type - ParameterExceptionprotected void addInputParam(String name, Class<?> type) throws ParameterException
ParameterExceptionprotected void addIncludedInputParam(String name, Class<?> type) throws ParameterException
name - type - ParameterExceptionprotected void addOutput(String name, String type) throws ParameterException
name - type - ParameterExceptionprotected void addOutput(String name, Class<?> type) throws ParameterException
name - type - ParameterExceptionpublic boolean setInputParamValue(String name, Object value) throws ParameterException
name - - input parameter name from the script xmlvalue - - object to use for this parameterParameterException - - name not found or wrong typepublic Object evaluate(ItemPath itemPath, CastorHashMap inputProps, String actContext, Object locker) throws ScriptingEngineException
itemPath - inputProps - actContext - locker - ScriptingEngineExceptionpublic Object evaluate(ItemPath itemPath, CastorHashMap inputProps, String actContext, boolean actExecEnv, Object locker) throws ScriptingEngineException
itemPath - the Item contextinputProps - imput propertiesactContext - activity pathlocker - transaction lockerScriptingEngineExceptionpublic Object execute() throws ScriptingEngineException
ScriptingEngineException - - input parameters weren't set, there was an error executing the script, or the output was invalidpublic void setScriptData(String script) throws ScriptParsingException
ScriptParsingExceptionpublic String getScriptData()
public String getItemID()
getItemID in interface DescriptionObjectpublic static Script getScript(String name, Integer version) throws ScriptingEngineException, ObjectNotFoundException, InvalidDataException
name - the name of the Script Item or an expressionversion - the version of the Script. If set to nullScriptScriptingEngineExceptionObjectNotFoundExceptionInvalidDataExceptionBuiltInVertexProperties.ROUTING_EXPRpublic ArrayList<Include> getIncludes()
public void setIncludes(ArrayList<Include> includes) throws ObjectNotFoundException, InvalidDataException, ParameterException, ScriptParsingException
includes - included ScriptsObjectNotFoundExceptionInvalidDataExceptionParameterExceptionScriptParsingExceptionpublic CollectionArrayList makeDescCollections() throws InvalidDataException, ObjectNotFoundException
makeDescCollections in interface DescriptionObjectInvalidDataExceptionObjectNotFoundExceptionpublic void export(Writer imports, File dir, boolean shallow) throws IOException
export in interface DescriptionObjectIOExceptionpublic static void main(String[] args)
Copyright © 1997–2019 CRISTAL-iSE. All rights reserved.