atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shweth...@apache.org
Subject [4/5] incubator-atlas git commit: ATLAS-1171 Structured, high-level public APIs (mneethiraj via shwethags)
Date Sun, 02 Oct 2016 13:35:24 GMT
ATLAS-1171 Structured, high-level public APIs (mneethiraj via shwethags)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/698a5652
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/698a5652
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/698a5652

Branch: refs/heads/master
Commit: 698a56526ce5704e49054b8f8e40ab173a9a3166
Parents: a52112d
Author: Shwetha GS <sshivalingamurthy@hortonworks.com>
Authored: Sun Oct 2 18:23:33 2016 +0530
Committer: Shwetha GS <sshivalingamurthy@hortonworks.com>
Committed: Sun Oct 2 18:23:33 2016 +0530

----------------------------------------------------------------------
 intg/pom.xml                                    |  65 +++
 .../org/apache/atlas/api/AtlasApiEntities.java  |  52 ++
 .../org/apache/atlas/api/AtlasApiTypes.java     |  99 ++++
 .../main/java/org/apache/atlas/api/PList.java   | 128 +++++
 .../java/org/apache/atlas/api/SearchFilter.java | 123 +++++
 .../atlas/exception/AtlasBaseException.java     |  43 ++
 .../model/instance/AtlasClassification.java     |  60 ++
 .../atlas/model/instance/AtlasEntity.java       | 206 +++++++
 .../atlas/model/instance/AtlasObjectId.java     | 132 +++++
 .../atlas/model/instance/AtlasStruct.java       | 230 ++++++++
 .../atlas/model/typedef/AtlasBaseTypeDef.java   | 353 ++++++++++++
 .../model/typedef/AtlasClassificationDef.java   | 169 ++++++
 .../atlas/model/typedef/AtlasEntityDef.java     | 166 ++++++
 .../atlas/model/typedef/AtlasEnumDef.java       | 335 ++++++++++++
 .../atlas/model/typedef/AtlasStructDef.java     | 401 ++++++++++++++
 .../org/apache/atlas/type/AtlasArrayType.java   | 271 +++++++++
 .../apache/atlas/type/AtlasBuiltInTypes.java    | 547 +++++++++++++++++++
 .../atlas/type/AtlasClassificationType.java     | 201 +++++++
 .../org/apache/atlas/type/AtlasEntityType.java  | 201 +++++++
 .../org/apache/atlas/type/AtlasEnumType.java    |  87 +++
 .../org/apache/atlas/type/AtlasMapType.java     | 189 +++++++
 .../org/apache/atlas/type/AtlasStructType.java  | 292 ++++++++++
 .../java/org/apache/atlas/type/AtlasType.java   |  73 +++
 .../apache/atlas/type/AtlasTypeRegistry.java    | 442 +++++++++++++++
 .../org/apache/atlas/model/ModelTestUtil.java   | 411 ++++++++++++++
 .../model/instance/TestAtlasClassification.java |  89 +++
 .../atlas/model/instance/TestAtlasEntity.java   |  89 +++
 .../typedef/TestAtlasClassificationDef.java     | 100 ++++
 .../atlas/model/typedef/TestAtlasEntityDef.java | 140 +++++
 .../atlas/model/typedef/TestAtlasEnumDef.java   | 110 ++++
 .../atlas/model/typedef/TestAtlasStructDef.java | 104 ++++
 .../apache/atlas/type/TestAtlasArrayType.java   | 120 ++++
 .../atlas/type/TestAtlasBigDecimalType.java     | 114 ++++
 .../atlas/type/TestAtlasBigIntegerType.java     | 115 ++++
 .../apache/atlas/type/TestAtlasBooleanType.java |  88 +++
 .../apache/atlas/type/TestAtlasByteType.java    | 115 ++++
 .../atlas/type/TestAtlasClassificationType.java | 125 +++++
 .../apache/atlas/type/TestAtlasDateType.java    | 132 +++++
 .../apache/atlas/type/TestAtlasDoubleType.java  | 115 ++++
 .../apache/atlas/type/TestAtlasEntityType.java  | 125 +++++
 .../apache/atlas/type/TestAtlasFloatType.java   | 115 ++++
 .../org/apache/atlas/type/TestAtlasIntType.java | 115 ++++
 .../apache/atlas/type/TestAtlasLongType.java    | 115 ++++
 .../org/apache/atlas/type/TestAtlasMapType.java | 116 ++++
 .../atlas/type/TestAtlasObjectIdType.java       | 122 +++++
 .../apache/atlas/type/TestAtlasShortType.java   | 115 ++++
 .../apache/atlas/type/TestAtlasStringType.java  |  90 +++
 .../apache/atlas/type/TestAtlasStructType.java  | 183 +++++++
 pom.xml                                         |   8 +
 release-log.txt                                 |   1 +
 src/build/checkstyle.xml                        |   4 +-
 webapp/pom.xml                                  |   5 +
 .../org/apache/atlas/web/rest/TypesREST.java    | 371 +++++++++++++
 53 files changed, 8316 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/pom.xml
