diff options
Diffstat (limited to 'src/org/traccar/MainModule.java')
-rw-r--r-- | src/org/traccar/MainModule.java | 17 |
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(); |