aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-30 14:04:24 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-30 14:04:24 -0700
commit014cf82a9e63a36e944e293932f9edf27e452919 (patch)
tree7ac5899f535fbf47e66dc1321738c951473a009b /src/main/java/org/traccar/BaseProtocolDecoder.java
parentce661ec77a957b70c15509c6801e6f34b32ad11d (diff)
downloadtrackermap-server-014cf82a9e63a36e944e293932f9edf27e452919.tar.gz
trackermap-server-014cf82a9e63a36e944e293932f9edf27e452919.tar.bz2
trackermap-server-014cf82a9e63a36e944e293932f9edf27e452919.zip
No context dependency for decoder
Diffstat (limited to 'src/main/java/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/BaseProtocolDecoder.java42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/BaseProtocolDecoder.java b/src/main/java/org/traccar/BaseProtocolDecoder.java
index 505e7926f..0f62c87df 100644
--- a/src/main/java/org/traccar/BaseProtocolDecoder.java
+++ b/src/main/java/org/traccar/BaseProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,17 +50,47 @@ public abstract class BaseProtocolDecoder extends ExtendedObjectDecoder {
private static final String PROTOCOL_UNKNOWN = "unknown";
- private final Config config = Context.getConfig();
- private final IdentityManager identityManager = Context.getIdentityManager();
- private final ConnectionManager connectionManager = Context.getConnectionManager();
- private final StatisticsManager statisticsManager;
private final Protocol protocol;
+ private Config config;
+ private IdentityManager identityManager;
+ private ConnectionManager connectionManager;
+ private StatisticsManager statisticsManager;
private MediaManager mediaManager;
public BaseProtocolDecoder(Protocol protocol) {
this.protocol = protocol;
- statisticsManager = Main.getInjector() != null ? Main.getInjector().getInstance(StatisticsManager.class) : null;
+ }
+
+ /**
+ * Method called when config is initialized.
+ */
+ protected void init() {
+ }
+
+ public Config getConfig() {
+ return config;
+ }
+
+ @Inject
+ public void setConfig(Config config) {
+ this.config = config;
+ init();
+ }
+
+ @Inject
+ public void setIdentityManager(IdentityManager identityManager) {
+ this.identityManager = identityManager;
+ }
+
+ @Inject
+ public void setConnectionManager(ConnectionManager connectionManager) {
+ this.connectionManager = connectionManager;
+ }
+
+ @Inject
+ public void setStatisticsManager(StatisticsManager statisticsManager) {
+ this.statisticsManager = statisticsManager;
}
@Inject