public final class PluginRegistryImpl extends Object implements PluginRegistry
Configuration parameters
This registry implementation supports following configuration parameters:
true.registering
or un-registering plug-ins.
If this is false, the registration errors will be stored
in the internal report that is available with
PluginRegistry.checkIntegrity(PathResolver) method.
The default parameter value is false.ObjectFactory.createRegistry()PluginRegistry.RegistryChangeData, PluginRegistry.RegistryChangeListener| Constructor and Description |
|---|
PluginRegistryImpl()
Creates plug-in registry object.
|
| Modifier and Type | Method and Description |
|---|---|
IntegrityCheckReport |
checkIntegrity(PathResolver pathResolver)
Performs integrity check of all registered plug-ins and generates result
as a collection of standard report items.
|
IntegrityCheckReport |
checkIntegrity(PathResolver pathResolver,
boolean includeRegistrationReport)
Performs integrity check of all registered plug-ins and generates result
as a collection of standard report items.
|
void |
configure(ExtendedProperties config)
Configures this registry instance.
|
String |
extractId(String uniqueId)
Extracts plug-in element ID from some unique identifier.
|
String |
extractPluginId(String uniqueId)
Extracts plug-in ID from some unique identifier.
|
Version |
extractVersion(String uniqueId)
Extracts plug-in version identifier from some unique identifier (plug-in
or plug-in fragment).
|
Collection<PluginDescriptor> |
getDependingPlugins(PluginDescriptor descr)
Utility method that recursively collects all plug-ins that depends on the
given plug-in.
|
ExtensionPoint |
getExtensionPoint(String uniqueId)
Looks for extension point.
|
ExtensionPoint |
getExtensionPoint(String pluginId,
String pointId)
Looks for extension point.
|
PluginDescriptor |
getPluginDescriptor(String pluginId)
Returns descriptor of plug-in with given ID.
|
Collection<PluginDescriptor> |
getPluginDescriptors()
Returns collection of descriptors of all plug-ins that was successfully
populated by this registry.
|
Collection<PluginFragment> |
getPluginFragments()
Returns collection of descriptors of all plug-in fragments that was
successfully populated by this registry.
|
IntegrityCheckReport |
getRegistrationReport() |
boolean |
isExtensionPointAvailable(String uniqueId)
Checks if extension point exists and is in valid state.
|
boolean |
isExtensionPointAvailable(String pluginId,
String pointId)
Checks if extension point exists and is in valid state.
|
boolean |
isPluginDescriptorAvailable(String pluginId)
Checks if plug-in exists and is in valid state.
|
String |
makeUniqueId(String pluginId,
String id)
Constructs unique identifier for some plug-in element from it's ID.
|
String |
makeUniqueId(String pluginId,
Version version)
Constructs unique identifier for plug-in with given ID.
|
ManifestInfo |
readManifestInfo(URL url)
Reads basic information from a plug-in or plug-in fragment manifest.
|
Map<String,Identity> |
register(URL[] manifests)
General algorithm:
Collect all currently registered extension points.
Parse given URL's as XML content files and separate them on plug-in
and plug-in fragment descriptors.
Process new plug-in descriptors first:
Instantiate new PluginDescriptorImpl object.
Handle versions correctly - register new descriptor as most
recent version or as an old version.
If other versions of the same plug-in already registered, take
their fragments and register them with this version.
Process new plug-in fragments next:
Instantiate new PluginFragmentImpl object.
Check if older version of the same fragment already registered.
|
void |
registerListener(PluginRegistry.RegistryChangeListener listener)
Registers plug-in registry change event listener.
|
Collection<String> |
unregister(String[] ids)
Unregisters plug-ins and plug-in fragments with given ID's (including
depending plug-ins and plug-in fragments).
|
void |
unregisterListener(PluginRegistry.RegistryChangeListener listener)
Unregisters registry change event listener.
|
public void configure(ExtendedProperties config)
PluginRegistryobject factory implementation.configure in interface PluginRegistryconfig - registry configuration dataPluginRegistry.configure(
ExtendedProperties)public ManifestInfo readManifestInfo(URL url) throws ManifestProcessingException
PluginRegistryreadManifestInfo in interface PluginRegistryurl - manifest data URLManifestProcessingException - if manifest data can't be readPluginRegistry.readManifestInfo(
java.net.URL)public Map<String,Identity> register(URL[] manifests) throws ManifestProcessingException
register in interface PluginRegistrymanifests - array of manifest locationsManifestProcessingException - if manifest processing error has occurred (optional behavior)PluginRegistry.register(java.net.URL[])public Collection<String> unregister(String[] ids)
PluginRegistryunregister in interface PluginRegistryids - ID's of plug-ins and plug-in fragments to be unregisteredPluginRegistry.unregister(java.lang.String[])public ExtensionPoint getExtensionPoint(String pluginId, String pointId)
PluginRegistryIllegalArgumentException if requested extension point can't be
found or is in invalid state.getExtensionPoint in interface PluginRegistrypluginId - plug-in IDpointId - extension point IDPluginRegistry.getExtensionPoint(
java.lang.String, java.lang.String)public ExtensionPoint getExtensionPoint(String uniqueId)
PluginRegistrygetExtensionPoint in interface PluginRegistryuniqueId - extension point unique IDPluginRegistry.getExtensionPoint(java.lang.String)public boolean isExtensionPointAvailable(String pluginId, String pointId)
PluginRegistrytrue, the method
PluginRegistry.getExtensionPoint(String, String) should always return valid
extension point.isExtensionPointAvailable in interface PluginRegistrypluginId - plug-in IDpointId - extension point IDtrue if extension point exists and validPluginRegistry.isExtensionPointAvailable(
java.lang.String, java.lang.String)public boolean isExtensionPointAvailable(String uniqueId)
PluginRegistryisExtensionPointAvailable in interface PluginRegistryuniqueId - extension point unique IDtrue if extension point exists and validPluginRegistry.isExtensionPointAvailable(
java.lang.String)public PluginDescriptor getPluginDescriptor(String pluginId)
PluginRegistryIllegalArgumentException. In other words, this method shouldn't
return null.getPluginDescriptor in interface PluginRegistrypluginId - plug-id IDPluginRegistry.getPluginDescriptor(java.lang.String)public boolean isPluginDescriptorAvailable(String pluginId)
PluginRegistrytrue, the method PluginRegistry.getPluginDescriptor(String)
should always return valid plug-in descriptor.isPluginDescriptorAvailable in interface PluginRegistrypluginId - plug-in IDtrue if plug-in exists and validPluginRegistry.isPluginDescriptorAvailable(java.lang.String)public Collection<PluginDescriptor> getPluginDescriptors()
PluginRegistrygetPluginDescriptors in interface PluginRegistryPluginDescriptor objectsPluginRegistry.getPluginDescriptors()public Collection<PluginFragment> getPluginFragments()
PluginRegistrygetPluginFragments in interface PluginRegistryPluginFragment objectsPluginRegistry.getPluginFragments()public Collection<PluginDescriptor> getDependingPlugins(PluginDescriptor descr)
PluginRegistrygetDependingPlugins in interface PluginRegistrydescr - descriptor of plug-in to collect dependencies forplug-in descriptors that
depend on given plug-inPluginRegistry.getDependingPlugins(
org.java.plugin.registry.PluginDescriptor)public IntegrityCheckReport checkIntegrity(PathResolver pathResolver)
PluginRegistrycheckIntegrity in interface PluginRegistrypathResolver - optional path resolverPluginRegistry.checkIntegrity(
org.java.plugin.PathResolver)public IntegrityCheckReport checkIntegrity(PathResolver pathResolver, boolean includeRegistrationReport)
PluginRegistrycheckIntegrity in interface PluginRegistrypathResolver - optional path resolverincludeRegistrationReport - if true, the plug-ins registration report will
be included into resulting reportPluginRegistry.checkIntegrity(
org.java.plugin.PathResolver, boolean)public IntegrityCheckReport getRegistrationReport()
getRegistrationReport in interface PluginRegistryPluginRegistry.getRegistrationReport()public String makeUniqueId(String pluginId, String id)
PluginRegistrymakeUniqueId in interface PluginRegistrypluginId - plug-in IDid - element IDPluginRegistry.makeUniqueId(
java.lang.String, java.lang.String)public String makeUniqueId(String pluginId, Version version)
PluginRegistrymakeUniqueId in interface PluginRegistrypluginId - plug-in IDversion - plug-in version identifierPluginRegistry.makeUniqueId(
java.lang.String, org.java.plugin.registry.Version)public String extractPluginId(String uniqueId)
PluginRegistryextractPluginId in interface PluginRegistryuniqueId - unique IDPluginRegistry.extractPluginId(java.lang.String)public String extractId(String uniqueId)
PluginRegistryextractId in interface PluginRegistryuniqueId - unique IDPluginRegistry.extractId(java.lang.String)public Version extractVersion(String uniqueId)
PluginRegistryextractVersion in interface PluginRegistryuniqueId - unique IDPluginRegistry.extractVersion(java.lang.String)public void registerListener(PluginRegistry.RegistryChangeListener listener)
PluginRegistryIllegalArgumentException.registerListener in interface PluginRegistrylistener - new registry change event listenerPluginRegistry.registerListener(
org.java.plugin.registry.PluginRegistry.RegistryChangeListener)public void unregisterListener(PluginRegistry.RegistryChangeListener listener)
PluginRegistryIllegalArgumentException.unregisterListener in interface PluginRegistrylistener - registered listenerPluginRegistry.unregisterListener(
org.java.plugin.registry.PluginRegistry.RegistryChangeListener)Copyright © 2015. All rights reserved.