http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSRepositoryConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSRepositoryConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSRepositoryConnector.java deleted file mode 100644 index 72de2f4..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSRepositoryConnector.java +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.omrs.localrepository.repositoryconnector; - -import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; -import org.apache.atlas.ocf.properties.beans.Connection; -import org.apache.atlas.omrs.eventmanagement.*; -import org.apache.atlas.omrs.eventmanagement.events.OMRSInstanceEventProcessor; -import org.apache.atlas.omrs.eventmanagement.events.OMRSTypeDefEventProcessor; -import org.apache.atlas.omrs.eventmanagement.repositoryeventmapper.OMRSRepositoryEventMapperConnector; -import org.apache.atlas.omrs.ffdc.OMRSErrorCode; -import org.apache.atlas.omrs.ffdc.exception.OMRSLogicErrorException; -import org.apache.atlas.omrs.ffdc.exception.RepositoryErrorException; -import org.apache.atlas.omrs.localrepository.OMRSLocalRepository; -import org.apache.atlas.omrs.localrepository.repositorycontentmanager.*; -import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection; -import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector; - - -/** - * LocalOMRSRepositoryConnector provides access the local metadata repository plus manages outbound - * repository events. - * - * It passes each request to both the real OMRS connector for the local metadata repository and an - * OMRSEventPublisher. The OMRSEventPublisher will use its configuration to decide if it needs to - * pass on the request to the rest of the metadata repository cohort. - */ -public class LocalOMRSRepositoryConnector extends OMRSRepositoryConnector implements OMRSLocalRepository -{ - private static final String repositoryEventMapperName = "LocalRepositoryEventMapper"; - private static final String repositoryName = "LocalRepository"; - - /* - * The repository content manager is the TypeDefManager for the Local OMRS Metadata Collection, - * The TypeDefValidator for the CohortRegistry and the incoming TypeDef Event Processor for the Archive - * Manager and EventListener - */ - private OMRSTypeDefValidator typeDefValidator; - private OMRSTypeDefManager typeDefManager; - private OMRSTypeDefEventProcessor incomingTypeDefEventProcessor; - - private OMRSInstanceEventProcessor incomingInstanceEventProcessor = null; - private OMRSRepositoryEventProcessor outboundRepositoryEventProcessor = null; - private OMRSRepositoryEventManager outboundRepositoryEventManager = null; - private OMRSRepositoryEventExchangeRule saveExchangeRule = null; - - private OMRSRepositoryConnector realLocalConnector = null; - private OMRSRepositoryEventMapperConnector realEventMapper = null; - - - /** - * Constructor used by the LocalOMRSConnectorProvider. It provides the information necessary to run the - * local repository. - * - * @param realLocalConnector - connector to the local repository - * @param realEventMapper - optional event mapper for local repository - * @param outboundRepositoryEventManager - event manager to call for outbound events. - * @param repositoryContentManager - repositoryContentManager for supporting OMRS in managing TypeDefs. - * @param saveExchangeRule - rule to determine what events to save to the local repository. - */ - protected LocalOMRSRepositoryConnector(OMRSRepositoryConnector realLocalConnector, - OMRSRepositoryEventMapperConnector realEventMapper, - OMRSRepositoryEventManager outboundRepositoryEventManager, - OMRSRepositoryContentManager repositoryContentManager, - OMRSRepositoryEventExchangeRule saveExchangeRule) - { - this.realLocalConnector = realLocalConnector; - this.realEventMapper = realEventMapper; - - this.outboundRepositoryEventManager = outboundRepositoryEventManager; - this.saveExchangeRule = saveExchangeRule; - - /* - * The repository content manager is the TypeDefManager for the Local OMRS Metadata Collection, - * The TypeDefValidator for the CohortRegistry and the incoming TypeDef Event Processor for the Archive - * Manager and EventListener - */ - this.typeDefValidator = repositoryContentManager; - this.typeDefManager = repositoryContentManager; - this.incomingTypeDefEventProcessor = repositoryContentManager; - - /* - * Incoming events are processed directly with real local connector to avoid the outbound event - * propagation managed by LocalOMRSMetadataCollection. - */ - if (repositoryContentManager != null) - { - repositoryContentManager.setupEventProcessor(this, - realLocalConnector, - saveExchangeRule, - outboundRepositoryEventManager); - } - - /* - * The realEventMapper is a plug-in component that handles repository events for - * repository that have additional APIs for managing metadata and need their own mechanism for - * sending OMRS Repository Events. If there is no realEventMapper then the localOMRSMetadataCollection - * will send the outbound repository events. - */ - if (realEventMapper != null) - { - realEventMapper.initialize(repositoryEventMapperName, - realLocalConnector); - realEventMapper.setRepositoryEventProcessor(outboundRepositoryEventManager); - } - else - { - /* - * When outboundRepositoryEventProcessor is not null then the local metadata collection creates events. - * Otherwise it assumes the event mapper will produce events. - */ - this.outboundRepositoryEventProcessor = outboundRepositoryEventManager; - } - } - - - /** - * Indicates that the connector is completely configured and can begin processing. - * - * @throws ConnectorCheckedException - there is a problem within the connector. - */ - public void start() throws ConnectorCheckedException - { - super.start(); - - if (realLocalConnector != null) - { - realLocalConnector.start(); - } - - if (realEventMapper != null) - { - realEventMapper.start(); - } - } - - - /** - * Free up any resources held since the connector is no longer needed. - * - * @throws ConnectorCheckedException - there is a problem within the connector. - */ - public void disconnect() throws ConnectorCheckedException - { - super.disconnect(); - - if (realLocalConnector != null) - { - realLocalConnector.disconnect(); - } - - if (realEventMapper != null) - { - realEventMapper.disconnect(); - } - } - - - /* - * ============================== - * OMRSMetadataCollectionManager - */ - - /** - * Set up a repository helper object for the repository connector to use. - * - * @param repositoryHelper - helper object for building TypeDefs and metadata instances. - */ - public void setRepositoryHelper(OMRSRepositoryHelper repositoryHelper) - { - super.setRepositoryHelper(repositoryHelper); - - if (realLocalConnector != null) - { - realLocalConnector.setRepositoryHelper(repositoryHelper); - } - - if (realEventMapper != null) - { - realEventMapper.setRepositoryHelper(repositoryHelper); - } - } - - - /** - * Set up a repository validator for the repository connector to use. - * - * @param repositoryValidator - validator object to check the validity of TypeDefs and metadata instances. - */ - public void setRepositoryValidator(OMRSRepositoryValidator repositoryValidator) - { - super.setRepositoryValidator(repositoryValidator); - - if (realLocalConnector != null) - { - realLocalConnector.setRepositoryValidator(repositoryValidator); - } - - if (realEventMapper != null) - { - realEventMapper.setRepositoryValidator(repositoryValidator); - } - } - - - /** - * Set up the maximum PageSize - * - * @param maxPageSize - maximum number of elements that can be retrieved on a request. - */ - public void setMaxPageSize(int maxPageSize) - { - super.setMaxPageSize(maxPageSize); - - if (realLocalConnector != null) - { - realLocalConnector.setMaxPageSize(maxPageSize); - } - } - - - /** - * Set up the name of the server where the metadata collection resides. - * - * @param serverName - String name - */ - public void setServerName(String serverName) - { - super.setServerName(serverName); - - if (realLocalConnector != null) - { - realLocalConnector.setServerName(serverName); - } - - if (realEventMapper != null) - { - realEventMapper.setServerName(serverName); - } - } - - - /** - * Set up the descriptive string describing the type of the server. This might be the - * name of the product, or similar identifier. - * - * @param serverType - String server type - */ - public void setServerType(String serverType) - { - super.setServerType(serverType); - - if (realLocalConnector != null) - { - realLocalConnector.setServerType(serverType); - } - - if (realEventMapper != null) - { - realEventMapper.setServerType(serverType); - } - } - - - - /** - * Set up the name of the organization that runs/owns the server. - * - * @param organizationName - String organization name - */ - public void setOrganizationName(String organizationName) - { - super.setOrganizationName(organizationName); - - if (realLocalConnector != null) - { - realLocalConnector.setOrganizationName(organizationName); - } - - if (realEventMapper != null) - { - realEventMapper.setOrganizationName(organizationName); - } - } - - - /** - * Set up the unique Id for this metadata collection. - * - * @param metadataCollectionId - String unique Id - */ - public void setMetadataCollectionId(String metadataCollectionId) - { - final String methodName = "setMetadataCollectionId"; - - super.setMetadataCollectionId(metadataCollectionId); - - if (realLocalConnector != null) - { - realLocalConnector.setMetadataCollectionId(metadataCollectionId); - } - - if (realEventMapper != null) - { - realEventMapper.setMetadataCollectionId(metadataCollectionId); - } - - this.incomingInstanceEventProcessor = new LocalOMRSInstanceEventProcessor(metadataCollectionId, - super.serverName, - realLocalConnector, - super.repositoryHelper, - super.repositoryValidator, - saveExchangeRule, - outboundRepositoryEventProcessor); - - try - { - /* - * Initialize the metadata collection only once the connector is properly set up. - */ - metadataCollection = new LocalOMRSMetadataCollection(this, - super.serverName, - super.repositoryHelper, - super.repositoryValidator, - metadataCollectionId, - this.getLocalServerName(), - this.getLocalServerType(), - this.getOrganizationName(), - realLocalConnector.getMetadataCollection(), - outboundRepositoryEventProcessor, - typeDefManager); - } - catch (Throwable error) - { - OMRSErrorCode errorCode = OMRSErrorCode.NULL_METADATA_COLLECTION; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(realLocalConnector.getRepositoryName()); - - throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction(), - error); - } - } - - /** - * Returns the metadata collection object that provides an OMRS abstraction of the metadata within - * a metadata repository. - * - * @return OMRSMetadataCollection - metadata information retrieved from the metadata repository. - * @throws RepositoryErrorException - no metadata collection - */ - public OMRSMetadataCollection getMetadataCollection() throws RepositoryErrorException - { - final String methodName = "getMetadataCollection"; - - if (metadataCollection == null) - { - OMRSErrorCode errorCode = OMRSErrorCode.NULL_METADATA_COLLECTION; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(repositoryName); - - throw new RepositoryErrorException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - - return metadataCollection; - } - - /* - * ==================================== - * OMRSLocalRepository - */ - - /** - * Returns the unique identifier (guid) of the local repository's metadata collection. - * - * @return String guid - */ - public String getMetadataCollectionId() - { - return super.metadataCollectionId; - } - - - /** - * Returns the Connection to the local repository that can be used by remote servers to create - * an OMRS repository connector to call this server in order to access the local repository. - * - * @return Connection object - */ - public Connection getLocalRepositoryRemoteConnection() - { - return new Connection(super.connection); - } - - - /** - * Return the event manager that the local repository uses to distribute events from the local repository. - * - * @return outbound repository event manager - */ - public OMRSRepositoryEventManager getOutboundRepositoryEventManager() - { - return outboundRepositoryEventManager; - } - - - /** - * Return the TypeDef event processor that should be passed all incoming TypeDef events received - * from the cohorts that this server is a member of. - * - * @return OMRSTypeDefEventProcessor for the local repository. - */ - public OMRSTypeDefEventProcessor getIncomingTypeDefEventProcessor() - { - return incomingTypeDefEventProcessor; - } - - - /** - * Return the instance event processor that should be passed all incoming instance events received - * from the cohorts that this server is a member of. - * - * @return OMRSInstanceEventProcessor for the local repository. - */ - public OMRSInstanceEventProcessor getIncomingInstanceEventProcessor() - { - return incomingInstanceEventProcessor; - } - - - /** - * Return the local server name - used for outbound events. - * - * @return String name - */ - public String getLocalServerName() { return super.serverName; } - - - /** - * Return the local server type - used for outbound events. - * - * @return String name - */ - public String getLocalServerType() { return super.serverType; } - - - /** - * Return the name of the organization that owns this local repository. - * - * @return String name - */ - public String getOrganizationName() { return super.organizationName; } -}
http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/OMRSInstanceRetrievalEventProcessor.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/OMRSInstanceRetrievalEventProcessor.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/OMRSInstanceRetrievalEventProcessor.java deleted file mode 100644 index e16df3b..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/OMRSInstanceRetrievalEventProcessor.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.omrs.localrepository.repositoryconnector; - -import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail; -import org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship; - -import java.util.List; - - -/** - * OMRSInstanceRetrievalEventProcessor defines the interface used by the Enterprise OMRS Repository Connector - * to pass instance metadata retrieved from remote open metadata repository connectors. - */ -public interface OMRSInstanceRetrievalEventProcessor -{ - /** - * Pass an entity that has been retrieved from a remote open metadata repository so it can be validated and - * (if the rules permit) cached in the local repository. - * - * @param sourceName - name of the source of this event. - * @param metadataCollectionId - unique identifier for the metadata from the remote repository - * @param entity - the retrieved entity. - * @return Validated and processed entity. - */ - EntityDetail processRetrievedEntity(String sourceName, - String metadataCollectionId, - EntityDetail entity); - - - /** - * Pass a list of entities that have been retrieved from a remote open metadata repository so they can be - * validated and (if the rules permit) cached in the local repository. - * - * @param sourceName - name of the source of this event. - * @param metadataCollectionId - unique identifier for the metadata from the remote repository - * @param entities - the retrieved relationships - * @return the validated and processed relationships - */ - List<EntityDetail> processRetrievedEntities(String sourceName, - String metadataCollectionId, - List<EntityDetail> entities); - - - /** - * Pass a relationship that has been retrieved from a remote open metadata repository so it can be validated and - * (if the rules permit) cached in the local repository. - * - * @param sourceName - name of the source of this event. - * @param metadataCollectionId - unique identifier for the metadata from the remote repository - * @param relationship - the retrieved relationship - * @return the validated and processed relationship - */ - Relationship processRetrievedRelationship(String sourceName, - String metadataCollectionId, - Relationship relationship); - - - /** - * Pass a list of relationships that have been retrieved from a remote open metadata repository so they can be - * validated and (if the rules permit) cached in the local repository. - * - * @param sourceName - name of the source of this event. - * @param metadataCollectionId - unique identifier for the metadata from the remote repository - * @param relationships - the list of retrieved relationships - * @return the validated and processed relationships - */ - List<Relationship> processRetrievedRelationships(String sourceName, - String metadataCollectionId, - List<Relationship> relationships); -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceHelper.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceHelper.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceHelper.java deleted file mode 100644 index 5e95b9a..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceHelper.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.omrs.localrepository.repositorycontentmanager; - - -import org.apache.atlas.omrs.ffdc.exception.TypeErrorException; -import org.apache.atlas.omrs.metadatacollection.properties.instances.*; - -import java.util.List; - - -/** - * OMRSInstanceHelper provides methods to help OMRS connectors and adapters ensure the content of - * entities and relationships match the type definitions recorded in the TypeDefs. - */ -public interface OMRSInstanceHelper -{ - /** - * Return an entity with the header and type information filled out. The caller only needs to add properties - * and classifications to complete the set up of the entity. - * - * @param sourceName - source of the request (used for logging) - * @param metadataCollectionId - unique identifier for the home metadata collection - * @param provenanceType - origin of the entity - * @param userName - name of the creator - * @param typeName - name of the type - * @return partially filled out entity - needs classifications and properties - * @throws TypeErrorException - the type name is not recognized. - */ - EntityDetail getSkeletonEntity(String sourceName, - String metadataCollectionId, - InstanceProvenanceType provenanceType, - String userName, - String typeName) throws TypeErrorException; - - - /** - * Return a classification with the header and type information filled out. The caller only needs to add properties - * and possibility origin information if it is propagated to complete the set up of the classification. - * - * @param sourceName - source of the request (used for logging) - * @param userName - name of the creator - * @param classificationTypeName - name of the classification type - * @param entityTypeName - name of the type for the entity that this classification is to be attached to. - * @return partially filled out classification - needs properties and possibly origin information - * @throws TypeErrorException - the type name is not recognized as a classification type. - */ - Classification getSkeletonClassification(String sourceName, - String userName, - String classificationTypeName, - String entityTypeName) throws TypeErrorException; - - - /** - * Return a relationship with the header and type information filled out. The caller only needs to add properties - * to complete the set up of the relationship. - * - * @param sourceName - source of the request (used for logging) - * @param metadataCollectionId - unique identifier for the home metadata collection - * @param provenanceType - origin type of the relationship - * @param userName - name of the creator - * @param typeName - name of the relationship's type - * @return partially filled out relationship - needs properties - * @throws TypeErrorException - the type name is not recognized as a relationship type. - */ - Relationship getSkeletonRelationship(String sourceName, - String metadataCollectionId, - InstanceProvenanceType provenanceType, - String userName, - String typeName) throws TypeErrorException; - - - /** - * Return a filled out entity. It just needs to add the classifications. - * - * @param sourceName - source of the request (used for logging) - * @param metadataCollectionId - unique identifier for the home metadata collection - * @param provenanceType - origin of the entity - * @param userName - name of the creator - * @param typeName - name of the type - * @param properties - properties for the entity - * @param classifications - list of classifications for the entity - * @return an entity that is filled out - * @throws TypeErrorException - the type name is not recognized as an entity type - */ - EntityDetail getNewEntity(String sourceName, - String metadataCollectionId, - InstanceProvenanceType provenanceType, - String userName, - String typeName, - InstanceProperties properties, - List<Classification> classifications) throws TypeErrorException; - - - /** - * Return a filled out relationship. - * - * @param sourceName - source of the request (used for logging) - * @param metadataCollectionId - unique identifier for the home metadata collection - * @param provenanceType - origin of the relationship - * @param userName - name of the creator - * @param typeName - name of the type - * @param properties - properties for the relationship - * @return a relationship that is filled out - * @throws TypeErrorException - the type name is not recognized as a relationship type - */ - Relationship getNewRelationship(String sourceName, - String metadataCollectionId, - InstanceProvenanceType provenanceType, - String userName, - String typeName, - InstanceProperties properties) throws TypeErrorException; - - - /** - * Return a classification with the header and type information filled out. The caller only needs to add properties - * to complete the set up of the classification. - * - * @param sourceName - source of the request (used for logging) - * @param userName - name of the creator - * @param typeName - name of the type - * @param entityTypeName - name of the type for the entity that this classification is to be attached to. - * @param classificationOrigin - origin of classification - * @param classificationOriginGUID - GUID of original classification if propagated - * @param properties - properties for the classification - * @return partially filled out classification - needs properties and possibly origin information - * @throws TypeErrorException - the type name is not recognized as a classification type. - */ - Classification getNewClassification(String sourceName, - String userName, - String typeName, - String entityTypeName, - ClassificationOrigin classificationOrigin, - String classificationOriginGUID, - InstanceProperties properties) throws TypeErrorException; -} http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceValidator.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceValidator.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceValidator.java deleted file mode 100644 index b3b75d8..0000000 --- a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSInstanceValidator.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.omrs.localrepository.repositorycontentmanager; - -import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail; -import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityProxy; -import org.apache.atlas.omrs.metadatacollection.properties.instances.EntitySummary; -import org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship; -import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefCategory; - - -/** - * OMRSInstanceValidator provides method to validate entities and relationships match their type definition - * (TypeDef). - */ -public interface OMRSInstanceValidator -{ - /** - * Test that the supplied entity is valid. - * - * @param sourceName - source of the entity (used for logging) - * @param entity - entity to test - * @return boolean result - */ - boolean validEntity(String sourceName, - EntitySummary entity); - - - /** - * Test that the supplied entity is valid. - * - * @param sourceName - source of the entity (used for logging) - * @param entity - entity to test - * @return boolean result - */ - boolean validEntity(String sourceName, - EntityProxy entity); - - - /** - * Test that the supplied entity is valid. - * - * @param sourceName - source of the entity (used for logging) - * @param entity - entity to test - * @return boolean result - */ - boolean validEntity(String sourceName, - EntityDetail entity); - - - /** - * Test that the supplied relationship is valid. - * - * @param sourceName - source of the relationship (used for logging) - * @param relationship - relationship to test - * @return boolean result - */ - boolean validRelationship(String sourceName, - Relationship relationship); - - /** - * Verify that the identifiers for an instance are correct. - * - * @param sourceName - source of the instance (used for logging) - * @param typeDefGUID - unique identifier for the type. - * @param typeDefName - unique name for the type. - * @param category - expected category of the instance. - * @param instanceGUID - unique identifier for the instance. - * @return boolean indicating whether the identifiers are ok. - */ - boolean validInstanceId(String sourceName, - String typeDefGUID, - String typeDefName, - TypeDefCategory category, - String instanceGUID); -}