I am extending a project that it has been initiated with C++ language. Now I am developing a new part of the project. a开发者_如何学Gond it will be based on OSGi (Java). Now I want to know is there any stable method to compose the old project with new part? Is there any steps that can convert C++ objects to OSGi bundles (or with similar structure and metadata)? Or is there any way to have communication between them?
Although it isn't C++, but plain C, you might check out Apache Celix. Apache Celix is an implementation of the OSGi specification in C, without a dependency to any Java implementation or such. Currently Celix is still in the incubation phase.
Regarding communication between C and Java, one of the items on the (short term) todo list of Celix is an implementation of the OSGi Remote Services. We intend to use hessian as implementation since it already exists in many other languages, is relatively simple, binary and compact. This provides a solution for distributed systems as well as C - Java communication.
I don't think there is any alternative to JNI, the Java-Native Interface.
You could take a look at the BUNDLE_NATIVECODE
header and the related descriptions in the core specification (section 3.10). Still, you'll have to whip up a lot of interfaces using JNI then.
FYI - For C <-> Java communication the Paremus' OSGi Remote Service implementation (see Nimble) supports an Avro distribution provider.
精彩评论