org.rhq.bindings.engine
Class JsEngineInitializer
java.lang.Object
org.rhq.bindings.engine.JsEngineInitializer
- All Implemented Interfaces:
- ScriptEngineInitializer
public class JsEngineInitializer
- extends Object
- implements ScriptEngineInitializer
- Author:
- Lukas Krejci
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JsEngineInitializer
public JsEngineInitializer()
implementsLanguage
public boolean implementsLanguage(String language)
- Specified by:
implementsLanguage in interface ScriptEngineInitializer
instantiate
public ScriptEngine instantiate(Set<String> packages)
throws ScriptException
- Specified by:
instantiate in interface ScriptEngineInitializer
- Throws:
ScriptException
generateIndirectionMethod
public String generateIndirectionMethod(String boundObjectName,
Method method)
- Description copied from interface:
ScriptEngineInitializer
- This function returns a definition string in the script engine's language
that provides an indirection to calling the method on the bound object.
for example for parameters:
-
boundObjectName = foo
-
method = <int bar(int)>
The method would generate this javascript:
function bar(arg) { return foo.bar(arg); }
- Specified by:
generateIndirectionMethod in interface ScriptEngineInitializer
- Returns:
- a string with method definition in the scripting language
extractUserFriendlyErrorMessage
public String extractUserFriendlyErrorMessage(ScriptException e)
- Description copied from interface:
ScriptEngineInitializer
- At least the Rhino script engine for java script generates exceptions
whose error messages contain just "too much" information to be easily
decipherable by the end users.
This method extracts messages from the exception such that they are
presentable to the end user.
The returned string should only contain the error message. The filename, line
and column information should be stripped from it if at all possible.
- Specified by:
extractUserFriendlyErrorMessage in interface ScriptEngineInitializer
- Returns:
Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.