You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/09/11 21:34:29 UTC

[1/5] atlas git commit: ATLAS-1218: Atlas says it is started but does not accept REST requests

Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 7299815d1 -> 5ca7955a1


ATLAS-1218: Atlas says it is started but does not accept REST requests

Signed-off-by: Madhan Neethiraj <ma...@apache.org>
(cherry picked from commit cba5f7622b0724b158e93ac3d9cd7bd8de6d4c2b)


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

Branch: refs/heads/branch-0.8
Commit: 97ce63ec7c596f80978a07d5bbc7875f55bf4ff3
Parents: 7299815
Author: Richard Ding <rd...@yahoo-inc.com>
Authored: Sat Aug 26 02:06:59 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Sep 11 11:37:08 2017 -0700

----------------------------------------------------------------------
 distro/src/bin/atlas_config.py | 51 +++++++++++++++++++++++++++++++++++++
 distro/src/bin/atlas_start.py  |  4 +--
 2 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/97ce63ec/distro/src/bin/atlas_config.py
----------------------------------------------------------------------
diff --git a/distro/src/bin/atlas_config.py b/distro/src/bin/atlas_config.py
index 1be9ca2..ada5743 100755
--- a/distro/src/bin/atlas_config.py
+++ b/distro/src/bin/atlas_config.py
@@ -23,6 +23,7 @@ import subprocess
 import sys
 import time
 import errno
+import socket
 from re import split
 from time import sleep
 
@@ -65,6 +66,11 @@ SOLR_INDEX_CONF_ENTRY="atlas.graph.index.search.backend\s*=\s*solr5"
 SOLR_INDEX_LOCAL_CONF_ENTRY="atlas.graph.index.search.solr.zookeeper-url\s*=\s*localhost"
 SOLR_INDEX_ZK_URL="atlas.graph.index.search.solr.zookeeper-url"
 TOPICS_TO_CREATE="atlas.notification.topics"
+ATLAS_HTTP_PORT="atlas.server.http.port"
+ATLAS_HTTPS_PORT="atlas.server.https.port"
+DEFAULT_ATLAS_HTTP_PORT="21000"
+DEFAULT_ATLAS_HTTPS_PORT="21443"
+ATLAS_ENABLE_TLS="atlas.enableTLS"
 
 DEBUG = False
 
@@ -442,6 +448,45 @@ def get_topics_to_create(confdir):
         topics = ["ATLAS_HOOK", "ATLAS_ENTITIES"]
     return topics
 
+def get_atlas_url_port(confdir):
+    port = None
+    if '-port' in sys.argv:
+        port = sys.argv[sys.argv.index('-port')+1]
+
+    if port is None:
+        confdir = os.path.join(confdir, CONF_FILE)
+        enable_tls = getConfig(confdir, ATLAS_ENABLE_TLS)
+        if enable_tls is not None and enable_tls.lower() == 'true':
+            port = getConfigWithDefault(confdir, ATLAS_HTTPS_PORT, DEFAULT_ATLAS_HTTPS_PORT)
+        else:
+            port = getConfigWithDefault(confdir, ATLAS_HTTP_PORT, DEFAULT_ATLAS_HTTP_PORT)
+
+    print "starting atlas on port %s" % port
+    return port
+
+def wait_for_startup(confdir, wait):
+    count = 0
+    port = get_atlas_url_port(confdir)
+    while True:
+        try:
+            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+            s.settimeout(1)
+            s.connect(('localhost', int(port)))
+            s.close()
+            break
+        except Exception as e:
+            # Wait for 1 sec before next ping
+            sys.stdout.write('.')
+            sys.stdout.flush()
+            sleep(1)
+
+        if count > wait:
+            s.close()
+            break
+
+        count = count + 1
+
+    sys.stdout.write('\n')
 
 def run_solr(dir, action, zk_url = None, port = None, logdir = None, wait=True):
 
@@ -525,6 +570,12 @@ def getConfig(file, key):
             return line.split('=')[1].strip()
     return None
 
+def getConfigWithDefault(file, key, defaultValue):
+    value = getConfig(file, key)
+    if value is None:
+        value = defaultValue
+    return value
+
 def isCygwin():
     return platform.system().startswith("CYGWIN")
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/97ce63ec/distro/src/bin/atlas_start.py
----------------------------------------------------------------------
diff --git a/distro/src/bin/atlas_start.py b/distro/src/bin/atlas_start.py
index a6a3455..5ea93fc 100755
--- a/distro/src/bin/atlas_start.py
+++ b/distro/src/bin/atlas_start.py
@@ -131,6 +131,8 @@ def main():
         web_app_path = mc.convertCygwinPath(web_app_path)
     if not is_setup:
         start_atlas_server(atlas_classpath, atlas_pid_file, jvm_logdir, jvm_opts_list, web_app_path)
+        mc.wait_for_startup(confdir, 300)
+        print "Apache Atlas Server started!!!\n"
     else:
         process = mc.java("org.apache.atlas.web.setup.AtlasSetup", [], atlas_classpath, jvm_opts_list, jvm_logdir)
         return process.wait()
@@ -141,8 +143,6 @@ def start_atlas_server(atlas_classpath, atlas_pid_file, jvm_logdir, jvm_opts_lis
     args.extend(sys.argv[1:])
     process = mc.java("org.apache.atlas.Atlas", args, atlas_classpath, jvm_opts_list, jvm_logdir)
     mc.writePid(atlas_pid_file, process)
-    print "Apache Atlas Server started!!!\n"
-
 
 if __name__ == '__main__':
     try:


[2/5] atlas git commit: ATLAS-2071 : UI : Minification of atlas code (js, css)

Posted by ma...@apache.org.
ATLAS-2071 : UI : Minification of atlas code (js,css)

(cherry picked from commit a32e2b2e7f043740f2a282607ef356f8fea38bbf)


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

Branch: refs/heads/branch-0.8
Commit: 565213d4ea721202c90bd5a38099bf221dc7ec84
Parents: 97ce63e
Author: kevalbhatt <kb...@apache.org>
Authored: Thu Aug 24 17:54:46 2017 +0530
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Sep 11 11:39:08 2017 -0700

----------------------------------------------------------------------
 dashboardv2/gruntfile.js                    |  7 ++++---
 dashboardv2/pom.xml                         | 11 +----------
 docs/src/site/twiki/InstallationSteps.twiki | 10 ++++++++++
 pom.xml                                     |  7 +++++++
 4 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/565213d4/dashboardv2/gruntfile.js
----------------------------------------------------------------------
diff --git a/dashboardv2/gruntfile.js b/dashboardv2/gruntfile.js
index 12af6fd..900ee40 100644
--- a/dashboardv2/gruntfile.js
+++ b/dashboardv2/gruntfile.js
@@ -224,6 +224,9 @@ module.exports = function(grunt) {
         },
         uglify: {
             build: {
+                options: {
+                    sourceMap: true
+                },
                 files: [{
                     expand: true,
                     cwd: 'dist/js',
@@ -307,7 +310,6 @@ module.exports = function(grunt) {
         'sass:dist',
         'uglify:build',
         'cssmin:build',
-        'htmlmin:build',
         'configureProxies:server',
         'connect:server',
         'watch'
@@ -321,7 +323,6 @@ module.exports = function(grunt) {
         'copy:build',
         'sass:build',
         'uglify:build',
-        'cssmin:build',
-        'htmlmin:build'
+        'cssmin:build'
     ]);
 };
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/565213d4/dashboardv2/pom.xml
----------------------------------------------------------------------
diff --git a/dashboardv2/pom.xml b/dashboardv2/pom.xml
index 7c5c2bc..f40a315 100644
--- a/dashboardv2/pom.xml
+++ b/dashboardv2/pom.xml
@@ -108,21 +108,12 @@
                         </configuration>
                     </execution>
                     <execution>
-                        <id>npm remaining</id>
-                        <goals>
-                            <goal>npm</goal>
-                        </goals>
-                        <configuration>
-                            <arguments>install --ignore-scripts</arguments>
-                        </configuration>
-                    </execution>
-                    <execution>
                         <id>grunt dist</id>
                         <goals>
                             <goal>grunt</goal>
                         </goals>
                         <configuration>
-                            <arguments>build</arguments>
+                            <arguments>${project.build.dashboardv2.gruntBuild}</arguments>
                         </configuration>
                     </execution>
                 </executions>

http://git-wip-us.apache.org/repos/asf/atlas/blob/565213d4/docs/src/site/twiki/InstallationSteps.twiki
----------------------------------------------------------------------
diff --git a/docs/src/site/twiki/InstallationSteps.twiki b/docs/src/site/twiki/InstallationSteps.twiki
index 0934495..417df11 100644
--- a/docs/src/site/twiki/InstallationSteps.twiki
+++ b/docs/src/site/twiki/InstallationSteps.twiki
@@ -121,6 +121,16 @@ Also, a standalone instance of Solr can be started as the default search indexin
 indexing for a different Solr instance please see "Graph Search Index - Solr" in the
 [[Configuration][Configuration]] section.
 
+To build a distribution without minified js,css file, build with the skipMinify profile.
+
+<verbatim>
+
+mvn clean package -Pdist,skipMinify
+
+</verbatim>
+
+Note that by default js and css files are minified.
+
 ---+++ Installing & Running Atlas
 
 ---++++ Installing Atlas

http://git-wip-us.apache.org/repos/asf/atlas/blob/565213d4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1d33e7c..d255097 100644
--- a/pom.xml
+++ b/pom.xml
@@ -565,6 +565,7 @@
         <atlas.surefire.options></atlas.surefire.options>
 
         <aspectj.runtime.version>1.8.7</aspectj.runtime.version>
+        <project.build.dashboardv2.gruntBuild>build-minify</project.build.dashboardv2.gruntBuild>
     </properties>
 
     <profiles>
@@ -614,6 +615,12 @@
                 </dependencies>
             </dependencyManagement>
         </profile>
+        <profile>
+            <id>skipMinify</id>
+            <properties>
+                <project.build.dashboardv2.gruntBuild>build</project.build.dashboardv2.gruntBuild>
+            </properties>
+        </profile>
     </profiles>
 
     <modules>


[4/5] atlas git commit: ATLAS-2085: HA initialization fix

Posted by ma...@apache.org.
ATLAS-2085: HA initialization fix

(cherry picked from commit 2f6d7b2491140a5efd5a9fae5b8aaf3ccee5b514)


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

Branch: refs/heads/branch-0.8
Commit: 711baea940feef632fcacc5605505ff4c3d5b5fc
Parents: 16a02fc
Author: Madhan Neethiraj <ma...@apache.org>
Authored: Wed Aug 23 19:34:31 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Sep 11 13:00:29 2017 -0700

----------------------------------------------------------------------
 addons/models/0010-base_model.json              | 18 +++++-
 .../apache/atlas/catalog/DefaultTypeSystem.java | 30 ----------
 .../graph/GraphBackedSearchIndexer.java         | 53 ++++++++++--------
 .../bootstrap/AtlasTypeDefStoreInitializer.java | 58 +++++++++++++++++---
 .../store/graph/AtlasTypeDefGraphStore.java     | 22 ++------
 .../graph/v1/AtlasTypeDefGraphStoreV1.java      | 16 +-----
 .../graph/GraphBackedSearchIndexerMockTest.java |  8 ---
 7 files changed, 104 insertions(+), 101 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/711baea9/addons/models/0010-base_model.json
----------------------------------------------------------------------
diff --git a/addons/models/0010-base_model.json b/addons/models/0010-base_model.json
index 7f64d85..9ab4c44 100644
--- a/addons/models/0010-base_model.json
+++ b/addons/models/0010-base_model.json
@@ -1,7 +1,23 @@
 {
     "enumDefs": [],
     "structDefs": [],
-    "classificationDefs": [],
+    "classificationDefs": [
+        {
+            "name": "TaxonomyTerm",
+            "superTypes": [],
+            "typeVersion": "1.0",
+            "attributeDefs": [
+                {
+                    "name": "atlas.taxonomy",
+                    "typeName": "string",
+                    "cardinality": "SINGLE",
+                    "isIndexable": false,
+                    "isOptional": true,
+                    "isUnique": false
+                }
+            ]
+        }
+    ],
     "entityDefs": [
         {
             "name": "Referenceable",

http://git-wip-us.apache.org/repos/asf/atlas/blob/711baea9/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java b/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
index eabd272..888818e 100644
--- a/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
+++ b/catalog/src/main/java/org/apache/atlas/catalog/DefaultTypeSystem.java
@@ -26,7 +26,6 @@ import org.apache.atlas.catalog.definition.ResourceDefinition;
 import org.apache.atlas.catalog.exception.CatalogRuntimeException;
 import org.apache.atlas.catalog.exception.ResourceAlreadyExistsException;
 import org.apache.atlas.catalog.exception.ResourceNotFoundException;
-import org.apache.atlas.classification.InterfaceAudience;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
@@ -36,7 +35,6 @@ import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.repository.converters.TypeConverterUtil;
 import org.apache.atlas.services.MetadataService;
 import org.apache.atlas.store.AtlasTypeDefStore;
-import org.apache.atlas.type.AtlasTypeUtil;
 import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
@@ -70,34 +68,6 @@ public class DefaultTypeSystem implements AtlasTypeSystem {
     public DefaultTypeSystem(MetadataService metadataService, AtlasTypeDefStore typeDefStore) throws AtlasBaseException {
         this.metadataService = metadataService;
         this.typeDefStore = typeDefStore;
-        //Create namespace
-        createSuperTypes();
-    }
-
-    @InterfaceAudience.Private
-    private void createSuperTypes() throws AtlasBaseException {
-
-        AtlasClassificationDef termClassification = AtlasTypeUtil.createTraitTypeDef(TaxonomyResourceProvider.TAXONOMY_TERM_TYPE, TaxonomyResourceProvider.TAXONOMY_TERM_TYPE,
-            ImmutableSet.<String>of(), AtlasTypeUtil.createOptionalAttrDef(TaxonomyResourceProvider.NAMESPACE_ATTRIBUTE_NAME, "string"));
-
-        createTraitType(termClassification);
-    }
-
-    private void createTraitType(AtlasClassificationDef classificationDef) throws AtlasBaseException {
-        try {
-            typeDefStore.getClassificationDefByName(classificationDef.getName());
-        } catch (AtlasBaseException tne) {
-            //Type not found . Create
-            if (tne.getAtlasErrorCode() == AtlasErrorCode.TYPE_NAME_NOT_FOUND) {
-                AtlasTypesDef typesDef = new AtlasTypesDef(ImmutableList.<AtlasEnumDef>of(), ImmutableList.<AtlasStructDef>of(),
-                    ImmutableList.of(classificationDef),
-                    ImmutableList.<AtlasEntityDef>of());
-
-                typeDefStore.createTypesDef(typesDef);
-            } else {
-                throw tne;
-            }
-        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/atlas/blob/711baea9/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
index 632b479..be6a0a0 100755
--- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
@@ -132,19 +132,20 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang
         AtlasGraphManagement management = graph.getManagementSystem();
 
         try {
-            if (management.containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY)) {
-                LOG.info("Global indexes already exist for graph");
-                management.commit();
+            LOG.info("Creating indexes for graph.");
 
-                return;
+            if (management.getGraphIndex(Constants.VERTEX_INDEX) == null) {
+                management.createVertexIndex(Constants.VERTEX_INDEX, Constants.BACKING_INDEX, Collections.<AtlasPropertyKey>emptyList());
+
+                LOG.info("Created index {}", Constants.VERTEX_INDEX);
             }
 
-            /* This is called only once, which is the first time Atlas types are made indexable .*/
-            LOG.info("Indexes do not exist, Creating indexes for graph.");
+            if (management.getGraphIndex(Constants.EDGE_INDEX) == null) {
+                management.createEdgeIndex(Constants.EDGE_INDEX, Constants.BACKING_INDEX);
+
+                LOG.info("Created index {}", Constants.EDGE_INDEX);
+            }
 
-            
-            management.createVertexIndex(Constants.VERTEX_INDEX, Constants.BACKING_INDEX, Collections.<AtlasPropertyKey>emptyList());              
-            management.createEdgeIndex(Constants.EDGE_INDEX, Constants.BACKING_INDEX);
 
             // create a composite index for guid as its unique
             createIndexes(management, Constants.GUID_PROPERTY_KEY, String.class, true,
@@ -200,11 +201,14 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang
     }
 
     private void createFullTextIndex(AtlasGraphManagement management) {
-        AtlasPropertyKey fullText =
-                management.makePropertyKey(Constants.ENTITY_TEXT_PROPERTY_KEY, String.class, AtlasCardinality.SINGLE);
+        if (!management.containsPropertyKey(Constants.ENTITY_TEXT_PROPERTY_KEY)) {
+            AtlasPropertyKey fullText =
+                    management.makePropertyKey(Constants.ENTITY_TEXT_PROPERTY_KEY, String.class, AtlasCardinality.SINGLE);
 
-        management.createFullTextIndex(Constants.FULLTEXT_INDEX, fullText, Constants.BACKING_INDEX);
+            management.createFullTextIndex(Constants.FULLTEXT_INDEX, fullText, Constants.BACKING_INDEX);
 
+            LOG.info("Created index {}", Constants.ENTITY_TEXT_PROPERTY_KEY);
+        }
     }
 
     private void createTypeStoreIndexes(AtlasGraphManagement management) {
@@ -516,17 +520,21 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang
             propertyKey = management.makePropertyKey(propertyName, propertyClass, cardinality);
 
             updateVertexIndex(management, propertyName, propertyClass, cardinality, propertyKey);
-
         }
 
-        if (createCompositeForAttribute) {
-            createExactMatchIndex(management, propertyClass, propertyKey, isUnique);
-        } else if (createCompositeWithTypeandSuperTypes) {
-            // Index with typename since typename+property key queries need to
-            // speed up
-            createExactMatchIndexWithTypeName(management, propertyClass, propertyKey);
-            createExactMatchIndexWithSuperTypeName(management, propertyClass, propertyKey);
+        if (propertyKey != null) {
+            if (createCompositeForAttribute) {
+                createExactMatchIndex(management, propertyClass, propertyKey, isUnique);
+            } else if (createCompositeWithTypeandSuperTypes) {
+                // Index with typename since typename+property key queries need to
+                // speed up
+                createExactMatchIndexWithTypeName(management, propertyClass, propertyKey);
+                createExactMatchIndexWithSuperTypeName(management, propertyClass, propertyKey);
+            }
+        } else {
+            LOG.warn("Index not created for {}: propertyKey is null", propertyName);
         }
+
         return propertyKey;
     }
     
@@ -542,9 +550,9 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang
         AtlasGraphIndex existingIndex = management.getGraphIndex(propertyName);
         if (existingIndex == null) {
             management.createExactMatchIndex(propertyName, enforceUniqueness, Collections.singletonList(propertyKey));
-        }
 
-        LOG.info("Created composite index for property {} of type {}; isUnique={} ", propertyName, propertyClass.getName(), enforceUniqueness);
+            LOG.info("Created composite index for property {} of type {}; isUnique={} ", propertyName, propertyClass.getName(), enforceUniqueness);
+        }
     }
     
 
@@ -578,7 +586,6 @@ public class GraphBackedSearchIndexer implements SearchIndexer, ActiveStateChang
         AtlasGraphIndex existingIndex = management.getGraphIndex(indexName);
 
         if (existingIndex == null) {
-            
             List<AtlasPropertyKey> keys = new ArrayList<>(2);
             keys.add(propertyKey);
             keys.add(typePropertyKey);

http://git-wip-us.apache.org/repos/asf/atlas/blob/711baea9/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
index 3cb0f7e..93e382c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
@@ -18,7 +18,10 @@
 package org.apache.atlas.repository.store.bootstrap;
 
 import org.apache.atlas.AtlasErrorCode;
+import org.apache.atlas.AtlasException;
 import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.ha.HAConfiguration;
+import org.apache.atlas.listener.ActiveStateChangeHandler;
 import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
@@ -32,6 +35,7 @@ import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
+import org.apache.commons.configuration.Configuration;
 import org.apache.commons.lang.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.codehaus.jackson.annotate.JsonAutoDetect;
@@ -62,27 +66,41 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONL
  * Class that handles initial loading of models and patches into typedef store
  */
 @Service
-public class AtlasTypeDefStoreInitializer {
+public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefStoreInitializer.class);
 
     private final AtlasTypeDefStore atlasTypeDefStore;
     private final AtlasTypeRegistry atlasTypeRegistry;
+    private final Configuration     conf;
+
 
     @Inject
-    public AtlasTypeDefStoreInitializer(AtlasTypeDefStore atlasTypeDefStore, AtlasTypeRegistry atlasTypeRegistry) {
+    public AtlasTypeDefStoreInitializer(AtlasTypeDefStore atlasTypeDefStore, AtlasTypeRegistry atlasTypeRegistry, Configuration conf) {
         this.atlasTypeDefStore = atlasTypeDefStore;
         this.atlasTypeRegistry = atlasTypeRegistry;
+        this.conf              = conf;
     }
 
     @PostConstruct
-    public void init() {
-        String atlasHomeDir = System.getProperty("atlas.home");
-        String typesDirName = (StringUtils.isEmpty(atlasHomeDir) ? "." : atlasHomeDir) + File.separator + "models";
+    public void init() throws AtlasBaseException {
+        LOG.info("==> AtlasTypeDefStoreInitializer.init()");
+
+        if (!HAConfiguration.isHAEnabled(conf)) {
+            atlasTypeDefStore.init();
+
+            loadBootstrapTypeDefs();
+        } else {
+            LOG.info("AtlasTypeDefStoreInitializer.init(): deferring type loading until instance activation");
+        }
 
-        initializeStore(typesDirName);
+        LOG.info("<== AtlasTypeDefStoreInitializer.init()");
     }
 
-    private void initializeStore(String typesDirName) {
+    private void loadBootstrapTypeDefs() {
+        LOG.info("==> AtlasTypeDefStoreInitializer.loadBootstrapTypeDefs()");
+
+        String atlasHomeDir = System.getProperty("atlas.home");
+        String typesDirName = (StringUtils.isEmpty(atlasHomeDir) ? "." : atlasHomeDir) + File.separator + "models";
         File   typesDir     = new File(typesDirName);
         File[] typeDefFiles = typesDir.exists() ? typesDir.listFiles() : null;
 
@@ -127,6 +145,8 @@ public class AtlasTypeDefStoreInitializer {
         }
 
         applyTypePatches(typesDirName);
+
+        LOG.info("<== AtlasTypeDefStoreInitializer.loadBootstrapTypeDefs()");
     }
 
     public static AtlasTypesDef getTypesToCreate(AtlasTypesDef typesDef, AtlasTypeRegistry typeRegistry) {
@@ -237,6 +257,28 @@ public class AtlasTypeDefStoreInitializer {
         return typesToUpdate;
     }
 
+    @Override
+    public void instanceIsActive() throws AtlasException {
+        LOG.info("==> AtlasTypeDefStoreInitializer.instanceIsActive()");
+
+        try {
+            atlasTypeDefStore.init();
+
+            loadBootstrapTypeDefs();
+        } catch (AtlasBaseException e) {
+            LOG.error("Failed to init after becoming active", e);
+        }
+
+        LOG.info("<== AtlasTypeDefStoreInitializer.instanceIsActive()");
+    }
+
+    @Override
+    public void instanceIsPassive() throws AtlasException {
+        LOG.info("==> AtlasTypeDefStoreInitializer.instanceIsPassive()");
+
+        LOG.info("<== AtlasTypeDefStoreInitializer.instanceIsPassive()");
+    }
+
     private static boolean updateTypeAttributes(AtlasStructDef oldStructDef, AtlasStructDef newStructDef, boolean checkTypeVersion) {
         boolean ret = isTypeUpdateApplicable(oldStructDef, newStructDef, checkTypeVersion);
 
@@ -642,4 +684,4 @@ public class AtlasTypeDefStoreInitializer {
             }
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/711baea9/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
index 8aafdf4..d024bfd 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
@@ -18,11 +18,9 @@
 package org.apache.atlas.repository.store.graph;
 
 import org.apache.atlas.AtlasErrorCode;
-import org.apache.atlas.AtlasException;
 import org.apache.atlas.GraphTransactionInterceptor;
 import org.apache.atlas.annotation.GraphTransaction;
 import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.listener.ActiveStateChangeHandler;
 import org.apache.atlas.listener.ChangedTypeDefs;
 import org.apache.atlas.listener.TypeDefChangeListener;
 import org.apache.atlas.model.SearchFilter;
@@ -63,7 +61,7 @@ import static org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreIniti
 /**
  * Abstract class for graph persistence store for TypeDef
  */
-public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, ActiveStateChangeHandler {
+public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
 
     private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeDefGraphStore.class);
 
@@ -88,6 +86,8 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
 
     @Override
     public void init() throws AtlasBaseException {
+        LOG.info("==> AtlasTypeDefGraphStore.init()");
+
         AtlasTransientTypeRegistry ttr           = null;
         boolean                    commitUpdates = false;
 
@@ -108,6 +108,8 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
             commitUpdates = true;
         } finally {
             typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates);
+
+            LOG.info("<== AtlasTypeDefGraphStore.init()");
         }
     }
 
@@ -583,20 +585,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
         return getTypeDefFromType(type);
     }
 
-    @Override
-    public void instanceIsActive() throws AtlasException {
-        try {
-            init();
-        } catch (AtlasBaseException e) {
-            LOG.error("Failed to init after becoming active", e);
-        }
-    }
-
-    @Override
-    public void instanceIsPassive() throws AtlasException {
-        LOG.info("Not reacting to a Passive state change");
-    }
-
     private AtlasBaseTypeDef getTypeDefFromType(AtlasType type) throws AtlasBaseException {
         AtlasBaseTypeDef ret;
         switch (type.getTypeCategory()) {

http://git-wip-us.apache.org/repos/asf/atlas/blob/711baea9/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
index a30c97a..49a1f35 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
@@ -75,18 +75,6 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
         super(typeRegistry, typeDefChangeListeners);
         this.atlasGraph = atlasGraph;
 
-        LOG.debug("==> AtlasTypeDefGraphStoreV1()");
-
-        try {
-            init();
-            // commit/close the transaction after successful type store initialization.
-            atlasGraph.commit();
-
-        } catch (AtlasBaseException excp) {
-            atlasGraph.rollback();
-            LOG.error("failed to initialize types from graph store", excp);
-        }
-
         LOG.debug("<== AtlasTypeDefGraphStoreV1()");
     }
 
@@ -113,11 +101,11 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
     @Override
     @PostConstruct
     public void init() throws AtlasBaseException {
-        LOG.debug("==> AtlasTypeDefGraphStoreV1.init()");
+        LOG.info("==> AtlasTypeDefGraphStoreV1.init()");
 
         super.init();
 
-        LOG.debug("<== AtlasTypeDefGraphStoreV1.init()");
+        LOG.info("<== AtlasTypeDefGraphStoreV1.init()");
     }
 
     AtlasGraph getAtlasGraph() { return atlasGraph; }

http://git-wip-us.apache.org/repos/asf/atlas/blob/711baea9/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
index 2a07f02..a98ef38 100644
--- a/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexerMockTest.java
@@ -32,7 +32,6 @@ import org.mockito.MockitoAnnotations;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyZeroInteractions;
 import static org.mockito.Mockito.when;
 
@@ -59,11 +58,8 @@ public class GraphBackedSearchIndexerMockTest implements IAtlasGraphProvider {
     public void testSearchIndicesAreInitializedOnConstructionWhenHAIsDisabled() throws IndexException, RepositoryException {
         when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, false)).thenReturn(false);        
         when(graph.getManagementSystem()).thenReturn(management);
-        when(management.containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY)).thenReturn(true);
 
         GraphBackedSearchIndexer graphBackedSearchIndexer = new GraphBackedSearchIndexer(this, configuration, typeRegistry);
-
-        verify(management).containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY);
     }
 
     @Test
@@ -75,7 +71,6 @@ public class GraphBackedSearchIndexerMockTest implements IAtlasGraphProvider {
 
         new GraphBackedSearchIndexer(this, configuration, typeRegistry);
         verifyZeroInteractions(management);
-
     }
 
     @Test
@@ -83,12 +78,9 @@ public class GraphBackedSearchIndexerMockTest implements IAtlasGraphProvider {
         when(configuration.containsKey(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
         when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY)).thenReturn(true);
         when(graph.getManagementSystem()).thenReturn(management);
-        when(management.containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY)).thenReturn(true);
 
         GraphBackedSearchIndexer graphBackedSearchIndexer = new GraphBackedSearchIndexer(this, configuration, typeRegistry);
         graphBackedSearchIndexer.instanceIsActive();
-
-        verify(management).containsPropertyKey(Constants.VERTEX_TYPE_PROPERTY_KEY);
     }
     
 


[5/5] atlas git commit: ATLAS-2083: Refactor AtlasDefStore classes to reduce code duplication

Posted by ma...@apache.org.
ATLAS-2083: Refactor Atlas<Type>DefStore classes to reduce code duplication

Signed-off-by: Madhan Neethiraj <ma...@apache.org>
(cherry picked from commit 15d67e52f118ce689724f62ac3c83cfd3128e34f)


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

Branch: refs/heads/branch-0.8
Commit: 5ca7955a1f3bcd2a84381889ad450ca2ea4c6372
Parents: 711baea
Author: Richard Ding <sd...@us.ibm.com>
Authored: Fri Aug 25 11:37:27 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Sep 11 14:34:14 2017 -0700

----------------------------------------------------------------------
 .../graph/AtlasClassificationDefStore.java      | 52 --------------
 .../repository/store/graph/AtlasDefStore.java   | 53 ++++++++++++++
 .../store/graph/AtlasEntityDefStore.java        | 52 --------------
 .../store/graph/AtlasEnumDefStore.java          | 46 ------------
 .../store/graph/AtlasStructDefStore.java        | 52 --------------
 .../store/graph/AtlasTypeDefGraphStore.java     | 51 +++++++-------
 .../store/graph/v1/AtlasAbstractDefStoreV1.java | 34 ++++++++-
 .../graph/v1/AtlasClassificationDefStoreV1.java | 55 +--------------
 .../store/graph/v1/AtlasEntityDefStoreV1.java   | 55 +--------------
 .../store/graph/v1/AtlasEnumDefStoreV1.java     | 48 ++++++-------
 .../store/graph/v1/AtlasStructDefStoreV1.java   | 55 +--------------
 .../graph/v1/AtlasTypeDefGraphStoreV1.java      | 16 ++---
 .../test/java/org/apache/atlas/TestModules.java | 14 +---
 .../store/graph/AtlasEntityDefStoreV1Test.java  | 73 --------------------
 .../graph/v1/AtlasEntityDefStoreV1Test.java     | 72 +++++++++++++++++++
 15 files changed, 224 insertions(+), 504 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/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
deleted file mode 100644
index 5721534..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasClassificationDefStore.java
+++ /dev/null
@@ -1,52 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasClassificationDef;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasClassificationDef
- */
-public interface AtlasClassificationDefStore {
-    Object preCreate(AtlasClassificationDef classificationDef) throws AtlasBaseException;
-
-    AtlasClassificationDef create(AtlasClassificationDef classifiDef, Object preCreateResult) throws AtlasBaseException;
-
-    List<AtlasClassificationDef> getAll() throws AtlasBaseException;
-
-    AtlasClassificationDef getByName(String name) throws AtlasBaseException;
-
-    AtlasClassificationDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasClassificationDef update(AtlasClassificationDef classifiDef) throws AtlasBaseException;
-
-    AtlasClassificationDef updateByName(String name, AtlasClassificationDef classifiDef) throws AtlasBaseException;
-
-    AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classifiDef) throws AtlasBaseException;
-
-    Object preDeleteByName(String name) throws AtlasBaseException;
-
-    void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
-
-    Object preDeleteByGuid(String guid) throws AtlasBaseException;
-
-    void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java
new file mode 100644
index 0000000..7df3c86
--- /dev/null
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasDefStore.java
@@ -0,0 +1,53 @@
+/**
+ * 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.typedef.AtlasBaseTypeDef;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
+
+import java.util.List;
+
+/**
+ * Interface for graph persistence store for AtlasTypeDef
+ */
+public interface AtlasDefStore<T extends AtlasBaseTypeDef> {
+    AtlasVertex preCreate(T typeDef) throws AtlasBaseException;
+
+    T create(T typeDef, AtlasVertex preCreateResult) throws AtlasBaseException;
+
+    List<T> getAll() throws AtlasBaseException;
+
+    T getByName(String name) throws AtlasBaseException;
+
+    T getByGuid(String guid) throws AtlasBaseException;
+
+    T update(T typeDef) throws AtlasBaseException;
+
+    T updateByName(String name, T typeDef) throws AtlasBaseException;
+
+    T updateByGuid(String guid, T typeDef) throws AtlasBaseException;
+
+    AtlasVertex preDeleteByName(String name) throws AtlasBaseException;
+
+    void deleteByName(String name, AtlasVertex preDeleteResult) throws AtlasBaseException;
+
+    AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException;
+
+    void deleteByGuid(String guid, AtlasVertex preDeleteResult) throws AtlasBaseException;
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/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
deleted file mode 100644
index 7cabb349..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStore.java
+++ /dev/null
@@ -1,52 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasEntityDef;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasEntityDef
- */
-public interface AtlasEntityDefStore {
-    Object preCreate(AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    AtlasEntityDef create(AtlasEntityDef entityDef, Object preCreateResult) throws AtlasBaseException;
-
-    List<AtlasEntityDef> getAll() throws AtlasBaseException;
-
-    AtlasEntityDef getByName(String name) throws AtlasBaseException;
-
-    AtlasEntityDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasEntityDef update(AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    AtlasEntityDef updateByName(String name, AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    AtlasEntityDef updateByGuid(String guid, AtlasEntityDef entityDef) throws AtlasBaseException;
-
-    Object preDeleteByName(String name) throws AtlasBaseException;
-
-    void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
-
-    Object preDeleteByGuid(String guid) throws AtlasBaseException;
-
-    void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/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
deleted file mode 100644
index f543eb5..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasEnumDefStore.java
+++ /dev/null
@@ -1,46 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasEnumDef;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasEnumDef
- */
-public interface AtlasEnumDefStore {
-    AtlasEnumDef create(AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    List<AtlasEnumDef> getAll() throws AtlasBaseException;
-
-    AtlasEnumDef getByName(String name) throws AtlasBaseException;
-
-    AtlasEnumDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasEnumDef update(AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    AtlasEnumDef updateByName(String name, AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    AtlasEnumDef updateByGuid(String guid, AtlasEnumDef enumDef) throws AtlasBaseException;
-
-    void deleteByName(String name) throws AtlasBaseException;
-
-    void deleteByGuid(String guid) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/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
deleted file mode 100644
index 9e74d09..0000000
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasStructDefStore.java
+++ /dev/null
@@ -1,52 +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.repository.store.graph;
-
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasStructDef;
-
-import java.util.List;
-
-/**
- * Interface for graph persistence store for AtlasStructDef
- */
-public interface AtlasStructDefStore {
-    Object preCreate(AtlasStructDef structDef) throws AtlasBaseException;
-
-    AtlasStructDef create(AtlasStructDef structDef, Object preCreateResult) throws AtlasBaseException;
-
-    List<AtlasStructDef> getAll() throws AtlasBaseException;
-
-    AtlasStructDef getByName(String name) throws AtlasBaseException;
-
-    AtlasStructDef getByGuid(String guid) throws AtlasBaseException;
-
-    AtlasStructDef update(AtlasStructDef structDef) throws AtlasBaseException;
-
-    AtlasStructDef updateByName(String name, AtlasStructDef structDef) throws AtlasBaseException;
-
-    AtlasStructDef updateByGuid(String guid, AtlasStructDef structDef) throws AtlasBaseException;
-
-    Object preDeleteByName(String name) throws AtlasBaseException;
-
-    void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException;
-
-    Object preDeleteByGuid(String name) throws AtlasBaseException;
-
-    void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException;
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
index d024bfd..4669286 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
@@ -32,6 +32,7 @@ import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
 import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
 import org.apache.atlas.repository.util.FilterUtil;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasClassificationType;
@@ -76,13 +77,13 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
         this.typeUpdateLockMaxWaitTimeSeconds = AtlasRepositoryConfiguration.getTypeUpdateLockMaxWaitTimeInSeconds();
     }
 
-    protected abstract AtlasEnumDefStore getEnumDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasEnumDef> getEnumDefStore(AtlasTypeRegistry typeRegistry);
 
-    protected abstract AtlasStructDefStore getStructDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasStructDef> getStructDefStore(AtlasTypeRegistry typeRegistry);
 
-    protected abstract AtlasClassificationDefStore getClassificationDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasClassificationDef> getClassificationDefStore(AtlasTypeRegistry typeRegistry);
 
-    protected abstract AtlasEntityDefStore getEntityDefStore(AtlasTypeRegistry typeRegistry);
+    protected abstract AtlasDefStore<AtlasEntityDef> getEntityDefStore(AtlasTypeRegistry typeRegistry);
 
     @Override
     public void init() throws AtlasBaseException {
@@ -438,14 +439,14 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
 
         AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit();
 
-        AtlasEnumDefStore           enumDefStore     = getEnumDefStore(ttr);
-        AtlasStructDefStore         structDefStore   = getStructDefStore(ttr);
-        AtlasClassificationDefStore classifiDefStore = getClassificationDefStore(ttr);
-        AtlasEntityDefStore         entityDefStore   = getEntityDefStore(ttr);
+        AtlasDefStore<AtlasEnumDef>           enumDefStore     = getEnumDefStore(ttr);
+        AtlasDefStore<AtlasStructDef>         structDefStore   = getStructDefStore(ttr);
+        AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr);
+        AtlasDefStore<AtlasEntityDef>         entityDefStore   = getEntityDefStore(ttr);
 
-        List<Object> preDeleteStructDefs   = new ArrayList<>();
-        List<Object> preDeleteClassifiDefs = new ArrayList<>();
-        List<Object> preDeleteEntityDefs   = new ArrayList<>();
+        List<AtlasVertex> preDeleteStructDefs   = new ArrayList<>();
+        List<AtlasVertex> preDeleteClassifiDefs = new ArrayList<>();
+        List<AtlasVertex> preDeleteEntityDefs   = new ArrayList<>();
 
         if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) {
             for (AtlasStructDef structDef : typesDef.getStructDefs()) {
@@ -516,9 +517,9 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
         if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) {
             for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
                 if (StringUtils.isNotBlank(enumDef.getGuid())) {
-                    enumDefStore.deleteByGuid(enumDef.getGuid());
+                    enumDefStore.deleteByGuid(enumDef.getGuid(), null);
                 } else {
-                    enumDefStore.deleteByName(enumDef.getName());
+                    enumDefStore.deleteByName(enumDef.getName(), null);
                 }
             }
         }
@@ -721,18 +722,18 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
     private AtlasTypesDef addToGraphStore(AtlasTypesDef typesDef, AtlasTransientTypeRegistry ttr) throws AtlasBaseException {
         AtlasTypesDef ret = new AtlasTypesDef();
 
-        AtlasEnumDefStore           enumDefStore     = getEnumDefStore(ttr);
-        AtlasStructDefStore         structDefStore   = getStructDefStore(ttr);
-        AtlasClassificationDefStore classifiDefStore = getClassificationDefStore(ttr);
-        AtlasEntityDefStore         entityDefStore   = getEntityDefStore(ttr);
+        AtlasDefStore<AtlasEnumDef>           enumDefStore     = getEnumDefStore(ttr);
+        AtlasDefStore<AtlasStructDef>         structDefStore   = getStructDefStore(ttr);
+        AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr);
+        AtlasDefStore<AtlasEntityDef>         entityDefStore   = getEntityDefStore(ttr);
 
-        List<Object> preCreateStructDefs   = new ArrayList<>();
-        List<Object> preCreateClassifiDefs = new ArrayList<>();
-        List<Object> preCreateEntityDefs   = new ArrayList<>();
+        List<AtlasVertex> preCreateStructDefs   = new ArrayList<>();
+        List<AtlasVertex> preCreateClassifiDefs = new ArrayList<>();
+        List<AtlasVertex> preCreateEntityDefs   = new ArrayList<>();
 
         if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) {
             for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
-                AtlasEnumDef createdDef = enumDefStore.create(enumDef);
+                AtlasEnumDef createdDef = enumDefStore.create(enumDef, null);
 
                 ttr.updateGuid(createdDef.getName(), createdDef.getGuid());
 
@@ -800,10 +801,10 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore {
     private AtlasTypesDef updateGraphStore(AtlasTypesDef typesDef, AtlasTransientTypeRegistry ttr) throws AtlasBaseException {
         AtlasTypesDef ret = new AtlasTypesDef();
 
-        AtlasEnumDefStore           enumDefStore     = getEnumDefStore(ttr);
-        AtlasStructDefStore         structDefStore   = getStructDefStore(ttr);
-        AtlasClassificationDefStore classifiDefStore = getClassificationDefStore(ttr);
-        AtlasEntityDefStore         entityDefStore   = getEntityDefStore(ttr);
+        AtlasDefStore<AtlasEnumDef>           enumDefStore     = getEnumDefStore(ttr);
+        AtlasDefStore<AtlasStructDef>         structDefStore   = getStructDefStore(ttr);
+        AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr);
+        AtlasDefStore<AtlasEntityDef>         entityDefStore   = getEntityDefStore(ttr);
 
         if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) {
             for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
index baf2309..2bf53a1 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java
@@ -24,6 +24,8 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
 import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.query.QueryParser;
+import org.apache.atlas.repository.graphdb.AtlasVertex;
+import org.apache.atlas.repository.store.graph.AtlasDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,7 +37,7 @@ import java.util.regex.Pattern;
 /**
  * Abstract typedef-store for v1 format.
  */
-public abstract class AtlasAbstractDefStoreV1 {
+  abstract class AtlasAbstractDefStoreV1 <T extends AtlasBaseTypeDef> implements AtlasDefStore<T> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasAbstractDefStoreV1.class);
     protected final AtlasTypeDefGraphStoreV1 typeDefStore;
     protected final AtlasTypeRegistry        typeRegistry;
@@ -77,4 +79,34 @@ public abstract class AtlasAbstractDefStoreV1 {
 
         return m.matches();
     }
+
+    @Override
+    public void deleteByName(String name, AtlasVertex preDeleteResult) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasAbstractDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
+        }
+
+        AtlasVertex vertex = (preDeleteResult == null) ? preDeleteByName(name) : preDeleteResult;
+
+        typeDefStore.deleteTypeVertex(vertex);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasAbstractDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
+        }
+    }
+
+    @Override
+    public void deleteByGuid(String guid, AtlasVertex preDeleteResult) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> AtlasAbstractDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
+        }
+
+        AtlasVertex vertex = (preDeleteResult == null) ? preDeleteByGuid(guid) : preDeleteResult;
+
+        typeDefStore.deleteTypeVertex(vertex);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasAbstractDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
index 8944504..e3aa4e0 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
@@ -23,7 +23,6 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasClassificationDefStore;
 import org.apache.atlas.type.AtlasClassificationType;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -41,7 +40,7 @@ import java.util.regex.Pattern;
 /**
  * ClassificationDef store in v1 format.
  */
-public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasClassificationDefStore {
+class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasClassificationDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasClassificationDefStoreV1.class);
 
     private static final String  TRAIT_NAME_REGEX   = "[a-zA-Z][a-zA-Z0-9_ .]*";
@@ -84,19 +83,13 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
     }
 
     @Override
-    public AtlasClassificationDef create(AtlasClassificationDef classificationDef, Object preCreateResult)
+    public AtlasClassificationDef create(AtlasClassificationDef classificationDef, AtlasVertex preCreateResult)
         throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasClassificationDefStoreV1.create({}, {})", classificationDef, preCreateResult);
         }
 
-        AtlasVertex vertex;
-
-        if (preCreateResult == null || !(preCreateResult instanceof AtlasVertex)) {
-            vertex = preCreate(classificationDef);
-        } else {
-            vertex = (AtlasVertex)preCreateResult;
-        }
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(classificationDef) : preCreateResult;
 
         updateVertexAddReferences(classificationDef, vertex);
 
@@ -281,27 +274,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
     }
 
     @Override
-    public void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasClassificationDefStoreV1.deleteByName({})", name);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByName(name);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasClassificationDefStoreV1.deleteByName({})", name);
-        }
-    }
-
-    @Override
     public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasClassificationDefStoreV1.preDeleteByGuid({})", guid);
@@ -328,27 +300,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
         return ret;
     }
 
-    @Override
-    public void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasClassificationDefStoreV1.deleteByGuid({})", guid);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByGuid(guid);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasClassificationDefStoreV1.deleteByGuid({})", guid);
-        }
-    }
-
     private void updateVertexPreCreate(AtlasClassificationDef  classificationDef,
                                        AtlasClassificationType classificationType,
                                        AtlasVertex             vertex) throws AtlasBaseException {

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
index 8046234..5fca674 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
@@ -22,7 +22,6 @@ import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
 import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
@@ -39,7 +38,7 @@ import java.util.List;
 /**
  * EntityDef store in v1 format.
  */
-public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasEntityDefStore {
+public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEntityDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEntityDefStoreV1.class);
 
     @Inject
@@ -79,18 +78,12 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public AtlasEntityDef create(AtlasEntityDef entityDef, Object preCreateResult) throws AtlasBaseException {
+    public AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasEntityDefStoreV1.create({}, {})", entityDef, preCreateResult);
         }
 
-        AtlasVertex vertex;
-
-        if (preCreateResult == null || !(preCreateResult instanceof AtlasVertex)) {
-            vertex = preCreate(entityDef);
-        } else {
-            vertex = (AtlasVertex)preCreateResult;
-        }
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(entityDef) : preCreateResult;
 
         updateVertexAddReferences(entityDef, vertex);
 
@@ -275,27 +268,6 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEntityDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByName(name);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEntityDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-    }
-
-    @Override
     public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasEntityDefStoreV1.preDeleteByGuid({})", guid);
@@ -322,27 +294,6 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
         return ret;
     }
 
-    @Override
-    public void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEntityDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByGuid(guid);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEntityDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-    }
-
     private void updateVertexPreCreate(AtlasEntityDef entityDef, AtlasEntityType entityType, AtlasVertex vertex) throws AtlasBaseException {
         AtlasStructDefStoreV1.updateVertexPreCreate(entityDef, entityType, vertex, typeDefStore);
     }

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
index 54d14de..5bd9c12 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEnumDefStoreV1.java
@@ -23,7 +23,6 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
 import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasEnumDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
 import org.apache.commons.collections.CollectionUtils;
@@ -38,7 +37,7 @@ import java.util.List;
 /**
  * EnumDef store in v1 format.
  */
-public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasEnumDefStore {
+class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasEnumDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasEnumDefStoreV1.class);
 
     public AtlasEnumDefStoreV1(AtlasTypeDefGraphStoreV1 typeDefStore, AtlasTypeRegistry typeRegistry) {
@@ -46,9 +45,9 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
     }
 
     @Override
-    public AtlasEnumDef create(AtlasEnumDef enumDef) throws AtlasBaseException {
+    public AtlasVertex preCreate(AtlasEnumDef enumDef) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEnumDefStoreV1.create({})", enumDef);
+          LOG.debug("==> AtlasEnumDefStoreV1.preCreate({})", enumDef);
         }
 
         validateType(enumDef);
@@ -63,10 +62,25 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
 
         toVertex(enumDef, vertex);
 
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("<== AtlasEnumDefStoreV1.preCreate({}): {}", enumDef, vertex);
+        }
+
+        return vertex;
+    }
+
+    @Override
+    public AtlasEnumDef create(AtlasEnumDef enumDef, AtlasVertex preCreateResult) throws AtlasBaseException {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("==> AtlasEnumDefStoreV1.create({}, {})", enumDef, preCreateResult);
+        }
+
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(enumDef) : preCreateResult;
+
         AtlasEnumDef ret = toEnumDef(vertex);
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEnumDefStoreV1.create({}): {}", enumDef, ret);
+            LOG.debug("<== AtlasEntityDefStoreV1.create({}, {}): {}", enumDef, preCreateResult, ret);
         }
 
         return ret;
