Hi Bertrand, Let me see, whether I understand it correctly: You have jar, say hammer.jar. This jar contains the Felix framework (and osgi) libraries and a series of bundles plus the Hammer interface to be used by clients of the hammer.jar. Implementations of the Hammer implementations will be implemented by bundles loaded inside the hidden OSGi framework and will be available through some public HammerFactory in the hammer.jar.
I fear, you in fact will have to play around with class loaders :-) Probably, you will setup a class loader in whose parent is the class loader loading the hammer.jar. This private classloader, will know the Felix framework (and osgi) libraries, which you load in the Hammer. This way, the HammerFactory knows the framework as it knows the private class loader, but the framework etc. will not be visible from the outside, because the private class loader is not visible from the outside. The consequence of this is, that the Felix framework (and osgi) libraries will also be back in hammer.jar as JAR files such that they are not visible as classes from the hammer.jar class loader. But the private class loader must be able to be setup from jar files embedded in jar files, which is AFAIK not possible with the standard URLClassLoader. You might want to have a look at the ClassWorlds project for a solution to this problem. Hope this helps. Regards Felix Am Samstag, den 15.09.2007, 16:23 +0200 schrieb Bertrand Delacretaz: > On 9/15/07, Richard S. Hall <[EMAIL PROTECTED]> wrote: > > Perhaps I don't understand exactly what you are asking, but doesn't the > > example application basically do what you want? > > > > http://cwiki.apache.org/FELIX/apache-felix-application-demonstration.html... > > >From the functional side of things yes, but what I'm after is some > form of shielding classloader that completely hides the fact that > Felix is used to run my tool. > > Hopefully the example below is clearer: > > // hammer.jar is in the classpath > // hammerl.jar embeds the Felix runtime, and a number of > // OSGi bundles, used internally > > // Hammer comes from hammer.jar > Hammer h = HammerFactory.createHammer(); > > // This must fail: Felix classes, and classes found in mytool.jar > // except the Hammer interfaces, must be "invisible" > Class.forName("org.apache.felix.framework.Felix"); > > > ...Perhaps you also wish to make the bundle JAR files embedded into this > > single JAR file too? This should be fairly easy, just embed them as > > resources and then use getResource() to get a resource URL to them and > > use that URL to install them into your Felix instance... > > Yes, that shouldn't be too hard, the problem lies more in the > classloader isolation described above. > > Thanks for your reply - hope this clarifies what I'm after! > -Bertrand > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

