public class Script extends Object implements DescriptionObject
| Constructor and Description |
|---|
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) |
Script(String lang,
String expr,
Class<?> returnType)
Creates a script executor for the supplied expression, bypassing the xml parsing bit
Output class is forced to an object.
|
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 |
execute()
Executes the script with the submitted parameters.
|
void |
export(Writer imports,
File dir) |
HashMap<String,Parameter> |
getAllInputParams()
Gets all declared parameters, including those of imported scripts
|
ScriptContext |
getContext() |
HashMap<String,Parameter> |
getInputParams()
Gets all declared parameters
|
String |
getItemID() |
ItemPath |
getItemPath() |
String |
getName() |
String |
getScriptData() |
Integer |
getVersion() |
static void |
main(String[] args) |
CollectionArrayList |
makeDescCollections() |
void |
setActExecEnvironment(ItemProxy object,
AgentProxy subject,
Job job) |
void |
setContext(ScriptContext context) |
boolean |
setInputParamValue(String name,
Object value)
Submits an input parameter to the script.
|
void |
setItemPath(ItemPath path) |
void |
setName(String name) |
void |
setScriptData(String script) |
void |
setScriptEngine(String requestedLang) |
void |
setVersion(Integer version) |
public static final String INCLCOLL
public Script(String name, Integer version, ItemPath path, String xml) throws ScriptParsingException, ParameterException
xml - ScriptParsingExceptionParameterExceptionpublic Script(String lang, String expr, Class<?> returnType) throws ScriptingEngineException
ScriptingEngineExceptionpublic 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
ScriptingEngineExceptionpublic Script(String lang, AgentProxy agent, PrintStream out) throws Exception
lang - - script languageagent - - AgentProxy of the console userout - - the output PrintStream for reporting results that don't go to the logExceptionpublic void setActExecEnvironment(ItemProxy object, AgentProxy subject, Job job) throws ScriptingEngineException, InvalidDataException
public void setScriptEngine(String requestedLang) throws ScriptingEngineException
ScriptingEngineExceptionpublic void setContext(ScriptContext context)
public ScriptContext getContext()
protected void addInputParam(String name, String type) throws ParameterException
ParameterExceptionprotected void addInputParam(String name, Class<?> type) throws ParameterException
ParameterExceptionprotected void addIncludedInputParam(String name, Class<?> type) throws ParameterException
ParameterExceptionprotected void addOutput(String name, String type) throws ParameterException
ParameterExceptionprotected void addOutput(String name, Class<?> type) throws ParameterException
ParameterExceptionpublic HashMap<String,Parameter> getInputParams()
Parameterpublic HashMap<String,Parameter> getAllInputParams()
Parameterpublic 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 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 getName()
getName in interface DescriptionObjectpublic Integer getVersion()
getVersion in interface DescriptionObjectpublic ItemPath getItemPath()
getItemPath in interface DescriptionObjectpublic String getItemID()
getItemID in interface DescriptionObjectpublic void setName(String name)
setName in interface DescriptionObjectpublic void setVersion(Integer version)
setVersion in interface DescriptionObjectpublic void setItemPath(ItemPath path)
setItemPath in interface DescriptionObjectpublic CollectionArrayList makeDescCollections() throws InvalidDataException, ObjectNotFoundException
makeDescCollections in interface DescriptionObjectInvalidDataExceptionObjectNotFoundExceptionpublic void export(Writer imports, File dir) throws IOException
export in interface DescriptionObjectIOExceptionpublic static void main(String[] args)
Copyright © 1997–2016 CRISTAL-iSE. All rights reserved.