If you use the new framework launching API (in 4.2 spec draft and 
implemented in the recent Equinox and Felix builds), you will have a 
Bundle and BundleContext for the framework (system bundle) you created. 
You can then register/use services to communicate with bundles installed 
in the framework. This is a far better idea than trying to directly 
interact with implementation classes in bundles.

You can either 

(a) have your code register a service which bundles can use(call) to get 
information from the C code.
(b) have bundles register services which the C code can get and call with 
information

You can even do a combination of both.
-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
[email protected]

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




From:
Jae Woo Lee <[email protected]>
To:
OSGi Developer Mail List <[email protected]>
Date:
2009/04/11 11:55
Subject:
Re: [osgi-dev] Communicating with a bundle from C code using JNI
Sent by:
[email protected]



Thank you for your response, Siamak.

Yes, an inter-process communication would work, but I am trying to 
avoid it if possible.  What I am trying to do is to build a network 
router that supports plug-ins written in Java.  I am using an existing 
C-based router platform called Click and trying to put OSGi-based plug- 
in architecture on top of it.  I would like to try to have the pieces 
work in a single process for performance.

Thanks for the pointer to R-OSGi.  It seems a very useful thing in 
general.  I'll look into it further for any tip for JNI communications.

- Jae

On Apr 11, 2009, at 4:51 AM, Siamak Haschemi wrote:

> Hello Jae,
>
> I think the easiest way would be some kind of Inter-Process- 
> Communication. For example, the Apache Thrift library should do it 
> (there are many more). But you can also look at Jan Rellermeyer work 
> (R-OSGi). As far as I remember, he did something in the area of 
> communicating with C/C++ code (and the otherway around?).
>
> Hope this helps.
>
> - Siamak
>
> Am 11.04.2009 um 08:11 schrieb Jae Woo Lee:
>
>> Hi,
>>
>> I am using JNI Invocation API to start a JVM, which in turn starts 
>> an Equinox container, which in turn loads my bundles.
>>
>> I am having trouble trying to pass a piece of data from C code to a 
>> bundle.  When I try to "env->FindClass()" the Activator class in my 
>> bundle, it fails.  It's probably because the bundle is loaded from 
>> a BundleClass loader rather than a system class loader.
>>
>> Can anyone think of a way for me to pass some data from C code to 
>> Java bundle code?
>>
>> - Jae
>>
>>
>> _______________________________________________
>> OSGi Developer Mail List
>> [email protected]
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to