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:39 UTC

[23/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/enterprise/repositoryconnector/EnterpriseOMRSMetadataCollection.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSMetadataCollection.java b/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSMetadataCollection.java
new file mode 100644
index 0000000..12a6ea5
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSMetadataCollection.java
@@ -0,0 +1,3995 @@
+/*
+ * 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.enterprise.repositoryconnector;
+
+import org.apache.atlas.omrs.ffdc.OMRSErrorCode;
+import org.apache.atlas.omrs.ffdc.exception.*;
+import org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryValidator;
+import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection;
+import org.apache.atlas.omrs.metadatacollection.properties.MatchCriteria;
+import org.apache.atlas.omrs.metadatacollection.properties.SequencingOrder;
+import org.apache.atlas.omrs.metadatacollection.properties.instances.*;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.*;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+
+/**
+ * EnterpriseOMRSMetadataCollection executes the calls to the open metadata repositories registered
+ * with the OMRSEnterpriseConnectorManager.  The effect is a federated view over these open metadata
+ * repositories.
+ * <p>
+ *     EnterpriseOMRSMetadataCollection is part of an EnterpriseOMRSRepositoryConnector.  The EnterpriseOMRSRepositoryConnector
+ *     holds the list of OMRS Connectors, one for each of the metadata repositories.  This list may change
+ *     over time as metadata repositories register and deregister with the connected cohorts.
+ *     The EnterpriseOMRSRepositoryConnector is responsible for keeping the list of connectors up-to-date through
+ *     contact with the OMRSEnterpriseConnectorManager.
+ * </p>
+ * <p>
+ *     When a request is made to the EnterpriseOMRSMetadataCollection, it calls the EnterpriseOMRSRepositoryConnector
+ *     to request the appropriate list of metadata collection for the request.  Then the EnterpriseOMRSConnector
+ *     calls the appropriate remote connectors.
+ * </p>
+ * <p>
+ *     The first OMRS Connector in the list is the OMRS Repository Connector for the "local" repository.
+ *     The local repository is favoured when new metadata is to be created, unless the type of metadata
+ *     is not supported by the local repository. In which case, the EnterpriseOMRSMetadataCollection searches its
+ *     list looking for the first metadata repository that supports the metadata type and stores it there.
+ * </p>
+ * <p>
+ *     Updates and deletes are routed to the owning (home) repository.  Searches are made to each repository in turn
+ *     and the duplicates are removed.  Queries are directed to the local repository and then the remote repositories
+ *     until all of the requested metadata is assembled.
+ * </p>
+ */
+public class EnterpriseOMRSMetadataCollection extends OMRSMetadataCollection
+{
+
+    /*
+     * Private variables for a metadata collection instance
+     */
+    private EnterpriseOMRSRepositoryConnector parentConnector;
+    private String                            enterpriseMetadataCollectionId;
+    private String                            enterpriseMetadataCollectionName;
+
+
+    private final OMRSRepositoryValidator     repositoryValidator = new OMRSRepositoryValidator();
+
+
+    /**
+     * Default constructor.
+     *
+     * @param parentConnector - connector that this metadata collection supports.  The connector has the information
+     *                        to call the metadata repository.
+     * @param enterpriseMetadataCollectionId - unique identifier for the metadata collection.
+     * @param enterpriseMetadataCollectionName - name of the metadata collection - used for messages.
+     */
+    public EnterpriseOMRSMetadataCollection(EnterpriseOMRSRepositoryConnector parentConnector,
+                                            String                            enterpriseMetadataCollectionId,
+                                            String                            enterpriseMetadataCollectionName)
+    {
+        /*
+         * The metadata collection Id is the unique Id for the metadata collection.  It is managed by the super class.
+         */
+        super(enterpriseMetadataCollectionId);
+        this.enterpriseMetadataCollectionId = enterpriseMetadataCollectionId;
+        this.enterpriseMetadataCollectionName = enterpriseMetadataCollectionName;
+
+        /*
+         * Save parentConnector since this has the connection information and access to the metadata about the
+         * metadata cohort.
+         */
+        this.parentConnector = parentConnector;
+    }
+
+
+    /* ==============================
+     * Group 2: Working with typedefs
+     */
+
+    /**
+     * Returns the list of different types of metadata organized into two groups.  The first are the
+     * attribute type definitions (AttributeTypeDefs).  These provide types for properties in full
+     * type definitions.  Full type definitions (TypeDefs) describe types for entities, relationships
+     * and classifications.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @return TypeDefs - List of different categories of TypeDefs.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public TypeDefGallery getAllTypes(String userId) throws RepositoryErrorException,
+                                                            UserNotAuthorizedException
+    {
+        final String                       methodName = "getTypeDefs()";
+
+        /*
+         * The list of metadata collections are retrieved for each request to ensure that any changes in
+         * the shape of the cohort are reflected immediately.
+         */
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        /*
+         * Ready to process the request.  Search results need to come from all members of the cohort.
+         * They need to be combined and then duplicates removed to create the final list of results.
+         * Some repositories may produce exceptions.  These exceptions are saved and may be returned if
+         * there are no results from any repository.
+         */
+        ArrayList<TypeDef>          combinedTypeDefResults          = new ArrayList<>();
+        ArrayList<AttributeTypeDef> combinedAttributeTypeDefResults = new ArrayList<>();
+        UserNotAuthorizedException  userNotAuthorizedException      = null;
+        RepositoryErrorException    repositoryErrorException        = null;
+        RuntimeException            anotherException                = null;
+
+        /*
+         * Loop through the metadata collections extracting the typedefs from each repository.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection == null)
+            {
+                /*
+                 * A problem in the set up of the metadata collection list.  Repository connectors implemented
+                 * with no metadata collection are tested for in the OMRSEnterpriseConnectorManager so something
+                 * else has gone wrong.
+                 */
+                OMRSErrorCode errorCode = OMRSErrorCode.NULL_ENTERPRISE_METADATA_COLLECTION;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+
+            /*
+             * Process the retrieved metadata collection
+             */
+            try
+            {
+                TypeDefGallery     results = metadataCollection.getAllTypes(userId);
+
+                /*
+                 * Step through the list of returned TypeDefs and consolidate.
+                 */
+                if (results != null)
+                {
+                    ArrayList<TypeDef>           typeDefResults     = results.getTypeDefs();
+                    ArrayList<AttributeTypeDef>  attributeResults   = results.getAttributeTypeDefs();
+
+                    if (typeDefResults != null)
+                    {
+                        combinedTypeDefResults.addAll(typeDefResults);
+                    }
+
+                    if (attributeResults != null)
+                    {
+                        combinedAttributeTypeDefResults.addAll(attributeResults);
+                    }
+                }
+            }
+            catch (RepositoryErrorException  error)
+            {
+                repositoryErrorException = error;
+            }
+            catch (UserNotAuthorizedException  error)
+            {
+                userNotAuthorizedException = error;
+            }
+            catch (RuntimeException   error)
+            {
+                anotherException = error;
+            }
+        }
+
+        int  resultCount = (combinedTypeDefResults.size() + combinedAttributeTypeDefResults.size());
+
+        /*
+         * Return any results, or exception if nothing is found.
+         */
+        if (resultCount > 0)
+        {
+            TypeDefGallery combinedResults = new TypeDefGallery();
+
+            combinedResults.setAttributeTypeDefs(combinedAttributeTypeDefResults);
+            combinedResults.setTypeDefs(combinedTypeDefResults);
+
+            if (repositoryValidator.validateEnterpriseTypeDefs(enterpriseMetadataCollectionName,
+                                                               combinedTypeDefResults))
+            {
+                return combinedResults;
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.CONFLICTING_ENTERPRISE_TYPEDEFS;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+        }
+        else
+        {
+            /*
+             * A system with no defined TypeDefs is unbelievable.  Certainly not very useful :)
+             * This probably means that exceptions were thrown.  Re-throw any cached exceptions
+             * or, if no exceptions occurred then throw repository error because something is wrong.
+             */
+            if (userNotAuthorizedException != null)
+            {
+                throw userNotAuthorizedException;
+            }
+            else if (repositoryErrorException != null)
+            {
+                throw repositoryErrorException;
+            }
+            else if (anotherException != null)
+            {
+                throw anotherException;
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.NO_TYPEDEFS_DEFINED;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+        }
+    }
+
+
+    /**
+     * Returns a list of type definitions that have the specified name.  Type names should be unique.  This
+     * method allows wildcard character to be included in the name.  These are * (asterisk) for an
+     * arbitrary string of characters and ampersand for an arbitrary character.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param name - name of the TypeDefs to return (including wildcard characters).
+     * @return TypeDefs list.
+     * @throws InvalidParameterException - the name of the TypeDef is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public TypeDefGallery findTypesByName(String   userId,
+                                          String   name) throws InvalidParameterException,
+                                                                RepositoryErrorException,
+                                                                UserNotAuthorizedException
+    {
+        final String                       methodName = "findTypeDefsByName()";
+
+        /*
+         * Validate that there is a name supplied.
+         */
+        if (name == null)
+        {
+            /*
+             * No Name supplied so can not perform the search
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_TYPEDEF_NAME;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
+
+        /*
+         * The list of metadata collections are retrieved for each request to ensure that any changes in
+         * the shape of the cohort are reflected immediately.
+         */
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        /*
+         * Ready to process the request.  Search results need to come from all members of the cohort.
+         * They need to be combined and then duplicates removed to create the final list of results.
+         * Some repositories may produce exceptions.  These exceptions are saved and may be returned if
+         * there are no results from any repository.
+         */
+        ArrayList<TypeDef>          combinedTypeDefResults          = new ArrayList<>();
+        ArrayList<AttributeTypeDef> combinedAttributeTypeDefResults = new ArrayList<>();
+        InvalidParameterException   invalidParameterException       = null;
+        UserNotAuthorizedException  userNotAuthorizedException      = null;
+        RepositoryErrorException    repositoryErrorException        = null;
+        RuntimeException            anotherException                = null;
+
+        /*
+         * Loop through the metadata collections extracting the typedefs from each repository.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection == null)
+            {
+                /*
+                 * A problem in the set up of the metadata collection list.  Repository connectors implemented
+                 * with no metadata collection are tested for in the OMRSEnterpriseConnectorManager so something
+                 * else has gone wrong.
+                 */
+                OMRSErrorCode errorCode = OMRSErrorCode.NULL_ENTERPRISE_METADATA_COLLECTION;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+
+            /*
+             * Process the retrieved metadata collection
+             */
+            try
+            {
+                TypeDefGallery     results              = metadataCollection.findTypesByName(userId, name);
+                String             metadataCollectionId = metadataCollection.getMetadataCollectionId();
+
+                /*
+                 * Combine the results from the metadata collection with those elements previously retrieved.
+                 */
+                if (results != null)
+                {
+                    ArrayList<TypeDef>           typeDefResults     = results.getTypeDefs();
+                    ArrayList<AttributeTypeDef>  attributeResults   = results.getAttributeTypeDefs();
+
+                    if (typeDefResults != null)
+                    {
+                        combinedTypeDefResults.addAll(typeDefResults);
+                    }
+
+                    if (attributeResults != null)
+                    {
+                        combinedAttributeTypeDefResults.addAll(attributeResults);
+                    }
+                }
+            }
+            catch (InvalidParameterException  error)
+            {
+                invalidParameterException = error;
+            }
+            catch (RepositoryErrorException  error)
+            {
+                repositoryErrorException = error;
+            }
+            catch (UserNotAuthorizedException  error)
+            {
+                userNotAuthorizedException = error;
+            }
+            catch (RuntimeException   error)
+            {
+                anotherException = error;
+            }
+        }
+
+        int  resultCount = (combinedTypeDefResults.size() + combinedAttributeTypeDefResults.size());
+
+        /*
+         * Return any results, or exception if nothing is found.
+         */
+        if (resultCount > 0)
+        {
+            TypeDefGallery combinedResults = new TypeDefGallery();
+
+            combinedResults.setAttributeTypeDefs(combinedAttributeTypeDefResults);
+            combinedResults.setTypeDefs(combinedTypeDefResults);
+
+            if (repositoryValidator.validateEnterpriseTypeDefs(enterpriseMetadataCollectionName,
+                                                               combinedTypeDefResults))
+            {
+                return combinedResults;
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.CONFLICTING_ENTERPRISE_TYPEDEFS;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+        }
+        else
+        {
+            if (userNotAuthorizedException != null)
+            {
+                throw userNotAuthorizedException;
+            }
+            else if (repositoryErrorException != null)
+            {
+                throw repositoryErrorException;
+            }
+            else if (invalidParameterException != null)
+            {
+                throw invalidParameterException;
+            }
+            else if (anotherException != null)
+            {
+                throw anotherException;
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+
+
+    /**
+     * Returns all of the TypeDefs for a specific category.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param typeDefCategory - enum value for the category of TypeDef to return.
+     * @return TypeDefs list.
+     * @throws InvalidParameterException - the TypeDefCategory is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public ArrayList<TypeDef> findTypeDefsByCategory(String          userId,
+                                                     TypeDefCategory typeDefCategory) throws InvalidParameterException,
+                                                                                             RepositoryErrorException,
+                                                                                             UserNotAuthorizedException
+    {
+        final String                       methodName = "findTypeDefsByCategory()";
+
+        if (typeDefCategory == null)
+        {
+            /*
+             * No category supplied so can not perform the search
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_TYPEDEF_CATEGORY;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
+
+        /*
+         * The list of metadata collections are retrieved for each request to ensure that any changes in
+         * the shape of the cohort are reflected immediately.
+         */
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        /*
+         * Ready to process the request.  Search results need to come from all members of the cohort.
+         * They need to be combined and then duplicates removed to create the final list of results.
+         * Some repositories may produce exceptions.  These exceptions are saved and may be returned if
+         * there are no results from any repository.
+         */
+        ArrayList<TypeDef>         combinedResults            = new ArrayList<>();
+        InvalidParameterException  invalidParameterException  = null;
+        UserNotAuthorizedException userNotAuthorizedException = null;
+        RepositoryErrorException   repositoryErrorException   = null;
+        RuntimeException           anotherException           = null;
+
+        /*
+         * Loop through the metadata collections extracting the typedefs from each repository.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection == null)
+            {
+                /*
+                 * A problem in the set up of the metadata collection list.  Repository connectors implemented
+                 * with no metadata collection are tested for in the OMRSEnterpriseConnectorManager so something
+                 * else has gone wrong.
+                 */
+                OMRSErrorCode errorCode = OMRSErrorCode.NULL_ENTERPRISE_METADATA_COLLECTION;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+
+            /*
+             * Process the retrieved metadata collection
+             */
+            try
+            {
+                ArrayList<TypeDef> results              = metadataCollection.findTypeDefsByCategory(userId, typeDefCategory);
+                String             metadataCollectionId = metadataCollection.getMetadataCollectionId();
+
+                /*
+                 * Step through the list of returned TypeDefs and remove duplicates.
+                 */
+                if (results != null)
+                {
+                    for (TypeDef returnedTypeDef : results)
+                    {
+                        combinedResults = this.addUniqueTypeDef(combinedResults,
+                                                                returnedTypeDef,
+                                                                metadataCollectionId);
+                    }
+                }
+            }
+            catch (InvalidParameterException  error)
+            {
+                invalidParameterException = error;
+            }
+            catch (RepositoryErrorException  error)
+            {
+                repositoryErrorException = error;
+            }
+            catch (UserNotAuthorizedException  error)
+            {
+                userNotAuthorizedException = error;
+            }
+            catch (RuntimeException   error)
+            {
+                anotherException = error;
+            }
+        }
+
+        /*
+         * Return any results, or null if nothing is found.
+         */
+        if (combinedResults.size() > 0)
+        {
+            if (repositoryValidator.validateEnterpriseTypeDefs(enterpriseMetadataCollectionName, combinedResults))
+            {
+                return combinedResults;
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.CONFLICTING_ENTERPRISE_TYPEDEFS;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+        }
+        else
+        {
+            if (userNotAuthorizedException != null)
+            {
+                throw userNotAuthorizedException;
+            }
+            else if (repositoryErrorException != null)
+            {
+                throw repositoryErrorException;
+            }
+            else if (invalidParameterException != null)
+            {
+                throw invalidParameterException;
+            }
+            else if (anotherException != null)
+            {
+                throw anotherException;
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+
+
+    /**
+     * Returns all of the AttributeTypeDefs for a specific category.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param category - enum value for the category of an AttributeTypeDef to return.
+     * @return TypeDefs list.
+     * @throws InvalidParameterException - the TypeDefCategory is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public ArrayList<AttributeTypeDef> findAttributeTypeDefsByCategory(String                   userId,
+                                                                       AttributeTypeDefCategory category) throws InvalidParameterException,
+                                                                                                                 RepositoryErrorException,
+                                                                                                                 UserNotAuthorizedException
+    {
+        return null;
+    }
+
+
+    /**
+     * Return the TypeDefs that have the properties matching the supplied match criteria.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param matchCriteria - TypeDefProperties - a list of property names and values.
+     * @return TypeDefs list.
+     * @throws InvalidParameterException - the matchCriteria is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public ArrayList<TypeDef> findTypeDefsByProperty(String            userId,
+                                                     TypeDefProperties matchCriteria) throws InvalidParameterException,
+                                                                                             RepositoryErrorException,
+                                                                                             UserNotAuthorizedException
+    {
+        final String                       methodName = "findTypeDefsByProperty()";
+
+        if (matchCriteria == null)
+        {
+            /*
+             * No match criteria supplied so can not perform the search
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_MATCH_CRITERIA;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
+
+        /*
+         * The list of metadata collections are retrieved for each request to ensure that any changes in
+         * the shape of the cohort are reflected immediately.
+         */
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        /*
+         * Ready to process the request.  Search results need to come from all members of the cohort.
+         * They need to be combined and then duplicates removed to create the final list of results.
+         * Some repositories may produce exceptions.  These exceptions are saved and may be returned if
+         * there are no results from any repository.
+         */
+        ArrayList<TypeDef>         combinedResults            = new ArrayList<>();
+        InvalidParameterException  invalidParameterException  = null;
+        UserNotAuthorizedException userNotAuthorizedException = null;
+        RepositoryErrorException   repositoryErrorException   = null;
+        RuntimeException           anotherException           = null;
+
+        /*
+         * Loop through the metadata collections extracting the typedefs from each repository.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection == null)
+            {
+                /*
+                 * A problem in the set up of the metadata collection list.  Repository connectors implemented
+                 * with no metadata collection are tested for in the OMRSEnterpriseConnectorManager so something
+                 * else has gone wrong.
+                 */
+                OMRSErrorCode errorCode = OMRSErrorCode.NULL_ENTERPRISE_METADATA_COLLECTION;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+
+            /*
+             * Process the retrieved metadata collection
+             */
+            try
+            {
+                ArrayList<TypeDef> results              = metadataCollection.findTypeDefsByProperty(userId, matchCriteria);
+                String             metadataCollectionId = metadataCollection.getMetadataCollectionId();
+
+                /*
+                 * Step through the list of returned TypeDefs and remove duplicates.
+                 */
+                if (results != null)
+                {
+                    for (TypeDef returnedTypeDef : results)
+                    {
+                        combinedResults = this.addUniqueTypeDef(combinedResults,
+                                                                returnedTypeDef,
+                                                                metadataCollectionId);
+                    }
+                }
+            }
+            catch (InvalidParameterException  error)
+            {
+                invalidParameterException = error;
+            }
+            catch (RepositoryErrorException  error)
+            {
+                repositoryErrorException = error;
+            }
+            catch (UserNotAuthorizedException  error)
+            {
+                userNotAuthorizedException = error;
+            }
+            catch (RuntimeException   error)
+            {
+                anotherException = error;
+            }
+        }
+
+        /*
+         * Return any results, or null if nothing is found.
+         */
+        if (combinedResults.size() > 0)
+        {
+            if (repositoryValidator.validateEnterpriseTypeDefs(enterpriseMetadataCollectionName, combinedResults))
+            {
+                return combinedResults;
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.CONFLICTING_ENTERPRISE_TYPEDEFS;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+        }
+        else
+        {
+            if (userNotAuthorizedException != null)
+            {
+                throw userNotAuthorizedException;
+            }
+            else if (repositoryErrorException != null)
+            {
+                throw repositoryErrorException;
+            }
+            else if (invalidParameterException != null)
+            {
+                throw invalidParameterException;
+            }
+            else if (anotherException != null)
+            {
+                throw anotherException;
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+
+
+    /**
+     * Return the types that are linked to the elements from the specified standard.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param standard - name of the standard - null means any.
+     * @param organization - name of the organization - null means any.
+     * @param identifier - identifier of the element in the standard - null means any.
+     * @return TypeDefs list - each entry in the list contains a typedef.  This is is a structure
+     * describing the TypeDef's category and properties.
+     * @throws InvalidParameterException - all attributes of the external Id are null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public TypeDefGallery findTypesByExternalID(String    userId,
+                                                String    standard,
+                                                String    organization,
+                                                String    identifier) throws InvalidParameterException,
+                                                                             RepositoryErrorException,
+                                                                             UserNotAuthorizedException
+    {
+        final String                       methodName = "findTypeDefsByExternalID()";
+
+        if ((standard == null) && (organization == null) && (identifier == null))
+        {
+            /*
+             * No external Id properties supplied so can not perform the search
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_EXTERNAL_ID;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
+
+        /*
+         * The list of metadata collections are retrieved for each request to ensure that any changes in
+         * the shape of the cohort are reflected immediately.
+         */
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        /*
+         * Ready to process the request.  Search results need to come from all members of the cohort.
+         * They need to be combined and then duplicates removed to create the final list of results.
+         * Some repositories may produce exceptions.  These exceptions are saved and may be returned if
+         * there are no results from any repository.
+         */
+        ArrayList<TypeDef>          combinedTypeDefResults          = new ArrayList<>();
+        ArrayList<AttributeTypeDef> combinedAttributeTypeDefResults = new ArrayList<>();
+        InvalidParameterException   invalidParameterException       = null;
+        UserNotAuthorizedException  userNotAuthorizedException      = null;
+        RepositoryErrorException    repositoryErrorException        = null;
+        RuntimeException            anotherException                = null;
+
+        /*
+         * Loop through the metadata collections extracting the typedefs from each repository.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection == null)
+            {
+                /*
+                 * A problem in the set up of the metadata collection list.  Repository connectors implemented
+                 * with no metadata collection are tested for in the OMRSEnterpriseConnectorManager so something
+                 * else has gone wrong.
+                 */
+                OMRSErrorCode errorCode = OMRSErrorCode.NULL_ENTERPRISE_METADATA_COLLECTION;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+
+            /*
+             * Process the retrieved metadata collection
+             */
+            try
+            {
+                TypeDefGallery results  = metadataCollection.findTypesByExternalID(userId,
+                                                                                   standard,
+                                                                                   organization,
+                                                                                   identifier);
+                String             metadataCollectionId = metadataCollection.getMetadataCollectionId();
+
+                /*
+                 * Combine the results from the metadata collection with those elements previously retrieved.
+                 */
+                if (results != null)
+                {
+                    ArrayList<TypeDef>           typeDefResults     = results.getTypeDefs();
+                    ArrayList<AttributeTypeDef>  attributeResults   = results.getAttributeTypeDefs();
+
+                    if (typeDefResults != null)
+                    {
+                        combinedTypeDefResults.addAll(typeDefResults);
+                    }
+
+                    if (attributeResults != null)
+                    {
+                        combinedAttributeTypeDefResults.addAll(attributeResults);
+                    }
+                }
+            }
+            catch (InvalidParameterException  error)
+            {
+                invalidParameterException = error;
+            }
+            catch (RepositoryErrorException  error)
+            {
+                repositoryErrorException = error;
+            }
+            catch (UserNotAuthorizedException  error)
+            {
+                userNotAuthorizedException = error;
+            }
+            catch (RuntimeException   error)
+            {
+                anotherException = error;
+            }
+        }
+
+        int  resultCount = (combinedTypeDefResults.size() + combinedAttributeTypeDefResults.size());
+
+        /*
+         * Return any results, or exception if nothing is found.
+         */
+        if (resultCount > 0)
+        {
+            TypeDefGallery combinedResults = new TypeDefGallery();
+
+            combinedResults.setAttributeTypeDefs(combinedAttributeTypeDefResults);
+            combinedResults.setTypeDefs(combinedTypeDefResults);
+
+            if (repositoryValidator.validateEnterpriseTypeDefs(enterpriseMetadataCollectionName,
+                                                               combinedTypeDefResults))
+            {
+                return combinedResults;
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.CONFLICTING_ENTERPRISE_TYPEDEFS;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+        }
+        else
+        {
+            if (userNotAuthorizedException != null)
+            {
+                throw userNotAuthorizedException;
+            }
+            else if (repositoryErrorException != null)
+            {
+                throw repositoryErrorException;
+            }
+            else if (invalidParameterException != null)
+            {
+                throw invalidParameterException;
+            }
+            else if (anotherException != null)
+            {
+                throw anotherException;
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+
+
+    /**
+     * Return the TypeDefs that match the search criteria.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param searchCriteria - String - search criteria.
+     * @return TypeDefs list - each entry in the list contains a typedef.  This is is a structure
+     * describing the TypeDef's category and properties.
+     * @throws InvalidParameterException - the searchCriteria is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public ArrayList<TypeDef> searchForTypeDefs(String userId,
+                                                String searchCriteria) throws InvalidParameterException,
+                                                                              RepositoryErrorException,
+                                                                              UserNotAuthorizedException
+    {
+        final String                       methodName = "searchForTypeDefs()";
+
+        if (searchCriteria == null)
+        {
+            /*
+             * No search criteria supplied so can not perform the search
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_SEARCH_CRITERIA;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
+
+        /*
+         * The list of metadata collections are retrieved for each request to ensure that any changes in
+         * the shape of the cohort are reflected immediately.
+         */
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        /*
+         * Ready to process the request.  Search results need to come from all members of the cohort.
+         * They need to be combined and then duplicates removed to create the final list of results.
+         * Some repositories may produce exceptions.  These exceptions are saved and may be returned if
+         * there are no results from any repository.
+         */
+        ArrayList<TypeDef>         combinedResults            = new ArrayList<>();
+        InvalidParameterException  invalidParameterException  = null;
+        UserNotAuthorizedException userNotAuthorizedException = null;
+        RepositoryErrorException   repositoryErrorException   = null;
+        RuntimeException           anotherException           = null;
+
+        /*
+         * Loop through the metadata collections extracting the typedefs from each repository.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection == null)
+            {
+                /*
+                 * A problem in the set up of the metadata collection list.  Repository connectors implemented
+                 * with no metadata collection are tested for in the OMRSEnterpriseConnectorManager so something
+                 * else has gone wrong.
+                 */
+                OMRSErrorCode errorCode = OMRSErrorCode.NULL_ENTERPRISE_METADATA_COLLECTION;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+
+            /*
+             * Process the retrieved metadata collection
+             */
+            try
+            {
+                ArrayList<TypeDef> results              = metadataCollection.searchForTypeDefs(userId, searchCriteria);
+                String             metadataCollectionId = metadataCollection.getMetadataCollectionId();
+
+                /*
+                 * Step through the list of returned TypeDefs and remove duplicates.
+                 */
+                if (results != null)
+                {
+                    for (TypeDef returnedTypeDef : results)
+                    {
+                        combinedResults = this.addUniqueTypeDef(combinedResults,
+                                                                returnedTypeDef,
+                                                                metadataCollectionId);
+                    }
+                }
+            }
+            catch (InvalidParameterException  error)
+            {
+                invalidParameterException = error;
+            }
+            catch (RepositoryErrorException  error)
+            {
+                repositoryErrorException = error;
+            }
+            catch (UserNotAuthorizedException  error)
+            {
+                userNotAuthorizedException = error;
+            }
+            catch (RuntimeException   error)
+            {
+                anotherException = error;
+            }
+        }
+
+        /*
+         * Return any results, or null if nothing is found.
+         */
+        if (combinedResults.size() > 0)
+        {
+            if (repositoryValidator.validateEnterpriseTypeDefs(enterpriseMetadataCollectionName, combinedResults))
+            {
+                return combinedResults;
+            }
+            else
+            {
+                OMRSErrorCode errorCode = OMRSErrorCode.CONFLICTING_ENTERPRISE_TYPEDEFS;
+                String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+                throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                                   this.getClass().getName(),
+                                                   methodName,
+                                                   errorMessage,
+                                                   errorCode.getSystemAction(),
+                                                   errorCode.getUserAction());
+            }
+        }
+        else
+        {
+            if (userNotAuthorizedException != null)
+            {
+                throw userNotAuthorizedException;
+            }
+            else if (repositoryErrorException != null)
+            {
+                throw repositoryErrorException;
+            }
+            else if (invalidParameterException != null)
+            {
+                throw invalidParameterException;
+            }
+            else if (anotherException != null)
+            {
+                throw anotherException;
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+
+
+    /**
+     * Return the TypeDef identified by the GUID.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param guid - String unique Id of the TypeDef
+     * @return TypeDef structure describing its category and properties.
+     * @throws InvalidParameterException - the guid is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotKnownException - The requested TypeDef is not known in the metadata collection.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public TypeDef getTypeDefByGUID(String    userId,
+                                    String    guid) throws InvalidParameterException,
+                                                           RepositoryErrorException,
+                                                           TypeDefNotKnownException,
+                                                           UserNotAuthorizedException
+    {
+        final String    methodName = "getTypeDefByGUID()";
+
+        if (guid == null)
+        {
+            /*
+             * No guid supplied so can not perform the search
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_GUID;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
+
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        TypeDefNotKnownException   typeDefNotKnownException = null;
+        UserNotAuthorizedException userNotAuthorizedException = null;
+        RepositoryErrorException   repositoryErrorException = null;
+        RuntimeException           anotherException = null;
+
+        /*
+         * Loop through the metadata collections requesting the typedef from each repository.
+         * The first TypeDef retrieved is returned to the caller.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection != null)
+            {
+                try
+                {
+                    TypeDef retrievedTypeDef = getTypeDefByGUID(userId, guid);
+
+                    if (retrievedTypeDef != null)
+                    {
+                        return retrievedTypeDef;
+                    }
+                }
+                catch (TypeDefNotKnownException  error)
+                {
+                    typeDefNotKnownException = error;
+                }
+                catch (UserNotAuthorizedException error)
+                {
+                    userNotAuthorizedException = error;
+                }
+                catch (RepositoryErrorException error)
+                {
+                    repositoryErrorException = error;
+                }
+                catch (RuntimeException error)
+                {
+                    anotherException = error;
+                }
+            }
+        }
+
+        /*
+         * The TypeDef has not been found. Process the exceptions.
+         */
+        if (typeDefNotKnownException != null)
+        {
+            throw typeDefNotKnownException;
+        }
+        else if (userNotAuthorizedException != null)
+        {
+            throw userNotAuthorizedException;
+        }
+        else if (repositoryErrorException != null)
+        {
+            throw repositoryErrorException;
+        }
+        else if (anotherException != null)
+        {
+            throw anotherException;
+        }
+        else
+        {
+            /*
+             * All of the repositories have returned a null TypeDef so default to TypeDefNotKnownException.
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.TYPEDEF_NOT_KNOWN;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new TypeDefNotKnownException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+    }
+
+
+    /**
+     * Return the AttributeTypeDef identified by the GUID.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param guid - String unique id of the TypeDef
+     * @return TypeDef structure describing its category and properties.
+     * @throws InvalidParameterException - the guid is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotKnownException - The requested TypeDef is not known in the metadata collection.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public  AttributeTypeDef getAttributeTypeDefByGUID(String    userId,
+                                                       String    guid) throws InvalidParameterException,
+                                                                              RepositoryErrorException,
+                                                                              TypeDefNotKnownException,
+                                                                              UserNotAuthorizedException
+    {
+        return null;
+    }
+
+
+    /**
+     * Return the TypeDef identified by the unique name.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param name - String name of the TypeDef.
+     * @return TypeDef structure describing its category and properties.
+     * @throws InvalidParameterException - the name is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotKnownException - the requested TypeDef is not found in the metadata collection.
+     */
+    public TypeDef getTypeDefByName(String    userId,
+                                    String    name) throws InvalidParameterException,
+                                                           RepositoryErrorException,
+                                                           TypeDefNotKnownException,
+                                                           UserNotAuthorizedException
+    {
+        final String    methodName = "getTypeDefByName()";
+
+        if (name == null)
+        {
+            /*
+             * No name supplied so can not perform the search
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_TYPEDEF_NAME;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new InvalidParameterException(errorCode.getHTTPErrorCode(),
+                                                this.getClass().getName(),
+                                                methodName,
+                                                errorMessage,
+                                                errorCode.getSystemAction(),
+                                                errorCode.getUserAction());
+        }
+
+        ArrayList<OMRSMetadataCollection>  metadataCollections = parentConnector.getMetadataCollections();
+
+        if (metadataCollections == null)
+        {
+            /*
+             * No repositories available
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+
+        TypeDefNotKnownException   typeDefNotKnownException = null;
+        UserNotAuthorizedException userNotAuthorizedException = null;
+        RepositoryErrorException   repositoryErrorException = null;
+        RuntimeException           anotherException = null;
+
+        /*
+         * Loop through the metadata collections requesting the typedef from each repository.
+         * The first TypeDef retrieved is returned to the caller.
+         */
+        for (OMRSMetadataCollection metadataCollection : metadataCollections)
+        {
+            if (metadataCollection != null)
+            {
+                try
+                {
+                    TypeDef retrievedTypeDef = getTypeDefByName(userId, name);
+
+                    if (retrievedTypeDef != null)
+                    {
+                        return retrievedTypeDef;
+                    }
+                }
+                catch (TypeDefNotKnownException  error)
+                {
+                    typeDefNotKnownException = error;
+                }
+                catch (UserNotAuthorizedException error)
+                {
+                    userNotAuthorizedException = error;
+                }
+                catch (RepositoryErrorException error)
+                {
+                    repositoryErrorException = error;
+                }
+                catch (RuntimeException error)
+                {
+                    anotherException = error;
+                }
+            }
+        }
+
+        /*
+         * The TypeDef has not been found. Process the exceptions.
+         */
+        if (typeDefNotKnownException != null)
+        {
+            throw typeDefNotKnownException;
+        }
+        else if (userNotAuthorizedException != null)
+        {
+            throw userNotAuthorizedException;
+        }
+        else if (repositoryErrorException != null)
+        {
+            throw repositoryErrorException;
+        }
+        else if (anotherException != null)
+        {
+            throw anotherException;
+        }
+        else
+        {
+            /*
+             * All of the repositories have returned a null TypeDef so default to TypeDefNotKnownException.
+             */
+            OMRSErrorCode errorCode = OMRSErrorCode.TYPEDEF_NOT_KNOWN;
+            String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage();
+
+            throw new TypeDefNotKnownException(errorCode.getHTTPErrorCode(),
+                                               this.getClass().getName(),
+                                               methodName,
+                                               errorMessage,
+                                               errorCode.getSystemAction(),
+                                               errorCode.getUserAction());
+        }
+    }
+
+
+    /**
+     * Return the AttributeTypeDef identified by the unique name.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param name - String name of the TypeDef.
+     * @return TypeDef structure describing its category and properties.
+     * @throws InvalidParameterException - the name is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotKnownException - the requested TypeDef is not found in the metadata collection.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public  AttributeTypeDef getAttributeTypeDefByName(String    userId,
+                                                       String    name) throws InvalidParameterException,
+                                                                              RepositoryErrorException,
+                                                                              TypeDefNotKnownException,
+                                                                              UserNotAuthorizedException
+    {
+        return null;
+    }
+
+
+    /**
+     * Create a collection of related types.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param newTypes - TypeDefGallery structure describing the new AttributeTypeDefs and TypeDefs.
+     * @throws InvalidParameterException - the new TypeDef is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotSupportedException - the repository is not able to support this TypeDef.
+     * @throws TypeDefKnownException - the TypeDef is already stored in the repository.
+     * @throws TypeDefConflictException - the new TypeDef conflicts with an existing TypeDef.
+     * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public  void addTypeDefGallery(String          userId,
+                                   TypeDefGallery  newTypes) throws InvalidParameterException,
+                                                                    RepositoryErrorException,
+                                                                    TypeDefNotSupportedException,
+                                                                    TypeDefKnownException,
+                                                                    TypeDefConflictException,
+                                                                    InvalidTypeDefException,
+                                                                    UserNotAuthorizedException
+    {
+
+    }
+
+
+    /**
+     * Create a definition of a new TypeDef.   This new TypeDef is pushed to each repository that will accept it.
+     * An exception is passed to the caller if the TypeDef is invalid, or if none of the repositories accept it.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param newTypeDef - TypeDef structure describing the new TypeDef.
+     * @throws InvalidParameterException - the new TypeDef is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotSupportedException - the repository is not able to support this TypeDef.
+     * @throws TypeDefKnownException - the TypeDef is already stored in the repository.
+     * @throws TypeDefConflictException - the new TypeDef conflicts with an existing TypeDef.
+     * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public void addTypeDef(String       userId,
+                           TypeDef      newTypeDef) throws InvalidParameterException,
+                                                           RepositoryErrorException,
+                                                           TypeDefNotSupportedException,
+                                                           TypeDefKnownException,
+                                                           TypeDefConflictException,
+                                                           InvalidTypeDefException,
+                                                           UserNotAuthorizedException
+    {
+        final String    methodName = "addTypeDef()";
+
+        OMRSErrorCode errorCode = OMRSErrorCode.ENTERPRISE_NOT_SUPPORTED;
+
+        String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(methodName);
+
+        throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                           this.getClass().getName(),
+                                           methodName,
+                                           errorMessage,
+                                           errorCode.getSystemAction(),
+                                           errorCode.getUserAction());
+    }
+
+    /**
+     * Create a definition of a new AttributeTypeDef.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param newAttributeTypeDef - TypeDef structure describing the new TypeDef.
+     * @throws InvalidParameterException - the new TypeDef is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotSupportedException - the repository is not able to support this TypeDef.
+     * @throws TypeDefKnownException - the TypeDef is already stored in the repository.
+     * @throws TypeDefConflictException - the new TypeDef conflicts with an existing TypeDef.
+     * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public  void addAttributeTypeDef(String             userId,
+                                     AttributeTypeDef   newAttributeTypeDef) throws InvalidParameterException,
+                                                                                    RepositoryErrorException,
+                                                                                    TypeDefNotSupportedException,
+                                                                                    TypeDefKnownException,
+                                                                                    TypeDefConflictException,
+                                                                                    InvalidTypeDefException,
+                                                                                    UserNotAuthorizedException
+    {
+        final String    methodName = "addAttributeTypeDef()";
+
+        OMRSErrorCode errorCode = OMRSErrorCode.ENTERPRISE_NOT_SUPPORTED;
+
+        String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(methodName);
+
+        throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                           this.getClass().getName(),
+                                           methodName,
+                                           errorMessage,
+                                           errorCode.getSystemAction(),
+                                           errorCode.getUserAction());
+    }
+
+
+    /**
+     * Verify that a definition of a TypeDef is either new - or matches the definition already stored.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param typeDef - TypeDef structure describing the TypeDef to test.
+     * @return boolean - true means the TypeDef matches the local definition - false means the TypeDef is not known.
+     * @throws InvalidParameterException - the TypeDef is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotSupportedException - the repository is not able to support this TypeDef.
+     * @throws TypeDefConflictException - the new TypeDef conflicts with an existing TypeDef.
+     * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public boolean verifyTypeDef(String       userId,
+                                 TypeDef      typeDef) throws InvalidParameterException,
+                                                              RepositoryErrorException,
+                                                              TypeDefNotSupportedException,
+                                                              TypeDefConflictException,
+                                                              InvalidTypeDefException,
+                                                              UserNotAuthorizedException
+    {
+        final String                       methodName = "verifyTypeDef()";
+
+        OMRSErrorCode errorCode = OMRSErrorCode.ENTERPRISE_NOT_SUPPORTED;
+
+        String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(methodName);
+
+        throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                           this.getClass().getName(),
+                                           methodName,
+                                           errorMessage,
+                                           errorCode.getSystemAction(),
+                                           errorCode.getUserAction());
+    }
+
+
+    /**
+     * Verify that a definition of an AttributeTypeDef is either new - or matches the definition already stored.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param attributeTypeDef - TypeDef structure describing the TypeDef to test.
+     * @return boolean - true means the TypeDef matches the local definition - false means the TypeDef is not known.
+     * @throws InvalidParameterException - the TypeDef is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                  the metadata collection is stored.
+     * @throws TypeDefNotSupportedException - the repository is not able to support this TypeDef.
+     * @throws TypeDefConflictException - the new TypeDef conflicts with an existing TypeDef.
+     * @throws InvalidTypeDefException - the new TypeDef has invalid contents.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public  boolean verifyAttributeTypeDef(String            userId,
+                                           AttributeTypeDef  attributeTypeDef) throws InvalidParameterException,
+                                                                                      RepositoryErrorException,
+                                                                                      TypeDefNotSupportedException,
+                                                                                      TypeDefConflictException,
+                                                                                      InvalidTypeDefException,
+                                                                                      UserNotAuthorizedException
+    {
+        final String                       methodName = "verifyAttributeTypeDef()";
+
+        OMRSErrorCode errorCode = OMRSErrorCode.ENTERPRISE_NOT_SUPPORTED;
+
+        String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(methodName);
+
+        throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                           this.getClass().getName(),
+                                           methodName,
+                                           errorMessage,
+                                           errorCode.getSystemAction(),
+                                           errorCode.getUserAction());
+    }
+
+
+    /**
+     * Update one or more properties of the TypeDef.  The TypeDefPatch controls what types of updates
+     * are safe to make to the TypeDef.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param typeDefPatch - TypeDef patch describing change to TypeDef.
+     * @return updated TypeDef
+     * @throws InvalidParameterException - the TypeDefPatch is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                    the metadata collection is stored.
+     * @throws TypeDefNotKnownException - the requested TypeDef is not found in the metadata collection.
+     * @throws PatchErrorException - the TypeDef can not be updated because the supplied patch is incompatible
+     *                               with the stored TypeDef.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public TypeDef updateTypeDef(String       userId,
+                                 TypeDefPatch typeDefPatch) throws InvalidParameterException,
+                                                                   RepositoryErrorException,
+                                                                   TypeDefNotKnownException,
+                                                                   PatchErrorException,
+                                                                   UserNotAuthorizedException
+    {
+        final String                       methodName = "updateTypeDef()";
+
+        OMRSErrorCode errorCode = OMRSErrorCode.ENTERPRISE_NOT_SUPPORTED;
+
+        String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(methodName);
+
+        throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                           this.getClass().getName(),
+                                           methodName,
+                                           errorMessage,
+                                           errorCode.getSystemAction(),
+                                           errorCode.getUserAction());
+    }
+
+
+    /**
+     * Delete the TypeDef.  This is only possible if the TypeDef has never been used to create instances or any
+     * instances of this TypeDef have been purged from the metadata collection.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param obsoleteTypeDefGUID - String unique identifier for the TypeDef.
+     * @param obsoleteTypeDefName - String unique name for the TypeDef.
+     * @throws InvalidParameterException - the one of TypeDef identifiers is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                    the metadata collection is stored.
+     * @throws TypeDefNotKnownException - the requested TypeDef is not found in the metadata collection.
+     * @throws TypeDefInUseException - the TypeDef can not be deleted because there are instances of this type in the
+     *                                 the metadata collection.  These instances need to be purged before the
+     *                                 TypeDef can be deleted.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public void deleteTypeDef(String    userId,
+                              String    obsoleteTypeDefGUID,
+                              String    obsoleteTypeDefName) throws InvalidParameterException,
+                                                                    RepositoryErrorException,
+                                                                    TypeDefNotKnownException,
+                                                                    TypeDefInUseException,
+                                                                    UserNotAuthorizedException
+    {
+        final String                       methodName = "deleteTypeDef()";
+
+        OMRSErrorCode errorCode = OMRSErrorCode.ENTERPRISE_NOT_SUPPORTED;
+
+        String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(methodName);
+
+        throw new RepositoryErrorException(errorCode.getHTTPErrorCode(),
+                                           this.getClass().getName(),
+                                           methodName,
+                                           errorMessage,
+                                           errorCode.getSystemAction(),
+                                           errorCode.getUserAction());
+    }
+
+
+    /**
+     * Delete an AttributeTypeDef.  This is only possible if the AttributeTypeDef has never been used to create
+     * instances or any instances of this AttributeTypeDef have been purged from the metadata collection.
+     *
+     * @param userId - unique identifier for requesting user.
+     * @param obsoleteTypeDefGUID - String unique identifier for the AttributeTypeDef.
+     * @param obsoleteTypeDefName - String unique name for the AttributeTypeDef.
+     * @throws InvalidParameterException - the one of AttributeTypeDef identifiers is null.
+     * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where
+     *                                    the metadata collection is stored.
+     * @throws TypeDefNotKnownException - the requested AttributeTypeDef is not found in the metadata collection.
+     * @throws TypeDefInUseException - the AttributeTypeDef can not be deleted because there are instances of this type in the
+     *                                 the metadata collection.  These instances need to be purged before the
+     *                                 AttributeTypeDef can be deleted.
+     * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation.
+     */
+    public void deleteAttributeTypeDef(String    userId,
+                                       String    obsoleteTypeDefGUID,
+                                       String    obsoleteTypeDefName) throws InvalidParameterException,
+      

<TRUNCATED>