aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-11 15:06:09 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-11 15:06:09 +0500
commit32a0fee0b092e488662ed29b7b7f1f303ae57e0f (patch)
tree8bfa422fd12567c1fd8cababe9b225a913492f7b /src/org/traccar/Context.java
parent2e459d8d591ee9d3578a38d981e7c1c13eb3c389 (diff)
downloadtrackermap-server-32a0fee0b092e488662ed29b7b7f1f303ae57e0f.tar.gz
trackermap-server-32a0fee0b092e488662ed29b7b7f1f303ae57e0f.tar.bz2
trackermap-server-32a0fee0b092e488662ed29b7b7f1f303ae57e0f.zip
Make Overspeed and Motion events handlers singleton and move some code to function
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 306a37e83..4bcc1468b 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -41,6 +41,8 @@ import org.traccar.database.GeofenceManager;
import org.traccar.database.GroupsManager;
import org.traccar.database.StatisticsManager;
import org.traccar.database.UsersManager;
+import org.traccar.events.MotionEventHandler;
+import org.traccar.events.OverspeedEventHandler;
import org.traccar.geocoder.BingMapsGeocoder;
import org.traccar.geocoder.FactualGeocoder;
import org.traccar.geocoder.GeocodeFarmGeocoder;
@@ -65,6 +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.smpp.SmppClient;
import org.traccar.web.WebServer;
@@ -229,6 +232,18 @@ public final class Context {
return smppClient;
}
+ private static MotionEventHandler motionEventHandler;
+
+ public static MotionEventHandler getMotionEventHandler() {
+ return motionEventHandler;
+ }
+
+ private static OverspeedEventHandler overspeedEventHandler;
+
+ public static OverspeedEventHandler getOverspeedEventHandler() {
+ return overspeedEventHandler;
+ }
+
public static void init(String[] arguments) throws Exception {
config = new Config();
@@ -350,6 +365,11 @@ public final class Context {
velocityEngine = new VelocityEngine();
velocityEngine.init(velocityProperties);
+
+ motionEventHandler = new MotionEventHandler(ReportUtils.initTripsConfig());
+ overspeedEventHandler = new OverspeedEventHandler(
+ Context.getConfig().getLong("event.overspeed.minimalDuration") * 1000,
+ Context.getConfig().getBoolean("event.overspeed.notRepeat"));
}
serverManager = new ServerManager();