diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-06-03 20:18:03 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-06-03 20:18:03 +0400 |
commit | f442d992179fe0355177181c01cc6c7ca8bfaca1 (patch) | |
tree | accc453bc5897a20ecfc239041ea130734232a01 /src/org/traccar/Server.java | |
parent | 02de9b3a41bdb4dd3b10ec646200369b94b673fe (diff) | |
download | trackermap-server-f442d992179fe0355177181c01cc6c7ca8bfaca1.tar.gz trackermap-server-f442d992179fe0355177181c01cc6c7ca8bfaca1.tar.bz2 trackermap-server-f442d992179fe0355177181c01cc6c7ca8bfaca1.zip |
Added Enfora protocol (fix #2)
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r-- | src/org/traccar/Server.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index cbcb68324..a6b0a67da 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -24,10 +24,14 @@ import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.Properties; -import java.util.logging.*; +import java.util.logging.FileHandler; +import java.util.logging.Formatter; +import java.util.logging.Level; +import java.util.logging.LogRecord; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; +import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; import org.jboss.netty.handler.codec.string.StringEncoder; import org.traccar.helper.Log; @@ -85,6 +89,7 @@ public class Server { initT55Server(properties); initXexun2Server(properties); initAvl08Server(properties); + initEnforaServer(properties); // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { @@ -389,4 +394,26 @@ public class Server { } } + /** + * Init Enfora server + */ + public void initEnforaServer(Properties properties) throws SQLException { + + String protocol = "enfora"; + if (isProtocolEnabled(properties, protocol)) { + + TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol)); + final Integer resetDelay = getProtocolResetDelay(properties, protocol); + + server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled()) { + protected void addSpecificHandlers(ChannelPipeline pipeline) { + pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 0, 2, -2, 2)); + pipeline.addLast("objectDecoder", new EnforaProtocolDecoder(getDataManager(), resetDelay)); + } + }); + + serverList.add(server); + } + } + } |