http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSInstanceEventProcessor.java
----------------------------------------------------------------------
diff --git 
a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSInstanceEventProcessor.java
 
b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSInstanceEventProcessor.java
index 5a0182e..fe144ed 100644
--- 
a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSInstanceEventProcessor.java
+++ 
b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositoryconnector/LocalOMRSInstanceEventProcessor.java
@@ -17,15 +17,20 @@
  */
 package org.apache.atlas.omrs.localrepository.repositoryconnector;
 
+import org.apache.atlas.ocf.properties.Connection;
+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.eventmanagement.*;
 import org.apache.atlas.omrs.eventmanagement.events.OMRSInstanceEventProcessor;
+import org.apache.atlas.omrs.ffdc.OMRSErrorCode;
 import org.apache.atlas.omrs.ffdc.exception.*;
-import 
org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSTypeDefHelper;
+import 
org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryHelper;
+import 
org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryValidator;
 import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection;
 import 
org.apache.atlas.omrs.metadatacollection.properties.instances.EntityDetail;
 import 
org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceProvenanceType;
+import 
org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceType;
 import 
org.apache.atlas.omrs.metadatacollection.properties.instances.Relationship;
 import 
org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary;
 import 
org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector;
@@ -44,10 +49,16 @@ import java.util.ArrayList;
  */
 public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcessor, OMRSInstanceRetrievalEventProcessor
 {
-    private String                          localMetadataCollectionId = null;
-    private OMRSRepositoryConnector         realLocalConnector        = null;
-    private OMRSTypeDefHelper               typeDefHelper             = null;
-    private OMRSRepositoryEventExchangeRule saveExchangeRule          = null;
+    private String                          localMetadataCollectionId;
+    private String                          localServerName;
+    private OMRSRepositoryConnector         realLocalConnector;
+    private OMRSRepositoryHelper            repositoryHelper;
+    private OMRSRepositoryValidator         repositoryValidator;
+    private OMRSRepositoryEventExchangeRule saveExchangeRule;
+    private String                          realRepositoryName = "Local 
Repository";
+    private OMRSMetadataCollection          realMetadataCollection = null;
+    private OMRSRepositoryEventProcessor    outboundRepositoryEventProcessor = 
null;
+
 
 
     /*
@@ -63,38 +74,41 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * of nulls in any of its parameters and will throw a logic error 
exception is it finds any.
      *
      * @param localMetadataCollectionId - local metadata collection identifier
-     * @param realLocalConnector - connector to the real local repository
-     * @param typeDefHelper - helper class for building instances
-     * @param saveExchangeRule - rule that determines which events to process.
+     * @param localServerName           - name of the local server - for 
logging
+     * @param realLocalConnector        - connector to the real local 
repository
+     * @param repositoryHelper          - helper class for building instances
+     * @param repositoryValidator       - helper class for validating instances
+     * @param saveExchangeRule          - rule that determines which events to 
process.
      */
-    LocalOMRSInstanceEventProcessor(String                            
localMetadataCollectionId,
-                                    OMRSRepositoryConnector           
realLocalConnector,
-                                    OMRSTypeDefHelper                 
typeDefHelper,
-                                    OMRSRepositoryEventExchangeRule   
saveExchangeRule)
+    LocalOMRSInstanceEventProcessor(String                          
localMetadataCollectionId,
+                                    String                          
localServerName,
+                                    OMRSRepositoryConnector         
realLocalConnector,
+                                    OMRSRepositoryHelper            
repositoryHelper,
+                                    OMRSRepositoryValidator         
repositoryValidator,
+                                    OMRSRepositoryEventExchangeRule 
saveExchangeRule,
+                                    OMRSRepositoryEventProcessor    
outboundRepositoryEventProcessor)
     {
-        if (localMetadataCollectionId == null)
-        {
-            // TODO throw exception
-        }
-        this.localMetadataCollectionId = localMetadataCollectionId;
+        final String methodName = "LocalOMRSInstanceEventProcessor 
constructor";
 
-        if (realLocalConnector == null)
-        {
-            // TODO throw exception
-        }
+        this.localMetadataCollectionId = localMetadataCollectionId;
+        this.localServerName = localServerName;
         this.realLocalConnector = realLocalConnector;
+        this.repositoryHelper = repositoryHelper;
+        this.repositoryValidator = repositoryValidator;
+        this.saveExchangeRule = saveExchangeRule;
 
-        if (typeDefHelper == null)
+        if (realLocalConnector != null)
         {
-            // TODO Throw exception
+            this.realMetadataCollection = 
realLocalConnector.getMetadataCollection();
         }
-        this.typeDefHelper = typeDefHelper;
 
-        if (saveExchangeRule == null)
+        this.verifyEventProcessor(methodName);
+
+        Connection connection = this.realLocalConnector.getConnection();
+        if (connection != null)
         {
-            // TODO Throw exception
+            this.realRepositoryName = connection.getConnectionName();
         }
-        this.saveExchangeRule = saveExchangeRule;
     }
 
 
@@ -103,17 +117,18 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * OMRSInstanceEventProcessor
      */
 
+
     /**
      * A new entity has been created.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the new entity
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the new entity
      */
     public void processNewEntityEvent(String       sourceName,
                                       String       
originatorMetadataCollectionId,
@@ -122,105 +137,29 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                       String       originatorOrganizationName,
                                       EntityDetail entity)
     {
-        OMRSMetadataCollection metadataCollection = 
realLocalConnector.getMetadataCollection();
-
-        if (metadataCollection != null)
-        {
-            try
-            {
-                metadataCollection.saveEntityReferenceCopy(null, entity);
-            }
-            catch (RepositoryErrorException  error)
-            {
-                // TODO log an error to say that the repository is not 
available
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Entity not added because repository is not 
available", entity);
-                    log.debug("RepositoryErrorException:", error);
-                }
-            }
-            catch (TypeErrorException   error)
-            {
-                // TODO log an error to say that the repository does not 
recognize the entity's type
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Entity not added because repository does not 
recognise its type", entity);
-                    log.debug("TypeErrorException:", error);
-                }
-            }
-            catch (PropertyErrorException  error)
-            {
-                // TODO log an error to say that the entity contains 
properties that conflict with its type
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Entity not added because it has properties that 
conflict with its type", entity);
-                    log.debug("PropertyErrorException:", error);
-                }
-            }
-            catch (HomeEntityException error)
-            {
-                // TODO log an error to say that the metadata collection Id of 
the archive conflicts with the
-                // TODO the local repository's local metadata collection Id
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Entity not added because it has metadata 
collection Id " +
-                                      "that conflicts with local repository's 
metadata collection Id", entity);
-                    log.debug("HomeEntityException:", error);
-                }
-            }
-            catch (EntityConflictException error)
-            {
-                // TODO log an error to say that the entity contents conflict 
with the versionName of the entity already stored.
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Entity not added because it has properties that 
conflict with the versionName of the entity already stored", entity);
-                    log.debug("EntityConflictException:", error);
-                }
-            }
-            catch (InvalidEntityException error)
-            {
-                // TODO log an error to say that the entity contents are 
invalid.
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Entity not added because entity has properties 
that are invalid", entity);
-                    log.debug("InvalidEntityException:", error);
-                }
-            }
-            catch (Throwable   error)
-            {
-                // TODO log a generic error
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Entity not applied because of an error", 
entity);
-                    log.debug("Throwable:", error);
-                }
-            }
-        }
-        else
-        {
-            // TODO log that metadata collection is null (logic Error)
-        }
+        final String methodName = "processNewEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * An existing entity has been updated.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the new versionName of the entity.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the new versionName 
of the entity.
      */
     public void processUpdatedEntityEvent(String       sourceName,
                                           String       
originatorMetadataCollectionId,
@@ -229,21 +168,29 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                           String       
originatorOrganizationName,
                                           EntityDetail entity)
     {
-
+        final String methodName = "processUpdatedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * An update to an entity has been undone.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the versionName of the entity that has been 
restored.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the versionName of 
the entity that has been restored.
      */
     public void processUndoneEntityEvent(String       sourceName,
                                          String       
originatorMetadataCollectionId,
@@ -252,67 +199,91 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                          String       
originatorOrganizationName,
                                          EntityDetail entity)
     {
-
+        final String methodName = "processUndoneEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * A new classification has been added to an entity.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the entity with the new classification added.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the entity with the 
new classification added.
      */
-    public void processClassifiedEntityEvent(String       sourceName,
-                                             String       
originatorMetadataCollectionId,
-                                             String       originatorServerName,
-                                             String       originatorServerType,
-                                             String       
originatorOrganizationName,
+    public void processClassifiedEntityEvent(String sourceName,
+                                             String 
originatorMetadataCollectionId,
+                                             String originatorServerName,
+                                             String originatorServerType,
+                                             String originatorOrganizationName,
                                              EntityDetail entity)
     {
-
+        final String methodName = "processClassifiedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * A classification has been removed from an entity.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the entity after the classification has been 
removed.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the entity after the 
classification has been removed.
      */
-    public void processDeclassifiedEntityEvent(String       sourceName,
-                                               String       
originatorMetadataCollectionId,
-                                               String       
originatorServerName,
-                                               String       
originatorServerType,
-                                               String       
originatorOrganizationName,
+    public void processDeclassifiedEntityEvent(String sourceName,
+                                               String 
originatorMetadataCollectionId,
+                                               String originatorServerName,
+                                               String originatorServerType,
+                                               String 
originatorOrganizationName,
                                                EntityDetail entity)
     {
-
+        final String methodName = "processDeclassifiedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * An existing classification has been changed on an entity.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the entity after the classification has been 
changed.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the entity after the 
classification has been changed.
      */
     public void processReclassifiedEntityEvent(String       sourceName,
                                                String       
originatorMetadataCollectionId,
@@ -321,85 +292,105 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                String       
originatorOrganizationName,
                                                EntityDetail entity)
     {
-
+        final String methodName = "processReclassifiedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * An existing entity has been deleted.  This is a soft delete. This means 
it is still in the repository
      * but it is no longer returned on queries.
-     *
+     * <p>
      * All relationships to the entity are also soft-deleted and will no 
longer be usable.  These deleted relationships
      * will be notified through separate events.
-     *
+     * <p>
      * Details of the TypeDef are included with the entity's unique id (guid) 
to ensure the right entity is deleted in
      * the remote repositories.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param typeDefGUID - unique identifier for this entity's TypeDef
-     * @param typeDefName - name of this entity's TypeDef
-     * @param instanceGUID - unique identifier for the entity
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - deleted entity
      */
     public void processDeletedEntityEvent(String       sourceName,
                                           String       
originatorMetadataCollectionId,
                                           String       originatorServerName,
                                           String       originatorServerType,
                                           String       
originatorOrganizationName,
-                                          String       typeDefGUID,
-                                          String       typeDefName,
-                                          String       instanceGUID)
+                                          EntityDetail entity)
     {
-
+        final String methodName = "processDeletedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * A deleted entity has been permanently removed from the repository.  
This request can not be undone.
-     *
+     * <p>
      * Details of the TypeDef are included with the entity's unique id (guid) 
to ensure the right entity is purged in
      * the remote repositories.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param typeDefGUID - unique identifier for this entity's TypeDef
-     * @param typeDefName - name of this entity's TypeDef
-     * @param instanceGUID - unique identifier for the entity
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param typeDefGUID                    - unique identifier for this 
entity's TypeDef
+     * @param typeDefName                    - name of this entity's TypeDef
+     * @param instanceGUID                   - unique identifier for the entity
      */
-    public void processPurgedEntityEvent(String       sourceName,
-                                         String       
originatorMetadataCollectionId,
-                                         String       originatorServerName,
-                                         String       originatorServerType,
-                                         String       
originatorOrganizationName,
-                                         String       typeDefGUID,
-                                         String       typeDefName,
-                                         String       instanceGUID)
+    public void processPurgedEntityEvent(String sourceName,
+                                         String originatorMetadataCollectionId,
+                                         String originatorServerName,
+                                         String originatorServerType,
+                                         String originatorOrganizationName,
+                                         String typeDefGUID,
+                                         String typeDefName,
+                                         String instanceGUID)
     {
-
+        final String methodName = "processPurgedEntityEvent";
+
+        purgeReferenceInstance(sourceName,
+                               methodName,
+                               originatorMetadataCollectionId,
+                               originatorServerName,
+                               typeDefGUID,
+                               typeDefName,
+                               instanceGUID);
     }
 
 
     /**
      * A deleted entity has been restored to the state it was before it was 
deleted.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the versionName of the entity that has been 
restored.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the versionName of 
the entity that has been restored.
      */
     public void processRestoredEntityEvent(String       sourceName,
                                            String       
originatorMetadataCollectionId,
@@ -408,7 +399,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                            String       
originatorOrganizationName,
                                            EntityDetail entity)
     {
-
+        final String methodName = "processRestoredEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
@@ -417,15 +416,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * entities are discovered to have the same guid.  This is extremely 
unlikely but not impossible so
      * the open metadata protocol has provision for this.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param originalEntityGUID - the existing identifier for the entity.
-     * @param entity - new values for this entity, including the new guid.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param originalEntityGUID             - the existing identifier for the 
entity.
+     * @param entity                         - new values for this entity, 
including the new guid.
      */
     public void processReIdentifiedEntityEvent(String       sourceName,
                                                String       
originatorMetadataCollectionId,
@@ -435,7 +434,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                String       originalEntityGUID,
                                                EntityDetail entity)
     {
-
+        final String methodName = "processReIdentifiedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
@@ -444,15 +451,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * type to either a super type (so the subtype can be deleted) or a new 
subtype (so additional properties can be
      * added.)  However, the type can be changed to any compatible type.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param originalTypeDefSummary - original details of this entity's 
TypeDef.
-     * @param entity - new values for this entity, including the new type 
information.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param originalTypeDefSummary         - original details of this 
entity's TypeDef.
+     * @param entity                         - new values for this entity, 
including the new type information.
      */
     public void processReTypedEntityEvent(String         sourceName,
                                           String         
originatorMetadataCollectionId,
@@ -462,7 +469,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                           TypeDefSummary 
originalTypeDefSummary,
                                           EntityDetail   entity)
     {
-
+        final String methodName = "processReTypedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
@@ -471,15 +486,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * becomes permanently unavailable, or if the user community updating this 
entity move to working
      * from a different repository in the open metadata repository cluster.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
-     * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
-     *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
+     * @param sourceName                       - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                         local repository, or event 
mapper name.
+     * @param originatorMetadataCollectionId   - unique identifier for the 
metadata collection hosted by the server that
+     *                                         sent the event.
+     * @param originatorServerName             - name of the server that the 
event came from.
+     * @param originatorServerType             - type of server that the event 
came from.
+     * @param originatorOrganizationName       - name of the organization that 
owns the server that sent the event.
      * @param originalHomeMetadataCollectionId - unique identifier for the 
original home repository.
-     * @param entity - new values for this entity, including the new home 
information.
+     * @param entity                           - new values for this entity, 
including the new home information.
      */
     public void processReHomedEntityEvent(String       sourceName,
                                           String       
originatorMetadataCollectionId,
@@ -489,7 +504,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                           String       
originalHomeMetadataCollectionId,
                                           EntityDetail entity)
     {
-
+        final String methodName = "processReHomedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
@@ -497,43 +520,69 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * The local repository is requesting that an entity from another 
repository's metadata collection is
      * refreshed so the local repository can create a reference copy.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param typeDefGUID - - unique identifier for this entity's TypeDef
-     * @param typeDefName - name of this entity's TypeDef
-     * @param instanceGUID - unique identifier for the entity
-     * @param homeMetadataCollectionId - metadata collection id for the home 
of this instance.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param typeDefGUID                    - - unique identifier for this 
entity's TypeDef
+     * @param typeDefName                    - name of this entity's TypeDef
+     * @param instanceGUID                   - unique identifier for the entity
+     * @param homeMetadataCollectionId       - metadata collection id for the 
home of this instance.
      */
-    public void processRefreshEntityRequested(String       sourceName,
-                                              String       
originatorMetadataCollectionId,
-                                              String       
originatorServerName,
-                                              String       
originatorServerType,
-                                              String       
originatorOrganizationName,
-                                              String       typeDefGUID,
-                                              String       typeDefName,
-                                              String       instanceGUID,
-                                              String       
homeMetadataCollectionId)
+    public void processRefreshEntityRequested(String sourceName,
+                                              String 
originatorMetadataCollectionId,
+                                              String originatorServerName,
+                                              String originatorServerType,
+                                              String 
originatorOrganizationName,
+                                              String typeDefGUID,
+                                              String typeDefName,
+                                              String instanceGUID,
+                                              String homeMetadataCollectionId)
     {
+        final String  methodName = "processRefreshEntityRequested";
 
+        try
+        {
+            verifyEventProcessor(methodName);
+
+            realMetadataCollection.refreshEntityReferenceCopy(sourceName,
+                                                              instanceGUID,
+                                                              typeDefGUID,
+                                                              typeDefName,
+                                                              
originatorMetadataCollectionId);
+
+        }
+        catch (Throwable error)
+        {
+            OMRSAuditCode auditCode = 
OMRSAuditCode.UNEXPECTED_EXCEPTION_FROM_EVENT;
+            auditLog.logRecord(methodName,
+                               auditCode.getLogMessageId(),
+                               auditCode.getSeverity(),
+                               auditCode.getFormattedLogMessage(methodName,
+                                                                
originatorServerName,
+                                                                
originatorMetadataCollectionId,
+                                                                
error.getMessage()),
+                               null,
+                               auditCode.getSystemAction(),
+                               auditCode.getUserAction());
+        }
     }
 
 
     /**
      * A remote repository in the cohort has sent entity details in response 
to a refresh request.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param entity - details of the requested entity
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param entity                         - details of the requested entity
      */
     public void processRefreshEntityEvent(String       sourceName,
                                           String       
originatorMetadataCollectionId,
@@ -542,21 +591,29 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                           String       
originatorOrganizationName,
                                           EntityDetail entity)
     {
-
+        final String methodName = "processReHomedEntityEvent";
+        final String entityParameterName = "entity";
+
+        updateReferenceEntity(sourceName,
+                              methodName,
+                              entityParameterName,
+                              originatorMetadataCollectionId,
+                              originatorServerName,
+                              entity);
     }
 
 
     /**
      * A new relationship has been created.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param relationship - details of the new relationship
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param relationship                   - details of the new relationship
      */
     public void processNewRelationshipEvent(String       sourceName,
                                             String       
originatorMetadataCollectionId,
@@ -565,106 +622,29 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                             String       
originatorOrganizationName,
                                             Relationship relationship)
     {
-        OMRSMetadataCollection metadataCollection = 
realLocalConnector.getMetadataCollection();
-
-        if (metadataCollection != null)
-        {
-            try
-            {
-                metadataCollection.saveRelationshipReferenceCopy(null, 
relationship);
-            }
-            catch (RepositoryErrorException error)
-            {
-                // TODO log an error to say that the repository is not 
available
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Relationship not added because repository is 
not available", relationship);
-                    log.debug("RepositoryErrorException:", error);
-                }
-            }
-            catch (TypeErrorException error)
-            {
-                // TODO log an error to say that the repository does not 
recognize the relationship's type
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Relationship not added because repository does 
not recognise its type", relationship);
-                    log.debug("TypeErrorException:", error);
-                }
-            }
-            catch (PropertyErrorException error)
-            {
-                // TODO log an error to say that the relationship contains 
properties that conflict with its type
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Relationship not added because its has 
properties that conflict with its type", relationship);
-                    log.debug("PropertyErrorException:", error);
-                }
-            }
-            catch (HomeRelationshipException error)
-            {
-                // TODO log an error to say that the metadata collection Id of 
the archive conflicts with the
-                // TODO the local repository's local metadata collection Id
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Relationship not added because its has metadata 
collection Id " +
-                                      "that conflicts with local repository's 
metadata collection Id", relationship);
-                    log.debug("HomeRelationshipException:", error);
-                }
-            }
-            catch (RelationshipConflictException error)
-            {
-                // TODO log an error to say that the relationship contents 
conflict with the versionName of the relationship already stored.
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Relationship not added because it has 
properties that conflict with " +
-                                      "the versionName of the relationship 
already stored", relationship);
-                    log.debug("EntityConflictException:", error);
-                }
-            }
-            catch (InvalidRelationshipException error)
-            {
-                // TODO log an error to say that the entity contents are 
invalid.
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Relationship not added because it has 
properties that are invalid", relationship);
-                    log.debug("InvalidRelationshipException:", error);
-                }
-            }
-            catch (Throwable   error)
-            {
-                // TODO log a generic error
-
-                if (log.isDebugEnabled())
-                {
-                    log.debug("Relationship not applied because of an error", 
relationship);
-                    log.debug("Throwable:", error);
-                }
-            }
-        }
-        else
-        {
-            // TODO log that metadata collection is null (logic Error)
-        }
+        final String methodName = "processNewRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
     /**
      * An existing relationship has been updated.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param relationship - details of the new versionName of the 
relationship.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param relationship                   - details of the new versionName 
of the relationship.
      */
     public void processUpdatedRelationshipEvent(String       sourceName,
                                                 String       
originatorMetadataCollectionId,
@@ -673,21 +653,29 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                 String       
originatorOrganizationName,
                                                 Relationship relationship)
     {
-
+        final String methodName = "processUpdatedRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
     /**
      * An update to a relationship has been undone.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param relationship - details of the versionName of the relationship 
that has been restored.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param relationship                   - details of the versionName of 
the relationship that has been restored.
      */
     public void processUndoneRelationshipEvent(String       sourceName,
                                                String       
originatorMetadataCollectionId,
@@ -696,81 +684,102 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                String       
originatorOrganizationName,
                                                Relationship relationship)
     {
+        final String methodName = "processUndoneRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
     /**
      * An existing relationship has been deleted.  This is a soft delete. This 
means it is still in the repository
      * but it is no longer returned on queries.
-     *
+     * <p>
      * Details of the TypeDef are included with the relationship's unique id 
(guid) to ensure the right
      * relationship is deleted in the remote repositories.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param typeDefGUID - unique identifier for this relationship's TypeDef
-     * @param typeDefName - name of this relationship's TypeDef
-     * @param instanceGUID - unique identifier for the relationship
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param relationship                   - deleted relationship
      */
     public void processDeletedRelationshipEvent(String       sourceName,
                                                 String       
originatorMetadataCollectionId,
                                                 String       
originatorServerName,
                                                 String       
originatorServerType,
                                                 String       
originatorOrganizationName,
-                                                String       typeDefGUID,
-                                                String       typeDefName,
-                                                String       instanceGUID)
+                                                Relationship relationship)
     {
-
+        final String methodName = "processDeletedRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
     /**
      * A deleted relationship has been permanently removed from the 
repository.  This request can not be undone.
-     *
+     * <p>
      * Details of the TypeDef are included with the relationship's unique id 
(guid) to ensure the right
      * relationship is purged in the remote repositories.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param typeDefGUID - unique identifier for this relationship's TypeDef.
-     * @param typeDefName - name of this relationship's TypeDef.
-     * @param instanceGUID - unique identifier for the relationship.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param typeDefGUID                    - unique identifier for this 
relationship's TypeDef.
+     * @param typeDefName                    - name of this relationship's 
TypeDef.
+     * @param instanceGUID                   - unique identifier for the 
relationship.
      */
-    public void processPurgedRelationshipEvent(String       sourceName,
-                                               String       
originatorMetadataCollectionId,
-                                               String       
originatorServerName,
-                                               String       
originatorServerType,
-                                               String       
originatorOrganizationName,
-                                               String       typeDefGUID,
-                                               String       typeDefName,
-                                               String       instanceGUID)
+    public void processPurgedRelationshipEvent(String sourceName,
+                                               String 
originatorMetadataCollectionId,
+                                               String originatorServerName,
+                                               String originatorServerType,
+                                               String 
originatorOrganizationName,
+                                               String typeDefGUID,
+                                               String typeDefName,
+                                               String instanceGUID)
     {
-
+        final String methodName = "processPurgedRelationshipEvent";
+
+        purgeReferenceInstance(sourceName,
+                               methodName,
+                               originatorMetadataCollectionId,
+                               originatorServerName,
+                               typeDefGUID,
+                               typeDefName,
+                               instanceGUID);
     }
 
 
     /**
      * A deleted relationship has been restored to the state it was before it 
was deleted.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param relationship - details of the versionName of the relationship 
that has been restored.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param relationship                   - details of the versionName of 
the relationship that has been restored.
      */
     public void processRestoredRelationshipEvent(String       sourceName,
                                                  String       
originatorMetadataCollectionId,
@@ -779,7 +788,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                  String       
originatorOrganizationName,
                                                  Relationship relationship)
     {
-
+        final String methodName = "processRestoredRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
@@ -788,15 +805,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * relationships are discovered to have the same guid.  This is extremely 
unlikely but not impossible so
      * the open metadata protocol has provision for this.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param originalRelationshipGUID - the existing identifier for the 
relationship.
-     * @param relationship - new values for this relationship, including the 
new guid.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param originalRelationshipGUID       - the existing identifier for the 
relationship.
+     * @param relationship                   - new values for this 
relationship, including the new guid.
      */
     public void processReIdentifiedRelationshipEvent(String       sourceName,
                                                      String       
originatorMetadataCollectionId,
@@ -806,7 +823,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                      String       
originalRelationshipGUID,
                                                      Relationship relationship)
     {
-
+        final String methodName = "processReIdentifiedRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
@@ -815,15 +840,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * type to either a super type (so the subtype can be deleted) or a new 
subtype (so additional properties can be
      * added.)  However, the type can be changed to any compatible type.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param originalTypeDefSummary - original details of this relationship's 
TypeDef.
-     * @param relationship - new values for this relationship, including the 
new type information.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param originalTypeDefSummary         - original details of this 
relationship's TypeDef.
+     * @param relationship                   - new values for this 
relationship, including the new type information.
      */
     public void processReTypedRelationshipEvent(String         sourceName,
                                                 String         
originatorMetadataCollectionId,
@@ -833,7 +858,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                 TypeDefSummary 
originalTypeDefSummary,
                                                 Relationship   relationship)
     {
-
+        final String methodName = "processReTypedRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
@@ -842,15 +875,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * becomes permanently unavailable, or if the user community updating this 
relationship move to working
      * from a different repository in the open metadata repository cluster.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
      * @param originalHomeMetadataCollection - unique identifier for the 
original home repository.
-     * @param relationship - new values for this relationship, including the 
new home information.
+     * @param relationship                   - new values for this 
relationship, including the new home information.
      */
     public void processReHomedRelationshipEvent(String       sourceName,
                                                 String       
originatorMetadataCollectionId,
@@ -860,7 +893,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                 String       
originalHomeMetadataCollection,
                                                 Relationship relationship)
     {
-
+        final String methodName = "processReHomedRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
@@ -868,29 +909,55 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * A repository has requested the home repository of a relationship send 
details of the relationship so
      * the local repository can create a reference copy of the instance.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param typeDefGUID - unique identifier for this instance's TypeDef
-     * @param typeDefName - name of this relationship's TypeDef
-     * @param instanceGUID - unique identifier for the instance
-     * @param homeMetadataCollectionId - metadata collection id for the home 
of this instance.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param typeDefGUID                    - unique identifier for this 
instance's TypeDef
+     * @param typeDefName                    - name of this relationship's 
TypeDef
+     * @param instanceGUID                   - unique identifier for the 
instance
+     * @param homeMetadataCollectionId       - metadata collection id for the 
home of this instance.
      */
-    public void processRefreshRelationshipRequest(String       sourceName,
-                                                  String       
originatorMetadataCollectionId,
-                                                  String       
originatorServerName,
-                                                  String       
originatorServerType,
-                                                  String       
originatorOrganizationName,
-                                                  String       typeDefGUID,
-                                                  String       typeDefName,
-                                                  String       instanceGUID,
-                                                  String       
homeMetadataCollectionId)
+    public void processRefreshRelationshipRequest(String sourceName,
+                                                  String 
originatorMetadataCollectionId,
+                                                  String originatorServerName,
+                                                  String originatorServerType,
+                                                  String 
originatorOrganizationName,
+                                                  String typeDefGUID,
+                                                  String typeDefName,
+                                                  String instanceGUID,
+                                                  String 
homeMetadataCollectionId)
     {
+        final String    methodName = "processRefreshRelationshipRequest";
+
+        try
+        {
+            verifyEventProcessor(methodName);
 
+            realMetadataCollection.refreshRelationshipReferenceCopy(sourceName,
+                                                                    
instanceGUID,
+                                                                    
typeDefGUID,
+                                                                    
typeDefName,
+                                                                    
originatorMetadataCollectionId);
+
+        }
+        catch (Throwable error)
+        {
+            OMRSAuditCode auditCode = 
OMRSAuditCode.UNEXPECTED_EXCEPTION_FROM_EVENT;
+            auditLog.logRecord(methodName,
+                               auditCode.getLogMessageId(),
+                               auditCode.getSeverity(),
+                               auditCode.getFormattedLogMessage(methodName,
+                                                                
originatorServerName,
+                                                                
originatorMetadataCollectionId,
+                                                                
error.getMessage()),
+                               null,
+                               auditCode.getSystemAction(),
+                               auditCode.getUserAction());
+        }
     }
 
 
@@ -898,14 +965,14 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * The local repository is refreshing the information about a relationship 
for the other
      * repositories in the cohort.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - unique identifier for the 
metadata collection hosted by the server that
      *                                       sent the event.
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param relationship - relationship details
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param relationship                   - relationship details
      */
     public void processRefreshRelationshipEvent(String       sourceName,
                                                 String       
originatorMetadataCollectionId,
@@ -914,7 +981,15 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
                                                 String       
originatorOrganizationName,
                                                 Relationship relationship)
     {
-
+        final String methodName = "processRefreshRelationshipEvent";
+        final String entityParameterName = "relationship";
+
+        updateReferenceRelationship(sourceName,
+                                    methodName,
+                                    entityParameterName,
+                                    originatorMetadataCollectionId,
+                                    originatorServerName,
+                                    relationship);
     }
 
 
@@ -925,20 +1000,20 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * at least one of the instances has its GUID changed in its respective 
home repository.  The updated instance(s)
      * are redistributed around the cohort.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - metadata collection id of the 
repository reporting the conflicting instance
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param targetMetadataCollectionId - metadata collection id of other 
repository with the conflicting instance
-     * @param targetTypeDefSummary - details of the target instance's TypeDef
-     * @param targetInstanceGUID - unique identifier for the source instance
-     * @param otherOrigin - origin of the other (older) metadata instance
-     * @param otherMetadataCollectionId - metadata collection of the other 
(older) metadata instance
-     * @param otherTypeDefSummary - details of the other (older) instance's 
TypeDef
-     * @param otherInstanceGUID - unique identifier for the other (older) 
instance
-     * @param errorMessage - description of the error.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param targetMetadataCollectionId     - metadata collection id of other 
repository with the conflicting instance
+     * @param targetTypeDefSummary           - details of the target 
instance's TypeDef
+     * @param targetInstanceGUID             - unique identifier for the 
source instance
+     * @param otherOrigin                    - origin of the other (older) 
metadata instance
+     * @param otherMetadataCollectionId      - metadata collection of the 
other (older) metadata instance
+     * @param otherTypeDefSummary            - details of the other (older) 
instance's TypeDef
+     * @param otherInstanceGUID              - unique identifier for the other 
(older) instance
+     * @param errorMessage                   - description of the error.
      */
     public void processConflictingInstancesEvent(String                 
sourceName,
                                                  String                 
originatorMetadataCollectionId,
@@ -962,28 +1037,28 @@ public class LocalOMRSInstanceEventProcessor implements 
OMRSInstanceEventProcess
      * An open metadata repository has detected an inconsistency in the 
versionName of the type used in an updated metadata
      * instance compared to its stored versionName.
      *
-     * @param sourceName - name of the source of the event.  It may be the 
cohort name for incoming events or the
-     *                   local repository, or event mapper name.
+     * @param sourceName                     - name of the source of the 
event.  It may be the cohort name for incoming events or the
+     *                                       local repository, or event mapper 
name.
      * @param originatorMetadataCollectionId - metadata collection id of the 
repository reporting the conflicting instance
-     * @param originatorServerName - name of the server that the event came 
from.
-     * @param originatorServerType - type of server that the event came from.
-     * @param originatorOrganizationName - name of the organization that owns 
the server that sent the event.
-     * @param targetMetadataCollectionId - metadata collection id of other 
repository with the conflicting instance
-     * @param targetTypeDefSummary - details of the target instance's TypeDef
-     * @param targetInstanceGUID - unique identifier for the source instance
-     * @param otherTypeDefSummary - details of the local copy of the 
instance's TypeDef
-     * @param errorMessage - description of the error.
+     * @param originatorServerName           - name of the server that the 
event came from.
+     * @param originatorServerType           - type of server that the event 
came from.
+     * @param originatorOrganizationName     - name of the organization that 
owns the server that sent the event.
+     * @param targetMetadataCollectionId     - metadata collection id of other 
repository with the conflicting instance
+     * @param targetTypeDefSummary           - details of the target 
instance's TypeDef
+     * @param t

<TRUNCATED>

Reply via email to