Calling third party jar method from OSGi Bundle [message #93061] |
Thu, 26 July 2007 11:40 |
Eclipse User |
|
|
|
Originally posted by: michael2de.yahoo.com
Hi All
From my bundle installed in equinox, I want to call a method of third party jar (asm.jar). One way of doing this is to include this jar in the bundle but there is a restriction that we cannot include this jar in the bundle.
Is there a way to call this jar present outside on file system from inside the container.
Thanks,
MJ
|
|
|
Re: Calling third party jar method from OSGi Bundle [message #93076 is a reply to message #93061] |
Thu, 26 July 2007 13:28 |
Danail Nachev Messages: 36 Registered: July 2009 |
Member |
|
|
Hi Michael,
I can think of three methods to do this:
1) create a new url classloader, pass the filesystem url and call the
jar entry point via reflection. Ugly:)
2) deploy the jar in the system classpath and export its packages via
framework extension. Then, you import them in your bundle and everything
is OK.
3) bundle-ize the third party library. I don't know what are the
restriction of the license of the library, so you need to figure out
whether this makes any sense. Perhaps, not:)
So, the best option you have is 2). How to do it:
http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg02229.ht ml
However, this message is quite scarce, so if you need additional
assistance, drop a message.
Michael wrote:
> Hi All
>
> From my bundle installed in equinox, I want to call a method of third party jar (asm.jar). One way of doing this is to include this jar in the bundle but there is a restriction that we cannot include this jar in the bundle.
>
> Is there a way to call this jar present outside on file system from inside the container.
>
> Thanks,
> MJ
|
|
|
Re: Calling third party jar method from OSGi Bundle [message #93106 is a reply to message #93076] |
Thu, 26 July 2007 17:43 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
You can use the 'external' location, but that's not supported outside of Eclipse and in any case isn't a good thing.
What you could do is develop a placeholder bundle to be expanded on the filing system:
org.example.asm.placeholder_1.0.0/META-INF/MANIFEST.MF
Bundle-Name: org.example.asm.placeholder
Bundle-ClassPath: asm.jar
Export-Package: org.example.asm
Then, get your users to manually install/copy the 'asm.jar' into 'plugins/org.example.asm.placeholder_1.0.0/'
You can then use standard Import-Package to get the packages in. Then, if ASM ever gets bundleized, you will have a working dependency straight away.
Alex.
|
|
|
Re: Calling third party jar method from OSGi Bundle [message #93146 is a reply to message #93061] |
Fri, 27 July 2007 05:33 |
Eclipse User |
|
|
|
Originally posted by: michael2de.yahoo.com
I tried the following but does not seem to be working :(
System.setProperty("osgi.clean", "true");
System.setProperty("osgi.frameworkClassPath",
".,D:\\asm.jar");
System.setProperty("osgi.framework.extensions",
"D:\\asm.jar");
Is there something i am missing?
Thanks,
MJ
|
|
|
|
Re: Calling third party jar method from OSGi Bundle [message #93174 is a reply to message #93160] |
Fri, 27 July 2007 07:53 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
I thought so :-)
BTW you can't expect to do anything with setting osgi.* properties after the environment is up and running. They can only be set before startup, such as with -D and config.ini entries.
Alex.
PS I'm sure that the approach of placeholder bundle has been used in prior versions of Eclipse for bundling non-EPL functionality, but I can't remember what it was.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02398 seconds