How to Compose OSGi Based project with C++ based p

2019-07-21 20:17发布

问题:

I am extending a project that it has been initiated with C++ language. Now I am developing a new part of the project. and 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?

回答1:

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.



回答2:

I don't think there is any alternative to JNI, the Java-Native Interface.



回答3:

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.



回答4:

FYI - For C <-> Java communication the Paremus' OSGi Remote Service implementation (see Nimble) supports an Avro distribution provider.



标签: c++ osgi