java.lang.Object
org.odpi.openmetadata.repositoryservices.events.OMRSRegistryEventProcessor
org.odpi.openmetadata.repositoryservices.metadatahighway.cohortregistry.OMRSCohortRegistry
All Implemented Interfaces:
OMRSRegistryEventProcessorInterface

public class OMRSCohortRegistry extends OMRSRegistryEventProcessor
OMRSCohortRegistry manages the local server's registration into a cohort and receives registration requests from other servers in the cohort. This management involves:
  • Sending and receiving registry events that contain registration information about the members of the cohort.
  • Maintaining details of the local server's and other remote server's registration information in the cohort registry store to use for server restart.
  • Configuring the federation services (OMRS Connection Manager and Enterprise OMRS Connector) with information about the other servers in the cohort as they register and unregister from the cohort.
Within a server, there is a single instance of the cohort registry for each cohort that the server joins.
  • Constructor Details

    • OMRSCohortRegistry

      public OMRSCohortRegistry(AuditLog auditLog)
      Default constructor that relies on the initialization of variables in the declaration.
      Parameters:
      auditLog - audit log for this component.
  • Method Details

    • initialize

      public void initialize(String cohortName, String localMetadataCollectionId, String localMetadataCollectionName, OMRSLocalRepository localRepository, String localServerName, String localServerType, String localOrganizationName, OMRSRegistryEventProcessor registryEventProcessor, OMRSCohortRegistryStore cohortRegistryStore, OMRSConnectionConsumer connectionConsumer)
      Initialize the cohort registry object. The parameters passed control its behavior.
      Parameters:
      cohortName - the name of the cohort that this cohort registry is communicating with.
      localMetadataCollectionId - configured value for the local metadata collection id may be null if no local repository.
      localMetadataCollectionName - display name for the local metadata collection
      localRepository - the optional local repository.
      localServerName - the name of the local server. It is a descriptive name for informational purposes.
      localServerType - the type of the local server. It is a descriptive name for informational purposes.
      localOrganizationName - the name of the organization that owns the local server/repository. It is a descriptive name for informational purposes.
      registryEventProcessor - used to send outbound registry events to the cohort.
      cohortRegistryStore - the cohort registry store where details of members of the cohort are kept.
      connectionConsumer - The connection consumer is a component interested in maintaining details of the connections to each of the members of the open metadata repository cohort. If it is null, the cohort registry does not publish connections for members of the open metadata repository cohort.
    • connectToCohort

      public void connectToCohort()
      A new server needs to register the metadataCollectionId for its metadata repository with the other servers in the open metadata repository. It only needs to do this once and uses a timestamp to record that the registration event has been sent. If the server has already registered in the past, it sends a registration request.
    • getLocalRegistration

      public MemberRegistration getLocalRegistration()
      Return the local registration for this cohort.
      Returns:
      list of member registrations
    • getRemoteMembers

      public List<MemberRegistration> getRemoteMembers()
      Return the remote members for this cohort.
      Returns:
      list of member registrations
    • disconnectFromCohort

      public void disconnectFromCohort(boolean unregister)
      Close the connection to the registry store.
      Parameters:
      unregister - boolean flag indicating whether the disconnection also includes unregistration from the cohort. If it is set to true, the OMRS Cohort will inform the other members of the cohort that it is leaving and remove all information about the cohort from the cohort registry store.
    • processRegistrationEvent

      public boolean processRegistrationEvent(String sourceName, String originatorMetadataCollectionId, String originatorMetadataCollectionName, String originatorServerName, String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, Connection remoteConnection)
      Introduces a new server/repository to the metadata repository cohort.
      Specified by:
      processRegistrationEvent in interface OMRSRegistryEventProcessorInterface
      Specified by:
      processRegistrationEvent in class OMRSRegistryEventProcessor
      Parameters:
      sourceName - name of the source of the event. It may be the cohort name for incoming events or the local repository, or event mapper name.
      originatorMetadataCollectionId - unique identifier for the metadata collection that is registering with the cohort.
      originatorMetadataCollectionName - display for the metadata collection that is registering with the cohort.
      originatorServerName - name of the server that the event came from.
      originatorServerType - type of server that the event came from.
      originatorOrganizationName - name of the organization that owns the server that sent the event.
      registrationTimestamp - the time that the server/repository issued the registration request.
      remoteConnection - the Connection properties for the connector used to call the registering server.
      Returns:
      flag indicating if the event was sent or not.
    • processReRegistrationEvent

      public boolean processReRegistrationEvent(String sourceName, String originatorMetadataCollectionId, String originatorMetadataCollectionName, String originatorServerName, String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, Connection remoteConnection)
      Refreshes the other servers in the cohort with the originator server's registration.
      Specified by:
      processReRegistrationEvent in interface OMRSRegistryEventProcessorInterface
      Specified by:
      processReRegistrationEvent in class OMRSRegistryEventProcessor
      Parameters:
      sourceName - name of the source of the event. It may be the cohort name for incoming events or the local repository, or event mapper name.
      originatorMetadataCollectionId - unique identifier for the metadata collection that is registering with the cohort.
      originatorMetadataCollectionName - display name for the metadata collection that is registering with the cohort.
      originatorServerName - name of the server that the event came from.
      originatorServerType - type of server that the event came from.
      originatorOrganizationName - name of the organization that owns the server that sent the event.
      registrationTimestamp - the time that the server/repository first registered with the cohort.
      remoteConnection - the Connection properties for the connector used to call the registering server.
      Returns:
      flag indicating if the event was sent or not.
    • processRegistrationRefreshRequest

      public boolean processRegistrationRefreshRequest(String sourceName, String originatorServerName, String originatorServerType, String originatorOrganizationName)
      Requests that the other servers in the cohort send re-registration events.
      Specified by:
      processRegistrationRefreshRequest in interface OMRSRegistryEventProcessorInterface
      Specified by:
      processRegistrationRefreshRequest in class OMRSRegistryEventProcessor
      Parameters:
      sourceName - name of the source of the event. It may be the cohort name for incoming events or the local repository, or event mapper name.
      originatorServerName - name of the server that the event came from.
      originatorServerType - type of server that the event came from.
      originatorOrganizationName - name of the organization that owns the server that sent the event.
      Returns:
      flag indicating if the event was sent or not.
    • processUnRegistrationEvent

      public boolean processUnRegistrationEvent(String sourceName, String originatorMetadataCollectionId, String originatorMetadataCollectionName, String originatorServerName, String originatorServerType, String originatorOrganizationName)
      A server/repository is being removed from the metadata repository cohort.
      Specified by:
      processUnRegistrationEvent in interface OMRSRegistryEventProcessorInterface
      Specified by:
      processUnRegistrationEvent in class OMRSRegistryEventProcessor
      Parameters:
      sourceName - name of the source of the event. It may be the cohort name for incoming events or the local repository, or event mapper name.
      originatorMetadataCollectionId - metadata collectionId of originator.
      originatorMetadataCollectionName - display name of metadata collection of originator.
      originatorServerName - name of the server that the event came from.
      originatorServerType - type of server that the event came from.
      originatorOrganizationName - name of the organization that owns the server that sent the event.
      Returns:
      flag indicating if the event was sent or not.
    • processConflictingCollectionIdEvent

      public void processConflictingCollectionIdEvent(String sourceName, String originatorMetadataCollectionId, String originatorMetadataCollectionName, String originatorServerName, String originatorServerType, String originatorOrganizationName, String conflictingMetadataCollectionId, String errorMessage)
      There is more than one member of the open metadata repository cohort that is using the same metadata collection id. This means that their metadata instances can be updated in more than one server and there is a potential for data integrity issues.
      Specified by:
      processConflictingCollectionIdEvent in interface OMRSRegistryEventProcessorInterface
      Specified by:
      processConflictingCollectionIdEvent in class OMRSRegistryEventProcessor
      Parameters:
      sourceName - name of the source of the event. It may be the cohort name for incoming events or the local repository, or event mapper name.
      originatorMetadataCollectionId - metadata collectionId of originator.
      originatorMetadataCollectionName - display name of metadata collection of originator.
      originatorServerName - name of the server that the event came from.
      originatorServerType - type of server that the event came from.
      originatorOrganizationName - name of the organization that owns the server that sent the event.
      conflictingMetadataCollectionId - unique identifier for the metadata collection that is registering with the cohort.
      errorMessage - details of the conflict
    • processBadConnectionEvent

      public void processBadConnectionEvent(String sourceName, String originatorMetadataCollectionId, String originatorMetadataCollectionName, String originatorServerName, String originatorServerType, String originatorOrganizationName, String targetMetadataCollectionId, Connection remoteRepositoryConnection, String errorMessage)
      A connection to one of the members of the open metadata repository cohort is not usable by one of the members.
      Specified by:
      processBadConnectionEvent in interface OMRSRegistryEventProcessorInterface
      Specified by:
      processBadConnectionEvent in class OMRSRegistryEventProcessor
      Parameters:
      sourceName - name of the source of the event. It may be the cohort name for incoming events or the local repository, or event mapper name.
      originatorMetadataCollectionId - metadata collectionId of originator.
      originatorMetadataCollectionName - display name of metadata collection of originator.
      originatorServerName - name of the server that the event came from.
      originatorServerType - type of server that the event came from.
      originatorOrganizationName - name of the organization that owns the server that sent the event.
      targetMetadataCollectionId - id for the repository with the bad remote connection.
      remoteRepositoryConnection - the Connection properties for the connector used to call the registering server.
      errorMessage - details of the error that occurs when the connection is used.
    • toString

      public String toString()
      Standard toString method.
      Overrides:
      toString in class Object
      Returns:
      JSON style description of variables.