Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between bootdelegation and DynamicImport-Package in osgi

Tags:

java

osgi

Both will resolve package dependencies in osgi what is the difference between them

like image 841
sreejith Avatar asked Feb 06 '13 12:02

sreejith


People also ask

What is OSGi import package?

OSGi allows for dependencies to be determined via Import-Package , which just wires up a single package (exported from any bundle), and Require-Bundle , which wires up to a specific named bundle's exports.

What is the purpose of the export package manifest header in OSGi bundle?

This header declares the external dependencies of the bundle that the OSGi Framework uses to resolve the bundle. Specific versions or version ranges for each package can be declared.

What is bundle ClassPath?

jar,. The Bundle-ClassPath header defines a comma-separated list of JAR file path names or directories (inside the bundle) containing classes and resources. The full stop ( '. ' \u002E ) specifies the root directory of the bundle's JAR. The full stop is also the default.


1 Answers

Bootdelegation is a hack that is needed because some code inside the VM assumed that application class loaders had visibility to com.sun.* classes. In OSGi, this is obviously NOT the case. Boot delegation is parameter that specifies for which packages the framework may do a lookup on the boot classpath. Since this is not modular, don't do it. It is global for the framework.

DynamicImport-Package is similar but only for the bundle it is defined in and only for exported packages. If a package cannot be found in the normal bundle contents or Import-Package then a DynamicImport-Package specifies the patterns of packages that are allowed to be searched in the set of exported packages. This idea is similar to the classpath, you've no idea what version you're going to get. Once a package is found, it is used forever. However, if it is not found every access will keep looking. I.e. you can install the package after the fact without restarting the bundle.

like image 169
Peter Kriens Avatar answered Sep 20 '22 12:09

Peter Kriens