Package org.onosproject.net.provider
Class AbstractProviderRegistry<P extends Provider,S extends ProviderService<P>>
- java.lang.Object
-
- org.onosproject.net.provider.AbstractProviderRegistry<P,S>
-
- Type Parameters:
P
- type of the information providerS
- type of the provider service
- All Implemented Interfaces:
ProviderRegistry<P,S>
- Direct Known Subclasses:
AbstractListenerProviderRegistry
public abstract class AbstractProviderRegistry<P extends Provider,S extends ProviderService<P>> extends Object implements ProviderRegistry<P,S>
Base implementation of provider registry.
-
-
Constructor Summary
Constructors Constructor Description AbstractProviderRegistry()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract S
createProviderService(P provider)
Creates a new provider service bound to the specified provider.protected P
defaultProvider()
Returns the default fall-back provider.protected P
getProvider(String scheme)
Returns the provider registered with the specified scheme.protected P
getProvider(DeviceId deviceId)
Returns the provider for the specified device ID based on URI scheme.protected P
getProvider(ProviderId providerId)
Returns the provider registered with the specified provider ID or null if none is found for the given provider family and default fall-back is not supported.Set<ProviderId>
getProviders()
Returns a set of currently registered provider identities.S
register(P provider)
Registers the supplied provider with the core.void
unregister(P provider)
Unregisters the supplied provider.
-
-
-
Method Detail
-
createProviderService
protected abstract S createProviderService(P provider)
Creates a new provider service bound to the specified provider.- Parameters:
provider
- provider- Returns:
- provider service
-
defaultProvider
protected P defaultProvider()
Returns the default fall-back provider. Default implementation return null.- Returns:
- default provider
-
register
public S register(P provider)
Description copied from interface:ProviderRegistry
Registers the supplied provider with the core.- Specified by:
register
in interfaceProviderRegistry<P extends Provider,S extends ProviderService<P>>
- Parameters:
provider
- provider to be registered- Returns:
- provider service for injecting information into core
-
unregister
public void unregister(P provider)
Description copied from interface:ProviderRegistry
Unregisters the supplied provider. As a result the previously issued provider service will be invalidated and any subsequent invocations of its methods may throwIllegalStateException
.Unregistering a provider that has not been previously registered results in a no-op.
- Specified by:
unregister
in interfaceProviderRegistry<P extends Provider,S extends ProviderService<P>>
- Parameters:
provider
- provider to be unregistered
-
getProviders
public Set<ProviderId> getProviders()
Description copied from interface:ProviderRegistry
Returns a set of currently registered provider identities.- Specified by:
getProviders
in interfaceProviderRegistry<P extends Provider,S extends ProviderService<P>>
- Returns:
- set of provider identifiers
-
getProvider
protected P getProvider(ProviderId providerId)
Returns the provider registered with the specified provider ID or null if none is found for the given provider family and default fall-back is not supported.- Parameters:
providerId
- provider identifier- Returns:
- provider
-
getProvider
protected P getProvider(DeviceId deviceId)
Returns the provider for the specified device ID based on URI scheme.- Parameters:
deviceId
- device identifier- Returns:
- provider bound to the URI scheme
-
-