usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [1/6] git commit: Use already loaded Usergrid properties to populate Core Persistence configuration.
Date Fri, 25 Jul 2014 17:40:39 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o b1e41a05d -> f2b6d25b6


Use already loaded Usergrid properties to populate Core Persistence configuration.


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

Branch: refs/heads/two-dot-o
Commit: 287ec6ee7e6f628e12f3c1681a7dd5e17e7c161c
Parents: 54f045f
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Wed Jul 23 10:45:23 2014 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Wed Jul 23 10:45:23 2014 -0400

----------------------------------------------------------------------
 .../main/resources/usergrid-default.properties  | 26 ++++++++++----------
 .../usergrid/corepersistence/CpSetup.java       | 16 +++++++++---
 2 files changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/287ec6ee/stack/config/src/main/resources/usergrid-default.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/main/resources/usergrid-default.properties b/stack/config/src/main/resources/usergrid-default.properties
index 07483f4..369bdf6 100644
--- a/stack/config/src/main/resources/usergrid-default.properties
+++ b/stack/config/src/main/resources/usergrid-default.properties
@@ -32,33 +32,34 @@ usergrid.persistence=CP
 #
 # Corepersistence properties
 
-#cassandra.hosts=127.0.0.1  # will be set by CpSetup
-#cassandra.port=9160        # will be set by CpSetup
-cassandra.embedded=true
+# These will be set automatically bp CpSetup
+#cassandra.hosts=       
+#cassandra.port=         
+#cassandra.cluster_name= 
+#collections.keyspace.strategy.class=
+#collections.keyspace.strategy.options=replication_factor:1
+
+collections.keyspace=Usergrid_Applications
+cassandra.embedded=false
 cassandra.version=1.2
-cassandra.cluster_name=Usergrid
 cassandra.timeout=2000
 
-collections.keyspace=Usergrid_Applications
-collections.keyspace.strategy.options=replication_factor:1
-collections.keyspace.strategy.class=org.apache.cassandra.locator.SimpleStrategy
+# Max Cassandra connections, applies to both CP and EM
+cassandra.connections=600
 
 collection.stage.transient.timeout=60
 
 hystrix.threadpool.graph_user.coreSize=40
 hystrix.threadpool.graph_async.coreSize=40
 
-elasticsearch.embedded=true
-elasticsearch.cluster_name=usergrid_test
+elasticsearch.embedded=false
+elasticsearch.cluster_name=elasticsearch
 elasticsearch.index_prefix=usergrid
 elasticsearch.hosts=127.0.0.1
 elasticsearch.port=9300
 
 index.query.limit.default=100
 
-# Max Cassandra connections, applies to both CP and EM
-cassandra.connections=600
-
 
 ###############################################################################
 #
@@ -72,7 +73,6 @@ cassandra.cluster=Test Cluster
 
 cassandra.keyspace.strategy=org.apache.cassandra.locator.SimpleStrategy
 #cassandra.keyspace.strategy=org.apache.cassandra.locator.NetworkTopologyStrategy
-
 #cassandra.keyspace.strategy.options.replication_factor=1
 #cassandra.keyspace.strategy.options.us-east=1
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/287ec6ee/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 dd1da81..46820e1 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
@@ -96,8 +96,6 @@ public class CpSetup implements Setup {
         try {
             logger.info("Loading Core Persistence properties");
 
-            ConfigurationManager.loadCascadedPropertiesFromResources( "usergrid-default"
);
-
             String hostsString = "";
             CassandraHost[] hosts = cass.getCassandraHostConfigurator().buildCassandraHosts();
             if ( hosts.length == 0 ) {
@@ -109,14 +107,24 @@ public class CpSetup implements Setup {
                 sep = ",";
             }
 
+            // Translate Usergrid properties into Core Persistence properties
+
             Properties cpProps = new Properties();
             cpProps.put("cassandra.hosts", hostsString);
             cpProps.put("cassandra.port", hosts[0].getPort());
+            cpProps.put("cassandra.cluster_name", 
+                    cass.getProperties().get("cassandra.cluster"));
+            cpProps.put("collections.keyspace.strategy.class", 
+                    cass.getProperties().get("cassandra.keyspace.strategy"));
+            cpProps.put("collections.keyspace.strategy.options", "replication_factor:" +
 
+                    cass.getProperties().get("cassandra.keyspace.strategy.options.replication_factor"));
+            logger.debug("Set Cassandra properties for Core Persistence: " + cpProps.toString()
);
+
+            cpProps.putAll( cass.getProperties() );
 
             ConfigurationManager.loadProperties( cpProps );
-            logger.debug("Set Cassandra properties for Core Persistence: " + cpProps.toString()
);
         }
-        catch ( IOException e ) {
+        catch ( Exception e ) {
             throw new RuntimeException( "Fatal error loading configuration.", e );
         }
 


Mime
View raw message