Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Prototype some OSGi integration for jruby

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bundles
Octocat-spinner-32 p2
Octocat-spinner-32 .gitattributes
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 pom.xml
README.rdoc

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.

Errata

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 -> 1.5.3.20101104

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:

container.addToClassPath(bundle)

require 'bundle:/bundle.symbolic.name'

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:

require 'osgibundle:/org.jruby.embed.osgi.test/ruby/extend_MyClass.rb'

How-to build:

maven-3:

mvn clean integration-test

License and copyright:

The same than the jruby code.

Something went wrong with that request. Please try again.