Commit 5cfb0228 by Mandy Chessell Committed by David Radley

ATLAS-2585 Fix up validation of TypDef GUIDs

parent 810aceb5
...@@ -77,7 +77,7 @@ public enum AssetConsumerErrorCode ...@@ -77,7 +77,7 @@ public enum AssetConsumerErrorCode
"The system is unable to process the request.", "The system is unable to process the request.",
"Verify the access rights of the user."), "Verify the access rights of the user."),
PROPERTY_SERVER_ERROR(400, "OMAS-ASSETCONSUMER-400-009 ", PROPERTY_SERVER_ERROR(400, "OMAS-ASSETCONSUMER-400-009 ",
"An unexpected error with message \'{0}\' was returned by the property server during {1} request for open metadata access service {2} on server {3}", "An unexpected error was returned by the property server during {1} request for open metadata access service {2} on server {3}; message was {0}",
"The system is unable to process the request.", "The system is unable to process the request.",
"Verify the access rights of the user."), "Verify the access rights of the user."),
NULL_ENUM(400, "OMAS-ASSETCONSUMER-400-010 ", NULL_ENUM(400, "OMAS-ASSETCONSUMER-400-010 ",
......
...@@ -267,6 +267,13 @@ public class OMRSOperationalServices ...@@ -267,6 +267,13 @@ public class OMRSOperationalServices
List<CohortConfig> cohortConfigList = repositoryServicesConfig.getCohortConfigList(); List<CohortConfig> cohortConfigList = repositoryServicesConfig.getCohortConfigList();
/* /*
* The local repository is optional. However, the repository content manager is still
* used to manage the validation of TypeDefs and the creation of metadata instances.
* It is loaded with any TypeDefs from the archives to seed its in-memory TypeDef cache.
*/
localRepositoryContentManager = new OMRSRepositoryContentManager();
/*
* Begin with the enterprise repository services. They are always needed since the * Begin with the enterprise repository services. They are always needed since the
* Open Metadata Access Services (OMAS) is dependent on them. There are 2 modes of operation: local only * Open Metadata Access Services (OMAS) is dependent on them. There are 2 modes of operation: local only
* and enterprise access. Enterprise access provide an enterprise view of metadata * and enterprise access. Enterprise access provide an enterprise view of metadata
...@@ -287,13 +294,6 @@ public class OMRSOperationalServices ...@@ -287,13 +294,6 @@ public class OMRSOperationalServices
archiveManager = initializeOpenMetadataArchives(repositoryServicesConfig.getOpenMetadataArchiveConnections()); archiveManager = initializeOpenMetadataArchives(repositoryServicesConfig.getOpenMetadataArchiveConnections());
/* /*
* The local repository is optional. However, the repository content manager is still
* used to manage the validation of TypeDefs and the creation of metadata instances.
* It is loaded with any TypeDefs from the archives to seed its in-memory TypeDef cache.
*/
localRepositoryContentManager = new OMRSRepositoryContentManager();
/*
* The repository validator and helper are used by repository connectors to verify the types and instances * The repository validator and helper are used by repository connectors to verify the types and instances
* they receive from external parties and to build new types and instances. Instances of these * they receive from external parties and to build new types and instances. Instances of these
* classes are created in each of the repository connectors (and possibly the event mappers as well). * classes are created in each of the repository connectors (and possibly the event mappers as well).
......
...@@ -26,7 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceTyp ...@@ -26,7 +26,6 @@ import org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceTyp
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -276,6 +275,9 @@ public class OMRSRepositoryEventExchangeRule ...@@ -276,6 +275,9 @@ public class OMRSRepositoryEventExchangeRule
*/ */
public boolean learnInstanceEvent(InstanceHeader instance) public boolean learnInstanceEvent(InstanceHeader instance)
{ {
final String methodName = "learnInstanceEvent";
final String parameterName = "instance";
if (repositoryContentManager == null) if (repositoryContentManager == null)
{ {
/* /*
...@@ -300,8 +302,11 @@ public class OMRSRepositoryEventExchangeRule ...@@ -300,8 +302,11 @@ public class OMRSRepositoryEventExchangeRule
try try
{ {
TypeDef typeDef = repositoryContentManager.getTypeDef(sourceName, TypeDef typeDef = repositoryContentManager.getTypeDef(sourceName,
parameterName,
parameterName,
type.getTypeDefGUID(), type.getTypeDefGUID(),
type.getTypeDefName()); type.getTypeDefName(),
methodName);
if (typeDef != null) if (typeDef != null)
{ {
......
...@@ -419,23 +419,27 @@ public enum OMRSErrorCode ...@@ -419,23 +419,27 @@ public enum OMRSErrorCode
"The TypeDef \"{0}\" (guid = {1}) passed on the {2} parameter of the {3} operation is not known to the open metadata repository {4}", "The TypeDef \"{0}\" (guid = {1}) passed on the {2} parameter of the {3} operation is not known to the open metadata repository {4}",
"The system is unable to retrieve the properties for the requested TypeDef because the supplied identifier is not recognized.", "The system is unable to retrieve the properties for the requested TypeDef because the supplied identifier is not recognized.",
"The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the typedef has been deleted since the identifier was retrieved."), "The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the typedef has been deleted since the identifier was retrieved."),
ATTRIBUTE_TYPEDEF_NOT_KNOWN(404, "OMRS-REPOSITORY-404-004 ", TYPEDEF_NOT_KNOWN_FOR_INSTANCE(404, "OMRS-REPOSITORY-404-005 ",
"The TypeDef \"{0}\" of category \"{1}\" passed by the {2} operation is not known to the open metadata repository {3}",
"The system is unable to retrieve the properties for the requested TypeDef because the supplied identifier is not recognized.",
"The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the typedef has been deleted since the identifier was retrieved."),
ATTRIBUTE_TYPEDEF_NOT_KNOWN(404, "OMRS-REPOSITORY-404-006 ",
"The AttributeTypeDef \"{0}\" (guid = {1}) passed on the {2} call is not known to the open metadata repository {3}", "The AttributeTypeDef \"{0}\" (guid = {1}) passed on the {2} call is not known to the open metadata repository {3}",
"The system is unable to retrieve the properties for the requested TypeDef because the supplied identifier is not recognized.", "The system is unable to retrieve the properties for the requested TypeDef because the supplied identifier is not recognized.",
"The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the typedef has been deleted since the identifier was retrieved."), "The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the typedef has been deleted since the identifier was retrieved."),
TYPEDEF_ID_NOT_KNOWN(404, "OMRS-REPOSITORY-404-005 ", TYPEDEF_ID_NOT_KNOWN(404, "OMRS-REPOSITORY-404-007 ",
"The TypeDef unique identifier {0} passed on a {1} request to open metadata repository {2} is not known to this repository", "The TypeDef unique identifier {0} passed as parameter {1} on a {2} request to open metadata repository {3} is not known to this repository",
"The system is unable to retrieve the properties for the requested TypeDef because the supplied identifiers are not recognized.", "The system is unable to retrieve the properties for the requested TypeDef because the supplied identifiers are not recognized.",
"The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the TypeDef has been deleted since the identifier was retrieved."), "The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the TypeDef has been deleted since the identifier was retrieved."),
ATTRIBUTE_TYPEDEF_ID_NOT_KNOWN(404, "OMRS-REPOSITORY-404-006 ", ATTRIBUTE_TYPEDEF_ID_NOT_KNOWN(404, "OMRS-REPOSITORY-404-008 ",
"The AttributeTypeDef \"{0}\" (guid {1}) passed on a {2} request to open metadata repository {3} is not known to this repository", "The AttributeTypeDef \"{0}\" (guid {1}) passed on a {2} request to open metadata repository {3} is not known to this repository",
"The system is unable to retrieve the properties for the requested AttributeTypeDef because the supplied identifiers are not recognized.", "The system is unable to retrieve the properties for the requested AttributeTypeDef because the supplied identifiers are not recognized.",
"The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the AttributeTypeDef has been deleted since the identifier was retrieved."), "The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the AttributeTypeDef has been deleted since the identifier was retrieved."),
TYPEDEF_NAME_NOT_KNOWN(404, "OMRS-REPOSITORY-404-007 ", TYPEDEF_NAME_NOT_KNOWN(404, "OMRS-REPOSITORY-404-009 ",
"The TypeDef unique name {0} passed on a {1} request to open metadata repository {2} is not known to this repository", "The TypeDef unique name {0} passed on a {1} request to open metadata repository {2} is not known to this repository",
"The system is unable to retrieve the properties for the requested TypeDef because the supplied identifiers are not recognized.", "The system is unable to retrieve the properties for the requested TypeDef because the supplied identifiers are not recognized.",
"The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the TypeDef has been deleted since the identifier was retrieved."), "The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the TypeDef has been deleted since the identifier was retrieved."),
ATTRIBUTE_TYPEDEF_NAME_NOT_KNOWN(404, "OMRS-REPOSITORY-404-008 ", ATTRIBUTE_TYPEDEF_NAME_NOT_KNOWN(404, "OMRS-REPOSITORY-404-010 ",
"The TypeDef unique name {0} passed on a {1} request to open metadata repository {2} is not known to this repository", "The TypeDef unique name {0} passed on a {1} request to open metadata repository {2} is not known to this repository",
"The system is unable to retrieve the properties for the requested TypeDef because the supplied identifiers are not recognized.", "The system is unable to retrieve the properties for the requested TypeDef because the supplied identifiers are not recognized.",
"The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the TypeDef has been deleted since the identifier was retrieved."), "The identifier is supplied by the caller. It may have a logic problem that has corrupted the identifier, or the TypeDef has been deleted since the identifier was retrieved."),
...@@ -619,7 +623,11 @@ public enum OMRSErrorCode ...@@ -619,7 +623,11 @@ public enum OMRSErrorCode
"An OMRS repository connector {0} has passed an invalid parameter to the repository helper {1} operation as part of the {2} request", "An OMRS repository connector {0} has passed an invalid parameter to the repository helper {1} operation as part of the {2} request",
"The open metadata component has called the repository helper operations in the wrong order or has a similar logic error.", "The open metadata component has called the repository helper operations in the wrong order or has a similar logic error.",
"Raise a Jira to get this fixed."), "Raise a Jira to get this fixed."),
NULL_CLASSIFICATION_CREATED(503, "OMRS-LOCAL-REPOSITORY-503-006 ", CONTENT_MANAGER_LOGIC_ERROR(503, "OMRS-LOCAL-REPOSITORY-503-007 ",
"An OMRS repository connector {0} has passed an invalid parameter to the repository content manager {1} operation as part of the {2} request",
"The open metadata component has called the repository helper operations in the wrong order or has a similar logic error.",
"Raise a Jira to get this fixed."),
NULL_CLASSIFICATION_CREATED(503, "OMRS-LOCAL-REPOSITORY-503-008 ",
"An OMRS repository connector or access server {0} has passed a null classification to the repository helper {1} operation as part of the {2} request", "An OMRS repository connector or access server {0} has passed a null classification to the repository helper {1} operation as part of the {2} request",
"The repository connector has called the repository helper operations in the wrong order or has a similar logic error.", "The repository connector has called the repository helper operations in the wrong order or has a similar logic error.",
"Raise a Jira to get this fixed."), "Raise a Jira to get this fixed."),
......
...@@ -21,7 +21,6 @@ import org.apache.atlas.ocf.properties.beans.Connection; ...@@ -21,7 +21,6 @@ import org.apache.atlas.ocf.properties.beans.Connection;
import org.apache.atlas.omrs.eventmanagement.events.OMRSInstanceEventProcessor; import org.apache.atlas.omrs.eventmanagement.events.OMRSInstanceEventProcessor;
import org.apache.atlas.omrs.eventmanagement.OMRSRepositoryEventManager; import org.apache.atlas.omrs.eventmanagement.OMRSRepositoryEventManager;
import org.apache.atlas.omrs.eventmanagement.events.OMRSTypeDefEventProcessor; import org.apache.atlas.omrs.eventmanagement.events.OMRSTypeDefEventProcessor;
import org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSTypeDefValidator;
/** /**
...@@ -48,15 +47,6 @@ public interface OMRSLocalRepository ...@@ -48,15 +47,6 @@ public interface OMRSLocalRepository
/** /**
* Return the TypeDefManager. This is used to validate that a list of type definitions (TypeDefs) are
* compatible with the local repository.
*
* @return OMRSTypeDefValidator object for the local repository.
*/
OMRSTypeDefValidator getTypeDefValidator();
/**
* Return the event manager that the local repository uses to * Return the event manager that the local repository uses to
* *
* @return outbound repository event manager * @return outbound repository event manager
......
...@@ -38,6 +38,7 @@ import org.slf4j.Logger; ...@@ -38,6 +38,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
...@@ -1119,11 +1120,11 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess ...@@ -1119,11 +1120,11 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess
* @param entities - the retrieved relationships * @param entities - the retrieved relationships
* @return the validated and processed relationships * @return the validated and processed relationships
*/ */
public ArrayList<EntityDetail> processRetrievedEntities(String sourceName, public List<EntityDetail> processRetrievedEntities(String sourceName,
String metadataCollectionId, String metadataCollectionId,
ArrayList<EntityDetail> entities) List<EntityDetail> entities)
{ {
ArrayList<EntityDetail> processedEntities = new ArrayList<>(); List<EntityDetail> processedEntities = new ArrayList<>();
for (EntityDetail entity : entities) for (EntityDetail entity : entities)
{ {
...@@ -1221,11 +1222,11 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess ...@@ -1221,11 +1222,11 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess
* @param relationships - the list of retrieved relationships * @param relationships - the list of retrieved relationships
* @return the validated and processed relationships * @return the validated and processed relationships
*/ */
public ArrayList<Relationship> processRetrievedRelationships(String sourceName, public List<Relationship> processRetrievedRelationships(String sourceName,
String metadataCollectionId, String metadataCollectionId,
ArrayList<Relationship> relationships) List<Relationship> relationships)
{ {
ArrayList<Relationship> processedRelationships = new ArrayList<>(); List<Relationship> processedRelationships = new ArrayList<>();
for (Relationship relationship : relationships) for (Relationship relationship : relationships)
{ {
......
...@@ -418,18 +418,6 @@ public class LocalOMRSRepositoryConnector extends OMRSRepositoryConnector implem ...@@ -418,18 +418,6 @@ public class LocalOMRSRepositoryConnector extends OMRSRepositoryConnector implem
/** /**
* Return the TypeDefValidator. This is used to validate that a list of type definitions (TypeDefs) are
* compatible with the local repository.
*
* @return OMRSTypeDefValidator object for the local repository.
*/
public OMRSTypeDefValidator getTypeDefValidator()
{
return typeDefValidator;
}
/**
* Return the event manager that the local repository uses to distribute events from the local repository. * Return the event manager that the local repository uses to distribute events from the local repository.
* *
* @return outbound repository event manager * @return outbound repository event manager
......
...@@ -20,7 +20,7 @@ package org.apache.atlas.omrs.localrepository.repositoryconnector; ...@@ -20,7 +20,7 @@ package org.apache.atlas.omrs.localrepository.repositoryconnector;
import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail; import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail;
import org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship; import org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship;
import java.util.ArrayList; import java.util.List;
/** /**
...@@ -52,9 +52,9 @@ public interface OMRSInstanceRetrievalEventProcessor ...@@ -52,9 +52,9 @@ public interface OMRSInstanceRetrievalEventProcessor
* @param entities - the retrieved relationships * @param entities - the retrieved relationships
* @return the validated and processed relationships * @return the validated and processed relationships
*/ */
ArrayList<EntityDetail> processRetrievedEntities(String sourceName, List<EntityDetail> processRetrievedEntities(String sourceName,
String metadataCollectionId, String metadataCollectionId,
ArrayList<EntityDetail> entities); List<EntityDetail> entities);
/** /**
...@@ -80,7 +80,7 @@ public interface OMRSInstanceRetrievalEventProcessor ...@@ -80,7 +80,7 @@ public interface OMRSInstanceRetrievalEventProcessor
* @param relationships - the list of retrieved relationships * @param relationships - the list of retrieved relationships
* @return the validated and processed relationships * @return the validated and processed relationships
*/ */
ArrayList<Relationship> processRetrievedRelationships(String sourceName, List<Relationship> processRetrievedRelationships(String sourceName,
String metadataCollectionId, String metadataCollectionId,
ArrayList<Relationship> relationships); List<Relationship> relationships);
} }
...@@ -17,13 +17,10 @@ ...@@ -17,13 +17,10 @@
*/ */
package org.apache.atlas.omrs.localrepository.repositorycontentmanager; package org.apache.atlas.omrs.localrepository.repositorycontentmanager;
import org.apache.atlas.omrs.ffdc.exception.InvalidParameterException;
import org.apache.atlas.omrs.ffdc.exception.PatchErrorException;
import org.apache.atlas.omrs.ffdc.exception.TypeErrorException; import org.apache.atlas.omrs.ffdc.exception.TypeErrorException;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.AttributeTypeDef; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.AttributeTypeDef;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefGallery; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefGallery;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefPatch;
/** /**
...@@ -91,12 +88,16 @@ public interface OMRSTypeDefHelper ...@@ -91,12 +88,16 @@ public interface OMRSTypeDefHelper
* retrieving a type that only the guid is known. * retrieving a type that only the guid is known.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param parameterName - name of parameter
* @param typeDefGUID - unique identifier for the TypeDef * @param typeDefGUID - unique identifier for the TypeDef
* @param methodName - calling method
* @return TypeDef object * @return TypeDef object
* @throws TypeErrorException - unknown or invalid type * @throws TypeErrorException - unknown or invalid type
*/ */
TypeDef getTypeDef (String sourceName, TypeDef getTypeDef (String sourceName,
String typeDefGUID) throws TypeErrorException; String parameterName,
String typeDefGUID,
String methodName) throws TypeErrorException;
/** /**
...@@ -109,7 +110,8 @@ public interface OMRSTypeDefHelper ...@@ -109,7 +110,8 @@ public interface OMRSTypeDefHelper
* @throws TypeErrorException - unknown or invalid type * @throws TypeErrorException - unknown or invalid type
*/ */
AttributeTypeDef getAttributeTypeDef (String sourceName, AttributeTypeDef getAttributeTypeDef (String sourceName,
String attributeTypeDefGUID) throws TypeErrorException; String attributeTypeDefGUID,
String methodName) throws TypeErrorException;
...@@ -118,14 +120,20 @@ public interface OMRSTypeDefHelper ...@@ -118,14 +120,20 @@ public interface OMRSTypeDefHelper
* retrieving a type that should exist. For example, retrieving the type of a metadata instance. * retrieving a type that should exist. For example, retrieving the type of a metadata instance.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param guidParameterName - name of guid parameter
* @param nameParameterName - name of name parameter
* @param typeDefGUID - unique identifier for the TypeDef * @param typeDefGUID - unique identifier for the TypeDef
* @param typeDefName - unique name for the TypeDef * @param typeDefName - unique name for the TypeDef
* @param methodName - calling method
* @return TypeDef object * @return TypeDef object
* @throws TypeErrorException - unknown or invalid type * @throws TypeErrorException - unknown or invalid type
*/ */
TypeDef getTypeDef (String sourceName, TypeDef getTypeDef (String sourceName,
String guidParameterName,
String nameParameterName,
String typeDefGUID, String typeDefGUID,
String typeDefName) throws TypeErrorException; String typeDefName,
String methodName) throws TypeErrorException;
/** /**
...@@ -136,10 +144,12 @@ public interface OMRSTypeDefHelper ...@@ -136,10 +144,12 @@ public interface OMRSTypeDefHelper
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param attributeTypeDefGUID - unique identifier for the AttributeTypeDef * @param attributeTypeDefGUID - unique identifier for the AttributeTypeDef
* @param attributeTypeDefName - unique name for the AttributeTypeDef * @param attributeTypeDefName - unique name for the AttributeTypeDef
* @param methodName - calling method
* @return TypeDef object * @return TypeDef object
* @throws TypeErrorException - unknown or invalid type * @throws TypeErrorException - unknown or invalid type
*/ */
AttributeTypeDef getAttributeTypeDef (String sourceName, AttributeTypeDef getAttributeTypeDef (String sourceName,
String attributeTypeDefGUID, String attributeTypeDefGUID,
String attributeTypeDefName) throws TypeErrorException; String attributeTypeDefName,
String methodName) throws TypeErrorException;
} }
...@@ -58,15 +58,6 @@ public interface OMRSTypeDefManager ...@@ -58,15 +58,6 @@ public interface OMRSTypeDefManager
/** /**
* Update one or more properties of a cached TypeDef.
*
* @param sourceName - source of the request (used for logging)
* @param attributeTypeDef - AttributeTypeDef structure.
*/
void updateAttributeTypeDef(String sourceName, AttributeTypeDef attributeTypeDef);
/**
* Delete a cached TypeDef. * Delete a cached TypeDef.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
...@@ -82,12 +73,12 @@ public interface OMRSTypeDefManager ...@@ -82,12 +73,12 @@ public interface OMRSTypeDefManager
* Delete a cached AttributeTypeDef. * Delete a cached AttributeTypeDef.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param obsoleteTypeDefGUID - String unique identifier for the AttributeTypeDef. * @param obsoleteAttributeTypeDefGUID - String unique identifier for the AttributeTypeDef.
* @param obsoleteTypeDefName - String unique name for the AttributeTypeDef. * @param obsoleteAttributeTypeDefName - String unique name for the AttributeTypeDef.
*/ */
void deleteAttributeTypeDef(String sourceName, void deleteAttributeTypeDef(String sourceName,
String obsoleteTypeDefGUID, String obsoleteAttributeTypeDefGUID,
String obsoleteTypeDefName); String obsoleteAttributeTypeDefName);
/** /**
...@@ -124,13 +115,15 @@ public interface OMRSTypeDefManager ...@@ -124,13 +115,15 @@ public interface OMRSTypeDefManager
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param category - TypeDefCategory enum value to test * @param category - TypeDefCategory enum value to test
* @param typeName - type name to test * @param typeName - type name to test
* @param methodName - name of calling method.
* @return - boolean flag indicating that the type name is of the specified category * @return - boolean flag indicating that the type name is of the specified category
* @throws TypeErrorException - the type name is not a recognized type or the category is incorrect or there * @throws TypeErrorException - the type name is not a recognized type or the category is incorrect or there
* is an error in the type definition (TypeDef) cached. * is an error in the type definition (TypeDef) cached.
*/ */
boolean isValidTypeCategory(String sourceName, boolean isValidTypeCategory(String sourceName,
TypeDefCategory category, TypeDefCategory category,
String typeName) throws TypeErrorException; String typeName,
String methodName) throws TypeErrorException;
/** /**
...@@ -140,13 +133,15 @@ public interface OMRSTypeDefManager ...@@ -140,13 +133,15 @@ public interface OMRSTypeDefManager
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param classificationTypeName - name of the classification's type (ClassificationDef) * @param classificationTypeName - name of the classification's type (ClassificationDef)
* @param entityTypeName - name of the entity's type (EntityDef) * @param entityTypeName - name of the entity's type (EntityDef)
* @param methodName - name of calling method.
* @return boolean indicating if the classification is valid for the entity. * @return boolean indicating if the classification is valid for the entity.
* @throws TypeErrorException - the type name is not a recognized type or the category is incorrect or there * @throws TypeErrorException - the type name is not a recognized type or the category is incorrect or there
* is an error in the type definition (TypeDef) cached. * is an error in the type definition (TypeDef) cached.
*/ */
boolean isValidClassificationForEntity(String sourceName, boolean isValidClassificationForEntity(String sourceName,
String classificationTypeName, String classificationTypeName,
String entityTypeName) throws TypeErrorException; String entityTypeName,
String methodName) throws TypeErrorException;
/** /**
...@@ -156,13 +151,15 @@ public interface OMRSTypeDefManager ...@@ -156,13 +151,15 @@ public interface OMRSTypeDefManager
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param category - category of type * @param category - category of type
* @param typeName - String type name - the type name is not recognized or of the wrong category. * @param typeName - String type name - the type name is not recognized or of the wrong category.
* @param methodName - name of calling method.
* @return InstanceType object containing TypeDef unique identifier (guid), typeDef name and version * @return InstanceType object containing TypeDef unique identifier (guid), typeDef name and version
* @throws TypeErrorException - the type name is not a recognized type or the category is incorrect or there * @throws TypeErrorException - the type name is not a recognized type or the category is incorrect or there
* is an error in the type definition (TypeDef) cached. * is an error in the type definition (TypeDef) cached.
*/ */
InstanceType getInstanceType(String sourceName, InstanceType getInstanceType(String sourceName,
TypeDefCategory category, TypeDefCategory category,
String typeName) throws TypeErrorException; String typeName,
String methodName) throws TypeErrorException;
/** /**
...@@ -173,17 +170,27 @@ public interface OMRSTypeDefManager ...@@ -173,17 +170,27 @@ public interface OMRSTypeDefManager
* @return InstanceStatus enum * @return InstanceStatus enum
* @throws TypeErrorException - the type name is not recognized. * @throws TypeErrorException - the type name is not recognized.
*/ */
InstanceStatus getInitialStatus(String sourceName, String typeName) throws TypeErrorException; InstanceStatus getInitialStatus(String sourceName,
String typeName,
String methodName) throws TypeErrorException;
/**
* Return the URL string to use for direct access to the metadata instance.
*
* @param sourceName - source of the request (used for logging)
* @param guid - unique identifier for the instance.
* @return String URL with placeholder for variables such as userId.
*/
String getEntityURL(String sourceName, String guid);
/** /**
* Return the URL string to use for direct access to the metadata instance. This can be used for * Return the URL string to use for direct access to the metadata instance.
* entities and relationships. However, not all servers support direct access, in which case, this
* URL is null.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param guid - unique identifier for the instance. * @param guid - unique identifier for the instance.
* @return String URL with placeholder for variables such as userId. * @return String URL with placeholder for variables such as userId.
*/ */
String getInstanceURL(String sourceName, String guid); String getRelationshipURL(String sourceName, String guid);
} }
...@@ -20,7 +20,6 @@ package org.apache.atlas.omrs.localrepository.repositorycontentmanager; ...@@ -20,7 +20,6 @@ package org.apache.atlas.omrs.localrepository.repositorycontentmanager;
import org.apache.atlas.omrs.ffdc.exception.RepositoryErrorException; import org.apache.atlas.omrs.ffdc.exception.RepositoryErrorException;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.*; import org.apache.atlas.omrs.metadatacollection.properties.typedefs.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -29,37 +28,6 @@ import java.util.List; ...@@ -29,37 +28,6 @@ import java.util.List;
public interface OMRSTypeDefValidator public interface OMRSTypeDefValidator
{ {
/** /**
* Return a summary list of the TypeDefs supported by the local metadata repository. This is
* broadcast to the other servers/repositories in the cohort during the membership registration exchanges
* managed by the cohort registries.
*
* @return TypeDefSummary list
*/
ArrayList<TypeDefSummary> getLocalTypeDefs();
/**
* Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the
* local metadata repository. A true response means it is ok; false means conflicts have been found.
*
* A valid TypeDef is one that:
* <ul>
* <li>
* Matches name, GUID and version to a TypeDef in the local repository, or
* </li>
* <li>
* Is not defined in the local repository.
* </li>
* </ul>
*
* @param sourceName - source of the request (used for logging)
* @param typeDefSummaries - list of summary information about the TypeDefs.
*/
void validateAgainstLocalTypeDefs(String sourceName,
List<TypeDefSummary> typeDefSummaries);
/**
* Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the * Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the
* all known typedefs. * all known typedefs.
* *
...@@ -94,14 +62,24 @@ public interface OMRSTypeDefValidator ...@@ -94,14 +62,24 @@ public interface OMRSTypeDefValidator
/** /**
* Return boolean indicating whether the TypeDef or AttributeTypeDef is one of the standard open metadata types. * Return boolean indicating whether the TypeDef is one of the standard open metadata types.
*
* @param sourceName - source of the request (used for logging)
* @param typeGUID - unique identifier of the type
* @param typeName - unique name of the type
* @return boolean result
*/
boolean isOpenType(String sourceName, String typeGUID, String typeName);
/**
* Return boolean indicating whether the TypeDef is one of the standard open metadata types.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param typeDefGUID - unique identifier of the type * @param typeGUID - unique identifier of the type
* @param typeDefName - unique name of the type
* @return boolean result * @return boolean result
*/ */
boolean isOpenType(String sourceName, String typeDefGUID, String typeDefName); boolean isOpenTypeId(String sourceName, String typeGUID);
/** /**
...@@ -109,35 +87,56 @@ public interface OMRSTypeDefValidator ...@@ -109,35 +87,56 @@ public interface OMRSTypeDefValidator
* by one or more of the members of the cohort. * by one or more of the members of the cohort.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param typeDefGUID - unique identifier of the type * @param typeGUID - unique identifier of the type
* @param typeDefName - unique name of the type * @param typeName - unique name of the type
* @return boolean result * @return boolean result
*/ */
boolean isKnownType(String sourceName, String typeDefGUID, String typeDefName); boolean isKnownType(String sourceName, String typeGUID, String typeName);
/**
* Return boolean indicating whether the TypeDef/AttributeTypeDef is known, either as an open type, or one defined
* by one or more of the members of the cohort.
*
* @param sourceName - source of the request (used for logging)
* @param typeGUID - unique identifier of the type
* @return boolean result
*/
boolean isKnownTypeId(String sourceName, String typeGUID);
/** /**
* Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the local repository. * Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the local repository.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param typeDefGUID - unique identifier of the type * @param typeGUID - unique identifier of the type
* @param typeDefName - unique name of the type * @param typeName - unique name of the type
* @return boolean result * @return boolean result
*/ */
boolean isActiveType(String sourceName, String typeDefGUID, String typeDefName); boolean isActiveType(String sourceName, String typeGUID, String typeName);
/**
* Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the local repository.
*
* @param sourceName - source of the request (used for logging)
* @param typeGUID - unique identifier of the type
* @return boolean result
*/
boolean isActiveTypeId(String sourceName, String typeGUID);
/** /**
* Return boolean indicating whether the TypeDef/AttributeTypeDef identifiers are from a single known type or not. * Return boolean indicating whether the TypeDef/AttributeTypeDef identifiers are from a single known type or not.
* *
* @param sourceName - source of the request (used for logging) * @param sourceName - source of the request (used for logging)
* @param typeDefGUID - unique identifier of the TypeDef * @param typeGUID - unique identifier of the TypeDef
* @param typeDefName - unique name of the TypeDef * @param typeName - unique name of the TypeDef
* @return boolean result * @return boolean result
*/ */
boolean validTypeId(String sourceName, boolean validTypeId(String sourceName,
String typeDefGUID, String typeGUID,
String typeDefName); String typeName);
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment