summaryrefslogtreecommitdiff
path: root/src/com/p4square/grow/GrowProcessComponent.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/p4square/grow/GrowProcessComponent.java')
-rw-r--r--src/com/p4square/grow/GrowProcessComponent.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/com/p4square/grow/GrowProcessComponent.java b/src/com/p4square/grow/GrowProcessComponent.java
index 29da766..7d0938e 100644
--- a/src/com/p4square/grow/GrowProcessComponent.java
+++ b/src/com/p4square/grow/GrowProcessComponent.java
@@ -38,13 +38,17 @@ public class GrowProcessComponent extends Component {
* Create a new Grow Process website component combining a frontend and backend.
*/
public GrowProcessComponent() throws Exception {
+ this(new Config());
+ }
+
+ public GrowProcessComponent(Config config) {
// Clients
getClients().add(Protocol.FILE);
getClients().add(Protocol.HTTP);
getClients().add(Protocol.HTTPS);
// Prepare mConfig
- mConfig = new Config();
+ mConfig = config;
// Frontend
GrowFrontend frontend = new GrowFrontend(mConfig);
@@ -62,6 +66,7 @@ public class GrowProcessComponent extends Component {
getDefaultHost().attach("/backend", auth);
}
+
@Override
public void start() throws Exception {
// Load mConfigs
@@ -84,10 +89,16 @@ public class GrowProcessComponent extends Component {
* Stand-alone main for testing.
*/
public static void main(String[] args) throws Exception {
+ // Load an optional config file from the first argument.
+ Config config = new Config();
+ config.setDomain("dev");
+ if (args.length == 1) {
+ config.updateConfig(args[0]);
+ }
+
// Start the HTTP Server
- final GrowProcessComponent component = new GrowProcessComponent();
+ final GrowProcessComponent component = new GrowProcessComponent(config);
component.getServers().add(Protocol.HTTP, 8085);
- //component.getClients().add(new Client(null, Arrays.asList(Protocol.HTTPS), "org.restlet.ext.httpclient.HttpClientHelper"));
// Static content
try {
@@ -102,12 +113,6 @@ public class GrowProcessComponent extends Component {
+ e.getMessage(), e);
}
- // Load an optional config file from the first argument.
- component.mConfig.setDomain("dev");
- if (args.length == 1) {
- component.mConfig.updateConfig(args[0]);
- }
-
// Setup shutdown hook
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {