diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2013-02-27 22:25:58 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2013-02-27 22:25:58 +0100 |
| commit | ba1d538b588dc57066213a94803584ea9016e1e7 (patch) | |
| tree | ef5cb41e8eeda495c819b3afcbf92ae464991768 /src/main/java/com/c2kernel | |
| parent | efb8494445128c827ff5182f5ef4732a73b3ea0d (diff) | |
Script testing and resulting fixes
Diffstat (limited to 'src/main/java/com/c2kernel')
| -rw-r--r-- | src/main/java/com/c2kernel/scripting/Script.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/com/c2kernel/scripting/Script.java b/src/main/java/com/c2kernel/scripting/Script.java index ab3c0e6..7e0c3f2 100644 --- a/src/main/java/com/c2kernel/scripting/Script.java +++ b/src/main/java/com/c2kernel/scripting/Script.java @@ -51,6 +51,14 @@ public class Script ScriptEngine engine;
ScriptContext context;
+ /** For testing. Parses a given script xml, instead of loading it from Items.
+ * @param xml
+ * @throws ScriptParsingException
+ * @throws ParameterException
+ */
+ public Script(String xml) throws ScriptParsingException, ParameterException {
+ parseScriptXML(xml);
+ }
/**
* Loads script xml and parses it for script source, parameters and output specifications.
* First tries to load the script from resource path /scriptFiles/scriptName_scriptVersion.xml
@@ -157,7 +165,7 @@ public class Script engine.setContext(context);
}
- public void loadScript(String scriptName, String scriptVersion) throws ScriptingEngineException
+ private void loadScript(String scriptName, String scriptVersion) throws ScriptingEngineException
{
try
{
@@ -420,7 +428,8 @@ public class Script throw new ScriptingEngineException("Execution aborted, the following declared parameters were not set: \n" + missingParams.toString());
for (Parameter outputParam : mOutputParams.values()) {
- if (outputParam.getName() == null) continue; // If the name is null then it's the return type. don't pre-register it
+ System.out.println("Output param: "+outputParam.getName());
+ if (outputParam.getName() == null || outputParam.getName().length()==0) continue; // If the name is null then it's the return type. don't pre-register it
Logger.msg(8, "Script.setOutput() - Initialising output bean '" + outputParam.getName() + "'");
Object emptyObject;
try {
@@ -468,7 +477,7 @@ public class Script for (Parameter outputParam : mOutputParams.values()) {
String outputName = outputParam.getName();
Object outputValue;
- if (outputName == null)
+ if (outputName == null || outputName.length()==0)
outputValue = returnValue;
else
outputValue = context.getBindings(ScriptContext.ENGINE_SCOPE).get(outputParam.getName());
|
