aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/MainModule.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-30 19:36:35 -0700
committerAnton Tananaev <anton@traccar.org>2024-03-30 19:36:35 -0700
commit0f7ec1247cff1a68ffa57ade3f45b11f6602e262 (patch)
tree8cd0006e2b9d2313ef6ff4291188e30d40456701 /src/main/java/org/traccar/MainModule.java
parentf84e2710e05660822633ec9e61cde44c03a42d7e (diff)
downloadtrackermap-server-0f7ec1247cff1a68ffa57ade3f45b11f6602e262.tar.gz
trackermap-server-0f7ec1247cff1a68ffa57ade3f45b11f6602e262.tar.bz2
trackermap-server-0f7ec1247cff1a68ffa57ade3f45b11f6602e262.zip
Make handlers nullable
Diffstat (limited to 'src/main/java/org/traccar/MainModule.java')
-rw-r--r--src/main/java/org/traccar/MainModule.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java
index 26654947e..791d61c61 100644
--- a/src/main/java/org/traccar/MainModule.java
+++ b/src/main/java/org/traccar/MainModule.java
@@ -72,9 +72,12 @@ import org.traccar.geolocation.GeolocationProvider;
import org.traccar.geolocation.GoogleGeolocationProvider;
import org.traccar.geolocation.OpenCellIdGeolocationProvider;
import org.traccar.geolocation.UnwiredGeolocationProvider;
+import org.traccar.handler.CopyAttributesHandler;
+import org.traccar.handler.FilterHandler;
import org.traccar.handler.GeocoderHandler;
import org.traccar.handler.GeolocationHandler;
import org.traccar.handler.SpeedLimitHandler;
+import org.traccar.handler.TimeHandler;
import org.traccar.helper.ObjectMapperContextResolver;
import org.traccar.helper.SanitizerModule;
import org.traccar.helper.WebHelper;
@@ -338,6 +341,34 @@ public class MainModule extends AbstractModule {
@Singleton
@Provides
+ public static CopyAttributesHandler provideCopyAttributesHandler(Config config, CacheManager cacheManager) {
+ if (config.getBoolean(Keys.PROCESSING_COPY_ATTRIBUTES_ENABLE)) {
+ return new CopyAttributesHandler(config, cacheManager);
+ }
+ return null;
+ }
+
+ @Singleton
+ @Provides
+ public static FilterHandler provideFilterHandler(
+ Config config, CacheManager cacheManager, Storage storage, StatisticsManager statisticsManager) {
+ if (config.getBoolean(Keys.FILTER_ENABLE)) {
+ return new FilterHandler(config, cacheManager, storage, statisticsManager);
+ }
+ return null;
+ }
+
+ @Singleton
+ @Provides
+ public static TimeHandler provideTimeHandler(Config config) {
+ if (config.hasKey(Keys.TIME_OVERRIDE)) {
+ return new TimeHandler(config);
+ }
+ return null;
+ }
+
+ @Singleton
+ @Provides
public static BroadcastService provideBroadcastService(
Config config, ObjectMapper objectMapper) throws IOException {
if (config.hasKey(Keys.BROADCAST_TYPE)) {