Repository: atlas
Updated Branches:
  refs/heads/master c2be0646d -> 8a57e6571


http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreConnector.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreConnector.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreConnector.java
new file mode 100644
index 0000000..7402a81
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreConnector.java
@@ -0,0 +1,582 @@
+/*
+ * 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.metadatahighway.cohortregistry.store.file;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.atlas.omrs.auditlog.OMRSAuditCode;
+import org.apache.atlas.omrs.auditlog.OMRSAuditLog;
+import org.apache.atlas.omrs.auditlog.OMRSAuditingComponent;
+import 
org.apache.atlas.omrs.metadatahighway.cohortregistry.store.OMRSCohortRegistryStoreConnectorBase;
+import 
org.apache.atlas.omrs.metadatahighway.cohortregistry.store.properties.CohortMembership;
+import 
org.apache.atlas.omrs.metadatahighway.cohortregistry.store.properties.MemberRegistration;
+
+import org.apache.commons.io.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * FileBasedRegistryStoreConnector uses JSON to store details of the 
membership of the open metadata repository
+ * cohort on behalf of the OMRSCohortRegistry.
+ */
+public class FileBasedRegistryStoreConnector extends 
OMRSCohortRegistryStoreConnectorBase
+{
+    /*
+     * This is the name of the cohort registry file that is used if there is 
no file name in the connection.
+     */
+    private static final String defaultFilename = "cohort.registry";
+
+    /*
+     * Variables used in writing to the file.
+     */
+    private String           registryStoreName       = defaultFilename;
+    private CohortMembership registryStoreProperties = null;
+
+    /*
+     * Variables used for logging and debug.
+     */
+    private static final OMRSAuditLog auditLog = new 
OMRSAuditLog(OMRSAuditingComponent.REGISTRY_STORE);
+
+    private static final Logger log = 
LoggerFactory.getLogger(FileBasedRegistryStoreConnector.class);
+
+    /**
+     * Default constructor
+     */
+    public FileBasedRegistryStoreConnector()
+    {
+        /*
+         * Nothing to do
+         */
+    }
+
+
+    /**
+     * Returns the index of the requested member in the members array list.  
If the member is not found, the index
+     * returned is the size of the array.
+     *
+     * @param metadataCollectionId - id of the member to find.
+     * @param members - list of members
+     * @return int index pointing to the location of the member (or the size 
of the array if the member is not found).
+     */
+    private int findRemoteRegistration(String   metadataCollectionId, 
ArrayList<MemberRegistration>   members)
+    {
+        int   indexOfNewMember = members.size();
+
+        for (int i=0; i<members.size(); i++)
+        {
+            String memberId = members.get(i).getMetadataCollectionId();
+
+            if (metadataCollectionId.equals(memberId))
+            {
+                if (log.isDebugEnabled())
+                {
+                    log.debug("Found existing registration for " + 
metadataCollectionId + " at position " + i);
+                }
+                return i;
+            }
+        }
+
+        if (log.isDebugEnabled())
+        {
+            log.debug("New registration for " + metadataCollectionId + " - 
saving at position " + indexOfNewMember);
+        }
+        return indexOfNewMember;
+    }
+
+
+    /**
+     * Save the local registration to the cohort registry store.  This 
provides details of the local repository's
+     * registration with the metadata repository cohort.
+     * Any previous local registration information is overwritten.
+     *
+     * @param localRegistration - details of the local repository's 
registration with the metadata cohort.
+     */
+    public void saveLocalRegistration(MemberRegistration localRegistration)
+    {
+        if (localRegistration != null)
+        {
+            if (registryStoreProperties == null)
+            {
+                registryStoreProperties = 
this.retrieveRegistryStoreProperties();
+            }
+
+            registryStoreProperties.setLocalRegistration(localRegistration);
+
+            this.writeRegistryStoreProperties(registryStoreProperties);
+        }
+        else
+        {
+            String actionDescription = "Saving Local Registration to Registry 
Store";
+
+            OMRSAuditCode auditCode = OMRSAuditCode.NULL_MEMBER_REGISTRATION;
+
+            auditLog.logRecord(actionDescription,
+                               auditCode.getLogMessageId(),
+                               auditCode.getSeverity(),
+                               
auditCode.getFormattedLogMessage(registryStoreName),
+                               null,
+                               auditCode.getSystemAction(),
+                               auditCode.getUserAction());
+
+            if (log.isDebugEnabled())
+            {
+                log.debug("Null local registration passed to 
saveLocalRegistration :(");
+            }
+        }
+    }
+
+
+    /**
+     * Retrieve details of the local registration from the cohort registry 
store.  A null may be returned if the
+     * local registration information has not been saved (typically because 
this is a new server instance).
+     *
+     * @return MemberRegistration object containing details for the local 
repository's registration with the
+     * metadata cohort (may be null if no registration has taken place).
+     */
+    public MemberRegistration retrieveLocalRegistration()
+    {
+        MemberRegistration  localRegistration = null;
+
+        if (registryStoreProperties == null)
+        {
+            registryStoreProperties = this.retrieveRegistryStoreProperties();
+        }
+
+        localRegistration = registryStoreProperties.getLocalRegistration();
+
+        if (log.isDebugEnabled())
+        {
+            if (localRegistration == null)
+            {
+                log.debug("Null local registration returned from 
retrieveLocalRegistration");
+            }
+            else
+            {
+                log.debug("Local Registration details: " +
+                                  "metadataCollectionId: " + 
localRegistration.getMetadataCollectionId() +
+                                  "; displayName: " + 
localRegistration.getServerName() +
+                                  "; serverType: " + 
localRegistration.getServerType() +
+                                  "; organizationName: " + 
localRegistration.getOrganizationName() +
+                                  "; registrationTime " + 
localRegistration.getRegistrationTime());
+            }
+        }
+
+        return localRegistration;
+    }
+
+
+    /**
+     * Remove details of the local registration from the cohort registry 
store.  This is used when the local
+     * repository unregisters from the open metadata repository cohort.
+     *
+     * There is a side-effect that all of the remote registrations are removed 
to since the local repository is
+     * no longer a member of this cohort.
+     */
+    public void removeLocalRegistration()
+    {
+        if (log.isDebugEnabled())
+        {
+            log.debug("Emptying cohort registry store.");
+        }
+
+        this.writeRegistryStoreProperties(new CohortMembership());
+    }
+
+
+    /**
+     * Save details of a remote registration.  This contains details of one of 
the other repositories in the
+     * metadata repository cohort.
+     *
+     * @param remoteRegistration - details of a remote repository in the 
metadata repository cohort.
+     */
+    public void saveRemoteRegistration(MemberRegistration  remoteRegistration)
+    {
+        if (remoteRegistration != null)
+        {
+            /*
+             * Retrieve the current properties from the file is necessary.
+             */
+            if (registryStoreProperties == null)
+            {
+                registryStoreProperties = 
this.retrieveRegistryStoreProperties();
+            }
+
+            /*
+             * It is possible that the remote repository already has an entry 
in the cohort registry and if this is
+             * the case, it will be overwritten.  Otherwise the new remote 
properties are added.
+             */
+            ArrayList<MemberRegistration> remotePropertiesList = 
registryStoreProperties.getRemoteRegistrations();
+
+            int index = 
findRemoteRegistration(remoteRegistration.getMetadataCollectionId(), 
remotePropertiesList);
+
+            if (index < remotePropertiesList.size())
+            {
+                remotePropertiesList.set(index, remoteRegistration);
+            }
+            else
+            {
+                remotePropertiesList.add(remoteRegistration);
+            }
+            
registryStoreProperties.setRemoteRegistrations(remotePropertiesList);
+
+            /*
+             * Write out the new cohort registry content.
+             */
+            this.writeRegistryStoreProperties(registryStoreProperties);
+        }
+        else
+        {
+            String actionDescription = "Saving a Remote Registration to Cohort 
Registry Store";
+
+            OMRSAuditCode auditCode = OMRSAuditCode.NULL_MEMBER_REGISTRATION;
+
+            auditLog.logRecord(actionDescription,
+                               auditCode.getLogMessageId(),
+                               auditCode.getSeverity(),
+                               
auditCode.getFormattedLogMessage(registryStoreName),
+                               null,
+                               auditCode.getSystemAction(),
+                               auditCode.getUserAction());
+
+            if (log.isDebugEnabled())
+            {
+                log.debug("Null remote registration passed to 
saveRemoteRegistration :(");
+            }
+        }
+    }
+
+
+    /**
+     * Return a list of all of the remote metadata repositories registered in 
the metadata repository cohort.
+     *
+     * @return Remote registrations iterator
+     */
+    public ArrayList<MemberRegistration> retrieveRemoteRegistrations()
+    {
+        ArrayList<MemberRegistration>    remoteRegistrations = null;
+
+        /*
+         * Ensure the current properties are retrieved from the registry.
+         */
+        if (registryStoreProperties == null)
+        {
+            registryStoreProperties = this.retrieveRegistryStoreProperties();
+        }
+
+        /*
+         * Copy the remote member properties into a registration iterator for 
return.
+         */
+        ArrayList<MemberRegistration> remotePropertiesList = 
registryStoreProperties.getRemoteRegistrations();
+        ArrayList<MemberRegistration> remoteRegistrationArray = new 
ArrayList<>();
+
+        for (MemberRegistration remoteRegistration : remotePropertiesList)
+        {
+            MemberRegistration   member = new 
MemberRegistration(remoteRegistration);
+
+            remoteRegistrationArray.add(member);
+        }
+
+        if (remoteRegistrationArray.size() > 0)
+        {
+            remoteRegistrations = remoteRegistrationArray;
+        }
+
+        return remoteRegistrations;
+    }
+
+
+    /**
+     * Return the registration information for a specific metadata repository, 
identified by its metadataCollectionId.
+     * If the metadataCollectionId is not recognized then null is returned.
+     *
+     * @param metadataCollectionId - unique identifier for the repository
+     * @return MemberRegistration object containing details of the remote 
metadata repository. (null if not found)
+     */
+    public MemberRegistration retrieveRemoteRegistration(String    
metadataCollectionId)
+    {
+        MemberRegistration    remoteRegistration = null;
+
+        if (metadataCollectionId != null)
+        {
+            /*
+             * Ensure the current properties are retrieved from the registry.
+             */
+            if (registryStoreProperties == null)
+            {
+                registryStoreProperties = 
this.retrieveRegistryStoreProperties();
+            }
+
+            /*
+             * Retrieve the list of remote registrations
+             */
+            ArrayList<MemberRegistration> remotePropertiesList = 
registryStoreProperties.getRemoteRegistrations();
+
+            /*
+             * Locate the required entry
+             */
+            int indexOfEntry = findRemoteRegistration(metadataCollectionId, 
remotePropertiesList);
+
+            /*
+             * If the entry is found create a registration object from it.
+             */
+            if (indexOfEntry < remotePropertiesList.size())
+            {
+                remoteRegistration = remotePropertiesList.get(indexOfEntry);
+            }
+        }
+        else
+        {
+            String actionDescription = "Retrieving Remote Registration from 
Cohort Registry Store";
+
+            OMRSAuditCode auditCode = OMRSAuditCode.NULL_MEMBER_REGISTRATION;
+
+            auditLog.logRecord(actionDescription,
+                               auditCode.getLogMessageId(),
+                               auditCode.getSeverity(),
+                               
auditCode.getFormattedLogMessage(registryStoreName),
+                               null,
+                               auditCode.getSystemAction(),
+                               auditCode.getUserAction());
+
+            if (log.isDebugEnabled())
+            {
+                log.debug("Null metadataCollectionId passed to 
retrieveRemoteRegistration :(");
+            }
+        }
+
+        return remoteRegistration;
+    }
+
+
+    /**
+     * Remove details of the requested remote repository's registration from 
the store.
+     *
+     * @param metadataCollectionId - unique identifier for the repository
+     */
+    public void removeRemoteRegistration(String    metadataCollectionId)
+    {
+        if (metadataCollectionId != null)
+        {
+            /*
+             * Ensure the current properties are retrieved from the registry.
+             */
+            if (registryStoreProperties == null)
+            {
+                registryStoreProperties = 
this.retrieveRegistryStoreProperties();
+            }
+
+            /*
+             * Retrieve the list of remote registrations
+             */
+            ArrayList<MemberRegistration> remotePropertiesList = 
registryStoreProperties.getRemoteRegistrations();
+
+            /*
+             * Locate the required entry
+             */
+            int indexOfEntry = findRemoteRegistration(metadataCollectionId, 
remotePropertiesList);
+
+            /*
+             * If the entry is found create a registration object from it.
+             */
+            if (indexOfEntry < remotePropertiesList.size())
+            {
+                remotePropertiesList.remove(indexOfEntry);
+                
registryStoreProperties.setRemoteRegistrations(remotePropertiesList);
+                writeRegistryStoreProperties(registryStoreProperties);
+            }
+            else
+            {
+                String actionDescription = "Removing Remote Registration from 
Cohort Registry Store";
+
+                OMRSAuditCode auditCode = 
OMRSAuditCode.MISSING_MEMBER_REGISTRATION;
+
+                auditLog.logRecord(actionDescription,
+                                   auditCode.getLogMessageId(),
+                                   auditCode.getSeverity(),
+                                   
auditCode.getFormattedLogMessage(metadataCollectionId, registryStoreName),
+                                   null,
+                                   auditCode.getSystemAction(),
+                                   auditCode.getUserAction());
+
+                if (log.isDebugEnabled())
+                {
+                    log.debug("MetadataCollectionId : " + metadataCollectionId 
+ " passed to removeRemoteRegistration not found :(");
+                }
+            }
+        }
+        else
+        {
+            String actionDescription = "Removing Remote Registration from 
Cohort Registry Store";
+
+            OMRSAuditCode auditCode = OMRSAuditCode.NULL_MEMBER_REGISTRATION;
+
+            auditLog.logRecord(actionDescription,
+                               auditCode.getLogMessageId(),
+                               auditCode.getSeverity(),
+                               
auditCode.getFormattedLogMessage(registryStoreName),
+                               null,
+                               auditCode.getSystemAction(),
+                               auditCode.getUserAction());
+
+            if (log.isDebugEnabled())
+            {
+                log.debug("Null metadataCollectionId passed to 
removeRemoteRegistration :(");
+            }
+        }
+    }
+
+
+    /**
+     * Remove the local and remote registrations from the cohort registry 
store since the local server has
+     * unregistered from the cohort.
+     */
+    public void clearAllRegistrations()
+    {
+        writeRegistryStoreProperties(null);
+    }
+
+
+    /**
+     * Close the config file
+     */
+    public void disconnect()
+    {
+        registryStoreProperties = null;
+
+        if (log.isDebugEnabled())
+        {
+            log.debug("Closing Cohort Registry Store.");
+        }
+    }
+
+
+    /**
+     * Refresh the registry store properties with the current values in the 
file base registry store.
+     *
+     * @return CohortRegistryProperties object containing the currently stored 
properties.
+     */
+    private CohortMembership retrieveRegistryStoreProperties()
+    {
+        File               registryStoreFile = new File(registryStoreName);
+        CohortMembership   newRegistryStoreProperties = null;
+
+        try
+        {
+            if (log.isDebugEnabled())
+            {
+                log.debug("Retrieving cohort registry store properties");
+            }
+
+            String registryStoreFileContents = 
FileUtils.readFileToString(registryStoreFile, "UTF-8");
+
+            ObjectMapper objectMapper = new ObjectMapper();
+            newRegistryStoreProperties = 
objectMapper.readValue(registryStoreFileContents, CohortMembership.class);
+        }
+        catch (IOException   ioException)
+        {
+            /*
+             * The registry file is not found, create a new one ...
+             */
+            String actionDescription = "Retrieving Cohort Registry Store 
Properties";
+
+            OMRSAuditCode auditCode = OMRSAuditCode.CREATE_REGISTRY_FILE;
+
+            auditLog.logRecord(actionDescription,
+                               auditCode.getLogMessageId(),
+                               auditCode.getSeverity(),
+                               
auditCode.getFormattedLogMessage(registryStoreName),
+                               null,
+                               auditCode.getSystemAction(),
+                               auditCode.getUserAction());
+
+            if (log.isDebugEnabled())
+            {
+                log.debug("New Cohort Registry Store", ioException);
+            }
+
+            newRegistryStoreProperties = new CohortMembership();
+        }
+
+        return newRegistryStoreProperties;
+    }
+
+
+    /**
+     * Writes the supplied registry store properties to the registry store.
+     *
+     * @param newRegistryStoreProperties - contents of the registry store
+     */
+    private void writeRegistryStoreProperties(CohortMembership   
newRegistryStoreProperties)
+    {
+        File    registryStoreFile = new File(registryStoreName);
+
+        try
+        {
+            if (log.isDebugEnabled())
+            {
+                log.debug("Writing cohort registry store properties", 
newRegistryStoreProperties);
+            }
+
+            if (newRegistryStoreProperties == null)
+            {
+                registryStoreFile.delete();
+            }
+            else
+            {
+                ObjectMapper objectMapper = new ObjectMapper();
+
+                String registryStoreFileContents = 
objectMapper.writeValueAsString(newRegistryStoreProperties);
+
+                FileUtils.writeStringToFile(registryStoreFile, 
registryStoreFileContents, false);
+            }
+        }
+        catch (IOException   ioException)
+        {
+            String actionDescription = "Writing Cohort Registry Store 
Properties";
+
+            OMRSAuditCode auditCode = OMRSAuditCode.UNUSABLE_REGISTRY_FILE;
+
+            auditLog.logException(actionDescription,
+                                  auditCode.getLogMessageId(),
+                                  auditCode.getSeverity(),
+                                  
auditCode.getFormattedLogMessage(registryStoreName),
+                                  null,
+                                  auditCode.getSystemAction(),
+                                  auditCode.getUserAction(),
+                                  ioException);
+
+            if (log.isDebugEnabled())
+            {
+                log.debug("Unusable Cohort Registry Store :(", ioException);
+            }
+        }
+    }
+
+    /**
+     * Flush all changes and close the registry store.
+     */
+    public void close()
+    {
+        this.disconnect();
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreProvider.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreProvider.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreProvider.java
new file mode 100644
index 0000000..6f33ec1
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/file/FileBasedRegistryStoreProvider.java
@@ -0,0 +1,37 @@
+/*
+ * 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.metadatahighway.cohortregistry.store.file;
+
+import 
org.apache.atlas.omrs.metadatahighway.cohortregistry.store.OMRSCohortRegistryStoreProviderBase;
+
+/**
+ * FileBasedRegistryStoreProvider is the OCF connector provider for the file 
based cohort registry store.
+ */
+public class FileBasedRegistryStoreProvider extends 
OMRSCohortRegistryStoreProviderBase
+{
+    /**
+     * Constructor used to initialize the ConnectorProviderBase with the Java 
class name of the specific
+     * registry store implementation.
+     */
+    public FileBasedRegistryStoreProvider()
+    {
+        Class    connectorClass = FileBasedRegistryStoreConnector.class;
+
+        super.setConnectorClassName(connectorClass.getName());
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java
new file mode 100644
index 0000000..60bcc43
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java
@@ -0,0 +1,67 @@
+/*
+ * 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.metadatahighway.cohortregistry.store.properties;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import static 
com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
+
+/**
+ * CohortMembership describes the structure of the cohort registry store.  It 
contains details
+ * of the local registration and a list of remote member registrations.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, 
fieldVisibility=NONE)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class CohortMembership implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    private MemberRegistration            localRegistration   = null;
+    private ArrayList<MemberRegistration> remoteRegistrations = null;
+
+    public CohortMembership()
+    {
+    }
+
+    public MemberRegistration getLocalRegistration()
+    {
+        return localRegistration;
+    }
+
+    public void setLocalRegistration(MemberRegistration localRegistration)
+    {
+        this.localRegistration = localRegistration;
+    }
+
+    public ArrayList<MemberRegistration> getRemoteRegistrations()
+    {
+        return remoteRegistrations;
+    }
+
+    public void setRemoteRegistrations(ArrayList<MemberRegistration> 
remoteRegistrations)
+    {
+        this.remoteRegistrations = remoteRegistrations;
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/MemberRegistration.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/MemberRegistration.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/MemberRegistration.java
new file mode 100644
index 0000000..4f43b0f
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/MemberRegistration.java
@@ -0,0 +1,206 @@
+/*
+ * 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.metadatahighway.cohortregistry.store.properties;
+
+import org.apache.atlas.ocf.properties.Connection;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * MemberRegistration is a POJO for storing the information about a metadata 
repository that is a member
+ * of the open metadata repository cohort. This information is saved to disk 
by the
+ * OMRSCohortRegistryStore.
+ */
+public class MemberRegistration implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /*
+     * Information about a metadata repository that is a member of the 
metadata repository cluster
+     */
+    private String     metadataCollectionId = null;
+    private String     serverName           = null;
+    private String     serverType           = null;
+    private String     organizationName     = null;
+    private Date       registrationTime     = null;
+    private Connection repositoryConnection = null;
+
+
+    /**
+     * Default constructor - initialize registration information to null.
+     */
+    public MemberRegistration()
+    {
+        /*
+         * Nothing to do
+         */
+    }
+
+
+    /**
+     * Copy/clone constructor - copy registration information from the 
template.
+     *
+     * @param template - MemberRegistration properties to copy
+     */
+    public MemberRegistration(MemberRegistration template)
+    {
+        if (template != null)
+        {
+            metadataCollectionId  = template.getMetadataCollectionId();
+            serverName            = template.getServerName();
+            serverType            = template.getServerType();
+            organizationName      = template.getOrganizationName();
+            registrationTime      = template.getRegistrationTime();
+            repositoryConnection  = template.getRepositoryConnection();
+
+        }
+    }
+
+
+    /**
+     * Return the unique identifier of the repository's metadata collection id.
+     *
+     * @return String metadata collection id
+     */
+    public String getMetadataCollectionId() { return metadataCollectionId; }
+
+
+    /**
+     * Set up the unique identifier of the repository's metadata collection id.
+     *
+     * @param metadataCollectionId - String guid
+     */
+    public void setMetadataCollectionId(String metadataCollectionId) { 
this.metadataCollectionId = metadataCollectionId; }
+
+
+    /**
+     * Return the display name for the server.  It is not guaranteed to be 
unique - just confusing for
+     * administrators if it is different.  The display name can change over 
time with no loss of data integrity.
+     *
+     * @return String display name
+     */
+    public String getServerName()
+    {
+        return serverName;
+    }
+
+
+    /**
+     * Set up the display name for the server.  It is not guaranteed to be 
unique - just confusing for
+     * administrators if it is different.  The display name can change over 
time with no loss of data integrity.
+     *
+     * @param serverName - String display name
+     */
+    public void setServerName(String serverName)
+    {
+        this.serverName = serverName;
+    }
+
+
+    /**
+     * Return the type of server.
+     *
+     * @return String server type
+     */
+    public String getServerType()
+    {
+        return serverType;
+    }
+
+
+    /**
+     * Set up the type of server.
+     *
+     * @param serverType - String server type
+     */
+    public void setServerType(String serverType)
+    {
+        this.serverType = serverType;
+    }
+
+
+    /**
+     * Return the name of the organization.
+     *
+     * @return String name of the organization
+     */
+    public String getOrganizationName()
+    {
+        return organizationName;
+    }
+
+
+    /**
+     * Set up the name of the organization.
+     *
+     * @param organizationName - String name of the organization
+     */
+    public void setOrganizationName(String organizationName)
+    {
+        this.organizationName = organizationName;
+    }
+
+
+    /**
+     * Return the time that this repository registered with the cluster. (Or 
null if it has not yet registered.)
+     *
+     * @return Date object representing the registration time stamp
+     */
+    public Date getRegistrationTime()
+    {
+        return registrationTime;
+    }
+
+
+    /**
+     * Set up the time that this repository registered with the cluster. (Or 
null if it has not yet registered.)
+     *
+     * @param registrationTime - Date object representing the registration 
time stamp
+     */
+    public void setRegistrationTime(Date registrationTime) { 
this.registrationTime = registrationTime; }
+
+
+    /**
+     * Return the connection information for a connector that enables remote 
calls to the repository server.
+     *
+     * @return Connection object containing the properties of the connection
+     */
+    public Connection getRepositoryConnection()
+    {
+        if (repositoryConnection == null)
+        {
+            return repositoryConnection;
+        }
+        else
+        {
+            return new Connection(repositoryConnection);
+        }
+    }
+
+
+    /**
+     * Set up the connection information for a connector that enables remote 
calls to the repository server.
+     *
+     * @param repositoryConnection - Connection object containing the 
properties of the connection
+     */
+    public void setRepositoryConnection(Connection repositoryConnection)
+    {
+        this.repositoryConnection = repositoryConnection;
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java
new file mode 100644
index 0000000..db48af7
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java
@@ -0,0 +1,59 @@
+/*
+ * 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.rest.repositoryconnector;
+
+import org.apache.atlas.omrs.ffdc.exception.NotImplementedRuntimeException;
+import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollectionBase;
+
+/**
+ * The OMRSRESTMetadataCollection represents a remote metadata repository that 
supports the OMRS REST API.
+ * Requests to this metadata collection are translated one-for-one to requests 
to the remote repository since
+ * the OMRS REST API has a one-to-one correspondence with the metadata 
collection.
+ */
+/*
+ * This class is using OMRSMetadataCollectionBase while it is under 
construction.  It will change to
+ * inheriting from OMRSMetadataCollection once it is implemented
+ */
+public class OMRSRESTMetadataCollection extends OMRSMetadataCollectionBase
+{
+    private OMRSRESTRepositoryConnector parentConnector = null;
+
+    /**
+     * Default constructor.
+     *
+     * @param parentConnector - connector that this metadata collection 
supports.  The connector has the information
+     *                        to call the metadata repository.
+     * @param metadataCollectionId - unique identifier for the metadata 
collection
+     */
+    public OMRSRESTMetadataCollection(OMRSRESTRepositoryConnector 
parentConnector,
+                                      String                      
metadataCollectionId)
+    {
+        super(metadataCollectionId);
+
+        /*
+         * Save parentConnector since this has the connection information.
+         */
+        this.parentConnector = parentConnector;
+
+        /*
+         * This is a temporary implementation to allow the structural 
implementation of the connectors to
+         * be committed before the metadata collection implementation is 
complete.
+         */
+        throw new NotImplementedRuntimeException("OMRSRESTMetadataCollection", 
"constructor", "ATLAS-1773");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java
new file mode 100644
index 0000000..423e829
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java
@@ -0,0 +1,87 @@
+/*
+ * 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.rest.repositoryconnector;
+
+import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
+import 
org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
+import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection;
+
+/**
+ * The OMRSRESTRepositoryConnector is a connector to a remote Apache Atlas 
repository (or any other metadata repository
+ * that supports the OMRS REST APIs).  This is the connector used by the 
EnterpriseOMRSRepositoryConnector to make a direct call
+ * to another open metadata repository.
+ */
+public class OMRSRESTRepositoryConnector extends OMRSRepositoryConnector
+{
+    private OMRSRESTMetadataCollection  metadataCollection   = null;
+    private String                      metadataCollectionId = null;
+
+
+    /**
+     * Default constructor used by the OCF Connector Provider.
+     */
+    public OMRSRESTRepositoryConnector()
+    {
+        /*
+         * Nothing to do (yet !)
+         */
+    }
+
+
+    /**
+     * Set up the unique Id for this metadata collection.
+     *
+     * @param metadataCollectionId - String unique Id
+     */
+    public void setMetadataCollectionId(String     metadataCollectionId)
+    {
+        this.metadataCollectionId = metadataCollectionId;
+
+        /*
+         * Initialize the metadata collection only once the connector is 
properly set up.
+         */
+        metadataCollection = new OMRSRESTMetadataCollection(this, 
metadataCollectionId);
+    }
+
+
+    /**
+     * Returns the metadata collection object that provides an OMRS 
abstraction of the metadata within
+     * a metadata repository.
+     *
+     * @return OMRSMetadataCollection - metadata information retrieved from 
the metadata repository.
+     */
+    public OMRSMetadataCollection getMetadataCollection()
+    {
+        if (metadataCollection == null)
+        {
+            // TODO Throw exception since it means the local metadata 
collection id is not set up.
+        }
+        return metadataCollection;
+    }
+
+
+    /**
+     * Free up any resources held since the connector is no longer needed.
+     *
+     * @throws ConnectorCheckedException - there is a problem disconnecting 
the connector.
+     */
+    public void disconnect() throws ConnectorCheckedException
+    {
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnectorProvider.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnectorProvider.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnectorProvider.java
new file mode 100644
index 0000000..f9c0a9f
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnectorProvider.java
@@ -0,0 +1,44 @@
+/*
+ * 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.rest.repositoryconnector;
+
+import 
org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnectorProviderBase;
+
+/**
+ * In the Open Connector Framework (OCF), a ConnectorProvider is a factory for 
a specific type of connector.
+ * The OMRSRESTRepositoryConnectorProvider is the connector provider for the 
OMRSRESTRepositoryConnector.
+ * It extends OMRSRepositoryConnectorProviderBase which in turn extends the 
OCF ConnectorProviderBase.
+ * ConnectorProviderBase supports the creation of connector instances.
+ *
+ * The OMRSRESTRepositoryConnectorProvider must initialize 
ConnectorProviderBase with the Java class
+ * name of the OMRS Connector implementation (by calling 
super.setConnectorClassName(className)).
+ * Then the connector provider will work.
+ */
+public class OMRSRESTRepositoryConnectorProvider extends 
OMRSRepositoryConnectorProviderBase
+{
+    /**
+     * Constructor used to initialize the ConnectorProviderBase with the Java 
class name of the specific
+     * OMRS Connector implementation.
+     */
+    public OMRSRESTRepositoryConnectorProvider()
+    {
+        Class    connectorClass = OMRSRESTRepositoryConnector.class;
+
+        super.setConnectorClassName(connectorClass.getName());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/rest/server/OMRSRepositoryRESTServices.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/rest/server/OMRSRepositoryRESTServices.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/server/OMRSRepositoryRESTServices.java
new file mode 100644
index 0000000..d53c795
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/rest/server/OMRSRepositoryRESTServices.java
@@ -0,0 +1,44 @@
+/*
+ * 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.rest.server;
+
+import 
org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
+
+/**
+ * OMRSRepositoryRESTServices provides the server-side support for the OMRS 
Repository REST Services API.
+ * It is a minimal wrapper around the OMRSRepositoryConnector for the local 
server's metadata collection.
+ * If localRepositoryConnector is null when a REST calls is received, the 
request is rejected.
+ */
+public class OMRSRepositoryRESTServices
+{
+    //TODO remember to support getInstanceURL from TypeDefManager
+    public static OMRSRepositoryConnector localRepositoryConnector = null;
+
+
+    /**
+     * Set up the local repository connector that will service the REST Calls.
+     *
+     * @param localRepositoryConnector - link to the local repository 
responsible for servicing the REST calls.
+     *                                 If localRepositoryConnector is null 
when a REST calls is received, the request
+     *                                 is rejected.
+     */
+    public static void setLocalRepository(OMRSRepositoryConnector    
localRepositoryConnector)
+    {
+        OMRSRepositoryRESTServices.localRepositoryConnector = 
localRepositoryConnector;
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopic.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopic.java 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopic.java
new file mode 100644
index 0000000..0fec97c
--- /dev/null
+++ b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopic.java
@@ -0,0 +1,43 @@
+/*
+ * 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.topicconnectors;
+
+
+import org.apache.atlas.omrs.eventmanagement.events.v1.OMRSEventV1;
+
+/**
+ * OMRSTopic defines the interface to the messaging Topic for OMRS Events.  It 
implemented by the OMTSTopicConnector.
+ */
+public interface OMRSTopic
+{
+    /**
+     * Register a listener object.  This object will be supplied with all of 
the events
+     * received on the topic.
+     *
+     * @param newListener - object implementing the OMRSTopicListener interface
+     */
+    void registerListener(OMRSTopicListener  newListener);
+
+
+    /**
+     * Sends the supplied event to the topic.
+     *
+     * @param event - OMRSEvent object containing the event properties.
+     */
+    void sendEvent(OMRSEventV1 event);
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicConnector.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicConnector.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicConnector.java
new file mode 100644
index 0000000..6cde7e6
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicConnector.java
@@ -0,0 +1,102 @@
+/*
+ * 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.topicconnectors;
+
+import org.apache.atlas.ocf.ConnectorBase;
+import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
+import org.apache.atlas.omrs.eventmanagement.events.v1.OMRSEventV1;
+
+import java.util.ArrayList;
+
+
+/**
+ * OMRSTopicConnector provides the support for the registration of listeners 
and the distribution of
+ * incoming events to the registered listeners.  An implementation of the 
OMRSTopicConnector needs to
+ * extend this class to include the interaction with the eventing/messaging 
layer.
+ * <ul>
+ *     <li>
+ *         For inbound events it should call the protected distributeEvents() 
method.
+ *     </li>
+ *     <li>
+ *         For outbound events, callers will invoke the sendEvent() method.
+ *     </li>
+ *     <li>
+ *         When the server no longer needs the topic, it will call close().
+ *     </li>
+ * </ul>
+ */
+public abstract class OMRSTopicConnector extends ConnectorBase implements 
OMRSTopic
+{
+    ArrayList<OMRSTopicListener> topicListeners     = new  ArrayList<>();
+
+    /**
+     * Simple constructor
+     */
+    public OMRSTopicConnector()
+    {
+        /*
+         * Nothing to do
+         */
+    }
+
+
+    /**
+     * Pass an event that has been received on the topic to each of the 
registered listeners.
+     *
+     * @param event - OMRSEvent to distribute
+     */
+    protected void distributeEvent(OMRSEventV1 event)
+    {
+        for (OMRSTopicListener  topicListener : topicListeners)
+        {
+            try
+            {
+                topicListener.processEvent(event);
+            }
+            catch (Throwable  error)
+            {
+                // TODO Need to log error
+            }
+        }
+    }
+
+
+    /**
+     * Register a listener object.  This object will be supplied with all of 
the events received on the topic.
+     *
+     * @param topicListener - object implementing the OMRSTopicListener 
interface
+     */
+    public void registerListener(OMRSTopicListener  topicListener)
+    {
+        if (topicListener != null)
+        {
+            topicListeners.add(topicListener);
+        }
+    }
+
+
+    /**
+     * Free up any resources held since the connector is no longer needed.
+     *
+     * @throws ConnectorCheckedException - there is a problem disconnecting 
the connector.
+     */
+    public void disconnect() throws ConnectorCheckedException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicListener.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicListener.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicListener.java
new file mode 100644
index 0000000..89ab683
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/OMRSTopicListener.java
@@ -0,0 +1,35 @@
+/*
+ * 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.topicconnectors;
+
+import org.apache.atlas.omrs.eventmanagement.events.v1.OMRSEventV1;
+
+
+/**
+ * OMRSTopicListener defines the interface that a listener must implement in 
order to receive events
+ * from the OMRSTopicConnector.
+ */
+public interface OMRSTopicListener
+{
+    /**
+     * Method to pass an event received on topic.
+     *
+     * @param event - inbound event
+     */
+    void processEvent(OMRSEventV1 event);
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicConnector.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicConnector.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicConnector.java
new file mode 100644
index 0000000..c9f0396
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicConnector.java
@@ -0,0 +1,55 @@
+/*
+ * 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.topicconnectors.kafka;
+
+import org.apache.atlas.ocf.ffdc.ConnectorCheckedException;
+import org.apache.atlas.omrs.eventmanagement.events.v1.OMRSEventV1;
+import org.apache.atlas.omrs.topicconnectors.OMRSTopicConnector;
+
+
+/**
+ * KafkaOMRSTopicConnector provides a concrete implementation of the 
OMRSTopicConnector that
+ * uses native Apache Kafka as the event/messaging infrastructure.
+ */
+public class KafkaOMRSTopicConnector extends OMRSTopicConnector
+{
+    public KafkaOMRSTopicConnector()
+    {
+        super();
+    }
+
+    /**
+     * Sends the supplied event to the topic.
+     *
+     * @param event - OMRSEvent object containing the event properties.
+     */
+    public void sendEvent(OMRSEventV1 event)
+    {
+        // TODO Needs implementation to connect to Kafka and send/receive 
events
+
+    }
+
+    /**
+     * Free up any resources held since the connector is no longer needed.
+     *
+     * @throws ConnectorCheckedException - there is a problem disconnecting 
the connector.
+     */
+    public void disconnect() throws ConnectorCheckedException
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/8a57e657/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicProvider.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicProvider.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicProvider.java
new file mode 100644
index 0000000..2297750
--- /dev/null
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/topicconnectors/kafka/KafkaOMRSTopicProvider.java
@@ -0,0 +1,38 @@
+/*
+ * 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.topicconnectors.kafka;
+
+import org.apache.atlas.ocf.ConnectorProviderBase;
+
+
+/**
+ * KafkaOMRSTopicProvider provides implementation of the connector provider 
for the KafkaOMRSTopicConnector.
+ */
+public class KafkaOMRSTopicProvider extends ConnectorProviderBase
+{
+    /**
+     * Constructor used to initialize the ConnectorProviderBase with the Java 
class name of the specific
+     * OMRS Connector implementation.
+     */
+    public KafkaOMRSTopicProvider()
+    {
+        Class    connectorClass = KafkaOMRSTopicConnector.class;
+
+        super.setConnectorClassName(connectorClass.getName());
+    }
+}

Reply via email to