Package org.datanucleus.plugin
Class PluginParser
- java.lang.Object
-
- org.datanucleus.plugin.PluginParser
-
class PluginParser extends java.lang.ObjectParser for "manifest.mf" and "plugin.xml" files.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPluginParser.ParserParser for a list of Bundle-Description
-
Field Summary
Fields Modifier and Type Field Description (package private) static javax.xml.parsers.DocumentBuilderFactorydbFactory
-
Constructor Summary
Constructors Constructor Description PluginParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringgetBundleName(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-Name from the manifest.mf fileprivate static java.lang.StringgetBundleSymbolicName(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-SymbolicName from the manifest.mf fileprivate static java.lang.StringgetBundleVendor(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-Vendor from the manifest.mf fileprivate static java.lang.StringgetBundleVersion(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-Version from the manifest.mf filestatic javax.xml.parsers.DocumentBuildergetDocumentBuilder()Convenience method to create a document builder for parsing.private static java.util.List<Bundle.BundleDescription>getRequireBundle(java.util.jar.Manifest mf)Accessor for the Bundle-Name from the manifest.mf filestatic ConfigurationElementparseConfigurationElement(Extension ex, org.w3c.dom.Element element, ConfigurationElement parent)Parses the current element and children, creating a ConfigurationElement objectprivate static java.util.List<ExtensionPoint>parseExtensionPoints(org.w3c.dom.Element rootElement, Bundle plugin, ClassLoaderResolver clr)Method to parse ExtensionPoints from plug-in fileprivate static java.util.List<Extension>parseExtensions(org.w3c.dom.Element rootElement, Bundle plugin, ClassLoaderResolver clr)Method to parse Extensions from plug-in filestatic BundleparseManifest(java.util.jar.Manifest mf, java.net.URL fileUrl)static java.util.List[]parsePluginElements(javax.xml.parsers.DocumentBuilder db, PluginRegistry mgr, java.net.URL fileUrl, Bundle plugin, ClassLoaderResolver clr)Method to parse Extensions in plug-in file.static Bundle.BundleVersionRangeparseVersionRange(java.lang.String interval)Parse a Version Range as per OSGi spec 3.0 $3.2.5
-
-
-
Method Detail
-
parseManifest
public static Bundle parseManifest(java.util.jar.Manifest mf, java.net.URL fileUrl)
-
getRequireBundle
private static java.util.List<Bundle.BundleDescription> getRequireBundle(java.util.jar.Manifest mf)
Accessor for the Bundle-Name from the manifest.mf file- Parameters:
mf- the manifest- Returns:
- the Set with BundleDescription
-
parseExtensionPoints
private static java.util.List<ExtensionPoint> parseExtensionPoints(org.w3c.dom.Element rootElement, Bundle plugin, ClassLoaderResolver clr)
Method to parse ExtensionPoints from plug-in file- Parameters:
rootElement- the root element of the plugin xmlplugin- the plugin bundleclr- the ClassLoaderResolver- Returns:
- a List of extensionPoints, if any
- Throws:
NucleusException- if an error occurs during parsing
-
parseExtensions
private static java.util.List<Extension> parseExtensions(org.w3c.dom.Element rootElement, Bundle plugin, ClassLoaderResolver clr)
Method to parse Extensions from plug-in file- Parameters:
rootElement- the root element of the plugin xmlplugin- the plugin bundleclr- the ClassLoaderResolver- Returns:
- a List of extensions, if any
- Throws:
NucleusException- if an error occurs during parsing
-
getBundleSymbolicName
private static java.lang.String getBundleSymbolicName(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-SymbolicName from the manifest.mf file- Parameters:
mf- the manifestdefaultValue- a default value, in case no symbolic name found in manifest- Returns:
- the bundle symbolic name
-
getBundleName
private static java.lang.String getBundleName(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-Name from the manifest.mf file- Parameters:
mf- the manifestdefaultValue- a default value, in case no name found in manifest- Returns:
- the bundle name
-
getBundleVendor
private static java.lang.String getBundleVendor(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-Vendor from the manifest.mf file- Parameters:
mf- the manifestdefaultValue- a default value, in case no vendor found in manifest- Returns:
- the bundle vendor
-
getBundleVersion
private static java.lang.String getBundleVersion(java.util.jar.Manifest mf, java.lang.String defaultValue)Accessor for the Bundle-Version from the manifest.mf file- Parameters:
mf- the manifestdefaultValue- a default value, in case no version found in manifest- Returns:
- the bundle version
-
parsePluginElements
public static java.util.List[] parsePluginElements(javax.xml.parsers.DocumentBuilder db, PluginRegistry mgr, java.net.URL fileUrl, Bundle plugin, ClassLoaderResolver clr)Method to parse Extensions in plug-in file.- Parameters:
db- DocumentBuilder to use for parsingmgr- the PluginManagerfileUrl- URL of the plugin.xml fileclr- the ClassLoaderResolver- 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 javax.xml.parsers.DocumentBuilder getDocumentBuilder()
Convenience method to create a document builder for parsing.- Returns:
- The document builder
- Throws:
NucleusException- if an error occurs creating the instance
-
parseConfigurationElement
public static ConfigurationElement parseConfigurationElement(Extension ex, org.w3c.dom.Element element, ConfigurationElement parent)
Parses the current element and children, creating a ConfigurationElement object- Parameters:
ex- theExtensionelement- the current elementparent- the parent. null if the parent is Extension- Returns:
- the ConfigurationElement for the element
-
parseVersionRange
public static Bundle.BundleVersionRange parseVersionRange(java.lang.String interval)
Parse a Version Range as per OSGi spec 3.0 $3.2.5- Parameters:
interval- the interval string- Returns:
-
-