aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/MainModule.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-25 22:00:30 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-25 22:00:30 -0800
commit2b9469e85bf7da0905ac3a679554178532f51009 (patch)
tree21ac831f314f2dcb302a7e5e25456523074c205b /src/org/traccar/MainModule.java
parentb8318c0a9a09dd0811eee189237e80b7da478e5a (diff)
downloadtrackermap-server-2b9469e85bf7da0905ac3a679554178532f51009.tar.gz
trackermap-server-2b9469e85bf7da0905ac3a679554178532f51009.tar.bz2
trackermap-server-2b9469e85bf7da0905ac3a679554178532f51009.zip
Refactor engine hours handler
Diffstat (limited to 'src/org/traccar/MainModule.java')
-rw-r--r--src/org/traccar/MainModule.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/org/traccar/MainModule.java b/src/org/traccar/MainModule.java
index 0c3c5be51..cd5f2568e 100644
--- a/src/org/traccar/MainModule.java
+++ b/src/org/traccar/MainModule.java
@@ -44,7 +44,9 @@ import org.traccar.geolocation.MozillaGeolocationProvider;
import org.traccar.geolocation.OpenCellIdGeolocationProvider;
import org.traccar.geolocation.UnwiredGeolocationProvider;
import org.traccar.handler.DistanceHandler;
+import org.traccar.handler.EngineHoursHandler;
import org.traccar.handler.FilterHandler;
+import org.traccar.handler.GeocoderHandler;
import org.traccar.handler.GeolocationHandler;
import org.traccar.handler.HemisphereHandler;
import org.traccar.handler.MotionHandler;
@@ -211,10 +213,30 @@ public class MainModule extends AbstractModule {
@Singleton
@Provides
+ public static GeocoderHandler provideGeocoderHandler(
+ Config config, @Nullable Geocoder geocoder, IdentityManager identityManager,
+ StatisticsManager statisticsManager) {
+ if (geocoder != null) {
+ return new GeocoderHandler(config, geocoder, identityManager, statisticsManager);
+ }
+ return null;
+ }
+
+ @Singleton
+ @Provides
public static MotionHandler provideMotionHandler(TripsConfig tripsConfig) {
return new MotionHandler(tripsConfig.getSpeedThreshold());
}
+ @Singleton
+ @Provides
+ public static EngineHoursHandler provideEngineHoursHandler(Config config, IdentityManager identityManager) {
+ if (config.getBoolean(Keys.PROCESSING_ENGINE_HOURS_ENABLE)) {
+ return new EngineHoursHandler(identityManager);
+ }
+ return null;
+ }
+
@Override
protected void configure() {
binder().requireExplicitBindings();