From 6c17f85d04b224ff2a09265918765c9f4fc8cf94 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 10 May 2017 13:27:49 +0500 Subject: Implement computed attributes --- src/org/traccar/BasePipelineFactory.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/BasePipelineFactory.java') diff --git a/src/org/traccar/BasePipelineFactory.java b/src/org/traccar/BasePipelineFactory.java index 620c4729a..11457905d 100644 --- a/src/org/traccar/BasePipelineFactory.java +++ b/src/org/traccar/BasePipelineFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,8 @@ import org.traccar.events.MotionEventHandler; import org.traccar.events.OverspeedEventHandler; import org.traccar.events.AlertEventHandler; import org.traccar.helper.Log; +import org.traccar.processing.ComputedAttributesHandler; +import org.traccar.processing.CopyAttributesHandler; import java.net.InetSocketAddress; @@ -53,6 +55,7 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { private GeolocationHandler geolocationHandler; private HemisphereHandler hemisphereHandler; private CopyAttributesHandler copyAttributesHandler; + private ComputedAttributesHandler computedAttributesHandler; private CommandResultEventHandler commandResultEventHandler; private OverspeedEventHandler overspeedEventHandler; @@ -153,6 +156,10 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { copyAttributesHandler = new CopyAttributesHandler(); } + if (Context.getConfig().getBoolean("processing.computedAttributes.enable")) { + computedAttributesHandler = new ComputedAttributesHandler(); + } + if (Context.getConfig().getBoolean("event.enable")) { commandResultEventHandler = new CommandResultEventHandler(); overspeedEventHandler = new OverspeedEventHandler(); @@ -209,6 +216,10 @@ public abstract class BasePipelineFactory implements ChannelPipelineFactory { pipeline.addLast("copyAttributes", copyAttributesHandler); } + if (computedAttributesHandler != null) { + pipeline.addLast("computedAttributes", computedAttributesHandler); + } + if (Context.getDataManager() != null) { pipeline.addLast("dataHandler", new DefaultDataHandler()); } -- cgit v1.2.3