aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/ServerManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-09 17:56:37 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-09 17:56:37 -0700
commitadafc5f6130854dd88c191dd04489073419ee41d (patch)
treee101d03069894f9a2fbfd388d9b3f93424cbe4d0 /src/main/java/org/traccar/ServerManager.java
parent29b5d05cfd66a9f51b7ce272c1fb07077bc715b2 (diff)
downloadtrackermap-server-adafc5f6130854dd88c191dd04489073419ee41d.tar.gz
trackermap-server-adafc5f6130854dd88c191dd04489073419ee41d.tar.bz2
trackermap-server-adafc5f6130854dd88c191dd04489073419ee41d.zip
Remove SMS from context
Diffstat (limited to 'src/main/java/org/traccar/ServerManager.java')
-rw-r--r--src/main/java/org/traccar/ServerManager.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/ServerManager.java b/src/main/java/org/traccar/ServerManager.java
index a6bb6888c..f4f6e1ba4 100644
--- a/src/main/java/org/traccar/ServerManager.java
+++ b/src/main/java/org/traccar/ServerManager.java
@@ -15,11 +15,13 @@
*/
package org.traccar;
+import com.google.inject.Injector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.config.Keys;
import org.traccar.helper.ClassScanner;
+import javax.inject.Inject;
import javax.inject.Singleton;
import java.io.IOException;
import java.net.BindException;
@@ -38,10 +40,12 @@ public class ServerManager implements LifecycleObject {
private final List<TrackerConnector> connectorList = new LinkedList<>();
private final Map<String, BaseProtocol> protocolList = new ConcurrentHashMap<>();
- public ServerManager() throws IOException, URISyntaxException, ReflectiveOperationException {
+ @Inject
+ public ServerManager(Injector injector) throws IOException, URISyntaxException, ReflectiveOperationException {
for (Class<?> protocolClass : ClassScanner.findSubclasses(BaseProtocol.class, "org.traccar.protocol")) {
if (Context.getConfig().hasKey(Keys.PROTOCOL_PORT.withPrefix(BaseProtocol.nameFromClass(protocolClass)))) {
BaseProtocol protocol = (BaseProtocol) protocolClass.getDeclaredConstructor().newInstance();
+ injector.injectMembers(protocol);
connectorList.addAll(protocol.getConnectorList());
protocolList.put(protocol.getName(), protocol);
}