ATLAS-1223 Type REST API v2 implementation (apoorvnaik via sumasai)
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/f8fe0945 Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/f8fe0945 Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/f8fe0945 Branch: refs/heads/master Commit: f8fe0945c9c99a6979c3acfa463e0796db50b42f Parents: 0d01f35 Author: Suma Shivaprasad <sumasai.shivapra...@gmail.com> Authored: Wed Oct 12 16:21:19 2016 -0700 Committer: Suma Shivaprasad <sumasai.shivapra...@gmail.com> Committed: Wed Oct 12 16:21:19 2016 -0700 ---------------------------------------------------------------------- .../org/apache/atlas/repository/Constants.java | 1 + intg/pom.xml | 2 +- .../org/apache/atlas/api/AtlasApiTypes.java | 104 ---- .../main/java/org/apache/atlas/model/PList.java | 3 + .../org/apache/atlas/model/SearchFilter.java | 7 + .../model/instance/AtlasClassification.java | 4 + .../atlas/model/instance/AtlasEntity.java | 4 + .../atlas/model/instance/AtlasObjectId.java | 4 + .../atlas/model/instance/AtlasStruct.java | 4 + .../atlas/model/typedef/AtlasBaseTypeDef.java | 5 +- .../model/typedef/AtlasClassificationDef.java | 13 +- .../atlas/model/typedef/AtlasEntityDef.java | 13 +- .../atlas/model/typedef/AtlasEnumDef.java | 13 +- .../atlas/model/typedef/AtlasStructDef.java | 13 +- .../atlas/model/typedef/AtlasTypesDef.java | 92 ++++ .../apache/atlas/store/AtlasTypeDefStore.java | 144 ++++++ .../apache/atlas/type/AtlasTypeRegistry.java | 74 +-- .../org/apache/atlas/type/AtlasTypeUtil.java | 78 +++ pom.xml | 2 + release-log.txt | 1 + repository/pom.xml | 5 + .../apache/atlas/RepositoryMetadataModule.java | 13 +- .../graph/AtlasClassificationDefStore.java | 56 +++ .../store/graph/AtlasEntityDefStore.java | 56 +++ .../store/graph/AtlasEnumDefStore.java | 56 +++ .../store/graph/AtlasStructDefStore.java | 56 +++ .../store/graph/AtlasTypeDefGraphStore.java | 451 ++++++++++++++++++ .../graph/v1/AtlasClassificationDefStoreV1.java | 363 ++++++++++++++ .../store/graph/v1/AtlasEntityDefStoreV1.java | 360 ++++++++++++++ .../store/graph/v1/AtlasEnumDefStoreV1.java | 390 +++++++++++++++ .../store/graph/v1/AtlasGraphUtilsV1.java | 189 ++++++++ .../store/graph/v1/AtlasStructDefStoreV1.java | 474 +++++++++++++++++++ .../graph/v1/AtlasTypeDefGraphStoreV1.java | 307 ++++++++++++ .../atlas/repository/util/FilterUtil.java | 105 ++++ .../org/apache/atlas/util/TypeDefSorter.java | 81 ++++ .../org/apache/atlas/web/rest/TypesREST.java | 259 +++++++--- .../atlas/web/rest/module/RestModule.java | 33 ++ webapp/src/main/webapp/WEB-INF/web.xml | 2 +- 38 files changed, 3611 insertions(+), 226 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/common/src/main/java/org/apache/atlas/repository/Constants.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/atlas/repository/Constants.java b/common/src/main/java/org/apache/atlas/repository/Constants.java index 66f5bb0..4a68317 100644 --- a/common/src/main/java/org/apache/atlas/repository/Constants.java +++ b/common/src/main/java/org/apache/atlas/repository/Constants.java @@ -88,4 +88,5 @@ public final class Constants { private Constants() { } + } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/pom.xml ---------------------------------------------------------------------- diff --git a/intg/pom.xml b/intg/pom.xml index ff3136d..3ac19cf 100644 --- a/intg/pom.xml +++ b/intg/pom.xml @@ -30,7 +30,7 @@ <packaging>jar</packaging> <properties> - <checkstyle.failOnViolation>true</checkstyle.failOnViolation> + <checkstyle.failOnViolation>false</checkstyle.failOnViolation> </properties> <dependencies> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/api/AtlasApiTypes.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/api/AtlasApiTypes.java b/intg/src/main/java/org/apache/atlas/api/AtlasApiTypes.java deleted file mode 100644 index 52a3585..0000000 --- a/intg/src/main/java/org/apache/atlas/api/AtlasApiTypes.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.api; - - -import org.apache.atlas.exception.AtlasBaseException; -import org.apache.atlas.model.SearchFilter; -import org.apache.atlas.model.typedef.AtlasClassificationDef; -import org.apache.atlas.model.typedef.AtlasClassificationDef.AtlasClassificationDefs; -import org.apache.atlas.model.typedef.AtlasEntityDef; -import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs; -import org.apache.atlas.model.typedef.AtlasEnumDef; -import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs; -import org.apache.atlas.model.typedef.AtlasStructDef; -import org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs; - -/** - * API to work with CRUD of Atlas types - enum/struct/classification/entity. - */ -public interface AtlasApiTypes { - AtlasEnumDef createEnumDef(AtlasEnumDef enumDef) throws AtlasBaseException; - - AtlasEnumDef getEnumDefByName(String name) throws AtlasBaseException; - - AtlasEnumDef getEnumDefByGuid(String guid) throws AtlasBaseException; - - AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef) throws AtlasBaseException; - - AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef) throws AtlasBaseException; - - void deleteEnumDefByName(String name) throws AtlasBaseException; - - void deleteEnumDefByGuid(String guid) throws AtlasBaseException; - - AtlasEnumDefs searchEnumDefs(SearchFilter filter) throws AtlasBaseException; - - - AtlasStructDef createStructDef(AtlasStructDef structDef) throws AtlasBaseException; - - AtlasStructDef getStructDefByName(String name) throws AtlasBaseException; - - AtlasStructDef getStructDefByGuid(String guid) throws AtlasBaseException; - - AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef) throws AtlasBaseException; - - AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef) throws AtlasBaseException; - - void deleteStructDefByName(String name) throws AtlasBaseException; - - void deleteStructDefByGuid(String guid) throws AtlasBaseException; - - AtlasStructDefs searchStructDefs(SearchFilter filter) throws AtlasBaseException; - - - AtlasClassificationDef createClassificationDef(AtlasClassificationDef classificationDef) throws AtlasBaseException; - - AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException; - - AtlasClassificationDef getClassificationDefByGuid(String guid) throws AtlasBaseException; - - AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef) - throws AtlasBaseException; - - AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef) - throws AtlasBaseException; - - void deleteClassificationDefByName(String name) throws AtlasBaseException; - - void deleteClassificationDefByGuid(String guid) throws AtlasBaseException; - - AtlasClassificationDefs searchClassificationDefs(SearchFilter filter) throws AtlasBaseException; - - - AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasBaseException; - - AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException; - - AtlasEntityDef getEntityDefByIdByGuid(String guid) throws AtlasBaseException; - - AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef) throws AtlasBaseException; - - AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef) throws AtlasBaseException; - - void deleteEntityDef(String name) throws AtlasBaseException; - - void deleteEntityDefByGuid(String guid) throws AtlasBaseException; - - AtlasEntityDefs searchEntityDefs(SearchFilter filter) throws AtlasBaseException; -} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/PList.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/PList.java b/intg/src/main/java/org/apache/atlas/model/PList.java index a56b774..0e1722f 100644 --- a/intg/src/main/java/org/apache/atlas/model/PList.java +++ b/intg/src/main/java/org/apache/atlas/model/PList.java @@ -27,6 +27,8 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; import org.apache.atlas.model.SearchFilter.SortType; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; /** @@ -36,6 +38,7 @@ import javax.xml.bind.annotation.XmlRootElement; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class PList<T> implements java.io.Serializable { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/SearchFilter.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/SearchFilter.java b/intg/src/main/java/org/apache/atlas/model/SearchFilter.java index e35715f..64800a5 100644 --- a/intg/src/main/java/org/apache/atlas/model/SearchFilter.java +++ b/intg/src/main/java/org/apache/atlas/model/SearchFilter.java @@ -26,6 +26,8 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.map.annotate.JsonSerialize; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; /** @@ -35,7 +37,12 @@ import javax.xml.bind.annotation.XmlRootElement; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class SearchFilter { + public static final String PARAM_TYPE = "type"; + public static final String PARAM_SUPERTYPE = "supertype"; + public static final String PARAM_NOT_SUPERTYPE = "notSupertype"; + /** * to specify whether the result should be sorted? If yes, whether asc or desc. */ http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java index 31a03f1..bc48366 100644 --- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java +++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java @@ -21,6 +21,8 @@ import java.io.Serializable; import java.util.List; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -40,6 +42,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasClassification extends AtlasStruct implements Serializable { private static final long serialVersionUID = 1L; @@ -73,6 +76,7 @@ public class AtlasClassification extends AtlasStruct implements Serializable { @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasClassification.class) public static class AtlasClassifications extends PList<AtlasClassification> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java index 3a8d38b..6727f27 100644 --- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java +++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java @@ -22,6 +22,8 @@ import java.util.Date; import java.util.List; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -42,6 +44,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasEntity extends AtlasStruct implements Serializable { private static final long serialVersionUID = 1L; @@ -218,6 +221,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable { @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasEntity.class) public static class AtlasEntities extends PList<AtlasEntity> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/instance/AtlasObjectId.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasObjectId.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasObjectId.java index 087006c..5921fea 100644 --- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasObjectId.java +++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasObjectId.java @@ -21,6 +21,8 @@ import java.io.Serializable; import java.util.List; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -39,6 +41,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasObjectId implements Serializable { private static final long serialVersionUID = 1L; @@ -145,6 +148,7 @@ public class AtlasObjectId implements Serializable { @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasObjectId.class) public static class AtlasObjectIds extends PList<AtlasObjectId> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java b/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java index 017fb06..695f1bb 100644 --- a/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java +++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java @@ -26,6 +26,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -47,6 +49,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasStruct implements Serializable { private static final long serialVersionUID = 1L; @@ -170,6 +173,7 @@ public class AtlasStruct implements Serializable { @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasStruct.class) public static class AtlasStructs extends PList<AtlasStruct> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java index a3fdbcc..6f8fdcd 100644 --- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java @@ -23,6 +23,8 @@ import java.util.Collection; import java.util.Date; import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.collections.CollectionUtils; @@ -41,6 +43,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public abstract class AtlasBaseTypeDef implements java.io.Serializable { private static final long serialVersionUID = 1L; @@ -238,7 +241,7 @@ public abstract class AtlasBaseTypeDef implements java.io.Serializable { sb = new StringBuilder(); } - sb.append(", AtlasBaseTypeDef{"); + sb.append("AtlasBaseTypeDef{"); sb.append("guid='").append(guid).append('\''); sb.append(", createdBy='").append(createdBy).append('\''); sb.append(", updatedBy='").append(updatedBy).append('\''); http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java index 44d410f..c771a05 100644 --- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java @@ -17,11 +17,12 @@ */ package org.apache.atlas.model.typedef; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -42,6 +43,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasClassificationDef extends AtlasStructDef implements java.io.Serializable { private static final long serialVersionUID = 1L; @@ -94,9 +96,9 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se } if (CollectionUtils.isEmpty(superTypes)) { - this.superTypes = Collections.emptySet(); + this.superTypes = new HashSet<String>(); } else { - this.superTypes = Collections.unmodifiableSet(new HashSet<String>(superTypes)); + this.superTypes = new HashSet<String>(superTypes); } } @@ -112,7 +114,7 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se s.add(typeName); - this.superTypes = Collections.unmodifiableSet(s); + this.superTypes = s; } } @@ -124,7 +126,7 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se s.remove(typeName); - this.superTypes = Collections.unmodifiableSet(s); + this.superTypes = s; } } @@ -181,6 +183,7 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasClassificationDef.class) public static class AtlasClassificationDefs extends PList<AtlasClassificationDef> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java index 648d705..bb6d8a5 100644 --- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java @@ -17,11 +17,12 @@ */ package org.apache.atlas.model.typedef; -import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -42,6 +43,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializable { private static final long serialVersionUID = 1L; @@ -91,9 +93,9 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab } if (CollectionUtils.isEmpty(superTypes)) { - this.superTypes = Collections.emptySet(); + this.superTypes = new HashSet<String>(); } else { - this.superTypes = Collections.unmodifiableSet(new HashSet<String>(superTypes)); + this.superTypes = new HashSet<String>(superTypes); } } @@ -109,7 +111,7 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab s.add(typeName); - this.superTypes = Collections.unmodifiableSet(s); + this.superTypes = s; } } @@ -121,7 +123,7 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab s.remove(typeName); - this.superTypes = Collections.unmodifiableSet(s); + this.superTypes = s; } } @@ -178,6 +180,7 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasEntityDef.class) public static class AtlasEntityDefs extends PList<AtlasEntityDef> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java index b3b2d04..caaf01a 100644 --- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java @@ -20,6 +20,8 @@ package org.apache.atlas.model.typedef; import java.io.Serializable; import java.util.*; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -41,6 +43,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable { private static final long serialVersionUID = 1L; @@ -101,7 +104,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable { } if (CollectionUtils.isEmpty(elementDefs)) { - this.elementDefs = Collections.emptyList(); + this.elementDefs = new ArrayList<AtlasEnumElementDef>(); } else { // if multiple elements with same value are present, keep only the last entry List<AtlasEnumElementDef> tmpList = new ArrayList<AtlasEnumElementDef>(elementDefs.size()); @@ -124,7 +127,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable { } Collections.reverse(tmpList); - this.elementDefs = Collections.unmodifiableList(tmpList); + this.elementDefs = tmpList; } } @@ -154,7 +157,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable { } tmpList.add(new AtlasEnumElementDef(elementDef)); - this.elementDefs = Collections.unmodifiableList(tmpList); + this.elementDefs = tmpList; } public void removeElement(String elemValue) { @@ -171,7 +174,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable { } } - this.elementDefs = Collections.unmodifiableList(tmpList); + this.elementDefs = tmpList; } } @@ -247,6 +250,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable { @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) public static class AtlasEnumElementDef implements Serializable { private static final long serialVersionUID = 1L; @@ -348,6 +352,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable { @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasEnumDef.class) public static class AtlasEnumDefs extends PList<AtlasEnumDef> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java index 607d477..ebfd535 100644 --- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java @@ -25,6 +25,8 @@ import java.util.List; import java.util.ListIterator; import java.util.Set; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @@ -46,6 +48,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { private static final long serialVersionUID = 1L; @@ -91,7 +94,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { } if (CollectionUtils.isEmpty(attributeDefs)) { - this.attributeDefs = Collections.emptyList(); + this.attributeDefs = new ArrayList<AtlasAttributeDef>(); } else { // if multiple attributes with same name are present, keep only the last entry List<AtlasAttributeDef> tmpList = new ArrayList<AtlasAttributeDef>(attributeDefs.size()); @@ -114,7 +117,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { } Collections.reverse(tmpList); - this.attributeDefs = Collections.unmodifiableList(tmpList); + this.attributeDefs = tmpList; } } @@ -140,7 +143,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { } tmpList.add(new AtlasAttributeDef(attributeDef)); - this.attributeDefs = Collections.unmodifiableList(tmpList); + this.attributeDefs = tmpList; } public void removeAttribute(String attrName) { @@ -156,7 +159,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { } } - this.attributeDefs = Collections.unmodifiableList(tmpList); + this.attributeDefs = tmpList; } } @@ -233,6 +236,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { @JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) public static class AtlasAttributeDef implements Serializable { private static final long serialVersionUID = 1L; @@ -414,6 +418,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) @XmlRootElement + @XmlAccessorType(XmlAccessType.PROPERTY) @XmlSeeAlso(AtlasStructDef.class) public static class AtlasStructDefs extends PList<AtlasStructDef> { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypesDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypesDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypesDef.java new file mode 100644 index 0000000..5d3f4a3 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypesDef.java @@ -0,0 +1,92 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.model.typedef; + +import org.codehaus.jackson.annotate.JsonAutoDetect; +import org.codehaus.jackson.annotate.JsonIgnoreProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE; +import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +@XmlRootElement +@XmlAccessorType(XmlAccessType.PROPERTY) +public class AtlasTypesDef { + private List<AtlasEnumDef> enumDefs; + private List<AtlasStructDef> structDefs; + private List<AtlasClassificationDef> classificationDefs; + private List<AtlasEntityDef> entityDefs; + + public AtlasTypesDef() { + enumDefs = new ArrayList<>(); + structDefs = new ArrayList<>(); + classificationDefs = new ArrayList<>(); + entityDefs = new ArrayList<>(); + } + + public AtlasTypesDef(List<AtlasEnumDef> enumDefs, List<AtlasStructDef> structDefs, + List<AtlasClassificationDef> classificationDefs, + List<AtlasEntityDef> entityDefs) { + this.enumDefs = enumDefs; + this.structDefs = structDefs; + this.classificationDefs = classificationDefs; + this.entityDefs = entityDefs; + } + + public List<AtlasEnumDef> getEnumDefs() { + return enumDefs; + } + + public void setEnumDefs(List<AtlasEnumDef> enumDefs) { + this.enumDefs = enumDefs; + } + + public List<AtlasStructDef> getStructDefs() { + return structDefs; + } + + public void setStructDefs(List<AtlasStructDef> structDefs) { + this.structDefs = structDefs; + } + + public List<AtlasClassificationDef> getClassificationDefs() { + return classificationDefs; + } + + public void setClassificationDefs(List<AtlasClassificationDef> classificationDefs) { + this.classificationDefs = classificationDefs; + } + + public List<AtlasEntityDef> getEntityDefs() { + return entityDefs; + } + + public void setEntityDefs(List<AtlasEntityDef> entityDefs) { + this.entityDefs = entityDefs; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java b/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java new file mode 100644 index 0000000..bc95288 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java @@ -0,0 +1,144 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.store; + +import org.apache.atlas.exception.AtlasBaseException; +import org.apache.atlas.model.SearchFilter; +import org.apache.atlas.model.typedef.AtlasClassificationDef; +import org.apache.atlas.model.typedef.AtlasClassificationDef.AtlasClassificationDefs; +import org.apache.atlas.model.typedef.AtlasEntityDef; +import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs; +import org.apache.atlas.model.typedef.AtlasEnumDef; +import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs; +import org.apache.atlas.model.typedef.AtlasStructDef; +import org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs; +import org.apache.atlas.model.typedef.AtlasTypesDef; + +import java.util.List; + +/** + * Interface to persistence store of TypeDef + */ +public interface AtlasTypeDefStore { + void init() throws AtlasBaseException; + + /***********************/ + /** EnumDef operation **/ + /***********************/ + + AtlasEnumDef createEnumDef(AtlasEnumDef enumDef) throws AtlasBaseException; + + List<AtlasEnumDef> createEnumDefs(List<AtlasEnumDef> atlasEnumDefs) throws AtlasBaseException; + + List<AtlasEnumDef> getAllEnumDefs() throws AtlasBaseException; + + AtlasEnumDef getEnumDefByName(String name) throws AtlasBaseException; + + AtlasEnumDef getEnumDefByGuid(String guid) throws AtlasBaseException; + + AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef) throws AtlasBaseException; + + AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef) throws AtlasBaseException; + + void deleteEnumDefByName(String name) throws AtlasBaseException; + + void deleteEnumDefByGuid(String guid) throws AtlasBaseException; + + AtlasEnumDefs searchEnumDefs(SearchFilter filter) throws AtlasBaseException; + + /*************************/ + /** StructDef operation **/ + /*************************/ + AtlasStructDef createStructDef(AtlasStructDef structDef) throws AtlasBaseException; + + List<AtlasStructDef> createStructDefs(List<AtlasStructDef> structDefs) throws AtlasBaseException; + + List<AtlasStructDef> getAllStructDefs() throws AtlasBaseException; + + AtlasStructDef getStructDefByName(String name) throws AtlasBaseException; + + AtlasStructDef getStructDefByGuid(String guid) throws AtlasBaseException; + + AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef) throws AtlasBaseException; + + AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef) throws AtlasBaseException; + + void deleteStructDefByName(String name) throws AtlasBaseException; + + void deleteStructDefByGuid(String guid) throws AtlasBaseException; + + AtlasStructDefs searchStructDefs(SearchFilter filter) throws AtlasBaseException; + + + /*********************************/ + /** ClassificationDef operation **/ + /*********************************/ + AtlasClassificationDef createClassificationDef(AtlasClassificationDef classificationDef) throws AtlasBaseException; + + List<AtlasClassificationDef> createClassificationDefs(List<AtlasClassificationDef> classificationDefs) throws AtlasBaseException; + + List<AtlasClassificationDef> getAllClassificationDefs() throws AtlasBaseException; + + AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException; + + AtlasClassificationDef getClassificationDefByGuid(String guid) throws AtlasBaseException; + + AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef) + throws AtlasBaseException; + + AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef) + throws AtlasBaseException; + + void deleteClassificationDefByName(String name) throws AtlasBaseException; + + void deleteClassificationDefByGuid(String guid) throws AtlasBaseException; + + AtlasClassificationDefs searchClassificationDefs(SearchFilter filter) throws AtlasBaseException; + + + /*************************/ + /** EntityDef operation **/ + /*************************/ + AtlasEntityDef createEntityDefs(AtlasEntityDef entityDef) throws AtlasBaseException; + + List<AtlasEntityDef> createEntityDefs(List<AtlasEntityDef> entityDefs) throws AtlasBaseException; + + List<AtlasEntityDef> getAllEntityDefs() throws AtlasBaseException; + + AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException; + + AtlasEntityDef getEntityDefByGuid(String guid) throws AtlasBaseException; + + AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef) throws AtlasBaseException; + + AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef) throws AtlasBaseException; + + void deleteEntityDefByName(String name) throws AtlasBaseException; + + void deleteEntityDefByGuid(String guid) throws AtlasBaseException; + + AtlasEntityDefs searchEntityDefs(SearchFilter filter) throws AtlasBaseException; + + /***** Bulk Operations *****/ + + AtlasTypesDef createTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException; + + AtlasTypesDef updateTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException; + + AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException; +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java index 4b2e325..f4683ff 100644 --- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java +++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java @@ -47,11 +47,11 @@ public class AtlasTypeRegistry { public AtlasTypeRegistry() { - allTypes = new ConcurrentHashMap<String, AtlasType>(); - enumDefs = new TypeDefCache<AtlasEnumDef>(this); - structDefs = new TypeDefCache<AtlasStructDef>(this); - classificationDefs = new TypeDefCache<AtlasClassificationDef>(this); - entityDefs = new TypeDefCache<AtlasEntityDef>(this); + allTypes = new ConcurrentHashMap<>(); + enumDefs = new TypeDefCache<>(this); + structDefs = new TypeDefCache<>(this); + classificationDefs = new TypeDefCache<>(this); + entityDefs = new TypeDefCache<>(this); registerType(new AtlasBuiltInTypes.AtlasBooleanType()); registerType(new AtlasBuiltInTypes.AtlasByteType()); @@ -77,7 +77,7 @@ public class AtlasTypeRegistry { public AtlasType getType(String typeName) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.getType(" + typeName + ")"); + LOG.debug("==> AtlasTypeRegistry.getType({})", typeName); } AtlasType ret = allTypes.get(typeName); @@ -105,7 +105,7 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.getType(" + typeName + ")"); + LOG.debug("<== AtlasTypeRegistry.getType({})", typeName); } return ret; @@ -114,13 +114,13 @@ public class AtlasTypeRegistry { public void addEnumDef(AtlasEnumDef enumDef) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.addEnumDef(" + enumDef + ")"); + LOG.debug("==> AtlasTypeRegistry.addEnumDef({})", enumDef); } enumDefs.addType(enumDef, new AtlasEnumType(enumDef)); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.addEnumDef(" + enumDef + ")"); + LOG.debug("<== AtlasTypeRegistry.addEnumDef({})", enumDef); } } @@ -136,7 +136,7 @@ public class AtlasTypeRegistry { public void removeEnumDefByGuid(String guid) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeEnumDefByGuid(" + guid + ")"); + LOG.debug("==> AtlasTypeRegistry.removeEnumDefByGuid({})", guid); } AtlasEnumDef enumDef = enumDefs.getTypeDefByGuid(guid); @@ -146,13 +146,13 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeEnumDefByGuid(" + guid + ")"); + LOG.debug("<== AtlasTypeRegistry.removeEnumDefByGuid({})", guid); } } public void removeEnumDefByName(String name) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeEnumDefByName(" + name + ")"); + LOG.debug("==> AtlasTypeRegistry.removeEnumDefByName({})", name); } AtlasEnumDef enumDef = enumDefs.getTypeDefByName(name); @@ -162,32 +162,32 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeEnumDefByName(" + name + ")"); + LOG.debug("<== AtlasTypeRegistry.removeEnumDefByName({})", name); } } public void addStructDefWithNoRefResolve(AtlasStructDef structDef) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.addStructDefWithNoRefResolve(" + structDef + ")"); + LOG.debug("==> AtlasTypeRegistry.addStructDefWithNoRefResolve({})", structDef); } structDefs.addType(structDef, new AtlasStructType(structDef)); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.addStructDefWithNoRefResolve(" + structDef + ")"); + LOG.debug("<== AtlasTypeRegistry.addStructDefWithNoRefResolve({})", structDef); } } public void addStructDef(AtlasStructDef structDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.addStructDef(" + structDef + ")"); + LOG.debug("==> AtlasTypeRegistry.addStructDef({})", structDef); } structDefs.addType(structDef, new AtlasStructType(structDef, this)); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.addStructDef(" + structDef + ")"); + LOG.debug("<== AtlasTypeRegistry.addStructDef({})", structDef); } } @@ -201,7 +201,7 @@ public class AtlasTypeRegistry { public void removeStructDefByGuid(String guid) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeStructDefByGuid(" + guid + ")"); + LOG.debug("==> AtlasTypeRegistry.removeStructDefByGuid({})", guid); } AtlasStructDef structDef = structDefs.getTypeDefByGuid(guid); @@ -211,13 +211,13 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeStructDefByGuid(" + guid + ")"); + LOG.debug("<== AtlasTypeRegistry.removeStructDefByGuid({})", guid); } } public void removeStructDefByName(String name) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeStructDefByName(" + name + ")"); + LOG.debug("==> AtlasTypeRegistry.removeStructDefByName({})", name); } AtlasStructDef structDef = structDefs.getTypeDefByName(name); @@ -227,33 +227,33 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeStructDefByName(" + name + ")"); + LOG.debug("<== AtlasTypeRegistry.removeStructDefByName({})", name); } } public void addClassificationDefWithNoRefResolve(AtlasClassificationDef classificationDef) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.addClassificationDefWithNoRefResolve(" + classificationDef + ")"); + LOG.debug("==> AtlasTypeRegistry.addClassificationDefWithNoRefResolve({})", classificationDef); } classificationDefs.addType(classificationDef, new AtlasClassificationType(classificationDef)); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.addClassificationDefWithNoRefResolve(" + classificationDef + ")"); + LOG.debug("<== AtlasTypeRegistry.addClassificationDefWithNoRefResolve({})", classificationDef); } } public void addClassificationDef(AtlasClassificationDef classificationDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.addClassificationDef(" + classificationDef + ")"); + LOG.debug("==> AtlasTypeRegistry.addClassificationDef({})", classificationDef); } classificationDefs.addType(classificationDef, new AtlasClassificationType(classificationDef, this)); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.addClassificationDef(" + classificationDef + ")"); + LOG.debug("<== AtlasTypeRegistry.addClassificationDef({})", classificationDef); } } @@ -269,7 +269,7 @@ public class AtlasTypeRegistry { public void removeClassificationDefByGuid(String guid) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeClassificationDefByGuid(" + guid + ")"); + LOG.debug("==> AtlasTypeRegistry.removeClassificationDefByGuid({})", guid); } AtlasClassificationDef classificationDef = classificationDefs.getTypeDefByGuid(guid); @@ -279,13 +279,13 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeClassificationDefByGuid(" + guid + ")"); + LOG.debug("<== AtlasTypeRegistry.removeClassificationDefByGuid({})", guid); } } public void removeClassificationDefByName(String name) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeClassificationDefByName(" + name + ")"); + LOG.debug("==> AtlasTypeRegistry.removeClassificationDefByName({})", name); } AtlasClassificationDef classificationDef = classificationDefs.getTypeDefByName(name); @@ -295,32 +295,32 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeClassificationDefByName(" + name + ")"); + LOG.debug("<== AtlasTypeRegistry.removeClassificationDefByName({})", name); } } public void addEntityDefWithNoRefResolve(AtlasEntityDef entityDef) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.addEntityDefWithNoRefResolve(" + entityDef + ")"); + LOG.debug("==> AtlasTypeRegistry.addEntityDefWithNoRefResolve({})", entityDef); } entityDefs.addType(entityDef, new AtlasEntityType(entityDef)); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.addEntityDefWithNoRefResolve(" + entityDef + ")"); + LOG.debug("<== AtlasTypeRegistry.addEntityDefWithNoRefResolve({})", entityDef); } } public void addEntityDef(AtlasEntityDef entityDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.addEntityDef(" + entityDef + ")"); + LOG.debug("==> AtlasTypeRegistry.addEntityDef({})", entityDef); } entityDefs.addType(entityDef, new AtlasEntityType(entityDef, this)); if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.addEntityDef(" + entityDef + ")"); + LOG.debug("<== AtlasTypeRegistry.addEntityDef({})", entityDef); } } @@ -336,7 +336,7 @@ public class AtlasTypeRegistry { public void removeEntityDefByGuid(String guid) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeEntityDefByGuid(" + guid + ")"); + LOG.debug("==> AtlasTypeRegistry.removeEntityDefByGuid({})", guid); } AtlasEntityDef entityDef = entityDefs.getTypeDefByGuid(guid); @@ -346,13 +346,13 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeEntityDefByGuid(" + guid + ")"); + LOG.debug("<== AtlasTypeRegistry.removeEntityDefByGuid({})", guid); } } public void removeEntityDefByName(String name) { if (LOG.isDebugEnabled()) { - LOG.debug("==> AtlasTypeRegistry.removeEntityDefByName(" + name + ")"); + LOG.debug("==> AtlasTypeRegistry.removeEntityDefByName({})", name); } AtlasEntityDef entityDef = entityDefs.getTypeDefByName(name); @@ -362,7 +362,7 @@ public class AtlasTypeRegistry { } if (LOG.isDebugEnabled()) { - LOG.debug("<== AtlasTypeRegistry.removeEntityDefByName(" + name + ")"); + LOG.debug("<== AtlasTypeRegistry.removeEntityDefByName({})", name); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java new file mode 100644 index 0000000..264e9a8 --- /dev/null +++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java @@ -0,0 +1,78 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.type; + +import org.apache.atlas.model.typedef.AtlasBaseTypeDef; +import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_PREFIX; +import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_SUFFIX; +import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_PREFIX; +import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_SUFFIX; +import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_MAP_KEY_VAL_SEP; +import org.apache.commons.lang.StringUtils; + +import java.util.HashSet; +import java.util.Set; + +/** + * Utility methods for AtlasType/AtlasTypeDef. + */ +public class AtlasTypeUtil { + private static final Set<String> ATLAS_BUILTIN_TYPENAMES = new HashSet<String>(); + + static { + for (String typeName : AtlasBaseTypeDef.ATLAS_BUILTIN_TYPES) { + ATLAS_BUILTIN_TYPENAMES.add(typeName); + } + } + + public static Set<String> getReferencedTypeNames(String typeName) { + Set<String> ret = new HashSet<String>(); + + getReferencedTypeNames(typeName, ret); + + return ret; + } + + public static boolean isBuiltInType(String typeName) { + return ATLAS_BUILTIN_TYPENAMES.contains(typeName); + } + + private static void getReferencedTypeNames(String typeName, Set<String> referencedTypeNames) { + if (StringUtils.isNotBlank(typeName) && !referencedTypeNames.contains(typeName)) { + if (typeName.startsWith(ATLAS_TYPE_ARRAY_PREFIX) && typeName.endsWith(ATLAS_TYPE_ARRAY_SUFFIX)) { + int startIdx = ATLAS_TYPE_ARRAY_PREFIX.length(); + int endIdx = typeName.length() - ATLAS_TYPE_ARRAY_SUFFIX.length(); + String elementTypeName = typeName.substring(startIdx, endIdx); + + getReferencedTypeNames(elementTypeName, referencedTypeNames); + } else if (typeName.startsWith(ATLAS_TYPE_MAP_PREFIX) && typeName.endsWith(ATLAS_TYPE_MAP_SUFFIX)) { + int startIdx = ATLAS_TYPE_MAP_PREFIX.length(); + int endIdx = typeName.length() - ATLAS_TYPE_MAP_SUFFIX.length(); + String[] keyValueTypes = typeName.substring(startIdx, endIdx).split(ATLAS_TYPE_MAP_KEY_VAL_SEP, 2); + String keyTypeName = keyValueTypes.length > 0 ? keyValueTypes[0] : null; + String valueTypeName = keyValueTypes.length > 1 ? keyValueTypes[1] : null; + + getReferencedTypeNames(keyTypeName, referencedTypeNames); + getReferencedTypeNames(valueTypeName, referencedTypeNames); + } else { + referencedTypeNames.add(typeName); + } + } + + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 06e2b7c..811d9b9 100644 --- a/pom.xml +++ b/pom.xml @@ -1760,6 +1760,8 @@ <exclude>**/atlas.data/**</exclude> <exclude>**/${sys:atlas.data}/**</exclude> <exclude>**/policy-store.txt</exclude> + <exclude>**/*rebel*.xml</exclude> + <exclude>**/*rebel*.xml.bak</exclude> </excludes> </configuration> <executions> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index a949dac..03ab7c9 100644 --- a/release-log.txt +++ b/release-log.txt @@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ALL CHANGES: +ATLAS-1223 Type REST API v2 implementation (apoorvnaik via sumasai) ATLAS-1210 patch file to add "position" attribute to hive_column type (sarath.ku...@gmail.com via sumasai) ATLAS-694 Update Atlas code to use graph abstraction layer (jnhagelb via sumasai) ATLAS-1215 Atlas UI not working in firefox due to fix in ATLAS-1199 (kevalbhatt) http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/repository/pom.xml ---------------------------------------------------------------------- diff --git a/repository/pom.xml b/repository/pom.xml index cdc8429..667af11 100755 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -34,6 +34,11 @@ <dependencies> <dependency> <groupId>org.apache.atlas</groupId> + <artifactId>atlas-intg</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.atlas</groupId> <artifactId>atlas-typesystem</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java b/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java index d0792d7..bbf75ae 100755 --- a/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java +++ b/repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java @@ -18,6 +18,11 @@ package org.apache.atlas; +import com.google.inject.Binder; +import com.google.inject.Singleton; +import com.google.inject.matcher.Matchers; +import com.google.inject.multibindings.Multibinder; + import org.aopalliance.intercept.MethodInterceptor; import org.apache.atlas.discovery.DataSetLineageService; import org.apache.atlas.discovery.DiscoveryService; @@ -31,6 +36,7 @@ import org.apache.atlas.repository.audit.EntityAuditRepository; import org.apache.atlas.repository.graph.DeleteHandler; import org.apache.atlas.repository.graph.GraphBackedMetadataRepository; import org.apache.atlas.repository.graph.GraphBackedSearchIndexer; +import org.apache.atlas.repository.store.graph.v1.AtlasTypeDefGraphStoreV1; import org.apache.atlas.repository.typestore.GraphBackedTypeStore; import org.apache.atlas.repository.typestore.ITypeStore; import org.apache.atlas.service.Service; @@ -38,17 +44,13 @@ import org.apache.atlas.services.DefaultMetadataService; import org.apache.atlas.services.IBootstrapTypesRegistrar; import org.apache.atlas.services.MetadataService; import org.apache.atlas.services.ReservedTypesRegistrar; +import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.typesystem.types.TypeSystem; import org.apache.atlas.typesystem.types.TypeSystemProvider; import org.apache.atlas.typesystem.types.cache.TypeCache; import org.apache.atlas.util.AtlasRepositoryConfiguration; import org.apache.commons.configuration.Configuration; -import com.google.inject.Binder; -import com.google.inject.Singleton; -import com.google.inject.matcher.Matchers; -import com.google.inject.multibindings.Multibinder; - /** * Guice module for Repository module. */ @@ -65,6 +67,7 @@ public class RepositoryMetadataModule extends com.google.inject.AbstractModule { // bind the ITypeStore interface to an implementation bind(ITypeStore.class).to(GraphBackedTypeStore.class).asEagerSingleton(); + bind(AtlasTypeDefStore.class).to(AtlasTypeDefGraphStoreV1.class).asEagerSingleton(); //GraphBackedSearchIndexer must be an eager singleton to force the search index creation to happen before //we try to restore the type system (otherwise we'll end up running queries http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java new file mode 100644 index 0000000..2917c20 --- /dev/null +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.repository.store.graph; + +import org.apache.atlas.exception.AtlasBaseException; +import org.apache.atlas.model.SearchFilter; +import org.apache.atlas.model.typedef.AtlasClassificationDef; +import org.apache.atlas.model.typedef.AtlasClassificationDef.AtlasClassificationDefs; + +import java.util.List; + +/** + * Interface for graph persistence store for AtlasClassificationDef + */ +public interface AtlasClassificationDefStore { + AtlasClassificationDef create(AtlasClassificationDef classificationDef) throws AtlasBaseException; + + List<AtlasClassificationDef> create(List<AtlasClassificationDef> classificationDefs) throws AtlasBaseException; + + List<AtlasClassificationDef> getAll() throws AtlasBaseException; + + AtlasClassificationDef getByName(String name) throws AtlasBaseException; + + AtlasClassificationDef getByGuid(String guid) throws AtlasBaseException; + + AtlasClassificationDef updateByName(String name, AtlasClassificationDef classificationDef) throws AtlasBaseException; + + AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classificationDef) throws AtlasBaseException; + + List<AtlasClassificationDef> update(List<AtlasClassificationDef> classificationDefs) throws AtlasBaseException; + + void deleteByName(String name) throws AtlasBaseException; + + void deleteByNames(List<String> names) throws AtlasBaseException; + + void deleteByGuid(String guid) throws AtlasBaseException; + + void deleteByGuids(List<String> guids) throws AtlasBaseException; + + AtlasClassificationDefs search(SearchFilter filter) throws AtlasBaseException; +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java new file mode 100644 index 0000000..2c81cdf --- /dev/null +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.repository.store.graph; + +import org.apache.atlas.exception.AtlasBaseException; +import org.apache.atlas.model.SearchFilter; +import org.apache.atlas.model.typedef.AtlasEntityDef; +import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs; + +import java.util.List; + +/** + * Interface for graph persistence store for AtlasEntityDef + */ +public interface AtlasEntityDefStore { + AtlasEntityDef create(AtlasEntityDef entityDef) throws AtlasBaseException; + + List<AtlasEntityDef> create(List<AtlasEntityDef> entityDefs) throws AtlasBaseException; + + List<AtlasEntityDef> getAll() throws AtlasBaseException; + + AtlasEntityDef getByName(String name) throws AtlasBaseException; + + AtlasEntityDef getByGuid(String guid) throws AtlasBaseException; + + AtlasEntityDef updateByName(String name, AtlasEntityDef entityDef) throws AtlasBaseException; + + AtlasEntityDef updateByGuid(String guid, AtlasEntityDef entityDef) throws AtlasBaseException; + + List<AtlasEntityDef> update(List<AtlasEntityDef> entityDefs) throws AtlasBaseException; + + void deleteByName(String name) throws AtlasBaseException; + + void deleteByNames(List<String> names) throws AtlasBaseException; + + void deleteByGuid(String guid) throws AtlasBaseException; + + void deleteByGuids(List<String> guids) throws AtlasBaseException; + + AtlasEntityDefs search(SearchFilter filter) throws AtlasBaseException; +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java new file mode 100644 index 0000000..d997a90 --- /dev/null +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.repository.store.graph; + +import org.apache.atlas.exception.AtlasBaseException; +import org.apache.atlas.model.SearchFilter; +import org.apache.atlas.model.typedef.AtlasEnumDef; +import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs; + +import java.util.List; + +/** + * Interface for graph persistence store for AtlasEnumDef + */ +public interface AtlasEnumDefStore { + AtlasEnumDef create(AtlasEnumDef enumDef) throws AtlasBaseException; + + List<AtlasEnumDef> create(List<AtlasEnumDef> atlasEnumDefs) throws AtlasBaseException; + + List<AtlasEnumDef> getAll() throws AtlasBaseException; + + AtlasEnumDef getByName(String name) throws AtlasBaseException; + + AtlasEnumDef getByGuid(String guid) throws AtlasBaseException; + + AtlasEnumDef updateByName(String name, AtlasEnumDef enumDef) throws AtlasBaseException; + + AtlasEnumDef updateByGuid(String guid, AtlasEnumDef enumDef) throws AtlasBaseException; + + List<AtlasEnumDef> update(List<AtlasEnumDef> enumDefs) throws AtlasBaseException; + + void deleteByName(String name) throws AtlasBaseException; + + void deleteByNames(List<String> names) throws AtlasBaseException; + + void deleteByGuid(String guid) throws AtlasBaseException; + + void deleteByGuids(List<String> guids) throws AtlasBaseException; + + AtlasEnumDefs search(SearchFilter filter) throws AtlasBaseException; +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/f8fe0945/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java new file mode 100644 index 0000000..1308bb3 --- /dev/null +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.repository.store.graph; + +import org.apache.atlas.exception.AtlasBaseException; +import org.apache.atlas.model.SearchFilter; +import org.apache.atlas.model.typedef.AtlasStructDef; +import org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs; + +import java.util.List; + +/** + * Interface for graph persistence store for AtlasStructDef + */ +public interface AtlasStructDefStore { + AtlasStructDef create(AtlasStructDef structDef) throws AtlasBaseException; + + List<AtlasStructDef> create(List<AtlasStructDef> structDefs) throws AtlasBaseException; + + List<AtlasStructDef> getAll() throws AtlasBaseException; + + AtlasStructDef getByName(String name) throws AtlasBaseException; + + AtlasStructDef getByGuid(String guid) throws AtlasBaseException; + + AtlasStructDef updateByName(String name, AtlasStructDef structDef) throws AtlasBaseException; + + AtlasStructDef updateByGuid(String guid, AtlasStructDef structDef) throws AtlasBaseException; + + List<AtlasStructDef> update(List<AtlasStructDef> structDefs) throws AtlasBaseException; + + void deleteByName(String name) throws AtlasBaseException; + + void deleteByNames(List<String> names) throws AtlasBaseException; + + void deleteByGuid(String guid) throws AtlasBaseException; + + void deleteByGuids(List<String> guids) throws AtlasBaseException; + + AtlasStructDefs search(SearchFilter filter) throws AtlasBaseException; +}