anchor.diff:  
   Although each bundle is isolated from other bundles, sometimes bundles may need to communicate/share classes with other bundles. A bundle can export a package to make the corresponding classes available for use by other bundles. A bundle can also import a package to use the classes of another bundle.
   
  -For example if a bundle `bundle1` requires a class `p1.p2.A` from `bundle2`, `bundle2` needs to export the `p1.p2` package and `bundle1` needs to import this package. The packages imported by a bundle as specified as a `Import-package` header in the `manifest.mf` while packages exported by a bundle are specified as a `Export-package` header in the `manifest.mf`.
  +For example if a bundle `bundle1` requires a class `p1.p2.A` from `bundle2`, `bundle2` needs to export the `p1.p2` package and `bundle1` needs to import this package. The packages imported by a bundle are specified as a `Import-package` header in the `manifest.mf` while packages exported by a bundle are specified as a `Export-package` header in the `manifest.mf`.
   
   The OSGi container ensures that a given bundle's package dependencies can be satisfied before the bundle runs. Thus, if the package dependencies cannot be satisfied, the bundle will not run.
   
  -==== Importing Packages in Plugins
  -
  -As explained earlier, Kill Bill plugins are packaged as OSGi bundles. The http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html[`maven-bundle-plugin`] specified in the https://github.com/killbill/killbill-hello-world-java-plugin/blob/3aa938d19fdfba81c7c035b45c3f17cac74db177/pom.xml[`pom.xml`] is responsible for this. Thus, the `maven-bundle-plugin` takes care of creating the jar with the correct OSGi headers (including adding the required packages to the `Import-Package` header). In addition, the https://github.com/killbill/killbill-oss-parent/blob/f3d9725cc7759a54eb6f978b3d3f763e1d170021/pom.xml[killbill-oss-parent pom] file (which is the parent of the plugin `pom.xml` file) also specifies the packages to be included in the `Import-Package` header.
  +==== Kill Bill OSGi Overview
  +
  +The Kill Bill core itself is packaged as an OSGi bundle (referred to as system bundle). It exports several packages as specified in the <<Packages exported by Kill Bill>> section. Packages exported by Kill Bill are automatically imported by a plugin as specified in the <<Packages Imported by Plugins by default>> section. However, in some cases, a plugin may need to explicitly import packages exported by Kill Bill as explained in the <<Importing Additional Packages in Plugins>> section.
  +
  +
  +==== Packages exported by Kill Bill
  +
  +As explained earlier, the Kill Bill system bundle exports the packages which it desires to share with plugins. The packages exported by the Kill Bill system bundle are specified in the https://github.com/killbill/killbill-platform/blob/4e735e9c3367cee2272964f16d028795f55592d3/osgi/src/main/java/org/killbill/billing/osgi/config/OSGIConfig.java#L49[OSGIConfig.java]. Additionally, Kill Bill also offers a system property, `org.killbill.osgi.system.bundle.export.packages.extra`, to specify additional packages to be exported by the system bundle and that could in turn be imported by a plugin.
  +
  +==== Packages Imported by Plugins by default
  +
  +As explained earlier, Kill Bill plugins are packaged as OSGi bundles. The http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html[`maven-bundle-plugin`] specified in the https://github.com/killbill/killbill-hello-world-java-plugin/blob/3aa938d19fdfba81c7c035b45c3f17cac74db177/pom.xml[`pom.xml`] is responsible for packaging a plugin as an OSGi bundle. Thus, the `maven-bundle-plugin` takes care of creating the jar with the correct OSGi headers (including adding the required packages to the `Import-Package` header). In addition, the https://github.com/killbill/killbill-oss-parent/blob/f3d9725cc7759a54eb6f978b3d3f763e1d170021/pom.xml[killbill-oss-parent pom] file (which is the parent of the plugin `pom.xml` file) also specifies the packages to be included in the `Import-Package` header.
   
   Thus, when a plugin is built, the `Import-Package` header is automatically computed based on:
   
  
positive.code: * Packages specified in the `killbill-oss-parent` pom file.
  
  
  ==== Packages exported by Kill Bill
  
  The Kill Bill system bundle also exports the packages which it desires to share with plugins. The packages exported by the Kill Bill system bundle are specified in the https://github.com/killbill/killbill-platform/blob/4e735e9c3367cee2272964f16d028795f55592d3/osgi/src/main/java/org/killbill/billing/osgi/config/OSGIConfig.java#L49[OSGIConfig.java]. Additionally, Kill Bill also offers a system property, `org.killbill.osgi.system.bundle.export.packages.extra`, to specify additional packages to be exported by the system bundle and that could in turn be imported by a plugin.
  
  ==== Importing Additional Packages in Plugins
  
  Sometimes, a plugin may require to use some additional packages from Kill Bill (other than those automatically imported as specified above). In such cases, you will need to explicitly *export* the package from Kill Bill and *import* it in the plugin as explained below.
  
negative.code: </osgi.extra-import> 
  
  This causes the package to be added to the `Import-Package` header of the plugin jar. You can see an example of this in the https://github.com/killbill/killbill-adyen-plugin/blob/0c5205d2ee42b543852e7cbd1a6f6f065ad575e5/pom.xml#L44[Kill Bill Adyen Plugin pom file]. 
  
  ==== Exporting Additional Packages from a Plugin
  
  A plugin can also export packages corresponding to the classes that it wants to share with other plugins. This mechanism is particularly useful since it allows plugins to share custom functionality with other plugins. 
  
  To *export* a package from a plugin, you need to follow the steps given below.
  
  . Open plugin `pom.xml`.
  
  . Specify the following in the `properties` section of the `pom.xml` (Replace `<package>` with the fully qualified name of the package that you would like to export): 
  [source,xml]
  <osgi.export>
    <package1>,
    <package2>
     ....
    <packagen>
  </osgi.export>
  
  . This causes the specified packages to be added to the `Export-Package` header of the plugin jar.
  
  . Other plugins can then use the classes in these packages by importing them as explained above.
  
  === Examples of Plugins
  
  