The OSGi runtime controls package visibility across bundles. If a bundle
does not explicitly import a package, then it will not have access to classes
within that package when it comes to dynamically loading them. This is especially
important to MQe, because it has been designed with this flexibility in mind.
Without some small changes to the bundles, developers cannot use 3rd party
or their own Rules or Adapters. There are two ways to remove this problem:
- OSGi version 3 includes a DynamicImport-Package statement for the bundles
manifest file. This has been included in the MQeBundle.jar and when the user-defined
class's package is exported from its bundles manifest, MQe will be able to
have access to this class.
Note: This functionality is available to SMF version
3.1.0 or higher.
- Create a new MQeLoader and add all the user-defined classes before they
are used, most likely within the bundles activator, for example:
String MyRule = "UserQMRule";
MQeLoader loader = new MQeLoader();
loader.addClass(MyRule, Class.forName(MyRule));
MQe.setLoader(loader);
Note: Take care that the loader within MQe is not
replaced with another loader from another bundle during the application runtime.