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/21 15:02:14 UTC
[08/25] incubator-usergrid git commit: Restores
/system/database/setup functionality after init method refactor
Restores /system/database/setup functionality after init method refactor
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/2ac22fd1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/2ac22fd1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/2ac22fd1
Branch: refs/heads/app-rebuild-fix
Commit: 2ac22fd1f23cdb6fecdeb7bc68560b8b39efafe7
Parents: c1b734e
Author: Todd Nine <tn...@apigee.com>
Authored: Tue Feb 17 22:02:45 2015 -0800
Committer: Todd Nine <tn...@apigee.com>
Committed: Tue Feb 17 22:02:45 2015 -0800
----------------------------------------------------------------------
.../main/resources/usergrid-default.properties | 13 +-
.../usergrid/corepersistence/CpSetup.java | 3 +
.../usergrid/rest/DatabaseInitializer.java | 146 -------------------
3 files changed, 9 insertions(+), 153 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ac22fd1/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 c840d21..068572d 100644
--- a/stack/config/src/main/resources/usergrid-default.properties
+++ b/stack/config/src/main/resources/usergrid-default.properties
@@ -35,9 +35,9 @@ usergrid.persistence=CP
# Corepersistence properties
# These will be set automatically bp CpSetup
-#cassandra.hosts=
-#cassandra.port=
-#cassandra.cluster_name=
+#cassandra.hosts=
+#cassandra.port=
+#cassandra.cluster_name=
#collections.keyspace.strategy.class=
#collections.keyspace.strategy.options=replication_factor:1
@@ -54,7 +54,6 @@ collection.stage.transient.timeout=60
hystrix.threadpool.graph_user.coreSize=40
hystrix.threadpool.graph_async.coreSize=40
-elasticsearch.embedded=false
elasticsearch.cluster_name=elasticsearch
elasticsearch.index_prefix=usergrid
elasticsearch.hosts=127.0.0.1
@@ -186,7 +185,7 @@ usergrid.queue.lock.timeout=5
#
# Scheduler setup
-#Time in milliseconds that a job can be started without a heartbeat before being considered dead.
+#Time in milliseconds that a job can be started without a heartbeat before being considered dead.
#Note that this must be high enough so that jobs that are iteration based can run an iteration and update the heartbeat
usergrid.scheduler.job.timeout=120000
#The path to the queue in the managment app to get jobs from
@@ -195,7 +194,7 @@ usergrid.scheduler.job.queueName=/jobs
usergrid.scheduler.job.workers=4
#Poll interval to check for new jobs in millseconds. 5 seconds is the default. It will run all jobs up to current so this won't limit throughput
usergrid.scheduler.job.interval=5000
-#The max number of times a job can fail before removing it permanently. Note that this count is INCLUSIVE.
+#The max number of times a job can fail before removing it permanently. Note that this count is INCLUSIVE.
#If the value is 10, the 11th fail will mark the job as dead
usergrid.scheduler.job.maxfail=10
@@ -338,7 +337,7 @@ usergrid.management.email.admin-password-reset=\
# User approval flow
#
-# email to admin to approve and activate new app user
+# email to admin to approve and activate new app user
usergrid.management.email.admin-user-activation=\
<p>To activate the user account for ${user_email}, click here:</p>\n\
<p><a href="${activation_url}">${activation_url}</a></p>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ac22fd1/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 299681d..a09ca49 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
@@ -83,6 +83,9 @@ public class CpSetup implements Setup {
@Override
public void init() throws Exception {
//a no op, creating the injector creates the connections
+ setupStaticKeyspace();
+ setupSystemKeyspace();
+ createDefaultApplications();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/2ac22fd1/stack/rest/src/test/java/org/apache/usergrid/rest/DatabaseInitializer.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/DatabaseInitializer.java b/stack/rest/src/test/java/org/apache/usergrid/rest/DatabaseInitializer.java
deleted file mode 100644
index 79a9410..0000000
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/DatabaseInitializer.java
+++ /dev/null
@@ -1,146 +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.usergrid.rest;
-
-
-import java.util.Map;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.apache.usergrid.management.ManagementService;
-import org.apache.usergrid.mq.QueueManagerFactory;
-import org.apache.usergrid.persistence.EntityManagerFactory;
-import org.apache.usergrid.services.ServiceManagerFactory;
-
-
-public class DatabaseInitializer {
-
- private static final Logger logger = LoggerFactory.getLogger( DatabaseInitializer.class );
-
- protected EntityManagerFactory emf;
-
- protected ServiceManagerFactory smf;
-
- protected ManagementService management;
-
- protected Properties properties;
-
- protected QueueManagerFactory qmf;
-
-
- public DatabaseInitializer() {
-
- }
-
-
- public EntityManagerFactory getEntityManagerFactory() {
- return emf;
- }
-
-
- @Autowired
- public void setEntityManagerFactory( EntityManagerFactory emf ) {
- this.emf = emf;
- }
-
-
- public ServiceManagerFactory getServiceManagerFactory() {
- return smf;
- }
-
-
- @Autowired
- public void setServiceManagerFactory( ServiceManagerFactory smf ) {
- this.smf = smf;
- }
-
-
- public ManagementService getManagementService() {
- return management;
- }
-
-
- @Autowired
- public void setManagementService( ManagementService management ) {
- this.management = management;
- }
-
-
- public Properties getProperties() {
- return properties;
- }
-
-
- @Autowired
- public void setProperties( Properties properties ) {
- this.properties = properties;
- }
-
-
- public QueueManagerFactory getQueueManagerFactory() {
- return qmf;
- }
-
-
- @Autowired
- public void setQueueManagerFactory( QueueManagerFactory qmf ) {
- this.qmf = qmf;
- }
-
-
- boolean databaseInitializationPerformed = false;
-
-
- public void init() {
- logger.info( "Initializing server with Spring" );
-
- // If we're running an embedded Cassandra, we always need to initialize
- // it since Hector wipes the data on startup.
- //
-
- if ( databaseInitializationPerformed ) {
- logger.info( "Can only attempt to initialized database once per JVM process" );
- return;
- }
- databaseInitializationPerformed = true;
-
- logger.info( "Initializing Cassandra database" );
- Map<String, String> properties = emf.getServiceProperties();
- if ( properties != null ) {
- logger.error( "System properties are initialized, database is set up already." );
- return;
- }
-
- try {
- emf.setup();
- }
- catch ( Exception e ) {
- logger.error( "Unable to complete core database setup, possibly due to it being setup already", e );
- }
-
- try {
- management.setup();
- }
- catch ( Exception e ) {
- logger.error( "Unable to complete management database setup, possibly due to it being setup already", e );
- }
-
- logger.info( "Usergrid schema setup" );
- }
-}