public class OSGiScriptingContainer extends ScriptingContainer
Currently:
TODO: look into using the LoadService of jruby. Look if it would be possible to reuse the base runtime and minimize the cost of new jruby runtimes.
Constructor and Description |
---|
OSGiScriptingContainer(Bundle creator) |
OSGiScriptingContainer(Bundle creator,
LocalContextScope scope,
LocalVariableBehavior behavior) |
Modifier and Type | Method and Description |
---|---|
void |
addToClassPath(Bundle bundle) |
JRubyOSGiBundleClassLoader |
getOSGiBundleClassLoader() |
EmbedEvalUnit |
parse(Bundle bundle,
java.lang.String path,
int... lines)
Parses a script given by a input stream and return an object which can be run().
|
java.lang.Object |
runScriptlet(Bundle bundle,
java.lang.String path)
Reads a script file from specified path and evaluates it under the current
scope (perhaps the top-level scope) and returns a result only if a script
returns a value.
|
java.lang.Object |
runScriptlet(java.lang.String bundleSymbolicName,
java.lang.String path) |
callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, callSuper, clear, finalize, get, get, getArgv, getAttribute, getAttributeMap, getClassCache, getClassLoader, getCompatVersion, getCompileMode, getCurrentDirectory, getEnvironment, getErr, getError, getErrorWriter, getHomeDirectory, getIn, getInput, getInstance, getJitLogEvery, getJitMax, getJitMaxSize, getJitThreshold, getKCode, getLoadPaths, getLoadServiceCreator, getOut, getOutput, getProfile, getProfileOutput, getProfilingMode, getProperty, getProvider, getReader, getRecordSeparator, getRuntime, getScriptFilename, getSupportedRubyVersion, getVarMap, getWriter, isNativeEnabled, isObjectSpaceEnabled, isRunRubyInProcess, newObjectAdapter, newRuntimeAdapter, parse, put, put, remove, remove, removeAttribute, resetErrorWriter, resetWriter, runRubyMethod, runRubyMethod, runScriptlet, setArgv, setAttribute, setClassCache, setClassLoader, setCompatVersion, setCompileMode, setCurrentDirectory, setEnvironment, setError, setError, setErrorWriter, setHomeDirectory, setInput, setInput, setJitLogEvery, setJitMax, setJitMaxSize, setJitThreshold, setKCode, setLoadPaths, setLoadServiceCreator, setNativeEnabled, setObjectSpaceEnabled, setOutput, setOutput, setProfile, setProfile, setProfileOutput, setProfilingMode, setReader, setRecordSeparator, setRunRubyInProcess, setScriptFilename, setWriter, terminate
public OSGiScriptingContainer(Bundle creator)
public OSGiScriptingContainer(Bundle creator, LocalContextScope scope, LocalVariableBehavior behavior)
scope
- if null, LocalContextScope.SINGLETHREADbehavior
- if null, LocalVariableBehavior.TRANSIENTpublic java.lang.Object runScriptlet(java.lang.String bundleSymbolicName, java.lang.String path)
bundleSymbolicName
- The bundle where the script is located. Lazily added to the
loader of the OSGiScriptingContainer. (require bundle:/... is implicitly done here)path
- The entry in the bundlepublic java.lang.Object runScriptlet(Bundle bundle, java.lang.String path)
ScriptingContainer
runScriptlet
in class ScriptingContainer
bundle
- The bundle where the script is located. Lazily added to the
loader of the OSGiScriptingContainer. (require bundle:/... is implicitly done here)path
- The entry in the bundlepublic EmbedEvalUnit parse(Bundle bundle, java.lang.String path, int... lines) throws java.io.IOException
parse
in class ScriptingContainer
bundle
- is where the script is locatedpath
- is the entry in the bundle.lines
- are linenumbers to display for parse errors and backtraces.
This field is optional. Only the first argument is used for parsing.
When no line number is specified, 0 is applied to.java.io.IOException
public void addToClassPath(Bundle bundle)
bundle
- Add a bundle to the jruby classloader.
Equivalent to require "bundle:/#{bundle.symbolic.name}"
public JRubyOSGiBundleClassLoader getOSGiBundleClassLoader()
Copyright © 2002-2009 JRuby Team. All Rights Reserved.