aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-14 19:34:58 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-14 19:34:58 +1200
commitf9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617 (patch)
tree057957543cb18c20bf66de6d363fdc821700832d /src/org/traccar/Context.java
parente98b18b8b0a8c99d24ac8010c1393978d071baa2 (diff)
downloadtrackermap-server-f9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617.tar.gz
trackermap-server-f9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617.tar.bz2
trackermap-server-f9b7908c1fe0c04e9dcb93b4261b9fe0b4bb1617.zip
Reduce dependencies on data manager (fix #954)
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 707e6edb6..f1fe443ed 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -97,10 +97,7 @@ public class Context {
dataManager = new DataManager(config);
identityManager = dataManager;
- connectionManager = new ConnectionManager();
- if (!config.getBoolean("web.old")) {
- permissionsManager = new PermissionsManager();
- }
+ connectionManager = new ConnectionManager(dataManager);
if (config.getBoolean("geocoder.enable")) {
String type = config.getString("geocoder.type", "google");
@@ -119,22 +116,21 @@ public class Context {
}
if (config.getBoolean("web.enable")) {
- webServer = new WebServer(config);
+ if (!config.getBoolean("web.old")) {
+ permissionsManager = new PermissionsManager(dataManager);
+ webServer = new WebServer(config);
+ } else {
+ webServer = new WebServer(config, dataManager.getDataSource());
+ }
}
serverManager = new ServerManager();
-
- connectionManager.init(dataManager);
- serverManager.init();
}
- /**
- * Initialize context for unit testing
- */
- public static void init(IdentityManager identityManager) {
+ public static void init(IdentityManager testIdentityManager) {
config = new Config();
- connectionManager = new ConnectionManager();
- Context.identityManager = identityManager;
+ connectionManager = new ConnectionManager(null);
+ identityManager = testIdentityManager;
}
}