diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-10-15 21:15:12 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-10-15 21:15:12 -0700 |
commit | eaffa34a7061232601668c2493a5f18e1b1c80f5 (patch) | |
tree | 140725fa580fc374c2beed152ffbd08cf34cfb15 /src/main/java | |
parent | cf883bc9e41f27613f456045b67d15d0ff443f0e (diff) | |
download | trackermap-server-eaffa34a7061232601668c2493a5f18e1b1c80f5.tar.gz trackermap-server-eaffa34a7061232601668c2493a5f18e1b1c80f5.tar.bz2 trackermap-server-eaffa34a7061232601668c2493a5f18e1b1c80f5.zip |
Save original config key
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/ExtendedObjectDecoder.java | 5 | ||||
-rw-r--r-- | src/main/java/org/traccar/config/Keys.java | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/ExtendedObjectDecoder.java b/src/main/java/org/traccar/ExtendedObjectDecoder.java index dad52d3ff..46720da52 100644 --- a/src/main/java/org/traccar/ExtendedObjectDecoder.java +++ b/src/main/java/org/traccar/ExtendedObjectDecoder.java @@ -21,6 +21,7 @@ import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.util.ReferenceCountUtil; +import org.traccar.config.Keys; import org.traccar.helper.DataConverter; import org.traccar.model.Position; @@ -31,14 +32,14 @@ import java.util.Collection; public abstract class ExtendedObjectDecoder extends ChannelInboundHandlerAdapter { private void saveOriginal(Object decodedMessage, Object originalMessage) { - if (Context.getConfig().getBoolean("database.saveOriginal") && decodedMessage instanceof Position) { + if (Context.getConfig().getBoolean(Keys.DATABASE_SAVE_ORIGINAL) && decodedMessage instanceof Position) { Position position = (Position) decodedMessage; if (originalMessage instanceof ByteBuf) { ByteBuf buf = (ByteBuf) originalMessage; position.set(Position.KEY_ORIGINAL, ByteBufUtil.hexDump(buf, 0, buf.writerIndex())); } else if (originalMessage instanceof String) { position.set(Position.KEY_ORIGINAL, DataConverter.printHex( - ((String) originalMessage).getBytes(StandardCharsets.US_ASCII))); + ((String) originalMessage).getBytes(StandardCharsets.US_ASCII))); } } } diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index d9e03517c..77b42943b 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -76,6 +76,12 @@ public final class Keys { "extra.handlers", String.class); /** + * Store original HEX or string data as "raw" attribute in the corresponding position. + */ + public static final ConfigKey DATABASE_SAVE_ORIGINAL = new ConfigKey( + "database.saveOriginal", Boolean.class); + + /** * Enable positions forwarding to other web server. */ public static final ConfigKey FORWARD_ENABLE = new ConfigKey( |