diff options
author | Abyss777 <abyss@fox5.ru> | 2016-05-26 16:14:52 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-05-26 16:14:52 +0500 |
commit | c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe (patch) | |
tree | 8b0cddcc79476a3252c8aec0946bd6e8e016b475 /src/org/traccar/BasePipelineFactory.java | |
parent | aa12e5c750e771016545269ffa39409b06b47eee (diff) | |
download | trackermap-server-c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe.tar.gz trackermap-server-c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe.tar.bz2 trackermap-server-c6cc8a87eb593dbf765814d1aaa09d5d231fa7fe.zip |
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..55820deb7 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 { } } } - } |