aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Server.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-09 11:41:38 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-09 11:41:38 +1300
commitd0b8756a27562917323fcf7f4476629752814e70 (patch)
tree191f7637702801e01c2254b4a1329e569b0c3126 /src/org/traccar/Server.java
parentd6a470c9bbc4cc6fea8d7b20ff34fbcb463fa2a5 (diff)
downloadtrackermap-server-d0b8756a27562917323fcf7f4476629752814e70.tar.gz
trackermap-server-d0b8756a27562917323fcf7f4476629752814e70.tar.bz2
trackermap-server-d0b8756a27562917323fcf7f4476629752814e70.zip
Option to set protocol interface (fix #91)
Diffstat (limited to 'src/org/traccar/Server.java')
-rw-r--r--src/org/traccar/Server.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java
index 288719834..e4541aa43 100644
--- a/src/org/traccar/Server.java
+++ b/src/org/traccar/Server.java
@@ -217,6 +217,10 @@ public class Server {
return false;
}
+ private String getProtocolInterface(Properties properties, String protocol) {
+ return properties.getProperty(protocol + ".address");
+ }
+
private Integer getProtocolPort(Properties properties, String protocol) {
String port = properties.getProperty(protocol + ".port");
if (port != null) {
@@ -242,6 +246,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -265,6 +270,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -291,6 +297,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -317,6 +324,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -343,6 +351,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -369,6 +378,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -395,6 +405,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -420,6 +431,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -445,6 +457,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -467,6 +480,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -485,6 +499,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -507,6 +522,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -528,6 +544,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
@@ -551,6 +568,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -576,6 +594,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -598,6 +617,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -623,6 +643,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -648,6 +669,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -674,6 +696,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {
@@ -700,6 +723,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
@@ -723,6 +747,7 @@ public class Server {
if (isProtocolEnabled(properties, protocol)) {
TrackerServer server = new TrackerServer(getProtocolPort(properties, protocol));
+ server.setAddress(getProtocolInterface(properties, protocol));
final Integer resetDelay = getProtocolResetDelay(properties, protocol);
server.setPipelineFactory(new GenericPipelineFactory(server, dataManager, isLoggerEnabled(), resetDelay, geocoder) {