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 Summary
Constructors Constructor Description RepositoryErrorHandler(OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName)Typical constructor providing access to the repository connector for this access service.RepositoryErrorHandler(OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName, AuditLog auditLog)Typical constructor providing access to the repository connector for this access service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandleAmbiguousEntityName(String name, String nameParameterName, String entityTypeName, List<EntityDetail> returnedEntities, String methodName)Throw an exception if multiple entities are returned when not expected.voidhandleAmbiguousName(String name, String nameParameterName, String entityTypeName, List<String> returnedEntityGUIDs, String methodName)Throw an exception if multiple entities are returned when not expected.voidhandleAmbiguousRelationships(String entityGUID, String entityTypeName, String relationshipTypeName, List<Relationship> returnedRelationships, String methodName)Throw an exception if multiple relationships are returned when not expected.voidhandleBadEntityProxy(Relationship relationship, int end, EntityProxy entityProxy, String methodName)Throw an exception to indicate that a retrieved entity proxy is missing critical information.voidhandleDuplicateCreateRequest(String typeName, String qualifiedName, String existingEntityGUID, String methodName)Report an error where an entity is being created with the same qualified name as an existing entity of the same type.voidhandleEntityProxy(Throwable error, String entityGUID, String entityTypeName, String methodName, String guidParameterName)Throw an exception if there is a problem with the asset guidvoidhandleNoEntity(String entityTypeGUID, String entityTypeName, InstanceProperties properties, String methodName)Throw an exception if it is not possible to create an entity.voidhandleNoEntityForClassification(String entityGUID, String classificationTypeGUID, String classificationTypeName, InstanceProperties properties, String methodName)Throw an exception if it is not possible to update an entity.voidhandleNoRelationship(String entityGUID, String entityTypeName, String relationshipTypeName, String methodName)Throw an exception if no relationships are returned when not expected.voidhandleRepositoryError(Throwable error, String methodName)Throw an exception if an unexpected repository error is receivedvoidhandleRepositoryError(Throwable error, String methodName, String localMethodName)Throw an exception if an unexpected repository error is receivedvoidhandleUnauthorizedUser(String userId, String methodName)Throw an exception if the supplied userId is not authorized to perform a requestvoidhandleUnknownEntity(Throwable error, String entityGUID, String entityTypeName, String methodName, String guidParameterName)Throw an exception if there is a problem with the entity guidvoidhandleUnknownRelationship(Throwable error, String relationshipGUID, String relationshipTypeName, String methodName, String guidParameterName)Throw an exception if there is a problem with the relationship guidvoidhandleUnsupportedAnchorsType(Exception error, String methodName, String typeName)Throw an exception if the supplied userId is not authorized to perform a requestvoidhandleUnsupportedParameter(String methodName, String parameterName, String parameterValue)Throw an exception if the supplied parameter is invalid.voidhandleUnsupportedProperty(Throwable error, String methodName, String propertyName)Throw an exception if the supplied property is not supportedvoidhandleUnsupportedType(Throwable error, String methodName, String typeName)Throw an exception if the supplied type name is not supported i nthe metadtavoidlogBadEntity(String expectedTypeName, EntityDetail entity, String methodName)Throw an exception to indicate that a retrieved entity has missing information.voidlogBadRelationship(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.voidlogNullInstance(String expectedTypeName, String methodName)Throw an exception to indicate that a retrieved entity has missing information.voidvalidateRepositoryConnector(OMRSRepositoryConnector repositoryConnector, String methodName)Check that there is a repository connector.
-
-
-
Constructor Detail
-
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 serviceserverName- 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 serviceserverName- name of this serverauditLog- logging destination
-
-
Method Detail
-
validateRepositoryConnector
public void validateRepositoryConnector(OMRSRepositoryConnector repositoryConnector, String methodName) throws PropertyServerException
Check that there is a repository connector.- Parameters:
methodName- name of the method being calledrepositoryConnector- connector object- Throws:
PropertyServerException- exception thrown if the repository connector
-
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 instancemethodName- 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 instanceentity- the entity with the bad headermethodName- 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 nullend- number of the end where the proxy is storedentityProxy- the entity proxy with the bad valuesmethodName- 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 instancerelationship- the relationship with the bad headermethodName- 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 typequalifiedName- clashing qualified nameexistingEntityGUID- existing entity found in the repositorymethodName- 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 validatemethodName- name of the method making the call.- Throws:
UserNotAuthorizedException- the userId is unauthorised for the request
-
handleUnsupportedProperty
public void handleUnsupportedProperty(Throwable error, String methodName, String propertyName) throws InvalidParameterException
Throw an exception if the supplied property is not supported- Parameters:
error- caught exceptionmethodName- name of the method making the callpropertyName- 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 callparameterName- name of the parameter in errorparameterValue- value of the parameter- Throws:
InvalidParameterException- invalid property
-
handleUnsupportedType
public void handleUnsupportedType(Throwable error, String methodName, String typeName) throws InvalidParameterException
Throw an exception if the supplied type name is not supported i nthe metadta- Parameters:
error- caught exceptionmethodName- name of the method making the calltypeName- 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 exceptionmethodName- name of the method making the calltypeName- name of the property in error- Throws:
PropertyServerException- no audit log
-
handleRepositoryError
public void handleRepositoryError(Throwable error, String methodName) throws PropertyServerException
Throw an exception if an unexpected repository error is received- Parameters:
error- caught exceptionmethodName- name of the method making the call.- Throws:
PropertyServerException- unexpected exception from property server
-
handleRepositoryError
public void handleRepositoryError(Throwable error, String methodName, String localMethodName) throws PropertyServerException
Throw an exception if an unexpected repository error is received- Parameters:
error- caught exceptionmethodName- name of the method called by the external partylocalMethodName- name of method that called this error- Throws:
PropertyServerException- unexpected exception from property server
-
handleUnknownEntity
public void handleUnknownEntity(Throwable 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 exceptionentityGUID- unique identifier for the requested entityentityTypeName- expected type of assetmethodName- name of the method making the callguidParameterName- name of the parameter that passed the GUID.- Throws:
InvalidParameterException- unexpected exception from property server
-
handleUnknownRelationship
public void handleUnknownRelationship(Throwable 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 exceptionrelationshipGUID- unique identifier for the requested entityrelationshipTypeName- expected type of assetmethodName- name of the method making the callguidParameterName- name of the parameter that passed the GUID.- Throws:
InvalidParameterException- unexpected exception from property server
-
handleEntityProxy
public void handleEntityProxy(Throwable 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 exceptionentityGUID- unique identifier for the requested entityentityTypeName- expected type of assetmethodName- name of the method making the callguidParameterName- 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 entityentityTypeName- name of the entity's typerelationshipTypeName- expected type of relationshipreturnedRelationships- list of relationships returnedmethodName- 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 entitynameParameterName- name of the parameterentityTypeName- name of the entity's typereturnedEntities- list of entities returnedmethodName- 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 entitynameParameterName- name of the parameterentityTypeName- name of the entity's typereturnedEntityGUIDs- list of entities returnedmethodName- 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 entityentityTypeName- name of the entity's typerelationshipTypeName- expected type of relationshipmethodName- 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 typeentityTypeName- name of the entity's typeproperties- propertiesmethodName- 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 entityclassificationTypeGUID- unique identifier for the classification's typeclassificationTypeName- name of the classification's typeproperties- propertiesmethodName- name of the method making the call- Throws:
PropertyServerException- unexpected response from property server
-
-