----------------------------------------------------------------------
diff --git a/intg/pom.xml b/intg/pom.xml
new file mode 100644
index 0000000..ff3136d
--- /dev/null
+++ b/intg/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>apache-atlas</artifactId>
+        <groupId>org.apache.atlas</groupId>
+        <version>0.8-incubating-SNAPSHOT</version>
+    </parent>
+    <artifactId>atlas-intg</artifactId>
+    <description>Apache Atlas Integration</description>
+    <name>Apache Atlas Integration</name>
+    <packaging>jar</packaging>
+
+    <properties>
+        <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-common</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.codehaus.jackson</groupId>
+            <artifactId>jackson-jaxrs</artifactId>
+            <version>${codehaus.jackson.version}</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/main/java/org/apache/atlas/api/AtlasApiEntities.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/api/AtlasApiEntities.java b/intg/src/main/java/org/apache/atlas/api/AtlasApiEntities.java
new file mode 100644
index 0000000..69b02b9
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/api/AtlasApiEntities.java
@@ -0,0 +1,52 @@
+/**
+ * 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 java.util.List;
+import java.util.Map;
+
+import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.instance.AtlasClassification;
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasObjectId;
+
+/**
+ * API to work with CRUD of Atlas entities.
+ */
+public interface AtlasApiEntities {
+    AtlasEntity createEntity(AtlasEntity entity) throws AtlasBaseException;
+
+    AtlasEntity getEntity(AtlasObjectId objId) throws AtlasBaseException;
+
+    AtlasEntity updateEntity(AtlasObjectId objId, AtlasEntity entity) throws AtlasBaseException;
+
+    AtlasEntity updateEntityAttributes(AtlasObjectId objId, Map<String, Object> attributes) throws AtlasBaseException;
+
+    void deleteEntity(AtlasObjectId objId) throws AtlasBaseException;
+
+    PList<AtlasEntity> searchEntities(SearchFilter filter) throws AtlasBaseException;
+
+
+    void addEntityClassification(AtlasObjectId entityId, AtlasClassification classification) throws AtlasBaseException;
+
+    void removeEntityClassification(AtlasObjectId entityId, String classificationName) throws AtlasBaseException;
+
+    List<AtlasClassification> getEntityClassifications(AtlasObjectId entityId) throws AtlasBaseException;
+
+    List<String> getEntityClassificationNames(AtlasObjectId entityId) throws AtlasBaseException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..6950406
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/api/AtlasApiTypes.java
@@ -0,0 +1,99 @@
+/**
+ * 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.typedef.AtlasClassificationDef;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.model.typedef.AtlasEnumDef;
+import org.apache.atlas.model.typedef.AtlasStructDef;
+
+/**
+ * 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;
+
+    PList<AtlasEnumDef> 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;
+
+    PList<AtlasStructDef> 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;
+
+    PList<AtlasClassificationDef> 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;
+
+    PList<AtlasEntityDef> searchEntityDefs(SearchFilter filter) throws AtlasBaseException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/main/java/org/apache/atlas/api/PList.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/api/PList.java b/intg/src/main/java/org/apache/atlas/api/PList.java
new file mode 100644
index 0000000..c6a3025
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/api/PList.java
@@ -0,0 +1,128 @@
+/**
+ * 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 java.util.List;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import org.apache.atlas.api.SearchFilter.SortType;
+
+/**
+ * Paged-list, for returning search results.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class PList<T> implements java.io.Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private List<T>  list       = null;
+    private long     startIndex = 0;
+    private int      pageSize   = 0;
+    private long     totalCount = 0;
+    private String   sortBy     = null;
+    private SortType sortType   = null;
+
+    public PList() {
+    }
+
+    public PList(List<T> list, long startIndex, int pageSize, long totalCount, SortType sortType, String sortBy) {
+        setList(list);
+        setStartIndex(startIndex);
+        setPageSize(pageSize);
+        setTotalCount(totalCount);
+        setSortType(sortType);
+        setSortBy(sortBy);
+    }
+
+    public List<T> getList() {
+        return list;
+    }
+
+    public void setList(List<T> list) {
+        this.list = list;
+    }
+
+    public long getStartIndex() {
+        return startIndex;
+    }
+
+    public void setStartIndex(long startIndex) {
+        this.startIndex = startIndex;
+    }
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public long getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(long totalCount) {
+        this.totalCount = totalCount;
+    }
+
+    public SortType getSortType() {
+        return sortType;
+    }
+
+    public void setSortType(SortType sortType) {
+        this.sortType = sortType;
+    }
+
+    public String getSortBy() {
+        return sortBy;
+    }
+
+    public void setSortBy(String sortBy) {
+        this.sortBy = sortBy;
+    }
+
+
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append("PList<T>{");
+        sb.append("list='").append((list == null ? "null" : ("size:" + list.size()))).append('\'');
+        sb.append(", startIndex=").append(startIndex);
+        sb.append(", pageSize=").append(pageSize);
+        sb.append(", totalCount=").append(totalCount);
+        sb.append(", sortType=").append(sortType);
+        sb.append(", version=").append(sortBy);
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/main/java/org/apache/atlas/api/SearchFilter.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/api/SearchFilter.java b/intg/src/main/java/org/apache/atlas/api/SearchFilter.java
new file mode 100644
index 0000000..f9235ad
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/api/SearchFilter.java
@@ -0,0 +1,123 @@
+/**
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * Generic filter, to specify search criteria using name/value pairs.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class SearchFilter {
+    /**
+     * to specify whether the result should be sorted? If yes, whether asc or desc.
+     */
+    public enum SortType { NONE, ASC, DESC };
+
+    private Map<String, String> params     = null;
+    private long                startIndex = 0;
+    private long                maxRows    = Long.MAX_VALUE;
+    private boolean             getCount   = true;
+    private String              sortBy     = null;
+    private SortType            sortType   = null;
+
+    public SearchFilter() {
+        setParams(null);
+    }
+
+    public SearchFilter(Map<String, String> params) {
+        setParams(params);
+    }
+
+    public Map<String, String> getParams() {
+        return params;
+    }
+
+    public void setParams(Map<String, String> params) {
+        this.params = params;
+    }
+
+    public String getParam(String name) {
+        String ret = null;
+
+        if (name != null && params != null) {
+            ret = params.get(name);
+        }
+
+        return ret;
+    }
+
+    public void setParam(String name, String value) {
+        if (name != null) {
+            if (params == null) {
+                params = new HashMap<String, String>();
+            }
+
+            params.put(name, value);
+        }
+    }
+
+    public long getStartIndex() {
+        return startIndex;
+    }
+
+    public void setStartIndex(long startIndex) {
+        this.startIndex = startIndex;
+    }
+
+    public long getMaxRows() {
+        return maxRows;
+    }
+
+    public void setMaxRows(long maxRows) {
+        this.maxRows = maxRows;
+    }
+
+    public boolean isGetCount() {
+        return getCount;
+    }
+
+    public void setGetCount(boolean getCount) {
+        this.getCount = getCount;
+    }
+
+    public String getSortBy() {
+        return sortBy;
+    }
+
+    public void setSortBy(String sortBy) {
+        this.sortBy = sortBy;
+    }
+
+    public SortType getSortType() {
+        return sortType;
+    }
+
+    public void setSortType(SortType sortType) {
+        this.sortType = sortType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/intg/src/main/java/org/apache/atlas/exception/AtlasBaseException.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/exception/AtlasBaseException.java b/intg/src/main/java/org/apache/atlas/exception/AtlasBaseException.java
new file mode 100644
index 0000000..3538f41
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/exception/AtlasBaseException.java
@@ -0,0 +1,43 @@
+/**
+ * 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.exception;
+
+/**
+ * Base Exception class for Atlas API.
+ */
+public class AtlasBaseException extends Exception {
+
+    public AtlasBaseException() {
+    }
+
+    public AtlasBaseException(String message) {
+        super(message);
+    }
+
+    public AtlasBaseException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public AtlasBaseException(Throwable cause) {
+        super(cause);
+    }
+
+    public AtlasBaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..2f034d4
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasClassification.java
@@ -0,0 +1,60 @@
+/**
+ * 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.instance;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * An instance of a classfication; it doesn't have an identity, this object exists only when associated with an entity.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AtlasClassification extends AtlasStruct implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    public AtlasClassification() {
+        this(null, null);
+    }
+
+    public AtlasClassification(String typeName) {
+        this(typeName, null);
+    }
+
+    public AtlasClassification(String typeName, Map<String, Object> attributes) {
+        super(typeName, attributes);
+    }
+
+    public AtlasClassification(String typeName, String attrName, Object attrValue) {
+        super(typeName, attrName, attrValue);
+    }
+
+    public AtlasClassification(AtlasClassification other) {
+        if (other != null) {
+            setTypeName(other.getTypeName());
+            setAttributes(other.getAttributes());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..e1d7bc6
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasEntity.java
@@ -0,0 +1,206 @@
+/**
+ * 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.instance;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+
+/**
+ * An instance of an entity - like hive_table, hive_database.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AtlasEntity extends AtlasStruct implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Status of the entity - can be active or deleted. Deleted entities are not removed from Atlas store.
+     */
+    public enum Status { STATUS_ACTIVE, STATUS_DELETED };
+
+    private String guid       = null;
+    private Status status     = Status.STATUS_ACTIVE;
+    private String createdBy  = null;
+    private String updatedBy  = null;
+    private Date   createTime = null;
+    private Date   updateTime = null;
+    private Long   version    = null;
+
+    public AtlasEntity() {
+        this(null, null);
+    }
+
+    public AtlasEntity(String typeName) {
+        this(typeName, null);
+    }
+
+    public AtlasEntity(AtlasEntityDef entityDef) {
+        this(entityDef != null ? entityDef.getName() : null, null);
+    }
+
+    public AtlasEntity(String typeName, Map<String, Object> attributes) {
+        super(typeName, attributes);
+
+        setGuid(null);
+        setStatus(null);
+        setCreatedBy(null);
+        setUpdatedBy(null);
+        setCreateTime(null);
+        setUpdateTime(null);
+        setVersion(null);
+    }
+
+    public AtlasEntity(AtlasEntity other) {
+        super(other);
+
+        if (other != null) {
+            setGuid(other.getGuid());
+            setStatus(other.getStatus());
+            setCreatedBy(other.getCreatedBy());
+            setUpdatedBy(other.getUpdatedBy());
+            setCreateTime(other.getCreateTime());
+            setUpdateTime(other.getUpdateTime());
+            setVersion(other.getVersion());
+        }
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public Status getStatus() {
+        return status;
+    }
+
+    public void setStatus(Status status) {
+        this.status = status;
+    }
+
+    public String getCreatedBy() {
+        return createdBy;
+    }
+
+    public void setCreatedBy(String createdBy) {
+        this.createdBy = createdBy;
+    }
+
+    public String getUpdatedBy() {
+        return updatedBy;
+    }
+
+    public void setUpdatedBy(String updatedBy) {
+        this.updatedBy = updatedBy;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Long getVersion() {
+        return version;
+    }
+
+    public void setVersion(Long version) {
+        this.version = version;
+    }
+
+    @Override
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append("AtlasEntity{");
+        sb.append("guid='").append(guid).append('\'');
+        sb.append(", status=").append(status);
+        sb.append(", createdBy='").append(createdBy).append('\'');
+        sb.append(", updatedBy='").append(updatedBy).append('\'');
+        dumpDateField(", createTime=", createTime, sb);
+        dumpDateField(", updateTime=", updateTime, sb);
+        sb.append(", version=").append(version);
+        sb.append(", ");
+        super.toString(sb);
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) { return true; }
+        if (o == null || getClass() != o.getClass()) { return false; }
+        if (!super.equals(o)) { return false; }
+
+        AtlasEntity that = (AtlasEntity) o;
+
+        if (guid != null ? !guid.equals(that.guid) : that.guid != null) { return false; }
+        if (status != null ? !status.equals(that.status) : that.status != null) { return false; }
+        if (createdBy != null ? !createdBy.equals(that.createdBy) : that.createdBy != null) { return false; }
+        if (updatedBy != null ? !updatedBy.equals(that.updatedBy) : that.updatedBy != null) { return false; }
+        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) { return false; }
+        if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) { return false; }
+        if (version != null ? !version.equals(that.version) : that.version != null) { return false; }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+
+        result = 31 * result + guid != null ? guid.hashCode() : 0;
+        result = 31 * result + (status != null ? status.hashCode() : 0);
+        result = 31 * result + (createdBy != null ? createdBy.hashCode() : 0);
+        result = 31 * result + (updatedBy != null ? updatedBy.hashCode() : 0);
+        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
+        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
+        result = 31 * result + (version != null ? version.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..6936cdc
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasObjectId.java
@@ -0,0 +1,132 @@
+/**
+ * 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.instance;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+/**
+ * Reference to an object-instance of an Atlas type - like entity.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AtlasObjectId  implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    public static final String KEY_TYPENAME = "typeName";
+    public static final String KEY_GUID     = "guid";
+
+    private String typeName;
+    private String guid;
+
+    public AtlasObjectId() {
+        this(null, null);
+    }
+
+    public AtlasObjectId(String typeName) {
+        this(typeName, null);
+    }
+
+    public AtlasObjectId(String typeName, String guid) {
+        setTypeName(typeName);
+        setGuid(guid);
+    }
+
+    public AtlasObjectId(AtlasObjectId other) {
+        if (other != null) {
+            setTypeName(other.getTypeName());
+            setGuid(other.getGuid());
+        }
+    }
+
+    public AtlasObjectId(Map objIdMap) {
+        if (objIdMap != null) {
+            Object t = objIdMap.get(KEY_TYPENAME);
+            Object g = objIdMap.get(KEY_GUID);
+
+            if (t != null) {
+                setTypeName(t.toString());
+            }
+
+            if (g != null) {
+                setGuid(g.toString());
+            }
+        }
+    }
+
+    public String getTypeName() {
+        return typeName;
+    }
+
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append("AtlasObjectId{");
+        sb.append("typeName='").append(typeName).append('\'');
+        sb.append(", guid='").append(guid).append('\'');
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) { return true; }
+        if (o == null || getClass() != o.getClass()) { return false; }
+
+        AtlasObjectId that = (AtlasObjectId) o;
+
+        if (typeName != null ? !typeName.equals(that.typeName) : that.typeName != null) { return false; }
+        if (guid != null ? !guid.equals(that.guid) : that.guid != null) { return false; }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = typeName != null ? typeName.hashCode() : 0;
+        result = 31 * result + (guid != null ? guid.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..cfe4938
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/instance/AtlasStruct.java
@@ -0,0 +1,230 @@
+/**
+ * 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.instance;
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+
+/**
+ * Captures details of struct contents. Not instantiated directly, used only via AtlasEntity, AtlasClassification.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AtlasStruct implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    public static final String     SERIALIZED_DATE_FORMAT_STR = "yyyyMMdd-HH:mm:ss.SSS-Z";
+    public static final DateFormat DATE_FORMATTER             = new SimpleDateFormat(SERIALIZED_DATE_FORMAT_STR);
+
+    private String              typeName;
+    private Map<String, Object> attributes;
+
+    public AtlasStruct() {
+        this(null, null);
+    }
+
+    public AtlasStruct(String typeName) {
+        this(typeName, null);
+    }
+
+    public AtlasStruct(String typeName, Map<String, Object> attributes) {
+        setTypeName(typeName);
+        setAttributes(attributes);
+    }
+
+    public AtlasStruct(String typeName, String attrName, Object attrValue) {
+        setTypeName(typeName);
+        setAttribute(attrName, attrValue);
+    }
+
+    public AtlasStruct(AtlasStruct other) {
+        if (other != null) {
+            setTypeName(other.getTypeName());
+            setAttributes(other.getAttributes());
+        }
+    }
+
+    public String getTypeName() {
+        return typeName;
+    }
+
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+
+    public Map<String, Object> getAttributes() {
+        return attributes;
+    }
+
+    public void setAttributes(Map<String, Object> attributes) {
+        this.attributes = attributes;
+    }
+
+    public boolean hasAttribute(String name) {
+        Map<String, Object> a = this.attributes;
+
+        return a != null ? a.containsKey(name) : null;
+    }
+
+    public Object getAttribute(String name) {
+        Map<String, Object> a = this.attributes;
+
+        return a != null ? a.get(name) : null;
+    }
+
+    public void setAttribute(String name, Object value) {
+        Map<String, Object> a = this.attributes;
+
+        if (a != null) {
+            a.put(name, value);
+        } else {
+            a = new HashMap<String, Object>();
+            a.put(name, value);
+
+            this.attributes = a;
+        }
+    }
+
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append("AtlasStruct{");
+        sb.append("typeName='").append(typeName).append('\'');
+        sb.append(", attributes=[");
+        dumpObjects(attributes, sb);
+        sb.append("]");
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) { return true; }
+        if (o == null || getClass() != o.getClass()) { return false; }
+
+        AtlasStruct that = (AtlasStruct) o;
+
+        if (typeName != null ? !typeName.equals(that.typeName) : that.typeName != null) { return false; }
+        if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) { return false; }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (typeName != null ? typeName.hashCode() : 0);
+        result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+
+
+    public static StringBuilder dumpModelObjects(Collection<? extends AtlasStruct> objList, StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        if (CollectionUtils.isNotEmpty(objList)) {
+            int i = 0;
+            for (AtlasStruct obj : objList) {
+                if (i > 0) {
+                    sb.append(", ");
+                }
+
+                obj.toString(sb);
+                i++;
+            }
+        }
+
+        return sb;
+    }
+
+    public static StringBuilder dumpObjects(Collection<? extends Object> objects, StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        if (CollectionUtils.isNotEmpty(objects)) {
+            int i = 0;
+            for (Object obj : objects) {
+                if (i > 0) {
+                    sb.append(", ");
+                }
+
+                sb.append(obj);
+                i++;
+            }
+        }
+
+        return sb;
+    }
+
+    public static StringBuilder dumpObjects(Map<? extends Object, ? extends Object> objects, StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        if (MapUtils.isNotEmpty(objects)) {
+            int i = 0;
+            for (Map.Entry<? extends Object, ? extends Object> e : objects.entrySet()) {
+                if (i > 0) {
+                    sb.append(", ");
+                }
+
+                sb.append(e.getKey()).append(":").append(e.getValue());
+                i++;
+            }
+        }
+
+        return sb;
+    }
+
+    public static StringBuilder dumpDateField(String prefix, Date value, StringBuilder sb) {
+        sb.append(prefix);
+
+        if (value == null) {
+            sb.append(value);
+        } else {
+            sb.append(DATE_FORMATTER.format(value));
+        }
+
+        return sb;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..d40354c
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasBaseTypeDef.java
@@ -0,0 +1,353 @@
+/**
+ * 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 java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+
+/**
+ * Base class that captures common-attributes for all Atlas types.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public abstract class AtlasBaseTypeDef implements java.io.Serializable {
+    private static final long serialVersionUID = 1L;
+
+    public static final String ATLAS_TYPE_BOOLEAN        = "boolean";
+    public static final String ATLAS_TYPE_BYTE           = "byte";
+    public static final String ATLAS_TYPE_SHORT          = "short";
+    public static final String ATLAS_TYPE_INT            = "int";
+    public static final String ATLAS_TYPE_LONG           = "long";
+    public static final String ATLAS_TYPE_FLOAT          = "float";
+    public static final String ATLAS_TYPE_DOUBLE         = "double";
+    public static final String ATLAS_TYPE_BIGINTEGER     = "biginteger";
+    public static final String ATLAS_TYPE_BIGDECIMAL     = "bigdecimal";
+    public static final String ATLAS_TYPE_STRING         = "string";
+    public static final String ATLAS_TYPE_DATE           = "date";
+    public static final String ATLAS_TYPE_OBJECT_ID      = "objectid";
+
+    public static final String ATLAS_TYPE_ARRAY_PREFIX    = "array<";
+    public static final String ATLAS_TYPE_ARRAY_SUFFIX    = ">";
+    public static final String ATLAS_TYPE_MAP_PREFIX      = "map<";
+    public static final String ATLAS_TYPE_MAP_KEY_VAL_SEP = ",";
+    public static final String ATLAS_TYPE_MAP_SUFFIX      = ">";
+
+    public static final String ATLAS_TYPE_PROCESS        = "Process";
+    public static final String ATLAS_TYPE_DATASET        = "DataSet";
+    public static final String ATLAS_TYPE_ASSET          = "Asset";
+    public static final String ATLAS_TYPE_INFRASTRUCTURE = "Infrastructure";
+
+    public static final String[] ATLAS_PRIMITIVE_TYPES = {
+        ATLAS_TYPE_BOOLEAN,
+        ATLAS_TYPE_BYTE,
+        ATLAS_TYPE_SHORT,
+        ATLAS_TYPE_INT,
+        ATLAS_TYPE_LONG,
+        ATLAS_TYPE_FLOAT,
+        ATLAS_TYPE_DOUBLE,
+        ATLAS_TYPE_BIGINTEGER,
+        ATLAS_TYPE_BIGDECIMAL,
+        ATLAS_TYPE_STRING,
+    };
+
+    public static final String[] ATLAS_BUILTIN_TYPES = {
+        ATLAS_TYPE_BOOLEAN,
+        ATLAS_TYPE_BYTE,
+        ATLAS_TYPE_SHORT,
+        ATLAS_TYPE_INT,
+        ATLAS_TYPE_LONG,
+        ATLAS_TYPE_FLOAT,
+        ATLAS_TYPE_DOUBLE,
+        ATLAS_TYPE_BIGINTEGER,
+        ATLAS_TYPE_BIGDECIMAL,
+        ATLAS_TYPE_STRING,
+
+        ATLAS_TYPE_DATE,
+        ATLAS_TYPE_OBJECT_ID,
+    };
+
+    public static final String     SERIALIZED_DATE_FORMAT_STR = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+    public static final DateFormat DATE_FORMATTER             = new SimpleDateFormat(SERIALIZED_DATE_FORMAT_STR);
+
+    private String  guid       = null;
+    private String  createdBy  = null;
+    private String  updatedBy  = null;
+    private Date    createTime = null;
+    private Date    updateTime = null;
+    private Long    version    = null;
+    private String  name;
+    private String  description;
+    private String  typeVersion;
+
+    public AtlasBaseTypeDef() {
+        this(null, null, null);
+    }
+
+    public AtlasBaseTypeDef(String name) {
+        this(name, null, null);
+    }
+
+    public AtlasBaseTypeDef(String name, String description) {
+        this(name, description, null);
+    }
+
+    public AtlasBaseTypeDef(String name, String description, String typeVersion) {
+        super();
+
+        setGuid(null);
+        setCreatedBy(null);
+        setUpdatedBy(null);
+        setCreateTime(null);
+        setUpdateTime(null);
+        setVersion(null);
+        setName(name);
+        setDescription(description);
+        setTypeVersion(typeVersion);
+    }
+
+    public AtlasBaseTypeDef(AtlasBaseTypeDef other) {
+        if (other != null) {
+            setGuid(other.getGuid());
+            setCreatedBy(other.getCreatedBy());
+            setUpdatedBy(other.getUpdatedBy());
+            setCreateTime(other.getCreateTime());
+            setUpdateTime(other.getUpdateTime());
+            setVersion(other.getVersion());
+            setName(other.getName());
+            setDescription(other.getDescription());
+            setTypeVersion(other.getTypeVersion());
+        } else {
+            setGuid(null);
+            setCreatedBy(null);
+            setUpdatedBy(null);
+            setCreateTime(null);
+            setUpdateTime(null);
+            setVersion(null);
+            setName(null);
+            setDescription(null);
+            setTypeVersion(null);
+        }
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public String getCreatedBy() {
+        return createdBy;
+    }
+
+    public void setCreatedBy(String createdBy) {
+        this.createdBy = createdBy;
+    }
+
+    public String getUpdatedBy() {
+        return updatedBy;
+    }
+
+    public void setUpdatedBy(String updatedBy) {
+        this.updatedBy = updatedBy;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Long getVersion() {
+        return version;
+    }
+
+    public void setVersion(Long version) {
+        this.version = version;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getTypeVersion() {
+        return typeVersion;
+    }
+
+    public void setTypeVersion(String typeVersion) {
+        this.typeVersion = typeVersion;
+    }
+
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append(", AtlasBaseTypeDef{");
+        sb.append("guid='").append(guid).append('\'');
+        sb.append(", createdBy='").append(createdBy).append('\'');
+        sb.append(", updatedBy='").append(updatedBy).append('\'');
+        dumpDateField(", createTime=", createTime, sb);
+        dumpDateField(", updateTime=", updateTime, sb);
+        sb.append(", version=").append(version);
+        sb.append(", name='").append(name).append('\'');
+        sb.append(", description='").append(description).append('\'');
+        sb.append(", typeVersion='").append(typeVersion).append('\'');
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) { return true; }
+        if (o == null || getClass() != o.getClass()) { return false; }
+
+        AtlasBaseTypeDef that = (AtlasBaseTypeDef) o;
+
+        if (guid != null ? !guid.equals(that.guid) : that.guid != null) { return false; }
+        if (createdBy != null ? !createdBy.equals(that.createdBy) : that.createdBy != null) { return false; }
+        if (updatedBy != null ? !updatedBy.equals(that.updatedBy) : that.updatedBy != null) { return false; }
+        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) { return false; }
+        if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) { return false; }
+        if (version != null ? !version.equals(that.version) : that.version != null) { return false; }
+        if (name != null ? !name.equals(that.name) : that.name != null) { return false; }
+        if (description != null ? !description.equals(that.description) : that.description != null) { return false; }
+        if (typeVersion != null ? !typeVersion.equals(that.typeVersion) : that.typeVersion != null) { return false; }
+
+        return true;
+
+    }
+
+    @Override
+    public int hashCode() {
+        int result = guid != null ? guid.hashCode() : 0;
+        result = 31 * result + (createdBy != null ? createdBy.hashCode() : 0);
+        result = 31 * result + (updatedBy != null ? updatedBy.hashCode() : 0);
+        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
+        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
+        result = 31 * result + (version != null ? version.hashCode() : 0);
+        result = 31 * result + (name != null ? name.hashCode() : 0);
+        result = 31 * result + (description != null ? description.hashCode() : 0);
+        result = 31 * result + (typeVersion != null ? typeVersion.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+
+    public static String getArrayTypeName(String elemTypeName) {
+        return  ATLAS_TYPE_ARRAY_PREFIX + elemTypeName + ATLAS_TYPE_ARRAY_SUFFIX;
+    }
+
+    public static String getMapTypeName(String keyTypeName, String valueTypeName) {
+        return String.format("%s%s%s%s%s", ATLAS_TYPE_MAP_PREFIX, keyTypeName, ATLAS_TYPE_MAP_KEY_VAL_SEP,
+                valueTypeName, ATLAS_TYPE_MAP_SUFFIX);
+    }
+
+    public static StringBuilder dumpObjects(Collection<? extends Object> objects, StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        if (CollectionUtils.isNotEmpty(objects)) {
+            int i = 0;
+            for (Object obj : objects) {
+                if (i > 0) {
+                    sb.append(", ");
+                }
+
+                sb.append(obj);
+                i++;
+            }
+        }
+
+        return sb;
+    }
+
+    public static StringBuilder dumpObjects(Map<? extends Object, ? extends Object> objects, StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        if (MapUtils.isNotEmpty(objects)) {
+            int i = 0;
+            for (Map.Entry<? extends Object, ? extends Object> e : objects.entrySet()) {
+                if (i > 0) {
+                    sb.append(", ");
+                }
+
+                sb.append(e.getKey()).append(":").append(e.getValue());
+                i++;
+            }
+        }
+
+        return sb;
+    }
+
+    public static StringBuilder dumpDateField(String prefix, Date value, StringBuilder sb) {
+        sb.append(prefix);
+
+        if (value == null) {
+            sb.append(value);
+        } else {
+            sb.append(DATE_FORMATTER.format(value));
+        }
+
+        return sb;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..f0188d9
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java
@@ -0,0 +1,169 @@
+/**
+ * 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 java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+
+/**
+ * class that captures details of a classification-type.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AtlasClassificationDef extends AtlasStructDef implements java.io.Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Set<String> superTypes;
+
+
+    public AtlasClassificationDef() {
+        super();
+
+        setSuperTypes(null);
+    }
+
+    public AtlasClassificationDef(String name) {
+        this(name, null, null, null, null);
+    }
+
+    public AtlasClassificationDef(String name, String description) {
+        this(name, description, null, null, null);
+    }
+
+    public AtlasClassificationDef(String name, String description, String typeVersion) {
+        this(name, description, typeVersion, null, null);
+    }
+
+    public AtlasClassificationDef(String name, String description, String typeVersion,
+                                  List<AtlasAttributeDef> attributeDefs) {
+        this(name, description, typeVersion, attributeDefs, null);
+    }
+
+    public AtlasClassificationDef(String name, String description, String typeVersion,
+                                  List<AtlasAttributeDef> attributeDefs, Set<String> superTypes) {
+        super(name, description, typeVersion, attributeDefs);
+
+        setSuperTypes(superTypes);
+    }
+
+    public AtlasClassificationDef(AtlasClassificationDef other) {
+        super(other);
+
+        setSuperTypes(other != null ? other.getSuperTypes() : null);
+    }
+
+    public Set<String> getSuperTypes() {
+        return superTypes;
+    }
+
+    public void setSuperTypes(Set<String> superTypes) {
+        if (superTypes != null && this.superTypes == superTypes) {
+            return;
+        }
+
+        if (CollectionUtils.isEmpty(superTypes)) {
+            this.superTypes = Collections.emptySet();
+        } else {
+            this.superTypes = Collections.unmodifiableSet(new HashSet<String>(superTypes));
+        }
+    }
+
+    public boolean hasSuperType(String typeName) {
+        return hasSuperType(superTypes, typeName);
+    }
+
+    public void addSuperType(String typeName) {
+        Set<String> s = this.superTypes;
+
+        if (!hasSuperType(s, typeName)) {
+            s = new HashSet<String>(s);
+
+            s.add(typeName);
+
+            this.superTypes = Collections.unmodifiableSet(s);
+        }
+    }
+
+    public void removeSuperType(String typeName) {
+        Set<String> s = this.superTypes;
+
+        if (hasSuperType(s, typeName)) {
+            s = new HashSet<String>(s);
+
+            s.remove(typeName);
+
+            this.superTypes = Collections.unmodifiableSet(s);
+        }
+    }
+
+    private static boolean hasSuperType(Set<String> superTypes, String typeName) {
+        return superTypes != null && typeName != null && superTypes.contains(typeName);
+    }
+
+    @Override
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append("AtlasClassificationDef{");
+        super.toString(sb);
+        sb.append(", superTypes=[");
+        dumpObjects(superTypes, sb);
+        sb.append("]");
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) { return true; }
+        if (o == null || getClass() != o.getClass()) { return false; }
+        if (!super.equals(o)) { return false; }
+
+        AtlasClassificationDef that = (AtlasClassificationDef) o;
+
+        if (superTypes != null ? !superTypes.equals(that.superTypes) : that.superTypes != null) { return false; }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (superTypes != null ? superTypes.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..aaa2bac
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java
@@ -0,0 +1,166 @@
+/**
+ * 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 java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+
+/**
+ * class that captures details of a entity-type.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Set<String> superTypes;
+
+
+    public AtlasEntityDef() {
+        this(null, null, null, null, null);
+    }
+
+    public AtlasEntityDef(String name) {
+        this(name, null, null, null, null);
+    }
+
+    public AtlasEntityDef(String name, String description) {
+        this(name, description, null, null, null);
+    }
+
+    public AtlasEntityDef(String name, String description, String typeVersion) {
+        this(name, description, typeVersion, null, null);
+    }
+
+    public AtlasEntityDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs) {
+        this(name, description, typeVersion, attributeDefs, null);
+    }
+
+    public AtlasEntityDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs,
+                          Set<String> superTypes) {
+        super(name, description, typeVersion, attributeDefs);
+
+        setSuperTypes(superTypes);
+    }
+
+    public AtlasEntityDef(AtlasEntityDef other) {
+        super(other);
+
+        setSuperTypes(other != null ? other.getSuperTypes() : null);
+    }
+
+    public Set<String> getSuperTypes() {
+        return superTypes;
+    }
+
+    public void setSuperTypes(Set<String> superTypes) {
+        if (superTypes != null && this.superTypes == superTypes) {
+            return;
+        }
+
+        if (CollectionUtils.isEmpty(superTypes)) {
+            this.superTypes = Collections.emptySet();
+        } else {
+            this.superTypes = Collections.unmodifiableSet(new HashSet<String>(superTypes));
+        }
+    }
+
+    public boolean hasSuperType(String typeName) {
+        return hasSuperType(superTypes, typeName);
+    }
+
+    public void addSuperType(String typeName) {
+        Set<String> s = this.superTypes;
+
+        if (!hasSuperType(s, typeName)) {
+            s = new HashSet<String>(s);
+
+            s.add(typeName);
+
+            this.superTypes = Collections.unmodifiableSet(s);
+        }
+    }
+
+    public void removeSuperType(String typeName) {
+        Set<String> s = this.superTypes;
+
+        if (hasSuperType(s, typeName)) {
+            s = new HashSet<String>(s);
+
+            s.remove(typeName);
+
+            this.superTypes = Collections.unmodifiableSet(s);
+        }
+    }
+
+    private static boolean hasSuperType(Set<String> superTypes, String typeName) {
+        return superTypes != null && typeName != null && superTypes.contains(typeName);
+    }
+
+    @Override
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append("AtlasEntityDef{");
+        super.toString(sb);
+        sb.append(", superTypes=[");
+        dumpObjects(superTypes, sb);
+        sb.append("]");
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) { return true; }
+        if (o == null || getClass() != o.getClass()) { return false; }
+        if (!super.equals(o)) { return false; }
+
+        AtlasEntityDef that = (AtlasEntityDef) o;
+
+        if (superTypes != null ? !superTypes.equals(that.superTypes) : that.superTypes != null) { return false; }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (superTypes != null ? superTypes.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/698a5652/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
new file mode 100644
index 0000000..5347461
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasEnumDef.java
@@ -0,0 +1,335 @@
+/**
+ * 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 java.io.Serializable;
+import java.util.*;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.hadoop.util.StringUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+
+/**
+ * class that captures details of an enum-type.
+ */
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private List<AtlasEnumElementDef> elementDefs;
+    private String                    defaultValue;
+
+    public AtlasEnumDef() {
+        super();
+
+        setElementDefs(null);
+        setDefaultValue(null);
+    }
+
+    public AtlasEnumDef(String name) {
+        this(name, null, null, null, null);
+    }
+
+    public AtlasEnumDef(String name, String description) {
+        this(name, description, null, null, null);
+    }
+
+    public AtlasEnumDef(String name, String description, String typeVersion) {
+        this(name, description, typeVersion, null, null);
+    }
+
+    public AtlasEnumDef(String name, String description, List<AtlasEnumElementDef> elementDefs) {
+        this(name, description, null, elementDefs, null);
+    }
+
+    public AtlasEnumDef(String name, String description, String typeVersion, List<AtlasEnumElementDef> elementDefs) {
+        this(name, description, typeVersion, elementDefs, null);
+    }
+
+    public AtlasEnumDef(String name, String description, String typeVersion, List<AtlasEnumElementDef> elementDefs,
+                        String defaultValue) {
+        super(name, description, typeVersion);
+
+        setElementDefs(elementDefs);
+        setDefaultValue(defaultValue);
+    }
+
+    public AtlasEnumDef(AtlasEnumDef other) {
+        super(other);
+
+        if (other != null) {
+            setElementDefs(other.getElementDefs());
+            setDefaultValue(other.getDefaultValue());
+        }
+    }
+
+    public List<AtlasEnumElementDef> getElementDefs() {
+        return elementDefs;
+    }
+
+    public void setElementDefs(List<AtlasEnumElementDef> elementDefs) {
+        if (elementDefs != null && this.elementDefs == elementDefs) {
+            return;
+        }
+
+        if (CollectionUtils.isEmpty(elementDefs)) {
+            this.elementDefs = Collections.emptyList();
+        } else {
+            // if multiple elements with same value are present, keep only the last entry
+            List<AtlasEnumElementDef> tmpList       = new ArrayList<AtlasEnumElementDef>(elementDefs.size());
+            Set<String>               elementValues = new HashSet<String>();
+
+            ListIterator<AtlasEnumElementDef> iter = elementDefs.listIterator(elementDefs.size());
+            while (iter.hasPrevious()) {
+                AtlasEnumElementDef elementDef   = iter.previous();
+                String              elementValue = elementDef != null ? elementDef.getValue() : null;
+
+                if (elementValue != null) {
+                    elementValue = elementValue.toLowerCase();
+
+                    if (!elementValues.contains(elementValue)) {
+                        tmpList.add(new AtlasEnumElementDef(elementDef));
+
+                        elementValues.add(elementValue);
+                    }
+                }
+            }
+            Collections.reverse(tmpList);
+
+            this.elementDefs = Collections.unmodifiableList(tmpList);
+        }
+    }
+
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+
+    public void setDefaultValue(String value) {
+        this.defaultValue = value;
+    }
+
+    public AtlasEnumElementDef getElement(String elemValue) {
+        return findElement(this.elementDefs, elemValue);
+    }
+
+    public void addElement(AtlasEnumElementDef elementDef) {
+        List<AtlasEnumElementDef> e = this.elementDefs;
+
+        List<AtlasEnumElementDef> tmpList = new ArrayList<AtlasEnumElementDef>();
+        if (CollectionUtils.isNotEmpty(e)) {
+            // copy existing elements, except ones having same value as the element being added
+            for (AtlasEnumElementDef existingElem : e) {
+                if (!StringUtils.equalsIgnoreCase(existingElem.getValue(), elementDef.getValue())) {
+                    tmpList.add(existingElem);
+                }
+            }
+        }
+        tmpList.add(new AtlasEnumElementDef(elementDef));
+
+        this.elementDefs = Collections.unmodifiableList(tmpList);
+    }
+
+    public void removeElement(String elemValue) {
+        List<AtlasEnumElementDef> e = this.elementDefs;
+
+        // if element doesn't exist, no need to create the tmpList below
+        if (hasElement(e, elemValue)) {
+            List<AtlasEnumElementDef> tmpList = new ArrayList<AtlasEnumElementDef>();
+
+            // copy existing elements, except ones having same value as the element being removed
+            for (AtlasEnumElementDef existingElem : e) {
+                if (!StringUtils.equalsIgnoreCase(existingElem.getValue(), elemValue)) {
+                    tmpList.add(existingElem);
+                }
+            }
+
+            this.elementDefs = Collections.unmodifiableList(tmpList);
+        }
+    }
+
+    public boolean hasElement(String elemValue) {
+        return getElement(elemValue) != null;
+    }
+
+    private static boolean hasElement(List<AtlasEnumElementDef> elementDefs, String elemValue) {
+        return findElement(elementDefs, elemValue) != null;
+    }
+
+    private static AtlasEnumElementDef findElement(List<AtlasEnumElementDef> elementDefs, String elemValue) {
+        AtlasEnumElementDef ret = null;
+
+        if (CollectionUtils.isNotEmpty(elementDefs)) {
+            for (AtlasEnumElementDef elementDef : elementDefs) {
+                if (StringUtils.equalsIgnoreCase(elementDef.getValue(), elemValue)) {
+                    ret = elementDef;
+                    break;
+                }
+            }
+        }
+
+        return ret;
+    }
+
+    @Override
+    public StringBuilder toString(StringBuilder sb) {
+        if (sb == null) {
+            sb = new StringBuilder();
+        }
+
+        sb.append("AtlasEnumDef{");
+        super.toString(sb);
+        sb.append(", elementDefs=[");
+        dumpObjects(elementDefs, sb);
+        sb.append("]");
+        sb.append('}');
+
+        return sb;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) { return true; }
+        if (o == null || getClass() != o.getClass()) { return false; }
+        if (!super.equals(o)) { return false; }
+
+        AtlasEnumDef that = (AtlasEnumDef) o;
+
+        if (elementDefs != null ? !elementDefs.equals(that.elementDefs) : that.elementDefs != null) { return false; }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (elementDefs != null ? elementDefs.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return toString(new StringBuilder()).toString();
+    }
+
+
+    /**
+     * class that captures details of an enum-element.
+     */
+    @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+    @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+    @JsonIgnoreProperties(ignoreUnknown=true)
+    public static class AtlasEnumElementDef implements Serializable {
+        private static final long serialVersionUID = 1L;
+
+        private String  value;
+        private String  description;
+        private Integer ordinal;
+
+        public AtlasEnumElementDef() {
+            this(null, null, null);
+        }
+
+        public AtlasEnumElementDef(String value, String description, Integer ordinal) {
+            setValue(value);
+            setDescription(description);
+            setOrdinal(ordinal);
+        }
+
+        public AtlasEnumElementDef(AtlasEnumElementDef other) {
+            if (other != null) {
+                setValue(other.getValue());
+                setDescription(other.getDescription());
+                setOrdinal(other.getOrdinal());
+            }
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public void setValue(String value) {
+            this.value = value;
+        }
+
+        public String getDescription() {
+            return description;
+        }
+
+        public void setDescription(String description) {
+            this.description = description;
+        }
+
+        public Integer getOrdinal() {
+            return ordinal;
+        }
+
+        public void setOrdinal(Integer ordinal) {
+            this.ordinal = ordinal;
+        }
+
+        public StringBuilder toString(StringBuilder sb) {
+            if (sb == null) {
+                sb = new StringBuilder();
+            }
+
+            sb.append("AtlasEnumElementDef{");
+            sb.append("value='").append(value).append('\'');
+            sb.append(", description='").append(description).append('\'');
+            sb.append(", ordinal=").append(ordinal);
+            sb.append('}');
+
+            return sb;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) { return true; }
+            if (o == null || getClass() != o.getClass()) { return false; }
+
+            AtlasEnumElementDef that = (AtlasEnumElementDef) o;
+
+            if (value != null ? !value.equals(that.value) : that.value != null) { return false; }
+            if (description != null ? !description.equals(that.description) : that.description != null) {
+                return false;
+            }
+            if (ordinal != null ? !ordinal.equals(that.ordinal) : that.ordinal != null) { return false; }
+
+            return true;
+        }
+
+        @Override
+        public int hashCode() {
+            int result = value != null ? value.hashCode() : 0;
+            result = 31 * result + (description != null ? description.hashCode() : 0);
+            result = 31 * result + (ordinal != null ? ordinal.hashCode() : 0);
+            return result;
+        }
+
+        @Override
+        public String toString() {
+            return toString(new StringBuilder()).toString();
+        }
+    }
+}


Mime
View raw message