|
JPF 1.5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PluginRegistry
Root interface to get access to all meta-information about discovered
plug-ins. All objects accessible from the registry are immutable. You can
imagine registry as a read-only storage of full information about discovered
plug-ins. There is only one exception from this rule: internal state of
registry, plug-in descriptors and plug-in elements can be modified indirectly
by 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)
.
ObjectFactory.createRegistry()
Nested Class Summary | |
---|---|
static interface |
PluginRegistry.RegistryChangeData
Registry changes data holder interface. |
static interface |
PluginRegistry.RegistryChangeListener
Plug-in registry changes callback interface. |
Method Summary | |
---|---|
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. |
java.lang.String |
extractId(java.lang.String uniqueId)
Extracts plug-in element ID from some unique identifier. |
java.lang.String |
extractPluginId(java.lang.String uniqueId)
Extracts plug-in ID from some unique identifier. |
Version |
extractVersion(java.lang.String uniqueId)
Extracts plug-in version identifier from some unique identifier (plug-in or plug-in fragment). |
java.util.Collection<PluginDescriptor> |
getDependingPlugins(PluginDescriptor descr)
Utility method that recursively collects all plug-ins that depends on the given plug-in. |
ExtensionPoint |
getExtensionPoint(java.lang.String uniqueId)
Looks for extension point. |
ExtensionPoint |
getExtensionPoint(java.lang.String pluginId,
java.lang.String pointId)
Looks for extension point. |
PluginDescriptor |
getPluginDescriptor(java.lang.String pluginId)
Returns descriptor of plug-in with given ID. |
java.util.Collection<PluginDescriptor> |
getPluginDescriptors()
Returns collection of descriptors of all plug-ins that was successfully populated by this registry. |
java.util.Collection<PluginFragment> |
getPluginFragments()
Returns collection of descriptors of all plug-in fragments that was successfully populated by this registry. |
IntegrityCheckReport |
getRegistrationReport()
|
boolean |
isExtensionPointAvailable(java.lang.String uniqueId)
Checks if extension point exists and is in valid state. |
boolean |
isExtensionPointAvailable(java.lang.String pluginId,
java.lang.String pointId)
Checks if extension point exists and is in valid state. |
boolean |
isPluginDescriptorAvailable(java.lang.String pluginId)
Checks if plug-in exists and is in valid state. |
java.lang.String |
makeUniqueId(java.lang.String pluginId,
java.lang.String elementId)
Constructs unique identifier for some plug-in element from it's ID. |
java.lang.String |
makeUniqueId(java.lang.String pluginId,
Version version)
Constructs unique identifier for plug-in with given ID. |
ManifestInfo |
readManifestInfo(java.net.URL manifest)
Reads basic information from a plug-in or plug-in fragment manifest. |
java.util.Map<java.lang.String,Identity> |
register(java.net.URL[] manifests)
Registers plug-ins and plug-in fragments in this registry. |
void |
registerListener(PluginRegistry.RegistryChangeListener listener)
Registers plug-in registry change event listener. |
java.util.Collection<java.lang.String> |
unregister(java.lang.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. |
Method Detail |
---|
java.util.Map<java.lang.String,Identity> register(java.net.URL[] manifests) throws ManifestProcessingException
PluginManager
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.
manifests
- array of manifest locations
ManifestProcessingException
- if manifest processing error has occurred (optional behavior)PluginManager.publishPlugins(PluginManager.PluginLocation[])
ManifestInfo readManifestInfo(java.net.URL manifest) throws ManifestProcessingException
manifest
- manifest data URL
ManifestProcessingException
- if manifest data can't be readjava.util.Collection<java.lang.String> unregister(java.lang.String[] ids)
ids
- ID's of plug-ins and plug-in fragments to be unregistered
PluginDescriptor getPluginDescriptor(java.lang.String pluginId)
IllegalArgumentException
. In other words, this method shouldn't
return null
.
pluginId
- plug-id ID
boolean isPluginDescriptorAvailable(java.lang.String pluginId)
true
, the method getPluginDescriptor(String)
should always return valid plug-in descriptor.
pluginId
- plug-in ID
true
if plug-in exists and validjava.util.Collection<PluginDescriptor> getPluginDescriptors()
PluginDescriptor
objectsExtensionPoint getExtensionPoint(java.lang.String pluginId, java.lang.String pointId)
IllegalArgumentException
if requested extension point can't be
found or is in invalid state.
pluginId
- plug-in IDpointId
- extension point ID
ExtensionPoint.isValid()
ExtensionPoint getExtensionPoint(java.lang.String uniqueId)
uniqueId
- extension point unique ID
getExtensionPoint(String, String)
boolean isExtensionPointAvailable(java.lang.String pluginId, java.lang.String pointId)
true
, the method
getExtensionPoint(String, String)
should always return valid
extension point.
pluginId
- plug-in IDpointId
- extension point ID
true
if extension point exists and validboolean isExtensionPointAvailable(java.lang.String uniqueId)
uniqueId
- extension point unique ID
true
if extension point exists and validisExtensionPointAvailable(String, String)
java.util.Collection<PluginFragment> getPluginFragments()
PluginFragment
objectsjava.util.Collection<PluginDescriptor> getDependingPlugins(PluginDescriptor descr)
descr
- descriptor of plug-in to collect dependencies for
plug-in descriptors
that
depend on given plug-inIntegrityCheckReport checkIntegrity(PathResolver pathResolver)
pathResolver
- optional path resolver
IntegrityCheckReport checkIntegrity(PathResolver pathResolver, boolean includeRegistrationReport)
pathResolver
- optional path resolverincludeRegistrationReport
- if true
, the plug-ins registration report will
be included into resulting report
IntegrityCheckReport getRegistrationReport()
java.lang.String makeUniqueId(java.lang.String pluginId, java.lang.String elementId)
pluginId
- plug-in IDelementId
- element ID
java.lang.String makeUniqueId(java.lang.String pluginId, Version version)
pluginId
- plug-in IDversion
- plug-in version identifier
java.lang.String extractPluginId(java.lang.String uniqueId)
uniqueId
- unique ID
java.lang.String extractId(java.lang.String uniqueId)
uniqueId
- unique ID
Version extractVersion(java.lang.String uniqueId)
uniqueId
- unique ID
void registerListener(PluginRegistry.RegistryChangeListener listener)
IllegalArgumentException
.
listener
- new registry change event listenervoid unregisterListener(PluginRegistry.RegistryChangeListener listener)
IllegalArgumentException
.
listener
- registered listenervoid configure(ExtendedProperties config)
object factory
implementation.
config
- registry configuration data
|
JPF 1.5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |