atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject [1/2] atlas git commit: ATLAS-2078: Type update using v1 API doesn't route to createUpdateTypesDef in v2 API
Date Wed, 23 Aug 2017 06:08:36 GMT
Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 b7f1fc914 -> 573383430


ATLAS-2078: Type update using v1 API doesn't route to createUpdateTypesDef in v2 API

(cherry picked from commit 88eadb9bfa74b17dfff26dcbad0617d240d856e9)


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

Branch: refs/heads/branch-0.8
Commit: cfd90449dfd7171eeef517d1edf077b8a8029994
Parents: b7f1fc9
Author: Sarath Subramanian <ssubramanian@hortonworks.com>
Authored: Tue Aug 22 23:05:10 2017 -0700
Committer: Sarath Subramanian <ssubramanian@hortonworks.com>
Committed: Tue Aug 22 23:07:48 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/atlas/store/AtlasTypeDefStore.java  |  2 ++
 .../repository/store/graph/AtlasTypeDefGraphStore.java  | 12 ++++++++++++
 .../org/apache/atlas/web/resources/TypesResource.java   |  9 ++++++---
 3 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/cfd90449/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java b/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java
index 198bd8f..7f196c6 100644
--- a/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java
+++ b/intg/src/main/java/org/apache/atlas/store/AtlasTypeDefStore.java
@@ -83,6 +83,8 @@ public interface AtlasTypeDefStore {
 
     AtlasTypesDef updateTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException;
 
+    AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreateUpdate) throws AtlasBaseException;
+
     AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate)
throws AtlasBaseException;
 
     void deleteTypesDef(AtlasTypesDef atlasTypesDef) throws AtlasBaseException;

http://git-wip-us.apache.org/repos/asf/atlas/blob/cfd90449/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 386b493..1f6cf0b 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
@@ -56,6 +56,9 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import static org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer.getTypesToCreate;
+import static org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer.getTypesToUpdate;
+
 
 /**
  * Abstract class for graph persistence store for TypeDef
@@ -310,6 +313,15 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore,
Activ
 
     @Override
     @GraphTransaction
+    public AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException
{
+        AtlasTypesDef typesToCreate = getTypesToCreate(typesDef, typeRegistry);
+        AtlasTypesDef typesToUpdate = getTypesToUpdate(typesDef, typeRegistry);
+
+        return createUpdateTypesDef(typesToCreate, typesToUpdate);
+    }
+
+    @Override
+    @GraphTransaction
     public AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef
typesToUpdate) throws AtlasBaseException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("==> AtlasTypeDefGraphStore.createUpdateTypesDef({}, {})", typesToCreate,
typesToUpdate);

http://git-wip-us.apache.org/repos/asf/atlas/blob/cfd90449/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
index 08121d8..ef8f0cb 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
@@ -23,6 +23,7 @@ import com.sun.jersey.api.core.ResourceContext;
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
+import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
 import org.apache.atlas.typesystem.TypesDef;
 import org.apache.atlas.typesystem.json.TypesSerialization;
@@ -71,11 +72,13 @@ public class TypesResource {
     private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger("rest.TypesResource");
     private static AtlasTypeRegistry typeRegistry;
     private final TypesREST typesREST;
+    private final AtlasTypeDefStore typeDefStore;
 
     @Inject
-    public TypesResource(AtlasTypeRegistry typeRegistry, TypesREST typesREST) {
+    public TypesResource(AtlasTypeRegistry typeRegistry, TypesREST typesREST, AtlasTypeDefStore
typeDefStore) {
         this.typeRegistry = typeRegistry;
-        this.typesREST = typesREST;
+        this.typesREST    = typesREST;
+        this.typeDefStore = typeDefStore;
     }
 
     @Context
@@ -176,7 +179,7 @@ public class TypesResource {
             }
 
             AtlasTypesDef updateTypesDef  = TypeConverterUtil.toAtlasTypesDef(typeDefinition,
typeRegistry);
-            AtlasTypesDef updatedTypesDef = typesREST.updateAtlasTypeDefs(updateTypesDef);
+            AtlasTypesDef updatedTypesDef = typeDefStore.createUpdateTypesDef(updateTypesDef);
             List<String>  typeNames       = TypeConverterUtil.getTypeNames(updatedTypesDef);
 
             for (int i = 0; i < typeNames.size(); i++) {


Mime
View raw message