aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BasePipelineFactory.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-23 15:49:56 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-23 15:49:56 +1200
commit2a3fad9496decd83f06ae5abf067f8d4337ec741 (patch)
tree69837f0bf89cf6ff78915d70380118575cc5c47a /src/org/traccar/BasePipelineFactory.java
parenta8d2a0170b7ac891ffe784320ac2d1389f11bf68 (diff)
downloadtrackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.gz
trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.tar.bz2
trackermap-server-2a3fad9496decd83f06ae5abf067f8d4337ec741.zip
Major code refacroting
Diffstat (limited to 'src/org/traccar/BasePipelineFactory.java')
-rw-r--r--src/org/traccar/BasePipelineFactory.java34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java
index 469bbc49f..fcb6266ef 100644
--- a/src/org/traccar/BasePipelineFactory.java
+++ b/src/org/traccar/BasePipelineFactory.java
@@ -26,13 +26,11 @@ import org.traccar.database.DataManager;
import org.traccar.geocode.ReverseGeocoder;
import org.traccar.helper.Log;
+import javax.crypto.Cipher;
+
public abstract class BasePipelineFactory implements ChannelPipelineFactory {
private final TrackerServer server;
- private final DataManager dataManager;
- private final DataCache dataCache;
- private final Boolean loggerEnabled;
- private final ReverseGeocoder reverseGeocoder;
private FilterHandler filterHandler;
private Integer resetDelay;
private Boolean processInvalidPositions;
@@ -83,34 +81,26 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory {
}
- public BasePipelineFactory(ServerManager serverManager, TrackerServer server, String protocol) {
+ public BasePipelineFactory(TrackerServer server, String protocol) {
this.server = server;
- dataManager = serverManager.getDataManager();
- dataCache = serverManager.getDataCache();
- loggerEnabled = serverManager.isLoggerEnabled();
- reverseGeocoder = serverManager.getReverseGeocoder();
- String resetDelayProperty = serverManager.getProperties().getProperty(protocol + ".resetDelay");
+ String resetDelayProperty = Context.getProps().getProperty(protocol + ".resetDelay");
if (resetDelayProperty != null) {
resetDelay = Integer.valueOf(resetDelayProperty);
}
- String enableFilter = serverManager.getProperties().getProperty("filter.enable");
+ String enableFilter = Context.getProps().getProperty("filter.enable");
if (enableFilter != null && Boolean.valueOf(enableFilter)) {
- filterHandler = new FilterHandler(serverManager.getProperties());
+ filterHandler = new FilterHandler();
}
- if (reverseGeocoder != null) {
+ if (Context.getReverseGeocoder() != null) {
// Default behavior is to process invalid positions (i.e., the "null" case)
- String invalidPositions = serverManager.getProperties().getProperty("geocode.processInvalidPositions");
+ String invalidPositions = Context.getProps().getProperty("geocode.processInvalidPositions");
processInvalidPositions = (invalidPositions == null || Boolean.valueOf(invalidPositions));
}
}
- protected DataManager getDataManager() {
- return dataManager;
- }
-
protected abstract void addSpecificHandlers(ChannelPipeline pipeline);
@Override
@@ -120,17 +110,17 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory {
pipeline.addLast("idleHandler", new IdleStateHandler(GlobalTimer.getTimer(), resetDelay, 0, 0));
}
pipeline.addLast("openHandler", new OpenChannelHandler(server));
- if (loggerEnabled) {
+ if (Context.isLoggerEnabled()) {
pipeline.addLast("logger", new StandardLoggingHandler());
}
addSpecificHandlers(pipeline);
if (filterHandler != null) {
pipeline.addLast("filter", filterHandler);
}
- if (reverseGeocoder != null) {
- pipeline.addLast("geocoder", new ReverseGeocoderHandler(reverseGeocoder, processInvalidPositions));
+ if (Context.getReverseGeocoder() != null) {
+ pipeline.addLast("geocoder", new ReverseGeocoderHandler(Context.getReverseGeocoder(), processInvalidPositions));
}
- pipeline.addLast("handler", new TrackerEventHandler(dataManager, dataCache));
+ pipeline.addLast("handler", new TrackerEventHandler());
return pipeline;
}