aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-11 15:26:11 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-11 15:26:11 +0500
commit26db3ccc2ed5d43a0e791a29d5cc4afca192e4b7 (patch)
tree18c8460f1f9bd4632086228dabfa4c3084d69db1 /src/org/traccar/Context.java
parent32a0fee0b092e488662ed29b7b7f1f303ae57e0f (diff)
downloadtrackermap-server-26db3ccc2ed5d43a0e791a29d5cc4afca192e4b7.tar.gz
trackermap-server-26db3ccc2ed5d43a0e791a29d5cc4afca192e4b7.tar.bz2
trackermap-server-26db3ccc2ed5d43a0e791a29d5cc4afca192e4b7.zip
Initialize tripsConfig ones in Context
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 4bcc1468b..a69b1786d 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -67,7 +67,7 @@ import org.traccar.geolocation.GeolocationProvider;
import org.traccar.geolocation.MozillaGeolocationProvider;
import org.traccar.geolocation.OpenCellIdGeolocationProvider;
import org.traccar.notification.EventForwarder;
-import org.traccar.reports.ReportUtils;
+import org.traccar.reports.model.TripsConfig;
import org.traccar.smpp.SmppClient;
import org.traccar.web.WebServer;
@@ -244,6 +244,21 @@ public final class Context {
return overspeedEventHandler;
}
+ private static TripsConfig tripsConfig;
+
+ public static TripsConfig getTripsConfig() {
+ return tripsConfig;
+ }
+
+ public static TripsConfig initTripsConfig() {
+ return new TripsConfig(
+ config.getLong("report.trip.minimalTripDistance", 500),
+ config.getLong("report.trip.minimalTripDuration", 300) * 1000,
+ config.getLong("report.trip.minimalParkingDuration", 300) * 1000,
+ config.getBoolean("report.trip.greedyParking"),
+ config.getLong("report.trip.minimalNoDataDuration", 3600) * 1000);
+ }
+
public static void init(String[] arguments) throws Exception {
config = new Config();
@@ -342,6 +357,8 @@ public final class Context {
connectionManager = new ConnectionManager();
+ tripsConfig = initTripsConfig();
+
if (config.getBoolean("event.enable")) {
geofenceManager = new GeofenceManager(dataManager);
calendarManager = new CalendarManager(dataManager);
@@ -366,7 +383,7 @@ public final class Context {
velocityEngine = new VelocityEngine();
velocityEngine.init(velocityProperties);
- motionEventHandler = new MotionEventHandler(ReportUtils.initTripsConfig());
+ motionEventHandler = new MotionEventHandler(tripsConfig);
overspeedEventHandler = new OverspeedEventHandler(
Context.getConfig().getLong("event.overspeed.minimalDuration") * 1000,
Context.getConfig().getBoolean("event.overspeed.notRepeat"));