summaryrefslogtreecommitdiff
path: root/src/com/p4square/grow/backend/GrowBackend.java
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2013-08-31 23:44:05 -0700
committerJesse Morgan <jesse@jesterpm.net>2013-08-31 23:44:05 -0700
commitec17ac7fca60b87449355f8c240fc7e0512eba33 (patch)
tree86299b9ad492279a17d9c4022a250161f76b5068 /src/com/p4square/grow/backend/GrowBackend.java
parentdced76f5f6f7efb4b4fd49e41a3fe73a9ab3bdc3 (diff)
Fixing logins and configuration
Diffstat (limited to 'src/com/p4square/grow/backend/GrowBackend.java')
-rw-r--r--src/com/p4square/grow/backend/GrowBackend.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/com/p4square/grow/backend/GrowBackend.java b/src/com/p4square/grow/backend/GrowBackend.java
index 515cd1b..d072dfb 100644
--- a/src/com/p4square/grow/backend/GrowBackend.java
+++ b/src/com/p4square/grow/backend/GrowBackend.java
@@ -26,7 +26,7 @@ import com.p4square.grow.backend.resources.TrainingRecordResource;
* @author Jesse Morgan <jesse@jesterpm.net>
*/
public class GrowBackend extends Application {
- private final static Logger cLog = Logger.getLogger(GrowBackend.class);
+ private final static Logger LOG = Logger.getLogger(GrowBackend.class);
private final Config mConfig;
private final CassandraDatabase mDatabase;
@@ -42,7 +42,7 @@ public class GrowBackend extends Application {
// Survey API
router.attach("/assessment/question/{questionId}", SurveyResource.class);
-
+
router.attach("/accounts/{userId}/assessment", SurveyResultsResource.class);
router.attach("/accounts/{userId}/assessment/answers/{questionId}",
SurveyResultsResource.class);
@@ -50,7 +50,7 @@ public class GrowBackend extends Application {
// Training API
router.attach("/training/{level}", TrainingResource.class);
router.attach("/training/{level}/videos/{videoId}", TrainingResource.class);
-
+
router.attach("/accounts/{userId}/training", TrainingRecordResource.class);
router.attach("/accounts/{userId}/training/videos/{videoId}",
TrainingRecordResource.class);
@@ -58,14 +58,14 @@ public class GrowBackend extends Application {
return router;
}
-
+
/**
* Open the database.
*/
@Override
public void start() throws Exception {
super.start();
-
+
// Load config
final String configDomain =
getContext().getParameters().getFirstValue("configDomain");
@@ -79,6 +79,7 @@ public class GrowBackend extends Application {
getContext().getParameters().getFirstValue("configFile");
if (configFilename != null) {
+ LOG.info("Loading configuration from " + configFilename);
mConfig.updateConfig(configFilename);
}
@@ -87,13 +88,13 @@ public class GrowBackend extends Application {
mDatabase.setKeyspaceName(mConfig.getString("keyspace", "GROW"));
mDatabase.init();
}
-
+
/**
* Close the database.
*/
@Override
public void stop() throws Exception {
- cLog.info("Shutting down...");
+ LOG.info("Shutting down...");
mDatabase.close();
super.stop();
@@ -115,24 +116,24 @@ public class GrowBackend extends Application {
component.getServers().add(Protocol.HTTP, 9095);
component.getClients().add(Protocol.HTTP);
component.getDefaultHost().attach(new GrowBackend());
-
+
// Setup shutdown hook
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
component.stop();
} catch (Exception e) {
- cLog.error("Exception during cleanup", e);
+ LOG.error("Exception during cleanup", e);
}
}
});
- cLog.info("Starting server...");
+ LOG.info("Starting server...");
try {
component.start();
} catch (Exception e) {
- cLog.fatal("Could not start: " + e.getMessage(), e);
+ LOG.fatal("Could not start: " + e.getMessage(), e);
}
}
}