aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <atananaev@lyft.com>2020-12-28 17:02:23 -0800
committerAnton Tananaev <atananaev@lyft.com>2020-12-28 17:02:23 -0800
commit51704590a835057bf4850a5eaf8c5037d20f648a (patch)
treec38acebce6cfec36ead21918d6272a99452b9ac5 /src/main/java/org/traccar/database
parent551298664bbac541450d83a021a2f8d77e65b216 (diff)
downloadtrackermap-server-51704590a835057bf4850a5eaf8c5037d20f648a.tar.gz
trackermap-server-51704590a835057bf4850a5eaf8c5037d20f648a.tar.bz2
trackermap-server-51704590a835057bf4850a5eaf8c5037d20f648a.zip
Migrate long config keys
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/ConnectionManager.java5
-rw-r--r--src/main/java/org/traccar/database/DeviceManager.java9
2 files changed, 6 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/database/ConnectionManager.java b/src/main/java/org/traccar/database/ConnectionManager.java
index 9342fd3de..8278baa7c 100644
--- a/src/main/java/org/traccar/database/ConnectionManager.java
+++ b/src/main/java/org/traccar/database/ConnectionManager.java
@@ -23,6 +23,7 @@ import org.traccar.Context;
import org.traccar.GlobalTimer;
import org.traccar.Main;
import org.traccar.Protocol;
+import org.traccar.config.Keys;
import org.traccar.handler.events.MotionEventHandler;
import org.traccar.handler.events.OverspeedEventHandler;
import org.traccar.model.Device;
@@ -44,8 +45,6 @@ public class ConnectionManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionManager.class);
- private static final long DEFAULT_TIMEOUT = 600;
-
private final long deviceTimeout;
private final boolean enableStatusEvents;
private final boolean updateDeviceState;
@@ -55,7 +54,7 @@ public class ConnectionManager {
private final Map<Long, Timeout> timeouts = new ConcurrentHashMap<>();
public ConnectionManager() {
- deviceTimeout = Context.getConfig().getLong("status.timeout", DEFAULT_TIMEOUT) * 1000;
+ deviceTimeout = Context.getConfig().getLong(Keys.STATUS_TIMEOUT) * 1000;
enableStatusEvents = Context.getConfig().getBoolean("event.enable");
updateDeviceState = Context.getConfig().getBoolean("status.updateDeviceState");
}
diff --git a/src/main/java/org/traccar/database/DeviceManager.java b/src/main/java/org/traccar/database/DeviceManager.java
index c78526b3e..d238e9229 100644
--- a/src/main/java/org/traccar/database/DeviceManager.java
+++ b/src/main/java/org/traccar/database/DeviceManager.java
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.config.Config;
import org.traccar.Context;
+import org.traccar.config.Keys;
import org.traccar.model.Command;
import org.traccar.model.Device;
import org.traccar.model.DeviceState;
@@ -41,8 +42,6 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
private static final Logger LOGGER = LoggerFactory.getLogger(DeviceManager.class);
- public static final long DEFAULT_REFRESH_DELAY = 300;
-
private final Config config;
private final long dataRefreshDelay;
@@ -68,7 +67,7 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
} finally {
writeUnlock();
}
- dataRefreshDelay = config.getLong("database.refreshDelay", DEFAULT_REFRESH_DELAY) * 1000;
+ dataRefreshDelay = config.getLong(Keys.DATABASE_REFRESH_DELAY) * 1000;
refreshLastPositions();
}
@@ -77,9 +76,9 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity
Device device = new Device();
device.setName(uniqueId);
device.setUniqueId(uniqueId);
- device.setCategory(Context.getConfig().getString("database.registerUnknown.defaultCategory"));
+ device.setCategory(Context.getConfig().getString(Keys.DATABASE_REGISTER_UNKNOWN_DEFAULT_CATEGORY));
- long defaultGroupId = Context.getConfig().getLong("database.registerUnknown.defaultGroupId");
+ long defaultGroupId = Context.getConfig().getLong(Keys.DATABASE_REGISTER_UNKNOWN_DEFAULT_GROUP_ID);
if (defaultGroupId != 0) {
device.setGroupId(defaultGroupId);
}