http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java index 45e7398..9c6ece7 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityDetail.java @@ -110,7 +110,7 @@ public class EntityDetail extends EntitySummary ", updatedBy='" + getUpdatedBy() + '\'' + ", createTime=" + getCreateTime() + ", updateTime=" + getUpdateTime() + - ", versionName=" + getVersion() + + ", version=" + getVersion() + ", statusOnDelete=" + getStatusOnDelete() + '}'; }
http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java index 9bb3a91..9277e27 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntityProxy.java @@ -121,7 +121,7 @@ public class EntityProxy extends EntitySummary ", updatedBy='" + getUpdatedBy() + '\'' + ", createTime=" + getCreateTime() + ", updateTime=" + getUpdateTime() + - ", versionName=" + getVersion() + + ", version=" + getVersion() + ", statusOnDelete=" + getStatusOnDelete() + '}'; } http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java index 408279c..f1d5459 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/EntitySummary.java @@ -128,7 +128,7 @@ public class EntitySummary extends InstanceHeader ", updatedBy='" + getUpdatedBy() + '\'' + ", createTime=" + getCreateTime() + ", updateTime=" + getUpdateTime() + - ", versionName=" + getVersion() + + ", version=" + getVersion() + ", statusOnDelete=" + getStatusOnDelete() + '}'; } http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java index 0940795..4203fcf 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceAuditHeader.java @@ -222,15 +222,15 @@ public abstract class InstanceAuditHeader extends InstanceElementHeader /** * Return the version number for this instance. * - * @return Long versionName number + * @return Long version number */ public long getVersion() { return version; } /** - * Set up the versionName number for this instance. + * Set up the version number for this instance. * - * @param version - Long versionName number + * @param version - Long version number */ public void setVersion(long version) { this.version = version; } @@ -268,7 +268,7 @@ public abstract class InstanceAuditHeader extends InstanceElementHeader ", updatedBy='" + updatedBy + '\'' + ", createTime=" + createTime + ", updateTime=" + updateTime + - ", versionName=" + version + + ", version=" + version + ", statusOnDelete=" + statusOnDelete + '}'; } http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java index 1a62baf..8d1cac6 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceHeader.java @@ -174,7 +174,7 @@ public abstract class InstanceHeader extends InstanceAuditHeader ", updatedBy='" + updatedBy + '\'' + ", createTime=" + createTime + ", updateTime=" + updateTime + - ", versionName=" + version + + ", version=" + version + ", statusOnDelete=" + statusOnDelete + ", GUID='" + getGUID() + '\'' + '}'; http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java index 2964f14..352f227 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceProperties.java @@ -115,6 +115,27 @@ public class InstanceProperties extends InstanceElementHeader /** + * Return the instance properties as a map. + * + * @return instance properties map. + */ + public Map<String, InstancePropertyValue> getInstanceProperties() + { + return instanceProperties; + } + + + /** + * Set up the instance properties map. + * + * @param instanceProperties - map of name valued properties + */ + public void setInstanceProperties(Map<String, InstancePropertyValue> instanceProperties) + { + this.instanceProperties = instanceProperties; + } + + /** * Returns a list of the instance properties for the element. * If no stored properties are present then null is returned. * http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.java index 27e82c8..8562436 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstancePropertyValue.java @@ -17,9 +17,7 @@ */ package org.apache.atlas.omrs.metadatacollection.properties.instances; -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.*; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; @@ -30,6 +28,17 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = ArrayPropertyValue.class, name = "ArrayPropertyValue"), + @JsonSubTypes.Type(value = EnumPropertyValue.class, name = "EnumPropertyValue"), + @JsonSubTypes.Type(value = MapPropertyValue.class, name = "MapPropertyValue"), + @JsonSubTypes.Type(value = PrimitivePropertyValue.class, name = "PrimitivePropertyValue"), + @JsonSubTypes.Type(value = StructPropertyValue.class, name = "StructPropertyValue") +}) public class InstancePropertyValue extends InstanceElementHeader { /* @@ -41,7 +50,14 @@ public class InstancePropertyValue extends InstanceElementHeader /** - * Default constructor initializes the instance property value to nulls. + * Default constructor for Jackson + */ + public InstancePropertyValue() + { + } + + /** + * Typical constructor initializes the instance property value to nulls. * * @param instancePropertyCategory - InstancePropertyCategory Enum */ http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java index 26a7510..5f8144c 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/InstanceType.java @@ -43,9 +43,9 @@ public class InstanceType extends InstanceElementHeader private long typeDefVersion = 0L; private String typeDefDescription = null; private String typeDefDescriptionGUID = null; - private ArrayList<TypeDefLink> typeDefSuperTypes = null; - private ArrayList<InstanceStatus> validStatusList = null; - private ArrayList<String> validInstanceProperties = null; + private List<TypeDefLink> typeDefSuperTypes = null; + private List<InstanceStatus> validStatusList = null; + private List<String> validInstanceProperties = null; /** * Default constructor relies on initialization of variables in the declaration. @@ -175,7 +175,7 @@ public class InstanceType extends InstanceElementHeader /** - * Set up the versionName for the TypeDef. + * Set up the version for the TypeDef. * * @param typeDefVersion - long version number */ http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java index 9a27f33..14923e4 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/instances/Relationship.java @@ -323,7 +323,7 @@ public class Relationship extends InstanceHeader ", updatedBy='" + getUpdatedBy() + '\'' + ", createTime=" + getCreateTime() + ", updateTime=" + getUpdateTime() + - ", versionName=" + getVersion() + + ", version=" + getVersion() + ", statusOnDelete=" + getStatusOnDelete() + '}'; } http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java index b0490e9..a314335 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/AttributeTypeDef.java @@ -18,9 +18,7 @@ package org.apache.atlas.omrs.metadatacollection.properties.typedefs; -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.*; import java.util.Objects; @@ -38,6 +36,15 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = PrimitiveDef.class, name = "PrimitiveDef"), + @JsonSubTypes.Type(value = CollectionDef.class, name = "CollectionDef"), + @JsonSubTypes.Type(value = EnumDef.class, name = "EnumDef"), +}) public class AttributeTypeDef extends TypeDefElementHeader { protected long version = 0L; http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java index 566bc59..c5f6960 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/ClassificationDef.java @@ -58,7 +58,7 @@ public class ClassificationDef extends TypeDef * @param guid - unique id for the TypeDef * @param name - unique name for the TypeDef * @param version - active version number for the TypeDef - * @param versionName - unique name for the TypeDef + * @param versionName - name for active version of the TypeDef */ public ClassificationDef(TypeDefCategory category, String guid, http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java index 6bf068d..a9447ca 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/EntityDef.java @@ -49,7 +49,7 @@ public class EntityDef extends TypeDef * @param guid - unique id for the TypeDef * @param name - unique name for the TypeDef * @param version - active version number for the TypeDef - * @param versionName - unique name for the TypeDef + * @param versionName - name for the active version of the TypeDef */ public EntityDef(TypeDefCategory category, String guid, http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java index b6b5387..f5adf92 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/PrimitiveDefCategory.java @@ -37,7 +37,7 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ @JsonIgnoreProperties(ignoreUnknown=true) public enum PrimitiveDefCategory implements Serializable { - OM_PRIMITIVE_TYPE_UNKNOWN (0, "<>", "java.lang.Object", "1c4b21f4-0b67-41a7-a6ed-2af185eb9b3b"), + OM_PRIMITIVE_TYPE_UNKNOWN (0, "object", "java.lang.Object", "1c4b21f4-0b67-41a7-a6ed-2af185eb9b3b"), OM_PRIMITIVE_TYPE_BOOLEAN (1, "boolean", "java.lang.Boolean", "3863f010-611c-41fe-aaae-5d4d427f863b"), OM_PRIMITIVE_TYPE_BYTE (2, "byte", "java.lang.Byte", "6b7d410a-2e8a-4d12-981a-a806449f9bdb"), OM_PRIMITIVE_TYPE_CHAR (3, "char", "java.Lang.Char", "b0abebe5-cf85-4065-86ad-f3c6360ed9c7"), http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java index f706752..12eca22 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/RelationshipDef.java @@ -59,7 +59,7 @@ public class RelationshipDef extends TypeDef * @param guid - unique id for the TypeDef * @param name - unique name for the TypeDef * @param version - active version number for the TypeDef - * @param versionName - unique name for the TypeDef + * @param versionName - name for the active version of the TypeDef */ public RelationshipDef(TypeDefCategory category, String guid, http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java index 2191944..2bb4ee7 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDef.java @@ -17,10 +17,8 @@ */ package org.apache.atlas.omrs.metadatacollection.properties.typedefs; -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceStatus; +import com.fasterxml.jackson.annotation.*; +import org.apache.atlas.omrs.metadatacollection.properties.instances.*; import java.util.ArrayList; import java.util.Date; @@ -39,6 +37,15 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type") +@JsonSubTypes({ + @JsonSubTypes.Type(value = EntityDef.class, name = "EntityDef"), + @JsonSubTypes.Type(value = RelationshipDef.class, name = "RelationshipDef"), + @JsonSubTypes.Type(value = ClassificationDef.class, name = "ClassificationDef"), +}) public class TypeDef extends TypeDefSummary { protected TypeDefLink superType = null; @@ -84,7 +91,7 @@ public class TypeDef extends TypeDefSummary * @param guid - unique id for the TypeDef * @param name - unique name for the TypeDef * @param version - active version number for the TypeDef - * @param versionName - unique name for the TypeDef + * @param versionName - name for the active version of the TypeDef */ public TypeDef(TypeDefCategory category, String guid, http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefPatch.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefPatch.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefPatch.java index a9144ba..9ba9192 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefPatch.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefPatch.java @@ -159,7 +159,7 @@ public class TypeDefPatch extends TypeDefElementHeader /** - * Set up the new versionName of the TypeDef. + * Set up the new version of the TypeDef. * * @param updateToVersion long version number */ @@ -387,7 +387,7 @@ public class TypeDefPatch extends TypeDefElementHeader } /** - * Validated that the GUID, name and versionName of a TypeDef are equal. + * Validated that the GUID, name and version of a TypeDef are equal. * * @param object to test * @return boolean flag to say object is the same TypeDefPatch http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefSummary.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefSummary.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefSummary.java index 9958da6..8a81e82 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefSummary.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/properties/typedefs/TypeDefSummary.java @@ -55,7 +55,7 @@ public class TypeDefSummary extends TypeDefLink * @param guid - unique id for the TypeDef * @param name - unique name for the TypeDef * @param version - active version number for the TypeDef - * @param versionName - unique name for the TypeDef + * @param versionName - active version name for the TypeDef */ public TypeDefSummary(TypeDefCategory category, String guid, http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSMetadataCollectionManager.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSMetadataCollectionManager.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSMetadataCollectionManager.java index 1407666..e77c62d 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSMetadataCollectionManager.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSMetadataCollectionManager.java @@ -17,6 +17,7 @@ */ package org.apache.atlas.omrs.metadatacollection.repositoryconnector; +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; @@ -47,11 +48,27 @@ public interface OMRSMetadataCollectionManager /** - * Set up the maximum PageSize + * Return the name of the repository where the metadata collection resides. * - * @param maxPageSize - maximum number of elements that can be retrieved on a request. + * @return String name */ - void setMaxPageSize(int maxPageSize); + String getRepositoryName(); + + + /** + * Set up the name of the repository where the metadata collection resides. + * + * @param repositoryName - String name + */ + void setRepositoryName(String repositoryName); + + + /** + * Return the name of the server where the metadata collection resides. + * + * @return String name + */ + String getServerName(); /** @@ -63,6 +80,15 @@ public interface OMRSMetadataCollectionManager /** + * Return the descriptive string describing the type of the server. This might be the + * name of the product, or similar identifier. + * + * @return String name + */ + String getServerType(); + + + /** * Set up the descriptive string describing the type of the server. This might be the * name of the product, or similar identifier. * @@ -72,7 +98,15 @@ public interface OMRSMetadataCollectionManager /** - * Set up the name of the organization that runs/owns the server. + * Return the name of the organization that runs/owns the server used to access the repository. + * + * @return String name + */ + String getOrganizationName(); + + + /** + * Set up the name of the organization that runs/owns the server used to access the repository. * * @param organizationName - String organization name */ @@ -80,6 +114,30 @@ public interface OMRSMetadataCollectionManager /** + * Return the maximum PageSize + * + * @return maximum number of elements that can be retrieved on a request. + */ + int getMaxPageSize(); + + + /** + * Set up the maximum PageSize + * + * @param maxPageSize - maximum number of elements that can be retrieved on a request. + */ + void setMaxPageSize(int maxPageSize); + + + /** + * Return the unique Id for this metadata collection. + * + * @return String unique Id + */ + String getMetadataCollectionId(); + + + /** * Set up the unique Id for this metadata collection. * * @param metadataCollectionId - String unique Id @@ -92,6 +150,7 @@ public interface OMRSMetadataCollectionManager * a metadata repository. * * @return OMRSMetadataCollection - metadata TypeDefs and instances retrieved from the metadata repository. + * @throws RepositoryErrorException - no metadata collection */ - OMRSMetadataCollection getMetadataCollection(); + OMRSMetadataCollection getMetadataCollection() throws RepositoryErrorException; } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSRepositoryConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSRepositoryConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSRepositoryConnector.java index 2d0f3b2..bcf9917 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSRepositoryConnector.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatacollection/repositoryconnector/OMRSRepositoryConnector.java @@ -19,7 +19,6 @@ package org.apache.atlas.omrs.metadatacollection.repositoryconnector; import org.apache.atlas.ocf.ConnectorBase; import org.apache.atlas.omrs.ffdc.OMRSErrorCode; -import org.apache.atlas.omrs.ffdc.exception.OMRSLogicErrorException; import org.apache.atlas.omrs.ffdc.exception.RepositoryErrorException; import org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryHelper; import org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSRepositoryValidator; @@ -34,6 +33,7 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O { protected OMRSRepositoryHelper repositoryHelper = null; protected OMRSRepositoryValidator repositoryValidator = null; + protected String repositoryName = null; protected String serverName = null; protected String serverType = null; protected String organizationName = null; @@ -54,7 +54,7 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** * Set up a repository helper object for the repository connector to use. * - * @param repositoryHelper - helper object for building TypeDefs and metadata instances. + * @param repositoryHelper - helper object for building and querying TypeDefs and metadata instances. */ public void setRepositoryHelper(OMRSRepositoryHelper repositoryHelper) { @@ -63,6 +63,17 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** + * Return the repository helper for this connector. + * + * @return helper object for building and querying TypeDefs and metadata instances. + */ + public OMRSRepositoryHelper getRepositoryHelper() + { + return repositoryHelper; + } + + + /** * Set up a repository validator for the repository connector to use. * * @param repositoryValidator - validator object to check the validity of TypeDefs and metadata instances. @@ -74,6 +85,47 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** + * Return the repository validator for this connector. + * + * @return validator object to check the validity of TypeDefs and metadata instances. + */ + public OMRSRepositoryValidator getRepositoryValidator() + { + return repositoryValidator; + } + + + /** + * Return the name of the repository where the metadata collection resides. + * + * @return String name + */ + public String getRepositoryName() + { + return this.repositoryName; + } + + + /** + * Set up the name of the repository where the metadata collection resides. + * + * @param repositoryName - String name + */ + public void setRepositoryName(String repositoryName) + { + this.repositoryName = repositoryName; + } + + + /** + * Return the name of the server where the metadata collection resides. + * + * @return String name + */ + public String getServerName() { return serverName; } + + + /** * Set up the name of the server where the metadata collection resides. * * @param serverName - String name @@ -85,6 +137,15 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** + * Return the descriptive string describing the type of the server. This might be the + * name of the product, or similar identifier. + * + * @return String name + */ + public String getServerType() { return serverType; } + + + /** * Set up the descriptive string describing the type of the server. This might be the * name of the product, or similar identifier. * @@ -97,7 +158,15 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** - * Set up the name of the organization that runs/owns the server. + * Return the name of the organization that runs/owns the server used to access the repository. + * + * @return String name + */ + public String getOrganizationName() { return organizationName; } + + + /** + * Set up the name of the organization that runs/owns the server used to access the repository. * * @param organizationName - String organization name */ @@ -108,6 +177,17 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** + * Return the unique Id for this metadata collection. + * + * @return String unique Id + */ + public String getMetadataCollectionId() + { + return this.metadataCollectionId; + } + + + /** * Set up the unique Id for this metadata collection. * * @param metadataCollectionId - String unique Id @@ -119,6 +199,17 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** + * Return the maximum PageSize + * + * @return maximum number of elements that can be retrieved on a request. + */ + public int getMaxPageSize() + { + return this.maxPageSize; + } + + + /** * Set up the maximum PageSize * * @param maxPageSize - maximum number of elements that can be retrieved on a request. @@ -132,6 +223,7 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O /** * Throw a RepositoryErrorException if the connector is not active. * + * @param methodName - name of calling method * @throws RepositoryErrorException repository connector has not started or has been disconnected. */ public void validateRepositoryIsActive(String methodName) throws RepositoryErrorException @@ -157,8 +249,9 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O * a metadata repository. * * @return OMRSMetadataCollection - metadata information retrieved from the metadata repository. + ** @throws RepositoryErrorException - no metadata collection */ - public OMRSMetadataCollection getMetadataCollection() + public OMRSMetadataCollection getMetadataCollection() throws RepositoryErrorException { if (metadataCollection == null) { @@ -168,12 +261,12 @@ public abstract class OMRSRepositoryConnector extends ConnectorBase implements O String errorMessage = errorCode.getErrorMessageId() + errorCode.getFormattedErrorMessage(serverName); - throw new OMRSLogicErrorException(errorCode.getHTTPErrorCode(), - this.getClass().getName(), - methodName, - errorMessage, - errorCode.getSystemAction(), - errorCode.getUserAction()); + throw new RepositoryErrorException(errorCode.getHTTPErrorCode(), + this.getClass().getName(), + methodName, + errorMessage, + errorCode.getSystemAction(), + errorCode.getUserAction()); } return metadataCollection; http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/OMRSCohortManager.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/OMRSCohortManager.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/OMRSCohortManager.java index e643653..50dfe7a 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/OMRSCohortManager.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/OMRSCohortManager.java @@ -161,7 +161,6 @@ public class OMRSCohortManager localOrganizationName, outboundRegistryEventProcessor, cohortRegistryStore, - localRepository.getTypeDefValidator(), connectionConsumer); localRepositoryEventManager = localRepository.getOutboundRepositoryEventManager(); @@ -210,7 +209,6 @@ public class OMRSCohortManager localOrganizationName, outboundRegistryEventProcessor, null, - null, connectionConsumer); } @@ -244,6 +242,7 @@ public class OMRSCohortManager this.cohortRepositoryEventManager, this.cohortRepositoryEventManager); cohortTopicConnector.registerListener(cohortEventListener); + cohortTopicConnector.start(); this.cohortTopicConnector = cohortTopicConnector; this.cohortEventListener = cohortEventListener; @@ -259,7 +258,15 @@ public class OMRSCohortManager catch (Throwable error) { this.cohortConnectionStatus = CohortConnectionStatus.CONFIGURATION_ERROR; - throw error; + + OMRSAuditCode auditCode = OMRSAuditCode.COHORT_CONFIG_ERROR; + auditLog.logRecord(actionDescription, + auditCode.getLogMessageId(), + auditCode.getSeverity(), + auditCode.getFormattedLogMessage(cohortName, error.getMessage()), + null, + auditCode.getSystemAction(), + auditCode.getUserAction()); } if (log.isDebugEnabled()) http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/OMRSCohortRegistry.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/OMRSCohortRegistry.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/OMRSCohortRegistry.java index 26a0dbc..d6c14bd 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/OMRSCohortRegistry.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/OMRSCohortRegistry.java @@ -27,15 +27,12 @@ import org.apache.atlas.omrs.metadatahighway.cohortregistry.store.OMRSCohortRegi import org.apache.atlas.omrs.metadatahighway.cohortregistry.store.properties.MemberRegistration; import org.apache.atlas.omrs.ffdc.exception.OMRSConfigErrorException; import org.apache.atlas.omrs.ffdc.exception.OMRSLogicErrorException; -import org.apache.atlas.omrs.localrepository.repositorycontentmanager.OMRSTypeDefValidator; import org.apache.atlas.omrs.enterprise.connectormanager.OMRSConnectionConsumer; import org.apache.atlas.omrs.ffdc.OMRSErrorCode; import org.apache.atlas.omrs.ffdc.exception.OMRSRuntimeException; -import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -53,11 +50,7 @@ import java.util.List; * in the cohort registry store to use for server restart. * </li> * <li> - * Interacting with the Local OMRS Connector and repository to verify that the type definitions - * (TypeDefs) used by other servers in the cohort are compatible with the local TypeDefs. - * </li> - * <li> - * Configuring the federation services (OMRS Federation Manager and Enterprise OMRS Connector) with + * Configuring the federation services (OMRS Connection Manager and Enterprise OMRS Connector) with * information about the other servers in the cohort as they register and unregister from the * cohort. * </li> @@ -97,12 +90,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor private OMRSConnectionConsumer connectionConsumer = null; /* - * The typeDef manager provides the cohort registry with details of the TypeDefs supported by the local - * and also validates the compatibility of TypeDefs from other members of the open metadata repository cohort. - */ - private OMRSTypeDefValidator typeDefValidator = null; - - /* * The audit log provides a verifiable record of the membership of the open metadata repository cohort and the * metadata exchange activity they are involved in. The Logger is for standard debug. */ @@ -217,8 +204,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor * It is a descriptive name for informational purposes. * @param registryEventProcessor - used to send outbound registry events to the cohort. * @param cohortRegistryStore - the cohort registry store where details of members of the cohort are kept. - * @param typeDefValidator - TypeDef validator is used to validate typedefs across membership of the open - * metadata repository cohort. If it is null then no TypeDef validation occurs. * @param connectionConsumer - The connection consumer is a component interested in maintaining details of the * connections to each of the members of the open metadata repository cohort. If it is * null, the cohort registry does not publish connections for members of the open @@ -232,7 +217,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor String localOrganizationName, OMRSRegistryEventProcessor registryEventProcessor, OMRSCohortRegistryStore cohortRegistryStore, - OMRSTypeDefValidator typeDefValidator, OMRSConnectionConsumer connectionConsumer) { String actionDescription = "Initialize cohort registry"; @@ -273,13 +257,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor this.localMetadataCollectionId = localMetadataCollectionId; /* - * Save the TypeDef validator. This object is able to generate the list of TypeDef - * summaries supported by this repository and validate the TypeDef summaries received - * from the remote members of the open metadata repository cluster. - */ - this.typeDefValidator = typeDefValidator; - - /* * Save the connection consumer. This component needs details of the current connections it should use * to contact various members of the cluster (including the local server). It needs an initial * upload of the members's connections and then ongoing notifications for any changes in the membership. @@ -493,21 +470,13 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor auditCode.getSystemAction(), auditCode.getUserAction()); - ArrayList<TypeDefSummary> typeDefSummaries = null; - - if (typeDefValidator != null) - { - typeDefSummaries = typeDefValidator.getLocalTypeDefs(); - } - return outboundRegistryEventProcessor.processRegistrationEvent(cohortName, localRegistration.getMetadataCollectionId(), localRegistration.getServerName(), localRegistration.getServerType(), localRegistration.getOrganizationName(), localRegistration.getRegistrationTime(), - localRegistration.getRepositoryConnection(), - typeDefSummaries); + localRegistration.getRepositoryConnection()); } @@ -684,7 +653,6 @@ public class OMRSCohortRegistry implements 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. */ public boolean processRegistrationEvent(String sourceName, String originatorMetadataCollectionId, @@ -692,8 +660,7 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, - Connection remoteConnection, - List<TypeDefSummary> typeDefList) + Connection remoteConnection) { final String actionDescription = "Receiving Registration event"; @@ -736,15 +703,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor auditCode.getSystemAction(), auditCode.getUserAction()); - /* - * Check for incompatible TypeDefs occurring between this local repository and the new member. - * Incompatible TypeDefs are logged and managed by the typeDefValidator. - */ - if ((typeDefValidator != null) && (typeDefList != null)) - { - typeDefValidator.validateAgainstLocalTypeDefs(sourceName, typeDefList); - } - return true; } else @@ -776,13 +734,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor if (localRegistration != null) { - ArrayList<TypeDefSummary> typeDefSummaries = null; - - if (typeDefValidator != null) - { - typeDefSummaries = typeDefValidator.getLocalTypeDefs(); - } - OMRSAuditCode auditCode = OMRSAuditCode.REFRESHING_REGISTRATION_WITH_COHORT; auditLog.logRecord(actionDescription, auditCode.getLogMessageId(), @@ -800,8 +751,7 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor localRegistration.getServerType(), localRegistration.getOrganizationName(), localRegistration.getRegistrationTime(), - localRegistration.getRepositoryConnection(), - typeDefSummaries); + localRegistration.getRepositoryConnection()); } else { @@ -836,7 +786,6 @@ public class OMRSCohortRegistry implements 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. */ public boolean processReRegistrationEvent(String sourceName, String originatorMetadataCollectionId, @@ -844,8 +793,7 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor String originatorServerType, String originatorOrganizationName, Date registrationTimestamp, - Connection remoteConnection, - List<TypeDefSummary> typeDefList) + Connection remoteConnection) { final String actionDescription = "Receiving ReRegistration event"; @@ -890,15 +838,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor auditCode.getSystemAction(), auditCode.getUserAction()); - /* - * Check for incompatible TypeDefs occurring between this local repository and the new member. - * The TypeDefManager will drive any error handling. - */ - if ((typeDefValidator != null) && (typeDefList != null)) - { - typeDefValidator.validateAgainstLocalTypeDefs(sourceName, typeDefList); - } - return true; } else @@ -1099,7 +1038,6 @@ public class OMRSCohortRegistry implements OMRSRegistryEventProcessor ", registryStore=" + registryStore + ", outboundRegistryEventProcessor=" + outboundRegistryEventProcessor + ", connectionConsumer=" + connectionConsumer + - ", typeDefValidator=" + typeDefValidator + '}'; } } http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java index 0372e29..ad48dbd 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/metadatahighway/cohortregistry/store/properties/CohortMembership.java @@ -40,7 +40,7 @@ public class CohortMembership implements Serializable private static final long serialVersionUID = 1L; private MemberRegistration localRegistration = null; - private ArrayList<MemberRegistration> remoteRegistrations = null; + private List<MemberRegistration> remoteRegistrations = null; /** * Default constructor http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/BooleanResponse.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/BooleanResponse.java b/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/BooleanResponse.java index 4c3807b..288a0a4 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/BooleanResponse.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/BooleanResponse.java @@ -33,7 +33,7 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ @JsonIgnoreProperties(ignoreUnknown=true) public class BooleanResponse extends OMRSRESTAPIResponse { - boolean flag = false; + private boolean flag = false; /** http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIPagedResponse.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIPagedResponse.java b/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIPagedResponse.java index f070a6c..b5b9086 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIPagedResponse.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIPagedResponse.java @@ -105,7 +105,7 @@ public class OMRSRESTAPIPagedResponse extends OMRSRESTAPIResponse /** * Set up the maximum number of elements that can be returned on this request. * - * @param pageSize + * @param pageSize - integer number */ public void setPageSize(int pageSize) { http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIResponse.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIResponse.java b/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIResponse.java index da244df..80f66d6 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIResponse.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/rest/properties/OMRSRESTAPIResponse.java @@ -33,7 +33,7 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ @JsonIgnoreProperties(ignoreUnknown=true) public abstract class OMRSRESTAPIResponse { - protected int relatedHTTPCode = 0; + protected int relatedHTTPCode = 200; protected String exceptionClassName = null; protected String exceptionErrorMessage = null; protected String exceptionSystemAction = null; http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java index 3aa1330..d790e6c 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTMetadataCollection.java @@ -47,21 +47,20 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection { static final private String defaultRepositoryName = "REST-connected Repository "; - private OMRSRESTRepositoryConnector parentConnector; /* Initialized in constructor */ - private String metadataCollectionId; /* Initialized in constructor */ - private OMRSRepositoryHelper repositoryHelper; /* Initialized in constructor */ - private OMRSRepositoryValidator repositoryValidator; /* Initialized in constructor */ - private String repositoryName; /* Initialized in constructor */ - private String restURLRoot; /* Initialized in constructor */ + private String restURLRoot; /* Initialized in constructor */ /** * Default constructor. * * @param parentConnector - connector that this metadata collection supports. The connector has the information * to call the metadata repository. + * @param repositoryName - name of the repository - used for logging. + * @param repositoryHelper - class used to build type definitions and instances. + * @param repositoryValidator - class used to validate type definitions and instances. * @param metadataCollectionId - unique identifier for the metadata collection */ public OMRSRESTMetadataCollection(OMRSRESTRepositoryConnector parentConnector, + String repositoryName, OMRSRepositoryHelper repositoryHelper, OMRSRepositoryValidator repositoryValidator, String metadataCollectionId) @@ -69,21 +68,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection /* * The metadata collection Id is the unique Id for the metadata collection. It is managed by the super class. */ - super(metadataCollectionId); - this.metadataCollectionId = metadataCollectionId; - - /* - * Save parentConnector since this has the connection information and access to the metadata about the - * metadata cluster. - */ - this.parentConnector = parentConnector; - - /* - * Save the repository helper and validator as they reduce the implementation effort of the metadata - * collection. - */ - this.repositoryHelper = repositoryHelper; - this.repositoryValidator = repositoryValidator; + super(parentConnector, repositoryName, metadataCollectionId, repositoryHelper, repositoryValidator); /* * The name of the repository comes from the connection @@ -101,7 +86,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection } } - this.repositoryName = defaultRepositoryName + endpointAddress; + super.repositoryName = defaultRepositoryName + endpointAddress; this.restURLRoot = endpointAddress; } @@ -123,7 +108,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection final String methodName = "getMetadataCollectionId"; final String urlTemplate = "metadata-collection-id"; - String restResult = ""; + String restResult = null; try { @@ -175,7 +160,8 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection { OMRSErrorCode errorCode = OMRSErrorCode.NULL_METADATA_COLLECTION_ID; String errorMessage = errorCode.getErrorMessageId() - + errorCode.getFormattedErrorMessage(repositoryName, super.metadataCollectionId); + + errorCode.getFormattedErrorMessage(repositoryName, + super.metadataCollectionId); throw new RepositoryErrorException(errorCode.getHTTPErrorCode(), this.getClass().getName(), @@ -403,7 +389,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection UserNotAuthorizedException { final String methodName = "searchForTypeDefs"; - final String urlTemplate = "{0}/types/typedefs/by-search-criteria?searchCriteria={1}"; + final String urlTemplate = "{0}/types/typedefs/by-property-value?searchCriteria={1}"; TypeDefListResponse restResult = this.callTypeDefListGetRESTCall(methodName, restURLRoot + urlTemplate, @@ -1119,11 +1105,11 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection /** - * Return a historical versionName of an entity - includes the header, classifications and properties of the entity. + * Return a historical version of an entity - includes the header, classifications and properties of the entity. * * @param userId - unique identifier for requesting user. * @param guid - String unique identifier for the entity. - * @param asOfTime - the time used to determine which versionName of the entity that is desired. + * @param asOfTime - the time used to determine which version of the entity that is desired. * @return EntityDetail structure. * @throws InvalidParameterException - the guid or date is null, or the asOfTime property is for a future time * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where @@ -1401,10 +1387,14 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection /** - * Return a list of entities matching the search criteria. + * Return a list of entities whose string based property values match the search criteria. The + * search criteria may include regex style wild cards. * * @param userId - unique identifier for requesting user. - * @param searchCriteria - String expression of the characteristics of the required relationships. + * @param entityTypeGUID - GUID of the type of entity to search for. Null means all types will + * be searched (could be slow so not recommended). + * @param searchCriteria - String expression contained in any of the property values within the entities + * of the supplied type. * @param fromEntityElement - the starting element number of the entities to return. * This is used when retrieving elements * beyond the first page of results. Zero means start from the first element. @@ -1429,27 +1419,29 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support the asOfTime parameter. * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation. */ - public List<EntityDetail> searchForEntities(String userId, - String searchCriteria, - int fromEntityElement, - List<InstanceStatus> limitResultsByStatus, - List<String> limitResultsByClassification, - Date asOfTime, - String sequencingProperty, - SequencingOrder sequencingOrder, - int pageSize) throws InvalidParameterException, - RepositoryErrorException, - PropertyErrorException, - PagingErrorException, - FunctionNotSupportedException, - UserNotAuthorizedException + public List<EntityDetail> findEntitiesByPropertyValue(String userId, + String entityTypeGUID, + String searchCriteria, + int fromEntityElement, + List<InstanceStatus> limitResultsByStatus, + List<String> limitResultsByClassification, + Date asOfTime, + String sequencingProperty, + SequencingOrder sequencingOrder, + int pageSize) throws InvalidParameterException, + RepositoryErrorException, + PropertyErrorException, + PagingErrorException, + FunctionNotSupportedException, + UserNotAuthorizedException { - final String methodName = "searchForEntities"; - final String urlTemplate = "{0}/instances/entities/by-search-criteria?searchCriteria={1}?fromEntityElement={2}&limitResultsByStatus={3}&limitResultsByClassification={4}&asOfTime={5}&sequencingProperty={6}&sequencingOrder={7}&pageSize={8}"; + final String methodName = "findEntitiesByPropertyValue"; + final String urlTemplate = "{0}/instances/entities/by-property-value?entityTypeGUID={1}&searchCriteria={2}?fromEntityElement={3}&limitResultsByStatus={4}&limitResultsByClassification={5}&asOfTime={6}&sequencingProperty={7}&sequencingOrder={8}&pageSize={9}"; EntityListResponse restResult = this.callEntityListGetRESTCall(methodName, restURLRoot + urlTemplate, userId, + entityTypeGUID, searchCriteria, fromEntityElement, limitResultsByStatus, @@ -1543,7 +1535,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * * @param userId - unique identifier for requesting user. * @param guid - String unique identifier for the relationship. - * @param asOfTime - the time used to determine which versionName of the entity that is desired. + * @param asOfTime - the time used to determine which version of the entity that is desired. * @return Relationship structure. * @throws InvalidParameterException - the guid or date is null or the asOfTime property is for a future time. * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where @@ -1658,10 +1650,14 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection /** - * Return a list of relationships that match the search criteria. The results can be paged. + * Return a list of relationships whose string based property values match the search criteria. The + * search criteria may include regex style wild cards. * * @param userId - unique identifier for requesting user. - * @param searchCriteria - String expression of the characteristics of the required relationships. + * @param relationshipTypeGUID - GUID of the type of entity to search for. Null means all types will + * be searched (could be slow so not recommended). + * @param searchCriteria - String expression contained in any of the property values within the entities + * of the supplied type. * @param fromRelationshipElement - Element number of the results to skip to when building the results list * to return. Zero means begin at the start of the results. This is used * to retrieve the results over a number of pages. @@ -1684,26 +1680,28 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support the asOfTime parameter. * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation. */ - public List<Relationship> searchForRelationships(String userId, - String searchCriteria, - int fromRelationshipElement, - List<InstanceStatus> limitResultsByStatus, - Date asOfTime, - String sequencingProperty, - SequencingOrder sequencingOrder, - int pageSize) throws InvalidParameterException, - RepositoryErrorException, - PropertyErrorException, - PagingErrorException, - FunctionNotSupportedException, - UserNotAuthorizedException + public List<Relationship> findRelationshipsByPropertyValue(String userId, + String relationshipTypeGUID, + String searchCriteria, + int fromRelationshipElement, + List<InstanceStatus> limitResultsByStatus, + Date asOfTime, + String sequencingProperty, + SequencingOrder sequencingOrder, + int pageSize) throws InvalidParameterException, + RepositoryErrorException, + PropertyErrorException, + PagingErrorException, + FunctionNotSupportedException, + UserNotAuthorizedException { - final String methodName = "searchForRelationships"; - final String urlTemplate = "{0}/instances/relationships/by-search-criteria?searchCriteria={1}?fromRelationshipElement={2}&limitResultsByStatus={3}&asOfTime={4}&sequencingProperty={5}&sequencingOrder={6}&pageSize={7}"; + final String methodName = "findRelationshipsByPropertyValue"; + final String urlTemplate = "{0}/instances/relationships/by-property-value?relationshipTypeGUID={1}&searchCriteria={2}&fromRelationshipElement={3}&limitResultsByStatus={4}&asOfTime={5}&sequencingProperty={6}&sequencingOrder={7}&pageSize={8}"; RelationshipListResponse restResult = this.callRelationshipListGetRESTCall(methodName, restURLRoot + urlTemplate, userId, + relationshipTypeGUID, searchCriteria, fromRelationshipElement, limitResultsByStatus, @@ -3068,7 +3066,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * Save the entity as a reference copy. The id of the home metadata collection is already set up in the * entity. * - * @param serverName - unique identifier for requesting server. + * @param userId - unique identifier for requesting server. * @param entity - details of the entity to save. * @throws InvalidParameterException - the entity is null. * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where @@ -3084,7 +3082,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support reference copies of instances. * @throws UserNotAuthorizedException - the userId is not permitted to perform this operation. */ - public void saveEntityReferenceCopy(String serverName, + public void saveEntityReferenceCopy(String userId, EntityDetail entity) throws InvalidParameterException, RepositoryErrorException, TypeErrorException, @@ -3100,7 +3098,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection VoidResponse restResult = this.callVoidPatchRESTCall(methodName, restURLRoot + urlTemplate, - serverName, + userId, entity); this.detectAndThrowFunctionNotSupportedException(methodName, restResult); @@ -3120,7 +3118,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * remove reference copies from the local cohort, repositories that have left the cohort, * or entities that have come from open metadata archives. * - * @param serverName - unique identifier for requesting server. + * @param userId - unique identifier for requesting server. * @param entityGUID - the unique identifier for the entity. * @param typeDefGUID - the guid of the TypeDef for the relationship - used to verify the relationship identity. * @param typeDefName - the name of the TypeDef for the relationship - used to verify the relationship identity. @@ -3134,7 +3132,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support reference copies of instances. * @throws UserNotAuthorizedException - the serverName is not permitted to perform this operation. */ - public void purgeEntityReferenceCopy(String serverName, + public void purgeEntityReferenceCopy(String userId, String entityGUID, String typeDefGUID, String typeDefName, @@ -3150,7 +3148,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection VoidResponse restResult = this.callVoidPatchRESTCall(methodName, restURLRoot + urlTemplate, - serverName, + userId, entityGUID, typeDefGUID, typeDefName, @@ -3169,7 +3167,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * The local repository has requested that the repository that hosts the home metadata collection for the * specified entity sends out the details of this entity so the local repository can create a reference copy. * - * @param serverName - unique identifier for requesting server. + * @param userId - unique identifier for requesting server. * @param entityGUID - unique identifier of requested entity. * @param typeDefGUID - unique identifier of requested entity's TypeDef. * @param typeDefName - unique name of requested entity's TypeDef. @@ -3183,7 +3181,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support reference copies of instances. * @throws UserNotAuthorizedException - the serverName is not permitted to perform this operation. */ - public void refreshEntityReferenceCopy(String serverName, + public void refreshEntityReferenceCopy(String userId, String entityGUID, String typeDefGUID, String typeDefName, @@ -3199,7 +3197,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection VoidResponse restResult = this.callVoidPatchRESTCall(methodName, restURLRoot + urlTemplate, - serverName, + userId, entityGUID, typeDefGUID, typeDefName, @@ -3218,7 +3216,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * Save the relationship as a reference copy. The id of the home metadata collection is already set up in the * relationship. * - * @param serverName - unique identifier for requesting user. + * @param userId - unique identifier for requesting user. * @param relationship - relationship to save. * @throws InvalidParameterException - the relationship is null. * @throws RepositoryErrorException - there is a problem communicating with the metadata repository where @@ -3236,7 +3234,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support reference copies of instances. * @throws UserNotAuthorizedException - the serverName is not permitted to perform this operation. */ - public void saveRelationshipReferenceCopy(String serverName, + public void saveRelationshipReferenceCopy(String userId, Relationship relationship) throws InvalidParameterException, RepositoryErrorException, TypeErrorException, @@ -3253,7 +3251,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection VoidResponse restResult = this.callVoidPatchRESTCall(methodName, restURLRoot + urlTemplate, - serverName, + userId, relationship); this.detectAndThrowFunctionNotSupportedException(methodName, restResult); @@ -3274,7 +3272,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * remove reference copies from the local cohort, repositories that have left the cohort, * or relationships that have come from open metadata archives. * - * @param serverName - unique identifier for requesting user. + * @param userId - unique identifier for requesting user. * @param relationshipGUID - the unique identifier for the relationship. * @param typeDefGUID - the guid of the TypeDef for the relationship - used to verify the relationship identity. * @param typeDefName - the name of the TypeDef for the relationship - used to verify the relationship identity. @@ -3288,7 +3286,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support reference copies of instances. * @throws UserNotAuthorizedException - the serverName is not permitted to perform this operation. */ - public void purgeRelationshipReferenceCopy(String serverName, + public void purgeRelationshipReferenceCopy(String userId, String relationshipGUID, String typeDefGUID, String typeDefName, @@ -3304,7 +3302,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection VoidResponse restResult = this.callVoidPatchRESTCall(methodName, restURLRoot + urlTemplate, - serverName, + userId, relationshipGUID, typeDefGUID, typeDefName, @@ -3324,7 +3322,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * specified relationship sends out the details of this relationship so the local repository can create a * reference copy. * - * @param serverName - unique identifier for requesting user. + * @param userId - unique identifier for requesting user. * @param relationshipGUID - unique identifier of the relationship. * @param typeDefGUID - the guid of the TypeDef for the relationship - used to verify the relationship identity. * @param typeDefName - the name of the TypeDef for the relationship - used to verify the relationship identity. @@ -3338,7 +3336,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection * @throws FunctionNotSupportedException - the repository does not support reference copies of instances. * @throws UserNotAuthorizedException - the serverName is not permitted to perform this operation. */ - public void refreshRelationshipReferenceCopy(String serverName, + public void refreshRelationshipReferenceCopy(String userId, String relationshipGUID, String typeDefGUID, String typeDefName, @@ -3354,7 +3352,7 @@ public class OMRSRESTMetadataCollection extends OMRSMetadataCollection VoidResponse restResult = this.callVoidPatchRESTCall(methodName, restURLRoot + urlTemplate, - serverName, + userId, relationshipGUID, typeDefGUID, typeDefName, http://git-wip-us.apache.org/repos/asf/atlas/blob/f57fd7f0/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java ---------------------------------------------------------------------- diff --git a/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java index e77d716..7e1595f 100644 --- a/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java +++ b/omrs/src/main/java/org/apache/atlas/omrs/rest/repositoryconnector/OMRSRESTRepositoryConnector.java @@ -20,6 +20,7 @@ package org.apache.atlas.omrs.rest.repositoryconnector; import org.apache.atlas.ocf.ffdc.ConnectorCheckedException; import org.apache.atlas.omrs.ffdc.OMRSErrorCode; import org.apache.atlas.omrs.ffdc.exception.OMRSLogicErrorException; +import org.apache.atlas.omrs.ffdc.exception.RepositoryErrorException; import org.apache.atlas.omrs.metadatacollection.repositoryconnector.OMRSRepositoryConnector; import org.apache.atlas.omrs.metadatacollection.OMRSMetadataCollection; @@ -56,6 +57,7 @@ public class OMRSRESTRepositoryConnector extends OMRSRepositoryConnector * Initialize the metadata collection. */ metadataCollection = new OMRSRESTMetadataCollection(this, + super.repositoryName, repositoryHelper, repositoryValidator, metadataCollectionId); @@ -67,8 +69,9 @@ public class OMRSRESTRepositoryConnector extends OMRSRepositoryConnector * a metadata repository. * * @return OMRSMetadataCollection - metadata information retrieved from the metadata repository. + * @throws RepositoryErrorException - no metadata collection */ - public OMRSMetadataCollection getMetadataCollection() + public OMRSMetadataCollection getMetadataCollection() throws RepositoryErrorException { if (metadataCollection == null) {
