Fragment/Exported Packages Plugin

Last Updated: May 20, 2019
documentation for the dotCMS Content Management System

This bundle plugin is an example of how to add a simple fragment bundle that can be use it to export 3rd party libraries. This is the preferred method of providing exports to your other custom osgi plugins - rather than using the Dynamic Plugins > Exported Packages button.

How to create a bundle fragment plugin

Let’s review the file organization on the Fragment (com.dotcms.fragment) example:

META-INF/MANIFEST.MF: The manifest file is very important for the deployment, it lists the Bundle Name, Version and Packages.

In this MANIFEST you must specify (see template plugin):

  • Bundle-Name: The name of your fragment
  • Bundle-SymbolicName: A short an unique name for the fragment
  • Fragment-Host: system.bundle; extension:=framework
  • Export-Package: This is a comma separated list of package's name. List the packages that you want to make available to other bundles.

Fragment bundles

A Bundle fragment, is a bundle whose contents are made available to another bundles exporting 3rd party libraries.

One notable difference is that fragments do not participate in the lifecycle of the bundle, and therefore cannot have an Bundle-Activator.
As it not contain a Bundle-Activator a fragment cannot be started so after deploy it will have its state as Resolved and NOT as Active as a normal bundle plugin.

There is another way to mimic the fragment behavior, now in dotCMS it is possible to modify directly the list of packages we are exposing the the OSGI context using the Export Packages functionality, just click on Export Packages and modify the packages you want to expose to OSGI, the use of any of this two methods depends of your needs.

Saving on this window will restart the OSGI Framework.

On this page

×

We Dig Feedback

Selected excerpt:

×