diff options
author | Abyss777 <abyss@fox5.ru> | 2018-06-26 12:05:16 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-06-26 12:05:16 +0500 |
commit | 825ee0d178a24620f075cb4ffb8d49c75b046484 (patch) | |
tree | 2bc60aaea8d4c1eff707ae6e0b8ff558d45d15dc /src/org/traccar/notification | |
parent | aba402226403f8b3eb58cc01e8f536eb4104d35a (diff) | |
download | trackermap-server-825ee0d178a24620f075cb4ffb8d49c75b046484.tar.gz trackermap-server-825ee0d178a24620f075cb4ffb8d49c75b046484.tar.bz2 trackermap-server-825ee0d178a24620f075cb4ffb8d49c75b046484.zip |
Cleanup and some adjustments
Diffstat (limited to 'src/org/traccar/notification')
7 files changed, 28 insertions, 22 deletions
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<Notificator> c = (Class<Notificator>) Class.forName(className); + final Class<Notificator> clazz = (Class<Notificator>) Class.forName(className); try { - final Constructor<Notificator> constructor = c.getConstructor(new Class[]{String.class}); + final Constructor<Notificator> 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<String> getNotificatorTypes() { - return notificators.keySet(); + public Set<Typed> getNotificatorTypes() { + Set<Typed> result = new HashSet<>(); + for (String notificator : notificators.keySet()) { + result.add(new Typed(notificator)); + } + return result; } |