java.lang.Object
org.odpi.openmetadata.repositoryservices.events.OMRSTypeDefEventProcessor
org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager.OMRSRepositoryContentManager
All Implemented Interfaces:
OMRSTypeDefEventProcessorInterface, OMRSTypeDefManager

public class OMRSRepositoryContentManager extends OMRSTypeDefEventProcessor implements OMRSTypeDefManager
OMRSRepositoryContentManager supports an in-memory cache of TypeDefs for the local server. It is used by the OMRS components for constructing metadata instances with valid types. It ensures that the TypeDefs used in other members of the open metadata repository cohorts that the local server is also a member of are consistent with the local repository. OMRSRepositoryContentManager plays a central role in ensuring the integrity of the metadata in the local repository. It is called from multiple components at different points in the processing. It presents a different interface to each of these components that is specialized to their needs.
  • OMRSTypeDefEventProcessor: processes inbound events from remote members of the open metadata repository cohorts that the local repository is connected to. These incoming TypeDef events need to be validated against the types used locally and either saved or discarded depending on the exchange rule setting.
  • OMRSTypeDefManager: provides maintenance methods for managing the TypeDefs in the local cache.
  • Constructor Details

    • OMRSRepositoryContentManager

      public OMRSRepositoryContentManager(String localServerUserId, AuditLog auditLog)
      Default constructor
      Parameters:
      localServerUserId - userId to use when processing messages
      auditLog - audit log for this component.
  • Method Details

    • setupEventProcessor

      public void setupEventProcessor(LocalOMRSRepositoryConnector localRepositoryConnector, OMRSRepositoryEventManager outboundRepositoryEventManager)
      Saves all the information necessary to process incoming TypeDef events.
      Parameters:
      localRepositoryConnector - connector to the local repository
      outboundRepositoryEventManager - event manager to call for outbound events used to send out reports of conflicting TypeDefs
    • setOpenMetadataTypesOriginGUID

      public void setOpenMetadataTypesOriginGUID(String openMetadataTypesGUID)
      Save the unique identifier of the open metadata archive. This is stored in the origin property of all the open metadata types. It is needed to support the isOpenType() method.
      Parameters:
      openMetadataTypesGUID - unique identifier for the open metadata type's archive
    • addTypeDef

      public void addTypeDef(String sourceName, TypeDef newTypeDef)
      Cache a definition of a new TypeDef. This method assumes the TypeDef has been successfully added to the local repository already and all that is needed is to maintain the cached list of types
      Specified by:
      addTypeDef in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      newTypeDef - TypeDef structure describing the new TypeDef.
    • addAttributeTypeDef

      public void addAttributeTypeDef(String sourceName, AttributeTypeDef newAttributeTypeDef)
      Cache a definition of a new AttributeTypeDef.
      Specified by:
      addAttributeTypeDef in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      newAttributeTypeDef - AttributeTypeDef structure describing the new TypeDef.
    • updateTypeDef

      public void updateTypeDef(String sourceName, TypeDef typeDef)
      Update one or more properties of a cached TypeDef. This method assumes the TypeDef has been successfully updated in the local repository already and all that is needed is to maintain the cached list of types
      Specified by:
      updateTypeDef in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      typeDef - TypeDef structure.
    • deleteTypeDef

      public void deleteTypeDef(String sourceName, String obsoleteTypeDefGUID, String obsoleteTypeDefName)
      Delete a cached TypeDef.
      Specified by:
      deleteTypeDef in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      obsoleteTypeDefGUID - String unique identifier for the TypeDef.
      obsoleteTypeDefName - String unique name for the TypeDef.
    • deleteAttributeTypeDef

      public void deleteAttributeTypeDef(String sourceName, String obsoleteAttributeTypeDefGUID, String obsoleteAttributeTypeDefName)
      Delete a cached AttributeTypeDef.
      Specified by:
      deleteAttributeTypeDef in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      obsoleteAttributeTypeDefGUID - String unique identifier for the AttributeTypeDef.
      obsoleteAttributeTypeDefName - String unique name for the AttributeTypeDef.
    • reIdentifyTypeDef

      public void reIdentifyTypeDef(String sourceName, String originalTypeDefGUID, String originalTypeDefName, TypeDef newTypeDef)
      Change the identifiers for a TypeDef.
      Specified by:
      reIdentifyTypeDef in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging).
      originalTypeDefGUID - TypeDef's original unique identifier.
      originalTypeDefName - TypeDef's original unique name.
      newTypeDef - updated TypeDef with new identifiers.
    • reIdentifyAttributeTypeDef

      public void reIdentifyAttributeTypeDef(String sourceName, String originalAttributeTypeDefGUID, String originalAttributeTypeDefName, AttributeTypeDef newAttributeTypeDef)
      Change the identifiers for an AttributeTypeDef.
      Specified by:
      reIdentifyAttributeTypeDef in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging).
      originalAttributeTypeDefGUID - AttributeTypeDef's original unique identifier.
      originalAttributeTypeDefName - AttributeTypeDef's original unique name.
      newAttributeTypeDef - updated AttributeTypeDef with new identifiers
    • getSuperTypes

      public List<TypeDefLink> getSuperTypes(String sourceName, String typeName, String methodName)
      Evaluate the superTypes for a type. The results are cached in typeDefSuperTypes.
      Parameters:
      sourceName - source of the request (used for logging)
      typeName - name of type to process
      methodName - calling method
      Returns:
      list of supertype links or null if top level
    • getInstanceType

      public InstanceType getInstanceType(String sourceName, TypeDefCategory category, String typeName, String methodName) throws TypeErrorException
      Return the InstanceType that matches the supplied type name. If the type name is not recognized, of the category is incorrect, a logic exception is thrown.
      Specified by:
      getInstanceType in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      category - category of the instance type required.
      typeName - String type name.
      methodName - name of calling method.
      Returns:
      InstanceType object containing TypeDef properties such as unique identifier (guid), typeDef name and version name
      Throws:
      TypeErrorException - the type name is not a recognized type or is of the wrong category or there is a problem with the cached TypeDef.
    • isValidTypeCategory

      public boolean isValidTypeCategory(String sourceName, TypeDefCategory category, String typeName, String methodName) throws TypeErrorException
      Return a boolean indicating that the type name matches the category.
      Specified by:
      isValidTypeCategory in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      category - TypeDefCategory enum value to test
      typeName - type name to test
      methodName - name of calling method.
      Returns:
      boolean flag indicating that the type name is of the specified category
      Throws:
      TypeErrorException - the type name is not a recognized type or there is a problem with the cached TypeDef.
    • isValidClassificationForEntity

      public boolean isValidClassificationForEntity(String sourceName, String classificationTypeName, String entityTypeName, String methodName)
      Return boolean indicating if a classification type can be applied to a specified entity. This uses the list of valid entity types located in the ClassificationDef.
      Specified by:
      isValidClassificationForEntity in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      classificationTypeName - name of the classification's type (ClassificationDef)
      entityTypeName - name of the entity's type (EntityDef)
      methodName - name of calling method.
      Returns:
      boolean indicating if the classification is valid for the entity.
    • getInitialStatus

      public InstanceStatus getInitialStatus(String sourceName, String typeName, String methodName) throws TypeErrorException
      Return the initial status value to use for an instance of the supplied type.
      Specified by:
      getInitialStatus in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      typeName - name of the type to extract the initial status from.
      methodName - calling method
      Returns:
      InstanceStatus enum
      Throws:
      TypeErrorException - the type name is not recognized.
    • getEntityURL

      public String getEntityURL(String sourceName, String guid)
      Return the URL string to use for direct access to the metadata instance.
      Specified by:
      getEntityURL in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      guid - unique identifier for the instance.
      Returns:
      String URL with placeholder for variables such as userId.
    • getRelationshipURL

      public String getRelationshipURL(String sourceName, String guid)
      Return the URL string to use for direct access to the metadata instance.
      Specified by:
      getRelationshipURL in interface OMRSTypeDefManager
      Parameters:
      sourceName - source of the request (used for logging)
      guid - unique identifier for the instance.
      Returns:
      String URL with placeholder for variables such as userId.
    • sendTypeDefEvent

      public void sendTypeDefEvent(String cohortName, OMRSTypeDefEvent typeDefEvent)
      Process incoming TypeDefEvent based on its type.
      Specified by:
      sendTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      sendTypeDefEvent in class OMRSTypeDefEventProcessor
      Parameters:
      cohortName - source of the event (cohort name)
      typeDefEvent - event to process
    • processNewTypeDefEvent

      public void processNewTypeDefEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, TypeDef typeDef)
      A new TypeDef has been defined either in an archive, or in another member of the cohort. This new TypeDef can be added to the repository if it does not clash with an existing typeDef and the local repository supports dynamic type definitions.
      Specified by:
      processNewTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processNewTypeDefEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      typeDef - details of the new TypeDef
    • processNewAttributeTypeDefEvent

      public void processNewAttributeTypeDefEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, AttributeTypeDef attributeTypeDef)
      A new AttributeTypeDef has been defined in an open metadata repository.
      Specified by:
      processNewAttributeTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processNewAttributeTypeDefEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      attributeTypeDef - details of the new AttributeTypeDef.
    • processUpdatedTypeDefEvent

      public void processUpdatedTypeDefEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, TypeDefPatch typeDefPatch)
      An existing TypeDef has been updated in a remote metadata repository.
      Specified by:
      processUpdatedTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processUpdatedTypeDefEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      typeDefPatch - details of the new version of the TypeDef
    • processDeletedTypeDefEvent

      public void processDeletedTypeDefEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, String typeDefGUID, String typeDefName)
      An existing TypeDef has been deleted in a remote metadata repository. Both the name and the GUID are provided to ensure the right TypeDef is deleted in other cohort member repositories.
      Specified by:
      processDeletedTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processDeletedTypeDefEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      typeDefGUID - unique identifier of the TypeDef
      typeDefName - unique name of the TypeDef
    • processDeletedAttributeTypeDefEvent

      public void processDeletedAttributeTypeDefEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, String attributeTypeDefGUID, String attributeTypeDefName)
      An existing AttributeTypeDef has been deleted in an open metadata repository. Both the name and the GUID are provided to ensure the right AttributeTypeDef is deleted in other cohort member repositories.
      Specified by:
      processDeletedAttributeTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processDeletedAttributeTypeDefEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      attributeTypeDefGUID - unique identifier of the AttributeTypeDef
      attributeTypeDefName - unique name of the AttributeTypeDef
    • processReIdentifiedTypeDefEvent

      public void processReIdentifiedTypeDefEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, TypeDefSummary originalTypeDefSummary, TypeDef typeDef)
      Process an event that changes either the name or guid of a TypeDef. It is resolving a Conflicting TypeDef Error.
      Specified by:
      processReIdentifiedTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processReIdentifiedTypeDefEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      originalTypeDefSummary - details of the original TypeDef
      typeDef - updated TypeDef with new identifiers inside.
    • processReIdentifiedAttributeTypeDefEvent

      public void processReIdentifiedAttributeTypeDefEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, AttributeTypeDef originalAttributeTypeDef, AttributeTypeDef attributeTypeDef)
      Process an event that changes either the name or guid of an AttributeTypeDef. It is resolving a Conflicting AttributeTypeDef Error.
      Specified by:
      processReIdentifiedAttributeTypeDefEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processReIdentifiedAttributeTypeDefEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      originalAttributeTypeDef - description of original AttributeTypeDef
      attributeTypeDef - updated AttributeTypeDef with new identifiers inside.
    • processTypeDefConflictEvent

      public void processTypeDefConflictEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, TypeDefSummary originatorTypeDefSummary, String otherMetadataCollectionId, TypeDefSummary conflictingTypeDefSummary, String errorMessage)
      Process a detected conflict in type definitions (TypeDefs) used in the cohort.
      Specified by:
      processTypeDefConflictEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processTypeDefConflictEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      originatorTypeDefSummary - details of the TypeDef in the event originator
      otherMetadataCollectionId - the metadataCollection using the conflicting TypeDef
      conflictingTypeDefSummary - the details of the TypeDef in the other metadata collection
      errorMessage - details of the error that occurs when the connection is used.
    • processAttributeTypeDefConflictEvent

      public void processAttributeTypeDefConflictEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, AttributeTypeDef originatorAttributeTypeDef, String otherMetadataCollectionId, AttributeTypeDef conflictingAttributeTypeDef, String errorMessage)
      Process a detected conflict in the attribute type definitions (AttributeTypeDefs) used in the cohort.
      Specified by:
      processAttributeTypeDefConflictEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processAttributeTypeDefConflictEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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.
      originatorAttributeTypeDef - - description of the AttributeTypeDef in the event originator.
      otherMetadataCollectionId - the metadataCollection using the conflicting AttributeTypeDef.
      conflictingAttributeTypeDef - description of the AttributeTypeDef in the other metadata collection.
      errorMessage - details of the error that occurs when the connection is used.
    • processTypeDefPatchMismatchEvent

      public void processTypeDefPatchMismatchEvent(String sourceName, String originatorMetadataCollectionId, String originatorServerName, String originatorServerType, String originatorOrganizationName, String targetMetadataCollectionId, TypeDefSummary targetTypeDefSummary, TypeDef otherTypeDef, String errorMessage)
      A TypeDef from another member in the cohort is at a different version than the local repository. This may create some inconsistencies in the different copies of instances of this type in different members of the cohort. The recommended action is to update all TypeDefs to the latest version.
      Specified by:
      processTypeDefPatchMismatchEvent in interface OMRSTypeDefEventProcessorInterface
      Specified by:
      processTypeDefPatchMismatchEvent in class OMRSTypeDefEventProcessor
      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 hosted by the server that sent the event.
      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 - identifier of the metadata collection that is reporting a TypeDef at a different level to the local repository.
      targetTypeDefSummary - details of the target TypeDef
      otherTypeDef - details of the TypeDef in the local repository.
      errorMessage - details of the error that occurs when the connection is used.
    • getMetadataCollectionName

      public String getMetadataCollectionName(String metadataCollectionId)
      Return the metadata collection name (or null) for a metadata collection id.
      Parameters:
      metadataCollectionId - unique identifier (guid) for the metadata collection.
      Returns:
      display name