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 type
E - the GenericEntity type
C - the GenericEntityOwnershipChange type
G - the GenericEntityOwnershipListener type
S - the GenericEntityOwnershipService type
R - 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 Details

    • AbstractClusterSingletonServiceProviderImpl

      protected AbstractClusterSingletonServiceProviderImpl(@NonNull S entityOwnershipService)
      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 registers ClusterSingletonService to Provider. Method returns RuntimeException 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 in ClusterSingletonService. RuntimeException implementation is a hotfix for an unwanted API contract changes in boron release only.
      Specified by:
      registerClusterSingletonService in interface ClusterSingletonServiceProvider
      Parameters:
      service - ClusterSingletonService instance
      Returns:
      AutoCloseable registration
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • ownershipChanged

      public final void ownershipChanged(C ownershipChange)
      Description copied from interface: GenericEntityOwnershipListener
      A notification that is generated when the ownership status of an entity changes.
      Specified by:
      ownershipChanged in interface GenericEntityOwnershipListener<P extends HierarchicalIdentifier<P>,E extends GenericEntity<P>>
      Parameters:
      ownershipChange - contains the entity and its ownership change state
    • registerListener

      protected abstract R registerListener(String entityType, S entityOwnershipServiceInst)
      Method implementation registers a defined GenericEntityOwnershipListenerRegistration type EntityOwnershipListenerRegistration.
      Parameters:
      entityType - the type of the entity
      entityOwnershipServiceInst - - EOS type
      Returns:
      instance of EntityOwnershipListenerRegistration
    • createEntity

      protected abstract E createEntity(String entityType, String entityIdentifier)
      Creates an extended GenericEntity instance.
      Parameters:
      entityType - the type of the entity
      entityIdentifier - the identifier of the entity
      Returns:
      instance of Entity extended GenericEntity type
    • getServiceIdentifierFromEntity

      protected abstract String getServiceIdentifierFromEntity(E entity)
      Method is responsible for parsing ServiceGroupIdentifier from E entity.
      Parameters:
      entity - instance of GenericEntity type
      Returns:
      ServiceGroupIdentifier parsed from entity key value.