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

It doesn't embed the Felix JAR, but it creates a single JAR file that contains the application and Felix classes.

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.

-> richard

Bertrand Delacretaz wrote:
Hi,

For an upcoming project I'd like to use Felix to manage third-party
dependencies internally, while hiding this completely from the users
of the resulting tool, which would be delivered as a single jar file.

If for example my library has this interface:

  package tunes.looney.hammer;
  public interface Hammer {
    HammerResult process(HammerInput hi)
      throws HammerException;
  }

My jar would only expose this interface and the supporting
tunes.looney.hammer.* classes to the outside world, yet use Felix
internally to manage a set of bundles to implement it.

This would not require the user of the jar to have an OSGi runtime, so
that the jar can be seen as a simple tool with no dependencies.

Has anyone done something similar?

I'm not an expert in classloaders, but I assume an isolating
classloader, which uses jars embedded inside the main jar for the
Felix and third-party stuff, would do the job (with some fun problems
to solve along the way, most probably).

This also sounds a lot like what servlet containers are doing, of course.

Thanks for any advice or pointers to existing such tools,
-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]

Reply via email to