diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-06-01 15:28:54 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-06-01 15:28:54 +1200 |
commit | 3db183a5535a986b015566c6df929da8c6ca9630 (patch) | |
tree | 3183f44e2b9b8ccfa2c460221b1d04fa74f0e9e9 /src/org/traccar/BasePipelineFactory.java | |
parent | cce427a783cbe0c2eca6a278d7327294002847e5 (diff) | |
parent | 41c46575a92f746622c61b07004b7a0832712a54 (diff) | |
download | trackermap-server-3db183a5535a986b015566c6df929da8c6ca9630.tar.gz trackermap-server-3db183a5535a986b015566c6df929da8c6ca9630.tar.bz2 trackermap-server-3db183a5535a986b015566c6df929da8c6ca9630.zip |
Merge pull request #1981 from Abyss777/master
Implement events subsystem
Diffstat (limited to 'src/org/traccar/BasePipelineFactory.java')
-rw-r--r-- | src/org/traccar/BasePipelineFactory.java | 33 |
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 { } } } - } |