diff options
author | Abyss777 <abyss@fox5.ru> | 2018-06-26 09:22:22 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-06-26 09:22:22 +0500 |
commit | aba402226403f8b3eb58cc01e8f536eb4104d35a (patch) | |
tree | ec884994ad90365fa9b385465a80391606f6d970 /src/org/traccar/Context.java | |
parent | c700bfdb66071ba224ddf01e9827e721562fed7a (diff) | |
parent | 575deac9e2df1cbd0601328f7ea7a9f22029fa43 (diff) | |
download | trackermap-server-aba402226403f8b3eb58cc01e8f536eb4104d35a.tar.gz trackermap-server-aba402226403f8b3eb58cc01e8f536eb4104d35a.tar.bz2 trackermap-server-aba402226403f8b3eb58cc01e8f536eb4104d35a.zip |
Merge remote-tracking branch 'ivanfmartinez/notifications'
# Conflicts:
# src/org/traccar/Context.java
Diffstat (limited to 'src/org/traccar/Context.java')
-rw-r--r-- | src/org/traccar/Context.java | 29 |
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") + "/"); |