Package org.datanucleus.plugin
Interface PluginRegistry
-
- All Known Implementing Classes:
NonManagedPluginRegistry,OSGiPluginRegistry
public interface PluginRegistryLoader and registry of Extensions and Extension Points. The implementation of this interface must have a public constructor taking the ClassLoaderResolver interface as argument. The plugin registry metadata/bundle resolution is ruled by OSGi specification. The following sections of the OSGi 3.0 specification must be fully supported: 3.5.2, 3.5.3, 3.2.4, 3.2.5. The section 3.6.3 is optional. All other OSGi parts not mentioned above are not likely to be supported.See https://dzone.com/articles/extensionserviceplugin-mechanisms-in-java for a comparison of some different plugin mechanisms in Java. The one we use is based around Eclipse extensions/extension points.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjectcreateExecutableExtension(ConfigurationElement confElm, String name, Class[] argTypes, Object[] args)Loads a class (do not initialize) from an attribute ofConfigurationElementBundle[]getBundles()Accessor for all registered bundlesExtensionPointgetExtensionPoint(String id)Acessor for the ExtensionPointExtensionPoint[]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.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.
-
-
-
Method Detail
-
getExtensionPoint
ExtensionPoint getExtensionPoint(String id)
Acessor for the ExtensionPoint- Parameters:
id- the unique id of the extension point- Returns:
- null if the ExtensionPoint is not registered
-
getExtensionPoints
ExtensionPoint[] getExtensionPoints()
Acessor for the currently registed ExtensionPoints- Returns:
- array of ExtensionPoints
-
registerExtensionPoints
void registerExtensionPoints()
Look for Bundles/Plugins and register them. Register also ExtensionPoints and Extensions declared in /plugin.xml files
-
registerExtensions
void registerExtensions()
Look for Bundles/Plugins and register them. Register also ExtensionPoints and Extensions declared in /plugin.xml files
-
createExecutableExtension
Object createExecutableExtension(ConfigurationElement confElm, String name, Class[] argTypes, Object[] args) throws ClassNotFoundException, SecurityException
Loads a class (do not initialize) from an attribute ofConfigurationElement- Parameters:
confElm- the configuration elementname- the attribute nameargTypes- Types of the constructor argumentsargs- The arguments- Returns:
- the instance
- Throws:
ClassNotFoundException- If an error occursSecurityException- If an error occurs
-
loadClass
Class loadClass(String pluginId, String className) throws ClassNotFoundException
Loads a class (do not initialize)- Parameters:
pluginId- the plugin idclassName- the class name- Returns:
- the Class
- Throws:
ClassNotFoundException- if an error occurs in loading
-
resolveURLAsFileURL
URL resolveURLAsFileURL(URL url) throws 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:
IOException- if an error occurs
-
resolveConstraints
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.
-
getBundles
Bundle[] getBundles()
Accessor for all registered bundles- Returns:
- the bundles
- Throws:
UnsupportedOperationException- if this operation is not supported by the implementation
-
-