aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/DataManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-29 10:49:13 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-29 10:49:13 +1200
commit55448d82b2971bc16c67bfa2b2e996d81c4c702e (patch)
tree565ee245ea0e98b88674b775147fbc6d3e1933cb /src/org/traccar/database/DataManager.java
parent88b3f00f3855aa408c7859051efdcb5b37fe559f (diff)
parentd1c4cd526845aad56c5b0a3e20454638bbc7fecc (diff)
downloadtrackermap-server-55448d82b2971bc16c67bfa2b2e996d81c4c702e.tar.gz
trackermap-server-55448d82b2971bc16c67bfa2b2e996d81c4c702e.tar.bz2
trackermap-server-55448d82b2971bc16c67bfa2b2e996d81c4c702e.zip
Merge branch implement commands (fix #1271)
Diffstat (limited to 'src/org/traccar/database/DataManager.java')
-rw-r--r--src/org/traccar/database/DataManager.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java
index 496a5a1b6..62275af3c 100644
--- a/src/org/traccar/database/DataManager.java
+++ b/src/org/traccar/database/DataManager.java
@@ -17,6 +17,7 @@ package org.traccar.database;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import java.io.File;
+import java.net.SocketAddress;
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Connection;
@@ -32,7 +33,10 @@ import java.util.Map;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.sql.DataSource;
+
+import org.jboss.netty.channel.Channel;
import org.traccar.Context;
+import org.traccar.Protocol;
import org.traccar.helper.DriverDelegate;
import org.traccar.helper.Log;
import org.traccar.http.AsyncServlet;
@@ -52,6 +56,7 @@ public class DataManager {
private DataSource dataSource;
private final Map<String, Device> devices = new HashMap<String, Device>();
+ private Map<String, ActiveDevice> activeDevices = new HashMap<String, ActiveDevice>();
private long devicesLastUpdate;
private long devicesRefreshDelay;
@@ -74,6 +79,14 @@ public class DataManager {
return dataSource;
}
+ public void setActiveDevice(String uniqueId, Protocol protocol, Channel channel, SocketAddress remoteAddress) {
+ this.activeDevices.put(uniqueId, new ActiveDevice(uniqueId, protocol, channel, remoteAddress));
+ }
+
+ public ActiveDevice getActiveDevice(String uniqueId) {
+ return this.activeDevices.get(uniqueId);
+ }
+
private void initDatabase(Properties properties) throws Exception {
String jndiName = properties.getProperty("database.jndi");