@@ -209,41 +223,25 @@ public class AtlasEnumDefStoreV1 extends AtlasAbstractDefStoreV1 implements Atla
     }
 
     @Override
-    public void deleteByName(String name) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEnumDefStoreV1.deleteByName({})", name);
-        }
-
+    public AtlasVertex preDeleteByName(String name) throws AtlasBaseException {
         AtlasVertex vertex = typeDefStore.findTypeVertexByNameAndCategory(name, TypeCategory.ENUM);
 
         if (vertex == null) {
             throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name);
         }
 
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEnumDefStoreV1.deleteByName({})", name);
-        }
+        return vertex;
     }
 
     @Override
-    public void deleteByGuid(String guid) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasEnumDefStoreV1.deleteByGuid({})", guid);
-        }
-
+    public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         AtlasVertex vertex = typeDefStore.findTypeVertexByGuidAndCategory(guid, TypeCategory.ENUM);
 
         if (vertex == null) {
             throw new AtlasBaseException(AtlasErrorCode.TYPE_GUID_NOT_FOUND, guid);
         }
 
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasEnumDefStoreV1.deleteByGuid({})", guid);
-        }
+        return vertex;
     }
 
     private void toVertex(AtlasEnumDef enumDef, AtlasVertex vertex) throws AtlasBaseException {

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
index 1c6cfc7..137fb30 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
@@ -26,7 +26,6 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graph.GraphHelper;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasStructDefStore;
 import org.apache.atlas.type.AtlasStructType;
 import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
 import org.apache.atlas.type.AtlasType;
@@ -51,7 +50,7 @@ import java.util.Set;
 /**
  * StructDef store in v1 format.
  */
-public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements AtlasStructDefStore {
+public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDef> {
     private static final Logger LOG = LoggerFactory.getLogger(AtlasStructDefStoreV1.class);
 
     public AtlasStructDefStoreV1(AtlasTypeDefGraphStoreV1 typeDefStore, AtlasTypeRegistry typeRegistry) {
@@ -90,18 +89,12 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public AtlasStructDef create(AtlasStructDef structDef, Object preCreateResult) throws AtlasBaseException {
+    public AtlasStructDef create(AtlasStructDef structDef, AtlasVertex preCreateResult) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasStructDefStoreV1.create({}, {})", structDef, preCreateResult);
         }
 
-        AtlasVertex vertex;
-
-        if (preCreateResult == null || !(preCreateResult instanceof AtlasVertex)) {
-            vertex = preCreate(structDef);
-        } else {
-            vertex = (AtlasVertex)preCreateResult;
-        }
+        AtlasVertex vertex = (preCreateResult == null) ? preCreate(structDef) : preCreateResult;
 
         if (CollectionUtils.isEmpty(structDef.getAttributeDefs())) {
             throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Missing attributes for structdef");
@@ -289,27 +282,6 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
     }
 
     @Override
-    public void deleteByName(String name, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasStructDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByName(name);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasStructDefStoreV1.deleteByName({}, {})", name, preDeleteResult);
-        }
-    }
-
-    @Override
     public AtlasVertex preDeleteByGuid(String guid) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasStructDefStoreV1.preDeleteByGuid({})", guid);
@@ -336,27 +308,6 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
         return ret;
     }
 
-    @Override
-    public void deleteByGuid(String guid, Object preDeleteResult) throws AtlasBaseException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("==> AtlasStructDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-
-        AtlasVertex vertex;
-
-        if (preDeleteResult == null || !(preDeleteResult instanceof AtlasVertex)) {
-            vertex = preDeleteByGuid(guid);
-        } else {
-            vertex = (AtlasVertex)preDeleteResult;
-        }
-
-        typeDefStore.deleteTypeVertex(vertex);
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("<== AtlasStructDefStoreV1.deleteByGuid({}, {})", guid, preDeleteResult);
-        }
-    }
-
     private AtlasStructDef toStructDef(AtlasVertex vertex) throws AtlasBaseException {
         AtlasStructDef ret = null;
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
index 49a1f35..6e9ef68 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
@@ -23,17 +23,13 @@ import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.RequestContextV1;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.listener.TypeDefChangeListener;
-import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
+import org.apache.atlas.model.typedef.*;
 import org.apache.atlas.repository.Constants;
 import org.apache.atlas.repository.graphdb.AtlasEdge;
 import org.apache.atlas.repository.graphdb.AtlasEdgeDirection;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.graphdb.AtlasVertex;
-import org.apache.atlas.repository.store.graph.AtlasClassificationDefStore;
-import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
-import org.apache.atlas.repository.store.graph.AtlasEnumDefStore;
-import org.apache.atlas.repository.store.graph.AtlasStructDefStore;
-import org.apache.atlas.repository.store.graph.AtlasTypeDefGraphStore;
+import org.apache.atlas.repository.store.graph.*;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.types.DataTypes.TypeCategory;
@@ -79,22 +75,22 @@ public class AtlasTypeDefGraphStoreV1 extends AtlasTypeDefGraphStore {
     }
 
     @Override
-    protected AtlasEnumDefStore getEnumDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasEnumDef> getEnumDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasEnumDefStoreV1(this, typeRegistry);
     }
 
     @Override
-    protected AtlasStructDefStore getStructDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasStructDef> getStructDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasStructDefStoreV1(this, typeRegistry);
     }
 
     @Override
