- java.lang.Object
-
- org.datanucleus.plugin.OSGiPluginRegistry
-
- All Implemented Interfaces:
PluginRegistry
public class OSGiPluginRegistry extends Object implements PluginRegistry
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classOSGiPluginRegistry.ExtensionSorterSorter for extensions that puts DataNucleus extensions first, then any vendor extension.
-
Constructor Summary
Constructors Constructor Description OSGiPluginRegistry(ClassLoaderResolver clr)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectcreateExecutableExtension(ConfigurationElement confElm, String name, Class[] argsClass, Object[] args)Loads a class (do not initialize) from an attribute ofConfigurationElementBundle[]getBundles()Accessor for all registered bundles.ExtensionPointgetExtensionPoint(String id)Accessor for the ExtensionPoint with the specified id.ExtensionPoint[]getExtensionPoints()Acessor for the currently registed ExtensionPointsClassloadClass(String pluginId, String className)Loads a class (do not initialize)voidregisterExtensionPoints()Look for Bundles/Plugins and register them.protected voidregisterExtensionPointsForPluginInternal(List extPoints, boolean updateExtensionPointsArray)Register extension-points for the specified plugin.voidregisterExtensions()Look for Bundles/Plugins and register them.voidresolveConstraints()Resolve constraints declared in bundle manifest.mf files.URLresolveURLAsFileURL(URL url)Converts a URL that uses a user-defined protocol into a URL that uses the file protocol.
-
-
-
Constructor Detail
-
OSGiPluginRegistry
public OSGiPluginRegistry(ClassLoaderResolver clr)
Constructor- Parameters:
clr- the ClassLoaderResolver
-
-
Method Detail
-
getExtensionPoint
public ExtensionPoint getExtensionPoint(String id)
Accessor for the ExtensionPoint with the specified id.- Specified by:
getExtensionPointin interfacePluginRegistry- Parameters:
id- the unique id of the extension point- Returns:
- null if the ExtensionPoint is not registered
-
getExtensionPoints
public ExtensionPoint[] getExtensionPoints()
Description copied from interface:PluginRegistryAcessor for the currently registed ExtensionPoints- Specified by:
getExtensionPointsin interfacePluginRegistry- Returns:
- array of ExtensionPoints
-
registerExtensionPoints
public void registerExtensionPoints()
Look for Bundles/Plugins and register them. Register also ExtensionPoints and Extensions declared in "/plugin.xml" files- Specified by:
registerExtensionPointsin interfacePluginRegistry
-
registerExtensions
public void registerExtensions()
Description copied from interface:PluginRegistryLook for Bundles/Plugins and register them. Register also ExtensionPoints and Extensions declared in /plugin.xml files- Specified by:
registerExtensionsin interfacePluginRegistry
-
registerExtensionPointsForPluginInternal
protected void registerExtensionPointsForPluginInternal(List extPoints, boolean updateExtensionPointsArray)
Register extension-points for the specified plugin.- Parameters:
extPoints- ExtensionPoints for this pluginupdateExtensionPointsArray- Whether to update "extensionPoints" array
-
createExecutableExtension
public Object createExecutableExtension(ConfigurationElement confElm, String name, Class[] argsClass, Object[] args) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
Loads a class (do not initialize) from an attribute ofConfigurationElement- Specified by:
createExecutableExtensionin interfacePluginRegistry- Parameters:
confElm- the configuration elementname- the attribute nameargsClass- Classes of the argsargs- The arguments- Returns:
- the Class
- Throws:
NoSuchMethodException- if an error occursSecurityException- if an error occursInvocationTargetException- if an error occursIllegalAccessException- if an error occursInstantiationException- if an error occursIllegalArgumentException- if an error occursClassNotFoundException- If an error occurs
-
loadClass
public Class loadClass(String pluginId, String className) throws ClassNotFoundException
Loads a class (do not initialize)- Specified by:
loadClassin interfacePluginRegistry- Parameters:
pluginId- the plugin idclassName- the class name- Returns:
- the Class
- Throws:
ClassNotFoundException- if there is a problem in loading
-
resolveURLAsFileURL
public URL resolveURLAsFileURL(URL url) throws IOException
Description copied from interface:PluginRegistryConverts a URL that uses a user-defined protocol into a URL that uses the file protocol.- Specified by:
resolveURLAsFileURLin interfacePluginRegistry- Parameters:
url- the url to be converted- Returns:
- the converted URL
- Throws:
IOException- if an error occurs
-
resolveConstraints
public void resolveConstraints()
Resolve constraints declared in bundle manifest.mf files. This must be invoked after registering all bundles. Should log errors if bundles are not resolvable, or raise runtime exceptions.- Specified by:
resolveConstraintsin interfacePluginRegistry
-
getBundles
public Bundle[] getBundles()
Accessor for all registered bundles.- Specified by:
getBundlesin interfacePluginRegistry- Returns:
- the bundles
- Throws:
UnsupportedOperationException- if this operation is not supported by the implementation
-
-