You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2015/02/26 18:11:41 UTC

[40/50] [abbrv] incubator-usergrid git commit: Added fix for full use of virtual keyspaces and for token generation using the getKeyspace method.

Added fix for full use of virtual keyspaces and for token generation using the getKeyspace method.


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

Branch: refs/heads/two-dot-o-import
Commit: 48a2be7a6e4c7166b2ce392a278eec7c2544d184
Parents: 95ac7af
Author: grey <gr...@apigee.com>
Authored: Wed Feb 25 16:08:08 2015 -0800
Committer: grey <gr...@apigee.com>
Committed: Wed Feb 25 16:08:08 2015 -0800

----------------------------------------------------------------------
 .../org/apache/usergrid/corepersistence/CpSetup.java | 13 -------------
 .../persistence/cassandra/CassandraService.java      | 11 +++++++++--
 .../usergrid/persistence/cassandra/SetupImpl.java    | 15 +++------------
 3 files changed, 12 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/48a2be7a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
index 345473a..d70c16c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java
@@ -172,19 +172,6 @@ public class CpSetup implements Setup {
     public void setupApplicationKeyspace( final UUID applicationId, String applicationName ) throws Exception {
 
         migrate();
-
-        // Need this legacy stuff for queues
-
-        String app_keyspace = keyspaceForApplication( applicationId );
-
-        logger.info( "Creating application keyspace " + app_keyspace + " for " + applicationName + " application" );
-
-        cass.createColumnFamily( app_keyspace,
-            createColumnFamilyDefinition( getApplicationKeyspace(), APPLICATIONS_CF, ComparatorType.BYTESTYPE ) );
-
-        cass.createColumnFamilies( app_keyspace, getCfDefs( ApplicationCF.class, app_keyspace ) );
-
-        cass.createColumnFamilies( app_keyspace, getCfDefs( QueuesCF.class, app_keyspace ) );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/48a2be7a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
index 38d9555..96d3fd9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
@@ -247,8 +247,15 @@ public class CassandraService {
 
 
     public Keyspace getKeyspace( String keyspace, UUID prefix ) {
-        Keyspace ko = createVirtualKeyspace( keyspace, prefix, ue, cluster, consistencyLevelPolicy,
+        Keyspace ko = null;
+        if ( ( prefix != null ) ) {
+            ko = createVirtualKeyspace( keyspace, prefix, ue, cluster, consistencyLevelPolicy,
                     ON_FAIL_TRY_ALL_AVAILABLE, accessMap );
+        }
+        else {
+            ko = HFactory.createKeyspace( keyspace, cluster, consistencyLevelPolicy, ON_FAIL_TRY_ALL_AVAILABLE,
+                    accessMap );
+        }
         return ko;
     }
 
@@ -262,7 +269,7 @@ public class CassandraService {
 
     /** The Usergrid_Applications keyspace directly */
     public Keyspace getUsergridApplicationKeyspace() {
-        return getKeyspace( getApplicationKeyspace(), null );
+        return getKeyspace( getApplicationKeyspace(),  null );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/48a2be7a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/SetupImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/SetupImpl.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/SetupImpl.java
index e6c52bd..23c0489 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/SetupImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/SetupImpl.java
@@ -103,18 +103,9 @@ public class SetupImpl implements Setup {
      * @throws Exception the exception
      */
     @Override
-    public void setupApplicationKeyspace(final UUID applicationId, String applicationName ) throws Exception {
-
-        String app_keyspace = keyspaceForApplication( applicationId );
-
-        logger.info( "Creating application keyspace " + app_keyspace + " for "
-                + applicationName + " application" );
-
-        cass.createColumnFamily( app_keyspace, createColumnFamilyDefinition(
-                getApplicationKeyspace(), APPLICATIONS_CF, ComparatorType.BYTESTYPE ) );
-
-        cass.createColumnFamilies( app_keyspace, getCfDefs( ApplicationCF.class, app_keyspace));
-        cass.createColumnFamilies( app_keyspace, getCfDefs( QueuesCF.class, app_keyspace ) );
+    public void setupApplicationKeyspace(
+            final UUID applicationId, String applicationName ) throws Exception {
+        logger.info("This method no longer needed due to using virtual keyspaces all the time.");
     }