[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Re: Adding to the framework exported libraries?

Ah nice idea, so include the jar in my host jar and then open a resource stream to it and then pass that in to a call to register the bundle via the root bundlecontext? nice idea! Thanks!

....
Kabe

On 2/12/07, BJ Hargrave <hargrave@xxxxxxxxxx> wrote:
The fragment bundle only need to be a resource in your host application's
jar. You can the install it after creating the OSGi framework with
BundleContext.installBundle(String, InputStream) passing the input stream
to the resource!

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargrave@xxxxxxxxxx

office: +1 386 848 3788
mobile: +1 386 848 3788




Kabe <kabriel@xxxxxxxxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx
02/12/2007 10:34 AM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx>


To
"Equinox development mailing list" < equinox-dev@xxxxxxxxxxx>
cc

Subject
Re: [equinox-dev] Re: Adding to the framework exported libraries?






OK, i see what you are talking about Tom. Your suggesting to use a
fragment just for the metadata while still keeping the objects/classes in
my host application. I will see if this is possible at some future point,
right now adding to the system.packages property is the only thing that
works because my host application is a single jar, and i will need to
figure out a good way to write out a fragment bundle that i can load.
There are a few places i have seen in-memory bundles created, and this
will likely be the best approach when i have time to develop it.

Thanks everyone for the suggestions, this has helped a great deal!

....
Kabe




On 2/12/07, Thomas Watson < tjwatson@xxxxxxxxxx> wrote:

Gunnar's suggestions may be the better approach but will require you to
place more of your "outer" application into real bundles.  That is
something you may not be in the position to do.

I was suggesting a system.bundle fragment as a way to add exports to the
system.bundle without having to override the default
org.osgi.framework.systempackages property which is set by the framework
according the the execution environment you are on.  Basically this would
be a shell fragment that would not contain any code.  Instead it is just
exposing more packages that are available from the host's classloader by
exporting them it the fragment's bundle manifest.  The
META-INF/MANIFEST.MF for the system.bundle fragment would look something
like this ...

Bundle-ManifestVersion: 2
Bundle-SymbolicName: my.apps.packages
Fragment-Host: system.bundle
Export-Package: my.app.pkg1, my.app.pkg2

This fragment bundle is simply adding the exports my.app.pkg1 and
my.app.pkg2 to the exports of the system.bundle (org.eclispe.osgi).  This
will allow other bundles to import the packages.  As long as the
classloader of the framework has access to the packages it will be able to
load the classes for other bundles.  This fragment bundle would be
installed just like the other bundles you are installing into the
framework.

Tom



Gunnar Wagenknecht < gunnar@xxxxxxxxxxxxxxx >
Sent by: equinox-dev-bounces@xxxxxxxxxxx
02/12/2007 12:44 AM

Please respond to
Equinox development mailing list < equinox-dev@xxxxxxxxxxx>



To
equinox-dev@xxxxxxxxxxx
cc

Subject
[equinox-dev] Re: Adding to the framework exported libraries?








Kabe wrote:
> Hi Tom, thanks for the suggestion. Only reason i don't think this will
> work (and maybe i'm wrong?) is that i need my host application to expose
> instances (services) to the bundles, so for example my host application
> creates in instance of FooService, and then registers it with the root
> BundleContext of the Equinox framework. However, unless i somehow tell
> Equinox that the package is available from the host (parent classloader)
> it won't let any bundle load that depends on this package. So far i'm
> not seeing how Fragment Bundles can solve this problem, because they
> seem like they need to be full bundles and not just passed in, but there
> could be some API or technique i'm not familiar with?

The system bundle is "org.eclipse.osgi". It exports the system packages.

Fragments contribute to the classpath of their bundle host. Thus, if you
create a fragment to "org.eclipse.osgi" you can add the packages from
your application to the set of exported packages of the system bundle,
which makes them available to all bundles.

For registering your services from the host application I suggest
creating a bundle that is started when the framework is started. This
bundle can register any OSGi services, etc. It could be also the
fragment you created above.

Cu, Gunnar

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EclipseCon 2007!
http://wagenknecht.org/eclipsecon2007/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Gunnar Wagenknecht
gunnar@xxxxxxxxxxxxxxx
http://wagenknecht.org/

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev