-
Notifications
You must be signed in to change notification settings - Fork 97
ThirdPartyLibraries
There are different ways to include third-party libraries in CS-Studio. In order of preference:
The Orbit repository provides some common libraries in a p2 repo for Eclipse products to use. If a library is in the Orbit repository, it is preferable to use this version.
The maven-osgi-bundles repo is used by CS-Studio to do a similar bundling, grabbing jar files from Maven Central and providing them in a p2 repo. If the jars from Maven Central are already bundled, they are not changed. If they are not bundled it uses a tool called BND to create an OSGi bundle for those jars.
There are two ways to add an artifact to maven-osgi-bundles:
- add the library to
repository/pom.xml
- if you need more control over how the bundle is configured, you may need to follow the examples in the
epics
directory. This uses the Apache Felix Maven Bundle Plugin.
As a last resort, wrap jars your own way.
Libraries like jython, jersey, serialization, need access to class loaders beyond their own one. For example, a display builder may invoke jython, and the jython script then needs to invoke code in the display builder.
If the jython.jar is included in the display builder, i.e. they are all within the same class loader, this is no problem. But if the jython code resides in its own bundle, jython scripts execute with the class loader of the jython bundle, lacking access to the display builder code.
The solution is the buddy class loader:
-
The Python plugin MANIFEST.MF includes
<Eclipse-BuddyPolicy>registered</Eclipse-BuddyPolicy>
. Thepom.xml
in the maven-osgi-bundles repo includes instructions to modify the original jython bundle by adding theEclipse-BuddyPolicy
. -
Every plugin that allows jython scripts to access its API add
Eclipse-RegisterBuddy: org.python.jython
to their MANIFEST.MF
In combination, plugins that allow access to their API will thus be included in the list of "buddies" and appear in the jython class loader.