Interface PluginRegistry
- All Known Implementing Classes:
MockPluginRegistry
,PluginRegistryImpl
registering
or
un-registering
plug-ins with this registry. If
your code is interested to be notified on all modifications of plug-ins set,
you can
register
an
implementation of PluginRegistry.RegistryChangeListener
with this
registry.
Notes on unique ID's (UID's)
There are two types of identifiers in the API: ID's and UID's. ID is an
identifier that is unique within set of elements of the same type. UID is an
identifier that unique globally within registry space. ID is usually defined
by developer in plug-in manifest. UID always combined automatically from
several other plug-in "parts". All plug-in elements have method
getId()
that come from
basic Identity
interface, but not all
elements have UID - only those that inherits
UniqueIdentity
interface.
There are several utility methods available in this interface that aimed to
build UID from different plug-in "parts" and also split UID to it's original
elements: makeUniqueId(String, Version)
,
makeUniqueId(String, String)
, extractPluginId(String)
,
extractId(String)
and extractVersion(String)
.
- Version:
- $Id: PluginRegistry.java,v 1.5 2007/03/03 17:16:26 ddimon Exp $
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Registry changes data holder interface.static interface
Plug-in registry changes callback interface. -
Method Summary
Modifier and TypeMethodDescriptioncheckIntegrity
(PathResolver pathResolver) Performs integrity check of all registered plug-ins and generates result as a collection of standard report items.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.Extracts plug-in element ID from some unique identifier.extractPluginId
(String uniqueId) Extracts plug-in ID from some unique identifier.extractVersion
(String uniqueId) Extracts plug-in version identifier from some unique identifier (plug-in or plug-in fragment).Utility method that recursively collects all plug-ins that depends on the given plug-in.getExtensionPoint
(String uniqueId) Looks for extension point.getExtensionPoint
(String pluginId, String pointId) Looks for extension point.getPluginDescriptor
(String pluginId) Returns descriptor of plug-in with given ID.Returns collection of descriptors of all plug-ins that was successfully populated by this registry.Returns collection of descriptors of all plug-in fragments that was successfully populated by this registry.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.makeUniqueId
(String pluginId, String elementId) Constructs unique identifier for some plug-in element from it's ID.makeUniqueId
(String pluginId, Version version) Constructs unique identifier for plug-in with given ID.readManifestInfo
(URL manifest) Reads basic information from a plug-in or plug-in fragment manifest.Registers plug-ins and plug-in fragments in this registry.void
Registers plug-in registry change event listener.unregister
(String[] ids) Unregisters plug-ins and plug-in fragments with given ID's (including depending plug-ins and plug-in fragments).void
Unregisters registry change event listener.
-
Method Details
-
register
Registers plug-ins and plug-in fragments in this registry. Note that this method not makes plug-ins available for activation by anyPluginManager
instance as it is not aware of any manager. Using this method just makes plug-in meta-data available for reading from this registry.If more than one version of the same plug-in or plug-in fragment given, the only latest version should be registered. If some plug-in or plug-in fragment already registered it should be ignored by this method. Client application have to un-register such plug-ins first before registering their newest versions.
- Parameters:
manifests
- array of manifest locations- Returns:
- map where keys are URL's and values are registered plug-ins or plug-in fragments, URL's for unprocessed manifests are not included
- Throws:
ManifestProcessingException
- if manifest processing error has occurred (optional behavior)- See Also:
-
readManifestInfo
Reads basic information from a plug-in or plug-in fragment manifest.- Parameters:
manifest
- manifest data URL- Returns:
- manifest info
- Throws:
ManifestProcessingException
- if manifest data can't be read
-
unregister
Unregisters plug-ins and plug-in fragments with given ID's (including depending plug-ins and plug-in fragments).- Parameters:
ids
- ID's of plug-ins and plug-in fragments to be unregistered- Returns:
- collection of UID's of actually unregistered plug-ins and plug-in fragments
-
getPluginDescriptor
Returns descriptor of plug-in with given ID.
If plug-in descriptor with given ID can't be found or such plug-in exists but is damaged this method have to throw anIllegalArgumentException
. In other words, this method shouldn't returnnull
.- Parameters:
pluginId
- plug-id ID- Returns:
- plug-in descriptor
-
isPluginDescriptorAvailable
Checks if plug-in exists and is in valid state. If this method returnstrue
, the methodgetPluginDescriptor(String)
should always return valid plug-in descriptor.- Parameters:
pluginId
- plug-in ID- Returns:
true
if plug-in exists and valid
-
getPluginDescriptors
Collection<PluginDescriptor> getPluginDescriptors()Returns collection of descriptors of all plug-ins that was successfully populated by this registry.- Returns:
- collection of
PluginDescriptor
objects
-
getExtensionPoint
Looks for extension point. This method have throw anIllegalArgumentException
if requested extension point can't be found or is in invalid state.- Parameters:
pluginId
- plug-in IDpointId
- extension point ID- Returns:
- plug-in extension point
- See Also:
-
getExtensionPoint
Looks for extension point.- Parameters:
uniqueId
- extension point unique ID- Returns:
- plug-in extension point
- See Also:
-
isExtensionPointAvailable
Checks if extension point exists and is in valid state. If this method returnstrue
, the methodgetExtensionPoint(String, String)
should always return valid extension point.- Parameters:
pluginId
- plug-in IDpointId
- extension point ID- Returns:
true
if extension point exists and valid
-
isExtensionPointAvailable
Checks if extension point exists and is in valid state.- Parameters:
uniqueId
- extension point unique ID- Returns:
true
if extension point exists and valid- See Also:
-
getPluginFragments
Collection<PluginFragment> getPluginFragments()Returns collection of descriptors of all plug-in fragments that was successfully populated by this registry.- Returns:
- collection of
PluginFragment
objects
-
getDependingPlugins
Utility method that recursively collects all plug-ins that depends on the given plug-in.- Parameters:
descr
- descriptor of plug-in to collect dependencies for- Returns:
- collection of
plug-in descriptors
that depend on given plug-in
-
checkIntegrity
Performs integrity check of all registered plug-ins and generates result as a collection of standard report items.- Parameters:
pathResolver
- optional path resolver- Returns:
- integrity check report
-
checkIntegrity
Performs integrity check of all registered plug-ins and generates result as a collection of standard report items.- Parameters:
pathResolver
- optional path resolverincludeRegistrationReport
- iftrue
, the plug-ins registration report will be included into resulting report- Returns:
- integrity check report
-
getRegistrationReport
IntegrityCheckReport getRegistrationReport()- Returns:
- plug-ins registration report for this registry
-
makeUniqueId
Constructs unique identifier for some plug-in element from it's ID.- Parameters:
pluginId
- plug-in IDelementId
- element ID- Returns:
- unique ID
-
makeUniqueId
Constructs unique identifier for plug-in with given ID.- Parameters:
pluginId
- plug-in IDversion
- plug-in version identifier- Returns:
- unique plug-in ID
-
extractPluginId
Extracts plug-in ID from some unique identifier.- Parameters:
uniqueId
- unique ID- Returns:
- plug-in ID
-
extractId
Extracts plug-in element ID from some unique identifier.- Parameters:
uniqueId
- unique ID- Returns:
- element ID
-
extractVersion
Extracts plug-in version identifier from some unique identifier (plug-in or plug-in fragment).- Parameters:
uniqueId
- unique ID- Returns:
- plug-in version identifier
-
registerListener
Registers plug-in registry change event listener. If given listener has been registered before, this method should throw anIllegalArgumentException
.- Parameters:
listener
- new registry change event listener
-
unregisterListener
Unregisters registry change event listener. If given listener hasn't been registered before, this method should throw anIllegalArgumentException
.- Parameters:
listener
- registered listener
-
configure
Configures this registry instance. Usually this method is called fromobject factory
implementation.- Parameters:
config
- registry configuration data
-