diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-07-16 12:33:32 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-16 12:33:32 +1200 |
commit | 6aa4a84c9ef97f5d7980e71cf524a445e87de714 (patch) | |
tree | a3e90f40f0c42cc59a6654965ff3dcf37d8d99cb /src/org/traccar/Context.java | |
parent | 6fefd48ab48a2382a9a7bc07e168b48a1ce8bc40 (diff) | |
parent | d71210f1f408c757d4fe3da07829bbc3362a7e93 (diff) | |
download | trackermap-server-6aa4a84c9ef97f5d7980e71cf524a445e87de714.tar.gz trackermap-server-6aa4a84c9ef97f5d7980e71cf524a445e87de714.tar.bz2 trackermap-server-6aa4a84c9ef97f5d7980e71cf524a445e87de714.zip |
Merge pull request #2116 from Abyss777/device_manager_final
Move code related to devices to DeviceManager
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r-- | src/org/traccar/Context.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 0bb18b675..d32837755 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -18,6 +18,7 @@ package org.traccar; import com.ning.http.client.AsyncHttpClient; import org.traccar.database.ConnectionManager; import org.traccar.database.DataManager; +import org.traccar.database.DeviceManager; import org.traccar.database.IdentityManager; import org.traccar.database.NotificationManager; import org.traccar.database.PermissionsManager; @@ -67,6 +68,12 @@ public final class Context { return dataManager; } + private static DeviceManager deviceManager; + + public static DeviceManager getDeviceManager() { + return deviceManager; + } + private static ConnectionManager connectionManager; public static ConnectionManager getConnectionManager() { @@ -142,7 +149,12 @@ public final class Context { if (config.hasKey("database.url")) { dataManager = new DataManager(config); } - identityManager = dataManager; + + if (dataManager != null) { + deviceManager = new DeviceManager(dataManager); + } + + identityManager = deviceManager; if (config.getBoolean("geocoder.enable")) { String type = config.getString("geocoder.type", "google"); @@ -205,7 +217,7 @@ public final class Context { permissionsManager = new PermissionsManager(dataManager); - connectionManager = new ConnectionManager(dataManager); + connectionManager = new ConnectionManager(); if (config.getBoolean("event.geofenceHandler")) { geofenceManager = new GeofenceManager(dataManager); @@ -225,7 +237,6 @@ public final class Context { public static void init(IdentityManager testIdentityManager) { config = new Config(); - connectionManager = new ConnectionManager(null); identityManager = testIdentityManager; } |