|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.bindings.ScriptEngineFactory
public class ScriptEngineFactory
This is RHQ specific imitation of ScriptEngineFactory. In RHQ, we provide a standard set of bound variables in the script context and also import classes from our standard packages to ease the development of the scripts.
This factory is able to instantiate a script engine and initialize it consistently so that all users of the script engine get the uniform environment to write the scripts in.
| Method Summary | |
|---|---|
static void |
bindIndirectionMethods(ScriptEngine scriptEngine,
String bindingName)
Goes through the methods of the object found in the scriptEngine's ENGINE_SCOPE
and for each of them generates a top-level function that is called the same name and accepts the same
parameters. |
static ScriptEngineInitializer |
getInitializer(String language)
|
static ScriptEngine |
getScriptEngine(String language,
PackageFinder packageFinder,
StandardBindings bindings)
Initializes the script engine for given language. |
static ScriptEngine |
getSecuredScriptEngine(String language,
PackageFinder packageFinder,
StandardBindings bindings,
PermissionCollection permissions)
This method is similar to the getScriptEngine(String, PackageFinder, StandardBindings) method
but additionally applies a security wrapper on the returned script engine so that the scripts execute
with the provided java permissions. |
static void |
injectStandardBindings(ScriptEngine engine,
StandardBindings bindings,
boolean deleteExistingBindings)
Injects the values provided in the bindings into the engine scope
of the provided script engine. |
static void |
removeBindings(ScriptEngine engine,
Set<String> keySet)
Remove the specified bindings from the engine. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static ScriptEngine getScriptEngine(String language,
PackageFinder packageFinder,
StandardBindings bindings)
throws ScriptException,
IOException
language - the language of the script to instantiatepackageFinder - the package finder to find the standard packages in user provided locationsbindings - the initial standard bindings or null if none required
ScriptException - on error during initialization of the script environment
IOException - if the package finder fails to find the packages
public static ScriptEngine getSecuredScriptEngine(String language,
PackageFinder packageFinder,
StandardBindings bindings,
PermissionCollection permissions)
throws ScriptException,
IOException
getScriptEngine(String, PackageFinder, StandardBindings) method
but additionally applies a security wrapper on the returned script engine so that the scripts execute
with the provided java permissions.
ScriptException
IOExceptiongetScriptEngine(String, PackageFinder, StandardBindings)
public static void injectStandardBindings(ScriptEngine engine,
StandardBindings bindings,
boolean deleteExistingBindings)
engine scope
of the provided script engine.
engine - the enginebindings - the bindingsdeleteExistingBindings - true if the existing bindings should be replaced by the provided ones, false
if the provided bindings should be added to the existing ones (possibly overwriting bindings with the same name).
public static void removeBindings(ScriptEngine engine,
Set<String> keySet)
engine - the enginekeySet - the binding keys to be removed
public static void bindIndirectionMethods(ScriptEngine scriptEngine,
String bindingName)
scriptEngine's ENGINE_SCOPE
and for each of them generates a top-level function that is called the same name and accepts the same
parameters.
scriptEngine - the script engine to generate the top-level functions inbindingName - the name of the object in the script engine to generate the functions fromScriptEngineInitializer#generateIndirectionMethod(String, Method),
NoTopLevelIndirectionpublic static ScriptEngineInitializer getInitializer(String language)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||