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(org.osgi.framework.Bundle creator)
A scripting container where the classloader can find classes in
the osgi creator bundle and where the jruby home is set to point to
the one in the jruby's bundle home folder.
|
OSGiScriptingContainer(org.osgi.framework.Bundle creator,
LocalContextScope scope,
LocalVariableBehavior behavior)
A scripting container where the classloader can find classes in
the osgi creator bundle and where the jruby home is set to point to
the one in the jruby's bundle home folder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addToClassPath(org.osgi.framework.Bundle bundle) |
JRubyOSGiBundleClassLoader |
getOSGiBundleClassLoader() |
EmbedEvalUnit |
parse(org.osgi.framework.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(org.osgi.framework.Bundle bundle,
java.lang.String path) |
java.lang.Object |
runScriptlet(java.lang.String bundleSymbolicName,
java.lang.String path) |
addClassLoader, addGemPath, addGemPath, addLoadPath, addLoadPath, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, callSuper, clear, finalize, get, get, getArgv, getAttribute, getAttributeMap, getClassLoader, getClassloaderDelegate, 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, parse, parse, parse, put, put, remove, remove, removeAttribute, resetErrorWriter, resetWriter, runRubyMethod, runRubyMethod, runScriptlet, runScriptlet, runScriptlet, runScriptlet, setArgv, setAttribute, setClassLoader, setClassloaderDelegate, 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, terminatepublic OSGiScriptingContainer(org.osgi.framework.Bundle creator)
scope: LocalContextScope.SINGLETHREAD; behavior: LocalVariableBehavior.TRANSIENT
creator - public OSGiScriptingContainer(org.osgi.framework.Bundle creator,
LocalContextScope scope,
LocalVariableBehavior behavior)
creator - 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(org.osgi.framework.Bundle bundle,
java.lang.String path)
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(org.osgi.framework.Bundle bundle, java.lang.String path, int... lines) throws java.io.IOException
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.IOExceptionpublic void addToClassPath(org.osgi.framework.Bundle bundle)
bundle - Add a bundle to the jruby classloader.
Equivalent to require "bundle:/#{bundle.symbolic.name}"public JRubyOSGiBundleClassLoader getOSGiBundleClassLoader()
Copyright © 2001-2023 JRuby. All Rights Reserved.