-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for OSGI bundles #414
Comments
Hi @martmoldau Part of that effort includes changes in the way serialization/deserialization is handled to avoid a strong dependency on any given serialization format/library and allow people to easily replace the implementation should they want to. We've already had one request for OSGI in the past, could you expand on what scenario it'd unlock for you? what environments are you trying to build a solution for? Thanks! |
Hi @baywet Solution I'm working on is integration between different systems including different parts from Microsoft O365. This is based on Apache Camel which runs in OSGI environment Apache Karaf. There are ready made enterprise integration platforms also built on top of these. Red Hat Fuse or Talend for an example. About the OSGI request you were referring. Actually it's still same jar packaging as now. OSGI needs more detailed manifest and that is a task all the build tools can do I guess. I would vote for it:) |
Thanks for the additional information.
Now, here come the questions where I'm still fuzzy on the details:
|
You understood and described things in the first section quite right. Adding manifest properties is actually only reason why they are not OSGI bundles. Adding those properties to manifest will make it OSGI ready, but then it wants to import gson internal classes and this fails because gson OSGI bundle has those internal classes, but for internal use only. It's not mandatory to create or export any services. Services can be useful when one starts to build some solution specially for OSGI environment, but for a regular java library this is usually not the case. Good enough is when there are package name, description, version, imports and exports listed in the manifest. Imports can be mandatory or optional and also version or version range can be specified e.g. gson >=2.6 and < 3.0. Dependecies don't need to be OSGI bundles. For a user it is convinient when they are, but adding this extra info into manifest is up to each library maintainer not yours. There can be even different packaging for the same library. for example Kotlin has put together their different libraries into separately packaged kotlin-osgi-bundle. |
Thanks for the additional information. Okhttp, interestingly enough it seems the only reason why they don't have it is because nobody submitted a pull request for it, having somebody do the work would make all the dependencies compliant according to your analysis. Would this conflict with JPMS and the META-INF/MANIFESTS.MF we already have in the jar? microsoftgraph/msgraph-sdk-java#297 Our packages are quite large, v1 and beta packages are actually generated from metadata. My search for gradle plugins mostly yielded either compatibility plugins or plugins to help building services. I've found one plugin which would help building the manifest by automatically exploring the sources. Are you aware of anything better? Is the community set on some specific tooling? |
My analysis may not be comprehensive, but yes it would make life a little easier if one day all dependencies will have entries in manifest for OSGI too. I'm not familiar with gradle otherwise I could do the PR myself. Looks like I should take the time to study it. Meanwhile I can't answer your question about gradle plugins. With Maven I'm using Apache Felix Maven Bundle Plugin wich is using bndtools and seems that there are also couple for Gradle too. JPMS or any other entries in the manifest should not cause problems until the same names are not used for different content and purposes. I found a list of current OSGI header names reference here |
Thanks a lot for all those additional details! This is going to be pending on #323 (my initial comment), which is going to take a few months. |
In the meantime, would you mind sharing the details for the workaround you used to make the current version work here please? |
Thank you, @baywet, too!
There might be more dependencies needed depending what parts of graph api will be used. In my case it is mostly reading-writing Sharepoint Online lists and Termstore(managed metadata). |
thanks for sharing that additional information with the broader community! |
To provide additional context on that we're working on a migration to our new SDK generator kiota, this is going to take a while, but part of doing that work will remove a dependency on those internal classes which should unlock that aspect. Version number for core will be 3.X when it reaches preview. |
Adobe have also shown interest for OSGI support in the Java SDK. We will consider this feature as part of CY23H2 (2023 second half-year) planning. |
There are classes used from Gson internal API
com.google.gson.internal.Streams is used in com/microsoft/graph/serializer/ODataTypeParametrizedIJsonBackedTypedAdapter.java
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory is used in com/microsoft/graph/serializer/FallbackTypeAdapterFactory.java
This is also the reason why this library cannot be used in the OSGI environment as starting from Gson 2.6, the com.google.gson.internal packages are no longer exported in the OSGi bundles.
The text was updated successfully, but these errors were encountered: