Class BeanShellScriptInterpreter
- java.lang.Object
-
- org.apache.maven.shared.scriptinterpreter.BeanShellScriptInterpreter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,ScriptInterpreter
class BeanShellScriptInterpreter extends java.lang.Object implements ScriptInterpreter
Provides a facade to evaluate BeanShell scripts.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBeanShellScriptInterpreter.ChildFirstURLClassLoader
-
Field Summary
Fields Modifier and Type Field Description private BeanShellScriptInterpreter.ChildFirstURLClassLoaderclassLoader
-
Constructor Summary
Constructors Constructor Description BeanShellScriptInterpreter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.lang.ObjectevaluateScript(java.lang.String script, java.util.Map<java.lang.String,?> globalVariables, java.io.PrintStream scriptOutput)Evaluates the specified script.voidsetClassPath(java.util.List<java.lang.String> classPath)Set class path used by interpreted.private java.net.URLtoUrl(java.lang.String path)
-
-
-
Field Detail
-
classLoader
private final BeanShellScriptInterpreter.ChildFirstURLClassLoader classLoader
-
-
Method Detail
-
setClassPath
public void setClassPath(java.util.List<java.lang.String> classPath)
Description copied from interface:ScriptInterpreterSet class path used by interpreted.- Specified by:
setClassPathin interfaceScriptInterpreter- Parameters:
classPath- The additional class path for the script interpreter, may benullor empty if only the plugin realm should be used for the script evaluation. If specified, this class path will precede the artifacts from the plugin class path.
-
toUrl
private java.net.URL toUrl(java.lang.String path)
-
evaluateScript
public java.lang.Object evaluateScript(java.lang.String script, java.util.Map<java.lang.String,?> globalVariables, java.io.PrintStream scriptOutput) throws ScriptEvaluationExceptionDescription copied from interface:ScriptInterpreterEvaluates the specified script.- Specified by:
evaluateScriptin interfaceScriptInterpreter- Parameters:
script- The script contents to evaluate, must not benull.globalVariables- The global variables (as a mapping from variable name to value) to define for the script, may benullif not used.scriptOutput- A print stream to redirect any output from the script to, may benullto use stdout/stderr.- Returns:
- The return value from the script, can be
null - Throws:
ScriptEvaluationException- If the script evaluation produced an error.
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-