Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix archive load #6899

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content-packs/CocoBusinessSystemsArchive.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"class":"OpenMetadataArchive","archiveProperties":{"class":"OpenMetadataArchiveProperties","archiveGUID":"ac202586-4042-407b-ae51-8096dfda223e","archiveName":"Coco Pharmaceuticals Business Systems","archiveDescription":"The data flows from Coco Pharmaceuticals business systems to the data lake.","archiveType":"CONTENT_PACK","originatorName":"Egeria Project","originatorLicense":"Apache 2.0","creationDate":1661805846259,"dependsOnArchives":["bce3b0a0-662a-4f87-b8dc-844078a11a6e"]}}
{"class":"OpenMetadataArchive","archiveProperties":{"class":"OpenMetadataArchiveProperties","archiveGUID":"ac202586-4042-407b-ae51-8096dfda223e","archiveName":"Coco Pharmaceuticals Business Systems","archiveDescription":"The data flows from Coco Pharmaceuticals business systems to the data lake.","archiveType":"CONTENT_PACK","originatorName":"Egeria Project","originatorLicense":"Apache 2.0","creationDate":1663761361930,"dependsOnArchives":["bce3b0a0-662a-4f87-b8dc-844078a11a6e"]},"archiveInstanceStore":{"class":"OpenMetadataArchiveInstanceStore","entities":[{"class":"EntityDetail","headerVersion":1,"type":{"class":"InstanceType","headerVersion":1,"typeDefCategory":"ENTITY_DEF","typeDefGUID":"aa7c7884-32ce-4991-9c41-9778f1fec6aa","typeDefName":"SoftwareServer","typeDefVersion":2,"typeDefDescription":"Software services to support a runtime environment for applications and data stores.","typeDefSuperTypes":[{"headerVersion":1,"guid":"151e6dd1-54a0-4b7f-a072-85caa09d1dda","name":"ITInfrastructure","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"c19746ac-b3ec-49ce-af4b-83348fc55e07","name":"Infrastructure","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"896d14c2-7522-4f6c-8519-757711943fe6","name":"Asset","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"a32316b8-dc8c-48c5-b12b-71c1b2a080bf","name":"Referenceable","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"4e7761e8-3969-4627-8f40-bfe3cde85a1d","name":"OpenMetadataRoot","status":"ACTIVE_TYPEDEF"}],"validStatusList":["ACTIVE","DELETED"],"validInstanceProperties":["serverVersion","source","type","version","userId","deployedImplementationType","owner","ownerType","latestChange","zoneMembership","name","description","qualifiedName","additionalProperties"]},"instanceProvenanceType":"CONTENT_PACK","metadataCollectionId":"ac202586-4042-407b-ae51-8096dfda223e","createdBy":"Egeria Project","createTime":1663761361930,"version":1,"guid":"e6b9b3d7-3580-4f54-941c-eec822bf37b4","classifications":[{"class":"Classification","headerVersion":1,"type":{"class":"InstanceType","headerVersion":1,"typeDefCategory":"CLASSIFICATION_DEF","typeDefGUID":"a1c17a86-9fd3-40ca-bb9b-fe83c6981deb","typeDefName":"AssetZoneMembership","typeDefVersion":1,"typeDefDescription":"Defines the asset's membership of the governance zones.","validStatusList":["ACTIVE","DELETED"],"validInstanceProperties":["zoneMembership"]},"instanceProvenanceType":"CONTENT_PACK","metadataCollectionId":"ac202586-4042-407b-ae51-8096dfda223e","createdBy":"Egeria Project","createTime":1663761361930,"version":1,"name":"AssetZoneMembership","properties":{"class":"InstanceProperties","headerVersion":0,"instanceProperties":{"zoneMembership":{"class":"ArrayPropertyValue","headerVersion":0,"instancePropertyCategory":"ARRAY","arrayCount":2,"arrayValues":{"class":"InstanceProperties","headerVersion":0,"instanceProperties":{"0":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"business-systems"},"1":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"sustainability"}},"propertyCount":2,"propertyNames":["0","1"]}}},"propertyCount":1,"propertyNames":["zoneMembership"]},"status":"ACTIVE"}],"properties":{"class":"InstanceProperties","headerVersion":0,"instanceProperties":{"name":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","typeGUID":"b34a64b9-554a-42b1-8f8a-7d5c2339f9c4","typeName":"string","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"Procurement"},"description":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","typeGUID":"b34a64b9-554a-42b1-8f8a-7d5c2339f9c4","typeName":"string","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"Purchasing system for Coco Pharmaceuticals."},"qualifiedName":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","typeGUID":"b34a64b9-554a-42b1-8f8a-7d5c2339f9c4","typeName":"string","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"System:procurement"}},"propertyCount":3,"propertyNames":["qualifiedName","name","description"]},"status":"ACTIVE"},{"class":"EntityDetail","headerVersion":1,"type":{"class":"InstanceType","headerVersion":1,"typeDefCategory":"ENTITY_DEF","typeDefGUID":"aa7c7884-32ce-4991-9c41-9778f1fec6aa","typeDefName":"SoftwareServer","typeDefVersion":2,"typeDefDescription":"Software services to support a runtime environment for applications and data stores.","typeDefSuperTypes":[{"headerVersion":1,"guid":"151e6dd1-54a0-4b7f-a072-85caa09d1dda","name":"ITInfrastructure","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"c19746ac-b3ec-49ce-af4b-83348fc55e07","name":"Infrastructure","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"896d14c2-7522-4f6c-8519-757711943fe6","name":"Asset","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"a32316b8-dc8c-48c5-b12b-71c1b2a080bf","name":"Referenceable","status":"ACTIVE_TYPEDEF"},{"headerVersion":1,"guid":"4e7761e8-3969-4627-8f40-bfe3cde85a1d","name":"OpenMetadataRoot","status":"ACTIVE_TYPEDEF"}],"validStatusList":["ACTIVE","DELETED"],"validInstanceProperties":["serverVersion","source","type","version","userId","deployedImplementationType","owner","ownerType","latestChange","zoneMembership","name","description","qualifiedName","additionalProperties"]},"instanceProvenanceType":"CONTENT_PACK","metadataCollectionId":"ac202586-4042-407b-ae51-8096dfda223e","createdBy":"Egeria Project","createTime":1663761361930,"version":1,"guid":"fe84febd-7ece-461f-8918-f060ccf70ae1","classifications":[{"class":"Classification","headerVersion":1,"type":{"class":"InstanceType","headerVersion":1,"typeDefCategory":"CLASSIFICATION_DEF","typeDefGUID":"a1c17a86-9fd3-40ca-bb9b-fe83c6981deb","typeDefName":"AssetZoneMembership","typeDefVersion":1,"typeDefDescription":"Defines the asset's membership of the governance zones.","validStatusList":["ACTIVE","DELETED"],"validInstanceProperties":["zoneMembership"]},"instanceProvenanceType":"CONTENT_PACK","metadataCollectionId":"ac202586-4042-407b-ae51-8096dfda223e","createdBy":"Egeria Project","createTime":1663761361930,"version":1,"name":"AssetZoneMembership","properties":{"class":"InstanceProperties","headerVersion":0,"instanceProperties":{"zoneMembership":{"class":"ArrayPropertyValue","headerVersion":0,"instancePropertyCategory":"ARRAY","arrayCount":2,"arrayValues":{"class":"InstanceProperties","headerVersion":0,"instanceProperties":{"0":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"business-systems"},"1":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"sustainability"}},"propertyCount":2,"propertyNames":["0","1"]}}},"propertyCount":1,"propertyNames":["zoneMembership"]},"status":"ACTIVE"}],"properties":{"class":"InstanceProperties","headerVersion":0,"instanceProperties":{"name":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","typeGUID":"b34a64b9-554a-42b1-8f8a-7d5c2339f9c4","typeName":"string","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"Inventory"},"description":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","typeGUID":"b34a64b9-554a-42b1-8f8a-7d5c2339f9c4","typeName":"string","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"Inventory for raw materials and products produced across all sites."},"qualifiedName":{"class":"PrimitivePropertyValue","headerVersion":0,"instancePropertyCategory":"PRIMITIVE","typeGUID":"b34a64b9-554a-42b1-8f8a-7d5c2339f9c4","typeName":"string","primitiveDefCategory":"OM_PRIMITIVE_TYPE_STRING","primitiveValue":"System:inventory"}},"propertyCount":3,"propertyNames":["qualifiedName","name","description"]},"status":"ACTIVE"}]}}
2 changes: 1 addition & 1 deletion content-packs/CocoClinicalTrialsTemplatesArchive.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"class":"OpenMetadataArchive","archiveProperties":{"class":"OpenMetadataArchiveProperties","archiveGUID":"74a786b2-d6d7-401d-b8c1-7d798f752c55","archiveName":"Coco Pharmaceuticals Clinical Trials Templates","archiveDescription":"Templates for new assets relating to a clinical trial.","archiveType":"CONTENT_PACK","originatorName":"Egeria Project","originatorLicense":"Apache 2.0","creationDate":1661805845696,"dependsOnArchives":["bce3b0a0-662a-4f87-b8dc-844078a11a6e"]}}
{"class":"OpenMetadataArchive","archiveProperties":{"class":"OpenMetadataArchiveProperties","archiveGUID":"74a786b2-d6d7-401d-b8c1-7d798f752c55","archiveName":"Coco Pharmaceuticals Clinical Trials Templates","archiveDescription":"Templates for new assets relating to a clinical trial.","archiveType":"CONTENT_PACK","originatorName":"Egeria Project","originatorLicense":"Apache 2.0","creationDate":1663761361149,"dependsOnArchives":["bce3b0a0-662a-4f87-b8dc-844078a11a6e"]}}
2 changes: 1 addition & 1 deletion content-packs/CocoComboArchive.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoGovernanceEngineDefinitionsArchive.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoGovernanceProgramArchive.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoOrganizationArchive.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoSustainabilityArchive.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoTypesArchive.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

public class ConfigsResource
{
private OMAGServerAdminServices adminAPI = new OMAGServerAdminServices();
private final OMAGServerAdminServices adminAPI = new OMAGServerAdminServices();

/**
* Return all the server configuration documents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,6 @@ private void maintainAnchorGUIDInClassification(String targetGUID,
anchorsClassification = null;
}


/*
* This is an attempt to trap an intermittent error recorded in issue #4680.
*/
Expand Down Expand Up @@ -1760,25 +1759,22 @@ private void maintainAnchorGUIDInClassification(String targetGUID,

if (anchorsClassification == null)
{
if (anchorGUID != null)
{
repositoryHandler.classifyEntity(localServerUserId,
null,
null,
targetGUID,
null,
targetGUIDParameterName,
targetEntity.getType().getTypeDefName(),
OpenMetadataAPIMapper.ANCHORS_CLASSIFICATION_TYPE_GUID,
OpenMetadataAPIMapper.ANCHORS_CLASSIFICATION_TYPE_NAME,
ClassificationOrigin.ASSIGNED,
null,
anchorsProperties,
forLineage,
forDuplicateProcessing,
effectiveTime,
methodName);
}
repositoryHandler.classifyEntity(localServerUserId,
null,
null,
targetGUID,
null,
targetGUIDParameterName,
targetEntity.getType().getTypeDefName(),
OpenMetadataAPIMapper.ANCHORS_CLASSIFICATION_TYPE_GUID,
OpenMetadataAPIMapper.ANCHORS_CLASSIFICATION_TYPE_NAME,
ClassificationOrigin.ASSIGNED,
null,
anchorsProperties,
forLineage,
forDuplicateProcessing,
effectiveTime,
methodName);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.search.SearchClassifications;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.search.SearchProperties;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper;
import org.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -297,7 +298,7 @@ else if (errorHandler.validateIsLatestUpdate(existingClassification, peerClassif
/**
* Use the dates in the entities and return the one that was last updated most recently.
* If the dates are equal, then compare GUIDs in order to always retrieve the same entity (no matter
* which of the is the current and which is the new one).
* which of the entities is the current and which is the new one).
*
* @param currentEntity current entity
* @param newEntity next peer entity
Expand Down Expand Up @@ -1403,10 +1404,7 @@ public EntityDetail classifyEntity(String userId,
{
if (entityDetail == null)
{
/*
* This is to check that the entity is in an appropriate state to add the classification.
*/
entityDetail = this.getEntityByGUID(userId, entityGUID, entityGUIDParameterName, entityTypeName, forLineage, forDuplicateProcessing, effectiveTime, methodName);
entityDetail = this.getEntityByGUID(userId, entityGUID, entityGUIDParameterName, entityTypeName, forLineage, forDuplicateProcessing, effectiveTime, methodName);
}

// create a proxy representation to allow classification of entities incoming from other metadata collections
Expand Down Expand Up @@ -1450,6 +1448,71 @@ public EntityDetail classifyEntity(String userId,
{
errorHandler.handleUnauthorizedUser(userId, methodName);
}
catch (ClassificationErrorException error)
{
/*
* There was a problem adding the classification. It probably means that another thread/server
* is simultaneously adding the same classification to the same element.
* The example that caused this code to be added was the attachment of Anchors classifications
* to new entities being processed by multiple event listener threads from the OMASs.
*/
try
{
entityDetail = this.getEntityByGUID(userId, entityGUID, entityGUIDParameterName, entityTypeName, forLineage, forDuplicateProcessing,
effectiveTime, methodName);

if (entityDetail.getClassifications() != null)
{
for (Classification classification : entityDetail.getClassifications())
{
if (classificationTypeName.equals(classification.getName()))
{
/*
* The same classification is already present on the entity.
* This means two threads were updating the same classification on the same entity
* at the same time.
*/
if (classification.getProperties() == null)
{
if (properties == null)
{
/*
* No concern as the updates are identical.
*/
return entityDetail;
}
}
else
{
if (classification.getProperties().equals(properties))
{
/*
* No concern as the updates are identical.
*/
return entityDetail;
}
}

/*
* The change to the classification is incompatible with the conflicting
* change, so the appropriate exception is returned to the caller.
*/
errorHandler.handleRepositoryError(error, methodName, localMethodName);
}
}

errorHandler.handleRepositoryError(error, methodName, localMethodName);
}
else
{
errorHandler.handleRepositoryError(error, methodName, localMethodName);
}
}
catch (Exception nestedError)
{
errorHandler.handleRepositoryError(error, methodName, localMethodName);
}
}
catch (Exception error)
{
errorHandler.handleRepositoryError(error, methodName, localMethodName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ public enum OMRSErrorCode implements ExceptionMessageSet
"Type name {0} is invalid because it contains a blank character.",
"The archive build has ended.",
"Verify the definition of the types being added to the archive. Once the definitions are fixed, rerun the request."),
UNKNOWN_TYPENAME(400, "OMRS-ARCHIVE-BUILDER-400-013",
"The archive builder has been passed an unknown type name {0}.",
"There is an problem in the code that created the instance.",
"Identify the code that called the archive builder and correct the type name."),
NO_AUDIT_LOG_STORE(400, "OMRS-AUDIT-LOG-400-001",
"There are no Audit Log destinations configured for server {0}",
"The system is unable to support diagnostic and audit logging because it has not been configured with any audit log destinations.",
Expand Down Expand Up @@ -788,8 +792,7 @@ public enum OMRSErrorCode implements ExceptionMessageSet
UNKNOWN_TYPEDEF(500, "OMRS-CONTENT-MANAGER-500-005",
"The repository content manager has detected an unknown TypeDef {0} ({1}) from {2}. It was passed to method {3} via parameters {4} and {5}",
"There is an internal problem in the Open Metadata Repository Services (OMRS) code.",
"Raise a Github issue so this can be addressed"),

"Raise a Github issue so this can be addressed."),
ARCHIVE_UNAVAILABLE(500, "OMRS-OPEN-METADATA-ARCHIVE-500-001",
"The archive builder failed to initialize.",
"There is an internal error in the archive building process.",
Expand Down
Loading