Importing packages from the main classloader

Importing packages from the main classloader

It's possible to access classes from outside of the OSGI by declaring their packages in the org.osgi.framework.system.packages.extra framework property. OSGI creates a synthetic System Bundle which declares these packages as exports. The effect is that within the OSGI container, these packages appear as if they're natively exported by a bundle.

The org.osgi.framework.system.packages.extra property is configured within the karaf/etc/custom.properties file. A Pentaho customized version is housed with the pentaho-karaf-assembly here.

OSGI doesn't support wildcarding of packages, making it cumbersome to manage. We've pre-processing the custom.properties on server startup to provide this wildcarding functionality.

Example:
org.apache.*,org.slf4j.*; version="1.7.7"

org.apache.* will be expand out to all packages with that base, with no versioning information. org.slf4j.* will expand out with the version appended to each package