On Mon, Nov 29, 2010 at 8:20 PM, Rob Heittman <rob.heitt...@solertium.com>wrote:
> I use JRuby under OSGi several places. I also have to do step #1. > > In my user story, the non-workingness of step #2 is a good thing; the OSGi > paradigm is helping restrict my REPL to see only what I mean it to -- users > can't accidentally/on-purpose go in and randomly exercise Java classes at > will, although they can use Ruby to exercise objects I've exposed > intentionally. So ... "correcting" it so that require 'java' works > transparently under OSGi might actually cause a security issue for me, > unless it was done carefully. I think the behavior I'd ideally want would > be for the interpreter to use the OSGi finder associated with the bundle > *where I instantiate the JRuby Runtime* but I have no good idea how to do > this without introducing an OSGi dependency in JRuby. > I'm new to embedding JRuby, so I'm curious what you mean by "exposed intentionally." Are you injecting implicit instances into the script runtime, or somehow doing the equivalent of the require 'java' provided import 'org.example.MyClass'? Regarding whether exporting that package would break your code, I haven't examined how many individual org.jruby packages I'd have to Import-Package if I were not doing Require-Bundle, but if you went the Import-Package route, you could just avoid importing builtin.* into your application's bundle.