ScriptFrameworkErrorType.UNKNOWN );
}
// Set class loader to be used for class files
// and jar files
Thread.currentThread().setContextClassLoader(cl);
Interpreter interpreter = new Interpreter();
interpreter.getNameSpace().clear();
// Set class loader to be used by interpreter
// to look for classes by source e.g. interpreter
// will use this classloader to search classpath
// for source file ( bla.java ) on import or reference
interpreter.setClassLoader(cl);
try {
interpreter.set("XSCRIPTCONTEXT",
ScriptContext.createContext(m_xModel, m_xInvocContext,
m_xContext, m_xMultiComponentFactory));
interpreter.set("ARGUMENTS", aParams);
}
catch (bsh.EvalError e) {
// Framework error setting up context
throw new ScriptFrameworkErrorException(
e.getMessage(), null,
metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.UNKNOWN );
}
try {
String source = null;
Object result = null;
ScriptEditorForBeanShell editor =
ScriptEditorForBeanShell.getEditor(
sourceUrl );
if ( editor != null )
{
result = editor.execute();
if (result == null)
{
return new Any(new Type(), null);
}
return result;
}
metaData.loadSource();
source = metaData.getSource();
if ( source == null || source.length() == 0 )
{
throw new ScriptFrameworkErrorException(
"Failed to read script", null,
metaData.getLanguageName(), metaData.getLanguage(),
ScriptFrameworkErrorType.UNKNOWN );
}
result = interpreter.eval( source );
if (result == null)
{
return new Any(new Type(), null);
}