You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by da...@apache.org on 2018/02/16 09:52:25 UTC

[09/30] atlas git commit: ATLAS-2246: OMRS Connector API plus REST and IGC Connector skeleton - 15th February 2018

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryHelper.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryHelper.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryHelper.java
new file mode 100644
index 0000000..bd7fcbd
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryHelper.java
@@ -0,0 +1,551 @@
+/*
+ * 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.OMRSErrorCode;
+import org.apache.atlas.omrs.ffdc.exception.OMRSLogicErrorException;
+import org.apache.atlas.omrs.ffdc.exception.PatchErrorException;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.*;
+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.TypeDefCategory;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefPatch;
+
+import org.apache.atlas.omrs.ffdc.exception.TypeErrorException;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.UUID;
+
+/**
+ * OMRSRepositoryHelper provides methods to repository connectors and repository event mappers to help
+ * them build valid type definitions (TypeDefs), entities and relationships.  It is a facade to the
+ * repository content manager which holds an in memory cache of all the active TypeDefs in the local server.
+ * OMRSRepositoryHelper's purpose is to create a object that the repository connectors and event mappers can
+ * create, use and discard without needing to know how to connect to the repository content manager.
+ */
+public class OMRSRepositoryHelper implements OMRSTypeDefHelper, OMRSInstanceHelper
+{
+    private static OMRSRepositoryContentManager    repositoryContentManager = null;
+
+    /**
+     * Set up the local repository's content manager.  This maintains a cache of the local repository's type
+     * definitions and rules to provide helpers and validators for TypeDefs and instances that are
+     * exchanged amongst the open metadata repositories and open metadata access services (OMAS).
+     *
+     * @param repositoryContentManager - link to repository content manager.
+     */
+    public static synchronized void setRepositoryContentManager(OMRSRepositoryContentManager    repositoryContentManager)
+    {
+        OMRSRepositoryHelper.repositoryContentManager = repositoryContentManager;
+    }
+
+
+    /*
+     * ========================
+     * OMRSTypeDefHelper
+     */
+
+    /**
+     * Return the TypeDef identified by the name supplied by the caller.  This is used in the connectors when
+     * validating the actual types of the repository with the known open metadata types - looking specifically
+     * for types of the same name but with different content.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefName - unique name for the TypeDef
+     * @return TypeDef object or null if TypeDef is not known.
+     */
+    public TypeDef  getTypeDefByName (String    sourceName,
+                                      String    typeDefName)
+    {
+        final String  methodName = "getTypeDefByName()";
+
+        if (repositoryContentManager != null)
+        {
+            /*
+             * Delegate call to repository content manager.
+             */
+            return repositoryContentManager.getTypeDefByName(sourceName, typeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                    + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return the AttributeTypeDef identified by the name supplied by the caller.  This is used in the connectors when
+     * validating the actual types of the repository with the known open metadata types - looking specifically
+     * for types of the same name but with different content.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param attributeTypeDefName - unique name for the TypeDef
+     * @return AttributeTypeDef object or null if AttributeTypeDef is not known.
+     */
+    public AttributeTypeDef getAttributeTypeDefByName (String    sourceName,
+                                                       String    attributeTypeDefName)
+    {
+        final String  methodName = "getAttributeTypeDefByName()";
+
+        if (repositoryContentManager != null)
+        {
+            /*
+             * Delegate call to repository content manager.
+             */
+            return repositoryContentManager.getAttributeTypeDefByName(sourceName, attributeTypeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                    + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return the TypeDef identified by the guid and name supplied by the caller.  This call is used when
+     * 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 typeDefGUID - unique identifier for the TypeDef
+     * @param typeDefName - unique name for the TypeDef
+     * @return TypeDef object
+     * @throws TypeErrorException - unknown or invalid type
+     */
+    public TypeDef  getTypeDef (String    sourceName,
+                                String    typeDefGUID,
+                                String    typeDefName) throws TypeErrorException
+    {
+        final String  methodName = "getTypeDef()";
+
+        if (repositoryContentManager != null)
+        {
+            /*
+             * Delegate call to repository content manager.
+             */
+            return repositoryContentManager.getTypeDef(sourceName, typeDefGUID, typeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                                + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return the AttributeTypeDef identified by the guid and name supplied by the caller.  This call is used when
+     * retrieving a type that should exist.  For example, retrieving the type definition of a metadata instance's
+     * property.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param attributeTypeDefGUID - unique identifier for the AttributeTypeDef
+     * @param attributeTypeDefName - unique name for the AttributeTypeDef
+     * @return TypeDef object
+     * @throws TypeErrorException - unknown or invalid type
+     */
+    public AttributeTypeDef  getAttributeTypeDef (String    sourceName,
+                                                  String    attributeTypeDefGUID,
+                                                  String    attributeTypeDefName) throws TypeErrorException
+    {
+        final String  methodName = "getAttributeTypeDef()";
+
+        if (repositoryContentManager != null)
+        {
+            /*
+             * Delegate call to repository content manager.
+             */
+            return repositoryContentManager.getAttributeTypeDef(sourceName, attributeTypeDefGUID, attributeTypeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                    + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Returns an updated TypeDef that has had the supplied patch applied.  It throws an exception if any part of
+     * the patch is incompatible with the original TypeDef.  For example, if there is a mismatch between
+     * the type or version that either represents.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefPatch - patch to apply
+     * @return updated TypeDef
+     * @throws PatchErrorException - the patch is either badly formatted, or does not apply to the supplied TypeDef
+     */
+    public TypeDef applyPatch(String sourceName, TypeDefPatch typeDefPatch) throws PatchErrorException
+    {
+        final String  methodName = "applyPatch()";
+
+        if (repositoryContentManager != null)
+        {
+            /*
+             * Delegate call to repository content manager.
+             */
+            return repositoryContentManager.applyPatch(sourceName, typeDefPatch);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                                + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /*
+     * ======================
+     * 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.
+     */
+    public EntityDetail getSkeletonEntity(String                  sourceName,
+                                          String                  metadataCollectionId,
+                                          InstanceProvenanceType  provenanceType,
+                                          String                  userName,
+                                          String                  typeName) throws TypeErrorException
+    {
+        final String methodName = "getSkeletonEntity()";
+
+        if (repositoryContentManager != null)
+        {
+            EntityDetail entity = new EntityDetail();
+            String       guid   = UUID.randomUUID().toString();
+
+            entity.setInstanceProvenanceType(provenanceType);
+            entity.setMetadataCollectionId(metadataCollectionId);
+            entity.setCreateTime(new Date());
+            entity.setGUID(guid);
+            entity.setVersion(1L);
+
+            entity.setType(repositoryContentManager.getInstanceType(sourceName, TypeDefCategory.ENTITY_DEF, typeName));
+            entity.setStatus(repositoryContentManager.getInitialStatus(sourceName, typeName));
+            entity.setCreatedBy(userName);
+            entity.setInstanceURL(repositoryContentManager.getInstanceURL(sourceName, guid));
+
+            return entity;
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                                + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * 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.
+     */
+    public Classification getSkeletonClassification(String       sourceName,
+                                                    String       userName,
+                                                    String       classificationTypeName,
+                                                    String       entityTypeName) throws TypeErrorException
+    {
+        final String  methodName = "getSkeletonClassification()";
+
+        if (repositoryContentManager != null)
+        {
+            if (repositoryContentManager.isValidTypeCategory(sourceName,
+                                                             TypeDefCategory.CLASSIFICATION_DEF,
+                                                             classificationTypeName))
+            {
+                if (repositoryContentManager.isValidClassificationForEntity(sourceName,
+                                                                            classificationTypeName,
+                                                                            entityTypeName))
+                {
+                    Classification classification = new Classification();
+
+                    classification.setName(classificationTypeName);
+                    classification.setCreateTime(new Date());
+                    classification.setCreatedBy(userName);
+                    classification.setVersion(1L);
+                    classification.setStatus(repositoryContentManager.getInitialStatus(sourceName,
+                                                                                       classificationTypeName));
+
+                    return classification;
+                }
+                else
+                {
+                    OMRSErrorCode errorCode = OMRSErrorCode.INVALID_CLASSIFICATION_FOR_ENTITY;
+                    String errorMessage = errorCode.getErrorMessageId()
+                                        + errorCode.getFormattedErrorMessage(classificationTypeName, entityTypeName);
+
+                    throw new TypeErrorException(errorCode.getHTTPErrorCode(),
+                                                 this.getClass().getName(),
+                                                 methodName,
+                                                 errorMessage,
+                                                 errorCode.getSystemAction(),
+                                                 errorCode.getUserAction());
+                }
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.UNKNOWN_CLASSIFICATION;
+                String errorMessage = errorCode.getErrorMessageId()
+                                    + errorCode.getFormattedErrorMessage(classificationTypeName);
+
+                throw new TypeErrorException(errorCode.getHTTPErrorCode(),
+                                             this.getClass().getName(),
+                                             methodName,
+                                             errorMessage,
+                                             errorCode.getSystemAction(),
+                                             errorCode.getUserAction());
+            }
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                                + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * 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.
+     */
+    public Relationship getSkeletonRelationship(String                  sourceName,
+                                                String                  metadataCollectionId,
+                                                InstanceProvenanceType  provenanceType,
+                                                String                  userName,
+                                                String                  typeName) throws TypeErrorException
+    {
+        final String  methodName = "getSkeletonRelationship()";
+
+
+        if (repositoryContentManager != null)
+        {
+            Relationship relationship = new Relationship();
+            String       guid = UUID.randomUUID().toString();
+
+            relationship.setInstanceProvenanceType(provenanceType);
+            relationship.setMetadataCollectionId(metadataCollectionId);
+            relationship.setCreateTime(new Date());
+            relationship.setGUID(guid);
+            relationship.setVersion(1L);
+
+            relationship.setType(repositoryContentManager.getInstanceType(sourceName,
+                                                                          TypeDefCategory.RELATIONSHIP_DEF,
+                                                                          typeName));
+            relationship.setStatus(repositoryContentManager.getInitialStatus(sourceName, typeName));
+            relationship.setCreatedBy(userName);
+            relationship.setInstanceURL(repositoryContentManager.getInstanceURL(sourceName, guid));
+
+            return relationship;
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId()
+                                + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * 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
+     */
+    public EntityDetail getNewEntity(String                    sourceName,
+                                     String                    metadataCollectionId,
+                                     InstanceProvenanceType    provenanceType,
+                                     String                    userName,
+                                     String                    typeName,
+                                     InstanceProperties        properties,
+                                     ArrayList<Classification> classifications) throws TypeErrorException
+    {
+        EntityDetail entity = this.getSkeletonEntity(sourceName,
+                                                     metadataCollectionId,
+                                                     provenanceType,
+                                                     userName,
+                                                     typeName);
+
+        entity.setProperties(properties);
+        entity.setClassifications(classifications);
+
+        return entity;
+    }
+
+
+    /**
+     * 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
+     */
+    public Relationship getNewRelationship(String                  sourceName,
+                                           String                  metadataCollectionId,
+                                           InstanceProvenanceType  provenanceType,
+                                           String                  userName,
+                                           String                  typeName,
+                                           InstanceProperties      properties) throws TypeErrorException
+    {
+        Relationship relationship = this.getSkeletonRelationship(sourceName,
+                                                                 metadataCollectionId,
+                                                                 provenanceType,
+                                                                 userName,
+                                                                 typeName);
+
+        relationship.setProperties(properties);
+
+        return relationship;
+    }
+
+
+    /**
+     * 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 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.
+     */
+    public Classification getNewClassification(String               sourceName,
+                                               String               userName,
+                                               String               typeName,
+                                               String               entityTypeName,
+                                               ClassificationOrigin classificationOrigin,
+                                               String               classificationOriginGUID,
+                                               InstanceProperties   properties) throws TypeErrorException
+    {
+        Classification classification = this.getSkeletonClassification(sourceName,
+                                                                       userName,
+                                                                       typeName,
+                                                                       entityTypeName);
+
+        classification.setClassificationOrigin(classificationOrigin);
+        classification.setClassificationOriginGUID(classificationOriginGUID);
+        classification.setProperties(properties);
+
+        return classification;
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryValidator.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryValidator.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryValidator.java
new file mode 100644
index 0000000..6a73a9d
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSRepositoryValidator.java
@@ -0,0 +1,529 @@
+/*
+ * 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.OMRSErrorCode;
+import org.apache.atlas.omrs.ffdc.exception.OMRSLogicErrorException;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceType;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefCategory;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary;
+
+import java.util.ArrayList;
+
+/**
+ * OMRSRepositoryValidator provides methods to validate TypeDefs and Instances returned from
+ * an open metadata repository.  An instance can be created by any OMRS component, or OMRS adapter and
+ * it will connect to the local repository's content manager to access the local type definitions (TypeDefs)
+ * and rules.
+ */
+public class OMRSRepositoryValidator implements OMRSTypeDefValidator, OMRSInstanceValidator
+{
+    private static OMRSRepositoryContentManager    repositoryContentManager = null;
+
+    /**
+     * Set up the local repository's content manager.  This maintains a cache of the local repository's type
+     * definitions and rules to provide helpers and validators for TypeDefs and instances that are
+     * exchanged amongst the open metadata repositories and open metadata access services (OMAS).
+     *
+     * @param repositoryContentManager - link to repository content manager.
+     */
+    public static synchronized void setRepositoryContentManager(OMRSRepositoryContentManager  repositoryContentManager)
+    {
+        OMRSRepositoryHelper.setRepositoryContentManager(repositoryContentManager);
+    }
+
+
+    /**
+     * Return a summary list of the TypeDefs supported by the local metadata repository.  This is
+     * broadcast to the other servers/repositories in the cluster during the membership registration exchanges
+     * managed by the cluster registries.
+     *
+     * @return TypeDefSummary iterator
+     */
+    public ArrayList<TypeDefSummary> getLocalTypeDefs()
+    {
+        final String  methodName = "getLocalTypeDefs()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.getLocalTypeDefs();
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+
+    }
+
+
+    /**
+     * 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 - name of the caller
+     * @param typeDefSummaries - list of summary information about the TypeDefs.
+     */
+    public void validateAgainstLocalTypeDefs(String   sourceName,
+                                             ArrayList<TypeDefSummary> typeDefSummaries)
+    {
+        final String  methodName = "validateAgainstLocalTypeDefs()";
+
+        if (repositoryContentManager != null)
+        {
+            repositoryContentManager.validateAgainstLocalTypeDefs(sourceName, typeDefSummaries);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the
+     * all known typedefs.
+     *
+     * A valid TypeDef is one that matches name, GUID and version to the full list of TypeDefs.
+     * If a new TypeDef is present, it is added to the enterprise list.
+     *
+     * @param typeDefs - list of TypeDefs.
+     * @return boolean flag
+     */
+    public boolean   validateEnterpriseTypeDefs(String             sourceName,
+                                                ArrayList<TypeDef> typeDefs)
+    {
+        final String  methodName = "validateEnterpriseTypeDefs()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validateEnterpriseTypeDefs(sourceName, typeDefs);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return boolean indicating whether the TypeDef is in use in the repository.
+     *
+     * @param sourceName - name of caller
+     * @param typeDefGUID - unique identifier of the type
+     * @param typeDefName - unique name of the type
+     * @return boolean flag
+     */
+    public boolean isActiveType(String   sourceName, String   typeDefGUID, String   typeDefName)
+    {
+        final String  methodName = "isActiveType()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.isActiveType(sourceName, typeDefGUID, typeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+    /**
+     * Return boolean indicating whether the TypeDef is one of the open metadata types.
+     *
+     * @param sourceName - name of caller
+     * @param typeDefGUID - unique identifier of the type
+     * @param typeDefName - unique name of the type
+     * @return boolean flag
+     */
+    public boolean isOpenType(String   sourceName, String   typeDefGUID, String   typeDefName)
+    {
+        final String  methodName = "isOpenType()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.isOpenType(sourceName, typeDefGUID, typeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return boolean indicating whether the TypeDef is in use in the repository.
+     *
+     * @param sourceName - name of caller
+     * @param typeDefGUID - unique identifier of the type
+     * @param typeDefName - unique name of the type
+     * @return boolean flag
+     */
+    public boolean isKnownType(String   sourceName, String   typeDefGUID, String   typeDefName)
+    {
+        final String  methodName = "isKnownType()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.isKnownType(sourceName, typeDefGUID, typeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the TypeDef
+     * @param typeDefName - unique name of the TypeDef
+     * @return boolean result
+     */
+    public boolean validTypeId(String          sourceName,
+                               String          typeDefGUID,
+                               String          typeDefName)
+    {
+        final String  methodName = "validTypeId()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validTypeId(sourceName,
+                                                        typeDefGUID,
+                                                        typeDefName);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the TypeDef
+     * @param typeDefName - unique name of the TypeDef
+     * @param category - category for the TypeDef
+     * @return boolean result
+     */
+    public boolean validTypeId(String          sourceName,
+                               String          typeDefGUID,
+                               String          typeDefName,
+                               TypeDefCategory category)
+    {
+        final String  methodName = "validTypeId()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validTypeId(sourceName,
+                                                        typeDefGUID,
+                                                        typeDefName,
+                                                        category);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the TypeDef
+     * @param typeDefName - unique name of the TypeDef
+     * @param typeDefVersion - versionName of the type
+     * @param category - category for the TypeDef
+     * @return boolean result
+     */
+    public boolean validTypeId(String          sourceName,
+                               String          typeDefGUID,
+                               String          typeDefName,
+                               long            typeDefVersion,
+                               TypeDefCategory category)
+    {
+        final String  methodName = "validTypeId()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validTypeId(sourceName,
+                                                        typeDefGUID,
+                                                        typeDefName,
+                                                        typeDefVersion,
+                                                        category);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return boolean indicating whether the supplied TypeDef is valid or not.
+     *
+     * @param sourceName - source of the TypeDef (used for logging)
+     * @param typeDef - TypeDef to test
+     * @return boolean result
+     */
+    public boolean validTypeDef(String         sourceName,
+                                TypeDef        typeDef)
+    {
+        final String  methodName = "validTypeDef()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validTypeDef(sourceName, typeDef);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return boolean indicating whether the supplied TypeDefSummary is valid or not.
+     *
+     * @param sourceName - source of the TypeDefSummary (used for logging)
+     * @param typeDefSummary - TypeDefSummary to test.
+     * @return boolean result.
+     */
+    public boolean validTypeDefSummary(String                sourceName,
+                                       TypeDefSummary        typeDefSummary)
+    {
+        final String  methodName = "validTypeDefSummary()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validTypeDefSummary(sourceName, typeDefSummary);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Test that the supplied entity is valid.
+     *
+     * @param sourceName - source of the entity (used for logging)
+     * @param entity - entity to test
+     * @return boolean result
+     */
+    public boolean validEntity(String       sourceName,
+                               EntityDetail entity)
+    {
+        final String  methodName = "validEntity()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validEntity(sourceName, entity);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Test that the supplied relationship is valid.
+     *
+     * @param sourceName - name of the caller (used for logging)
+     * @param relationship - relationship to test
+     * @return boolean result
+     */
+    public boolean validRelationship(String       sourceName,
+                                     Relationship relationship)
+    {
+        final String  methodName = "validRelationship()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validRelationship(sourceName, relationship);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * 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.
+     */
+    public boolean validInstanceId(String           sourceName,
+                                   String           typeDefGUID,
+                                   String           typeDefName,
+                                   TypeDefCategory  category,
+                                   String           instanceGUID)
+    {
+        final String  methodName = "validInstanceId()";
+
+        if (repositoryContentManager != null)
+        {
+            return repositoryContentManager.validInstanceId(sourceName,
+                                                            typeDefGUID,
+                                                            typeDefName,
+                                                            category,
+                                                            instanceGUID);
+        }
+        else
+        {
+            OMRSErrorCode errorCode = OMRSErrorCode.LOCAL_REPOSITORY_CONFIGURATION_ERROR;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(),
+                                              this.getClass().getName(),
+                                              methodName,
+                                              errorMessage,
+                                              errorCode.getSystemAction(),
+                                              errorCode.getUserAction());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java
new file mode 100644
index 0000000..113393b
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java
@@ -0,0 +1,101 @@
+/*
+ * 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.PatchErrorException;
+import org.apache.atlas.omrs.ffdc.exception.TypeErrorException;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceType;
+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.TypeDefPatch;
+
+/**
+ * OMRSTypeDefHelper provides methods for manipulating TypeDefs and creating metadata instances with the correct TypeDef
+ * headers
+ */
+public interface OMRSTypeDefHelper
+{
+    /**
+     * Return the TypeDef identified by the name supplied by the caller.  This is used in the connectors when
+     * validating the actual types of the repository with the known open metadata types - looking specifically
+     * for types of the same name but with different content.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefName - unique name for the TypeDef
+     * @return TypeDef object or null if TypeDef is not known.
+     */
+    TypeDef  getTypeDefByName (String    sourceName,
+                               String    typeDefName);
+
+
+    /**
+     * Return the AttributeTypeDef identified by the name supplied by the caller.  This is used in the connectors when
+     * validating the actual types of the repository with the known open metadata types - looking specifically
+     * for types of the same name but with different content.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param attributeTypeDefName - unique name for the TypeDef
+     * @return AttributeTypeDef object or null if AttributeTypeDef is not known.
+     */
+    AttributeTypeDef getAttributeTypeDefByName (String    sourceName,
+                                                String    attributeTypeDefName);
+
+
+    /**
+     * Return the TypeDef identified by the guid and name supplied by the caller.  This call is used when
+     * 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 typeDefGUID - unique identifier for the TypeDef
+     * @param typeDefName - unique name for the TypeDef
+     * @return TypeDef object
+     * @throws TypeErrorException - unknown or invalid type
+     */
+    TypeDef  getTypeDef (String    sourceName,
+                         String    typeDefGUID,
+                         String    typeDefName) throws TypeErrorException;
+
+
+    /**
+     * Return the AttributeTypeDef identified by the guid and name supplied by the caller.  This call is used when
+     * retrieving a type that should exist.  For example, retrieving the type definition of a metadata instance's
+     * property.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param attributeTypeDefGUID - unique identifier for the AttributeTypeDef
+     * @param attributeTypeDefName - unique name for the AttributeTypeDef
+     * @return TypeDef object
+     * @throws TypeErrorException - unknown or invalid type
+     */
+    AttributeTypeDef  getAttributeTypeDef (String    sourceName,
+                                           String    attributeTypeDefGUID,
+                                           String    attributeTypeDefName) throws TypeErrorException;
+
+
+    /**
+     * Returns an updated TypeDef that has had the supplied patch applied.  It throws an exception if any part of
+     * the patch is incompatible with the original TypeDef.  For example, if there is a mismatch between
+     * the type or version that either represents.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefPatch - patch to apply
+     * @return updated TypeDef
+     * @throws PatchErrorException - the patch is either badly formatted, or does not apply to the supplied TypeDef
+     */
+    TypeDef   applyPatch(String   sourceName, TypeDefPatch typeDefPatch) throws PatchErrorException;
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java
new file mode 100644
index 0000000..34bc02a
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java
@@ -0,0 +1,181 @@
+/*
+ * 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.InstanceStatus;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceType;
+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.TypeDefCategory;
+
+
+/**
+ * OMRSTypeDefManager provides maintenance methods for managing the TypeDefs in the local cache and supporting
+ * the OMRSInstanceHelper to build instances that respect their type definition (TypeDef).
+ */
+public interface OMRSTypeDefManager
+{
+    /**
+     * Cache a definition of a new TypeDef.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param newTypeDef - TypeDef structure describing the new TypeDef.
+     */
+    void addTypeDef(String  sourceName, TypeDef      newTypeDef);
+
+
+    /**
+     * Cache a definition of a new AttributeTypeDef.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param newAttributeTypeDef - AttributeTypeDef structure describing the new TypeDef.
+     */
+    void addAttributeTypeDef(String  sourceName, AttributeTypeDef newAttributeTypeDef);
+
+
+    /**
+     * Update one or more properties of a cached TypeDef.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDef - TypeDef structure.
+     */
+    void updateTypeDef(String  sourceName, TypeDef   typeDef);
+
+
+    /**
+     * Delete a cached TypeDef.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param obsoleteTypeDefGUID - String unique identifier for the TypeDef.
+     * @param obsoleteTypeDefName - String unique name for the TypeDef.
+     */
+    void deleteTypeDef(String    sourceName,
+                       String    obsoleteTypeDefGUID,
+                       String    obsoleteTypeDefName);
+
+
+    /**
+     * Delete a cached AttributeTypeDef.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param obsoleteTypeDefGUID - String unique identifier for the AttributeTypeDef.
+     * @param obsoleteTypeDefName - String unique name for the AttributeTypeDef.
+     */
+    void deleteAttributeTypeDef(String    sourceName,
+                                String    obsoleteTypeDefGUID,
+                                String    obsoleteTypeDefName);
+
+
+    /**
+     * Change the identifiers for a TypeDef.
+     *
+     * @param sourceName - source of the request (used for logging).
+     * @param originalTypeDefGUID - TypeDef's original unique identifier.
+     * @param originalTypeDefName - TypeDef's original unique name.
+     * @param newTypeDef - updated TypeDef with new identifiers.
+     */
+    void reIdentifyTypeDef(String   sourceName,
+                           String   originalTypeDefGUID,
+                           String   originalTypeDefName,
+                           TypeDef  newTypeDef);
+
+
+    /**
+     * Change the identifiers for an AttributeTypeDef.
+     *
+     * @param sourceName - source of the request (used for logging).
+     * @param originalAttributeTypeDefGUID - AttributeTypeDef's original unique identifier.
+     * @param originalAttributeTypeDefName - AttributeTypeDef's original unique name.
+     * @param newAttributeTypeDef - updated AttributeTypeDef with new identifiers
+     */
+    void reIdentifyAttributeTypeDef(String            sourceName,
+                                    String            originalAttributeTypeDefGUID,
+                                    String            originalAttributeTypeDefName,
+                                    AttributeTypeDef  newAttributeTypeDef);
+
+
+    /**
+     * Return a boolean indicating that the type name matches the category.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param category - TypeDefCategory enum value to test
+     * @param typeName - type name to test
+     * @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
+     *                              is an error in the type definition (TypeDef) cached.
+     */
+    boolean    isValidTypeCategory(String            sourceName,
+                                   TypeDefCategory   category,
+                                   String            typeName) throws TypeErrorException;
+
+
+    /**
+     * Return boolean indicating if a classification type can be applied to a specified entity.  This
+     * uses the list of valid entity types located in the ClassificationDef.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param classificationTypeName - name of the classification's type (ClassificationDef)
+     * @param entityTypeName - name of the entity's type (EntityDef)
+     * @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
+     *                              is an error in the type definition (TypeDef) cached.
+     */
+    boolean    isValidClassificationForEntity(String  sourceName,
+                                              String  classificationTypeName,
+                                              String  entityTypeName) throws TypeErrorException;
+
+
+    /**
+     * Return identifiers for the TypeDef that matches the supplied type name.  If the type name is not recognized,
+     * null is returned.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param category - category of type
+     * @param typeName - String type name - the type name is not recognized or of the wrong category.
+     * @return InstanceType object containing TypeDef unique identifier (guid), typeDef name and versionName
+     * @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.
+     */
+    InstanceType getInstanceType(String            sourceName,
+                                 TypeDefCategory   category,
+                                 String            typeName) throws TypeErrorException;
+
+
+    /**
+     * Return the initial status set up for the instance.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeName - name of the type to extract the initial status from.
+     * @return InstanceStatus enum
+     * @throws TypeErrorException - the type name is not recognized.
+     */
+    InstanceStatus getInitialStatus(String sourceName, String typeName) throws TypeErrorException;
+
+
+    /**
+     * Return the URL string to use for direct access to the metadata instance.  This can be used for
+     * 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 guid - unique identifier for the instance.
+     * @return String URL with placeholder for variables such as userId.
+     */
+    String getInstanceURL(String sourceName, String guid);
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java
new file mode 100644
index 0000000..9c7281a
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java
@@ -0,0 +1,176 @@
+/*
+ * 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.typedefs.TypeDef;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefCategory;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary;
+
+import java.util.ArrayList;
+
+/**
+ * OMRSTypeDefValidator describes a component that is able to manage TypeDefs for the local metadata repository.
+ */
+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,
+                                      ArrayList<TypeDefSummary> typeDefSummaries);
+
+
+    /**
+     * Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the
+     * all known typedefs.
+     *
+     * A valid TypeDef is one that matches name, GUID and version to the full list of TypeDefs.
+     * If a new TypeDef is present, it is added to the enterprise list.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefs - list of TypeDefs.
+     * @return boolean flag
+     */
+    boolean   validateEnterpriseTypeDefs(String             sourceName,
+                                         ArrayList<TypeDef> typeDefs);
+
+
+    /**
+     * Return boolean indicating whether the TypeDef is one of the standard open metadata types.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the type
+     * @param typeDefName - unique name of the type
+     * @return boolean result
+     */
+    boolean isOpenType(String  sourceName, String   typeDefGUID, String   typeDefName);
+
+
+    /**
+     * Return boolean indicating whether the TypeDef 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 typeDefGUID - unique identifier of the type
+     * @param typeDefName - unique name of the type
+     * @return boolean result
+     */
+    boolean isKnownType(String  sourceName, String   typeDefGUID, String   typeDefName);
+
+
+    /**
+     * Return boolean indicating whether the TypeDef is in use in the local repository.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the type
+     * @param typeDefName - unique name of the type
+     * @return boolean result
+     */
+    boolean isActiveType(String  sourceName, String   typeDefGUID, String   typeDefName);
+
+
+    /**
+     * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the TypeDef
+     * @param typeDefName - unique name of the TypeDef
+     * @return boolean result
+     */
+    boolean validTypeId(String          sourceName,
+                        String          typeDefGUID,
+                        String          typeDefName);
+
+
+    /**
+     * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the TypeDef
+     * @param typeDefName - unique name of the TypeDef
+     * @param category - category for the TypeDef
+     * @return boolean result
+     */
+    boolean validTypeId(String          sourceName,
+                        String          typeDefGUID,
+                        String          typeDefName,
+                        TypeDefCategory category);
+
+
+    /**
+     * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDefGUID - unique identifier of the TypeDef
+     * @param typeDefName - unique name of the TypeDef
+     * @param typeDefVersion - versionName of the type
+     * @param category - category for the TypeDef
+     * @return boolean result
+     */
+    boolean validTypeId(String          sourceName,
+                        String          typeDefGUID,
+                        String          typeDefName,
+                        long            typeDefVersion,
+                        TypeDefCategory category);
+
+
+    /**
+     * Return boolean indicating whether the supplied TypeDef is valid or not.
+     *
+     * @param sourceName - source of the request (used for logging)
+     * @param typeDef - TypeDef to test
+     * @return boolean result
+     */
+    boolean validTypeDef(String         sourceName,
+                         TypeDef        typeDef);
+
+
+    /**
+     * Return boolean indicating whether the supplied TypeDefSummary is valid or not.
+     *
+     * @param sourceName - source of the TypeDefSummary (used for logging)
+     * @param typeDefSummary - TypeDefSummary to test.
+     * @return boolean result.
+     */
+    boolean validTypeDefSummary(String                sourceName,
+                                TypeDefSummary        typeDefSummary);
+}