JRuby Embed OSGi
Prototype of JRuby Embed support in OSGi. Extends the jruby.embed APIs: kenai.com/projects/jruby-embed/pages/Home Access classes, ruby and libraries contained in OSGi bundles.
Example: use EclipseRT Web Starter Kit to run some ruby servlets and access some java objects.
Generated p2 repository
A p2-repository is a way to publish artifacts. It supports the provisioning of products (p2-director) and compilation environments (maven-tycho). It is developped at eclipse.
The repository generated by this project contains org.jruby.jruby, org.jruby.jruby.source, org.jruby.osg and org.jruby.embed.osgi.source It is published here: www.intalio.org/public/p2repo/org/jruby/
The jruby sources bundle was assembled manually. It is currently uploaded here: www.intalio.org/public/maven2/org/jruby/jruby/1.5.3/ The org.jruby.jruby bundle is jruby-complete downloaded from maven central; unchanged.
the version 1.5.3.v20101104-nobsfimports is a repackaged jruby-complete without the bsf imports
until we figure out the PDE issue.
In particular: no DynamicImport-Package in this MANIFEST.MF
Due to a bug in Eclipse PDE the jruby-complete was repackaged: bugs.eclipse.org/bugs/show_bug.cgi?id=329390 The only change is the presence of a qualifier in the version number: 1.5.3 -> 184.108.40.20601104
org.jruby.embed.osgi.OSGiScriptingContainer extends ScriptingContainer
Java code in an osgi bundle:
OSGiScriptingContainer container = new OSGiScriptingContainer(); container.runScriptlet(bundle, "/ruby/extend_MyClass.rb")
The bundle is lazily added to JRuby's ClassPath.
where 'extend_MyClass.rb' reads:
class Java::OrgJrubyOsgiTestSample::MyClass def say_hello puts "hello" end end
It is also possible to add OSGi bundles to JRuby's ClassPath from java:
Define ruby libraries contained in an osgi bundle:
require 'osgibundle:/org.jruby.embed.osgi.test.samplebundle' class Java::OrgJrubyOsgiTestSamplebundle::MyOtherClass def say_hello_as_well puts "hello_as_well" end end
Access a ruby file inside a bundle:
mvn clean integration-test
License and copyright:
The same than the jruby code.