aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/Context.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r--src/org/traccar/Context.java29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index 7224fd742..80be1ddc6 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -77,8 +77,9 @@ import org.traccar.geolocation.MozillaGeolocationProvider;
import org.traccar.geolocation.OpenCellIdGeolocationProvider;
import org.traccar.notification.EventForwarder;
import org.traccar.notification.JsonTypeEventForwarder;
+import org.traccar.notification.NotificatorManager;
import org.traccar.reports.model.TripsConfig;
-import org.traccar.smpp.SmppClient;
+import org.traccar.sms.SMSManager;
import org.traccar.web.WebServer;
import javax.ws.rs.client.Client;
@@ -206,6 +207,12 @@ public final class Context {
return notificationManager;
}
+ private static NotificatorManager notificatorManager;
+
+ public static NotificatorManager getNotificatorManager() {
+ return notificatorManager;
+ }
+
private static VelocityEngine velocityEngine;
public static VelocityEngine getVelocityEngine() {
@@ -254,10 +261,10 @@ public final class Context {
return statisticsManager;
}
- private static SmppClient smppClient;
+ private static SMSManager smsManager;
- public static SmppClient getSmppManager() {
- return smppClient;
+ public static SMSManager getSmsManager() {
+ return smsManager;
}
private static MotionEventHandler motionEventHandler;
@@ -389,6 +396,15 @@ public final class Context {
tripsConfig = initTripsConfig();
+ if (config.getBoolean("sms.smpp.enable")) {
+ final String smsManagerClass = config.getString("sms.manager.class", "org.traccar.smpp.SmppClient");
+ try {
+ smsManager = (SMSManager) Class.forName(smsManagerClass).newInstance();
+ } catch (ClassNotFoundException e) {
+ Log.warning("Error loading SMS Manager class : " + smsManagerClass, e);
+ }
+ }
+
if (config.getBoolean("event.enable")) {
initEventsModule();
}
@@ -407,10 +423,6 @@ public final class Context {
statisticsManager = new StatisticsManager();
- if (config.getBoolean("sms.smpp.enable")) {
- smppClient = new SmppClient();
- }
-
}
private static void initGeolocationModule() {
@@ -441,6 +453,7 @@ public final class Context {
calendarManager = new CalendarManager(dataManager);
maintenancesManager = new MaintenancesManager(dataManager);
notificationManager = new NotificationManager(dataManager);
+ notificatorManager = new NotificatorManager();
Properties velocityProperties = new Properties();
velocityProperties.setProperty("file.resource.loader.path",
Context.getConfig().getString("templates.rootPath", "templates") + "/");