aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index 3976ba9e8..e4a3448f1 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -29,22 +29,14 @@ import org.traccar.database.DataManager;
*/
public abstract class BaseProtocolDecoder extends OneToOneDecoder {
- private ServerManager serverManager;
- private DataManager dataManager;
+ private final ServerManager serverManager;
+ private final DataManager dataManager;
private final String protocol;
- public final void setDataManager(DataManager dataManager) {
- this.dataManager = dataManager;
- }
-
public final DataManager getDataManager() {
return dataManager;
}
- public final void setServerManager(ServerManager serverManager) {
- this.serverManager = serverManager;
- }
-
public final ServerManager getServerManager() {
return serverManager;
}
@@ -53,21 +45,17 @@ public abstract class BaseProtocolDecoder extends OneToOneDecoder {
return protocol;
}
- public BaseProtocolDecoder() {
- protocol = null;
- }
-
- public BaseProtocolDecoder(ServerManager serverManager) {
- // Only used by test classes now
- assert (serverManager == null) :
- "BaseProtocolDecoder() initialized with non-NULL serverManager";
-
- if (serverManager != null) {
- this.serverManager = serverManager;
- dataManager = serverManager.getDataManager();
- }
+ public BaseProtocolDecoder(DataManager dataManager) {
+ // This constructor must only be used by test classes.
+ // There should be a way to check this at compile time.
+
+ assert (dataManager != null) :
+ "BaseProtocolDecoder() initialized with NULL dataManager";
+ serverManager = null;
protocol = null;
+
+ this.dataManager = dataManager;
}
public BaseProtocolDecoder(ServerManager serverManager, String protocol) {