Class AbstractClusterSingletonServiceProviderImpl<P extends HierarchicalIdentifier<P>,E extends GenericEntity<P>,C extends GenericEntityOwnershipChange<P,E>,G extends GenericEntityOwnershipListener<P,C>,S extends GenericEntityOwnershipService<P,E,G>,R extends GenericEntityOwnershipListenerRegistration<P,G>>
java.lang.Object
org.opendaylight.mdsal.singleton.dom.impl.AbstractClusterSingletonServiceProviderImpl<P,E,C,G,S,R>
- Type Parameters:
P
- the instance identifier path typeE
- the GenericEntity typeC
- the GenericEntityOwnershipChange typeG
- the GenericEntityOwnershipListener typeS
- the GenericEntityOwnershipService typeR
- the GenericEntityOwnershipListenerRegistration type
- All Implemented Interfaces:
AutoCloseable
,GenericEntityOwnershipListener<P,
,C> ClusterSingletonServiceProvider
- Direct Known Subclasses:
DOMClusterSingletonServiceProviderImpl
public abstract class AbstractClusterSingletonServiceProviderImpl<P extends HierarchicalIdentifier<P>,E extends GenericEntity<P>,C extends GenericEntityOwnershipChange<P,E>,G extends GenericEntityOwnershipListener<P,C>,S extends GenericEntityOwnershipService<P,E,G>,R extends GenericEntityOwnershipListenerRegistration<P,G>>
extends Object
implements ClusterSingletonServiceProvider, GenericEntityOwnershipListener<P,C>
Abstract class
AbstractClusterSingletonServiceProviderImpl
represents implementations of
ClusterSingletonServiceProvider
and it implements GenericEntityOwnershipListener
for providing OwnershipChange for all registered ClusterSingletonServiceGroup
entity
candidate.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractClusterSingletonServiceProviderImpl
(@NonNull S entityOwnershipService) Class constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
close()
protected abstract E
createEntity
(String entityType, String entityIdentifier) Creates an extendedGenericEntity
instance.protected abstract String
getServiceIdentifierFromEntity
(E entity) Method is responsible for parsing ServiceGroupIdentifier from E entity.final void
This method must be called once on startup to initialize this provider.final void
ownershipChanged
(C ownershipChange) A notification that is generated when the ownership status of an entity changes.Method registersClusterSingletonService
to Provider.protected abstract R
registerListener
(String entityType, S entityOwnershipServiceInst) Method implementation registers a definedGenericEntityOwnershipListenerRegistration
type EntityOwnershipListenerRegistration.
-
Constructor Details
-
AbstractClusterSingletonServiceProviderImpl
Class constructor.- Parameters:
entityOwnershipService
- relevant EOS
-
-
Method Details
-
initializeProvider
public final void initializeProvider()This method must be called once on startup to initialize this provider. -
registerClusterSingletonService
public final ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) Description copied from interface:ClusterSingletonServiceProvider
Method registersClusterSingletonService
to Provider. Method returnsRuntimeException
for unexpected state, so be careful with implementation. Note: RuntimeException is implemented as a notification about some problems with registration and client has to implement some strategy for handling this issue. TODO: RuntimeException is not a transparent contract for handling unexpected state and it needs to be replaced with a specific documented Exception or it needs to add another contract definition for a client notification about the unexpected state reason inClusterSingletonService
. RuntimeException implementation is a hotfix for an unwanted API contract changes in boron release only.- Specified by:
registerClusterSingletonService
in interfaceClusterSingletonServiceProvider
- Parameters:
service
- ClusterSingletonService instance- Returns:
AutoCloseable
registration
-
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
-
ownershipChanged
Description copied from interface:GenericEntityOwnershipListener
A notification that is generated when the ownership status of an entity changes.- Specified by:
ownershipChanged
in interfaceGenericEntityOwnershipListener<P extends HierarchicalIdentifier<P>,
E extends GenericEntity<P>> - Parameters:
ownershipChange
- contains the entity and its ownership change state
-
registerListener
Method implementation registers a definedGenericEntityOwnershipListenerRegistration
type EntityOwnershipListenerRegistration.- Parameters:
entityType
- the type of the entityentityOwnershipServiceInst
- - EOS type- Returns:
- instance of EntityOwnershipListenerRegistration
-
createEntity
Creates an extendedGenericEntity
instance.- Parameters:
entityType
- the type of the entityentityIdentifier
- the identifier of the entity- Returns:
- instance of Entity extended GenericEntity type
-
getServiceIdentifierFromEntity
Method is responsible for parsing ServiceGroupIdentifier from E entity.- Parameters:
entity
- instance of GenericEntity type- Returns:
- ServiceGroupIdentifier parsed from entity key value.
-