Skip to main content



      Home
Home » Eclipse Projects » Equinox » Re: Dynamic extensions in 3.2 with custom class loader
Re: Dynamic extensions in 3.2 with custom class loader [message #91931] Wed, 11 July 2007 09:03 Go to next message
Eclipse UserFriend
JP Moresmau wrote:
> Hello all, I'm trying to programmatically add extensions to a running
> Eclipse. I've used addContribution on the extensionRegistry, but it loads
> all the classes it needs from the plugin used as a contributor. What I want
> to do is to load classes from outside Eclipse, using a custom class loader
> that is not the plugin class loader. How do I do that in 3.2? I could do it
> in 3.0 by using the internal API (ok, so it's not an API if it's internal,
> I've been bold): creating Extension objects and their ConfigurationElements,
> and overloading ConfigurationElement.createExecutableExtension() to provide
> the actual instance of the object from my own class loader. But that code
> doesn't work anymore and I'm not sure there's a replacement (I don't mind
> using internal classes if there is no other way to do it).
>
> Thanks for any pointer!

If you have to dynamically inject classes into your bundle, I would
think that you could so it using OSGi/equinox hooks. Check out
org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook and its
implementers. That might enable you to farm out the loading of your
class without overriding any internal API.

Also, the kindly people in eclipse.technology.equinox might be able to
help/give you some direction.

Later,
PW
Re: Dynamic extensions in 3.2 with custom class loader [message #92083 is a reply to message #91931] Fri, 13 July 2007 10:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jp.moresmau.fr

Thanks, is there any code sample anywhere that shows how to add
programmatically a jar to my plugin class loader anywhere? The documentation
on ClassLoadingHook is quite sparse. I was hoping it would be a simple
enough operation...

JP

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:f72k6h$3nv$1@build.eclipse.org...
> JP Moresmau wrote:
>> Hello all, I'm trying to programmatically add extensions to a running
>> Eclipse. I've used addContribution on the extensionRegistry, but it loads
>> all the classes it needs from the plugin used as a contributor. What I
>> want to do is to load classes from outside Eclipse, using a custom class
>> loader that is not the plugin class loader. How do I do that in 3.2? I
>> could do it in 3.0 by using the internal API (ok, so it's not an API if
>> it's internal, I've been bold): creating Extension objects and their
>> ConfigurationElements, and overloading
>> ConfigurationElement.createExecutableExtension() to provide the actual
>> instance of the object from my own class loader. But that code doesn't
>> work anymore and I'm not sure there's a replacement (I don't mind using
>> internal classes if there is no other way to do it).
>>
>> Thanks for any pointer!
>
> If you have to dynamically inject classes into your bundle, I would think
> that you could so it using OSGi/equinox hooks. Check out
> org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook and its implementers.
> That might enable you to farm out the loading of your class without
> overriding any internal API.
>
> Also, the kindly people in eclipse.technology.equinox might be able to
> help/give you some direction.
>
> Later,
> PW
Re: Dynamic extensions in 3.2 with custom class loader [message #92161 is a reply to message #92083] Tue, 17 July 2007 08:53 Go to previous message
Eclipse UserFriend
JP Moresmau wrote:
> Thanks, is there any code sample anywhere that shows how to add
> programmatically a jar to my plugin class loader anywhere? The documentation
> on ClassLoadingHook is quite sparse. I was hoping it would be a simple
> enough operation...

Simple ... I don't think anything that fools around with the OSGi class
loader is simple :-)

I haven't seen any code examples myself, but there's some information on
the hooks at http://wiki.eclipse.org/Adaptor_Hooks and it is used as
part of http://wiki.eclipse.org/index.php/Product_Customization

Later,
PW
Previous Topic:BundleActivator in main thread
Next Topic:Reverse bundle resolving
Goto Forum:
  


Current Time: Sat Jun 07 07:25:52 EDT 2025

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

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

Back to the top