aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/ServerManager.java103
1 files changed, 16 insertions, 87 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 1e4714c65..d0ff203fc 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -15,13 +15,14 @@
*/
package org.traccar;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
-import org.traccar.protocol.*;
public class ServerManager {
@@ -29,92 +30,20 @@ public class ServerManager {
public void init() throws Exception {
- initProtocolServer(new Gps103Protocol());
- initProtocolServer(new Tk103Protocol());
- initProtocolServer(new Gl100Protocol());
- initProtocolServer(new Gl200Protocol());
- initProtocolServer(new T55Protocol());
- initProtocolServer(new XexunProtocol());
- initProtocolServer(new TotemProtocol());
- initProtocolServer(new EnforaProtocol());
- initProtocolServer(new MeiligaoProtocol());
- initProtocolServer(new MaxonProtocol());
- initProtocolServer(new SuntechProtocol());
- initProtocolServer(new ProgressProtocol());
- initProtocolServer(new H02Protocol());
- initProtocolServer(new Jt600Protocol());
- initProtocolServer(new Ev603Protocol());
- initProtocolServer(new V680Protocol());
- initProtocolServer(new Pt502Protocol());
- initProtocolServer(new Tr20Protocol());
- initProtocolServer(new NavisProtocol());
- initProtocolServer(new MeitrackProtocol());
- initProtocolServer(new SkypatrolProtocol());
- initProtocolServer(new Gt02Protocol());
- initProtocolServer(new Gt06Protocol());
- initProtocolServer(new MegastekProtocol());
- initProtocolServer(new NavigilProtocol());
- initProtocolServer(new GpsGateProtocol());
- initProtocolServer(new TeltonikaProtocol());
- initProtocolServer(new Mta6Protocol());
- initProtocolServer(new Tlt2hProtocol());
- initProtocolServer(new SyrusProtocol());
- initProtocolServer(new WondexProtocol());
- initProtocolServer(new CellocatorProtocol());
- initProtocolServer(new GalileoProtocol());
- initProtocolServer(new YwtProtocol());
- initProtocolServer(new Tk102Protocol());
- initProtocolServer(new IntellitracProtocol());
- initProtocolServer(new Xt7Protocol());
- initProtocolServer(new WialonProtocol());
- initProtocolServer(new CarscopProtocol());
- initProtocolServer(new ApelProtocol());
- initProtocolServer(new ManPowerProtocol());
- initProtocolServer(new GlobalSatProtocol());
- initProtocolServer(new AtrackProtocol());
- initProtocolServer(new Pt3000Protocol());
- initProtocolServer(new RuptelaProtocol());
- initProtocolServer(new TopflytechProtocol());
- initProtocolServer(new LaipacProtocol());
- initProtocolServer(new AplicomProtocol());
- initProtocolServer(new GotopProtocol());
- initProtocolServer(new SanavProtocol());
- initProtocolServer(new GatorProtocol());
- initProtocolServer(new NoranProtocol());
- initProtocolServer(new M2mProtocol());
- initProtocolServer(new OsmAndProtocol());
- initProtocolServer(new EasyTrackProtocol());
- initProtocolServer(new TaipProtocol());
- initProtocolServer(new KhdProtocol());
- initProtocolServer(new PiligrimProtocol());
- initProtocolServer(new Stl060Protocol());
- initProtocolServer(new CarTrackProtocol());
- initProtocolServer(new MiniFinderProtocol());
- initProtocolServer(new HaicomProtocol());
- initProtocolServer(new EelinkProtocol());
- initProtocolServer(new BoxProtocol());
- initProtocolServer(new FreedomProtocol());
- initProtocolServer(new TelikProtocol());
- initProtocolServer(new TrackboxProtocol());
- initProtocolServer(new VisiontekProtocol());
- initProtocolServer(new OrionProtocol());
- initProtocolServer(new RitiProtocol());
- initProtocolServer(new UlbotechProtocol());
- initProtocolServer(new TramigoProtocol());
- initProtocolServer(new Tr900Protocol());
- initProtocolServer(new Ardi01Protocol());
- initProtocolServer(new Xt013Protocol());
- initProtocolServer(new AutoFonProtocol());
- initProtocolServer(new GoSafeProtocol());
- initProtocolServer(new AutoFon45Protocol());
- initProtocolServer(new BceProtocol());
- initProtocolServer(new XirgoProtocol());
- initProtocolServer(new CalAmpProtocol());
- initProtocolServer(new MtxProtocol());
- initProtocolServer(new TytanProtocol());
- initProtocolServer(new Avl301Protocol());
- initProtocolServer(new CastelProtocol());
- initProtocolServer(new MxtProtocol());
+ ClassLoader cl = ServerManager.class.getClassLoader();
+ String pack = "org/traccar/protocol";
+ String dottedPackage = pack.replaceAll("[/]", ".");
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(cl.getResourceAsStream(pack)));
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ if (line.endsWith(".class")) {
+ Class protocolClass = Class.forName(dottedPackage + "." + line.substring(0, line.lastIndexOf('.')));
+ if (BaseProtocol.class.isAssignableFrom(protocolClass)) {
+ initProtocolServer((BaseProtocol) protocolClass.newInstance());
+ }
+ }
+ }
initProtocolDetector();
}