aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BasePipelineFactory.java
diff options
context:
space:
mode:
authordrecchia <danilo@deltatecnologia.com>2016-06-01 21:08:05 -0300
committerdrecchia <danilo@deltatecnologia.com>2016-06-01 21:08:05 -0300
commite4ba1ebf54838041fae352d95e399b1fb3483458 (patch)
tree334626820ff4efa4583bb5257d19a18cd0ebf631 /src/org/traccar/BasePipelineFactory.java
parent5df7c128af15e9d1021b7570f081185f14467f09 (diff)
parentd2c85b59bde4729d027ef1bb6e874d1fd1a02c68 (diff)
downloadtrackermap-server-e4ba1ebf54838041fae352d95e399b1fb3483458.tar.gz
trackermap-server-e4ba1ebf54838041fae352d95e399b1fb3483458.tar.bz2
trackermap-server-e4ba1ebf54838041fae352d95e399b1fb3483458.zip
Merge branch 'master' of https://github.com/tananaev/traccar
Conflicts: src/org/traccar/database/DataManager.java
Diffstat (limited to 'src/org/traccar/BasePipelineFactory.java')
-rw-r--r--src/org/traccar/BasePipelineFactory.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java
index 6e350f61d..634c6d6a4 100644
--- a/src/org/traccar/BasePipelineFactory.java
+++ b/src/org/traccar/BasePipelineFactory.java
@@ -29,6 +29,9 @@ import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.handler.logging.LoggingHandler;
import org.jboss.netty.handler.timeout.IdleStateHandler;
+import org.traccar.events.CommandResultEventHandler;
+import org.traccar.events.MotionEventHandler;
+import org.traccar.events.OverspeedEventHandler;
import org.traccar.helper.Log;
import java.net.InetSocketAddress;
@@ -44,6 +47,10 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory {
private LocationProviderHandler locationProviderHandler;
private HemisphereHandler hemisphereHandler;
+ private CommandResultEventHandler commandResultEventHandler;
+ private OverspeedEventHandler overspeedEventHandler;
+ private MotionEventHandler motionEventHandler;
+
private static final class OpenChannelHandler extends SimpleChannelHandler {
private final TrackerServer server;
@@ -122,6 +129,17 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory {
|| Context.getConfig().hasKey("location.longitudeHemisphere")) {
hemisphereHandler = new HemisphereHandler();
}
+
+ commandResultEventHandler = new CommandResultEventHandler();
+
+ if (Context.getConfig().getBoolean("event.overspeedHandler")) {
+ overspeedEventHandler = new OverspeedEventHandler();
+ }
+
+ if (Context.getConfig().getBoolean("event.motionHandler")) {
+ motionEventHandler = new MotionEventHandler();
+ }
+
}
protected abstract void addSpecificHandlers(ChannelPipeline pipeline);
@@ -162,9 +180,23 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory {
if (Context.getDataManager() != null) {
pipeline.addLast("dataHandler", new DefaultDataHandler());
}
+
if (Context.getConfig().getBoolean("forward.enable")) {
pipeline.addLast("webHandler", new WebDataHandler(Context.getConfig().getString("forward.url")));
}
+
+ if (commandResultEventHandler != null) {
+ pipeline.addLast("CommandResultEventHandler", commandResultEventHandler);
+ }
+
+ if (overspeedEventHandler != null) {
+ pipeline.addLast("OverspeedEventHandler", overspeedEventHandler);
+ }
+
+ if (motionEventHandler != null) {
+ pipeline.addLast("MotionEventHandler", motionEventHandler);
+ }
+
pipeline.addLast("mainHandler", new MainEventHandler());
return pipeline;
}
@@ -181,5 +213,4 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory {
}
}
}
-
}