Class OSGiBundleParser

java.lang.Object
org.datanucleus.plugin.OSGiBundleParser

public class OSGiBundleParser extends Object
  • Field Details

  • Constructor Details

    • OSGiBundleParser

      public OSGiBundleParser()
  • Method Details

    • parseManifest

      public static Bundle parseManifest(org.osgi.framework.Bundle osgiBundle)
    • getRequireBundle

      private static List<Bundle.BundleDescription> getRequireBundle(Dictionary<String,String> headers)
      Accessor for the Bundle-Name from the manifest.mf file
      Parameters:
      headers - manifest headers
      Returns:
      the Set with BundleDescription
    • parseExtensionPoints

      private static List<ExtensionPoint> parseExtensionPoints(Element rootElement, Bundle plugin, org.osgi.framework.Bundle osgiBundle)
      Method to parse ExtensionPoints from plug-in file
      Parameters:
      rootElement - the root element of the plugin xml
      plugin - the plugin bundle
      osgiBundle - The bundle
      Returns:
      a List of extensionPoints, if any
      Throws:
      NucleusException - if an error occurs during parsing
    • parseExtensions

      private static List<Extension> parseExtensions(Element rootElement, Bundle plugin, org.osgi.framework.Bundle osgiBundle)
      Method to parse Extensions from plug-in file
      Parameters:
      rootElement - the root element of the plugin xml
      plugin - the plugin bundle
      osgiBundle - the bundle
      Returns:
      a List of extensions, if any
      Throws:
      NucleusException - if an error occurs during parsing
    • getHeaderValue

      private static String getHeaderValue(Dictionary<String,String> headers, String key, String defaultValue)
    • getBundleSymbolicName

      private static String getBundleSymbolicName(Dictionary<String,String> headers, String defaultValue)
      Accessor for the Bundle-SymbolicName from the manifest.mf file
      Parameters:
      headers - Manifest headers
      defaultValue - a default value, in case no symbolic name found in manifest
      Returns:
      the bundle symbolic name
    • getBundleName

      private static String getBundleName(Dictionary<String,String> headers, String defaultValue)
      Accessor for the Bundle-Name from the manifest.mf file
      Parameters:
      headers - manifest headers
      defaultValue - a default value, in case no name found in manifest
      Returns:
      the bundle name
    • getBundleVendor

      private static String getBundleVendor(Dictionary<String,String> headers, String defaultValue)
      Accessor for the Bundle-Vendor from the manifest.mf file
      Parameters:
      headers - manifest headers
      defaultValue - a default value, in case no vendor found in manifest
      Returns:
      the bundle vendor
    • getBundleVersion

      private static String getBundleVersion(Dictionary<String,String> headers, String defaultValue)
      Accessor for the Bundle-Version from the manifest.mf file
      Parameters:
      headers - the manifest headers
      defaultValue - a default value, in case no version found in manifest
      Returns:
      the bundle version
    • parsePluginElements

      public static List[] parsePluginElements(DocumentBuilder db, PluginRegistry mgr, URL fileUrl, Bundle plugin, org.osgi.framework.Bundle osgiBundle)
      Method to parse Extensions in plug-in file.
      Parameters:
      db - DocumentBuilder to use for parsing
      mgr - the PluginManager
      fileUrl - URL of the plugin.xml file
      plugin - The Bundle
      osgiBundle - The OSGi Bundle
      Returns:
      array of 2 elements. first element is a List of extensionPoints, and 2nd element is a List of Extension
      Throws:
      NucleusException - if an error occurs during parsing
    • getDocumentBuilder

      public static DocumentBuilder getDocumentBuilder()
      Convenience method to create a document builder for parsing.
      Returns:
      The document builder
      Throws:
      NucleusException - if an error occurs creating the instance