aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/Context.java9
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorSms.java18
2 files changed, 5 insertions, 22 deletions
diff --git a/src/main/java/org/traccar/Context.java b/src/main/java/org/traccar/Context.java
index 8492e4230..d23314c06 100644
--- a/src/main/java/org/traccar/Context.java
+++ b/src/main/java/org/traccar/Context.java
@@ -60,8 +60,8 @@ import org.traccar.notification.EventForwarder;
import org.traccar.notification.NotificatorManager;
import org.traccar.reports.model.TripsConfig;
import org.traccar.schedule.ScheduleManager;
+import org.traccar.sms.HttpSmsClient;
import org.traccar.sms.SmsManager;
-import org.traccar.sms.smpp.SmppClient;
import org.traccar.web.WebServer;
import javax.ws.rs.client.Client;
@@ -326,12 +326,7 @@ public final class Context {
tripsConfig = initTripsConfig();
if (config.getBoolean("sms.enable")) {
- final String smsManagerClass = config.getString("sms.manager.class", SmppClient.class.getCanonicalName());
- try {
- smsManager = (SmsManager) Class.forName(smsManagerClass).newInstance();
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
- LOGGER.warn("Error loading SMS Manager class : " + smsManagerClass, e);
- }
+ smsManager = new HttpSmsClient();
}
if (config.getBoolean("event.enable")) {
diff --git a/src/main/java/org/traccar/notificators/NotificatorSms.java b/src/main/java/org/traccar/notificators/NotificatorSms.java
index d5c791eae..8124e40b1 100644
--- a/src/main/java/org/traccar/notificators/NotificatorSms.java
+++ b/src/main/java/org/traccar/notificators/NotificatorSms.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,27 +24,15 @@ import org.traccar.model.Position;
import org.traccar.model.User;
import org.traccar.notification.MessageException;
import org.traccar.notification.NotificationFormatter;
-import org.traccar.sms.SmsManager;
public final class NotificatorSms extends Notificator {
- private final SmsManager smsManager;
-
- public NotificatorSms() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
- final String smsClass = Context.getConfig().getString("notificator.sms.manager.class", "");
- if (smsClass.length() > 0) {
- smsManager = (SmsManager) Class.forName(smsClass).newInstance();
- } else {
- smsManager = Context.getSmsManager();
- }
- }
-
@Override
public void sendAsync(long userId, Event event, Position position) {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getPhone() != null) {
Main.getInjector().getInstance(StatisticsManager.class).registerSms();
- smsManager.sendMessageAsync(user.getPhone(),
+ Context.getSmsManager().sendMessageAsync(user.getPhone(),
NotificationFormatter.formatShortMessage(userId, event, position), false);
}
}
@@ -54,7 +42,7 @@ public final class NotificatorSms extends Notificator {
final User user = Context.getPermissionsManager().getUser(userId);
if (user.getPhone() != null) {
Main.getInjector().getInstance(StatisticsManager.class).registerSms();
- smsManager.sendMessageSync(user.getPhone(),
+ Context.getSmsManager().sendMessageSync(user.getPhone(),
NotificationFormatter.formatShortMessage(userId, event, position), false);
}
}