aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/MainModule.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-26 19:05:25 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-26 19:05:25 -0800
commit728e55fc00a4b7b980d6e59f2ce8664859a5c848 (patch)
treeaf71d95acbd58370dd7c0ac4463275513360f610 /src/org/traccar/MainModule.java
parent03539bca46f9242ff62db9a6c9ab722ae2bb6a4d (diff)
downloadtrackermap-server-728e55fc00a4b7b980d6e59f2ce8664859a5c848.tar.gz
trackermap-server-728e55fc00a4b7b980d6e59f2ce8664859a5c848.tar.bz2
trackermap-server-728e55fc00a4b7b980d6e59f2ce8664859a5c848.zip
Refactor computed attributes
Diffstat (limited to 'src/org/traccar/MainModule.java')
-rw-r--r--src/org/traccar/MainModule.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/MainModule.java b/src/org/traccar/MainModule.java
index 34ece8658..f784a1a71 100644
--- a/src/org/traccar/MainModule.java
+++ b/src/org/traccar/MainModule.java
@@ -21,6 +21,7 @@ import com.google.inject.Provides;
import com.google.inject.Singleton;
import org.traccar.config.Config;
import org.traccar.config.Keys;
+import org.traccar.database.AttributesManager;
import org.traccar.database.DataManager;
import org.traccar.database.IdentityManager;
import org.traccar.database.StatisticsManager;
@@ -43,6 +44,7 @@ import org.traccar.geolocation.GoogleGeolocationProvider;
import org.traccar.geolocation.MozillaGeolocationProvider;
import org.traccar.geolocation.OpenCellIdGeolocationProvider;
import org.traccar.geolocation.UnwiredGeolocationProvider;
+import org.traccar.handler.ComputedAttributesHandler;
import org.traccar.handler.CopyAttributesHandler;
import org.traccar.handler.DistanceHandler;
import org.traccar.handler.EngineHoursHandler;
@@ -89,6 +91,11 @@ public class MainModule extends AbstractModule {
return Context.getTripsConfig();
}
+ @Provides
+ public static AttributesManager provideAttributesManager() {
+ return Context.getAttributesManager();
+ }
+
@Singleton
@Provides
public static StatisticsManager provideStatisticsManager(Config config, DataManager dataManager, Client client) {
@@ -247,6 +254,16 @@ public class MainModule extends AbstractModule {
return null;
}
+ @Singleton
+ @Provides
+ public static ComputedAttributesHandler provideComputedAttributesHandler(
+ Config config, IdentityManager identityManager, AttributesManager attributesManager) {
+ if (config.getBoolean(Keys.PROCESSING_COMPUTED_ATTRIBUTES_ENABLE)) {
+ return new ComputedAttributesHandler(config, identityManager, attributesManager);
+ }
+ return null;
+ }
+
@Override
protected void configure() {
binder().requireExplicitBindings();