Class NonManagedPluginRegistry
java.lang.Object
org.datanucleus.plugin.NonManagedPluginRegistry
- All Implemented Interfaces:
PluginRegistry
Manages the registry of Extensions and Extension Points outside any OSGI container.
This implementation cannot handle multiple versions of the same plugin, so it either raises an exception or logs the issue as a warning.
This is different to that mandated by the OSGi specification 3.0 $3.5.2.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classSorter for extensions that puts DataNucleus extensions first, then any vendor extension. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhether to load up any user (third-party) bundles.private StringType of check on bundles (EXCEPTION, LOG, NONE).private final ClassLoaderResolverClassLoaderResolver corresponding to the persistence context.private static final StringDataNucleus package to define whether to check for deps, etc.(package private) ExtensionPoint[]extension points(package private) Map<String, ExtensionPoint> extension points keyed by Unique Id (plugin.id +"."+ id)private static final charCharacter that is used in URLs of jars to separate the file name from the path of a resource inside the jar.
example: jar:file:foo.jar!/META-INF/manifest.mfprivate static final FilenameFilterfilters all accepted manifest file namesprivate static final Stringdirectories that are searched for plugin filesregistered bundles files keyed by bundle symbolic name -
Constructor Summary
ConstructorsConstructorDescriptionNonManagedPluginRegistry(ClassLoaderResolver clr, String bundleCheckType, boolean allowUserBundles) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateExecutableExtension(ConfigurationElement confElm, String name, Class[] argTypes, Object[] args) Loads a class (do not initialize) from an attribute ofConfigurationElementBundle[]Accessor for all registered bundlesAcessor for the ExtensionPointAcessor for the currently registed ExtensionPointsprivate URLgetManifestURL(URL pluginURL) Get the URL to the "manifest.mf" file relative to the plugin URL ($pluginurl/meta-inf/manifest.mf)private booleanisVersionInInterval(String version, String interval) Check if the version is in intervalLoads a class (do not initialize)protected BundleregisterBundle(URL manifest) Register the plugin bundle.protected BundleregisterBundle(Manifest mf, URL manifest) Register the plugin bundle.voidLook for Bundles/Plugins and register them.protected voidregisterExtensionPointsForPluginInternal(List<ExtensionPoint> extPoints, boolean updateExtensionPointsArray) Register extension-points for the specified plugin.voidLook for Bundles/Plugins and register them.voidregisterExtensionsForPlugin(URL pluginURL, Bundle bundle) Register extension and extension points for the specified plugin.voidResolve constraints declared in bundle manifest.mf files.resolveURLAsFileURL(URL url) Converts a URL that uses a user-defined protocol into a URL that uses the file protocol.
-
Field Details
-
DATANUCLEUS_PKG
DataNucleus package to define whether to check for deps, etc.- See Also:
-
PLUGIN_DIR
-
MANIFEST_FILE_FILTER
filters all accepted manifest file names -
JAR_SEPARATOR
private static final char JAR_SEPARATORCharacter that is used in URLs of jars to separate the file name from the path of a resource inside the jar.
example: jar:file:foo.jar!/META-INF/manifest.mf- See Also:
-
clr
ClassLoaderResolver corresponding to the persistence context. -
extensionPointsByUniqueId
Map<String, ExtensionPoint> extensionPointsByUniqueIdextension points keyed by Unique Id (plugin.id +"."+ id) -
registeredPluginByPluginId
-
extensionPoints
ExtensionPoint[] extensionPointsextension points -
bundleCheckType
Type of check on bundles (EXCEPTION, LOG, NONE). -
allowUserBundles
private boolean allowUserBundlesWhether to load up any user (third-party) bundles.
-
-
Constructor Details
-
NonManagedPluginRegistry
public NonManagedPluginRegistry(ClassLoaderResolver clr, String bundleCheckType, boolean allowUserBundles) Constructor.- Parameters:
clr- the ClassLoaderResolverbundleCheckType- Type of check on bundles (EXCEPTION, LOG, NONE)allowUserBundles- Whether to only load DataNucleus bundles (org.datanucleus).
-
-
Method Details
-
getExtensionPoint
Description copied from interface:PluginRegistryAcessor for the ExtensionPoint- Specified by:
getExtensionPointin interfacePluginRegistry- Parameters:
id- the unique id of the extension point- Returns:
- null if the ExtensionPoint is not registered
-
getExtensionPoints
Description copied from interface:PluginRegistryAcessor for the currently registed ExtensionPoints- Specified by:
getExtensionPointsin interfacePluginRegistry- Returns:
- array of ExtensionPoints
-
registerExtensionPoints
public void registerExtensionPoints()Description copied from interface:PluginRegistryLook 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<ExtensionPoint> extPoints, boolean updateExtensionPointsArray) Register extension-points for the specified plugin.- Parameters:
extPoints- ExtensionPoints for this pluginupdateExtensionPointsArray- Whether to update "extensionPoints" array
-
registerBundle
-
registerBundle
-
getManifestURL
-
createExecutableExtension
public Object createExecutableExtension(ConfigurationElement confElm, String name, Class[] argTypes, Object[] args) throws ClassNotFoundException, SecurityException Description copied from interface:PluginRegistryLoads a class (do not initialize) from an attribute ofConfigurationElement- Specified by:
createExecutableExtensionin interfacePluginRegistry- 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
Description copied from interface:PluginRegistryLoads a class (do not initialize)- Specified by:
loadClassin interfacePluginRegistry- Parameters:
pluginId- the plugin idclassName- the class name- Returns:
- the Class
- Throws:
ClassNotFoundException- if an error occurs in loading
-
resolveURLAsFileURL
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()Description copied from interface:PluginRegistryResolve 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
-
isVersionInInterval
-
getBundles
Description copied from interface:PluginRegistryAccessor for all registered bundles- Specified by:
getBundlesin interfacePluginRegistry- Returns:
- the bundles
-
registerExtensionsForPlugin
-