From 9339c709e5a6d521fd0bdd4b1221b909c0a888d6 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Mon, 9 Apr 2018 21:20:15 -0300 Subject: configuration support for notificators --- setup/default.xml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'setup') diff --git a/setup/default.xml b/setup/default.xml index 1788cb901..123f67572 100644 --- a/setup/default.xml +++ b/setup/default.xml @@ -27,6 +27,11 @@ ./media + web,mail + org.traccar.notification.NotificationWeb + org.traccar.notification.NotificationSms + org.traccar.notification.NotificationMail + https://www.traccar.org/analytics/ -- cgit v1.2.3 From 825ee0d178a24620f075cb4ffb8d49c75b046484 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 26 Jun 2018 12:05:16 +0500 Subject: Cleanup and some adjustments --- schema/changelog-3.18.xml | 57 ---------------------- schema/changelog-4.0.xml | 47 ++++++++++++++++++ setup/default.xml | 2 +- .../traccar/api/resource/NotificationResource.java | 9 ++-- src/org/traccar/database/NotificationManager.java | 5 +- src/org/traccar/model/Notification.java | 18 +++++-- .../notification/NotificationException.java | 4 +- src/org/traccar/notification/NotificationMail.java | 4 +- src/org/traccar/notification/NotificationNull.java | 4 +- src/org/traccar/notification/NotificationSms.java | 4 +- src/org/traccar/notification/NotificationWeb.java | 4 +- src/org/traccar/notification/Notificator.java | 4 +- .../traccar/notification/NotificatorManager.java | 26 ++++++---- src/org/traccar/sms/SMSException.java | 4 +- src/org/traccar/sms/SMSManager.java | 16 ++++++ templates/full/alarm.vm | 10 ++++ templates/full/commandResult.vm | 10 ++++ templates/full/deviceFuelDrop.vm | 9 ++++ templates/full/deviceMoving.vm | 10 ++++ templates/full/deviceOffline.vm | 10 ++++ templates/full/deviceOnline.vm | 10 ++++ templates/full/deviceOverspeed.vm | 19 ++++++++ templates/full/deviceStopped.vm | 10 ++++ templates/full/deviceUnknown.vm | 10 ++++ templates/full/driverChanged.vm | 10 ++++ templates/full/geofenceEnter.vm | 10 ++++ templates/full/geofenceExit.vm | 10 ++++ templates/full/ignitionOff.vm | 10 ++++ templates/full/ignitionOn.vm | 10 ++++ templates/full/maintenance.vm | 10 ++++ templates/full/test.vm | 7 +++ templates/full/textMessage.vm | 9 ++++ templates/full/unknown.vm | 7 +++ templates/mail/alarm.vm | 10 ---- templates/mail/commandResult.vm | 10 ---- templates/mail/deviceFuelDrop.vm | 9 ---- templates/mail/deviceMoving.vm | 10 ---- templates/mail/deviceOffline.vm | 10 ---- templates/mail/deviceOnline.vm | 10 ---- templates/mail/deviceOverspeed.vm | 19 -------- templates/mail/deviceStopped.vm | 10 ---- templates/mail/deviceUnknown.vm | 10 ---- templates/mail/driverChanged.vm | 10 ---- templates/mail/geofenceEnter.vm | 10 ---- templates/mail/geofenceExit.vm | 10 ---- templates/mail/ignitionOff.vm | 10 ---- templates/mail/ignitionOn.vm | 10 ---- templates/mail/maintenance.vm | 10 ---- templates/mail/test.vm | 7 --- templates/mail/textMessage.vm | 9 ---- templates/mail/unknown.vm | 7 --- templates/short/alarm.vm | 1 + templates/short/commandResult.vm | 1 + templates/short/deviceFuelDrop.vm | 1 + templates/short/deviceMoving.vm | 1 + templates/short/deviceOffline.vm | 1 + templates/short/deviceOnline.vm | 1 + templates/short/deviceOverspeed.vm | 10 ++++ templates/short/deviceStopped.vm | 1 + templates/short/deviceUnknown.vm | 1 + templates/short/driverChanged.vm | 6 +++ templates/short/geofenceEnter.vm | 1 + templates/short/geofenceExit.vm | 1 + templates/short/ignitionOff.vm | 1 + templates/short/ignitionOn.vm | 1 + templates/short/maintenance.vm | 1 + templates/short/test.vm | 1 + templates/short/textMessage.vm | 1 + templates/short/unknown.vm | 1 + templates/sms/alarm.vm | 1 - templates/sms/commandResult.vm | 1 - templates/sms/deviceFuelDrop.vm | 1 - templates/sms/deviceMoving.vm | 1 - templates/sms/deviceOffline.vm | 1 - templates/sms/deviceOnline.vm | 1 - templates/sms/deviceOverspeed.vm | 10 ---- templates/sms/deviceStopped.vm | 1 - templates/sms/deviceUnknown.vm | 1 - templates/sms/driverChanged.vm | 6 --- templates/sms/geofenceEnter.vm | 1 - templates/sms/geofenceExit.vm | 1 - templates/sms/ignitionOff.vm | 1 - templates/sms/ignitionOn.vm | 1 - templates/sms/maintenance.vm | 1 - templates/sms/test.vm | 1 - templates/sms/textMessage.vm | 1 - templates/sms/unknown.vm | 1 - 87 files changed, 328 insertions(+), 306 deletions(-) delete mode 100644 schema/changelog-3.18.xml create mode 100644 templates/full/alarm.vm create mode 100644 templates/full/commandResult.vm create mode 100644 templates/full/deviceFuelDrop.vm create mode 100644 templates/full/deviceMoving.vm create mode 100644 templates/full/deviceOffline.vm create mode 100644 templates/full/deviceOnline.vm create mode 100644 templates/full/deviceOverspeed.vm create mode 100644 templates/full/deviceStopped.vm create mode 100644 templates/full/deviceUnknown.vm create mode 100644 templates/full/driverChanged.vm create mode 100644 templates/full/geofenceEnter.vm create mode 100644 templates/full/geofenceExit.vm create mode 100644 templates/full/ignitionOff.vm create mode 100644 templates/full/ignitionOn.vm create mode 100644 templates/full/maintenance.vm create mode 100644 templates/full/test.vm create mode 100644 templates/full/textMessage.vm create mode 100644 templates/full/unknown.vm delete mode 100644 templates/mail/alarm.vm delete mode 100644 templates/mail/commandResult.vm delete mode 100644 templates/mail/deviceFuelDrop.vm delete mode 100644 templates/mail/deviceMoving.vm delete mode 100644 templates/mail/deviceOffline.vm delete mode 100644 templates/mail/deviceOnline.vm delete mode 100644 templates/mail/deviceOverspeed.vm delete mode 100644 templates/mail/deviceStopped.vm delete mode 100644 templates/mail/deviceUnknown.vm delete mode 100644 templates/mail/driverChanged.vm delete mode 100644 templates/mail/geofenceEnter.vm delete mode 100644 templates/mail/geofenceExit.vm delete mode 100644 templates/mail/ignitionOff.vm delete mode 100644 templates/mail/ignitionOn.vm delete mode 100644 templates/mail/maintenance.vm delete mode 100644 templates/mail/test.vm delete mode 100644 templates/mail/textMessage.vm delete mode 100644 templates/mail/unknown.vm create mode 100644 templates/short/alarm.vm create mode 100644 templates/short/commandResult.vm create mode 100644 templates/short/deviceFuelDrop.vm create mode 100644 templates/short/deviceMoving.vm create mode 100644 templates/short/deviceOffline.vm create mode 100644 templates/short/deviceOnline.vm create mode 100644 templates/short/deviceOverspeed.vm create mode 100644 templates/short/deviceStopped.vm create mode 100644 templates/short/deviceUnknown.vm create mode 100644 templates/short/driverChanged.vm create mode 100644 templates/short/geofenceEnter.vm create mode 100644 templates/short/geofenceExit.vm create mode 100644 templates/short/ignitionOff.vm create mode 100644 templates/short/ignitionOn.vm create mode 100644 templates/short/maintenance.vm create mode 100644 templates/short/test.vm create mode 100644 templates/short/textMessage.vm create mode 100644 templates/short/unknown.vm delete mode 100644 templates/sms/alarm.vm delete mode 100644 templates/sms/commandResult.vm delete mode 100644 templates/sms/deviceFuelDrop.vm delete mode 100644 templates/sms/deviceMoving.vm delete mode 100644 templates/sms/deviceOffline.vm delete mode 100644 templates/sms/deviceOnline.vm delete mode 100644 templates/sms/deviceOverspeed.vm delete mode 100644 templates/sms/deviceStopped.vm delete mode 100644 templates/sms/deviceUnknown.vm delete mode 100644 templates/sms/driverChanged.vm delete mode 100644 templates/sms/geofenceEnter.vm delete mode 100644 templates/sms/geofenceExit.vm delete mode 100644 templates/sms/ignitionOff.vm delete mode 100644 templates/sms/ignitionOn.vm delete mode 100644 templates/sms/maintenance.vm delete mode 100644 templates/sms/test.vm delete mode 100644 templates/sms/textMessage.vm delete mode 100644 templates/sms/unknown.vm (limited to 'setup') diff --git a/schema/changelog-3.18.xml b/schema/changelog-3.18.xml deleted file mode 100644 index 85c3b0c33..000000000 --- a/schema/changelog-3.18.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - web = 1 AND mail = 1 AND sms = 1 - - - - - web = 1 AND mail = 1 AND sms = 0 - - - - - web = 1 AND mail = 0 AND sms = 0 - - - - - web = 1 AND mail = 0 AND sms = 1 - - - - - web = 0 AND mail = 1 AND sms = 1 - - - - - web = 0 AND mail = 1 AND sms = 0 - - - - - web = 0 AND mail = 0 AND sms = 1 - - - - - - diff --git a/schema/changelog-4.0.xml b/schema/changelog-4.0.xml index 04e9fe0c4..82403c83c 100644 --- a/schema/changelog-4.0.xml +++ b/schema/changelog-4.0.xml @@ -53,4 +53,51 @@ + + + + + + + + + web = 1 AND mail = 1 AND sms = 1 + + + + + web = 1 AND mail = 1 AND sms = 0 + + + + + web = 1 AND mail = 0 AND sms = 0 + + + + + web = 1 AND mail = 0 AND sms = 1 + + + + + web = 0 AND mail = 1 AND sms = 1 + + + + + web = 0 AND mail = 1 AND sms = 0 + + + + + web = 0 AND mail = 0 AND sms = 1 + + + + + + + + diff --git a/setup/default.xml b/setup/default.xml index 353ba36a7..d7c1e5f0f 100644 --- a/setup/default.xml +++ b/setup/default.xml @@ -30,8 +30,8 @@ web,mail org.traccar.notification.NotificationWeb - org.traccar.notification.NotificationSms org.traccar.notification.NotificationMail + org.traccar.notification.NotificationSms https://www.traccar.org/analytics/ diff --git a/src/org/traccar/api/resource/NotificationResource.java b/src/org/traccar/api/resource/NotificationResource.java index 2347b43fa..9046569a0 100644 --- a/src/org/traccar/api/resource/NotificationResource.java +++ b/src/org/traccar/api/resource/NotificationResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,8 +52,9 @@ public class NotificationResource extends ExtendedObjectResource { @POST @Path("test") public Response testMessage() throws NotificationException, InterruptedException { - for (String method : Context.getNotificatorManager().getNotificatorTypes()) { - Context.getNotificatorManager().getNotificator(method).sendSync(getUserId(), new Event("test", 0), null); + for (Typed method : Context.getNotificatorManager().getNotificatorTypes()) { + Context.getNotificatorManager() + .getNotificator(method.getType()).sendSync(getUserId(), new Event("test", 0), null); } return Response.noContent().build(); } @@ -68,7 +69,7 @@ public class NotificationResource extends ExtendedObjectResource { @GET @Path("notificators") - public Collection getNotificators() { + public Collection getNotificators() { return Context.getNotificatorManager().getNotificatorTypes(); } diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java index 2c1ffc09c..b2a30e4f1 100644 --- a/src/org/traccar/database/NotificationManager.java +++ b/src/org/traccar/database/NotificationManager.java @@ -90,8 +90,9 @@ public class NotificationManager extends ExtendedObjectManager { notificationMethods.addAll(notification.getTransportMethods()); } } - for (String nm : notificationMethods) { - Context.getNotificatorManager().getNotificator(nm).sendAsync(userId, event, position); + for (String notificationMethod : notificationMethods) { + Context.getNotificatorManager() + .getNotificator(notificationMethod).sendAsync(userId, event, position); } } } diff --git a/src/org/traccar/model/Notification.java b/src/org/traccar/model/Notification.java index 0b632c861..4923798c2 100644 --- a/src/org/traccar/model/Notification.java +++ b/src/org/traccar/model/Notification.java @@ -18,6 +18,10 @@ package org.traccar.model; import java.util.HashSet; import java.util.Set; +import org.traccar.database.QueryIgnore; + +import com.fasterxml.jackson.annotation.JsonIgnore; + public class Notification extends ScheduledModel { private boolean always; @@ -52,13 +56,17 @@ public class Notification extends ScheduledModel { } + @JsonIgnore + @QueryIgnore public Set getTransportMethods() { - final Set set = new HashSet<>(); - final String[] tmp = transports.split(","); - for (String t : tmp) { - set.add(t.trim()); + final Set result = new HashSet<>(); + if (transports != null) { + final String[] transportsList = transports.split(","); + for (String transport : transportsList) { + result.add(transport.trim()); + } } - return set; + return result; } } diff --git a/src/org/traccar/notification/NotificationException.java b/src/org/traccar/notification/NotificationException.java index 34d5a80f7..525e5ee37 100644 --- a/src/org/traccar/notification/NotificationException.java +++ b/src/org/traccar/notification/NotificationException.java @@ -1,6 +1,6 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index fb89bf5bd..76387c73b 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -1,6 +1,6 @@ /* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/org/traccar/notification/NotificationNull.java b/src/org/traccar/notification/NotificationNull.java index fd7950a80..3ee954c24 100644 --- a/src/org/traccar/notification/NotificationNull.java +++ b/src/org/traccar/notification/NotificationNull.java @@ -1,6 +1,6 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/org/traccar/notification/NotificationSms.java b/src/org/traccar/notification/NotificationSms.java index 63fd57895..dd3304d85 100644 --- a/src/org/traccar/notification/NotificationSms.java +++ b/src/org/traccar/notification/NotificationSms.java @@ -1,6 +1,6 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/org/traccar/notification/NotificationWeb.java b/src/org/traccar/notification/NotificationWeb.java index c6a1ae281..8e04fc2c4 100644 --- a/src/org/traccar/notification/NotificationWeb.java +++ b/src/org/traccar/notification/NotificationWeb.java @@ -1,6 +1,6 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/org/traccar/notification/Notificator.java b/src/org/traccar/notification/Notificator.java index 7192d25c0..09f98d3ad 100644 --- a/src/org/traccar/notification/Notificator.java +++ b/src/org/traccar/notification/Notificator.java @@ -1,6 +1,6 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/org/traccar/notification/NotificatorManager.java b/src/org/traccar/notification/NotificatorManager.java index 20c7749d2..87a294345 100644 --- a/src/org/traccar/notification/NotificatorManager.java +++ b/src/org/traccar/notification/NotificatorManager.java @@ -1,6 +1,6 @@ /* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,13 @@ package org.traccar.notification; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; import org.traccar.Context; import org.traccar.helper.Log; +import org.traccar.model.Typed; public final class NotificatorManager { @@ -33,13 +35,13 @@ public final class NotificatorManager { final String className = Context.getConfig().getString("notificator." + type + ".class", ""); if (className.length() > 0) { try { - final Class c = (Class) Class.forName(className); + final Class clazz = (Class) Class.forName(className); try { - final Constructor constructor = c.getConstructor(new Class[]{String.class}); + final Constructor constructor = clazz.getConstructor(new Class[]{String.class}); notificators.put(type, constructor.newInstance(type)); } catch (NoSuchMethodException e) { // No constructor with String argument - notificators.put(type, c.newInstance()); + notificators.put(type, clazz.newInstance()); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException e) { @@ -53,17 +55,21 @@ public final class NotificatorManager { private static final Notificator NULL_NOTIFICATOR = new NotificationNull(); public Notificator getNotificator(String type) { - final Notificator n = notificators.get(type); - if (n == null) { + final Notificator notificator = notificators.get(type); + if (notificator == null) { Log.error("No notificator configured for type : " + type); return NULL_NOTIFICATOR; } - return n; + return notificator; } - public Set getNotificatorTypes() { - return notificators.keySet(); + public Set getNotificatorTypes() { + Set result = new HashSet<>(); + for (String notificator : notificators.keySet()) { + result.add(new Typed(notificator)); + } + return result; } diff --git a/src/org/traccar/sms/SMSException.java b/src/org/traccar/sms/SMSException.java index c9c0b3128..22ca95296 100644 --- a/src/org/traccar/sms/SMSException.java +++ b/src/org/traccar/sms/SMSException.java @@ -1,6 +1,6 @@ /* - * Copyright 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/org/traccar/sms/SMSManager.java b/src/org/traccar/sms/SMSManager.java index b40dae867..c4cb68fb7 100644 --- a/src/org/traccar/sms/SMSManager.java +++ b/src/org/traccar/sms/SMSManager.java @@ -1,3 +1,19 @@ +/* + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.traccar.sms; public interface SMSManager { diff --git a/templates/full/alarm.vm b/templates/full/alarm.vm new file mode 100644 index 000000000..8f1164291 --- /dev/null +++ b/templates/full/alarm.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: alarm!") + + + +Device: $device.name
+Alarm: $position.getString("alarm")
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/commandResult.vm b/templates/full/commandResult.vm new file mode 100644 index 000000000..5b6d8ef3e --- /dev/null +++ b/templates/full/commandResult.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: command result received") + + + +Device: $device.name
+Result: $position.getString("result")
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Link: $webUrl?eventId=$event.id + + diff --git a/templates/full/deviceFuelDrop.vm b/templates/full/deviceFuelDrop.vm new file mode 100644 index 000000000..c30ec3a1c --- /dev/null +++ b/templates/full/deviceFuelDrop.vm @@ -0,0 +1,9 @@ +#set($subject = "$device.name: fuel drop") + + + +Device: $device.name
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/deviceMoving.vm b/templates/full/deviceMoving.vm new file mode 100644 index 000000000..6e98af1de --- /dev/null +++ b/templates/full/deviceMoving.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: moving") + + + +Device: $device.name
+Moving
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/deviceOffline.vm b/templates/full/deviceOffline.vm new file mode 100644 index 000000000..1f6d02fb2 --- /dev/null +++ b/templates/full/deviceOffline.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: offline") + + + +Device: $device.name
+Offline
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Link: $webUrl?eventId=$event.id + + diff --git a/templates/full/deviceOnline.vm b/templates/full/deviceOnline.vm new file mode 100644 index 000000000..9211eff11 --- /dev/null +++ b/templates/full/deviceOnline.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: online") + + + +Device: $device.name
+Online
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Link: $webUrl?eventId=$event.id + + diff --git a/templates/full/deviceOverspeed.vm b/templates/full/deviceOverspeed.vm new file mode 100644 index 000000000..e5e576f3a --- /dev/null +++ b/templates/full/deviceOverspeed.vm @@ -0,0 +1,19 @@ +#set($subject = "$device.name: exceeds the speed") +#if($speedUnit == 'kmh') +#set($speedValue = $position.speed * 1.852) +#set($speedString = $numberTool.format("0.0 km/h", $speedValue)) +#elseif($speedUnit == 'mph') +#set($speedValue = $position.speed * 1.15078) +#set($speedString = $numberTool.format("0.0 mph", $speedValue)) +#else +#set($speedString = $numberTool.format("0.0 kn", $position.speed)) +#end + + + +Device: $device.name
+Exceeds the speed: $speedString#{if}($geofence) in $geofence.name#{else}#{end}
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/deviceStopped.vm b/templates/full/deviceStopped.vm new file mode 100644 index 000000000..2ec0f8db9 --- /dev/null +++ b/templates/full/deviceStopped.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: stopped") + + + +Device: $device.name
+Stopped
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/deviceUnknown.vm b/templates/full/deviceUnknown.vm new file mode 100644 index 000000000..34fa01a8a --- /dev/null +++ b/templates/full/deviceUnknown.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: status is unknown") + + + +Device: $device.name
+Status is unknown
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Link: $webUrl?eventId=$event.id + + diff --git a/templates/full/driverChanged.vm b/templates/full/driverChanged.vm new file mode 100644 index 000000000..ba1e68661 --- /dev/null +++ b/templates/full/driverChanged.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: driver has changed") + + + +Device: $device.name
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+Driver: #{if}($driver)$driver.name#{else}$event.getString("driverUniqueId")#{end} + + diff --git a/templates/full/geofenceEnter.vm b/templates/full/geofenceEnter.vm new file mode 100644 index 000000000..e83a0de62 --- /dev/null +++ b/templates/full/geofenceEnter.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: has entered geofence") + + + +Device: $device.name
+Has entered geofence: $geofence.name
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/geofenceExit.vm b/templates/full/geofenceExit.vm new file mode 100644 index 000000000..3557f6eb2 --- /dev/null +++ b/templates/full/geofenceExit.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: has exited geofence") + + + +Device: $device.name
+Has exited geofence: $geofence.name
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/ignitionOff.vm b/templates/full/ignitionOff.vm new file mode 100644 index 000000000..0281eef02 --- /dev/null +++ b/templates/full/ignitionOff.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: ignition OFF") + + + +Device: $device.name
+Ignition OFF
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/ignitionOn.vm b/templates/full/ignitionOn.vm new file mode 100644 index 000000000..27135a7f0 --- /dev/null +++ b/templates/full/ignitionOn.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: ignition ON") + + + +Device: $device.name
+Ignition ON
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/maintenance.vm b/templates/full/maintenance.vm new file mode 100644 index 000000000..c6973f97a --- /dev/null +++ b/templates/full/maintenance.vm @@ -0,0 +1,10 @@ +#set($subject = "$device.name: maintenance is required") + + + +Device: $device.name
+Maintenance is required: $maintenance.name
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
+ + diff --git a/templates/full/test.vm b/templates/full/test.vm new file mode 100644 index 000000000..93cbdc549 --- /dev/null +++ b/templates/full/test.vm @@ -0,0 +1,7 @@ +#set($subject = "Test message") + + + +Test message + + diff --git a/templates/full/textMessage.vm b/templates/full/textMessage.vm new file mode 100644 index 000000000..174173c85 --- /dev/null +++ b/templates/full/textMessage.vm @@ -0,0 +1,9 @@ +#set($subject = "$device.name: text message received") + + + +Device: $device.name
+Message: $event.getString("message")
+Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
+ + diff --git a/templates/full/unknown.vm b/templates/full/unknown.vm new file mode 100644 index 000000000..566ce0d42 --- /dev/null +++ b/templates/full/unknown.vm @@ -0,0 +1,7 @@ +#set($subject = "Unknown type") + + + +Unknown type + + diff --git a/templates/mail/alarm.vm b/templates/mail/alarm.vm deleted file mode 100644 index 8f1164291..000000000 --- a/templates/mail/alarm.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: alarm!") - - - -Device: $device.name
-Alarm: $position.getString("alarm")
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/commandResult.vm b/templates/mail/commandResult.vm deleted file mode 100644 index 5b6d8ef3e..000000000 --- a/templates/mail/commandResult.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: command result received") - - - -Device: $device.name
-Result: $position.getString("result")
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Link: $webUrl?eventId=$event.id - - diff --git a/templates/mail/deviceFuelDrop.vm b/templates/mail/deviceFuelDrop.vm deleted file mode 100644 index c30ec3a1c..000000000 --- a/templates/mail/deviceFuelDrop.vm +++ /dev/null @@ -1,9 +0,0 @@ -#set($subject = "$device.name: fuel drop") - - - -Device: $device.name
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/deviceMoving.vm b/templates/mail/deviceMoving.vm deleted file mode 100644 index 6e98af1de..000000000 --- a/templates/mail/deviceMoving.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: moving") - - - -Device: $device.name
-Moving
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/deviceOffline.vm b/templates/mail/deviceOffline.vm deleted file mode 100644 index 1f6d02fb2..000000000 --- a/templates/mail/deviceOffline.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: offline") - - - -Device: $device.name
-Offline
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Link: $webUrl?eventId=$event.id - - diff --git a/templates/mail/deviceOnline.vm b/templates/mail/deviceOnline.vm deleted file mode 100644 index 9211eff11..000000000 --- a/templates/mail/deviceOnline.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: online") - - - -Device: $device.name
-Online
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Link: $webUrl?eventId=$event.id - - diff --git a/templates/mail/deviceOverspeed.vm b/templates/mail/deviceOverspeed.vm deleted file mode 100644 index e5e576f3a..000000000 --- a/templates/mail/deviceOverspeed.vm +++ /dev/null @@ -1,19 +0,0 @@ -#set($subject = "$device.name: exceeds the speed") -#if($speedUnit == 'kmh') -#set($speedValue = $position.speed * 1.852) -#set($speedString = $numberTool.format("0.0 km/h", $speedValue)) -#elseif($speedUnit == 'mph') -#set($speedValue = $position.speed * 1.15078) -#set($speedString = $numberTool.format("0.0 mph", $speedValue)) -#else -#set($speedString = $numberTool.format("0.0 kn", $position.speed)) -#end - - - -Device: $device.name
-Exceeds the speed: $speedString#{if}($geofence) in $geofence.name#{else}#{end}
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/deviceStopped.vm b/templates/mail/deviceStopped.vm deleted file mode 100644 index 2ec0f8db9..000000000 --- a/templates/mail/deviceStopped.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: stopped") - - - -Device: $device.name
-Stopped
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/deviceUnknown.vm b/templates/mail/deviceUnknown.vm deleted file mode 100644 index 34fa01a8a..000000000 --- a/templates/mail/deviceUnknown.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: status is unknown") - - - -Device: $device.name
-Status is unknown
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Link: $webUrl?eventId=$event.id - - diff --git a/templates/mail/driverChanged.vm b/templates/mail/driverChanged.vm deleted file mode 100644 index ba1e68661..000000000 --- a/templates/mail/driverChanged.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: driver has changed") - - - -Device: $device.name
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
-Driver: #{if}($driver)$driver.name#{else}$event.getString("driverUniqueId")#{end} - - diff --git a/templates/mail/geofenceEnter.vm b/templates/mail/geofenceEnter.vm deleted file mode 100644 index e83a0de62..000000000 --- a/templates/mail/geofenceEnter.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: has entered geofence") - - - -Device: $device.name
-Has entered geofence: $geofence.name
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/geofenceExit.vm b/templates/mail/geofenceExit.vm deleted file mode 100644 index 3557f6eb2..000000000 --- a/templates/mail/geofenceExit.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: has exited geofence") - - - -Device: $device.name
-Has exited geofence: $geofence.name
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/ignitionOff.vm b/templates/mail/ignitionOff.vm deleted file mode 100644 index 0281eef02..000000000 --- a/templates/mail/ignitionOff.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: ignition OFF") - - - -Device: $device.name
-Ignition OFF
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/ignitionOn.vm b/templates/mail/ignitionOn.vm deleted file mode 100644 index 27135a7f0..000000000 --- a/templates/mail/ignitionOn.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: ignition ON") - - - -Device: $device.name
-Ignition ON
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/maintenance.vm b/templates/mail/maintenance.vm deleted file mode 100644 index c6973f97a..000000000 --- a/templates/mail/maintenance.vm +++ /dev/null @@ -1,10 +0,0 @@ -#set($subject = "$device.name: maintenance is required") - - - -Device: $device.name
-Maintenance is required: $maintenance.name
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
-Point: #{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}
- - diff --git a/templates/mail/test.vm b/templates/mail/test.vm deleted file mode 100644 index 93cbdc549..000000000 --- a/templates/mail/test.vm +++ /dev/null @@ -1,7 +0,0 @@ -#set($subject = "Test message") - - - -Test message - - diff --git a/templates/mail/textMessage.vm b/templates/mail/textMessage.vm deleted file mode 100644 index 174173c85..000000000 --- a/templates/mail/textMessage.vm +++ /dev/null @@ -1,9 +0,0 @@ -#set($subject = "$device.name: text message received") - - - -Device: $device.name
-Message: $event.getString("message")
-Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone)
- - diff --git a/templates/mail/unknown.vm b/templates/mail/unknown.vm deleted file mode 100644 index 566ce0d42..000000000 --- a/templates/mail/unknown.vm +++ /dev/null @@ -1,7 +0,0 @@ -#set($subject = "Unknown type") - - - -Unknown type - - diff --git a/templates/short/alarm.vm b/templates/short/alarm.vm new file mode 100644 index 000000000..389341cf1 --- /dev/null +++ b/templates/short/alarm.vm @@ -0,0 +1 @@ +$device.name alarm: $position.getString("alarm") at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/commandResult.vm b/templates/short/commandResult.vm new file mode 100644 index 000000000..4a327d850 --- /dev/null +++ b/templates/short/commandResult.vm @@ -0,0 +1 @@ +$device.name command result received: $position.getString("result") at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/deviceFuelDrop.vm b/templates/short/deviceFuelDrop.vm new file mode 100644 index 000000000..5e51396d4 --- /dev/null +++ b/templates/short/deviceFuelDrop.vm @@ -0,0 +1 @@ +$device.name fuel drop at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/deviceMoving.vm b/templates/short/deviceMoving.vm new file mode 100644 index 000000000..aaa72ab0d --- /dev/null +++ b/templates/short/deviceMoving.vm @@ -0,0 +1 @@ +$device.name moving at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/deviceOffline.vm b/templates/short/deviceOffline.vm new file mode 100644 index 000000000..8c4a02335 --- /dev/null +++ b/templates/short/deviceOffline.vm @@ -0,0 +1 @@ +$device.name offline at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/deviceOnline.vm b/templates/short/deviceOnline.vm new file mode 100644 index 000000000..62854feb0 --- /dev/null +++ b/templates/short/deviceOnline.vm @@ -0,0 +1 @@ +$device.name online at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/deviceOverspeed.vm b/templates/short/deviceOverspeed.vm new file mode 100644 index 000000000..5e92f662c --- /dev/null +++ b/templates/short/deviceOverspeed.vm @@ -0,0 +1,10 @@ +#if($speedUnit == 'kmh') +#set($speedValue = $position.speed * 1.852) +#set($speedString = $numberTool.format("0.0 km/h", $speedValue)) +#elseif($speedUnit == 'mph') +#set($speedValue = $position.speed * 1.15078) +#set($speedString = $numberTool.format("0.0 mph", $speedValue)) +#else +#set($speedString = $numberTool.format("0.0 kn", $position.speed)) +#end +$device.name exceeds the speed $speedString#{if}($geofence) in $geofence.name#{else}#{end} at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/deviceStopped.vm b/templates/short/deviceStopped.vm new file mode 100644 index 000000000..c2437b5f6 --- /dev/null +++ b/templates/short/deviceStopped.vm @@ -0,0 +1 @@ +$device.name stopped at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/deviceUnknown.vm b/templates/short/deviceUnknown.vm new file mode 100644 index 000000000..07f39f3a9 --- /dev/null +++ b/templates/short/deviceUnknown.vm @@ -0,0 +1 @@ +$device.name status is unknown at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/driverChanged.vm b/templates/short/driverChanged.vm new file mode 100644 index 000000000..50849df7c --- /dev/null +++ b/templates/short/driverChanged.vm @@ -0,0 +1,6 @@ +#if($driver) +#set($driverName = $driver.name) +#else +#set($driverName = $event.getString("driverUniqueId")) +#end +Driver $driverName has changed in $device.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/geofenceEnter.vm b/templates/short/geofenceEnter.vm new file mode 100644 index 000000000..debdbf356 --- /dev/null +++ b/templates/short/geofenceEnter.vm @@ -0,0 +1 @@ +$device.name has entered geofence $geofence.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/geofenceExit.vm b/templates/short/geofenceExit.vm new file mode 100644 index 000000000..8553458f7 --- /dev/null +++ b/templates/short/geofenceExit.vm @@ -0,0 +1 @@ +$device.name has exited geofence $geofence.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/ignitionOff.vm b/templates/short/ignitionOff.vm new file mode 100644 index 000000000..ddf860413 --- /dev/null +++ b/templates/short/ignitionOff.vm @@ -0,0 +1 @@ +$device.name ignition OFF at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/ignitionOn.vm b/templates/short/ignitionOn.vm new file mode 100644 index 000000000..00b365be9 --- /dev/null +++ b/templates/short/ignitionOn.vm @@ -0,0 +1 @@ +$device.name ignition ON at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/maintenance.vm b/templates/short/maintenance.vm new file mode 100644 index 000000000..621beae46 --- /dev/null +++ b/templates/short/maintenance.vm @@ -0,0 +1 @@ +$device.name maintenance $maintenance.name is required at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/test.vm b/templates/short/test.vm new file mode 100644 index 000000000..d25f218ce --- /dev/null +++ b/templates/short/test.vm @@ -0,0 +1 @@ +Test message diff --git a/templates/short/textMessage.vm b/templates/short/textMessage.vm new file mode 100644 index 000000000..dc42f29f1 --- /dev/null +++ b/templates/short/textMessage.vm @@ -0,0 +1 @@ +Text message received from $device.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/short/unknown.vm b/templates/short/unknown.vm new file mode 100644 index 000000000..fd20b50cc --- /dev/null +++ b/templates/short/unknown.vm @@ -0,0 +1 @@ +Unknown type diff --git a/templates/sms/alarm.vm b/templates/sms/alarm.vm deleted file mode 100644 index 389341cf1..000000000 --- a/templates/sms/alarm.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name alarm: $position.getString("alarm") at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/commandResult.vm b/templates/sms/commandResult.vm deleted file mode 100644 index 4a327d850..000000000 --- a/templates/sms/commandResult.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name command result received: $position.getString("result") at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/deviceFuelDrop.vm b/templates/sms/deviceFuelDrop.vm deleted file mode 100644 index 5e51396d4..000000000 --- a/templates/sms/deviceFuelDrop.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name fuel drop at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/deviceMoving.vm b/templates/sms/deviceMoving.vm deleted file mode 100644 index aaa72ab0d..000000000 --- a/templates/sms/deviceMoving.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name moving at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/deviceOffline.vm b/templates/sms/deviceOffline.vm deleted file mode 100644 index 8c4a02335..000000000 --- a/templates/sms/deviceOffline.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name offline at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/deviceOnline.vm b/templates/sms/deviceOnline.vm deleted file mode 100644 index 62854feb0..000000000 --- a/templates/sms/deviceOnline.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name online at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/deviceOverspeed.vm b/templates/sms/deviceOverspeed.vm deleted file mode 100644 index 5e92f662c..000000000 --- a/templates/sms/deviceOverspeed.vm +++ /dev/null @@ -1,10 +0,0 @@ -#if($speedUnit == 'kmh') -#set($speedValue = $position.speed * 1.852) -#set($speedString = $numberTool.format("0.0 km/h", $speedValue)) -#elseif($speedUnit == 'mph') -#set($speedValue = $position.speed * 1.15078) -#set($speedString = $numberTool.format("0.0 mph", $speedValue)) -#else -#set($speedString = $numberTool.format("0.0 kn", $position.speed)) -#end -$device.name exceeds the speed $speedString#{if}($geofence) in $geofence.name#{else}#{end} at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/deviceStopped.vm b/templates/sms/deviceStopped.vm deleted file mode 100644 index c2437b5f6..000000000 --- a/templates/sms/deviceStopped.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name stopped at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/deviceUnknown.vm b/templates/sms/deviceUnknown.vm deleted file mode 100644 index 07f39f3a9..000000000 --- a/templates/sms/deviceUnknown.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name status is unknown at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/driverChanged.vm b/templates/sms/driverChanged.vm deleted file mode 100644 index 50849df7c..000000000 --- a/templates/sms/driverChanged.vm +++ /dev/null @@ -1,6 +0,0 @@ -#if($driver) -#set($driverName = $driver.name) -#else -#set($driverName = $event.getString("driverUniqueId")) -#end -Driver $driverName has changed in $device.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/geofenceEnter.vm b/templates/sms/geofenceEnter.vm deleted file mode 100644 index debdbf356..000000000 --- a/templates/sms/geofenceEnter.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name has entered geofence $geofence.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/geofenceExit.vm b/templates/sms/geofenceExit.vm deleted file mode 100644 index 8553458f7..000000000 --- a/templates/sms/geofenceExit.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name has exited geofence $geofence.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/ignitionOff.vm b/templates/sms/ignitionOff.vm deleted file mode 100644 index ddf860413..000000000 --- a/templates/sms/ignitionOff.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name ignition OFF at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/ignitionOn.vm b/templates/sms/ignitionOn.vm deleted file mode 100644 index 00b365be9..000000000 --- a/templates/sms/ignitionOn.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name ignition ON at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/maintenance.vm b/templates/sms/maintenance.vm deleted file mode 100644 index 621beae46..000000000 --- a/templates/sms/maintenance.vm +++ /dev/null @@ -1 +0,0 @@ -$device.name maintenance $maintenance.name is required at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/test.vm b/templates/sms/test.vm deleted file mode 100644 index d25f218ce..000000000 --- a/templates/sms/test.vm +++ /dev/null @@ -1 +0,0 @@ -Test message diff --git a/templates/sms/textMessage.vm b/templates/sms/textMessage.vm deleted file mode 100644 index dc42f29f1..000000000 --- a/templates/sms/textMessage.vm +++ /dev/null @@ -1 +0,0 @@ -Text message received from $device.name at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.serverTime, $locale, $timezone) diff --git a/templates/sms/unknown.vm b/templates/sms/unknown.vm deleted file mode 100644 index fd20b50cc..000000000 --- a/templates/sms/unknown.vm +++ /dev/null @@ -1 +0,0 @@ -Unknown type -- cgit v1.2.3 From 14840af2abd9976b8f5634af8e77f4a7126dfac1 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 27 Jun 2018 15:55:19 +0500 Subject: - Rename NotificationException to MessageException - Simplify Notificator instantiation - Make sms configuration more clear - Move some defaults in code - Some cleanup --- setup/default.xml | 3 -- src/org/traccar/Context.java | 12 +++--- .../traccar/api/resource/NotificationResource.java | 6 +-- src/org/traccar/notification/MessageException.java | 25 +++++++++++ .../notification/NotificationException.java | 25 ----------- .../notification/NotificationFormatter.java | 7 +-- src/org/traccar/notification/NotificationMail.java | 4 +- src/org/traccar/notification/NotificationSms.java | 22 ++++------ src/org/traccar/notification/NotificationWeb.java | 3 +- src/org/traccar/notification/Notificator.java | 6 +-- .../traccar/notification/NotificatorManager.java | 50 ++++++++++++---------- src/org/traccar/smpp/SmppClient.java | 14 +++--- src/org/traccar/sms/SMSException.java | 28 ------------ src/org/traccar/sms/SMSManager.java | 24 ----------- src/org/traccar/sms/SmsManager.java | 27 ++++++++++++ 15 files changed, 112 insertions(+), 144 deletions(-) create mode 100644 src/org/traccar/notification/MessageException.java delete mode 100644 src/org/traccar/notification/NotificationException.java delete mode 100644 src/org/traccar/sms/SMSException.java delete mode 100644 src/org/traccar/sms/SMSManager.java create mode 100644 src/org/traccar/sms/SmsManager.java (limited to 'setup') diff --git a/setup/default.xml b/setup/default.xml index d7c1e5f0f..83447ef83 100644 --- a/setup/default.xml +++ b/setup/default.xml @@ -29,9 +29,6 @@ ./media web,mail - org.traccar.notification.NotificationWeb - org.traccar.notification.NotificationMail - org.traccar.notification.NotificationSms https://www.traccar.org/analytics/ diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 80be1ddc6..2afdde3b9 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -79,7 +79,7 @@ import org.traccar.notification.EventForwarder; import org.traccar.notification.JsonTypeEventForwarder; import org.traccar.notification.NotificatorManager; import org.traccar.reports.model.TripsConfig; -import org.traccar.sms.SMSManager; +import org.traccar.sms.SmsManager; import org.traccar.web.WebServer; import javax.ws.rs.client.Client; @@ -261,9 +261,9 @@ public final class Context { return statisticsManager; } - private static SMSManager smsManager; + private static SmsManager smsManager; - public static SMSManager getSmsManager() { + public static SmsManager getSmsManager() { return smsManager; } @@ -396,11 +396,11 @@ public final class Context { tripsConfig = initTripsConfig(); - if (config.getBoolean("sms.smpp.enable")) { + if (config.getBoolean("sms.enable")) { final String smsManagerClass = config.getString("sms.manager.class", "org.traccar.smpp.SmppClient"); try { - smsManager = (SMSManager) Class.forName(smsManagerClass).newInstance(); - } catch (ClassNotFoundException e) { + smsManager = (SmsManager) Class.forName(smsManagerClass).newInstance(); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { Log.warning("Error loading SMS Manager class : " + smsManagerClass, e); } } diff --git a/src/org/traccar/api/resource/NotificationResource.java b/src/org/traccar/api/resource/NotificationResource.java index 0d7a7982d..9631a52b7 100644 --- a/src/org/traccar/api/resource/NotificationResource.java +++ b/src/org/traccar/api/resource/NotificationResource.java @@ -31,7 +31,7 @@ import org.traccar.api.ExtendedObjectResource; import org.traccar.model.Event; import org.traccar.model.Notification; import org.traccar.model.Typed; -import org.traccar.notification.NotificationException; +import org.traccar.notification.MessageException; @Path("notifications") @@ -57,7 +57,7 @@ public class NotificationResource extends ExtendedObjectResource { @POST @Path("test") - public Response testMessage() throws NotificationException, InterruptedException { + public Response testMessage() throws MessageException, InterruptedException { for (Typed method : Context.getNotificatorManager().getAllNotificatorTypes()) { Context.getNotificatorManager() .getNotificator(method.getType()).sendSync(getUserId(), new Event("test", 0), null); @@ -68,7 +68,7 @@ public class NotificationResource extends ExtendedObjectResource { @POST @Path("test/{notificator}") public Response testMessage(@PathParam("notificator") String notificator) - throws NotificationException, InterruptedException { + throws MessageException, InterruptedException { Context.getNotificatorManager().getNotificator(notificator).sendSync(getUserId(), new Event("test", 0), null); return Response.noContent().build(); } diff --git a/src/org/traccar/notification/MessageException.java b/src/org/traccar/notification/MessageException.java new file mode 100644 index 000000000..ce4b9f6ee --- /dev/null +++ b/src/org/traccar/notification/MessageException.java @@ -0,0 +1,25 @@ +/* + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.notification; + +public class MessageException extends Exception { + + public MessageException(Throwable cause) { + super(cause); + } + +} diff --git a/src/org/traccar/notification/NotificationException.java b/src/org/traccar/notification/NotificationException.java deleted file mode 100644 index 525e5ee37..000000000 --- a/src/org/traccar/notification/NotificationException.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.notification; - -public class NotificationException extends Exception { - - public NotificationException(Throwable cause) { - super(cause); - } - -} diff --git a/src/org/traccar/notification/NotificationFormatter.java b/src/org/traccar/notification/NotificationFormatter.java index a1abdd0cc..c011403c5 100644 --- a/src/org/traccar/notification/NotificationFormatter.java +++ b/src/org/traccar/notification/NotificationFormatter.java @@ -89,17 +89,14 @@ public final class NotificationFormatter { } public static FullMessage formatFullMessage(long userId, Event event, Position position) { - String templatePath = Context.getConfig().getString("message.full.templatesPath", "full"); VelocityContext velocityContext = prepareContext(userId, event, position); - String formattedMessage = formatMessage(velocityContext, userId, event, position, templatePath); + String formattedMessage = formatMessage(velocityContext, userId, event, position, "full"); return new FullMessage((String) velocityContext.get("subject"), formattedMessage); } public static String formatShortMessage(long userId, Event event, Position position) { - String templatePath = Context.getConfig().getString("message.short.templatesPath", "short"); - - return formatMessage(null, userId, event, position, templatePath); + return formatMessage(null, userId, event, position, "short"); } private static String formatMessage(VelocityContext vc, Long userId, Event event, Position position, diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java index 808acca76..c2ee67299 100644 --- a/src/org/traccar/notification/NotificationMail.java +++ b/src/org/traccar/notification/NotificationMail.java @@ -82,7 +82,7 @@ public final class NotificationMail extends Notificator { } @Override - public void sendSync(long userId, Event event, Position position) throws NotificationException { + public void sendSync(long userId, Event event, Position position) throws MessageException { User user = Context.getPermissionsManager().getUser(userId); Properties properties = null; @@ -125,7 +125,7 @@ public final class NotificationMail extends Notificator { transport.close(); } } catch (MessagingException e) { - throw new NotificationException(e); + throw new MessageException(e); } } diff --git a/src/org/traccar/notification/NotificationSms.java b/src/org/traccar/notification/NotificationSms.java index dd3304d85..ed651ac11 100644 --- a/src/org/traccar/notification/NotificationSms.java +++ b/src/org/traccar/notification/NotificationSms.java @@ -20,41 +20,37 @@ import org.traccar.Context; import org.traccar.model.Event; import org.traccar.model.Position; import org.traccar.model.User; -import org.traccar.sms.SMSManager; -import org.traccar.sms.SMSException; +import org.traccar.sms.SmsManager; public final class NotificationSms extends Notificator { - private final SMSManager sms; + private final SmsManager smsManager; - public NotificationSms(String methodId) throws ClassNotFoundException, - InstantiationException, IllegalAccessException { - final String smsClass = Context.getConfig().getString("notificator." + methodId + ".sms.class", ""); + public NotificationSms() throws ClassNotFoundException, InstantiationException, IllegalAccessException { + final String smsClass = Context.getConfig().getString("notificator.sms.manager.class", ""); if (smsClass.length() > 0) { - sms = (SMSManager) Class.forName(smsClass).newInstance(); + smsManager = (SmsManager) Class.forName(smsClass).newInstance(); } else { - sms = Context.getSmsManager(); + smsManager = Context.getSmsManager(); } } - @Override public void sendAsync(long userId, Event event, Position position) { final User user = Context.getPermissionsManager().getUser(userId); if (user.getPhone() != null) { Context.getStatisticsManager().registerSms(); - sms.sendMessageAsync(user.getPhone(), + smsManager.sendMessageAsync(user.getPhone(), NotificationFormatter.formatShortMessage(userId, event, position), false); } } @Override - public void sendSync(long userId, Event event, Position position) throws SMSException, - InterruptedException { + public void sendSync(long userId, Event event, Position position) throws MessageException, InterruptedException { final User user = Context.getPermissionsManager().getUser(userId); if (user.getPhone() != null) { Context.getStatisticsManager().registerSms(); - sms.sendMessageSync(user.getPhone(), + smsManager.sendMessageSync(user.getPhone(), NotificationFormatter.formatShortMessage(userId, event, position), false); } } diff --git a/src/org/traccar/notification/NotificationWeb.java b/src/org/traccar/notification/NotificationWeb.java index 8e04fc2c4..afc401d24 100644 --- a/src/org/traccar/notification/NotificationWeb.java +++ b/src/org/traccar/notification/NotificationWeb.java @@ -23,8 +23,7 @@ import org.traccar.model.Position; public final class NotificationWeb extends Notificator { @Override - public void sendSync(long userId, Event event, Position position) throws NotificationException, - InterruptedException { + public void sendSync(long userId, Event event, Position position) { Context.getConnectionManager().updateEvent(userId, event); } diff --git a/src/org/traccar/notification/Notificator.java b/src/org/traccar/notification/Notificator.java index 09f98d3ad..d912b445d 100644 --- a/src/org/traccar/notification/Notificator.java +++ b/src/org/traccar/notification/Notificator.java @@ -27,14 +27,14 @@ public abstract class Notificator { public void run() { try { sendSync(userId, event, position); - } catch (NotificationException | InterruptedException error) { + } catch (MessageException | InterruptedException error) { Log.warning(error); } } }).start(); } - public abstract void sendSync(long userId, Event event, Position position) - throws NotificationException, InterruptedException; + throws MessageException, InterruptedException; + } diff --git a/src/org/traccar/notification/NotificatorManager.java b/src/org/traccar/notification/NotificatorManager.java index bb55844f3..147de47d3 100644 --- a/src/org/traccar/notification/NotificatorManager.java +++ b/src/org/traccar/notification/NotificatorManager.java @@ -16,8 +16,6 @@ */ package org.traccar.notification; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -29,31 +27,40 @@ import org.traccar.model.Typed; public final class NotificatorManager { + private static final String DEFAULT_WEB_NOTIFICATOR = "org.traccar.notification.NotificationWeb"; + private static final String DEFAULT_MAIL_NOTIFICATOR = "org.traccar.notification.NotificationMail"; + private static final String DEFAULT_SMS_NOTIFICATOR = "org.traccar.notification.NotificationSms"; + + private final Map notificators = new HashMap<>(); + private static final Notificator NULL_NOTIFICATOR = new NotificationNull(); + public NotificatorManager() { final String[] types = Context.getConfig().getString("notificator.types", "").split(","); for (String type : types) { - final String className = Context.getConfig().getString("notificator." + type + ".class", ""); - if (className.length() > 0) { - try { - final Class clazz = (Class) Class.forName(className); - try { - final Constructor constructor = clazz.getConstructor(new Class[]{String.class}); - notificators.put(type, constructor.newInstance(type)); - } catch (NoSuchMethodException e) { - // No constructor with String argument - notificators.put(type, clazz.newInstance()); - } - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | InvocationTargetException e) { - Log.error("Unable to load notificator class for " + type + " " + className + " " + e.getMessage()); - } + String defaultNotificator = ""; + switch (type) { + case "web": + defaultNotificator = DEFAULT_WEB_NOTIFICATOR; + break; + case "mail": + defaultNotificator = DEFAULT_MAIL_NOTIFICATOR; + break; + case "sms": + defaultNotificator = DEFAULT_SMS_NOTIFICATOR; + break; + default: + break; + } + final String className = Context.getConfig() + .getString("notificator." + type + ".class", defaultNotificator); + try { + notificators.put(type, (Notificator) Class.forName(className).newInstance()); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + Log.error("Unable to load notificator class for " + type + " " + className + " " + e.getMessage()); } } } - private final Map notificators = new HashMap<>(); - private static final Notificator NULL_NOTIFICATOR = new NotificationNull(); - public Notificator getNotificator(String type) { final Notificator notificator = notificators.get(type); if (notificator == null) { @@ -63,7 +70,6 @@ public final class NotificatorManager { return notificator; } - public Set getAllNotificatorTypes() { Set result = new HashSet<>(); for (String notificator : notificators.keySet()) { @@ -72,6 +78,4 @@ public final class NotificatorManager { return result; } - } - diff --git a/src/org/traccar/smpp/SmppClient.java b/src/org/traccar/smpp/SmppClient.java index d5e6820ab..ddda4cb4f 100644 --- a/src/org/traccar/smpp/SmppClient.java +++ b/src/org/traccar/smpp/SmppClient.java @@ -25,8 +25,8 @@ import java.util.concurrent.TimeUnit; import org.traccar.Context; import org.traccar.helper.Log; -import org.traccar.sms.SMSException; -import org.traccar.sms.SMSManager; +import org.traccar.notification.MessageException; +import org.traccar.sms.SmsManager; import com.cloudhopper.commons.charset.CharsetUtil; import com.cloudhopper.smpp.SmppBindType; @@ -44,7 +44,7 @@ import com.cloudhopper.smpp.type.SmppChannelException; import com.cloudhopper.smpp.type.SmppTimeoutException; import com.cloudhopper.smpp.type.UnrecoverablePduException; -public class SmppClient implements SMSManager { +public class SmppClient implements SmsManager { private SmppSessionConfiguration sessionConfig = new SmppSessionConfiguration(); private SmppSession smppSession; @@ -216,7 +216,7 @@ public class SmppClient implements SMSManager { @Override public synchronized void sendMessageSync(String destAddress, String message, boolean command) - throws SMSException, InterruptedException, IllegalStateException { + throws MessageException, InterruptedException, IllegalStateException { if (getSession() != null && getSession().isBound()) { try { SubmitSm submit = new SubmitSm(); @@ -245,10 +245,10 @@ public class SmppClient implements SMSManager { } } catch (SmppChannelException | RecoverablePduException | SmppTimeoutException | UnrecoverablePduException error) { - throw new SMSException(error); + throw new MessageException(error); } } else { - throw new SMSException(new SmppChannelException("SMPP session is not connected")); + throw new MessageException(new SmppChannelException("SMPP session is not connected")); } } @@ -259,7 +259,7 @@ public class SmppClient implements SMSManager { public void run() { try { sendMessageSync(destAddress, message, command); - } catch (SMSException | InterruptedException | IllegalStateException error) { + } catch (MessageException | InterruptedException | IllegalStateException error) { Log.warning(error); } } diff --git a/src/org/traccar/sms/SMSException.java b/src/org/traccar/sms/SMSException.java deleted file mode 100644 index 22ca95296..000000000 --- a/src/org/traccar/sms/SMSException.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.sms; - - -import org.traccar.notification.NotificationException; - -public class SMSException extends NotificationException { - - public SMSException(Throwable cause) { - super(cause); - } - -} diff --git a/src/org/traccar/sms/SMSManager.java b/src/org/traccar/sms/SMSManager.java deleted file mode 100644 index c4cb68fb7..000000000 --- a/src/org/traccar/sms/SMSManager.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2018 Anton Tananaev (anton@traccar.org) - * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.sms; - -public interface SMSManager { - - void sendMessageSync(String destAddress, String message, boolean command) throws InterruptedException, SMSException; - void sendMessageAsync(final String destAddress, final String message, final boolean command); - -} diff --git a/src/org/traccar/sms/SmsManager.java b/src/org/traccar/sms/SmsManager.java new file mode 100644 index 000000000..4bc4bd009 --- /dev/null +++ b/src/org/traccar/sms/SmsManager.java @@ -0,0 +1,27 @@ +/* + * Copyright 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2018 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.sms; + +import org.traccar.notification.MessageException; + +public interface SmsManager { + + void sendMessageSync(String destAddress, String message, boolean command) + throws InterruptedException, MessageException; + void sendMessageAsync(final String destAddress, final String message, final boolean command); + +} -- cgit v1.2.3