-    protected AtlasClassificationDefStore getClassificationDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasClassificationDef> getClassificationDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasClassificationDefStoreV1(this, typeRegistry);
     }
 
     @Override
-    protected AtlasEntityDefStore getEntityDefStore(AtlasTypeRegistry typeRegistry) {
+    protected AtlasDefStore<AtlasEntityDef> getEntityDefStore(AtlasTypeRegistry typeRegistry) {
         return new AtlasEntityDefStoreV1(this, typeRegistry);
     }
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/test/java/org/apache/atlas/TestModules.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/TestModules.java b/repository/src/test/java/org/apache/atlas/TestModules.java
index 512d994..9efbb77 100644
--- a/repository/src/test/java/org/apache/atlas/TestModules.java
+++ b/repository/src/test/java/org/apache/atlas/TestModules.java
@@ -40,16 +40,8 @@ import org.apache.atlas.repository.graph.HardDeleteHandler;
 import org.apache.atlas.repository.graph.SoftDeleteHandler;
 import org.apache.atlas.repository.graphdb.AtlasGraph;
 import org.apache.atlas.repository.impexp.ExportService;
-import org.apache.atlas.repository.store.graph.AtlasEntityDefStore;
-import org.apache.atlas.repository.store.graph.AtlasEntityStore;
-import org.apache.atlas.repository.store.graph.v1.AtlasEntityChangeNotifier;
-import org.apache.atlas.repository.store.graph.v1.AtlasEntityDefStoreV1;
-import org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1;
-import org.apache.atlas.repository.store.graph.v1.AtlasTypeDefGraphStoreV1;
-import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
-import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
-import org.apache.atlas.repository.store.graph.v1.HardDeleteHandlerV1;
-import org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1;
+import org.apache.atlas.repository.store.graph.*;
+import org.apache.atlas.repository.store.graph.v1.*;
 import org.apache.atlas.repository.typestore.GraphBackedTypeStore;
 import org.apache.atlas.repository.typestore.ITypeStore;
 import org.apache.atlas.repository.typestore.StoreBackedTypeCache;
@@ -128,8 +120,6 @@ public class TestModules {
             bind(ITypeStore.class).to(GraphBackedTypeStore.class).asEagerSingleton();
             bind(AtlasTypeDefStore.class).to(AtlasTypeDefGraphStoreV1.class).asEagerSingleton();
 
-            //For testing
-            bind(AtlasEntityDefStore.class).to(AtlasEntityDefStoreV1.class).asEagerSingleton();
             bind(AtlasTypeRegistry.class).asEagerSingleton();
             bind(EntityGraphMapper.class).asEagerSingleton();
             bind(ExportService.class).asEagerSingleton();

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
deleted file mode 100644
index 5f01136..0000000
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java
+++ /dev/null
@@ -1,73 +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.repository.store.graph;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Inject;
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasErrorCode;
-import org.apache.atlas.AtlasException;
-import org.apache.atlas.TestModules;
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasEntityDef;
-import org.apache.atlas.repository.graph.AtlasGraphProvider;
-import org.apache.atlas.repository.store.graph.v1.AtlasAbstractDefStoreV1;
-import org.apache.atlas.type.AtlasTypeUtil;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-/**
- * Tests for AtlasEntityStoreV1
- */
-@Guice(modules = TestModules.TestOnlyModule.class)
-public class AtlasEntityDefStoreV1Test {
-
-    @Inject
-    private
-    AtlasEntityDefStore entityDefStore;
-
-    @DataProvider
-    public Object[][] invalidAttributeNameWithReservedKeywords(){
-        AtlasEntityDef invalidAttrNameType =
-            AtlasTypeUtil.createClassTypeDef("Invalid_Attribute_Type", "description", ImmutableSet.<String>of(),
-                AtlasTypeUtil.createRequiredAttrDef("order", "string"),
-                AtlasTypeUtil.createRequiredAttrDef("limit", "string"));
-
-        return new Object[][] {{
-            invalidAttrNameType
-        }};
-    }
-
-    @Test(dataProvider = "invalidAttributeNameWithReservedKeywords")
-    public void testCreateTypeWithReservedKeywords(AtlasEntityDef atlasEntityDef) throws AtlasException {
-        try {
-            ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV1.ALLOW_RESERVED_KEYWORDS, false);
-            entityDefStore.create(atlasEntityDef, null);
-        } catch (AtlasBaseException e) {
-            Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID);
-        }
-    }
-
-    @AfterClass
-    public void clear(){
-        AtlasGraphProvider.cleanup();
-    }
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/5ca7955a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java
new file mode 100644
index 0000000..95b5761
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1Test.java
@@ -0,0 +1,72 @@
+/**
+ * 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.v1;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Inject;
+import org.apache.atlas.ApplicationProperties;
+import org.apache.atlas.AtlasErrorCode;
+import org.apache.atlas.AtlasException;
+import org.apache.atlas.TestModules;
+import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.repository.graph.AtlasGraphProvider;
+import org.apache.atlas.type.AtlasTypeUtil;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for AtlasEntityStoreV1
+ */
+@Guice(modules = TestModules.TestOnlyModule.class)
+public class AtlasEntityDefStoreV1Test {
+
+    @Inject
+    private
+    AtlasEntityDefStoreV1 entityDefStore;
+
+    @DataProvider
+    public Object[][] invalidAttributeNameWithReservedKeywords(){
+        AtlasEntityDef invalidAttrNameType =
+            AtlasTypeUtil.createClassTypeDef("Invalid_Attribute_Type", "description", ImmutableSet.<String>of(),
+                AtlasTypeUtil.createRequiredAttrDef("order", "string"),
+                AtlasTypeUtil.createRequiredAttrDef("limit", "string"));
+
+        return new Object[][] {{
+            invalidAttrNameType
+        }};
+    }
+
+    @Test(dataProvider = "invalidAttributeNameWithReservedKeywords")
+    public void testCreateTypeWithReservedKeywords(AtlasEntityDef atlasEntityDef) throws AtlasException {
+        try {
+            ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV1.ALLOW_RESERVED_KEYWORDS, false);
+            entityDefStore.create(atlasEntityDef, null);
+        } catch (AtlasBaseException e) {
+            Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID);
+        }
+    }
+
+    @AfterClass
+    public void clear(){
+        AtlasGraphProvider.cleanup();
+    }
+}


