diff options
author | Anton Tananaev <anton@traccar.org> | 2022-11-13 11:48:43 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-11-13 11:48:43 -0800 |
commit | 5877cb1b3f1fa7331c4310b9754a3ec442586497 (patch) | |
tree | 6cc3e7193412aa152c1b593bf0ad7e4119687a1e /src/main/java/org/traccar/MainModule.java | |
parent | ff793b2e2872f8ba076e748fab41d944f92b64d4 (diff) | |
download | trackermap-server-5877cb1b3f1fa7331c4310b9754a3ec442586497.tar.gz trackermap-server-5877cb1b3f1fa7331c4310b9754a3ec442586497.tar.bz2 trackermap-server-5877cb1b3f1fa7331c4310b9754a3ec442586497.zip |
Refactor position forwarding
Diffstat (limited to 'src/main/java/org/traccar/MainModule.java')
-rw-r--r-- | src/main/java/org/traccar/MainModule.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java index 9a5cca4c7..9d450fef7 100644 --- a/src/main/java/org/traccar/MainModule.java +++ b/src/main/java/org/traccar/MainModule.java @@ -37,6 +37,9 @@ import org.traccar.database.LdapProvider; import org.traccar.database.StatisticsManager; import org.traccar.forward.EventForwarder; import org.traccar.forward.EventForwarderJson; +import org.traccar.forward.PositionForwarder; +import org.traccar.forward.PositionForwarderJson; +import org.traccar.forward.PositionForwarderUrl; import org.traccar.geocoder.AddressFormat; import org.traccar.geocoder.BanGeocoder; import org.traccar.geocoder.BingMapsGeocoder; @@ -320,6 +323,19 @@ public class MainModule extends AbstractModule { @Singleton @Provides + public static PositionForwarder providePositionForwarder(Config config, Client client, ObjectMapper objectMapper) { + if (config.hasKey(Keys.FORWARD_URL)) { + if (config.getBoolean(Keys.FORWARD_JSON)) { + return new PositionForwarderJson(config, client, objectMapper); + } else { + return new PositionForwarderUrl(config, client, objectMapper); + } + } + return null; + } + + @Singleton + @Provides public static VelocityEngine provideVelocityEngine(Config config) { Properties properties = new Properties(); properties.setProperty("file.resource.loader.path", config.getString(Keys.TEMPLATES_ROOT) + "/"); |