Class OMRSEnterpriseConnectorManager

java.lang.Object
org.odpi.openmetadata.repositoryservices.enterprise.connectormanager.OMRSEnterpriseConnectorManager
All Implemented Interfaces:
OMRSConnectionConsumer, OMRSConnectorManager

public class OMRSEnterpriseConnectorManager extends Object implements OMRSConnectionConsumer, OMRSConnectorManager
OMRSEnterpriseConnectorManager provides the connectors for all the repositories in the connected metadata repository cohorts to each of the registered connector consumers. It supports:
  • A single local repository connector.
  • A remote repository connector for each of the other repositories in the open metadata repository cohort.

Connector instances are then passed to each of the registered connector consumers.

The operation of the OMRSEnterpriseConnectorManager can be thought of in terms of its 3 contract interfaces:

  • OMRSConnectionConsumer is the interface for passing connections to the OMRSEnterpriseConnectorManager. New connections are validated by creating a test connector and the combination of the metadata collection id and connection are stored. An instance of the connector is passed to each of the registered connector consumers.
  • OMRSConnectorManager is the interface that enables OMRSConnectorConsumers to register with the federation manager. When new connector consumers are stored their reference is stored and a uniqueId is returned to the connector consumer. This id can be used to unregister from the connector manager.
  • OMRSConnectorConsumer is the interface that the federation manager uses to pass connectors to each registered connector consumer. The connector for the local repository is typically passed first (if it is available) followed by the remote connectors.

With these interfaces, the OMRSEnterpriseConnectorManager acts as a go between the OMRSCohortRegistry and the EnterpriseOMRSRepositoryConnector instances.

Note: this class uses synchronized methods to ensure that no registration information is lost when the server is operating multi-threaded.

  • Constructor Details

    • OMRSEnterpriseConnectorManager

      public OMRSEnterpriseConnectorManager(boolean enterpriseAccessEnabled, int maxPageSize, OMRSRepositoryContentManager repositoryContentManager, AuditLog auditLog, String localServerUserId, String localServerPassword)
      Constructor for the enterprise connector manager.
      Parameters:
      enterpriseAccessEnabled - boolean indicating whether the connector consumers should be informed of remote connectors. If enterpriseAccessEnabled = true the connector consumers will be informed of remote connectors; otherwise they will not.
      maxPageSize - the maximum number of elements that can be requested on a page.
      repositoryContentManager - repository content manager used by the connectors.
      auditLog - audit log to act as a factory for connector audit logs.
      localServerUserId - userId for the local server
      localServerPassword - password for the local server
  • Method Details

    • isEnterpriseAccessEnabled

      public boolean isEnterpriseAccessEnabled()
      Returns boolean indicating whether the enterprise connector manager should pass on details about remote members of the cohort to the connector consumers or not. (This capability allows the OMASs to be configured to work only with the local repository and not perform federated queries.)
      Returns:
      boolean - true means that the registered connector consumers will receive information about remote connectors enabling federated queries across the cohort members. False means all queries will be directed to the local repository only.
    • disconnect

      public void disconnect() throws ConnectorCheckedException
      The disconnect processing involves disconnecting the local connector then unregistering all remote repositories with each of the connector consumers. Each connector consumer will pass the disconnect() request to each of their repository connector instances. If there is an error during disconnect of the local connector, it is logged here and re-thrown to generate an audit log entry.
      Throws:
      ConnectorCheckedException - exception from the connector
    • setLocalConnector

      public void setLocalConnector(String localMetadataCollectionId, LocalOMRSRepositoryConnector localRepositoryConnector)
      Pass details of the connection for the local repository to the connection consumer.
      Parameters:
      localMetadataCollectionId - Unique identifier for the metadata collection
      localRepositoryConnector - connector to the local repository
    • addRemoteConnection

      public void addRemoteConnection(String cohortName, String remoteServerName, String remoteServerType, String owningOrganizationName, String metadataCollectionId, String metadataCollectionName, Connection remoteConnection) throws ConnectionCheckedException, ConnectorCheckedException
      Pass details of the connection for one of the remote repositories registered in a connected open metadata repository cohort.
      Specified by:
      addRemoteConnection in interface OMRSConnectionConsumer
      Parameters:
      cohortName - name of the cohort adding the remote connection.
      remoteServerName - name of the remote server for this connection.
      remoteServerType - type of the remote server.
      owningOrganizationName - name of the organization the owns the remote server.
      metadataCollectionId - Unique identifier for the metadata collection
      metadataCollectionName - Display name for the metadata collection
      remoteConnection - Connection object providing properties necessary to create an OMRSRepositoryConnector for the remote repository.
      Throws:
      ConnectionCheckedException - there are invalid properties in the Connection
      ConnectorCheckedException - there is a problem initializing the Connector
    • removeRemoteConnection

      public void removeRemoteConnection(String cohortName, String metadataCollectionId)
      Pass details that identify the connection for the repository that has left one of the open metadata repository cohorts. Since any repository may be a member of multiple cohorts, we only remove it from the list if it is the last connector for this repository to be removed.
      Specified by:
      removeRemoteConnection in interface OMRSConnectionConsumer
      Parameters:
      cohortName - name of the cohort removing the remote connection.
      metadataCollectionId - Unique identifier for the metadata collection.
    • removeCohort

      public void removeCohort(String cohortName)
      Remove all the remote connections for the requested open metadata repository cohort. Care must be taken to only remove the remote connectors from the registered connector consumers if the remote connection is only registered with this cohort.
      Specified by:
      removeCohort in interface OMRSConnectionConsumer
      Parameters:
      cohortName - name of the cohort
    • registerConnectorConsumer

      public String registerConnectorConsumer(OMRSConnectorConsumer connectorConsumer)
      Register the supplied connector consumer with the connector manager. During the registration request, the connector manager will pass the connector to the local repository and the connectors to all currently registered remote repositories. Once successfully registered the connector manager will call the connector consumer each time the repositories in the open metadata repository cohort changes.
      Specified by:
      registerConnectorConsumer in interface OMRSConnectorManager
      Parameters:
      connectorConsumer - OMRSConnectorConsumer interested in details of the connectors to all repositories registered in the open metadata repository cohort.
      Returns:
      String identifier for the connectorConsumer used for the call to unregister.
    • unregisterConnectorConsumer

      public void unregisterConnectorConsumer(String connectorConsumerId)
      Unregister a connector consumer from the connector manager, so it is no longer informed of changes to the open metadata repository cohort.
      Specified by:
      unregisterConnectorConsumer in interface OMRSConnectorManager
      Parameters:
      connectorConsumerId - String identifier of the connector consumer returned on the registerConnectorConsumer.