http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSRepositoryConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSRepositoryConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSRepositoryConnector.java index 0e18748..996ca27 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSRepositoryConnector.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/enterprise/repositoryconnector/EnterpriseOMRSRepositoryConnector.java @@ -20,12 +20,15 @@ package org.apache.atlas.omrs.enterprise.repositoryconnector; import org.apache.atlas.ocf.Connector; import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; 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.enterprise.connectormanager.OMRSConnectorConsumer; import org.apache.atlas.omrs.enterprise.connectormanager.OMRSConnectorManager; import org.apache.atlas.omrs.ffdc.exception.RepositoryErrorException; 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.InstanceHeader; import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector; import org.apache.atlas.omrs.ffdc.OMRSErrorCode; import org.apache.atlas.omrs.ffdc.exception.OMRSRuntimeException; @@ -34,6 +37,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; /** * EnterpriseOMRSRepositoryConnector supports federating calls to multiple metadata repositories. As a result, @@ -54,31 +58,26 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i private OMRSConnectorManager connectorManager = null; private String connectorConsumerId = null; - private EnterpriseOMRSMetadataCollection enterpriseMetadataCollection = null; - private String enterpriseMetadataCollectionId = null; - private String enterpriseMetadataCollectionName = null; - - private boolean connected = false; - private FederatedConnector localCohortConnector = null; private ArrayList<FederatedConnector> remoteCohortConnectors = new ArrayList<>(); - private static final Logger log = LoggerFactory.getLogger(EnterpriseOMRSRepositoryConnector.class); + private String accessServiceName = null; + + private static final Logger log = LoggerFactory.getLogger(EnterpriseOMRSRepositoryConnector.class); + private static final OMRSAuditLog auditLog = new OMRSAuditLog(OMRSAuditingComponent.ENTERPRISE_REPOSITORY_CONNECTOR); + /** * Constructor used by the EnterpriseOMRSConnectorProvider. * * @param connectorManager - provides notifications as repositories register and unregister with the * cohorts. - * @param enterpriseMetadataCollectionName - name of the virtual metadata collection that this - * connector is managing. */ - public EnterpriseOMRSRepositoryConnector(OMRSConnectorManager connectorManager, - String enterpriseMetadataCollectionName) + public EnterpriseOMRSRepositoryConnector(OMRSConnectorManager connectorManager) { super(); - this.enterpriseMetadataCollectionName = enterpriseMetadataCollectionName; + String methodName = "constructor"; this.connectorManager = connectorManager; @@ -93,7 +92,7 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(), this.getClass().getName(), - "constructor", + methodName, errorMessage, errorCode.getSystemAction(), errorCode.getUserAction()); @@ -108,49 +107,42 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i */ public void setMetadataCollectionId(String metadataCollectionId) { - this.enterpriseMetadataCollectionId = metadataCollectionId; + super.metadataCollectionId = metadataCollectionId; if (metadataCollectionId != null) { - enterpriseMetadataCollection = new EnterpriseOMRSMetadataCollection(this, - repositoryHelper, - repositoryValidator, - enterpriseMetadataCollectionId, - enterpriseMetadataCollectionName); + super.metadataCollection = new EnterpriseOMRSMetadataCollection(this, + super.serverName, + repositoryHelper, + repositoryValidator, + metadataCollectionId); - connected = true; } } /** - * Returns the metadata collection object that provides an OMRS abstraction of the metadata within - * a metadata repository. For the EnterpriseOMRSRepositoryConnector, this is the metadata collection that is - * configured to work across the cohort. + * Return the name of the access service using this connector. * - * @return OMRSMetadataCollection - metadata information retrieved from the metadata repository. + * @return access service name */ - public OMRSMetadataCollection getMetadataCollection() + public String getAccessServiceName() { - String methodName = "getMetadataCollection()"; - - if (enterpriseMetadataCollection == null) - { - OMRSErrorCode errorCode = OMRSErrorCode.INVALID_COHORT_CONFIG; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(); + return accessServiceName; + } - throw new OMRSRuntimeException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } - return enterpriseMetadataCollection; + /** + * Set up the name of the access service using this connector. + * + * @param accessServiceName - string name + */ + public void setAccessServiceName(String accessServiceName) + { + this.accessServiceName = accessServiceName; } + /** * Indicates that the connector is completely configured and can begin processing. * @@ -159,6 +151,17 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i public void start() throws ConnectorCheckedException { super.start(); + + final String actionDescription = "start"; + + OMRSAuditCode auditCode = OMRSAuditCode.STARTING_ENTERPRISE_CONNECTOR; + auditLog.logRecord(actionDescription, + auditCode.getLogMessageId(), + auditCode.getSeverity(), + auditCode.getFormattedLogMessage(accessServiceName), + null, + auditCode.getSystemAction(), + auditCode.getUserAction()); } @@ -171,6 +174,17 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i { super.disconnect(); + final String actionDescription = "disconnect"; + + OMRSAuditCode auditCode = OMRSAuditCode.DISCONNECTING_ENTERPRISE_CONNECTOR; + auditLog.logRecord(actionDescription, + auditCode.getLogMessageId(), + auditCode.getSeverity(), + auditCode.getFormattedLogMessage(accessServiceName), + null, + auditCode.getSystemAction(), + auditCode.getUserAction()); + if ((connectorManager != null) && (connectorConsumerId != null)) { connectorManager.unregisterConnectorConsumer(connectorConsumerId); @@ -178,96 +192,95 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i localCohortConnector = null; remoteCohortConnectors = new ArrayList<>(); - enterpriseMetadataCollection = null; - connected = false; } /** - * Returns the list of metadata collections that the EnterpriseOMRSRepositoryConnector is federating queries across. - * - * This method is used by this connector's metadata collection object on each request it processes. This - * means it always has the most up to date list of metadata collections to work with. + * Returns the connector to the repository where the supplied instance can be updated - ie its home repository. * - * @return OMRSMetadataCollection ArrayList - * @throws RepositoryErrorException - the enterprise services are not available + * @param instance - instance to test + * @param methodName - name of method making the request (used for logging) + * @return repository connector + * @throws RepositoryErrorException - home metadata collection is null */ - protected ArrayList<OMRSMetadataCollection> getMetadataCollections() throws RepositoryErrorException + protected OMRSRepositoryConnector getHomeConnector(InstanceHeader instance, + String methodName) throws RepositoryErrorException { - String methodName = "getMetadataCollections()"; + this.validateRepositoryIsActive(methodName); - if (connected) - { - ArrayList<OMRSMetadataCollection> cohortMetadataCollections = new ArrayList<>(); + repositoryValidator.validateHomeMetadataGUID(repositoryName, instance, methodName); - /* - * Make sure the local connector is first. - */ - if (localCohortConnector != null) - { - cohortMetadataCollections.add(localCohortConnector.getMetadataCollection()); - } + String instanceMetadataCollectionId = instance.getMetadataCollectionId(); - /* - * Now add the remote connectors. - */ - for (FederatedConnector federatedConnector : remoteCohortConnectors) - { - cohortMetadataCollections.add(federatedConnector.getMetadataCollection()); - } + if (instanceMetadataCollectionId.equals(localCohortConnector.getMetadataCollectionId())) + { + return localCohortConnector.getConnector(); + } - if (cohortMetadataCollections.size() > 0) - { - return cohortMetadataCollections; - } - else + for (FederatedConnector remoteCohortConnector : remoteCohortConnectors) + { + if (remoteCohortConnector != null) { - OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES; - String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(); - - throw new RepositoryErrorException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); + if (instanceMetadataCollectionId.equals(remoteCohortConnector.getMetadataCollectionId())) + { + return remoteCohortConnector.getConnector(); + } } } - else - { - OMRSErrorCode errorCode = OMRSErrorCode.ENTERPRISE_DISCONNECTED; - String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(); - throw new RepositoryErrorException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); - } + return null; } /** - * Return a repository helper that can be used by an OMAS to create types and instance objects. + * Returns the list of repository connectors that the EnterpriseOMRSRepositoryConnector is federating queries across. * - * @return an OMRSRepositoryHelper object that is linked to the repository content manager for this server. + * This method is used by this connector's metadata collection object on each request it processes. This + * means it always has the most up to date list of connectors to work with. + * + * @param methodName - name of method making the request (used for logging) + * @return OMRSRepositoryConnector List + * @throws RepositoryErrorException - the enterprise services are not available */ - public OMRSRepositoryHelper getRepositoryHelper() + protected List<OMRSRepositoryConnector> getCohortConnectors(String methodName) throws RepositoryErrorException { - return super.repositoryHelper; - } + this.validateRepositoryIsActive(methodName); + List<OMRSRepositoryConnector> cohortConnectors = new ArrayList<>(); + + /* + * Make sure the local connector is first. + */ + if (localCohortConnector != null) + { + cohortConnectors.add(localCohortConnector.getConnector()); + } + + /* + * Now add the remote connectors. + */ + for (FederatedConnector federatedConnector : remoteCohortConnectors) + { + cohortConnectors.add(federatedConnector.getConnector()); + } + + if (! cohortConnectors.isEmpty()) + { + return cohortConnectors; + } + else + { + OMRSErrorCode errorCode = OMRSErrorCode.NO_REPOSITORIES; + String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(accessServiceName); + + throw new RepositoryErrorException(errorCode.getHTTPErrorCode(), + this.getClass().getName(), + methodName, + errorMessage, + errorCode.getSystemAction(), + errorCode.getUserAction()); + } - /** - * Return a repository validator that can be used by an OMAS to validate types and instance objects. - * - * @return an OMRSRepositoryValidator object that is linked to the repository content manager for this server. - */ - public OMRSRepositoryValidator getRepositoryValidator() - { - return super.repositoryValidator; } @@ -282,9 +295,7 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i { if (localConnector != null) { - localCohortConnector = new FederatedConnector(metadataCollectionId, - localConnector, - localConnector.getMetadataCollection()); + localCohortConnector = new FederatedConnector(metadataCollectionId, localConnector); } else { @@ -304,9 +315,7 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i { if (remoteConnector != null) { - remoteCohortConnectors.add(new FederatedConnector(metadataCollectionId, - remoteConnector, - remoteConnector.getMetadataCollection())); + remoteCohortConnectors.add(new FederatedConnector(metadataCollectionId, remoteConnector)); } } @@ -332,23 +341,35 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i } } + /** * Call disconnect on all registered connectors and stop calling them. The OMRS is about to shutdown. */ public void disconnectAllConnectors() { + try + { + super.disconnect(); + } + catch (Throwable error) + { + /* + * Nothing to do + */ + } + if (localCohortConnector != null) { this.disconnectConnector(localCohortConnector); + } - if (remoteCohortConnectors != null) + if (remoteCohortConnectors != null) + { + for (FederatedConnector remoteConnector : remoteCohortConnectors) { - for (FederatedConnector remoteConnector : remoteCohortConnectors) + if (remoteConnector != null) { - if (remoteConnector != null) - { - this.disconnectConnector(remoteConnector); - } + this.disconnectConnector(remoteConnector); } } } @@ -390,7 +411,6 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i { private String metadataCollectionId = null; private OMRSRepositoryConnector connector = null; - private OMRSMetadataCollection metadataCollection = null; /** @@ -398,13 +418,11 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i * * @param metadataCollectionId - unique identifier for the metadata collection accessed through the connector * @param connector - connector for the repository - * @param metadataCollection - metadata collection from the connection. */ - public FederatedConnector(String metadataCollectionId, OMRSRepositoryConnector connector, OMRSMetadataCollection metadataCollection) + public FederatedConnector(String metadataCollectionId, OMRSRepositoryConnector connector) { this.metadataCollectionId = metadataCollectionId; this.connector = connector; - this.metadataCollection = metadataCollection; } @@ -437,7 +455,19 @@ public class EnterpriseOMRSRepositoryConnector extends OMRSRepositoryConnector i */ public OMRSMetadataCollection getMetadataCollection() { - return metadataCollection; + if (connector != null) + { + try + { + return connector.getMetadataCollection(); + } + catch (Throwable error) + { + return null; + } + } + + return null; } } }
http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventListener.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventListener.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventListener.java index c1ed59b..2c8de30 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventListener.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventListener.java @@ -40,8 +40,8 @@ import org.slf4j.LoggerFactory; */ public class OMRSEventListener implements OMRSTopicListener { - private String cohortName = null; - private String localMetadataCollectionId = null; + private String cohortName = null; + private String localMetadataCollectionId = null; /* * There is an event processor for each category of event. The OMRSEventListener passes appropriate events to these @@ -86,7 +86,7 @@ public class OMRSEventListener implements OMRSTopicListener /** * Process an incoming event. This method is called by the OMRSTopicConnector. The processing is careful of nulls * and ignores an event that is incorrectly formatted. The assumption is that the unformatted part of the message - * is an extension from a newer versionName of the protocol and can be ignored. + * is an extension from a newer version of the protocol and can be ignored. * * @param event Version 1 of the OMRSEvent that defines the category and payload of the incoming event. */ @@ -219,8 +219,7 @@ public class OMRSEventListener implements OMRSTopicListener registryEventOriginator.getServerType(), registryEventOriginator.getOrganizationName(), registryEvent.getRegistrationTimestamp(), - registryEvent.getRemoteConnection(), - registryEvent.getTypeDefSummaries()); + registryEvent.getRemoteConnection()); break; case RE_REGISTRATION_EVENT: @@ -230,8 +229,7 @@ public class OMRSEventListener implements OMRSTopicListener registryEventOriginator.getServerType(), registryEventOriginator.getOrganizationName(), registryEvent.getRegistrationTimestamp(), - registryEvent.getRemoteConnection(), - registryEvent.getTypeDefSummaries()); + registryEvent.getRemoteConnection()); break; case REFRESH_REGISTRATION_REQUEST: @@ -808,7 +806,7 @@ public class OMRSEventListener implements OMRSTopicListener default: if (log.isDebugEnabled()) { - log.debug("Ignored TypeDef event - unknown type"); + log.debug("Ignored Instance event - unknown type"); } break; } http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventPublisher.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventPublisher.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventPublisher.java index 6f482b6..12be782 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventPublisher.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSEventPublisher.java @@ -59,7 +59,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * * @param publisherName - name of the cohort (or enterprise virtual repository) that this event publisher * is sending events to. - * @param localProtocolVersion - protocol versionName to use + * @param localProtocolVersion - protocol version to use * @param topicConnector - OMRS Topic to send requests on */ public OMRSEventPublisher(String publisherName, @@ -69,7 +69,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD String actionDescription = "Initialize event publisher"; /* - * Save the publisherName and protocol versionName + * Save the publisherName and protocol version */ this.eventProtocolVersion = localProtocolVersion; this.publisherName = publisherName; @@ -269,7 +269,6 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @param originatorOrganizationName - name of the organization that owns the server that sent the event. * @param registrationTimestamp - the time that the server/repository issued the registration request. * @param remoteConnection - the Connection properties for the connector used to call the registering server. - * @param typeDefList - the list of TypeDefs supported by the registering server/repository. */ public boolean processRegistrationEvent(String sourceName, String metadataCollectionId, @@ -277,8 +276,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, - Connection remoteConnection, - List<TypeDefSummary> typeDefList) + Connection remoteConnection) { OMRSEventOriginator eventOriginator = new OMRSEventOriginator(); @@ -289,8 +287,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD OMRSRegistryEvent registryEvent = new OMRSRegistryEvent(OMRSRegistryEventType.REGISTRATION_EVENT, registrationTimestamp, - remoteConnection, - typeDefList); + remoteConnection); registryEvent.setEventOriginator(eventOriginator); @@ -337,7 +334,6 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @param originatorOrganizationName - name of the organization that owns the server that sent the event. * @param registrationTimestamp - the time that the server/repository first registered with the cohort. * @param remoteConnection - the Connection properties for the connector used to call the registering server. - * @param typeDefList - the list of TypeDefs supported by the registering server/repository. */ public boolean processReRegistrationEvent(String sourceName, String metadataCollectionId, @@ -345,8 +341,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, - Connection remoteConnection, - List<TypeDefSummary> typeDefList) + Connection remoteConnection) { OMRSEventOriginator eventOriginator = new OMRSEventOriginator(); @@ -357,8 +352,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD OMRSRegistryEvent registryEvent = new OMRSRegistryEvent(OMRSRegistryEventType.RE_REGISTRATION_EVENT, registrationTimestamp, - remoteConnection, - typeDefList); + remoteConnection); registryEvent.setEventOriginator(eventOriginator); @@ -557,7 +551,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @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 typeDefPatch - details of the new versionName of the TypeDef + * @param typeDefPatch - details of the new version of the TypeDef */ public void processUpdatedTypeDefEvent(String sourceName, String originatorMetadataCollectionId, @@ -829,9 +823,9 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD /** - * A TypeDef from another member in the cohort is at a different versionName than the local repository. This may + * A TypeDef from another member in the cohort is at a different version than the local repository. This may * create some inconsistencies in the different copies of instances of this type in different members of the - * cohort. The recommended action is to update all TypeDefs to the latest versionName. + * cohort. The recommended action is to update all TypeDefs to the latest version. * * @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. @@ -922,7 +916,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @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 entity - details of the new version of the entity. */ public void processUpdatedEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -958,7 +952,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @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 entity - details of the version of the entity that has been restored. */ public void processUndoneEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -1188,7 +1182,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @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 entity - details of the version of the entity that has been restored. */ public void processRestoredEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -1459,7 +1453,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @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 relationship - details of the new version of the relationship. */ public void processUpdatedRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -1494,7 +1488,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @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 relationship - details of the version of the relationship that has been restored. */ public void processUndoneRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -1611,7 +1605,7 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD * @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 relationship - details of the version of the relationship that has been restored. */ public void processRestoredRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -1914,8 +1908,8 @@ public class OMRSEventPublisher implements OMRSRegistryEventProcessor, OMRSTypeD /** - * 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. + * An open metadata repository has detected an inconsistency in the version of the type used in an updated metadata + * instance compared to its stored version. * * @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. http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSRepositoryEventManager.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSRepositoryEventManager.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSRepositoryEventManager.java index ae2b31c..2deeddb 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSRepositoryEventManager.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/OMRSRepositoryEventManager.java @@ -60,6 +60,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * Constructor to initialize a repository event manager * * @param exchangeRule - this is the rule that determines which events are processed. + * @param repositoryValidator - validator class for checking open metadata repository objects and parameters. */ public OMRSRepositoryEventManager(OMRSRepositoryEventExchangeRule exchangeRule, OMRSRepositoryValidator repositoryValidator) @@ -210,7 +211,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * @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 typeDefPatch - details of the new versionName of the TypeDef + * @param typeDefPatch - details of the new version of the TypeDef */ public void processUpdatedTypeDefEvent(String sourceName, String originatorMetadataCollectionId, @@ -471,9 +472,9 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor } /** - * A TypeDef from another member in the cohort is at a different versionName than the local repository. This may + * A TypeDef from another member in the cohort is at a different version than the local repository. This may * create some inconsistencies in the different copies of instances of this type in different members of the - * cohort. The recommended action is to update all TypeDefs to the latest versionName. + * cohort. The recommended action is to update all TypeDefs to the latest version. * * @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. @@ -563,7 +564,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * @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 entity - details of the new version of the entity. */ public void processUpdatedEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -600,7 +601,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * @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 entity - details of the version of the entity that has been restored. */ public void processUndoneEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -838,7 +839,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * @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 entity - details of the version of the entity that has been restored. */ public void processRestoredEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -1122,7 +1123,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * @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 relationship - details of the new version of the relationship. */ public void processUpdatedRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -1158,7 +1159,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * @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 relationship - details of the version of the relationship that has been restored. */ public void processUndoneRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -1282,7 +1283,7 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor * @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 relationship - details of the version of the relationship that has been restored. */ public void processRestoredRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -1584,8 +1585,8 @@ public class OMRSRepositoryEventManager implements OMRSRepositoryEventProcessor /** - * 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. + * An open metadata repository has detected an inconsistency in the version of the type used in an updated metadata + * instance compared to its stored version. * * @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. http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSEventOriginator.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSEventOriginator.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSEventOriginator.java index a4c8193..6a7d0d3 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSEventOriginator.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSEventOriginator.java @@ -40,7 +40,7 @@ package org.apache.atlas.omrs.eventmanagement.events; * of business partners then it may be their respective company names. This is an optional field. * </li> * <li> - * ProtocolVersion - this is an enumeration that identifies which versionName of the OMRS event structure + * ProtocolVersion - this is an enumeration that identifies which version of the OMRS event structure * should be used. In general it should be set to the highest level that all servers in the cohort * can support. * </li> http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEvent.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEvent.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEvent.java index 8ed3e61..0cdfa26 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEvent.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEvent.java @@ -215,7 +215,7 @@ public class OMRSInstanceEvent extends OMRSEvent * @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 other TypeDef */ public OMRSInstanceEvent(OMRSInstanceEventErrorCode errorCode, String errorMessage, @@ -371,7 +371,7 @@ public class OMRSInstanceEvent extends OMRSEvent /** - * Return the original versionName for this instance's TypeDef. This is used if the type for the + * Return the original version for this instance's TypeDef. This is used if the type for the * instance has been changed to resolve a conflict or to allow a change in the TypeDef Gallery. * * @return details of the original TypeDef http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEventErrorCode.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEventErrorCode.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEventErrorCode.java index 7691839..6c4fbfa 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEventErrorCode.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSInstanceEventErrorCode.java @@ -38,7 +38,7 @@ public enum OMRSInstanceEventErrorCode " have different types.", OMRSEventErrorCode.CONFLICTING_INSTANCES), CONFLICTING_TYPE (2, "Conflicting Type Version", - "An instance can not be processed because there is a mismatch in the type definition (TypeDef) versionName.", + "An instance can not be processed because there is a mismatch in the type definition (TypeDef) version.", OMRSEventErrorCode.CONFLICTING_TYPE), UNKNOWN_ERROR_CODE (99, "Unknown Error Code", "Unrecognized error code from incoming event.", http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEvent.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEvent.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEvent.java index 0f9b515..9650219 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEvent.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEvent.java @@ -58,11 +58,6 @@ public class OMRSRegistryEvent extends OMRSEvent private Connection remoteConnection = null; /* - * Used in the registration process to enable the repositories to detect incompatible TypeDefs. - */ - private List<TypeDefSummary> typeDefSummaries = null; - - /* * Specific variables only used in error reporting. It defines the subset of error codes from OMRSEvent * that are specific to registry events. */ @@ -89,7 +84,6 @@ public class OMRSRegistryEvent extends OMRSEvent this.registryEventType = registrySection.getRegistryEventType(); this.registrationTimestamp = registrySection.getRegistrationTimestamp(); this.remoteConnection = registrySection.getRemoteConnection(); - this.typeDefSummaries = registrySection.getTypeDefList(); } if (super.genericErrorCode != null) @@ -118,19 +112,16 @@ public class OMRSRegistryEvent extends OMRSEvent * @param registryEventType - type of event (REGISTRATION_EVENT, REFRESH_REGISTRATION_REQUEST, RE_REGISTRATION_EVENT) * @param registrationTimestamp - time that the local repository registered. * @param remoteConnection - remote connection to this local repository. - * @param typeDefSummaries - Summary list of supported TypeDefs */ public OMRSRegistryEvent(OMRSRegistryEventType registryEventType, Date registrationTimestamp, - Connection remoteConnection, - List<TypeDefSummary> typeDefSummaries) + Connection remoteConnection) { super(OMRSEventCategory.REGISTRY); this.registryEventType = registryEventType; this.registrationTimestamp = registrationTimestamp; this.remoteConnection = remoteConnection; - this.typeDefSummaries = typeDefSummaries; } @@ -209,19 +200,6 @@ public class OMRSRegistryEvent extends OMRSEvent /** - * Return the list of TypeDef summaries included in the event. - * If this is a normal registry event then these TypeDefs are from the local repository. - * If this an error event, then these TypeDefs are from the targeted repository. - * - * @return TypeDefSummaries object - */ - public List<TypeDefSummary> getTypeDefSummaries() - { - return typeDefSummaries; - } - - - /** * Return the error code for the event. This property is only used for error events. * * @return OMRSRegistryEventErrorCode enum @@ -246,7 +224,6 @@ public class OMRSRegistryEvent extends OMRSEvent registrySection.setRegistryEventType(this.registryEventType); registrySection.setRegistrationTimestamp(this.registrationTimestamp); registrySection.setRemoteConnection(this.remoteConnection); - registrySection.setTypeDefList(this.typeDefSummaries); omrsEvent.setRegistryEventSection(registrySection); @@ -266,7 +243,6 @@ public class OMRSRegistryEvent extends OMRSEvent "registryEventType=" + registryEventType + ", registrationTimestamp=" + registrationTimestamp + ", remoteConnection=" + remoteConnection + - ", typeDefSummaries=" + typeDefSummaries + ", errorCode=" + errorCode + ", eventTimestamp=" + eventTimestamp + ", eventDirection=" + eventDirection + http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEventProcessor.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEventProcessor.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEventProcessor.java index 620c6b3..27e6059 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEventProcessor.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSRegistryEventProcessor.java @@ -19,11 +19,8 @@ package org.apache.atlas.omrs.eventmanagement.events; import org.apache.atlas.ocf.properties.beans.Connection; -import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary; -import java.util.ArrayList; import java.util.Date; -import java.util.List; /** * OMRSRegistryEventProcessor is an interface implemented by a component that is able to process @@ -42,7 +39,6 @@ public interface OMRSRegistryEventProcessor * @param originatorOrganizationName - name of the organization that owns the server that sent the event. * @param registrationTimestamp - the time that the server/repository issued the registration request. * @param remoteConnection - the Connection properties for the connector used to call the registering server. - * @param typeDefList - the list of TypeDefs supported by the registering server/repository. * @return flag indicating if the event was sent or not. */ boolean processRegistrationEvent(String sourceName, @@ -51,8 +47,7 @@ public interface OMRSRegistryEventProcessor String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, - Connection remoteConnection, - List<TypeDefSummary> typeDefList); + Connection remoteConnection); /** @@ -82,7 +77,6 @@ public interface OMRSRegistryEventProcessor * @param originatorOrganizationName - name of the organization that owns the server that sent the event. * @param registrationTimestamp - the time that the server/repository first registered with the cohort. * @param remoteConnection - the Connection properties for the connector used to call the registering server. - * @param typeDefList - the list of TypeDefs supported by the registering server/repository. * @return flag indicating if the event was sent or not. */ boolean processReRegistrationEvent(String sourceName, @@ -91,8 +85,7 @@ public interface OMRSRegistryEventProcessor String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, - Connection remoteConnection, - List<TypeDefSummary> typeDefList); + Connection remoteConnection); /** http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSTypeDefEventType.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSTypeDefEventType.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSTypeDefEventType.java index e1db23d..e04fbe4 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSTypeDefEventType.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/OMRSTypeDefEventType.java @@ -43,7 +43,7 @@ package org.apache.atlas.omrs.eventmanagement.events; */ public enum OMRSTypeDefEventType { - UNKNOWN_TYPEDEF_EVENT (0, "UnknownTypeDefEvent", "An TypeDef event that is not recognized by the local server."), + UNKNOWN_TYPEDEF_EVENT (0, "UnknownTypeDefEvent", "A TypeDef event that is not recognized by the local server."), NEW_TYPEDEF_EVENT (1, "NewTypeDef", "A new TypeDef has been defined."), NEW_ATTRIBUTE_TYPEDEF_EVENT (2, "NewAttributeTypeDef", "A new AttributeTypeDef has been defined."), UPDATED_TYPEDEF_EVENT (3, "UpdatedTypeDef", "An existing TypeDef has been updated."), http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1.java index 8d20042..26345a6 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1.java @@ -33,7 +33,7 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; /** - * OMRSEventV1 is the OMRSEvent payload for versionName 1 of the open metadata and governance message exchange. + * OMRSEventV1 is the OMRSEvent payload for version 1 of the open metadata and governance message exchange. */ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1RegistrySection.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1RegistrySection.java b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1RegistrySection.java index 91da30c..2878404 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1RegistrySection.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/eventmanagement/events/v1/OMRSEventV1RegistrySection.java @@ -45,7 +45,7 @@ public class OMRSEventV1RegistrySection implements Serializable private OMRSRegistryEventType registryEventType = null; private Date registrationTimestamp = null; private Connection remoteConnection = null; - private ArrayList<TypeDefSummary> typeDefList = null; + public OMRSEventV1RegistrySection() { @@ -80,28 +80,4 @@ public class OMRSEventV1RegistrySection implements Serializable { this.remoteConnection = remoteConnection; } - - public List<TypeDefSummary> getTypeDefList() - { - if (typeDefList == null) - { - return null; - } - else - { - return new ArrayList<>(typeDefList); - } - } - - public void setTypeDefList(List<TypeDefSummary> typeDefList) - { - if (typeDefList == null) - { - this.typeDefList = null; - } - else - { - this.typeDefList = new ArrayList<>(typeDefList); - } - } } http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/ffdc/OMRSErrorCode.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/ffdc/OMRSErrorCode.java b/omrs/src/main/java/org/apache/atlas/omrs/ffdc/OMRSErrorCode.java index 185311a..351c910 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/ffdc/OMRSErrorCode.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/ffdc/OMRSErrorCode.java @@ -248,6 +248,36 @@ public enum OMRSErrorCode "A null TypeDef patch has been passed on the {0} operation of repository {1} ", "The system is unable to perform the request because it needs the patch to process the update.", "Correct the caller's code and retry the request."), + NEGATIVE_PAGE_SIZE(400, "OMRS-REPOSITORY-400-050 ", + "A negative pageSize of {0} has been passed on the {0} parameter of a {1} request to open metadata repository {2}", + "The system is unable to process the request.", + "The pageSize parameter is supplied by the caller to the API. This call needs to be corrected before the server will operate correctly."), + ENTITY_PROXY_ONLY(400, "OMRS-REPOSITORY-400-051 ", + "A request for entity {0} has been passed to repository {1} as the {2} parameter of the {3} operation but only an entity proxy has been found", + "The system is unable to return all of the details of the entity. It can only supply an entity summary.", + "The fact that the system has a proxy means that the entity exists in one of the members of the connected cohorts. " + + "The repository where it is located may be unavailable, or the entity has been deleted " + + "but the delete request has not propagated through to this repository."), + INVALID_ENTITY_FROM_STORE(400, "OMRS-REPOSITORY-400-052 ", + "The entity {0} retrieved from repository {1} during the {2} operation has invalid contents: {3}", + "The system is unable continue processing the request.", + "This error suggests there is a logic error in either this repository, or the home repository for the instance. Raise a Jira to get this fixed."), + INVALID_RELATIONSHIP_FROM_STORE(400, "OMRS-REPOSITORY-400-053 ", + "The relationship {0} retrieved from repository {1} during the {2} operation has invalid contents: {3}", + "The system is unable continue processing the request.", + "This error suggests there is a logic error in either this repository, or the home repository for the instance. Raise a Jira to get this fixed."), + NULL_INSTANCE_METADATA_COLLECTION_ID(400, "OMRS-REPOSITORY-400-054 ", + "The instance {0} retrieved from repository {1} during the {2} operation has a null metadata collection id in its header: {3}", + "The system is unable continue processing the request.", + "This error suggests there is a logic error in either this repository, or the home repository for the instance. Raise a Jira to get this fixed."), + UNEXPECTED_EXCEPTION_FROM_COHORT(400, "OMRS-REPOSITORY-400-055 ", + "An unexpected exception was received from a repository connector during the {0} operation which had message: {1}", + "The system is unable continue processing the request.", + "This error suggests there is a logic error in either this repository, or the home repository for the instance. Raise a Jira to get this fixed."), + NO_HOME_FOR_INSTANCE(400, "OMRS-REPOSITORY-400-055 ", + "The OMRS repository connector operation {0} from the OMRS Enterprise Repository Services can not locate the home repository connector for instance {1} located in metadata collection {2}", + "The system is unable continue processing the request.", + "This error suggests there is a logic error in either this repository, or the home repository for the instance. Raise a Jira to get this fixed."), NULL_USER_NAME(400, "OMRS-REST-API-400-001 ", "The OMRS REST API for server {0} has been called with a null user name (userId)", "The system is unable to access the local metadata repository.", @@ -369,6 +399,10 @@ public enum OMRSErrorCode "A request for a type from category {0} passed a null name.", "The build of the archive terminates.", "Verify the definition of the elements being added to the archive. Once the definitions have been corrected, rerun the request."), + NULL_LOG_RECORD(400, "OMRS-AUDITLOG-400-001 ", + "A null log record has been passed by the audit log to the audit log store.", + "The audit log store throws an exception and the log record is not written to the audit log store.", + "This is probably an internal error in the audit log. Raise a jira to get this fixed."), REPOSITORY_NOT_AVAILABLE(404, "OMRS-REPOSITORY-404-001 ", "The open metadata repository connector for server {0} is not active and is unable to service the {1} request", "The system is unable to retrieve any metadata properties from this repository.", @@ -548,7 +582,7 @@ public enum OMRSErrorCode "(a subclass of MetadataCollectionBase) does not have a complete implementation.", "Raise a Jira to get this fixed."), NO_REPOSITORIES(503, "OMRS-ENTERPRISE-REPOSITORY-503-001 ", - "There are no open metadata repositories available for this server.", + "There are no open metadata repositories available for access service {0}.", "The configuration for the server is set up so there is no local repository and no remote repositories " + "connected through the open metadata repository cohorts. " + "This may because of one or more configuration errors.", @@ -578,11 +612,15 @@ public enum OMRSErrorCode "The root cause of this error is recorded in previous exceptions.", "Review the other error messages to determine the source of the error. When these are resolved, retry the request."), VALIDATION_LOGIC_ERROR(503, "OMRS-LOCAL-REPOSITORY-503-005 ", - "An OMRS repository connector {0} has passed an invalid parameter to the repository validator {1} operation as part of the {2} request", - "The repository connector has called the repository validator operations in the wrong order or has a similar logic error.", + "An OMRS repository connector or access service {0} has passed an invalid parameter to the repository validator {1} operation as part of the {2} request", + "The open metadata component has called the repository validator operations in the wrong order or has a similar logic error.", + "Raise a Jira to get this fixed."), + HELPER_LOGIC_ERROR(503, "OMRS-LOCAL-REPOSITORY-503-006 ", + "An OMRS repository connector {0} has passed an invalid parameter to the repository helper {1} operation as part of the {2} request", + "The open metadata component has called the repository helper operations in the wrong order or has a similar logic error.", "Raise a Jira to get this fixed."), NULL_CLASSIFICATION_CREATED(503, "OMRS-LOCAL-REPOSITORY-503-006 ", - "An OMRS repository connector {0} has passed a null classification to the repository helper {1} operation as part of the {2} request", + "An OMRS repository connector or access server {0} has passed a null classification to the repository helper {1} operation as part of the {2} request", "The repository connector has called the repository helper operations in the wrong order or has a similar logic error.", "Raise a Jira to get this fixed."), NO_LOCAL_REPOSITORY(503, "OMRS-REST-API-503-001 ", http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/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 fe144ed..b7526a8 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 @@ -99,7 +99,17 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess if (realLocalConnector != null) { - this.realMetadataCollection = realLocalConnector.getMetadataCollection(); + try + { + this.realMetadataCollection = realLocalConnector.getMetadataCollection(); + } + catch (Throwable error) + { + /* + * Nothing to do - will be logged in verifyEventProcessor + */ + this.realMetadataCollection = null; + } } this.verifyEventProcessor(methodName); @@ -159,7 +169,7 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess * @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 entity - details of the new version of the entity. */ public void processUpdatedEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -190,7 +200,7 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess * @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 entity - details of the version of the entity that has been restored. */ public void processUndoneEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -390,7 +400,7 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess * @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 entity - details of the version of the entity that has been restored. */ public void processRestoredEntityEvent(String sourceName, String originatorMetadataCollectionId, @@ -644,7 +654,7 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess * @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 relationship - details of the new version of the relationship. */ public void processUpdatedRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -675,7 +685,7 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess * @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 relationship - details of the version of the relationship that has been restored. */ public void processUndoneRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -779,7 +789,7 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess * @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 relationship - details of the version of the relationship that has been restored. */ public void processRestoredRelationshipEvent(String sourceName, String originatorMetadataCollectionId, @@ -1034,8 +1044,8 @@ 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. + * An open metadata repository has detected an inconsistency in the version of the type used in an updated metadata + * instance compared to its stored version. * * @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. @@ -1421,6 +1431,19 @@ public class LocalOMRSInstanceEventProcessor implements OMRSInstanceEventProcess errorCode.getUserAction()); } + if (realMetadataCollection == null) + { + OMRSErrorCode errorCode = OMRSErrorCode.NULL_LOCAL_METADATA_COLLECTION; + String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(); + + throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(), + this.getClass().getName(), + methodName, + errorMessage, + errorCode.getSystemAction(), + errorCode.getUserAction()); + } + if (repositoryHelper ==null) { OMRSErrorCode errorCode = OMRSErrorCode.NULL_REPOSITORY_HELPER;