diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/Context.java | 24 | ||||
-rw-r--r-- | src/main/java/org/traccar/MainModule.java | 6 | ||||
-rw-r--r-- | src/main/java/org/traccar/database/DataManager.java | 8 |
3 files changed, 9 insertions, 29 deletions
diff --git a/src/main/java/org/traccar/Context.java b/src/main/java/org/traccar/Context.java index 00ab05d57..cbbc73d76 100644 --- a/src/main/java/org/traccar/Context.java +++ b/src/main/java/org/traccar/Context.java @@ -16,7 +16,6 @@ package org.traccar; import org.traccar.config.Config; -import org.traccar.config.Keys; import org.traccar.database.BaseObjectManager; import org.traccar.database.DataManager; import org.traccar.database.DeviceManager; @@ -47,12 +46,6 @@ public final class Context { return identityManager; } - private static DataManager dataManager; - - public static DataManager getDataManager() { - return dataManager; - } - private static GroupsManager groupsManager; public static GroupsManager getGroupsManager() { @@ -82,20 +75,17 @@ public final class Context { throw e; } - if (config.hasKey(Keys.DATABASE_URL)) { - dataManager = new DataManager(config, Main.getInjector().getInstance(Storage.class)); - } - - if (dataManager != null) { - groupsManager = new GroupsManager(dataManager); - deviceManager = new DeviceManager( - config, dataManager, Main.getInjector().getInstance(ConnectionManager.class)); - } + groupsManager = new GroupsManager(Main.getInjector().getInstance(DataManager.class)); + deviceManager = new DeviceManager( + config, + Main.getInjector().getInstance(DataManager.class), + Main.getInjector().getInstance(ConnectionManager.class)); identityManager = deviceManager; permissionsManager = new PermissionsManager( - dataManager, Main.getInjector().getInstance(Storage.class)); + Main.getInjector().getInstance(DataManager.class), + Main.getInjector().getInstance(Storage.class)); } diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java index 4e95b2be0..aac11e619 100644 --- a/src/main/java/org/traccar/MainModule.java +++ b/src/main/java/org/traccar/MainModule.java @@ -30,7 +30,6 @@ import org.eclipse.jetty.util.URIUtil; import org.traccar.broadcast.BroadcastService; import org.traccar.config.Config; import org.traccar.config.Keys; -import org.traccar.database.DataManager; import org.traccar.database.DeviceManager; import org.traccar.database.IdentityManager; import org.traccar.database.LdapProvider; @@ -115,11 +114,6 @@ public class MainModule extends AbstractModule { } @Provides - public static DataManager provideDataManager() { - return Context.getDataManager(); - } - - @Provides public static IdentityManager provideIdentityManager() { return Context.getIdentityManager(); } diff --git a/src/main/java/org/traccar/database/DataManager.java b/src/main/java/org/traccar/database/DataManager.java index 9ffe1fe97..3cad2dd63 100644 --- a/src/main/java/org/traccar/database/DataManager.java +++ b/src/main/java/org/traccar/database/DataManager.java @@ -32,6 +32,7 @@ import org.traccar.storage.query.Limit; import org.traccar.storage.query.Order; import org.traccar.storage.query.Request; +import javax.inject.Inject; import java.util.Collection; import java.util.Date; @@ -41,6 +42,7 @@ public class DataManager { private final boolean forceLdap; + @Inject public DataManager(Config config, Storage storage) throws Exception { this.storage = storage; forceLdap = config.getBoolean(Keys.LDAP_FORCE); @@ -68,12 +70,6 @@ public class DataManager { return null; } - public void updateUserPassword(User user) throws StorageException { - storage.updateObject(user, new Request( - new Columns.Include("hashedPassword", "salt"), - new Condition.Equals("id", "id"))); - } - public void updateDeviceStatus(Device device) throws StorageException { storage.updateObject(device, new Request( new Columns.Include("lastUpdate"), |