osgi - When should I use Import-Package and when should I use Require-Bundle? -
allows the reliance of dependency through OSGi import-package
, which is just a package Wire (exported from any bundle), and requirement-bundle
, which is ready for export of a specific designated bundle.
In the creation of a greenfield OSGI application, what approach should I use to represent dependency? Most bundles will be internal, but there will be some dependencies on external (open source) bundles.
I believe required-bundle
is an eclipse object (which is now It is designed to accommodate the eclipse in Olji imagery) The use of "pure" OSGI is to use the import-package
, because it separates the package from the bundle specifically, which it provides Does. You should announce the dependency on the functionality you need (which is the Java API provided by a specific version of a particular package) rather than that functionality (which will not make any difference to you). It keeps the structure of bundles more flexible.
Javascript analogy: It is similar to checking whether a web browser supports a particular API, which tells the user-agent string what kind of browser it is.
There is hardly a case where you need to use the requirement-bundle
, if you have a partition package, this is a package that has spread to many bundles . Split packages are definitely extremely disappointed.
Comments
Post a Comment