org.datanucleus.plugin
Class PluginManager

java.lang.Object
  extended by org.datanucleus.plugin.PluginManager

public class PluginManager
extends java.lang.Object

Manages the registry of Extensions and Extension Points.


Constructor Summary
PluginManager(PersistenceConfiguration conf, ClassLoaderResolver clr)
          Constructor
 
Method Summary
 java.lang.Object createExecutableExtension(java.lang.String extensionPoint, java.lang.String[] discrimAttrName, java.lang.String[] discrimAttrValue, java.lang.String attributeName, java.lang.Class[] argsClass, java.lang.Object[] args)
          Convenience accessor for getting the Class of an attribute for an extension (of an extension point).
 java.lang.Object createExecutableExtension(java.lang.String extensionPoint, java.lang.String discrimAttrName, java.lang.String discrimAttrValue, java.lang.String attributeName, java.lang.Class[] argsClass, java.lang.Object[] args)
          Convenience accessor for getting the Class of an attribute for an extension (of an extension point).
 java.lang.String getAttributeValueForExtension(java.lang.String extensionPoint, java.lang.String[] discrimAttrName, java.lang.String[] discrimAttrValue, java.lang.String attributeName)
          Convenience accessor for getting the value of an attribute for an extension (of an extension point).
 java.lang.String getAttributeValueForExtension(java.lang.String extensionPoint, java.lang.String discrimAttrName, java.lang.String discrimAttrValue, java.lang.String attributeName)
          Convenience accessor for getting the value of an attribute for an extension (of an extension point).
 java.lang.String[] getAttributeValuesForExtension(java.lang.String extensionPoint, java.lang.String discrimAttrName, java.lang.String discrimAttrValue, java.lang.String attributeName)
          Convenience accessor for getting the value of an attribute for an extension (of an extension point).
 ConfigurationElement getConfigurationElementForExtension(java.lang.String extensionPointName, java.lang.String[] discrimAttrName, java.lang.String[] discrimAttrValue)
          Convenience accessor for getting the ConfigurationElement for an extension (of an extension point).
 ConfigurationElement getConfigurationElementForExtension(java.lang.String extensionPointName, java.lang.String discrimAttrName, java.lang.String discrimAttrValue)
          Convenience accessor for getting the (first) ConfigurationElement for an extension (of an extension point).
 ConfigurationElement[] getConfigurationElementsForExtension(java.lang.String extensionPointName, java.lang.String discrimAttrName, java.lang.String discrimAttrValue)
          Convenience accessor for getting the ConfigurationElement(s) for an extension (of an extension point).
 ExtensionPoint getExtensionPoint(java.lang.String id)
          Acessor for the ExtensionPoint
 ExtensionPoint[] getExtensionPoints()
          Acessor for the currently registed ExtensionPoints
 java.lang.String getRegistryClassName()
          Accessor for the PluginRegistry class name.
 java.lang.Class loadClass(java.lang.String pluginId, java.lang.String className)
          Loads a class (do not initialize)
 void registerExtensionPoints()
          Register Extension Points declared in /org/datanucleus/plugin/plugin.xml
 void registerExtensions()
          Register ExtensionPoints and Extensions declared in plugin files
 void resolveConstraints()
          Resolve constraints declared in bundle files.
 java.net.URL resolveURLAsFileURL(java.net.URL url)
          Converts a URL that uses a user-defined protocol into a URL that uses the file protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginManager

public PluginManager(PersistenceConfiguration conf,
                     ClassLoaderResolver clr)
Constructor

Parameters:
conf - the PMF Configuration
clr - the ClassLoaderResolver
Method Detail

getRegistryClassName

public java.lang.String getRegistryClassName()
Accessor for the PluginRegistry class name.

Returns:
Name of the plugin registry

getExtensionPoint

public ExtensionPoint getExtensionPoint(java.lang.String id)
Acessor for the ExtensionPoint

Parameters:
id - the unique id of the extension point
Returns:
null if the ExtensionPoint is not registered

getExtensionPoints

public ExtensionPoint[] getExtensionPoints()
Acessor for the currently registed ExtensionPoints

Returns:
array of ExtensionPoints

registerExtensionPoints

public void registerExtensionPoints()
Register Extension Points declared in /org/datanucleus/plugin/plugin.xml


registerExtensions

public void registerExtensions()
Register ExtensionPoints and Extensions declared in plugin files


resolveConstraints

public void resolveConstraints()
Resolve constraints declared in bundle files. This must be invoked after registering all bundles. Should log errors if bundles are not resolvable, or raise runtime exceptions.


getConfigurationElementForExtension

public ConfigurationElement getConfigurationElementForExtension(java.lang.String extensionPointName,
                                                                java.lang.String discrimAttrName,
                                                                java.lang.String discrimAttrValue)
Convenience accessor for getting the (first) ConfigurationElement for an extension (of an extension point).

Parameters:
extensionPointName - The extension point
discrimAttrName - Attribute on the extension to use as discriminator
discrimAttrValue - Value for discriminator attribute
Returns:
The value of the attribute

getConfigurationElementsForExtension

