diff options
author | Anton Tananaev <atananaev@lyft.com> | 2020-12-28 14:21:30 -0800 |
---|---|---|
committer | Anton Tananaev <atananaev@lyft.com> | 2020-12-28 14:21:30 -0800 |
commit | 3cc85b094e571f7cf655b5b4d678a7ba718d323e (patch) | |
tree | 47ee0a7ff7e7b42296aeedb8f06b17bc841a562d /src | |
parent | 76ba984121f8eb72ada824bcaa1800831ceabdf2 (diff) | |
download | trackermap-server-3cc85b094e571f7cf655b5b4d678a7ba718d323e.tar.gz trackermap-server-3cc85b094e571f7cf655b5b4d678a7ba718d323e.tar.bz2 trackermap-server-3cc85b094e571f7cf655b5b4d678a7ba718d323e.zip |
Remove dynamic handlers
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/BasePipelineFactory.java | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/src/main/java/org/traccar/BasePipelineFactory.java b/src/main/java/org/traccar/BasePipelineFactory.java index ffce45342..ab781fd7a 100644 --- a/src/main/java/org/traccar/BasePipelineFactory.java +++ b/src/main/java/org/traccar/BasePipelineFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2019 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2020 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. @@ -22,23 +22,10 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOutboundHandler; import io.netty.channel.ChannelPipeline; import io.netty.handler.timeout.IdleStateHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.traccar.config.Keys; -import org.traccar.handler.DefaultDataHandler; -import org.traccar.handler.SpeedLimitHandler; -import org.traccar.handler.TimeHandler; -import org.traccar.handler.events.AlertEventHandler; -import org.traccar.handler.events.CommandResultEventHandler; -import org.traccar.handler.events.DriverEventHandler; -import org.traccar.handler.events.FuelDropEventHandler; -import org.traccar.handler.events.GeofenceEventHandler; -import org.traccar.handler.events.IgnitionEventHandler; -import org.traccar.handler.events.MaintenanceEventHandler; -import org.traccar.handler.events.MotionEventHandler; -import org.traccar.handler.events.OverspeedEventHandler; import org.traccar.handler.ComputedAttributesHandler; import org.traccar.handler.CopyAttributesHandler; +import org.traccar.handler.DefaultDataHandler; import org.traccar.handler.DistanceHandler; import org.traccar.handler.EngineHoursHandler; import org.traccar.handler.FilterHandler; @@ -49,14 +36,23 @@ import org.traccar.handler.MotionHandler; import org.traccar.handler.NetworkMessageHandler; import org.traccar.handler.OpenChannelHandler; import org.traccar.handler.RemoteAddressHandler; +import org.traccar.handler.SpeedLimitHandler; import org.traccar.handler.StandardLoggingHandler; +import org.traccar.handler.TimeHandler; +import org.traccar.handler.events.AlertEventHandler; +import org.traccar.handler.events.CommandResultEventHandler; +import org.traccar.handler.events.DriverEventHandler; +import org.traccar.handler.events.FuelDropEventHandler; +import org.traccar.handler.events.GeofenceEventHandler; +import org.traccar.handler.events.IgnitionEventHandler; +import org.traccar.handler.events.MaintenanceEventHandler; +import org.traccar.handler.events.MotionEventHandler; +import org.traccar.handler.events.OverspeedEventHandler; import java.util.Map; public abstract class BasePipelineFactory extends ChannelInitializer<Channel> { - private static final Logger LOGGER = LoggerFactory.getLogger(BasePipelineFactory.class); - private final TrackerServer server; private final String protocol; private final boolean eventsEnabled; @@ -128,8 +124,6 @@ public abstract class BasePipelineFactory extends ChannelInitializer<Channel> { DistanceHandler.class, RemoteAddressHandler.class); - addDynamicHandlers(pipeline); - addHandlers( pipeline, FilterHandler.class, @@ -159,17 +153,4 @@ public abstract class BasePipelineFactory extends ChannelInitializer<Channel> { pipeline.addLast(new MainEventHandler()); } - private void addDynamicHandlers(ChannelPipeline pipeline) { - String handlers = Context.getConfig().getString(Keys.EXTRA_HANDLERS); - if (handlers != null) { - for (String handler : handlers.split(",")) { - try { - pipeline.addLast((ChannelHandler) Class.forName(handler).getDeclaredConstructor().newInstance()); - } catch (ReflectiveOperationException error) { - LOGGER.warn("Dynamic handler error", error); - } - } - } - } - } |