Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » framework extensions question
framework extensions question [message #76703] Wed, 08 November 2006 06:24 Go to next message
Eclipse UserFriend
Originally posted by: ifedorenko.rogers.com

Hello,

I am trying to "bundleize" a library that defines few java interfaces
and has a special bytecode transformer that injects implementations of
these interfaces to clients of the library that use them. The bytecode
transformer and injected instances need to share certain state.
ClassLoadingHook looks promising, but... problem is, I can't keep the
interfaces (and classes that implement shared state) inside framework
extension bundle because other bundles cannot depend on a fragment. And
framework seems to disallow "Require-Bundle" for framework extensions,
so I can't keep the interfaces in a separate bundle either.

Is there a way to share classes between framework extension bundle and
other bundles?

--
Regards,
Igor Fedorenko
Re: framework extensions question [message #76909 is a reply to message #76703] Fri, 10 November 2006 03:06 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
A framework extension can export new packages. But the bundles you are
transforming will need to either import the package you export or use
Require-Bundle: system.bundle to access the package you export from your
system bundle fragment (framework extension).

There are other tricks you can do like exporting the packages from your
framework extension bundle with special matching attributes and have the
bundles that you transform using DynamicImport-Package to access the
package. I recommend using a special matching attribute so that the
DynamicImport-Package is scoped to only the packages you export from
your transforming extension bundle.

<in framework extension bundle manifest>
Export-Package: some.transform.stuff; type="transform"

<in transformed bundle manifest>
Dynamic-Import: *; type="transform"

There are other options that involve calling some internals of the
framework to add dynamic imports "dynamically" to the bundles you
transform by calling
BundleLoader.addDynamicImportPackage(ManifestElement[] packages) This
is one approach the AspectJ project uses in the Equinox incubator.

HTH

Tom.


Igor Fedorenko wrote:
> Hello,
>
> I am trying to "bundleize" a library that defines few java interfaces
> and has a special bytecode transformer that injects implementations of
> these interfaces to clients of the library that use them. The bytecode
> transformer and injected instances need to share certain state.
> ClassLoadingHook looks promising, but... problem is, I can't keep the
> interfaces (and classes that implement shared state) inside framework
> extension bundle because other bundles cannot depend on a fragment. And
> framework seems to disallow "Require-Bundle" for framework extensions,
> so I can't keep the interfaces in a separate bundle either.
>
> Is there a way to share classes between framework extension bundle and
> other bundles?
>
> --
> Regards,
> Igor Fedorenko
Previous Topic:Difference between exit and shutdown. Problem with bundle state persistence
Next Topic:OSGi bundle deployment
Goto Forum:
  


Current Time: Sat May 04 05:36:52 GMT 2024

Powered by FUDForum. Page generated in 0.03416 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top