Class RepositoryErrorHandler

java.lang.Object
org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryErrorHandler

public class RepositoryErrorHandler extends Object
RepositoryErrorHandler provides common validation routines for the other handler classes
  • Constructor Details

    • RepositoryErrorHandler

      public RepositoryErrorHandler(OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName)
      Typical constructor providing access to the repository connector for this access service.
      Parameters:
      repositoryHelper - access to the repository helper.
      serviceName - name of this access service
      serverName - name of this server
    • RepositoryErrorHandler

      public RepositoryErrorHandler(OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName, AuditLog auditLog)
      Typical constructor providing access to the repository connector for this access service.
      Parameters:
      repositoryHelper - access to the repository helper.
      serviceName - name of this access service
      serverName - name of this server
      auditLog - logging destination
  • Method Details

    • validateRepositoryConnector

      public void validateRepositoryConnector(OMRSRepositoryConnector repositoryConnector, String methodName) throws PropertyServerException
      Check that there is a repository connector.
      Parameters:
      methodName - name of the method being called
      repositoryConnector - connector object
      Throws:
      PropertyServerException - exception thrown if the repository connector
    • validateInstanceType

      public void validateInstanceType(InstanceHeader instanceHeader, String expectedTypeName, String methodName, String localMethodName) throws InvalidParameterException
      Verify whether an instance is of a particular type or not. If the expected type is null then the verification is successful. Any problems result in an exception.
      Parameters:
      instanceHeader - the entity or relationship header.
      expectedTypeName - name of the type to test for
      methodName - calling method
      localMethodName - name of repository handler method
      Throws:
      InvalidParameterException - one of the parameters is null or invalid.
    • validateTypeIdentifiers

      public void validateTypeIdentifiers(String typeDefGUID, String guidParameterName, String typeDefName, String nameParameterName, String methodName, String localMethodName) throws PropertyServerException
      Verify that the type's unique identifier and name are for a single valid type. Any problems result in an exception. This is considered a logic error in the handlers or OMASs (or more likely in the mapper) which is why PropertyServerException is thrown.
      Parameters:
      typeDefGUID - GUID of the type to test for
      guidParameterName - name of parameter passing the GUID
      typeDefName - name of the type to test for
      nameParameterName - name of parameter passing the typeDefName
      methodName - calling method
      localMethodName - name of repository handler method
      Throws:
      PropertyServerException - The type identifiers are either unknown or mismatched
    • logNullInstance

      public void logNullInstance(String expectedTypeName, String methodName)
      Throw an exception to indicate that a retrieved entity has missing information.
      Parameters:
      expectedTypeName - type name of instance
      methodName - calling method
    • logBadEntity

      public void logBadEntity(String expectedTypeName, EntityDetail entity, String methodName)
      Throw an exception to indicate that a retrieved entity has missing information.
      Parameters:
      expectedTypeName - type name of instance
      entity - the entity with the bad header
      methodName - calling method
    • handleBadEntityProxy

      public void handleBadEntityProxy(Relationship relationship, int end, EntityProxy entityProxy, String methodName)
      Throw an exception to indicate that a retrieved entity proxy is missing critical information.
      Parameters:
      relationship - the relationship with a bad entity proxy - not null
      end - number of the end where the proxy is stored
      entityProxy - the entity proxy with the bad values
      methodName - calling method
    • logBadRelationship

      public void logBadRelationship(String expectedTypeName, Relationship relationship, String methodName)
      Throw an exception to indicate that a critical instance (typically the main entity) has not been passed to the converter.
      Parameters:
      expectedTypeName - type name of instance
      relationship - the relationship with the bad header
      methodName - calling method
    • handleDuplicateCreateRequest

      public void handleDuplicateCreateRequest(String typeName, String qualifiedName, String existingEntityGUID, String methodName) throws InvalidParameterException
      Report an error where an entity is being created with the same qualified name as an existing entity of the same type.
      Parameters:
      typeName - name of the type
      qualifiedName - clashing qualified name
      existingEntityGUID - existing entity found in the repository
      methodName - calling method
      Throws:
      InvalidParameterException - exception that reports this error
    • handleUnauthorizedUser

      public void handleUnauthorizedUser(String userId, String methodName) throws UserNotAuthorizedException
      Throw an exception if the supplied userId is not authorized to perform a request
      Parameters:
      userId - user name to validate
      methodName - name of the method making the call.
      Throws:
      UserNotAuthorizedException - the userId is unauthorised for the request
    • handleUnsupportedProperty

      public void handleUnsupportedProperty(Exception error, String methodName, String propertyName) throws InvalidParameterException
      Throw an exception if the supplied property is not supported
      Parameters:
      error - caught exception
      methodName - name of the method making the call
      propertyName - name of the property in error
      Throws:
      InvalidParameterException - invalid property
    • handleUnsupportedParameter

      public void handleUnsupportedParameter(String methodName, String parameterName, String parameterValue) throws InvalidParameterException
      Throw an exception if the supplied parameter is invalid.
      Parameters:
      methodName - name of the method making the call
      parameterName - name of the parameter in error
      parameterValue - value of the parameter
      Throws:
      InvalidParameterException - invalid property
    • handleUnsupportedType

      public void handleUnsupportedType(Exception error, String methodName, String typeName) throws InvalidParameterException
      Throw an exception if the supplied type name is not supported in the metadata
      Parameters:
      error - caught exception
      methodName - name of the method making the call
      typeName - name of the property in error
      Throws:
      InvalidParameterException - invalid property
    • handleUnsupportedAnchorsType

      public void handleUnsupportedAnchorsType(Exception error, String methodName, String typeName) throws PropertyServerException
      Throw an exception if the supplied userId is not authorized to perform a request
      Parameters:
      error - caught exception
      methodName - name of the method making the call
      typeName - name of the property in error
      Throws:
      PropertyServerException - no audit log
    • handleRepositoryError

      public void handleRepositoryError(Exception error, String methodName, String localMethodName) throws PropertyServerException
      Throw an exception if an unexpected repository error is received
      Parameters:
      error - caught exception
      methodName - name of the method called by the external party
      localMethodName - name of method that called this error
      Throws:
      PropertyServerException - unexpected exception from property server
    • handleUnknownEntity

      public void handleUnknownEntity(Exception error, String entityGUID, String entityTypeName, String methodName, String guidParameterName) throws InvalidParameterException
      Throw an exception if there is a problem with the entity guid
      Parameters:
      error - caught exception (or null)
      entityGUID - unique identifier for the requested entity
      entityTypeName - expected type of asset
      methodName - name of the method making the call
      guidParameterName - name of the parameter that passed the GUID.
      Throws:
      InvalidParameterException - unexpected exception from property server
    • handleNotEffectiveElement

      public void handleNotEffectiveElement(String elementGUID, String elementTypeName, InstanceProperties properties, String methodName, String guidParameterName, Date effectiveDate) throws InvalidParameterException
      Throw an exception if there is a problem with and elements effectivity dates
      Parameters:
      elementGUID - unique identifier for the requested entity
      elementTypeName - expected type of element
      properties - properties of the element
      methodName - name of the method making the call
      guidParameterName - name of the parameter that passed the GUID
      effectiveDate - date to retrieve from
      Throws:
      InvalidParameterException - unexpected exception from property server
    • handleUnknownRelationship

      public void handleUnknownRelationship(Exception error, String relationshipGUID, String relationshipTypeName, String methodName, String guidParameterName) throws InvalidParameterException
      Throw an exception if there is a problem with the relationship guid
      Parameters:
      error - caught exception
      relationshipGUID - unique identifier for the requested entity
      relationshipTypeName - expected type of asset
      methodName - name of the method making the call
      guidParameterName - name of the parameter that passed the GUID.
      Throws:
      InvalidParameterException - unexpected exception from property server
    • handleEntityProxy

      public void handleEntityProxy(Exception error, String entityGUID, String entityTypeName, String methodName, String guidParameterName) throws InvalidParameterException
      Throw an exception if there is a problem with the asset guid
      Parameters:
      error - caught exception
      entityGUID - unique identifier for the requested entity
      entityTypeName - expected type of asset
      methodName - name of the method making the call
      guidParameterName - name of the parameter that passed the GUID.
      Throws:
      InvalidParameterException - unexpected exception from property server
    • handleAmbiguousRelationships

      public void handleAmbiguousRelationships(String entityGUID, String entityTypeName, String relationshipTypeName, List<Relationship> returnedRelationships, String methodName) throws PropertyServerException
      Throw an exception if multiple relationships are returned when not expected.
      Parameters:
      entityGUID - unique identifier for the anchor entity
      entityTypeName - name of the entity's type
      relationshipTypeName - expected type of relationship
      returnedRelationships - list of relationships returned
      methodName - name of the method making the call
      Throws:
      PropertyServerException - unexpected response from property server
    • handleAmbiguousEntityName

      public void handleAmbiguousEntityName(String name, String nameParameterName, String entityTypeName, List<EntityDetail> returnedEntities, String methodName) throws PropertyServerException
      Throw an exception if multiple entities are returned when not expected.
      Parameters:
      name - requested name for the entity
      nameParameterName - name of the parameter
      entityTypeName - name of the entity's type
      returnedEntities - list of entities returned
      methodName - name of the method making the call
      Throws:
      PropertyServerException - unexpected response from property server
    • handleAmbiguousName

      public void handleAmbiguousName(String name, String nameParameterName, String entityTypeName, List<String> returnedEntityGUIDs, String methodName) throws PropertyServerException
      Throw an exception if multiple entities are returned when not expected.
      Parameters:
      name - requested name for the entity
      nameParameterName - name of the parameter
      entityTypeName - name of the entity's type
      returnedEntityGUIDs - list of entities returned
      methodName - name of the method making the call
      Throws:
      PropertyServerException - unexpected response from property server
    • handleNoRelationship

      public void handleNoRelationship(String entityGUID, String entityTypeName, String relationshipTypeName, String methodName) throws PropertyServerException
      Throw an exception if no relationships are returned when not expected.
      Parameters:
      entityGUID - unique identifier for the anchor entity
      entityTypeName - name of the entity's type
      relationshipTypeName - expected type of relationship
      methodName - name of the method making the call
      Throws:
      PropertyServerException - unexpected response from property server
    • handleNoEntity

      public void handleNoEntity(String entityTypeGUID, String entityTypeName, InstanceProperties properties, String methodName) throws PropertyServerException
      Throw an exception if it is not possible to create an entity.
      Parameters:
      entityTypeGUID - unique identifier for the entity's type
      entityTypeName - name of the entity's type
      properties - properties
      methodName - name of the method making the call
      Throws:
      PropertyServerException - unexpected response from property server
    • handleNoEntityForClassification

      public void handleNoEntityForClassification(String entityGUID, String classificationTypeGUID, String classificationTypeName, InstanceProperties properties, String methodName) throws PropertyServerException
      Throw an exception if it is not possible to update an entity.
      Parameters:
      entityGUID - unique identifier of entity
      classificationTypeGUID - unique identifier for the classification's type
      classificationTypeName - name of the classification's type
      properties - properties
      methodName - name of the method making the call
      Throws:
      PropertyServerException - unexpected response from property server