Interface PluginRegistry

All Known Implementing Classes:
MockPluginRegistry, PluginRegistryImpl

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 UniqueIdentityinterface.

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:
  • Method Details

    • register

      Map<String,Identity> register(URL[] manifests) throws ManifestProcessingException
      Registers plug-ins and plug-in fragments in this registry. Note that this method not makes plug-ins available for activation by any 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.

      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

      ManifestInfo readManifestInfo(URL manifest) throws ManifestProcessingException
      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

      Collection<String> unregister(String[] ids)
      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

      PluginDescriptor getPluginDescriptor(String pluginId)
      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 an IllegalArgumentException. In other words, this method shouldn't return null.
      Parameters:
      pluginId - plug-id ID
      Returns:
      plug-in descriptor
    • isPluginDescriptorAvailable

      boolean isPluginDescriptorAvailable(String pluginId)
      Checks if plug-in exists and is in valid state. If this method returns true, the method getPluginDescriptor(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

      ExtensionPoint getExtensionPoint(String pluginId, String pointId)
      Looks for extension point. This method have throw an IllegalArgumentException if requested extension point can't be found or is in invalid state.
      Parameters:
      pluginId - plug-in ID
      pointId - extension point ID
      Returns:
      plug-in extension point
      See Also:
    • getExtensionPoint

      ExtensionPoint getExtensionPoint(String uniqueId)
      Looks for extension point.
      Parameters:
      uniqueId - extension point unique ID
      Returns:
      plug-in extension point
      See Also:
    • isExtensionPointAvailable

      boolean isExtensionPointAvailable(String pluginId, String pointId)
      Checks if extension point exists and is in valid state. If this method returns true, the method getExtensionPoint(String, String) should always return valid extension point.
      Parameters:
      pluginId - plug-in ID
      pointId - extension point ID
      Returns:
      true if extension point exists and valid
    • isExtensionPointAvailable

      boolean isExtensionPointAvailable(String uniqueId)
      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

      Collection<PluginDescriptor> getDependingPlugins(PluginDescriptor descr)
      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

      IntegrityCheckReport checkIntegrity(PathResolver pathResolver)
      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

      IntegrityCheckReport checkIntegrity(PathResolver pathResolver, boolean includeRegistrationReport)
      Performs integrity check of all registered plug-ins and generates result as a collection of standard report items.
      Parameters:
      pathResolver - optional path resolver
      includeRegistrationReport - if true, 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

      String makeUniqueId(String pluginId, String elementId)
      Constructs unique identifier for some plug-in element from it's ID.
      Parameters:
      pluginId - plug-in ID
      elementId - element ID
      Returns:
      unique ID
    • makeUniqueId

      String makeUniqueId(String pluginId, Version version)
      Constructs unique identifier for plug-in with given ID.
      Parameters:
      pluginId - plug-in ID
      version - plug-in version identifier
      Returns:
      unique plug-in ID
    • extractPluginId

      String extractPluginId(String uniqueId)
      Extracts plug-in ID from some unique identifier.
      Parameters:
      uniqueId - unique ID
      Returns:
      plug-in ID
    • extractId

      String extractId(String uniqueId)
      Extracts plug-in element ID from some unique identifier.
      Parameters:
      uniqueId - unique ID
      Returns:
      element ID
    • extractVersion

      Version extractVersion(String uniqueId)
      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

      void registerListener(PluginRegistry.RegistryChangeListener listener)
      Registers plug-in registry change event listener. If given listener has been registered before, this method should throw an IllegalArgumentException.
      Parameters:
      listener - new registry change event listener
    • unregisterListener

      void unregisterListener(PluginRegistry.RegistryChangeListener listener)
      Unregisters registry change event listener. If given listener hasn't been registered before, this method should throw an IllegalArgumentException.
      Parameters:
      listener - registered listener
    • configure

      void configure(ExtendedProperties config)
      Configures this registry instance. Usually this method is called from object factory implementation.
      Parameters:
      config - registry configuration data