public ConfigurationElement[] getConfigurationElementsForExtension(java.lang.String extensionPointName,
                                                                   java.lang.String discrimAttrName,
                                                                   java.lang.String discrimAttrValue)
Convenience accessor for getting the ConfigurationElement(s) for an extension (of an extension point).

Parameters:
extensionPointName - The extension point
discrimAttrName - Attribute on the extension to use as discriminator
discrimAttrValue - Value for discriminator attribute
Returns:
The value of the attribute

getConfigurationElementForExtension

public ConfigurationElement getConfigurationElementForExtension(java.lang.String extensionPointName,
                                                                java.lang.String[] discrimAttrName,
                                                                java.lang.String[] discrimAttrValue)
Convenience accessor for getting the ConfigurationElement for an extension (of an extension point).

Parameters:
extensionPointName - The extension point
discrimAttrName - Attribute on the extension to use as discriminator1
discrimAttrValue - Value for discriminator1 attribute
Returns:
The value of the attribute

getAttributeValueForExtension

public java.lang.String getAttributeValueForExtension(java.lang.String extensionPoint,
                                                      java.lang.String discrimAttrName,
                                                      java.lang.String discrimAttrValue,
                                                      java.lang.String attributeName)
Convenience accessor for getting the value of an attribute for an extension (of an extension point).

Parameters:
extensionPoint - The extension point
discrimAttrName - Attribute on the extension to use as discriminator
discrimAttrValue - Value for discriminator attribute
attributeName - Name of the attribute whose value we want
Returns:
The value of the attribute

getAttributeValuesForExtension

public java.lang.String[] getAttributeValuesForExtension(java.lang.String extensionPoint,
                                                         java.lang.String discrimAttrName,
                                                         java.lang.String discrimAttrValue,
                                                         java.lang.String attributeName)
Convenience accessor for getting the value of an attribute for an extension (of an extension point).

Parameters:
extensionPoint - The extension point
discrimAttrName - Attribute on the extension to use as discriminator
discrimAttrValue - Value for discriminator attribute
attributeName - Name of the attribute whose value we want
Returns:
The value(s) of the attribute

getAttributeValueForExtension

public java.lang.String getAttributeValueForExtension(java.lang.String extensionPoint,
                                                      java.lang.String[] discrimAttrName,
                                                      java.lang.String[] discrimAttrValue,
                                                      java.lang.String attributeName)
Convenience accessor for getting the value of an attribute for an extension (of an extension point).

Parameters:
extensionPoint - The extension point
discrimAttrName - Attribute on the extension to use as discriminator1
discrimAttrValue - Value for discriminator1 attribute
attributeName - Name of the attribute whose value we want
Returns:
The value of the attribute

createExecutableExtension

public java.lang.Object createExecutableExtension(java.lang.String extensionPoint,
                                                  java.lang.String discrimAttrName,
                                                  java.lang.String discrimAttrValue,
                                                  java.lang.String attributeName,
                                                  java.lang.Class[] argsClass,
                                                  java.lang.Object[] args)
                                           throws java.lang.ClassNotFoundException,
                                                  java.lang.SecurityException,
                                                  java.lang.NoSuchMethodException,
                                                  java.lang.IllegalArgumentException,
                                                  java.lang.InstantiationException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException
Convenience accessor for getting the Class of an attribute for an extension (of an extension point).

Parameters:
extensionPoint - The extension point
discrimAttrName - Attribute on the extension to use as discriminator
discrimAttrValue - Value for discriminator attribute
attributeName - Name of the attribute whose value we want
Returns:
The value of the attribute
Throws:
java.lang.ClassNotFoundException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

createExecutableExtension

public java.lang.Object createExecutableExtension(java.lang.String extensionPoint,
                                                  java.lang.String[] discrimAttrName,
                                                  java.lang.String[] discrimAttrValue,
                                                  java.lang.String attributeName,
                                                  java.lang.Class[] argsClass,
                                                  java.lang.Object[] args)
                                           throws java.lang.ClassNotFoundException,
                                                  java.lang.SecurityException,
                                                  java.lang.NoSuchMethodException,
                                                  java.lang.IllegalArgumentException,
                                                  java.lang.InstantiationException,
                                                  java.lang.IllegalAccessException,
                                                  java.lang.reflect.InvocationTargetException
Convenience accessor for getting the Class of an attribute for an extension (of an extension point).

Parameters:
extensionPoint - The extension point
discrimAttrName - First attribute on the extension to use as discriminator
discrimAttrValue - Value for first discriminator attribute
attributeName - Name of the attribute whose value we want
Returns:
The value of the attribute
Throws:
java.lang.ClassNotFoundException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

loadClass

public java.lang.Class loadClass(java.lang.String pluginId,
                                 java.lang.String className)
                          throws ClassNotResolvedException
Loads a class (do not initialize)

Parameters:
pluginId - the plugin id
className - the class name
Returns:
the Class
Throws:
ClassNotResolvedException

resolveURLAsFileURL

public java.net.URL resolveURLAsFileURL(java.net.URL url)
                                 throws java.io.IOException
Converts a URL that uses a user-defined protocol into a URL that uses the file protocol.

Parameters:
url - the url to be converted
Returns:
the converted URL
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.