From 61d4c1f15b645aa06c84905933108437e1ade92a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 17 Oct 2018 17:08:59 +1300 Subject: Move server init into constructor --- src/org/traccar/BaseProtocol.java | 12 ++++++++++++ src/org/traccar/Protocol.java | 5 ++--- src/org/traccar/ServerManager.java | 15 +++++---------- src/org/traccar/protocol/AdmProtocol.java | 7 +------ src/org/traccar/protocol/AisProtocol.java | 8 +------- src/org/traccar/protocol/AlematicsProtocol.java | 8 +------- src/org/traccar/protocol/AnytrekProtocol.java | 8 +------- src/org/traccar/protocol/ApelProtocol.java | 8 +------- src/org/traccar/protocol/AplicomProtocol.java | 8 +------- src/org/traccar/protocol/AppelloProtocol.java | 8 +------- src/org/traccar/protocol/AppletProtocol.java | 8 +------- src/org/traccar/protocol/AquilaProtocol.java | 8 +------- src/org/traccar/protocol/Ardi01Protocol.java | 8 +------- src/org/traccar/protocol/ArknavProtocol.java | 8 +------- src/org/traccar/protocol/ArknavX8Protocol.java | 8 +------- src/org/traccar/protocol/ArnaviProtocol.java | 8 +------- src/org/traccar/protocol/AstraProtocol.java | 10 ++-------- src/org/traccar/protocol/At2000Protocol.java | 8 +------- src/org/traccar/protocol/AtrackProtocol.java | 10 ++-------- src/org/traccar/protocol/AuroProtocol.java | 8 +------- src/org/traccar/protocol/AustinNbProtocol.java | 8 +------- src/org/traccar/protocol/AutoFonProtocol.java | 8 +------- src/org/traccar/protocol/AutoGradeProtocol.java | 8 +------- src/org/traccar/protocol/AutoTrackProtocol.java | 8 +------- src/org/traccar/protocol/AvemaProtocol.java | 8 +------- src/org/traccar/protocol/Avl301Protocol.java | 8 +------- src/org/traccar/protocol/BceProtocol.java | 8 +------- src/org/traccar/protocol/BlackKiteProtocol.java | 8 +------- src/org/traccar/protocol/BoxProtocol.java | 8 +------- src/org/traccar/protocol/CalAmpProtocol.java | 8 +------- src/org/traccar/protocol/CarTrackProtocol.java | 8 +------- src/org/traccar/protocol/CarcellProtocol.java | 8 +------- src/org/traccar/protocol/CarscopProtocol.java | 8 +------- src/org/traccar/protocol/CastelProtocol.java | 10 ++-------- src/org/traccar/protocol/CautelaProtocol.java | 8 +------- src/org/traccar/protocol/CellocatorProtocol.java | 10 ++-------- src/org/traccar/protocol/CguardProtocol.java | 8 +------- src/org/traccar/protocol/CityeasyProtocol.java | 8 +------- src/org/traccar/protocol/ContinentalProtocol.java | 8 +------- src/org/traccar/protocol/CradlepointProtocol.java | 8 +------- src/org/traccar/protocol/DishaProtocol.java | 8 +------- src/org/traccar/protocol/DmtHttpProtocol.java | 8 +------- src/org/traccar/protocol/DmtProtocol.java | 8 +------- src/org/traccar/protocol/DwayProtocol.java | 8 +------- src/org/traccar/protocol/EasyTrackProtocol.java | 8 +------- src/org/traccar/protocol/EelinkProtocol.java | 10 ++-------- src/org/traccar/protocol/EgtsProtocol.java | 8 +------- src/org/traccar/protocol/EnforaProtocol.java | 8 +------- src/org/traccar/protocol/EsealProtocol.java | 8 +------- src/org/traccar/protocol/EskyProtocol.java | 8 +------- src/org/traccar/protocol/ExtremTracProtocol.java | 8 +------- src/org/traccar/protocol/FifotrackProtocol.java | 8 +------- src/org/traccar/protocol/FlespiProtocol.java | 8 +------- src/org/traccar/protocol/FlexCommProtocol.java | 8 +------- src/org/traccar/protocol/FlextrackProtocol.java | 8 +------- src/org/traccar/protocol/FoxProtocol.java | 8 +------- src/org/traccar/protocol/FreedomProtocol.java | 8 +------- src/org/traccar/protocol/FreematicsProtocol.java | 8 +------- src/org/traccar/protocol/GalileoProtocol.java | 8 +------- src/org/traccar/protocol/GatorProtocol.java | 10 ++-------- src/org/traccar/protocol/GenxProtocol.java | 8 +------- src/org/traccar/protocol/Gl100Protocol.java | 10 ++-------- src/org/traccar/protocol/Gl200Protocol.java | 10 ++-------- src/org/traccar/protocol/GlobalSatProtocol.java | 8 +------- src/org/traccar/protocol/GnxProtocol.java | 8 +------- src/org/traccar/protocol/GoSafeProtocol.java | 8 +------- src/org/traccar/protocol/GotopProtocol.java | 8 +------- src/org/traccar/protocol/Gps056Protocol.java | 8 +------- src/org/traccar/protocol/Gps103Protocol.java | 10 ++-------- src/org/traccar/protocol/GpsGateProtocol.java | 8 +------- src/org/traccar/protocol/GpsMarkerProtocol.java | 8 +------- src/org/traccar/protocol/GpsmtaProtocol.java | 8 +------- src/org/traccar/protocol/GranitProtocol.java | 8 +------- src/org/traccar/protocol/Gt02Protocol.java | 8 +------- src/org/traccar/protocol/Gt06Protocol.java | 8 +------- src/org/traccar/protocol/Gt30Protocol.java | 8 +------- src/org/traccar/protocol/H02Protocol.java | 10 ++-------- src/org/traccar/protocol/HaicomProtocol.java | 8 +------- src/org/traccar/protocol/HomtecsProtocol.java | 8 +------- src/org/traccar/protocol/HuaShengProtocol.java | 8 +------- src/org/traccar/protocol/HuabaoProtocol.java | 8 +------- src/org/traccar/protocol/HunterProProtocol.java | 8 +------- src/org/traccar/protocol/IdplProtocol.java | 8 +------- src/org/traccar/protocol/IntellitracProtocol.java | 8 +------- src/org/traccar/protocol/ItsProtocol.java | 8 +------- src/org/traccar/protocol/Ivt401Protocol.java | 8 +------- src/org/traccar/protocol/JpKorjarProtocol.java | 8 +------- src/org/traccar/protocol/Jt600Protocol.java | 8 +------- src/org/traccar/protocol/KenjiProtocol.java | 8 +------- src/org/traccar/protocol/KhdProtocol.java | 8 +------- src/org/traccar/protocol/L100Protocol.java | 8 +------- src/org/traccar/protocol/LaipacProtocol.java | 8 +------- src/org/traccar/protocol/M2cProtocol.java | 8 +------- src/org/traccar/protocol/M2mProtocol.java | 8 +------- src/org/traccar/protocol/MaestroProtocol.java | 8 +------- src/org/traccar/protocol/ManPowerProtocol.java | 8 +------- src/org/traccar/protocol/MegastekProtocol.java | 8 +------- src/org/traccar/protocol/MeiligaoProtocol.java | 10 ++-------- src/org/traccar/protocol/MeitrackProtocol.java | 10 ++-------- src/org/traccar/protocol/MilesmateProtocol.java | 8 +------- src/org/traccar/protocol/MiniFinderProtocol.java | 8 +------- src/org/traccar/protocol/Mta6Protocol.java | 8 +------- src/org/traccar/protocol/MtxProtocol.java | 8 +------- src/org/traccar/protocol/MxtProtocol.java | 8 +------- src/org/traccar/protocol/NavigilProtocol.java | 8 +------- src/org/traccar/protocol/NavisProtocol.java | 8 +------- src/org/traccar/protocol/NoranProtocol.java | 8 +------- src/org/traccar/protocol/NvsProtocol.java | 8 +------- src/org/traccar/protocol/ObdDongleProtocol.java | 8 +------- src/org/traccar/protocol/OigoProtocol.java | 8 +------- src/org/traccar/protocol/OkoProtocol.java | 8 +------- src/org/traccar/protocol/OpenGtsProtocol.java | 8 +------- src/org/traccar/protocol/OrionProtocol.java | 8 +------- src/org/traccar/protocol/OsmAndProtocol.java | 8 +------- src/org/traccar/protocol/OwnTracksProtocol.java | 8 +------- src/org/traccar/protocol/PathAwayProtocol.java | 8 +------- src/org/traccar/protocol/PiligrimProtocol.java | 8 +------- src/org/traccar/protocol/PretraceProtocol.java | 8 +------- src/org/traccar/protocol/PricolProtocol.java | 10 ++-------- src/org/traccar/protocol/ProgressProtocol.java | 8 +------- src/org/traccar/protocol/Pt3000Protocol.java | 8 +------- src/org/traccar/protocol/Pt502Protocol.java | 8 +------- src/org/traccar/protocol/Pt60Protocol.java | 8 +------- src/org/traccar/protocol/RaveonProtocol.java | 8 +------- src/org/traccar/protocol/RecodaProtocol.java | 8 +------- src/org/traccar/protocol/RetranslatorProtocol.java | 8 +------- src/org/traccar/protocol/RitiProtocol.java | 8 +------- src/org/traccar/protocol/RoboTrackProtocol.java | 8 +------- src/org/traccar/protocol/RuptelaProtocol.java | 8 +------- src/org/traccar/protocol/SabertekProtocol.java | 8 +------- src/org/traccar/protocol/SanavProtocol.java | 10 ++-------- src/org/traccar/protocol/SigfoxProtocol.java | 8 +------- src/org/traccar/protocol/SiwiProtocol.java | 8 +------- src/org/traccar/protocol/SkypatrolProtocol.java | 8 +------- src/org/traccar/protocol/SmartSoleProtocol.java | 8 +------- src/org/traccar/protocol/SmokeyProtocol.java | 8 +------- src/org/traccar/protocol/SpotProtocol.java | 8 +------- src/org/traccar/protocol/StarLinkProtocol.java | 8 +------- src/org/traccar/protocol/Stl060Protocol.java | 8 +------- src/org/traccar/protocol/SuntechProtocol.java | 8 +------- src/org/traccar/protocol/SupermateProtocol.java | 8 +------- src/org/traccar/protocol/SviasProtocol.java | 7 +------ src/org/traccar/protocol/T55Protocol.java | 10 ++-------- src/org/traccar/protocol/T57Protocol.java | 8 +------- src/org/traccar/protocol/T800xProtocol.java | 8 +------- src/org/traccar/protocol/TaipProtocol.java | 10 ++-------- src/org/traccar/protocol/TekProtocol.java | 8 +------- src/org/traccar/protocol/TelemaxProtocol.java | 8 +------- src/org/traccar/protocol/TelicProtocol.java | 8 +------- src/org/traccar/protocol/TeltonikaProtocol.java | 10 ++-------- src/org/traccar/protocol/TeltonikaProtocolDecoder.java | 3 ++- src/org/traccar/protocol/ThinkRaceProtocol.java | 8 +------- src/org/traccar/protocol/Tk102Protocol.java | 8 +------- src/org/traccar/protocol/Tk103Protocol.java | 10 ++-------- src/org/traccar/protocol/Tlt2hProtocol.java | 8 +------- src/org/traccar/protocol/TlvProtocol.java | 8 +------- src/org/traccar/protocol/TmgProtocol.java | 8 +------- src/org/traccar/protocol/TopflytechProtocol.java | 8 +------- src/org/traccar/protocol/TotemProtocol.java | 8 +------- src/org/traccar/protocol/Tr20Protocol.java | 8 +------- src/org/traccar/protocol/Tr900Protocol.java | 10 ++-------- src/org/traccar/protocol/TrackboxProtocol.java | 8 +------- src/org/traccar/protocol/TrakMateProtocol.java | 8 +------- src/org/traccar/protocol/TramigoProtocol.java | 8 +------- src/org/traccar/protocol/TrvProtocol.java | 8 +------- src/org/traccar/protocol/Tt8850Protocol.java | 8 +------- src/org/traccar/protocol/TytanProtocol.java | 8 +------- src/org/traccar/protocol/TzoneProtocol.java | 8 +------- src/org/traccar/protocol/UlbotechProtocol.java | 8 +------- src/org/traccar/protocol/UproProtocol.java | 8 +------- src/org/traccar/protocol/V680Protocol.java | 10 ++-------- src/org/traccar/protocol/VisiontekProtocol.java | 8 +------- src/org/traccar/protocol/Vt200Protocol.java | 8 +------- src/org/traccar/protocol/VtfmsProtocol.java | 10 ++-------- src/org/traccar/protocol/WatchProtocol.java | 8 +------- src/org/traccar/protocol/WialonProtocol.java | 8 +------- src/org/traccar/protocol/WondexProtocol.java | 10 ++-------- src/org/traccar/protocol/WristbandProtocol.java | 8 +------- src/org/traccar/protocol/XexunProtocol.java | 8 +------- src/org/traccar/protocol/XexunProtocolDecoder.java | 3 ++- src/org/traccar/protocol/XirgoProtocol.java | 10 ++-------- src/org/traccar/protocol/Xt013Protocol.java | 8 +------- src/org/traccar/protocol/Xt2400Protocol.java | 8 +------- src/org/traccar/protocol/YwtProtocol.java | 8 +------- .../traccar/protocol/TeltonikaProtocolDecoderTest.java | 4 ++-- test/org/traccar/protocol/XexunProtocolDecoderTest.java | 4 ++-- 186 files changed, 229 insertions(+), 1293 deletions(-) diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java index 6e44b7285..4ece8f848 100644 --- a/src/org/traccar/BaseProtocol.java +++ b/src/org/traccar/BaseProtocol.java @@ -24,6 +24,8 @@ import org.traccar.model.Command; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; import java.util.Set; public abstract class BaseProtocol implements Protocol { @@ -31,6 +33,7 @@ public abstract class BaseProtocol implements Protocol { private final String name; private final Set supportedDataCommands = new HashSet<>(); private final Set supportedTextCommands = new HashSet<>(); + private final List serverList = new LinkedList<>(); private StringProtocolEncoder textCommandEncoder = null; @@ -48,6 +51,15 @@ public abstract class BaseProtocol implements Protocol { return name; } + protected void addServer(TrackerServer server) { + serverList.add(server); + } + + @Override + public Collection getServerList() { + return serverList; + } + public void setSupportedDataCommands(String... commands) { supportedDataCommands.addAll(Arrays.asList(commands)); } diff --git a/src/org/traccar/Protocol.java b/src/org/traccar/Protocol.java index c7aa67f9d..3b66f2598 100644 --- a/src/org/traccar/Protocol.java +++ b/src/org/traccar/Protocol.java @@ -19,18 +19,17 @@ import org.traccar.database.ActiveDevice; import org.traccar.model.Command; import java.util.Collection; -import java.util.List; public interface Protocol { String getName(); + Collection getServerList(); + Collection getSupportedDataCommands(); void sendDataCommand(ActiveDevice activeDevice, Command command); - void initTrackerServers(List serverList); - Collection getSupportedTextCommands(); void sendTextCommand(String destAddress, Command command) throws Exception; diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java index 17c572ae3..cdc679e8a 100644 --- a/src/org/traccar/ServerManager.java +++ b/src/org/traccar/ServerManager.java @@ -70,10 +70,11 @@ public class ServerManager { for (String name : names) { Class protocolClass = Class.forName(packageName + '.' + name); - if (BaseProtocol.class.isAssignableFrom(protocolClass)) { - BaseProtocol baseProtocol = (BaseProtocol) protocolClass.newInstance(); - initProtocolServer(baseProtocol); - protocolList.put(baseProtocol.getName(), baseProtocol); + if (BaseProtocol.class.isAssignableFrom(protocolClass) + && Context.getConfig().hasKey(BaseProtocol.nameFromClass(protocolClass) + ".port")) { + BaseProtocol protocol = (BaseProtocol) protocolClass.newInstance(); + serverList.addAll(protocol.getServerList()); + protocolList.put(protocol.getName(), protocol); } } } @@ -99,10 +100,4 @@ public class ServerManager { GlobalTimer.release(); } - private void initProtocolServer(final Protocol protocol) { - if (Context.getConfig().hasKey(protocol.getName() + ".port")) { - protocol.initTrackerServers(serverList); - } - } - } diff --git a/src/org/traccar/protocol/AdmProtocol.java b/src/org/traccar/protocol/AdmProtocol.java index e91b80dcf..08f932ceb 100644 --- a/src/org/traccar/protocol/AdmProtocol.java +++ b/src/org/traccar/protocol/AdmProtocol.java @@ -23,7 +23,6 @@ import org.traccar.TrackerServer; import org.traccar.model.Command; import java.nio.ByteOrder; -import java.util.List; public class AdmProtocol extends BaseProtocol { @@ -31,11 +30,7 @@ public class AdmProtocol extends BaseProtocol { setSupportedDataCommands( Command.TYPE_GET_DEVICE_STATUS, Command.TYPE_CUSTOM); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 2, 1, -3, 0, true)); diff --git a/src/org/traccar/protocol/AisProtocol.java b/src/org/traccar/protocol/AisProtocol.java index 27192139e..3b9cad7c8 100644 --- a/src/org/traccar/protocol/AisProtocol.java +++ b/src/org/traccar/protocol/AisProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AisProtocol extends BaseProtocol { public AisProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/AlematicsProtocol.java b/src/org/traccar/protocol/AlematicsProtocol.java index 7827df252..8da2356b9 100644 --- a/src/org/traccar/protocol/AlematicsProtocol.java +++ b/src/org/traccar/protocol/AlematicsProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AlematicsProtocol extends BaseProtocol { public AlematicsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new AlematicsFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/AnytrekProtocol.java b/src/org/traccar/protocol/AnytrekProtocol.java index 535be7ce4..4ab5833f7 100644 --- a/src/org/traccar/protocol/AnytrekProtocol.java +++ b/src/org/traccar/protocol/AnytrekProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AnytrekProtocol extends BaseProtocol { public AnytrekProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 2, 2, 2, 0)); diff --git a/src/org/traccar/protocol/ApelProtocol.java b/src/org/traccar/protocol/ApelProtocol.java index e9a7d43e5..382aa16af 100644 --- a/src/org/traccar/protocol/ApelProtocol.java +++ b/src/org/traccar/protocol/ApelProtocol.java @@ -21,16 +21,10 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import java.nio.ByteOrder; -import java.util.List; - public class ApelProtocol extends BaseProtocol { public ApelProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 2, 2, 4, 0, true)); diff --git a/src/org/traccar/protocol/AplicomProtocol.java b/src/org/traccar/protocol/AplicomProtocol.java index d20ba7f36..2b9dbf97c 100644 --- a/src/org/traccar/protocol/AplicomProtocol.java +++ b/src/org/traccar/protocol/AplicomProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AplicomProtocol extends BaseProtocol { public AplicomProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new AplicomFrameDecoder()); diff --git a/src/org/traccar/protocol/AppelloProtocol.java b/src/org/traccar/protocol/AppelloProtocol.java index 41afbd5a4..1ca4168e4 100644 --- a/src/org/traccar/protocol/AppelloProtocol.java +++ b/src/org/traccar/protocol/AppelloProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AppelloProtocol extends BaseProtocol { public AppelloProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/AppletProtocol.java b/src/org/traccar/protocol/AppletProtocol.java index 6fde967dc..2297dca03 100644 --- a/src/org/traccar/protocol/AppletProtocol.java +++ b/src/org/traccar/protocol/AppletProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AppletProtocol extends BaseProtocol { public AppletProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/AquilaProtocol.java b/src/org/traccar/protocol/AquilaProtocol.java index e271b1fb7..5ca1ec091 100644 --- a/src/org/traccar/protocol/AquilaProtocol.java +++ b/src/org/traccar/protocol/AquilaProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AquilaProtocol extends BaseProtocol { public AquilaProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/Ardi01Protocol.java b/src/org/traccar/protocol/Ardi01Protocol.java index 5837e9b03..f7826430f 100644 --- a/src/org/traccar/protocol/Ardi01Protocol.java +++ b/src/org/traccar/protocol/Ardi01Protocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Ardi01Protocol extends BaseProtocol { public Ardi01Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/ArknavProtocol.java b/src/org/traccar/protocol/ArknavProtocol.java index 05cc8775c..3b485e4a5 100644 --- a/src/org/traccar/protocol/ArknavProtocol.java +++ b/src/org/traccar/protocol/ArknavProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ArknavProtocol extends BaseProtocol { public ArknavProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\r')); diff --git a/src/org/traccar/protocol/ArknavX8Protocol.java b/src/org/traccar/protocol/ArknavX8Protocol.java index dd8d06516..a29bc1ad3 100644 --- a/src/org/traccar/protocol/ArknavX8Protocol.java +++ b/src/org/traccar/protocol/ArknavX8Protocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ArknavX8Protocol extends BaseProtocol { public ArknavX8Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ';')); diff --git a/src/org/traccar/protocol/ArnaviProtocol.java b/src/org/traccar/protocol/ArnaviProtocol.java index 905138302..afe491865 100644 --- a/src/org/traccar/protocol/ArnaviProtocol.java +++ b/src/org/traccar/protocol/ArnaviProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ArnaviProtocol extends BaseProtocol { public ArnaviProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/AstraProtocol.java b/src/org/traccar/protocol/AstraProtocol.java index 1496e2ebc..12b0dfb68 100644 --- a/src/org/traccar/protocol/AstraProtocol.java +++ b/src/org/traccar/protocol/AstraProtocol.java @@ -20,23 +20,17 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AstraProtocol extends BaseProtocol { public AstraProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 1, 2, -3, 0)); pipeline.addLast(new AstraProtocolDecoder(AstraProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new AstraProtocolDecoder(AstraProtocol.this)); diff --git a/src/org/traccar/protocol/At2000Protocol.java b/src/org/traccar/protocol/At2000Protocol.java index e95d8ccaa..5894f3eab 100644 --- a/src/org/traccar/protocol/At2000Protocol.java +++ b/src/org/traccar/protocol/At2000Protocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class At2000Protocol extends BaseProtocol { public At2000Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new At2000FrameDecoder()); diff --git a/src/org/traccar/protocol/AtrackProtocol.java b/src/org/traccar/protocol/AtrackProtocol.java index 8f4d7d68e..8e5cfe9ff 100644 --- a/src/org/traccar/protocol/AtrackProtocol.java +++ b/src/org/traccar/protocol/AtrackProtocol.java @@ -20,18 +20,12 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class AtrackProtocol extends BaseProtocol { public AtrackProtocol() { setSupportedDataCommands( Command.TYPE_CUSTOM); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new AtrackFrameDecoder()); @@ -39,7 +33,7 @@ public class AtrackProtocol extends BaseProtocol { pipeline.addLast(new AtrackProtocolDecoder(AtrackProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new AtrackProtocolEncoder()); diff --git a/src/org/traccar/protocol/AuroProtocol.java b/src/org/traccar/protocol/AuroProtocol.java index 9a2b49856..b8ebdaa75 100644 --- a/src/org/traccar/protocol/AuroProtocol.java +++ b/src/org/traccar/protocol/AuroProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AuroProtocol extends BaseProtocol { public AuroProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/AustinNbProtocol.java b/src/org/traccar/protocol/AustinNbProtocol.java index 9ad71bbee..32bfc0aae 100644 --- a/src/org/traccar/protocol/AustinNbProtocol.java +++ b/src/org/traccar/protocol/AustinNbProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AustinNbProtocol extends BaseProtocol { public AustinNbProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/AutoFonProtocol.java b/src/org/traccar/protocol/AutoFonProtocol.java index 18ddf4d89..08b5edc7d 100644 --- a/src/org/traccar/protocol/AutoFonProtocol.java +++ b/src/org/traccar/protocol/AutoFonProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AutoFonProtocol extends BaseProtocol { public AutoFonProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new AutoFonFrameDecoder()); diff --git a/src/org/traccar/protocol/AutoGradeProtocol.java b/src/org/traccar/protocol/AutoGradeProtocol.java index 95a24901c..c6dbb681e 100644 --- a/src/org/traccar/protocol/AutoGradeProtocol.java +++ b/src/org/traccar/protocol/AutoGradeProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AutoGradeProtocol extends BaseProtocol { public AutoGradeProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ')')); diff --git a/src/org/traccar/protocol/AutoTrackProtocol.java b/src/org/traccar/protocol/AutoTrackProtocol.java index eea95fb0f..6aa7558bf 100644 --- a/src/org/traccar/protocol/AutoTrackProtocol.java +++ b/src/org/traccar/protocol/AutoTrackProtocol.java @@ -21,16 +21,10 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import java.nio.ByteOrder; -import java.util.List; - public class AutoTrackProtocol extends BaseProtocol { public AutoTrackProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 5, 2, 2, 0, true)); diff --git a/src/org/traccar/protocol/AvemaProtocol.java b/src/org/traccar/protocol/AvemaProtocol.java index 8f38d2252..dbfab4dea 100644 --- a/src/org/traccar/protocol/AvemaProtocol.java +++ b/src/org/traccar/protocol/AvemaProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class AvemaProtocol extends BaseProtocol { public AvemaProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/Avl301Protocol.java b/src/org/traccar/protocol/Avl301Protocol.java index 5e3a5efc0..71fc7cb26 100644 --- a/src/org/traccar/protocol/Avl301Protocol.java +++ b/src/org/traccar/protocol/Avl301Protocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Avl301Protocol extends BaseProtocol { public Avl301Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(256, 2, 1, -3, 0)); diff --git a/src/org/traccar/protocol/BceProtocol.java b/src/org/traccar/protocol/BceProtocol.java index 176fbecba..2078d7da5 100644 --- a/src/org/traccar/protocol/BceProtocol.java +++ b/src/org/traccar/protocol/BceProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class BceProtocol extends BaseProtocol { public BceProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new BceFrameDecoder()); diff --git a/src/org/traccar/protocol/BlackKiteProtocol.java b/src/org/traccar/protocol/BlackKiteProtocol.java index 94ebf67e7..617a24d7a 100644 --- a/src/org/traccar/protocol/BlackKiteProtocol.java +++ b/src/org/traccar/protocol/BlackKiteProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class BlackKiteProtocol extends BaseProtocol { public BlackKiteProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new GalileoFrameDecoder()); diff --git a/src/org/traccar/protocol/BoxProtocol.java b/src/org/traccar/protocol/BoxProtocol.java index ed7337c54..dfea15938 100644 --- a/src/org/traccar/protocol/BoxProtocol.java +++ b/src/org/traccar/protocol/BoxProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class BoxProtocol extends BaseProtocol { public BoxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\r')); diff --git a/src/org/traccar/protocol/CalAmpProtocol.java b/src/org/traccar/protocol/CalAmpProtocol.java index 40997b31b..232e72a8c 100644 --- a/src/org/traccar/protocol/CalAmpProtocol.java +++ b/src/org/traccar/protocol/CalAmpProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class CalAmpProtocol extends BaseProtocol { public CalAmpProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CalAmpProtocolDecoder(CalAmpProtocol.this)); diff --git a/src/org/traccar/protocol/CarTrackProtocol.java b/src/org/traccar/protocol/CarTrackProtocol.java index d192103da..e340fba25 100644 --- a/src/org/traccar/protocol/CarTrackProtocol.java +++ b/src/org/traccar/protocol/CarTrackProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class CarTrackProtocol extends BaseProtocol { public CarTrackProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "##")); diff --git a/src/org/traccar/protocol/CarcellProtocol.java b/src/org/traccar/protocol/CarcellProtocol.java index 13e5f1bff..0c305efcb 100644 --- a/src/org/traccar/protocol/CarcellProtocol.java +++ b/src/org/traccar/protocol/CarcellProtocol.java @@ -15,8 +15,6 @@ */ package org.traccar.protocol; -import java.util.List; - import io.netty.handler.codec.string.StringDecoder; import io.netty.handler.codec.string.StringEncoder; import org.traccar.BaseProtocol; @@ -31,11 +29,7 @@ public class CarcellProtocol extends BaseProtocol { setSupportedDataCommands( Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\r')); diff --git a/src/org/traccar/protocol/CarscopProtocol.java b/src/org/traccar/protocol/CarscopProtocol.java index 0c09e0083..2c754a97f 100644 --- a/src/org/traccar/protocol/CarscopProtocol.java +++ b/src/org/traccar/protocol/CarscopProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class CarscopProtocol extends BaseProtocol { public CarscopProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '^')); diff --git a/src/org/traccar/protocol/CastelProtocol.java b/src/org/traccar/protocol/CastelProtocol.java index b6cfd4ba6..9b854afc3 100644 --- a/src/org/traccar/protocol/CastelProtocol.java +++ b/src/org/traccar/protocol/CastelProtocol.java @@ -22,19 +22,13 @@ import org.traccar.TrackerServer; import org.traccar.model.Command; import java.nio.ByteOrder; -import java.util.List; - public class CastelProtocol extends BaseProtocol { public CastelProtocol() { setSupportedDataCommands( Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 2, 2, -4, 0, true)); @@ -42,7 +36,7 @@ public class CastelProtocol extends BaseProtocol { pipeline.addLast(new CastelProtocolDecoder(CastelProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CastelProtocolEncoder()); diff --git a/src/org/traccar/protocol/CautelaProtocol.java b/src/org/traccar/protocol/CautelaProtocol.java index 11cb3411b..452bdf8d4 100644 --- a/src/org/traccar/protocol/CautelaProtocol.java +++ b/src/org/traccar/protocol/CautelaProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class CautelaProtocol extends BaseProtocol { public CautelaProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/CellocatorProtocol.java b/src/org/traccar/protocol/CellocatorProtocol.java index 7b9686089..a52170dc9 100644 --- a/src/org/traccar/protocol/CellocatorProtocol.java +++ b/src/org/traccar/protocol/CellocatorProtocol.java @@ -20,18 +20,12 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class CellocatorProtocol extends BaseProtocol { public CellocatorProtocol() { setSupportedDataCommands( Command.TYPE_OUTPUT_CONTROL); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CellocatorFrameDecoder()); @@ -39,7 +33,7 @@ public class CellocatorProtocol extends BaseProtocol { pipeline.addLast(new CellocatorProtocolDecoder(CellocatorProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CellocatorProtocolEncoder()); diff --git a/src/org/traccar/protocol/CguardProtocol.java b/src/org/traccar/protocol/CguardProtocol.java index 324cf6898..9157ca35c 100644 --- a/src/org/traccar/protocol/CguardProtocol.java +++ b/src/org/traccar/protocol/CguardProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class CguardProtocol extends BaseProtocol { public CguardProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/CityeasyProtocol.java b/src/org/traccar/protocol/CityeasyProtocol.java index c9b267845..f4b49c9ff 100644 --- a/src/org/traccar/protocol/CityeasyProtocol.java +++ b/src/org/traccar/protocol/CityeasyProtocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class CityeasyProtocol extends BaseProtocol { public CityeasyProtocol() { @@ -31,11 +29,7 @@ public class CityeasyProtocol extends BaseProtocol { Command.TYPE_POSITION_PERIODIC, Command.TYPE_POSITION_STOP, Command.TYPE_SET_TIMEZONE); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0)); diff --git a/src/org/traccar/protocol/ContinentalProtocol.java b/src/org/traccar/protocol/ContinentalProtocol.java index e90905e32..bc7928fba 100644 --- a/src/org/traccar/protocol/ContinentalProtocol.java +++ b/src/org/traccar/protocol/ContinentalProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ContinentalProtocol extends BaseProtocol { public ContinentalProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0)); diff --git a/src/org/traccar/protocol/CradlepointProtocol.java b/src/org/traccar/protocol/CradlepointProtocol.java index c555822d6..4a09e0311 100644 --- a/src/org/traccar/protocol/CradlepointProtocol.java +++ b/src/org/traccar/protocol/CradlepointProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class CradlepointProtocol extends BaseProtocol { public CradlepointProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/DishaProtocol.java b/src/org/traccar/protocol/DishaProtocol.java index ec4298248..38f49cc05 100644 --- a/src/org/traccar/protocol/DishaProtocol.java +++ b/src/org/traccar/protocol/DishaProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class DishaProtocol extends BaseProtocol { public DishaProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/DmtHttpProtocol.java b/src/org/traccar/protocol/DmtHttpProtocol.java index 86f64c457..34568128f 100644 --- a/src/org/traccar/protocol/DmtHttpProtocol.java +++ b/src/org/traccar/protocol/DmtHttpProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class DmtHttpProtocol extends BaseProtocol { public DmtHttpProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/DmtProtocol.java b/src/org/traccar/protocol/DmtProtocol.java index 866dda81f..78a5243c0 100644 --- a/src/org/traccar/protocol/DmtProtocol.java +++ b/src/org/traccar/protocol/DmtProtocol.java @@ -21,16 +21,10 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import java.nio.ByteOrder; -import java.util.List; - public class DmtProtocol extends BaseProtocol { public DmtProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 3, 2, 0, 0, true)); diff --git a/src/org/traccar/protocol/DwayProtocol.java b/src/org/traccar/protocol/DwayProtocol.java index 4c807cf12..05fd8b6e7 100644 --- a/src/org/traccar/protocol/DwayProtocol.java +++ b/src/org/traccar/protocol/DwayProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class DwayProtocol extends BaseProtocol { public DwayProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/EasyTrackProtocol.java b/src/org/traccar/protocol/EasyTrackProtocol.java index 71965167f..74c636d06 100644 --- a/src/org/traccar/protocol/EasyTrackProtocol.java +++ b/src/org/traccar/protocol/EasyTrackProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class EasyTrackProtocol extends BaseProtocol { public EasyTrackProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "#", "\r\n")); diff --git a/src/org/traccar/protocol/EelinkProtocol.java b/src/org/traccar/protocol/EelinkProtocol.java index dcfcb41a5..de4ea971b 100644 --- a/src/org/traccar/protocol/EelinkProtocol.java +++ b/src/org/traccar/protocol/EelinkProtocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class EelinkProtocol extends BaseProtocol { public EelinkProtocol() { @@ -32,11 +30,7 @@ public class EelinkProtocol extends BaseProtocol { Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME, Command.TYPE_REBOOT_DEVICE); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 3, 2)); @@ -44,7 +38,7 @@ public class EelinkProtocol extends BaseProtocol { pipeline.addLast(new EelinkProtocolDecoder(EelinkProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new EelinkProtocolEncoder(true)); diff --git a/src/org/traccar/protocol/EgtsProtocol.java b/src/org/traccar/protocol/EgtsProtocol.java index b45219ed2..5d4638f37 100644 --- a/src/org/traccar/protocol/EgtsProtocol.java +++ b/src/org/traccar/protocol/EgtsProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class EgtsProtocol extends BaseProtocol { public EgtsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new EgtsFrameDecoder()); diff --git a/src/org/traccar/protocol/EnforaProtocol.java b/src/org/traccar/protocol/EnforaProtocol.java index 7e3a92698..3bbbee6a2 100644 --- a/src/org/traccar/protocol/EnforaProtocol.java +++ b/src/org/traccar/protocol/EnforaProtocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class EnforaProtocol extends BaseProtocol { public EnforaProtocol() { @@ -30,11 +28,7 @@ public class EnforaProtocol extends BaseProtocol { Command.TYPE_CUSTOM, Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 0, 2, -2, 2)); diff --git a/src/org/traccar/protocol/EsealProtocol.java b/src/org/traccar/protocol/EsealProtocol.java index b478976c6..7a27c617d 100644 --- a/src/org/traccar/protocol/EsealProtocol.java +++ b/src/org/traccar/protocol/EsealProtocol.java @@ -23,8 +23,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class EsealProtocol extends BaseProtocol { public EsealProtocol() { @@ -32,11 +30,7 @@ public class EsealProtocol extends BaseProtocol { Command.TYPE_CUSTOM, Command.TYPE_ALARM_ARM, Command.TYPE_ALARM_DISARM); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/EskyProtocol.java b/src/org/traccar/protocol/EskyProtocol.java index 99573d888..aaa92da58 100644 --- a/src/org/traccar/protocol/EskyProtocol.java +++ b/src/org/traccar/protocol/EskyProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class EskyProtocol extends BaseProtocol { public EskyProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new EskyFrameDecoder()); diff --git a/src/org/traccar/protocol/ExtremTracProtocol.java b/src/org/traccar/protocol/ExtremTracProtocol.java index b0c2eb0ba..692fd4e99 100644 --- a/src/org/traccar/protocol/ExtremTracProtocol.java +++ b/src/org/traccar/protocol/ExtremTracProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ExtremTracProtocol extends BaseProtocol { public ExtremTracProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/FifotrackProtocol.java b/src/org/traccar/protocol/FifotrackProtocol.java index 9c27cc792..5de581c7a 100644 --- a/src/org/traccar/protocol/FifotrackProtocol.java +++ b/src/org/traccar/protocol/FifotrackProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class FifotrackProtocol extends BaseProtocol { public FifotrackProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/FlespiProtocol.java b/src/org/traccar/protocol/FlespiProtocol.java index 59f0c1d8b..2c0729b76 100644 --- a/src/org/traccar/protocol/FlespiProtocol.java +++ b/src/org/traccar/protocol/FlespiProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class FlespiProtocol extends BaseProtocol { public FlespiProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/FlexCommProtocol.java b/src/org/traccar/protocol/FlexCommProtocol.java index 4926ec4fa..9343ebeb8 100644 --- a/src/org/traccar/protocol/FlexCommProtocol.java +++ b/src/org/traccar/protocol/FlexCommProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class FlexCommProtocol extends BaseProtocol { public FlexCommProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new FixedLengthFrameDecoder(2 + 2 + 101 + 5)); diff --git a/src/org/traccar/protocol/FlextrackProtocol.java b/src/org/traccar/protocol/FlextrackProtocol.java index 7c634949b..ddd1d58f0 100644 --- a/src/org/traccar/protocol/FlextrackProtocol.java +++ b/src/org/traccar/protocol/FlextrackProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class FlextrackProtocol extends BaseProtocol { public FlextrackProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "\r")); diff --git a/src/org/traccar/protocol/FoxProtocol.java b/src/org/traccar/protocol/FoxProtocol.java index 48ece3901..9bac773b5 100644 --- a/src/org/traccar/protocol/FoxProtocol.java +++ b/src/org/traccar/protocol/FoxProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class FoxProtocol extends BaseProtocol { public FoxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "")); diff --git a/src/org/traccar/protocol/FreedomProtocol.java b/src/org/traccar/protocol/FreedomProtocol.java index b60fd12fb..bc6b92d5f 100644 --- a/src/org/traccar/protocol/FreedomProtocol.java +++ b/src/org/traccar/protocol/FreedomProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class FreedomProtocol extends BaseProtocol { public FreedomProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/FreematicsProtocol.java b/src/org/traccar/protocol/FreematicsProtocol.java index 20935388e..999b075a1 100644 --- a/src/org/traccar/protocol/FreematicsProtocol.java +++ b/src/org/traccar/protocol/FreematicsProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class FreematicsProtocol extends BaseProtocol { public FreematicsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/GalileoProtocol.java b/src/org/traccar/protocol/GalileoProtocol.java index 2126bdf81..9b7fe1a4b 100644 --- a/src/org/traccar/protocol/GalileoProtocol.java +++ b/src/org/traccar/protocol/GalileoProtocol.java @@ -20,19 +20,13 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class GalileoProtocol extends BaseProtocol { public GalileoProtocol() { setSupportedDataCommands( Command.TYPE_CUSTOM, Command.TYPE_OUTPUT_CONTROL); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new GalileoFrameDecoder()); diff --git a/src/org/traccar/protocol/GatorProtocol.java b/src/org/traccar/protocol/GatorProtocol.java index 4a956deb5..ca81caefb 100644 --- a/src/org/traccar/protocol/GatorProtocol.java +++ b/src/org/traccar/protocol/GatorProtocol.java @@ -20,23 +20,17 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GatorProtocol extends BaseProtocol { public GatorProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 3, 2)); pipeline.addLast(new GatorProtocolDecoder(GatorProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new GatorProtocolDecoder(GatorProtocol.this)); diff --git a/src/org/traccar/protocol/GenxProtocol.java b/src/org/traccar/protocol/GenxProtocol.java index f3d388266..c87ba946a 100644 --- a/src/org/traccar/protocol/GenxProtocol.java +++ b/src/org/traccar/protocol/GenxProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GenxProtocol extends BaseProtocol { public GenxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/Gl100Protocol.java b/src/org/traccar/protocol/Gl100Protocol.java index 3c4230bda..063e606db 100644 --- a/src/org/traccar/protocol/Gl100Protocol.java +++ b/src/org/traccar/protocol/Gl100Protocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Gl100Protocol extends BaseProtocol { public Gl100Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\0')); @@ -40,7 +34,7 @@ public class Gl100Protocol extends BaseProtocol { pipeline.addLast(new Gl100ProtocolDecoder(Gl100Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/Gl200Protocol.java b/src/org/traccar/protocol/Gl200Protocol.java index 0739b83ce..c5343dae0 100644 --- a/src/org/traccar/protocol/Gl200Protocol.java +++ b/src/org/traccar/protocol/Gl200Protocol.java @@ -22,8 +22,6 @@ import org.traccar.model.Command; import io.netty.handler.codec.string.StringEncoder; -import java.util.List; - public class Gl200Protocol extends BaseProtocol { public Gl200Protocol() { @@ -33,11 +31,7 @@ public class Gl200Protocol extends BaseProtocol { Command.TYPE_ENGINE_RESUME, Command.TYPE_IDENTIFICATION, Command.TYPE_REBOOT_DEVICE); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Gl200FrameDecoder()); @@ -46,7 +40,7 @@ public class Gl200Protocol extends BaseProtocol { pipeline.addLast(new Gl200ProtocolDecoder(Gl200Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/GlobalSatProtocol.java b/src/org/traccar/protocol/GlobalSatProtocol.java index 056358e2d..5612515c9 100644 --- a/src/org/traccar/protocol/GlobalSatProtocol.java +++ b/src/org/traccar/protocol/GlobalSatProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GlobalSatProtocol extends BaseProtocol { public GlobalSatProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '!')); diff --git a/src/org/traccar/protocol/GnxProtocol.java b/src/org/traccar/protocol/GnxProtocol.java index 8a7b9a17f..3576bf805 100644 --- a/src/org/traccar/protocol/GnxProtocol.java +++ b/src/org/traccar/protocol/GnxProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GnxProtocol extends BaseProtocol { public GnxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "\n\r")); diff --git a/src/org/traccar/protocol/GoSafeProtocol.java b/src/org/traccar/protocol/GoSafeProtocol.java index 1f3f25cb9..853b78a16 100644 --- a/src/org/traccar/protocol/GoSafeProtocol.java +++ b/src/org/traccar/protocol/GoSafeProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GoSafeProtocol extends BaseProtocol { public GoSafeProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '#')); diff --git a/src/org/traccar/protocol/GotopProtocol.java b/src/org/traccar/protocol/GotopProtocol.java index c86cdf890..07fe02248 100644 --- a/src/org/traccar/protocol/GotopProtocol.java +++ b/src/org/traccar/protocol/GotopProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GotopProtocol extends BaseProtocol { public GotopProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '#')); diff --git a/src/org/traccar/protocol/Gps056Protocol.java b/src/org/traccar/protocol/Gps056Protocol.java index 9b0e7e284..b6ab10a19 100644 --- a/src/org/traccar/protocol/Gps056Protocol.java +++ b/src/org/traccar/protocol/Gps056Protocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Gps056Protocol extends BaseProtocol { public Gps056Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Gps056FrameDecoder()); diff --git a/src/org/traccar/protocol/Gps103Protocol.java b/src/org/traccar/protocol/Gps103Protocol.java index 6fbe71f08..d112c1170 100644 --- a/src/org/traccar/protocol/Gps103Protocol.java +++ b/src/org/traccar/protocol/Gps103Protocol.java @@ -23,8 +23,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class Gps103Protocol extends BaseProtocol { public Gps103Protocol() { @@ -38,11 +36,7 @@ public class Gps103Protocol extends BaseProtocol { Command.TYPE_ALARM_ARM, Command.TYPE_ALARM_DISARM, Command.TYPE_REQUEST_PHOTO); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(2048, "\r\n", "\n", ";", "*")); @@ -52,7 +46,7 @@ public class Gps103Protocol extends BaseProtocol { pipeline.addLast(new Gps103ProtocolDecoder(Gps103Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/GpsGateProtocol.java b/src/org/traccar/protocol/GpsGateProtocol.java index 55b4462c2..a131b6f48 100644 --- a/src/org/traccar/protocol/GpsGateProtocol.java +++ b/src/org/traccar/protocol/GpsGateProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GpsGateProtocol extends BaseProtocol { public GpsGateProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "\0", "\n", "\r\n")); diff --git a/src/org/traccar/protocol/GpsMarkerProtocol.java b/src/org/traccar/protocol/GpsMarkerProtocol.java index e43a6c683..ad23ece48 100644 --- a/src/org/traccar/protocol/GpsMarkerProtocol.java +++ b/src/org/traccar/protocol/GpsMarkerProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GpsMarkerProtocol extends BaseProtocol { public GpsMarkerProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "\r")); diff --git a/src/org/traccar/protocol/GpsmtaProtocol.java b/src/org/traccar/protocol/GpsmtaProtocol.java index a6ded7289..ce6cc5929 100644 --- a/src/org/traccar/protocol/GpsmtaProtocol.java +++ b/src/org/traccar/protocol/GpsmtaProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class GpsmtaProtocol extends BaseProtocol { public GpsmtaProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/GranitProtocol.java b/src/org/traccar/protocol/GranitProtocol.java index 1ba244170..6785f2a2e 100644 --- a/src/org/traccar/protocol/GranitProtocol.java +++ b/src/org/traccar/protocol/GranitProtocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class GranitProtocol extends BaseProtocol { public GranitProtocol() { @@ -34,11 +32,7 @@ public class GranitProtocol extends BaseProtocol { setSupportedTextCommands( Command.TYPE_REBOOT_DEVICE, Command.TYPE_POSITION_PERIODIC); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new GranitFrameDecoder()); diff --git a/src/org/traccar/protocol/Gt02Protocol.java b/src/org/traccar/protocol/Gt02Protocol.java index 93c0009fc..f412ee720 100644 --- a/src/org/traccar/protocol/Gt02Protocol.java +++ b/src/org/traccar/protocol/Gt02Protocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Gt02Protocol extends BaseProtocol { public Gt02Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(256, 2, 1, 2, 0)); diff --git a/src/org/traccar/protocol/Gt06Protocol.java b/src/org/traccar/protocol/Gt06Protocol.java index dac8ffc7e..6e5435cd4 100644 --- a/src/org/traccar/protocol/Gt06Protocol.java +++ b/src/org/traccar/protocol/Gt06Protocol.java @@ -20,8 +20,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class Gt06Protocol extends BaseProtocol { public Gt06Protocol() { @@ -29,11 +27,7 @@ public class Gt06Protocol extends BaseProtocol { Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME, Command.TYPE_CUSTOM); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Gt06FrameDecoder()); diff --git a/src/org/traccar/protocol/Gt30Protocol.java b/src/org/traccar/protocol/Gt30Protocol.java index 18ef12fbc..aa4ad20b1 100644 --- a/src/org/traccar/protocol/Gt30Protocol.java +++ b/src/org/traccar/protocol/Gt30Protocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Gt30Protocol extends BaseProtocol { public Gt30Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/H02Protocol.java b/src/org/traccar/protocol/H02Protocol.java index 87982eef0..251beac5e 100644 --- a/src/org/traccar/protocol/H02Protocol.java +++ b/src/org/traccar/protocol/H02Protocol.java @@ -22,8 +22,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class H02Protocol extends BaseProtocol { public H02Protocol() { @@ -34,11 +32,7 @@ public class H02Protocol extends BaseProtocol { Command.TYPE_ENGINE_RESUME, Command.TYPE_POSITION_PERIODIC ); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { int messageLength = Context.getConfig().getInteger(getName() + ".messageLength"); @@ -48,7 +42,7 @@ public class H02Protocol extends BaseProtocol { pipeline.addLast(new H02ProtocolDecoder(H02Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/HaicomProtocol.java b/src/org/traccar/protocol/HaicomProtocol.java index 77b8280aa..6e5760bd4 100644 --- a/src/org/traccar/protocol/HaicomProtocol.java +++ b/src/org/traccar/protocol/HaicomProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class HaicomProtocol extends BaseProtocol { public HaicomProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '*')); diff --git a/src/org/traccar/protocol/HomtecsProtocol.java b/src/org/traccar/protocol/HomtecsProtocol.java index 7f7523946..34dbf0f51 100644 --- a/src/org/traccar/protocol/HomtecsProtocol.java +++ b/src/org/traccar/protocol/HomtecsProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class HomtecsProtocol extends BaseProtocol { public HomtecsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/HuaShengProtocol.java b/src/org/traccar/protocol/HuaShengProtocol.java index 56eb1384c..103f2d501 100644 --- a/src/org/traccar/protocol/HuaShengProtocol.java +++ b/src/org/traccar/protocol/HuaShengProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class HuaShengProtocol extends BaseProtocol { public HuaShengProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HuaShengFrameDecoder()); diff --git a/src/org/traccar/protocol/HuabaoProtocol.java b/src/org/traccar/protocol/HuabaoProtocol.java index 0f02f488d..44c9f7ac7 100644 --- a/src/org/traccar/protocol/HuabaoProtocol.java +++ b/src/org/traccar/protocol/HuabaoProtocol.java @@ -20,19 +20,13 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class HuabaoProtocol extends BaseProtocol { public HuabaoProtocol() { setSupportedDataCommands( Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HuabaoFrameDecoder()); diff --git a/src/org/traccar/protocol/HunterProProtocol.java b/src/org/traccar/protocol/HunterProProtocol.java index d6d8fdbfe..9f6424a57 100644 --- a/src/org/traccar/protocol/HunterProProtocol.java +++ b/src/org/traccar/protocol/HunterProProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class HunterProProtocol extends BaseProtocol { public HunterProProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "\r")); diff --git a/src/org/traccar/protocol/IdplProtocol.java b/src/org/traccar/protocol/IdplProtocol.java index c80f8eb75..418178756 100644 --- a/src/org/traccar/protocol/IdplProtocol.java +++ b/src/org/traccar/protocol/IdplProtocol.java @@ -15,8 +15,6 @@ */ package org.traccar.protocol; -import java.util.List; - import io.netty.handler.codec.LineBasedFrameDecoder; import io.netty.handler.codec.string.StringDecoder; import io.netty.handler.codec.string.StringEncoder; @@ -27,11 +25,7 @@ import org.traccar.TrackerServer; public class IdplProtocol extends BaseProtocol { public IdplProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/IntellitracProtocol.java b/src/org/traccar/protocol/IntellitracProtocol.java index 2faa472c0..3abf40da7 100644 --- a/src/org/traccar/protocol/IntellitracProtocol.java +++ b/src/org/traccar/protocol/IntellitracProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class IntellitracProtocol extends BaseProtocol { public IntellitracProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new IntellitracFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/ItsProtocol.java b/src/org/traccar/protocol/ItsProtocol.java index 8ba723e36..f53600dc9 100644 --- a/src/org/traccar/protocol/ItsProtocol.java +++ b/src/org/traccar/protocol/ItsProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ItsProtocol extends BaseProtocol { public ItsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '*')); diff --git a/src/org/traccar/protocol/Ivt401Protocol.java b/src/org/traccar/protocol/Ivt401Protocol.java index 960929641..fb44e4fe9 100644 --- a/src/org/traccar/protocol/Ivt401Protocol.java +++ b/src/org/traccar/protocol/Ivt401Protocol.java @@ -21,16 +21,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Ivt401Protocol extends BaseProtocol { public Ivt401Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ';')); diff --git a/src/org/traccar/protocol/JpKorjarProtocol.java b/src/org/traccar/protocol/JpKorjarProtocol.java index a9fa61074..fe5b2480d 100644 --- a/src/org/traccar/protocol/JpKorjarProtocol.java +++ b/src/org/traccar/protocol/JpKorjarProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class JpKorjarProtocol extends BaseProtocol { public JpKorjarProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, this.getName()) { + addServer(new TrackerServer(false, this.getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new JpKorjarFrameDecoder()); diff --git a/src/org/traccar/protocol/Jt600Protocol.java b/src/org/traccar/protocol/Jt600Protocol.java index 6d9816c22..97c5fa6ce 100644 --- a/src/org/traccar/protocol/Jt600Protocol.java +++ b/src/org/traccar/protocol/Jt600Protocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class Jt600Protocol extends BaseProtocol { public Jt600Protocol() { @@ -31,11 +29,7 @@ public class Jt600Protocol extends BaseProtocol { Command.TYPE_ENGINE_STOP, Command.TYPE_SET_TIMEZONE, Command.TYPE_REBOOT_DEVICE); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Jt600FrameDecoder()); diff --git a/src/org/traccar/protocol/KenjiProtocol.java b/src/org/traccar/protocol/KenjiProtocol.java index fb0eeeae6..90c0c511c 100644 --- a/src/org/traccar/protocol/KenjiProtocol.java +++ b/src/org/traccar/protocol/KenjiProtocol.java @@ -23,16 +23,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class KenjiProtocol extends BaseProtocol { public KenjiProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/KhdProtocol.java b/src/org/traccar/protocol/KhdProtocol.java index 702897970..cec7158ed 100644 --- a/src/org/traccar/protocol/KhdProtocol.java +++ b/src/org/traccar/protocol/KhdProtocol.java @@ -21,19 +21,13 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class KhdProtocol extends BaseProtocol { public KhdProtocol() { setSupportedDataCommands( Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(512, 3, 2)); diff --git a/src/org/traccar/protocol/L100Protocol.java b/src/org/traccar/protocol/L100Protocol.java index 12c4dc123..942029307 100644 --- a/src/org/traccar/protocol/L100Protocol.java +++ b/src/org/traccar/protocol/L100Protocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class L100Protocol extends BaseProtocol { public L100Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new L100FrameDecoder()); diff --git a/src/org/traccar/protocol/LaipacProtocol.java b/src/org/traccar/protocol/LaipacProtocol.java index 732cf3353..923b08a16 100644 --- a/src/org/traccar/protocol/LaipacProtocol.java +++ b/src/org/traccar/protocol/LaipacProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class LaipacProtocol extends BaseProtocol { public LaipacProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/M2cProtocol.java b/src/org/traccar/protocol/M2cProtocol.java index 0d22158a8..9de8526c3 100644 --- a/src/org/traccar/protocol/M2cProtocol.java +++ b/src/org/traccar/protocol/M2cProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class M2cProtocol extends BaseProtocol { public M2cProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(32 * 1024, ']')); diff --git a/src/org/traccar/protocol/M2mProtocol.java b/src/org/traccar/protocol/M2mProtocol.java index af7a3bde2..dda328a59 100644 --- a/src/org/traccar/protocol/M2mProtocol.java +++ b/src/org/traccar/protocol/M2mProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class M2mProtocol extends BaseProtocol { public M2mProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new FixedLengthFrameDecoder(23)); diff --git a/src/org/traccar/protocol/MaestroProtocol.java b/src/org/traccar/protocol/MaestroProtocol.java index d423e626a..87453ce7d 100644 --- a/src/org/traccar/protocol/MaestroProtocol.java +++ b/src/org/traccar/protocol/MaestroProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class MaestroProtocol extends BaseProtocol { public MaestroProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new FixedLengthFrameDecoder(160)); diff --git a/src/org/traccar/protocol/ManPowerProtocol.java b/src/org/traccar/protocol/ManPowerProtocol.java index 8b28bfa72..49d8b1e9f 100644 --- a/src/org/traccar/protocol/ManPowerProtocol.java +++ b/src/org/traccar/protocol/ManPowerProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ManPowerProtocol extends BaseProtocol { public ManPowerProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ';')); diff --git a/src/org/traccar/protocol/MegastekProtocol.java b/src/org/traccar/protocol/MegastekProtocol.java index 7418fee83..e9f5f9fde 100644 --- a/src/org/traccar/protocol/MegastekProtocol.java +++ b/src/org/traccar/protocol/MegastekProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class MegastekProtocol extends BaseProtocol { public MegastekProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new MegastekFrameDecoder()); diff --git a/src/org/traccar/protocol/MeiligaoProtocol.java b/src/org/traccar/protocol/MeiligaoProtocol.java index 7c5b8d8f1..c307c7318 100644 --- a/src/org/traccar/protocol/MeiligaoProtocol.java +++ b/src/org/traccar/protocol/MeiligaoProtocol.java @@ -20,8 +20,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class MeiligaoProtocol extends BaseProtocol { public MeiligaoProtocol() { @@ -34,11 +32,7 @@ public class MeiligaoProtocol extends BaseProtocol { Command.TYPE_SET_TIMEZONE, Command.TYPE_REQUEST_PHOTO, Command.TYPE_REBOOT_DEVICE); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new MeiligaoFrameDecoder()); @@ -46,7 +40,7 @@ public class MeiligaoProtocol extends BaseProtocol { pipeline.addLast(new MeiligaoProtocolDecoder(MeiligaoProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new MeiligaoProtocolEncoder()); diff --git a/src/org/traccar/protocol/MeitrackProtocol.java b/src/org/traccar/protocol/MeitrackProtocol.java index b0da50908..c887cd3a0 100644 --- a/src/org/traccar/protocol/MeitrackProtocol.java +++ b/src/org/traccar/protocol/MeitrackProtocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class MeitrackProtocol extends BaseProtocol { public MeitrackProtocol() { @@ -34,11 +32,7 @@ public class MeitrackProtocol extends BaseProtocol { Command.TYPE_ALARM_DISARM, Command.TYPE_REQUEST_PHOTO, Command.TYPE_SEND_SMS); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new MeitrackFrameDecoder()); @@ -47,7 +41,7 @@ public class MeitrackProtocol extends BaseProtocol { pipeline.addLast(new MeitrackProtocolDecoder(MeitrackProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/MilesmateProtocol.java b/src/org/traccar/protocol/MilesmateProtocol.java index b1b4ba2f3..822711603 100644 --- a/src/org/traccar/protocol/MilesmateProtocol.java +++ b/src/org/traccar/protocol/MilesmateProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class MilesmateProtocol extends BaseProtocol { public MilesmateProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/MiniFinderProtocol.java b/src/org/traccar/protocol/MiniFinderProtocol.java index db33c3f64..d4a154053 100644 --- a/src/org/traccar/protocol/MiniFinderProtocol.java +++ b/src/org/traccar/protocol/MiniFinderProtocol.java @@ -23,8 +23,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class MiniFinderProtocol extends BaseProtocol { public MiniFinderProtocol() { @@ -40,11 +38,7 @@ public class MiniFinderProtocol extends BaseProtocol { Command.TYPE_MODE_DEEP_SLEEP, Command.TYPE_SOS_NUMBER, Command.TYPE_SET_INDICATOR); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ';')); diff --git a/src/org/traccar/protocol/Mta6Protocol.java b/src/org/traccar/protocol/Mta6Protocol.java index 80cba47a4..632a7df80 100644 --- a/src/org/traccar/protocol/Mta6Protocol.java +++ b/src/org/traccar/protocol/Mta6Protocol.java @@ -23,16 +23,10 @@ import org.traccar.Context; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Mta6Protocol extends BaseProtocol { public Mta6Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/MtxProtocol.java b/src/org/traccar/protocol/MtxProtocol.java index 31eec3f88..44372ce83 100644 --- a/src/org/traccar/protocol/MtxProtocol.java +++ b/src/org/traccar/protocol/MtxProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class MtxProtocol extends BaseProtocol { public MtxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/MxtProtocol.java b/src/org/traccar/protocol/MxtProtocol.java index 765342def..dbe43fe45 100644 --- a/src/org/traccar/protocol/MxtProtocol.java +++ b/src/org/traccar/protocol/MxtProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class MxtProtocol extends BaseProtocol { public MxtProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new MxtFrameDecoder()); diff --git a/src/org/traccar/protocol/NavigilProtocol.java b/src/org/traccar/protocol/NavigilProtocol.java index 82db758cb..2c946c39f 100644 --- a/src/org/traccar/protocol/NavigilProtocol.java +++ b/src/org/traccar/protocol/NavigilProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class NavigilProtocol extends BaseProtocol { public NavigilProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new NavigilFrameDecoder()); diff --git a/src/org/traccar/protocol/NavisProtocol.java b/src/org/traccar/protocol/NavisProtocol.java index 687c5b334..83a9dc99d 100644 --- a/src/org/traccar/protocol/NavisProtocol.java +++ b/src/org/traccar/protocol/NavisProtocol.java @@ -21,16 +21,10 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import java.nio.ByteOrder; -import java.util.List; - public class NavisProtocol extends BaseProtocol { public NavisProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 4096, 12, 2, 2, 0, true)); diff --git a/src/org/traccar/protocol/NoranProtocol.java b/src/org/traccar/protocol/NoranProtocol.java index 9debed07f..9f3078d6d 100644 --- a/src/org/traccar/protocol/NoranProtocol.java +++ b/src/org/traccar/protocol/NoranProtocol.java @@ -20,8 +20,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class NoranProtocol extends BaseProtocol { public NoranProtocol() { @@ -31,11 +29,7 @@ public class NoranProtocol extends BaseProtocol { Command.TYPE_POSITION_STOP, Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new NoranProtocolEncoder()); diff --git a/src/org/traccar/protocol/NvsProtocol.java b/src/org/traccar/protocol/NvsProtocol.java index fed26655b..d319b22f3 100644 --- a/src/org/traccar/protocol/NvsProtocol.java +++ b/src/org/traccar/protocol/NvsProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class NvsProtocol extends BaseProtocol { public NvsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new NvsFrameDecoder()); diff --git a/src/org/traccar/protocol/ObdDongleProtocol.java b/src/org/traccar/protocol/ObdDongleProtocol.java index 0cb289a71..10a55759b 100644 --- a/src/org/traccar/protocol/ObdDongleProtocol.java +++ b/src/org/traccar/protocol/ObdDongleProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ObdDongleProtocol extends BaseProtocol { public ObdDongleProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1099, 20, 2, 3, 0)); diff --git a/src/org/traccar/protocol/OigoProtocol.java b/src/org/traccar/protocol/OigoProtocol.java index e090d8ace..5056f68aa 100644 --- a/src/org/traccar/protocol/OigoProtocol.java +++ b/src/org/traccar/protocol/OigoProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class OigoProtocol extends BaseProtocol { public OigoProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new OigoProtocolDecoder(OigoProtocol.this)); diff --git a/src/org/traccar/protocol/OkoProtocol.java b/src/org/traccar/protocol/OkoProtocol.java index 4507ba6cc..9571ccc48 100644 --- a/src/org/traccar/protocol/OkoProtocol.java +++ b/src/org/traccar/protocol/OkoProtocol.java @@ -21,16 +21,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class OkoProtocol extends BaseProtocol { public OkoProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '}')); diff --git a/src/org/traccar/protocol/OpenGtsProtocol.java b/src/org/traccar/protocol/OpenGtsProtocol.java index 136d86692..5ef3260c6 100644 --- a/src/org/traccar/protocol/OpenGtsProtocol.java +++ b/src/org/traccar/protocol/OpenGtsProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class OpenGtsProtocol extends BaseProtocol { public OpenGtsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/OrionProtocol.java b/src/org/traccar/protocol/OrionProtocol.java index 7cf7184f4..8485ae638 100644 --- a/src/org/traccar/protocol/OrionProtocol.java +++ b/src/org/traccar/protocol/OrionProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class OrionProtocol extends BaseProtocol { public OrionProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new OrionFrameDecoder()); diff --git a/src/org/traccar/protocol/OsmAndProtocol.java b/src/org/traccar/protocol/OsmAndProtocol.java index e1ce0755f..d3aa2fd6f 100644 --- a/src/org/traccar/protocol/OsmAndProtocol.java +++ b/src/org/traccar/protocol/OsmAndProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class OsmAndProtocol extends BaseProtocol { public OsmAndProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/OwnTracksProtocol.java b/src/org/traccar/protocol/OwnTracksProtocol.java index 76743406e..0086371d8 100644 --- a/src/org/traccar/protocol/OwnTracksProtocol.java +++ b/src/org/traccar/protocol/OwnTracksProtocol.java @@ -23,16 +23,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class OwnTracksProtocol extends BaseProtocol { public OwnTracksProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/PathAwayProtocol.java b/src/org/traccar/protocol/PathAwayProtocol.java index ca81e0b2d..6b5d75c5e 100644 --- a/src/org/traccar/protocol/PathAwayProtocol.java +++ b/src/org/traccar/protocol/PathAwayProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class PathAwayProtocol extends BaseProtocol { public PathAwayProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/PiligrimProtocol.java b/src/org/traccar/protocol/PiligrimProtocol.java index 1b19253d4..d88c1ab72 100644 --- a/src/org/traccar/protocol/PiligrimProtocol.java +++ b/src/org/traccar/protocol/PiligrimProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class PiligrimProtocol extends BaseProtocol { public PiligrimProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/PretraceProtocol.java b/src/org/traccar/protocol/PretraceProtocol.java index ec498fbba..f753cbdb4 100644 --- a/src/org/traccar/protocol/PretraceProtocol.java +++ b/src/org/traccar/protocol/PretraceProtocol.java @@ -23,19 +23,13 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class PretraceProtocol extends BaseProtocol { public PretraceProtocol() { setSupportedDataCommands( Command.TYPE_CUSTOM, Command.TYPE_POSITION_PERIODIC); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ')')); diff --git a/src/org/traccar/protocol/PricolProtocol.java b/src/org/traccar/protocol/PricolProtocol.java index f39b6ff13..6821cd949 100644 --- a/src/org/traccar/protocol/PricolProtocol.java +++ b/src/org/traccar/protocol/PricolProtocol.java @@ -20,23 +20,17 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class PricolProtocol extends BaseProtocol { public PricolProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new FixedLengthFrameDecoder(64)); pipeline.addLast(new PricolProtocolDecoder(PricolProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new PricolProtocolDecoder(PricolProtocol.this)); diff --git a/src/org/traccar/protocol/ProgressProtocol.java b/src/org/traccar/protocol/ProgressProtocol.java index a9732792c..aac84205d 100644 --- a/src/org/traccar/protocol/ProgressProtocol.java +++ b/src/org/traccar/protocol/ProgressProtocol.java @@ -21,16 +21,10 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import java.nio.ByteOrder; -import java.util.List; - public class ProgressProtocol extends BaseProtocol { public ProgressProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 2, 2, 4, 0, true)); diff --git a/src/org/traccar/protocol/Pt3000Protocol.java b/src/org/traccar/protocol/Pt3000Protocol.java index ca1a29b40..1ad0026a3 100644 --- a/src/org/traccar/protocol/Pt3000Protocol.java +++ b/src/org/traccar/protocol/Pt3000Protocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Pt3000Protocol extends BaseProtocol { public Pt3000Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, 'd')); // probably wrong diff --git a/src/org/traccar/protocol/Pt502Protocol.java b/src/org/traccar/protocol/Pt502Protocol.java index b3f0fc3a0..5afb9451d 100644 --- a/src/org/traccar/protocol/Pt502Protocol.java +++ b/src/org/traccar/protocol/Pt502Protocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class Pt502Protocol extends BaseProtocol { public Pt502Protocol() { @@ -32,11 +30,7 @@ public class Pt502Protocol extends BaseProtocol { Command.TYPE_ALARM_SPEED, Command.TYPE_OUTPUT_CONTROL, Command.TYPE_REQUEST_PHOTO); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Pt502FrameDecoder()); diff --git a/src/org/traccar/protocol/Pt60Protocol.java b/src/org/traccar/protocol/Pt60Protocol.java index ca1eb9324..18ea2edb1 100644 --- a/src/org/traccar/protocol/Pt60Protocol.java +++ b/src/org/traccar/protocol/Pt60Protocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Pt60Protocol extends BaseProtocol { public Pt60Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "@R#@")); diff --git a/src/org/traccar/protocol/RaveonProtocol.java b/src/org/traccar/protocol/RaveonProtocol.java index 13560931d..44faadb3b 100644 --- a/src/org/traccar/protocol/RaveonProtocol.java +++ b/src/org/traccar/protocol/RaveonProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class RaveonProtocol extends BaseProtocol { public RaveonProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/RecodaProtocol.java b/src/org/traccar/protocol/RecodaProtocol.java index 82019b4f5..0bc9870bc 100644 --- a/src/org/traccar/protocol/RecodaProtocol.java +++ b/src/org/traccar/protocol/RecodaProtocol.java @@ -21,16 +21,10 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import java.nio.ByteOrder; -import java.util.List; - public class RecodaProtocol extends BaseProtocol { public RecodaProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 4, 4, -8, 0, true)); diff --git a/src/org/traccar/protocol/RetranslatorProtocol.java b/src/org/traccar/protocol/RetranslatorProtocol.java index e66d17abb..fae81f7d2 100644 --- a/src/org/traccar/protocol/RetranslatorProtocol.java +++ b/src/org/traccar/protocol/RetranslatorProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class RetranslatorProtocol extends BaseProtocol { public RetranslatorProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new RetranslatorFrameDecoder()); diff --git a/src/org/traccar/protocol/RitiProtocol.java b/src/org/traccar/protocol/RitiProtocol.java index c70a0ebdf..de1026672 100644 --- a/src/org/traccar/protocol/RitiProtocol.java +++ b/src/org/traccar/protocol/RitiProtocol.java @@ -21,16 +21,10 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import java.nio.ByteOrder; -import java.util.List; - public class RitiProtocol extends BaseProtocol { public RitiProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 1024, 105, 2, 3, 0, true)); diff --git a/src/org/traccar/protocol/RoboTrackProtocol.java b/src/org/traccar/protocol/RoboTrackProtocol.java index 5dfc57541..c2c531293 100644 --- a/src/org/traccar/protocol/RoboTrackProtocol.java +++ b/src/org/traccar/protocol/RoboTrackProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class RoboTrackProtocol extends BaseProtocol { public RoboTrackProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new RoboTrackFrameDecoder()); diff --git a/src/org/traccar/protocol/RuptelaProtocol.java b/src/org/traccar/protocol/RuptelaProtocol.java index da1fad2ab..1ac62570a 100644 --- a/src/org/traccar/protocol/RuptelaProtocol.java +++ b/src/org/traccar/protocol/RuptelaProtocol.java @@ -21,8 +21,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class RuptelaProtocol extends BaseProtocol { public RuptelaProtocol() { @@ -34,11 +32,7 @@ public class RuptelaProtocol extends BaseProtocol { Command.TYPE_OUTPUT_CONTROL, Command.TYPE_SET_CONNECTION, Command.TYPE_SET_ODOMETER); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 0, 2, 2, 0)); diff --git a/src/org/traccar/protocol/SabertekProtocol.java b/src/org/traccar/protocol/SabertekProtocol.java index 9d100b5f2..0ec847b60 100644 --- a/src/org/traccar/protocol/SabertekProtocol.java +++ b/src/org/traccar/protocol/SabertekProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SabertekProtocol extends BaseProtocol { public SabertekProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new SabertekFrameDecoder()); diff --git a/src/org/traccar/protocol/SanavProtocol.java b/src/org/traccar/protocol/SanavProtocol.java index 7ab2a9284..6799c57e6 100644 --- a/src/org/traccar/protocol/SanavProtocol.java +++ b/src/org/traccar/protocol/SanavProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SanavProtocol extends BaseProtocol { public SanavProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); @@ -38,7 +32,7 @@ public class SanavProtocol extends BaseProtocol { pipeline.addLast(new SanavProtocolDecoder(SanavProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/SigfoxProtocol.java b/src/org/traccar/protocol/SigfoxProtocol.java index a6c4fc45f..e2f2cbe1f 100644 --- a/src/org/traccar/protocol/SigfoxProtocol.java +++ b/src/org/traccar/protocol/SigfoxProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SigfoxProtocol extends BaseProtocol { public SigfoxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/SiwiProtocol.java b/src/org/traccar/protocol/SiwiProtocol.java index 4a0eb1fae..8963721c8 100644 --- a/src/org/traccar/protocol/SiwiProtocol.java +++ b/src/org/traccar/protocol/SiwiProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SiwiProtocol extends BaseProtocol { public SiwiProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/SkypatrolProtocol.java b/src/org/traccar/protocol/SkypatrolProtocol.java index 689477a6c..7c6203d86 100644 --- a/src/org/traccar/protocol/SkypatrolProtocol.java +++ b/src/org/traccar/protocol/SkypatrolProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SkypatrolProtocol extends BaseProtocol { public SkypatrolProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new SkypatrolProtocolDecoder(SkypatrolProtocol.this)); diff --git a/src/org/traccar/protocol/SmartSoleProtocol.java b/src/org/traccar/protocol/SmartSoleProtocol.java index 911eca0bf..bcf43f68b 100644 --- a/src/org/traccar/protocol/SmartSoleProtocol.java +++ b/src/org/traccar/protocol/SmartSoleProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SmartSoleProtocol extends BaseProtocol { public SmartSoleProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '$')); diff --git a/src/org/traccar/protocol/SmokeyProtocol.java b/src/org/traccar/protocol/SmokeyProtocol.java index cd2bdec4e..482c8347c 100644 --- a/src/org/traccar/protocol/SmokeyProtocol.java +++ b/src/org/traccar/protocol/SmokeyProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SmokeyProtocol extends BaseProtocol { public SmokeyProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new SmokeyProtocolDecoder(SmokeyProtocol.this)); diff --git a/src/org/traccar/protocol/SpotProtocol.java b/src/org/traccar/protocol/SpotProtocol.java index 6dbccd944..bbf0e8d8a 100644 --- a/src/org/traccar/protocol/SpotProtocol.java +++ b/src/org/traccar/protocol/SpotProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SpotProtocol extends BaseProtocol { public SpotProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new HttpResponseEncoder()); diff --git a/src/org/traccar/protocol/StarLinkProtocol.java b/src/org/traccar/protocol/StarLinkProtocol.java index 30a9f322f..5630722ee 100644 --- a/src/org/traccar/protocol/StarLinkProtocol.java +++ b/src/org/traccar/protocol/StarLinkProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class StarLinkProtocol extends BaseProtocol { public StarLinkProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/Stl060Protocol.java b/src/org/traccar/protocol/Stl060Protocol.java index 95f4ac5a1..2711e936b 100644 --- a/src/org/traccar/protocol/Stl060Protocol.java +++ b/src/org/traccar/protocol/Stl060Protocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Stl060Protocol extends BaseProtocol { public Stl060Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Stl060FrameDecoder(1024)); diff --git a/src/org/traccar/protocol/SuntechProtocol.java b/src/org/traccar/protocol/SuntechProtocol.java index f3737ddff..29ae114e7 100644 --- a/src/org/traccar/protocol/SuntechProtocol.java +++ b/src/org/traccar/protocol/SuntechProtocol.java @@ -23,8 +23,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class SuntechProtocol extends BaseProtocol { public SuntechProtocol() { @@ -36,11 +34,7 @@ public class SuntechProtocol extends BaseProtocol { Command.TYPE_ENGINE_RESUME, Command.TYPE_ALARM_ARM, Command.TYPE_ALARM_DISARM); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\r')); diff --git a/src/org/traccar/protocol/SupermateProtocol.java b/src/org/traccar/protocol/SupermateProtocol.java index 3d7230427..46625ddc7 100644 --- a/src/org/traccar/protocol/SupermateProtocol.java +++ b/src/org/traccar/protocol/SupermateProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class SupermateProtocol extends BaseProtocol { public SupermateProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "#")); diff --git a/src/org/traccar/protocol/SviasProtocol.java b/src/org/traccar/protocol/SviasProtocol.java index 073462a4d..c6624b7d4 100644 --- a/src/org/traccar/protocol/SviasProtocol.java +++ b/src/org/traccar/protocol/SviasProtocol.java @@ -22,7 +22,6 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; import org.traccar.model.Command; public class SviasProtocol extends BaseProtocol { @@ -37,11 +36,7 @@ public class SviasProtocol extends BaseProtocol { Command.TYPE_ALARM_ARM, Command.TYPE_ALARM_DISARM, Command.TYPE_ALARM_REMOVE); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "]")); diff --git a/src/org/traccar/protocol/T55Protocol.java b/src/org/traccar/protocol/T55Protocol.java index d0028408e..f5ec19094 100644 --- a/src/org/traccar/protocol/T55Protocol.java +++ b/src/org/traccar/protocol/T55Protocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class T55Protocol extends BaseProtocol { public T55Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); @@ -40,7 +34,7 @@ public class T55Protocol extends BaseProtocol { pipeline.addLast(new T55ProtocolDecoder(T55Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/T57Protocol.java b/src/org/traccar/protocol/T57Protocol.java index 41e717af8..f67f82318 100644 --- a/src/org/traccar/protocol/T57Protocol.java +++ b/src/org/traccar/protocol/T57Protocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class T57Protocol extends BaseProtocol { public T57Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new T57FrameDecoder()); diff --git a/src/org/traccar/protocol/T800xProtocol.java b/src/org/traccar/protocol/T800xProtocol.java index b27ffbcb7..85749d0cf 100644 --- a/src/org/traccar/protocol/T800xProtocol.java +++ b/src/org/traccar/protocol/T800xProtocol.java @@ -21,18 +21,12 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class T800xProtocol extends BaseProtocol { public T800xProtocol() { setSupportedDataCommands( Command.TYPE_CUSTOM); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 3, 2, -5, 0)); diff --git a/src/org/traccar/protocol/TaipProtocol.java b/src/org/traccar/protocol/TaipProtocol.java index 62b7b17f3..b8f40a183 100644 --- a/src/org/traccar/protocol/TaipProtocol.java +++ b/src/org/traccar/protocol/TaipProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TaipProtocol extends BaseProtocol { public TaipProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '<')); @@ -40,7 +34,7 @@ public class TaipProtocol extends BaseProtocol { pipeline.addLast(new TaipProtocolDecoder(TaipProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/TekProtocol.java b/src/org/traccar/protocol/TekProtocol.java index 2c0a59909..c1d78e6f5 100644 --- a/src/org/traccar/protocol/TekProtocol.java +++ b/src/org/traccar/protocol/TekProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TekProtocol extends BaseProtocol { public TekProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TekFrameDecoder()); diff --git a/src/org/traccar/protocol/TelemaxProtocol.java b/src/org/traccar/protocol/TelemaxProtocol.java index 9222755ea..838da9df1 100644 --- a/src/org/traccar/protocol/TelemaxProtocol.java +++ b/src/org/traccar/protocol/TelemaxProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TelemaxProtocol extends BaseProtocol { public TelemaxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/TelicProtocol.java b/src/org/traccar/protocol/TelicProtocol.java index 694cb4e99..991befa19 100644 --- a/src/org/traccar/protocol/TelicProtocol.java +++ b/src/org/traccar/protocol/TelicProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TelicProtocol extends BaseProtocol { public TelicProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TelicFrameDecoder()); diff --git a/src/org/traccar/protocol/TeltonikaProtocol.java b/src/org/traccar/protocol/TeltonikaProtocol.java index 33d26be45..eef9662d7 100644 --- a/src/org/traccar/protocol/TeltonikaProtocol.java +++ b/src/org/traccar/protocol/TeltonikaProtocol.java @@ -20,18 +20,12 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class TeltonikaProtocol extends BaseProtocol { public TeltonikaProtocol() { setSupportedDataCommands( Command.TYPE_CUSTOM); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TeltonikaFrameDecoder()); @@ -39,7 +33,7 @@ public class TeltonikaProtocol extends BaseProtocol { pipeline.addLast(new TeltonikaProtocolDecoder(TeltonikaProtocol.this, false)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TeltonikaProtocolEncoder()); diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java index 6eac52585..5c3af026c 100644 --- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -23,6 +23,7 @@ import org.traccar.BaseProtocolDecoder; import org.traccar.Context; import org.traccar.DeviceSession; import org.traccar.NetworkMessage; +import org.traccar.Protocol; import org.traccar.helper.BitUtil; import org.traccar.helper.UnitsConverter; import org.traccar.model.CellTower; @@ -44,7 +45,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { this.extended = extended; } - public TeltonikaProtocolDecoder(TeltonikaProtocol protocol, boolean connectionless) { + public TeltonikaProtocolDecoder(Protocol protocol, boolean connectionless) { super(protocol); this.connectionless = connectionless; this.extended = Context.getConfig().getBoolean(getProtocolName() + ".extended"); diff --git a/src/org/traccar/protocol/ThinkRaceProtocol.java b/src/org/traccar/protocol/ThinkRaceProtocol.java index af3e2a940..ca1237cef 100644 --- a/src/org/traccar/protocol/ThinkRaceProtocol.java +++ b/src/org/traccar/protocol/ThinkRaceProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class ThinkRaceProtocol extends BaseProtocol { public ThinkRaceProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 2 + 12 + 1 + 1, 2, 2, 0)); diff --git a/src/org/traccar/protocol/Tk102Protocol.java b/src/org/traccar/protocol/Tk102Protocol.java index 782d55346..9f2463cd6 100644 --- a/src/org/traccar/protocol/Tk102Protocol.java +++ b/src/org/traccar/protocol/Tk102Protocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Tk102Protocol extends BaseProtocol { public Tk102Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 1 + 1 + 10, 1, 1, 0)); diff --git a/src/org/traccar/protocol/Tk103Protocol.java b/src/org/traccar/protocol/Tk103Protocol.java index 51cbd16b1..66136cf6f 100644 --- a/src/org/traccar/protocol/Tk103Protocol.java +++ b/src/org/traccar/protocol/Tk103Protocol.java @@ -23,8 +23,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class Tk103Protocol extends BaseProtocol { public Tk103Protocol() { @@ -46,11 +44,7 @@ public class Tk103Protocol extends BaseProtocol { Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME, Command.TYPE_OUTPUT_CONTROL); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Tk103FrameDecoder()); @@ -60,7 +54,7 @@ public class Tk103Protocol extends BaseProtocol { pipeline.addLast(new Tk103ProtocolDecoder(Tk103Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/Tlt2hProtocol.java b/src/org/traccar/protocol/Tlt2hProtocol.java index 7ceec9e2f..12fd92afa 100644 --- a/src/org/traccar/protocol/Tlt2hProtocol.java +++ b/src/org/traccar/protocol/Tlt2hProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Tlt2hProtocol extends BaseProtocol { public Tlt2hProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(32 * 1024, "##\r\n")); diff --git a/src/org/traccar/protocol/TlvProtocol.java b/src/org/traccar/protocol/TlvProtocol.java index 68793d694..94f5da94f 100644 --- a/src/org/traccar/protocol/TlvProtocol.java +++ b/src/org/traccar/protocol/TlvProtocol.java @@ -20,16 +20,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TlvProtocol extends BaseProtocol { public TlvProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '\0')); diff --git a/src/org/traccar/protocol/TmgProtocol.java b/src/org/traccar/protocol/TmgProtocol.java index b3388b027..020332ce7 100644 --- a/src/org/traccar/protocol/TmgProtocol.java +++ b/src/org/traccar/protocol/TmgProtocol.java @@ -21,16 +21,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TmgProtocol extends BaseProtocol { public TmgProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TmgFrameDecoder()); diff --git a/src/org/traccar/protocol/TopflytechProtocol.java b/src/org/traccar/protocol/TopflytechProtocol.java index 1b233b4ad..303072bdb 100644 --- a/src/org/traccar/protocol/TopflytechProtocol.java +++ b/src/org/traccar/protocol/TopflytechProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TopflytechProtocol extends BaseProtocol { public TopflytechProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, ')')); diff --git a/src/org/traccar/protocol/TotemProtocol.java b/src/org/traccar/protocol/TotemProtocol.java index a32471d40..66e1ec4f1 100644 --- a/src/org/traccar/protocol/TotemProtocol.java +++ b/src/org/traccar/protocol/TotemProtocol.java @@ -22,8 +22,6 @@ import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; import org.traccar.model.Command; -import java.util.List; - public class TotemProtocol extends BaseProtocol { public TotemProtocol() { @@ -31,11 +29,7 @@ public class TotemProtocol extends BaseProtocol { Command.TYPE_ENGINE_RESUME, Command.TYPE_ENGINE_STOP ); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TotemFrameDecoder()); diff --git a/src/org/traccar/protocol/Tr20Protocol.java b/src/org/traccar/protocol/Tr20Protocol.java index 2390ce5b1..3eee9d9c3 100644 --- a/src/org/traccar/protocol/Tr20Protocol.java +++ b/src/org/traccar/protocol/Tr20Protocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Tr20Protocol extends BaseProtocol { public Tr20Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/Tr900Protocol.java b/src/org/traccar/protocol/Tr900Protocol.java index 41af70f8b..b70521b35 100644 --- a/src/org/traccar/protocol/Tr900Protocol.java +++ b/src/org/traccar/protocol/Tr900Protocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Tr900Protocol extends BaseProtocol { public Tr900Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); @@ -40,7 +34,7 @@ public class Tr900Protocol extends BaseProtocol { pipeline.addLast(new Tr900ProtocolDecoder(Tr900Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/TrackboxProtocol.java b/src/org/traccar/protocol/TrackboxProtocol.java index d364fb4ff..5da5abd64 100644 --- a/src/org/traccar/protocol/TrackboxProtocol.java +++ b/src/org/traccar/protocol/TrackboxProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TrackboxProtocol extends BaseProtocol { public TrackboxProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/TrakMateProtocol.java b/src/org/traccar/protocol/TrakMateProtocol.java index e6f80d974..bda5df10f 100644 --- a/src/org/traccar/protocol/TrakMateProtocol.java +++ b/src/org/traccar/protocol/TrakMateProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TrakMateProtocol extends BaseProtocol { public TrakMateProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '#')); diff --git a/src/org/traccar/protocol/TramigoProtocol.java b/src/org/traccar/protocol/TramigoProtocol.java index 0dde2c08b..f683ccc5d 100644 --- a/src/org/traccar/protocol/TramigoProtocol.java +++ b/src/org/traccar/protocol/TramigoProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TramigoProtocol extends BaseProtocol { public TramigoProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TramigoFrameDecoder()); diff --git a/src/org/traccar/protocol/TrvProtocol.java b/src/org/traccar/protocol/TrvProtocol.java index ba0e3f7db..99a164cf1 100644 --- a/src/org/traccar/protocol/TrvProtocol.java +++ b/src/org/traccar/protocol/TrvProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TrvProtocol extends BaseProtocol { public TrvProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '#')); diff --git a/src/org/traccar/protocol/Tt8850Protocol.java b/src/org/traccar/protocol/Tt8850Protocol.java index 14f617406..66a13da9e 100644 --- a/src/org/traccar/protocol/Tt8850Protocol.java +++ b/src/org/traccar/protocol/Tt8850Protocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Tt8850Protocol extends BaseProtocol { public Tt8850Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "$")); diff --git a/src/org/traccar/protocol/TytanProtocol.java b/src/org/traccar/protocol/TytanProtocol.java index 13eed8e0f..32e9acae1 100644 --- a/src/org/traccar/protocol/TytanProtocol.java +++ b/src/org/traccar/protocol/TytanProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class TytanProtocol extends BaseProtocol { public TytanProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new TytanProtocolDecoder(TytanProtocol.this)); diff --git a/src/org/traccar/protocol/TzoneProtocol.java b/src/org/traccar/protocol/TzoneProtocol.java index 0dfb6c2f5..6e855d138 100644 --- a/src/org/traccar/protocol/TzoneProtocol.java +++ b/src/org/traccar/protocol/TzoneProtocol.java @@ -21,16 +21,10 @@ import org.traccar.TrackerServer; import io.netty.handler.codec.LengthFieldBasedFrameDecoder; -import java.util.List; - public class TzoneProtocol extends BaseProtocol { public TzoneProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(256, 2, 2, 2, 0)); diff --git a/src/org/traccar/protocol/UlbotechProtocol.java b/src/org/traccar/protocol/UlbotechProtocol.java index d24e09f7e..b99ec1cc6 100644 --- a/src/org/traccar/protocol/UlbotechProtocol.java +++ b/src/org/traccar/protocol/UlbotechProtocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class UlbotechProtocol extends BaseProtocol { public UlbotechProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new UlbotechFrameDecoder()); diff --git a/src/org/traccar/protocol/UproProtocol.java b/src/org/traccar/protocol/UproProtocol.java index 53446df6d..4e60ffeb6 100644 --- a/src/org/traccar/protocol/UproProtocol.java +++ b/src/org/traccar/protocol/UproProtocol.java @@ -21,16 +21,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class UproProtocol extends BaseProtocol { public UproProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '#')); diff --git a/src/org/traccar/protocol/V680Protocol.java b/src/org/traccar/protocol/V680Protocol.java index 63b084868..dc0922cd4 100644 --- a/src/org/traccar/protocol/V680Protocol.java +++ b/src/org/traccar/protocol/V680Protocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class V680Protocol extends BaseProtocol { public V680Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "##")); @@ -40,7 +34,7 @@ public class V680Protocol extends BaseProtocol { pipeline.addLast(new V680ProtocolDecoder(V680Protocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/VisiontekProtocol.java b/src/org/traccar/protocol/VisiontekProtocol.java index 9ae328bc3..2c6af45a8 100644 --- a/src/org/traccar/protocol/VisiontekProtocol.java +++ b/src/org/traccar/protocol/VisiontekProtocol.java @@ -22,16 +22,10 @@ import org.traccar.CharacterDelimiterFrameDecoder; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class VisiontekProtocol extends BaseProtocol { public VisiontekProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, '#')); diff --git a/src/org/traccar/protocol/Vt200Protocol.java b/src/org/traccar/protocol/Vt200Protocol.java index eafc3d096..2a9ef6ab5 100644 --- a/src/org/traccar/protocol/Vt200Protocol.java +++ b/src/org/traccar/protocol/Vt200Protocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Vt200Protocol extends BaseProtocol { public Vt200Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Vt200FrameDecoder()); diff --git a/src/org/traccar/protocol/VtfmsProtocol.java b/src/org/traccar/protocol/VtfmsProtocol.java index 8247a9ea3..2826a86e6 100644 --- a/src/org/traccar/protocol/VtfmsProtocol.java +++ b/src/org/traccar/protocol/VtfmsProtocol.java @@ -21,16 +21,10 @@ import org.traccar.TrackerServer; import io.netty.handler.codec.string.StringDecoder; -import java.util.List; - public class VtfmsProtocol extends BaseProtocol { public VtfmsProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new VtfmsFrameDecoder()); @@ -38,7 +32,7 @@ public class VtfmsProtocol extends BaseProtocol { pipeline.addLast(new VtfmsProtocolDecoder(VtfmsProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringDecoder()); diff --git a/src/org/traccar/protocol/WatchProtocol.java b/src/org/traccar/protocol/WatchProtocol.java index 1c4b0fb8e..926d2826d 100644 --- a/src/org/traccar/protocol/WatchProtocol.java +++ b/src/org/traccar/protocol/WatchProtocol.java @@ -22,8 +22,6 @@ import org.traccar.model.Command; import io.netty.handler.codec.string.StringEncoder; -import java.util.List; - public class WatchProtocol extends BaseProtocol { public WatchProtocol() { @@ -42,11 +40,7 @@ public class WatchProtocol extends BaseProtocol { Command.TYPE_VOICE_MESSAGE, Command.TYPE_SET_TIMEZONE, Command.TYPE_SET_INDICATOR); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new WatchFrameDecoder()); diff --git a/src/org/traccar/protocol/WialonProtocol.java b/src/org/traccar/protocol/WialonProtocol.java index ea6cfb33b..06b54dceb 100644 --- a/src/org/traccar/protocol/WialonProtocol.java +++ b/src/org/traccar/protocol/WialonProtocol.java @@ -26,8 +26,6 @@ import io.netty.handler.codec.string.StringDecoder; import io.netty.handler.codec.string.StringEncoder; import java.nio.charset.StandardCharsets; -import java.util.List; - public class WialonProtocol extends BaseProtocol { public WialonProtocol() { @@ -36,11 +34,7 @@ public class WialonProtocol extends BaseProtocol { Command.TYPE_SEND_USSD, Command.TYPE_IDENTIFICATION, Command.TYPE_OUTPUT_CONTROL); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(4 * 1024)); diff --git a/src/org/traccar/protocol/WondexProtocol.java b/src/org/traccar/protocol/WondexProtocol.java index 93be45a04..8c6283d66 100644 --- a/src/org/traccar/protocol/WondexProtocol.java +++ b/src/org/traccar/protocol/WondexProtocol.java @@ -22,8 +22,6 @@ import org.traccar.model.Command; import io.netty.handler.codec.string.StringEncoder; -import java.util.List; - public class WondexProtocol extends BaseProtocol { public WondexProtocol() { @@ -35,11 +33,7 @@ public class WondexProtocol extends BaseProtocol { Command.TYPE_POSITION_SINGLE, Command.TYPE_GET_VERSION, Command.TYPE_IDENTIFICATION); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new WondexFrameDecoder()); @@ -48,7 +42,7 @@ public class WondexProtocol extends BaseProtocol { pipeline.addLast(new WondexProtocolDecoder(WondexProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/WristbandProtocol.java b/src/org/traccar/protocol/WristbandProtocol.java index f5421105d..1e5ef2c01 100644 --- a/src/org/traccar/protocol/WristbandProtocol.java +++ b/src/org/traccar/protocol/WristbandProtocol.java @@ -20,16 +20,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class WristbandProtocol extends BaseProtocol { public WristbandProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LengthFieldBasedFrameDecoder(1024, 3, 2, 3, 0)); diff --git a/src/org/traccar/protocol/XexunProtocol.java b/src/org/traccar/protocol/XexunProtocol.java index 47a7881a9..0005270fb 100644 --- a/src/org/traccar/protocol/XexunProtocol.java +++ b/src/org/traccar/protocol/XexunProtocol.java @@ -25,19 +25,13 @@ import io.netty.handler.codec.LineBasedFrameDecoder; import io.netty.handler.codec.string.StringDecoder; import io.netty.handler.codec.string.StringEncoder; -import java.util.List; - public class XexunProtocol extends BaseProtocol { public XexunProtocol() { setSupportedDataCommands( Command.TYPE_ENGINE_STOP, Command.TYPE_ENGINE_RESUME); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { boolean full = Context.getConfig().getBoolean(getName() + ".extended"); diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java index 42699c272..5e2d0c05e 100644 --- a/src/org/traccar/protocol/XexunProtocolDecoder.java +++ b/src/org/traccar/protocol/XexunProtocolDecoder.java @@ -18,6 +18,7 @@ package org.traccar.protocol; import io.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; +import org.traccar.Protocol; import org.traccar.helper.DateBuilder; import org.traccar.helper.Parser; import org.traccar.helper.PatternBuilder; @@ -30,7 +31,7 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder { private final boolean full; - public XexunProtocolDecoder(XexunProtocol protocol, boolean full) { + public XexunProtocolDecoder(Protocol protocol, boolean full) { super(protocol); this.full = full; } diff --git a/src/org/traccar/protocol/XirgoProtocol.java b/src/org/traccar/protocol/XirgoProtocol.java index 0ba2d51fc..4979fda5d 100644 --- a/src/org/traccar/protocol/XirgoProtocol.java +++ b/src/org/traccar/protocol/XirgoProtocol.java @@ -24,18 +24,12 @@ import org.traccar.model.Command; import io.netty.handler.codec.string.StringDecoder; import io.netty.handler.codec.string.StringEncoder; -import java.util.List; - public class XirgoProtocol extends BaseProtocol { public XirgoProtocol() { setSupportedDataCommands( Command.TYPE_OUTPUT_CONTROL); - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new CharacterDelimiterFrameDecoder(1024, "##")); @@ -45,7 +39,7 @@ public class XirgoProtocol extends BaseProtocol { pipeline.addLast(new XirgoProtocolDecoder(XirgoProtocol.this)); } }); - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new StringEncoder()); diff --git a/src/org/traccar/protocol/Xt013Protocol.java b/src/org/traccar/protocol/Xt013Protocol.java index 27fbee298..ebb3c123f 100644 --- a/src/org/traccar/protocol/Xt013Protocol.java +++ b/src/org/traccar/protocol/Xt013Protocol.java @@ -23,16 +23,10 @@ import io.netty.handler.codec.LineBasedFrameDecoder; import io.netty.handler.codec.string.StringDecoder; import io.netty.handler.codec.string.StringEncoder; -import java.util.List; - public class Xt013Protocol extends BaseProtocol { public Xt013Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/src/org/traccar/protocol/Xt2400Protocol.java b/src/org/traccar/protocol/Xt2400Protocol.java index 071059795..9427876c8 100644 --- a/src/org/traccar/protocol/Xt2400Protocol.java +++ b/src/org/traccar/protocol/Xt2400Protocol.java @@ -19,16 +19,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class Xt2400Protocol extends BaseProtocol { public Xt2400Protocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(true, getName()) { + addServer(new TrackerServer(true, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new Xt2400ProtocolDecoder(Xt2400Protocol.this)); diff --git a/src/org/traccar/protocol/YwtProtocol.java b/src/org/traccar/protocol/YwtProtocol.java index 84b6c9a16..c525b75cf 100644 --- a/src/org/traccar/protocol/YwtProtocol.java +++ b/src/org/traccar/protocol/YwtProtocol.java @@ -22,16 +22,10 @@ import org.traccar.BaseProtocol; import org.traccar.PipelineBuilder; import org.traccar.TrackerServer; -import java.util.List; - public class YwtProtocol extends BaseProtocol { public YwtProtocol() { - } - - @Override - public void initTrackerServers(List serverList) { - serverList.add(new TrackerServer(false, getName()) { + addServer(new TrackerServer(false, getName()) { @Override protected void addProtocolHandlers(PipelineBuilder pipeline) { pipeline.addLast(new LineBasedFrameDecoder(1024)); diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index 12eb57f35..802cae877 100644 --- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -9,7 +9,7 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest { @Test public void testDecode() throws Exception { - TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(new TeltonikaProtocol(), false); + TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(null, false); verifyNull(decoder, binary( "000F313233343536373839303132333435")); @@ -97,7 +97,7 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest { @Test public void testDecodeConnectionless() throws Exception { - TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(new TeltonikaProtocol(), true); + TeltonikaProtocolDecoder decoder = new TeltonikaProtocolDecoder(null, true); verifyPositions(decoder, false, binary( "0049cafe0122000f33353734353430373237313339373508010000015d3766f6a800003eef961ec6215e0063006d09003100070401000200f001c8000242381c18003201c7000000e10001")); diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java index 8587ee295..8b0f245a2 100644 --- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java +++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java @@ -8,7 +8,7 @@ public class XexunProtocolDecoderTest extends ProtocolTest { @Test public void testDecode() throws Exception { - XexunProtocolDecoder decoder = new XexunProtocolDecoder(new XexunProtocol(), false); + XexunProtocolDecoder decoder = new XexunProtocolDecoder(null, false); verifyAttributes(decoder, text( "GPRMC,.000,A,0.000000,S,0.0000,W,0.00,0.00,,00,0000.0,A*55,L,,imei:353579010727036,")); @@ -53,7 +53,7 @@ public class XexunProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, text( "GPRMC,043435.000,A,811.299200,S,11339.9500,E,0.93,29.52,160313,00,0000.0,A*65,F,,imei:359585014597923,")); - decoder = new XexunProtocolDecoder(new XexunProtocol(), true); + decoder = new XexunProtocolDecoder(null, true); verifyPosition(decoder, text( "171007160505,,GPRMC,160505.000,A,5323.4680,N,00252.4202,W,000.0,129.7,071017,,,A*7A,F,ACCStart, imei:864504031916915,10,41.1,F:4.28V,1,135,19824,234,15,0062,B7D5")); -- cgit v1.2.3