org.electrocodeogram.cpc.core.api.provider.registry
Interface IProviderRegistry

All Known Subinterfaces:
IManagableProviderRegistry

public interface IProviderRegistry

The IProviderRegistry is the central point of integration for most CPC plugins/extensions. In order to allow loose coupling and easy replacement of the different CPC subsystem implementations this interface provides a central registry service which CPC subsystems use to acquire provider instances for the different CPC subsystem services.

I.e. the CPC Track plugin will use the lookupProvider() method to receive a CPC Store implementation which is then used for local clone storage.

Provider classes are never addressed directly, all interaction between IProviderRegistry based CPC subsystems should occur only via org.electrocodeogram.cpc.core.api interfaces or 3rd party API interfaces for new provider types.

A reference to the currently active IProviderRegistry instance can be obtained via CPCCorePlugin.getProviderRegistry().

NOTE: Any class implementing this interface should also implement IManagableProviderRegistry.

Author:
vw
See Also:
CPCCorePlugin.getProviderRegistry(), DefaultProviderRegistry, IManagableProviderRegistry, IManagableProvider

Method Summary
 IProvider lookupProvider(java.lang.Class<? extends IProvider> providerType)
          Returns the provider with the highest priority for the given type.
 IProvider lookupProvider(IProviderDescriptor providerDescriptor)
          Returns an instance of the provider which corresponds to the given IProviderDescriptor.
 java.util.List<IProviderDescriptor> lookupProviders(java.lang.Class<? extends IProvider> providerType)
          Returns a list of descriptors for all registered providers of the given type, ordered descending according to priority.
 

Method Detail

lookupProvider

IProvider lookupProvider(java.lang.Class<? extends IProvider> providerType)
Returns the provider with the highest priority for the given type.

Any non-null result is guaranteed to be castable to the given providerType.

Parameters:
providerType - the type of the provider to lookup, never null
Returns:
provider of providerType type or NULL if no such provider was found.

lookupProvider

IProvider lookupProvider(IProviderDescriptor providerDescriptor)
Returns an instance of the provider which corresponds to the given IProviderDescriptor.

The IProviderDescriptor needs to be compatible with the IProviderRegistry implementation.
Custom implementations of IProviderDescriptor are not supported.

Parameters:
providerDescriptor - a valid IProviderDescriptor, never null.
Returns:
provider of the corresponding type or NULL if no such provider was found.
See Also:
lookupProvider(Class), IProviderDescriptor

lookupProviders

java.util.List<IProviderDescriptor> lookupProviders(java.lang.Class<? extends IProvider> providerType)
Returns a list of descriptors for all registered providers of the given type, ordered descending according to priority.
I.e the first element of the list is the descriptor of the provider with the highest priority (the one which would be returned by lookupProvider()).

An instance for a given IProviderDescriptor can be obtained by calling lookupProvider(IProviderDescriptor).

Parameters:
providerType - the type of the provider to lookup, never null
Returns:
list of descriptors for all providers type providerType or empty list if no such providers were found, never null.
See Also:
lookupProvider(IProviderDescriptor), IProviderDescriptor