usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [13/50] incubator-usergrid git commit: SYSTEM_APP is deprecated and no longer used (except for appinfo migration).
Date Mon, 13 Apr 2015 17:45:38 GMT
SYSTEM_APP is deprecated and no longer used (except for appinfo migration).


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/4b126be4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4b126be4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4b126be4

Branch: refs/heads/USERGRID-536
Commit: 4b126be4d5fb67a91ae828c05d223f1f1bcfb3a1
Parents: 0766274
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Mon Apr 6 09:33:02 2015 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Mon Apr 6 09:33:02 2015 -0400

----------------------------------------------------------------------
 .../corepersistence/CpEntityManagerFactory.java | 33 ++++++++++----------
 .../corepersistence/util/CpNamingUtils.java     |  3 +-
 2 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4b126be4/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 4ffc92a..c81b47f 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -229,7 +229,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
 
     private String buildAppName( String organizationName, String name ) {
-        return StringUtils.lowerCase( name.contains( "/" ) ? name : organizationName + "/"
+ name );
+        return StringUtils.lowerCase(name.contains("/") ? name : organizationName + "/" +
name);
     }
 
 
@@ -333,13 +333,11 @@ public class CpEntityManagerFactory implements EntityManagerFactory,
Application
             }
         }
 
-        // delete the app from the application_info collection and delete its index
+        // delete the app from the application_info collection
 
         em.delete(appInfoToDelete);
 
-        final ApplicationEntityIndex entityIndex = managerCache.getEntityIndex(
-            new ApplicationScopeImpl(new SimpleId(applicationId, TYPE_APPLICATION)));
-        entityIndex.deleteApplication();
+        // TODO: what do we need to do about cleaning up graph edges from deleted app to
its connected entities?
 
         applicationIdCache.evictAppId(appInfoToDelete.getName());
     }
@@ -423,13 +421,16 @@ public class CpEntityManagerFactory implements EntityManagerFactory,
Application
 
         Map<String, UUID> appMap = new HashMap<>();
 
-        ApplicationScope appScope = CpNamingUtils.getApplicationScope(CpNamingUtils.SYSTEM_APP_ID);
+        ApplicationScope appScope =
+            CpNamingUtils.getApplicationScope(CpNamingUtils.MANAGEMENT_APPLICATION_ID );
         GraphManager gm = managerCache.getGraphManager(appScope);
 
-        EntityManager em = getEntityManager(CpNamingUtils.SYSTEM_APP_ID);
+        EntityManager em = getEntityManager(CpNamingUtils.MANAGEMENT_APPLICATION_ID);
         Application app = em.getApplication();
-        if(app == null)
-            throw new RuntimeException("System App "+CpNamingUtils.SYSTEM_APP_ID+" should
never be null");
+        if( app == null ) {
+            throw new RuntimeException("Management App "
+                + CpNamingUtils.MANAGEMENT_APPLICATION_ID + " should never be null");
+        }
         Id fromEntityId = new SimpleId( app.getUuid(), app.getType() );
 
         final String edgeType;
@@ -443,9 +444,9 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
         logger.debug("getApplications(): Loading edges of edgeType {} from {}:{}",
             new Object[] { edgeType, fromEntityId.getType(), fromEntityId.getUuid() } );
 
-        Observable<Edge> edges = gm.loadEdgesFromSource( new SimpleSearchByEdgeType(
-                fromEntityId, edgeType, Long.MAX_VALUE,
-                SearchByEdgeType.Order.DESCENDING, null ));
+        Observable<Edge> edges = gm.loadEdgesFromSource(new SimpleSearchByEdgeType(
+            fromEntityId, edgeType, Long.MAX_VALUE,
+            SearchByEdgeType.Order.DESCENDING, null));
 
         // TODO This is wrong, and will result in OOM if there are too many applications.
         // This needs to stream properly with a buffer
@@ -461,8 +462,6 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
                 edge.getTargetNode().getType(), edge.getTargetNode().getUuid()
             });
 
-
-
             org.apache.usergrid.persistence.model.entity.Entity appInfo =
                     managerCache.getEntityCollectionManager(  appScope ).load( targetId )
                         .toBlocking().lastOrDefault(null);
@@ -559,7 +558,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
     @Override
     public boolean setServiceProperty(final String name, final String value) {
-        return updateServiceProperties( new HashMap<String, String>() {{
+        return updateServiceProperties(new HashMap<String, String>() {{
             put(name, value);
         }});
     }
@@ -694,6 +693,8 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
     @Override
     public void rebuildInternalIndexes( ProgressObserver po ) throws Exception {
+
+        // TODO: remove this after appinfo migration done
         rebuildApplicationIndexes( CpNamingUtils.SYSTEM_APP_ID, po);
         rebuildApplicationIndexes( CpNamingUtils.MANAGEMENT_APPLICATION_ID, po );
     }
@@ -749,7 +750,7 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
         // could use any collection scope here, does not matter
         EntityCollectionManager ecm = getManagerCache().getEntityCollectionManager(
-            new ApplicationScopeImpl( new SimpleId( CpNamingUtils.SYSTEM_APP_ID, "application"
) ) );
+            new ApplicationScopeImpl( new SimpleId( CpNamingUtils.MANAGEMENT_APPLICATION_ID,
"application" ) ) );
 
         return ecm.getHealth();
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4b126be4/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
index 49929dc..a197fe0 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
@@ -52,7 +52,8 @@ public class CpNamingUtils {
     public static final  UUID MANAGEMENT_APPLICATION_ID =
             UUID.fromString("b6768a08-b5d5-11e3-a495-11ddb1de66c8");
 
-    /** Old and deprecated SYSTEM_APP */
+    /** Old and deprecated SYSTEM_APP. TODO: remove after app info migration done. */
+    @Deprecated
     public static final UUID SYSTEM_APP_ID =
         UUID.fromString("b6768a08-b5d5-11e3-a495-10ddb1de66c3");
 


Mime
View raw message