[3/5] atlas git commit: ATLAS-2060: Fix logger class name typos

Posted by ma...@apache.org.
ATLAS-2060: Fix logger class name typos

Signed-off-by: Madhan Neethiraj <ma...@apache.org>
(cherry picked from commit 8686333985311f3ed907ffc71942eb7e92896808)


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

Branch: refs/heads/branch-0.8
Commit: 16a02fc71be794f39c34c9ab5fe82bda6c5eabf7
Parents: 565213d
Author: Richard Ding <sd...@us.ibm.com>
Authored: Fri Aug 25 01:23:32 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Sep 11 11:39:58 2017 -0700

----------------------------------------------------------------------
 intg/src/main/java/org/apache/atlas/type/AtlasMapType.java      | 2 +-
 intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/16a02fc7/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
index 32b813b..8b702a7 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
@@ -31,7 +31,7 @@ import java.util.*;
  * class that implements behaviour of a map-type.
  */
 public class AtlasMapType extends AtlasType {
-    private static final Logger LOG = LoggerFactory.getLogger(AtlasEntityType.class);
+    private static final Logger LOG = LoggerFactory.getLogger(AtlasMapType.class);
 
     private final String keyTypeName;
     private final String valueTypeName;

http://git-wip-us.apache.org/repos/asf/atlas/blob/16a02fc7/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 dbd1038..322176a 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -49,7 +49,7 @@ import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.*;
 @Singleton
 @Component
 public class AtlasTypeRegistry {
-    private static final Logger LOG = LoggerFactory.getLogger(AtlasStructType.class);
+    private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeRegistry.class);
     private static final int    DEFAULT_LOCK_MAX_WAIT_TIME_IN_SECONDS = 15;
 
     protected       RegistryData                   registryData;