org.rhq.bindings.engine
Interface ScriptEngineInitializer

All Known Implementing Classes:
JsEngineInitializer

public interface ScriptEngineInitializer

Is able to instantiate a script engine and import packages into the context of the engine.

Author:
Lukas Krejci

Method Summary
 String extractUserFriendlyErrorMessage(ScriptException e)
          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.
 String generateIndirectionMethod(String boundObjectName, Method method)
          This function returns a definition string in the script engine's language that provides an indirection to calling the method on the bound object.
 boolean implementsLanguage(String language)
           
 ScriptEngine instantiate(Set<String> packages)
           
 

Method Detail

implementsLanguage

boolean implementsLanguage(String language)

instantiate

ScriptEngine instantiate(Set<String> packages)
                         throws ScriptException
Throws:
ScriptException

generateIndirectionMethod

String generateIndirectionMethod(String boundObjectName,
                                 Method method)
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: The method would generate this javascript:
function bar(arg) { return foo.bar(arg); }

Parameters:
boundObjectName -
method -
Returns:
a string with method definition in the scripting language

extractUserFriendlyErrorMessage

String extractUserFriendlyErrorMessage(ScriptException e)
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.

Parameters:
e -
Returns:


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.