aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/MainModule.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-23 11:41:49 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-23 11:41:49 -0800
commitbd909426d24832e42a63503c338bbd8c37176caa (patch)
treef8c593e3e7875a7d53ce9dcfdce7dd791b52a6c2 /src/org/traccar/MainModule.java
parent378e16a4845a245b27d3fbb2850f0abcbb502357 (diff)
downloadtrackermap-server-bd909426d24832e42a63503c338bbd8c37176caa.tar.gz
trackermap-server-bd909426d24832e42a63503c338bbd8c37176caa.tar.bz2
trackermap-server-bd909426d24832e42a63503c338bbd8c37176caa.zip
Move logic to module
Diffstat (limited to 'src/org/traccar/MainModule.java')
-rw-r--r--src/org/traccar/MainModule.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/org/traccar/MainModule.java b/src/org/traccar/MainModule.java
index 40933aba5..26bdfcd60 100644
--- a/src/org/traccar/MainModule.java
+++ b/src/org/traccar/MainModule.java
@@ -18,7 +18,9 @@ package org.traccar;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
+import com.google.inject.Singleton;
import org.traccar.config.Config;
+import org.traccar.config.Keys;
import org.traccar.database.IdentityManager;
import javax.ws.rs.client.Client;
@@ -45,4 +47,20 @@ public class MainModule extends AbstractModule {
return Context.getClient();
}
+ @Singleton
+ @Provides
+ public static WebDataHandler provideWebDataHandler(
+ Config config, IdentityManager identityManager, ObjectMapper objectMapper, Client client) {
+ if (config.getBoolean(Keys.FORWARD_ENABLE)) {
+ return new WebDataHandler(config, identityManager, objectMapper, client);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ protected void configure() {
+ binder().requireExplicitBindings();
+ }
+
}