aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service
diff options
context:
space:
mode:
authorIngo Bauersachs <ingo@jitsi.org>2011-12-05 19:40:11 +0000
committerIngo Bauersachs <ingo@jitsi.org>2011-12-05 19:40:11 +0000
commitc543e54197ffca702b75a3350fccaaf348357835 (patch)
tree552af02fa37d4d7dc9af4e5b6fedb43f137aaf25 /src/net/java/sip/communicator/service
parent6102f58f12caa76ded763834b92f2af10e283ce8 (diff)
downloadjitsi-c543e54197ffca702b75a3350fccaaf348357835.zip
jitsi-c543e54197ffca702b75a3350fccaaf348357835.tar.gz
jitsi-c543e54197ffca702b75a3350fccaaf348357835.tar.bz2
Separate notification service from its handlers
Diffstat (limited to 'src/net/java/sip/communicator/service')
-rw-r--r--src/net/java/sip/communicator/service/notification/CommandNotificationAction.java42
-rw-r--r--src/net/java/sip/communicator/service/notification/CommandNotificationHandler.java14
-rw-r--r--src/net/java/sip/communicator/service/notification/LogMessageNotificationAction.java58
-rw-r--r--src/net/java/sip/communicator/service/notification/LogMessageNotificationHandler.java32
-rw-r--r--src/net/java/sip/communicator/service/notification/Notification.java108
-rw-r--r--src/net/java/sip/communicator/service/notification/NotificationAction.java95
-rw-r--r--src/net/java/sip/communicator/service/notification/NotificationActionHandler.java38
-rw-r--r--src/net/java/sip/communicator/service/notification/NotificationHandler.java24
-rw-r--r--src/net/java/sip/communicator/service/notification/NotificationService.java362
-rw-r--r--src/net/java/sip/communicator/service/notification/NotificationServiceActivator.java77
-rw-r--r--src/net/java/sip/communicator/service/notification/NotificationServiceImpl.java975
-rw-r--r--src/net/java/sip/communicator/service/notification/PopupMessageNotificationAction.java41
-rw-r--r--src/net/java/sip/communicator/service/notification/PopupMessageNotificationHandler.java27
-rw-r--r--src/net/java/sip/communicator/service/notification/SoundNotificationAction.java75
-rw-r--r--src/net/java/sip/communicator/service/notification/SoundNotificationHandler.java21
-rw-r--r--src/net/java/sip/communicator/service/notification/event/NotificationActionTypeEvent.java24
-rw-r--r--src/net/java/sip/communicator/service/notification/notification.manifest.mf11
17 files changed, 1636 insertions, 388 deletions
diff --git a/src/net/java/sip/communicator/service/notification/CommandNotificationAction.java b/src/net/java/sip/communicator/service/notification/CommandNotificationAction.java
new file mode 100644
index 0000000..47cb340
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/CommandNotificationAction.java
@@ -0,0 +1,42 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+/**
+ * An implementation of the <tt>CommandNotificationHandler</tt> interface.
+ *
+ * @author Yana Stamcheva
+ */
+public class CommandNotificationAction
+ extends NotificationAction
+{
+ private String commandDescriptor;
+
+ /**
+ * Creates an instance of <tt>CommandNotification</tt> by
+ * specifying the <tt>commandDescriptor</tt>, which will point us to the
+ * command to execute.
+ *
+ * @param commandDescriptor a String that should point us to the command to
+ * execute
+ */
+ public CommandNotificationAction(String commandDescriptor)
+ {
+ super(NotificationAction.ACTION_COMMAND);
+ this.commandDescriptor = commandDescriptor;
+ }
+
+ /**
+ * Returns the command descriptor.
+ *
+ * @return the command descriptor
+ */
+ public String getDescriptor()
+ {
+ return commandDescriptor;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/notification/CommandNotificationHandler.java b/src/net/java/sip/communicator/service/notification/CommandNotificationHandler.java
index 51ef823..c528ed6 100644
--- a/src/net/java/sip/communicator/service/notification/CommandNotificationHandler.java
+++ b/src/net/java/sip/communicator/service/notification/CommandNotificationHandler.java
@@ -13,17 +13,11 @@ package net.java.sip.communicator.service.notification;
* @author Yana Stamcheva
*/
public interface CommandNotificationHandler
- extends NotificationActionHandler
+ extends NotificationHandler
{
/**
- * Executes the program pointed by the descriptor.
+ * Executes the program pointed by the descriptor.
+ * @param action the action to act upon
*/
- public void execute();
-
- /**
- * Returns the descriptor pointing to the command to be executed.
- *
- * @return the descriptor pointing to the command to be executed.
- */
- public String getDescriptor();
+ public void execute(CommandNotificationAction action);
}
diff --git a/src/net/java/sip/communicator/service/notification/LogMessageNotificationAction.java b/src/net/java/sip/communicator/service/notification/LogMessageNotificationAction.java
new file mode 100644
index 0000000..6efdb31
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/LogMessageNotificationAction.java
@@ -0,0 +1,58 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+/**
+ * An implementation of the <tt>LogMessageNotificationHandler</tt> interface.
+ *
+ * @author Yana Stamcheva
+ */
+public class LogMessageNotificationAction
+ extends NotificationAction
+{
+ /**
+ * Indicates that this log is of type trace. If this <tt>logType</tt> is set
+ * the messages would be logged as trace logs.
+ */
+ public static final String TRACE_LOG_TYPE = "TraceLog";
+
+ /**
+ * Indicates that this log is of type info. If this <tt>logType</tt> is set
+ * the messages would be logged as info logs.
+ */
+ public static final String INFO_LOG_TYPE = "InfoLog";
+
+ /**
+ * Indicates that this log is of type error. If this <tt>logType</tt> is set
+ * the messages would be logged as error logs.
+ */
+ public static final String ERROR_LOG_TYPE = "ErrorLog";
+
+ private String logType;
+
+ /**
+ * Creates an instance of <tt>LogMessageNotificationHandlerImpl</tt> by
+ * specifying the log type.
+ *
+ * @param logType the type of the log
+ */
+ public LogMessageNotificationAction(String logType)
+ {
+ super(NotificationAction.ACTION_LOG_MESSAGE);
+ this.logType = logType;
+ }
+
+ /**
+ * Returns the type of the log
+ *
+ * @return the type of the log
+ */
+ public String getLogType()
+ {
+ return logType;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/notification/LogMessageNotificationHandler.java b/src/net/java/sip/communicator/service/notification/LogMessageNotificationHandler.java
index f4d7757..922c0f1 100644
--- a/src/net/java/sip/communicator/service/notification/LogMessageNotificationHandler.java
+++ b/src/net/java/sip/communicator/service/notification/LogMessageNotificationHandler.java
@@ -14,37 +14,13 @@ package net.java.sip.communicator.service.notification;
* @author Yana Stamcheva
*/
public interface LogMessageNotificationHandler
- extends NotificationActionHandler
+ extends NotificationHandler
{
/**
- * Indicates that this log is of type trace. If this <tt>logType</tt> is set
- * the messages would be logged as trace logs.
- */
- public static final String TRACE_LOG_TYPE = "TraceLog";
-
- /**
- * Indicates that this log is of type info. If this <tt>logType</tt> is set
- * the messages would be logged as info logs.
- */
- public static final String INFO_LOG_TYPE = "InfoLog";
-
- /**
- * Indicates that this log is of type error. If this <tt>logType</tt> is set
- * the messages would be logged as error logs.
- */
- public static final String ERROR_LOG_TYPE = "ErrorLog";
-
- /**
- * Returns the type of the log. One of the XXX_LOG_TYPE-s declared in this
- * interface.
- * @return the type of the log. One of the XXX_LOG_TYPE-s declared in this
- * interface.
- */
- public String getLogType();
-
- /**
* Logs the given message.
+ *
+ * @param action the action to act upon
* @param message the message to log
*/
- public void logMessage(String message);
+ public void logMessage(LogMessageNotificationAction action, String message);
}
diff --git a/src/net/java/sip/communicator/service/notification/Notification.java b/src/net/java/sip/communicator/service/notification/Notification.java
new file mode 100644
index 0000000..81072e8
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/Notification.java
@@ -0,0 +1,108 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+import java.util.*;
+
+/**
+ * Represents an event notification.
+ *
+ * @author Yana Stamcheva
+ */
+public class Notification
+{
+ /**
+ * Indicates if this event notification is currently active. By default all
+ * notifications are active.
+ */
+ private boolean isActive = true;
+
+ /**
+ * Contains all actions which will be executed when this event notification
+ * is fired.
+ */
+ private final Hashtable<String, NotificationAction> actionsTable
+ = new Hashtable<String, NotificationAction>();
+
+ /**
+ * Creates an instance of <tt>EventNotification</tt> by specifying the
+ * event type as declared by the bundle registering it.
+ *
+ * @param eventType the name of the event
+ */
+ public Notification(String eventType)
+ {
+ }
+
+ /**
+ * Adds the given <tt>actionType</tt> to the list of actions for this event
+ * notifications.
+ * @param action the the handler that will process the given action
+ * type.
+ *
+ * @return the previous value of the actionHandler for the given actionType,
+ * if one existed, NULL if the actionType is a new one
+ */
+ public Object addAction(NotificationAction action)
+ {
+ return actionsTable.put(action.getActionType(), action);
+ }
+
+ /**
+ * Removes the action corresponding to the given <tt>actionType</tt>.
+ *
+ * @param actionType one of NotificationService.ACTION_XXX constants
+ */
+ public void removeAction(String actionType)
+ {
+ actionsTable.remove(actionType);
+ }
+
+ /**
+ * Returns the set of actions registered for this event notification.
+ *
+ * @return the set of actions registered for this event notification
+ */
+ public Map<String, NotificationAction> getActions()
+ {
+ return actionsTable;
+ }
+
+ /**
+ * Returns the <tt>Action</tt> corresponding to the given
+ * <tt>actionType</tt>.
+ *
+ * @param actionType one of NotificationService.ACTION_XXX constants
+ *
+ * @return the <tt>Action</tt> corresponding to the given
+ * <tt>actionType</tt>
+ */
+ public NotificationAction getAction(String actionType)
+ {
+ return actionsTable.get(actionType);
+ }
+
+ /**
+ * Indicates if this event notification is currently active.
+ *
+ * @return true if this event notification is active, false otherwise.
+ */
+ public boolean isActive()
+ {
+ return isActive;
+ }
+
+ /**
+ * Activates or deactivates this event notification.
+ *
+ * @param isActive indicates if this event notification is active
+ */
+ public void setActive(boolean isActive)
+ {
+ this.isActive = isActive;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/notification/NotificationAction.java b/src/net/java/sip/communicator/service/notification/NotificationAction.java
new file mode 100644
index 0000000..50106a5
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/NotificationAction.java
@@ -0,0 +1,95 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+/**
+ * Base class for actions of a notification.
+ *
+ * @author Ingo Bauersachs
+ */
+public abstract class NotificationAction
+{
+ /**
+ * The sound action type indicates that a sound would be played, when a
+ * notification is fired.
+ */
+ public static final String ACTION_SOUND = "SoundAction";
+
+ /**
+ * The popup message action type indicates that a window (or a systray
+ * popup), containing the corresponding notification message would be poped
+ * up, when a notification is fired.
+ */
+ public static final String ACTION_POPUP_MESSAGE = "PopupMessageAction";
+
+ /**
+ * The log message action type indicates that a message would be logged,
+ * when a notification is fired.
+ */
+ public static final String ACTION_LOG_MESSAGE = "LogMessageAction";
+
+ /**
+ * The command action type indicates that a command would be executed,
+ * when a notification is fired.
+ */
+ public static final String ACTION_COMMAND = "CommandAction";
+
+ /**
+ * Indicates if this handler is enabled.
+ */
+ private boolean isEnabled = true;
+
+ /**
+ * The action type name.
+ */
+ private String actionType;
+
+ /**
+ * Creates a new instance of this class.
+ * @param actionType The action type name.
+ */
+ protected NotificationAction(String actionType)
+ {
+ this.actionType = actionType;
+ }
+
+ /**
+ * Return the action type name.
+ * @return the action type name.
+ */
+ public String getActionType()
+ {
+ return actionType;
+ }
+
+ /**
+ * Returns TRUE if this notification action handler is enabled and FALSE
+ * otherwise. While the notification handler for the sound action type is
+ * disabled no sounds will be played when the <tt>fireNotification</tt>
+ * method is called.
+ *
+ * @return TRUE if this notification action handler is enabled and FALSE
+ * otherwise
+ */
+ public boolean isEnabled()
+ {
+ return isEnabled;
+ }
+
+ /**
+ * Enables or disables this notification handler. While the notification
+ * handler for the sound action type is disabled no sounds will be played
+ * when the <tt>fireNotification</tt> method is called.
+ *
+ * @param isEnabled TRUE to enable this notification handler, FALSE to
+ * disable it.
+ */
+ public void setEnabled(boolean isEnabled)
+ {
+ this.isEnabled = isEnabled;
+ }
+} \ No newline at end of file
diff --git a/src/net/java/sip/communicator/service/notification/NotificationActionHandler.java b/src/net/java/sip/communicator/service/notification/NotificationActionHandler.java
deleted file mode 100644
index 3adcd87..0000000
--- a/src/net/java/sip/communicator/service/notification/NotificationActionHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.sip.communicator.service.notification;
-
-/**
- * The <tt>NotificationActionHandler</tt> is the parent interface of all specific
- * notification handlers used for handling different action types. This
- * interface is used in the NotificationService in all methods dealing with
- * action handlers.
- *
- * @author Yana Stamcheva
- */
-public interface NotificationActionHandler
-{
- /**
- * Returns TRUE if this notification action handler is enabled and FALSE
- * otherwise. While the notification handler for an action type is disabled
- * no notifications will be fired for this action type.
- *
- * @return TRUE if this notification action handler is enabled and FALSE
- * otherwise
- */
- public boolean isEnabled();
-
- /**
- * Enables or disables this notification handler. While the notification
- * handler for an action type is disabled no notifications will be fired
- * for this action type.
- *
- * @param isEnabled TRUE to enable this notification handler, FALSE to
- * disable it.
- */
- public void setEnabled(boolean isEnabled);
-}
diff --git a/src/net/java/sip/communicator/service/notification/NotificationHandler.java b/src/net/java/sip/communicator/service/notification/NotificationHandler.java
new file mode 100644
index 0000000..b130c4e
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/NotificationHandler.java
@@ -0,0 +1,24 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+/**
+ * The <tt>NotificationActionHandler</tt> is the parent interface of all specific
+ * notification handlers used for handling different action types. This
+ * interface is used in the NotificationService in all methods dealing with
+ * action handlers.
+ *
+ * @author Yana Stamcheva
+ */
+public interface NotificationHandler
+{
+ /**
+ * Gets the type of this handler.
+ * @return the type of this handler.
+ */
+ String getActionType();
+}
diff --git a/src/net/java/sip/communicator/service/notification/NotificationService.java b/src/net/java/sip/communicator/service/notification/NotificationService.java
index cb0e2a5..37bc71e 100644
--- a/src/net/java/sip/communicator/service/notification/NotificationService.java
+++ b/src/net/java/sip/communicator/service/notification/NotificationService.java
@@ -6,8 +6,6 @@
*/
package net.java.sip.communicator.service.notification;
-import java.util.*;
-
/**
* This service is previewed for use by bundles that implement some kind of
* user notification (e.g. playing sounds, poping systray tooltips, or
@@ -23,237 +21,78 @@ import java.util.*;
public interface NotificationService
{
/**
- * The log message action type indicates that a message would be logged,
- * when a notification is fired.
- */
- public static final String ACTION_LOG_MESSAGE = "LogMessageAction";
-
- /**
- * The popup message action type indicates that a window (or a systray
- * popup), containing the corresponding notification message would be poped
- * up, when a notification is fired.
- */
- public static final String ACTION_POPUP_MESSAGE = "PopupMessageAction";
-
- /**
- * The sound action type indicates that a sound would be played, when a
- * notification is fired.
- */
- public static final String ACTION_SOUND = "SoundAction";
-
- /**
- * The command action type indicates that a command would be executed,
- * when a notification is fired.
- */
- public static final String ACTION_COMMAND = "CommandAction";
-
- /**
- * Default event type for receiving messages.
- */
- public static final String INCOMING_MESSAGE = "IncomingMessage";
-
- /**
- * Default event type for receiving calls (incoming calls).
- */
- public static final String INCOMING_CALL = "IncomingCall";
-
- /**
- * Default event type for outgoing calls.
- */
- public static final String OUTGOING_CALL = "OutgoingCall";
-
- /**
- * Default event type for a busy call.
- */
- public static final String BUSY_CALL = "BusyCall";
-
- /**
- * Default event type for dialing.
- */
- public static final String DIALING = "Dialing";
-
- /**
- * Default event type for hanging up calls.
- */
- public static final String HANG_UP = "HangUp";
-
- /**
- * Default event type for
- * proactive notifications (typing notifications when chatting).
- */
- public static final String PROACTIVE_NOTIFICATION = "ProactiveNotification";
-
- /**
- * Default event type when a secure message received.
- */
- public static final String SECURITY_MESSAGE = "SecurityMessage";
-
- /**
- * Default event type for activated security on a call.
- */
- public static final String CALL_SECURITY_ON = "CallSecurityOn";
-
- /**
- * Default event type for security error on a call.
- */
- public static final String CALL_SECURITY_ERROR = "CallSecurityError";
-
- /**
- * Default event type for incoming file transfers.
- */
- public static final String INCOMING_FILE = "IncomingFile";
-
- /**
- * Default event type for call been saved using a recorder.
- */
- public static final String CALL_SAVED = "CallSaved";
-
- /**
- * Creates a <tt>SoundNotificationHandler</tt>, by specifying the
- * path pointing to the sound file and the loop interval if the sound should
- * be played in loop. If the sound should be played just once the loop
- * interval should be set to -1. The <tt>SoundNotificationHandler</tt> is
- * the one that would take care of playing the sound, when a notification
- * is fired.
- *
- * @param soundFileDescriptor the path pointing to the sound file
- * @param loopInterval the interval of milliseconds to repeat the sound in
- * loop
- * @return the <tt>SoundNotificationHandler</tt> is the one, that would take
- * care of playing the given sound, when a notification is fired
- */
- public SoundNotificationHandler createSoundNotificationHandler(
- String soundFileDescriptor,
- int loopInterval);
-
- /**
- * Creates a <tt>PopupMessageNotificationHandler</tt>, by specifying the
- * default message to show, when no message is provided to the
- * <tt>fireNotification</tt> method. The
- * <tt>PopupMessageNotificationHandler</tt> is the one that would take care
- * of showing a popup message (through the systray service for example),
- * when a notification is fired.
- *
- * @param defaultMessage the message to show if not message is provided to
- * the <tt>fireNotification</tt> method
- * @return the <tt>PopupMessageNotificationHandler</tt> is the one, that
- * would take care of showing a popup message (through the systray service
- * for example), when a notification is fired.
- */
- public PopupMessageNotificationHandler createPopupMessageNotificationHandler(
- String defaultMessage);
-
- /**
- * Creates a <tt>LogMessageNotificationHandler</tt>, by specifying the
- * type of the log (error, trace, info, etc.). The
- * <tt>LogMessageNotificationHandler</tt> is the one that would take care
- * of logging a message (through the application log system), when a
- * notification is fired.
- *
- * @param logType the type of the log (error, trace, etc.). One of the types
- * defined in the <tt>LogMessageNotificationHandler</tt> interface
- * @return the <tt>LogMessageNotificationHandler</tt> is the one, that would
- * take care of logging a message (through the application log system), when
- * a notification is fired.
- */
- public LogMessageNotificationHandler createLogMessageNotificationHandler(
- String logType);
-
- /**
- * Creates a <tt>CommandNotificationHandler</tt>, by specifying the path to
- * the command file to execute, when a notification is fired. The
- * <tt>CommandNotificationHandler</tt> is the one that would take care
- * of executing the given program, when a notification is fired.
- *
- * @param commandFileDescriptor the path to the file containing the program
- * to execute
- * @return the <tt>CommandNotificationHandler</tt> is the one, that would
- * take care of executing a program, when a notification is fired.
- */
- public CommandNotificationHandler createCommandNotificationHandler(
- String commandFileDescriptor);
-
- /**
* Registers a notification for the given <tt>eventType</tt> by specifying
- * the type of the action to be performed when a notification is fired for
- * this event and the corresponding <tt>handler</tt> that should be used to
- * handle the action. Unlike the other <tt>registerNotificationForEvent</tt>
+ * the action to be performed when a notification is fired for this event.
+ *
+ * Unlike the other <tt>registerNotificationForEvent</tt>
* method, this one allows the user to specify its own
- * <tt>NotificationHandler</tt>, which would be used to handle notifications
+ * <tt>NotificationAction</tt>, which would be used to handle notifications
* for the specified <tt>actionType</tt>.
*
* @param eventType the name of the event (as defined by the plug-in that's
* registering it) that we are setting an action for.
- * @param actionType the type of the action that is to be executed when the
- * specified event occurs (could be one of the ACTION_XXX fields).
- * @param handler the <tt>NotificationActionHandler</tt>, which would be
+ * @param action the <tt>NotificationAction</tt>, which would be
* used to perform the notification action.
- * @throws IllegalArgumentException if the specified <tt>handler</tt> do not
- * correspond to the given <tt>actionType</tt>.
*/
- public void registerNotificationForEvent( String eventType,
- String actionType,
- NotificationActionHandler handler)
- throws IllegalArgumentException;
-
+ public void registerNotificationForEvent(String eventType,
+ NotificationAction action);
+
/**
- * Registers a Default notification for the given <tt>eventType</tt> by specifying
- * the type of the action to be performed when a notification is fired for
- * this event and the corresponding <tt>handler</tt> that should be used to
- * handle the action. Unlike the other
- * <tt>registerDefaultNotificationForEvent</tt>
- * method, this one allows the user to specify its own
- * <tt>NotificationHandler</tt>, which would be used to handle notifications
- * for the specified <tt>actionType</tt>.
- * Default events are stored or executed at first run or when they are
- * missing in the configuration. Also the registered default events
- * are used when restoreDefaults is called.
+ * Registers a default notification for the given <tt>eventType</tt> by
+ * specifying the action to be performed when a notification is fired for
+ * this event.
+ *
+ * Unlike the other <tt>registerDefaultNotificationForEvent</tt> method,
+ * this one allows the user to specify its own <tt>NotificationAction</tt>,
+ * which would be used to handle notifications.
+ *
+ * Default events are stored or executed at first run or when they are
+ * missing in the configuration. Also the registered default events are used
+ * when restoreDefaults is called.
*
* @param eventType the name of the event (as defined by the plug-in that's
- * registering it) that we are setting an action for.
- * @param actionType the type of the action that is to be executed when the
- * specified event occurs (could be one of the ACTION_XXX fields).
+ * registering it) that we are setting an action for.
* @param handler the <tt>NotificationActionHandler</tt>, which would be
- * used to perform the notification action.
- * @throws IllegalArgumentException if the specified <tt>handler</tt> do not
- * correspond to the given <tt>actionType</tt>.
+ * used to perform the notification action.
*/
- public void registerDefaultNotificationForEvent( String eventType,
- String actionType,
- NotificationActionHandler handler)
- throws IllegalArgumentException;
-
+ public void registerDefaultNotificationForEvent(String eventType,
+ NotificationAction handler);
+
/**
- * Registers a default notification for the given <tt>eventType</tt> by specifying
- * the type of the action to be performed when a notification is fired for
- * this event, the <tt>actionDescriptor</tt> for sound and command actions
- * and the <tt>defaultMessage</tt> for popup and log actions. Actions
- * registered by this method would be handled by some default
+ * Registers a default notification for the given <tt>eventType</tt> by
+ * specifying the type of the action to be performed when a notification is
+ * fired for this event, the <tt>actionDescriptor</tt> for sound and command
+ * actions and the <tt>defaultMessage</tt> for popup and log actions.
+ *
+ * Actions registered by this method would be handled by some default
* <tt>NotificationHandler</tt>s, declared by the implementation.
* <p>
* The method allows registering more than one actionType for a specific
- * event. Setting twice the same <tt>actionType</tt> for the same
- * <tt>eventType</tt> however would cause the first setting to be
+ * event. Setting the same <tt>actionType</tt> for the same
+ * <tt>eventType</tt> twice however would cause the first setting to be
* overridden.
- * Default events are stored or executed at first run or when they are
- * missing in the configuration. Also the registered default events
+ *
+ * Default events are stored or executed at first run or when
+ * they are missing in the configuration. Also the registered default events
* are used when restoreDefaults is called.
- *
+ *
* @param eventType the name of the event (as defined by the plug-in that's
- * registering it) that we are setting an action for.
+ * registering it) that we are setting an action for.
* @param actionType the type of the action that is to be executed when the
- * specified event occurs (could be one of the ACTION_XXX fields).
+ * specified event occurs (could be one of the ACTION_XXX
+ * fields).
* @param actionDescriptor a String containing a description of the action
- * (a URI to the sound file for audio notifications or a command line for
- * exec action types) that should be executed when the action occurs.
+ * (a URI to the sound file for audio notifications or a command
+ * line for exec action types) that should be executed when the
+ * action occurs.
* @param defaultMessage the default message to use if no specific message
- * has been provided when firing the notification.
+ * has been provided when firing the notification.
*/
- public void registerDefaultNotificationForEvent( String eventType,
- String actionType,
- String actionDescriptor,
- String defaultMessage);
-
+ public void registerDefaultNotificationForEvent(String eventType,
+ String actionType,
+ String actionDescriptor,
+ String defaultMessage);
+
/**
* Registers a notification for the given <tt>eventType</tt> by specifying
* the type of the action to be performed when a notification is fired for
@@ -263,44 +102,46 @@ public interface NotificationService
* <tt>NotificationHandler</tt>s, declared by the implementation.
* <p>
* The method allows registering more than one actionType for a specific
- * event. Setting twice the same <tt>actionType</tt> for the same
- * <tt>eventType</tt> however would cause the first setting to be
+ * event. Setting the same <tt>actionType</tt> for the same
+ * <tt>eventType</tt> twice however would cause the first setting to be
* overridden.
- *
+ *
* @param eventType the name of the event (as defined by the plug-in that's
- * registering it) that we are setting an action for.
+ * registering it) that we are setting an action for.
* @param actionType the type of the action that is to be executed when the
- * specified event occurs (could be one of the ACTION_XXX fields).
+ * specified event occurs (could be one of the ACTION_XXX
+ * fields).
* @param actionDescriptor a String containing a description of the action
- * (a URI to the sound file for audio notifications or a command line for
- * exec action types) that should be executed when the action occurs.
+ * (a URI to the sound file for audio notifications or a command
+ * line for exec action types) that should be executed when the
+ * action occurs.
* @param defaultMessage the default message to use if no specific message
- * has been provided when firing the notification.
+ * has been provided when firing the notification.
*/
public void registerNotificationForEvent( String eventType,
String actionType,
String actionDescriptor,
String defaultMessage);
-
+
/**
* Deletes all registered events and actions
* and registers and saves the default events as current.
*/
public void restoreDefaults();
-
+
/**
- * Removes the given <tt>eventType</tt> from the list of event notifications.
- * This means that we delete here all registered notifications for the given
- * <tt>eventType</tt>.
+ * Removes the given <tt>eventType</tt> from the list of event
+ * notifications. This means that we delete here all registered
+ * notifications for the given <tt>eventType</tt>.
* <p>
* This method does nothing if the given <tt>eventType</tt> is not contained
* in the list of registered event types.
- *
+ *
* @param eventType the name of the event (as defined by the plugin that's
- * registering it) to be removed.
+ * registering it) to be removed.
*/
public void removeEventNotification(String eventType);
-
+
/**
* Removes the event notification corresponding to the specified
* <tt>actionType</tt> and <tt>eventType</tt>.
@@ -309,57 +150,40 @@ public interface NotificationService
* <tt>actionType</tt> are not contained in the list of registered types.
*
* @param eventType the name of the event (as defined by the plugin that's
- * registering it) for which we'll remove the notification.
+ * registering it) for which we'll remove the notification.
* @param actionType the type of the action that is to be executed when the
- * specified event occurs (could be one of the ACTION_XXX fields).
+ * specified event occurs (could be one of the ACTION_XXX
+ * fields).
*/
public void removeEventNotificationAction( String eventType,
String actionType);
/**
* Returns an iterator over a list of all events registered in this
- * notification service. Each line in the returned list consists of
- * a String, representing the name of the event (as defined by the plugin
- * that registered it).
- *
- * @return an iterator over a list of all events registered in this
- * notifications service
- */
- public Iterator<String> getRegisteredEvents();
-
- /**
- * Returns a Map containing all action types (as keys) and actionDescriptors
- * (as values) that have been registered for <tt>eventType</tt>.
- * <p>
- * This method returns <b>null</b> if the given <tt>eventType</tt> is not
- * contained in the list of registered event types.
+ * notification service. Each line in the returned list consists of a
+ * String, representing the name of the event (as defined by the plugin that
+ * registered it).
*
- * @param eventType the name of the event that we'd like to retrieve actions
- * for.
- * @return a <tt>Map</tt> containing the <tt>actionType</tt>s (as keys) and
- * <tt>actionHandler</tt>s (as values) that should be executed when
- * an event with the specified name has occurred, or null if no actions
- * have been defined for <tt>eventType</tt>.
+ * @return an iterator over a list of all events registered in this
+ * notifications service
*/
- public Map<String, NotificationActionHandler> getEventNotifications(
- String eventType);
+ public Iterable<String> getRegisteredEvents();
/**
- * Returns the <tt>NotificationActionHandler</tt> corresponding to the given
- * event and action types.
+ * Returns the <tt>NotificationAction</tt> corresponding to the given event
+ * and action type.
* <p>
* This method returns <b>null</b> if the given <tt>eventType</tt> or
* <tt>actionType</tt> are not contained in the list of registered types.
- *
+ *
* @param eventType the type of the event that we'd like to retrieve.
* @param actionType the type of the action that we'd like to retrieve a
- * descriptor for.
- * @return the <tt>NotificationActionHandler</tt> corresponding to the given
- * event and action types
+ * descriptor for.
+ * @return the <tt>NotificationAction</tt> corresponding to the given event
+ * and action type
*/
- public NotificationActionHandler getEventNotificationActionHandler(
- String eventType,
- String actionType);
+ public NotificationAction getEventNotificationAction(String eventType,
+ String actionType);
/**
* Registers a listener that would be notified of changes that have occurred
@@ -382,6 +206,26 @@ public interface NotificationService
NotificationChangeListener listener);
/**
+ * Adds an object that executes the actual action of a notification action.
+ * @param handler The handler that executes the action.
+ */
+ public void addActionHandler(NotificationHandler handler);
+
+ /**
+ * Removes an object that executes the actual action of notification action.
+ * @param actionType The handler type to remove.
+ */
+ public void removeActionHandler(String actionType);
+
+ /**
+ * Gets at list of handler for the specified action type.
+ *
+ * @param actionType the type for which the list of handlers should be
+ * retrieved or <tt>null</tt> if all handlers shall be returned.
+ */
+ public Iterable<NotificationHandler> getActionHandlers(String actionType);
+
+ /**
* Fires all notifications registered for the specified <tt>eventType</tt>
* using <tt>message</tt> as a notification message wherever appropriate
* (e.g. systray notifications, logs, etc.)
diff --git a/src/net/java/sip/communicator/service/notification/NotificationServiceActivator.java b/src/net/java/sip/communicator/service/notification/NotificationServiceActivator.java
new file mode 100644
index 0000000..6599a16
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/NotificationServiceActivator.java
@@ -0,0 +1,77 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+import net.java.sip.communicator.service.configuration.*;
+import net.java.sip.communicator.util.*;
+
+import org.osgi.framework.*;
+
+/**
+ * The <tt>NotificationActivator</tt> is the activator of the notification
+ * bundle.
+ *
+ * @author Yana Stamcheva
+ */
+public class NotificationServiceActivator
+ implements BundleActivator
+{
+ private final Logger logger
+ = Logger.getLogger(NotificationServiceActivator.class);
+
+ protected static BundleContext bundleContext;
+ private static ConfigurationService configService;
+ private ServiceRegistration notificationService;
+
+ public void start(BundleContext bc) throws Exception
+ {
+ bundleContext = bc;
+
+ try
+ {
+ logger.logEntry();
+ logger.info("Notification Service...[ STARTED ]");
+
+ notificationService = bundleContext.registerService(
+ NotificationService.class.getName(),
+ new NotificationServiceImpl(),
+ null);
+
+ logger.info("Notification Service ...[REGISTERED]");
+ }
+ finally
+ {
+ logger.logExit();
+ }
+ }
+
+ public void stop(BundleContext bc) throws Exception
+ {
+ notificationService.unregister();
+ logger.info("Notification Service ...[STOPPED]");
+ }
+
+ /**
+ * Returns the <tt>ConfigurationService</tt> obtained from the bundle
+ * context.
+ * @return the <tt>ConfigurationService</tt> obtained from the bundle
+ * context
+ */
+ public static ConfigurationService getConfigurationService()
+ {
+ if(configService == null)
+ {
+ ServiceReference configReference = bundleContext
+ .getServiceReference(ConfigurationService.class.getName());
+
+ configService = (ConfigurationService) bundleContext
+ .getService(configReference);
+ }
+
+ return configService;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/service/notification/NotificationServiceImpl.java
new file mode 100644
index 0000000..1b7e382
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/NotificationServiceImpl.java
@@ -0,0 +1,975 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+import java.util.*;
+
+import net.java.sip.communicator.service.configuration.*;
+import net.java.sip.communicator.service.notification.event.*;
+import net.java.sip.communicator.util.*;
+import static net.java.sip.communicator.service.notification.NotificationAction.*;
+import static net.java.sip.communicator.service.notification.event.NotificationActionTypeEvent.*;
+import static net.java.sip.communicator.service.notification.event.NotificationEventTypeEvent.*;
+
+/**
+ * The implementation of the <tt>NotificationService</tt>.
+ *
+ * @author Yana Stamcheva
+ */
+class NotificationServiceImpl
+ implements NotificationService
+{
+ private final Logger logger
+ = Logger.getLogger(NotificationServiceImpl.class);
+
+ private final ConfigurationService configService =
+ NotificationServiceActivator.getConfigurationService();
+
+ private static final String NOTIFICATIONS_PREFIX
+ = "net.java.sip.communicator.impl.notifications";
+
+ /**
+ * A set of all registered event notifications.
+ */
+ private final Map<String, Notification> notifications
+ = new HashMap<String, Notification>();
+
+ /**
+ * A set of all registered event notifications.
+ */
+ private final Map<String, Notification> defaultNotifications
+ = new HashMap<String, Notification>();
+
+ /**
+ * Contains the notification handler per action type.
+ */
+ private final Map<String, NotificationHandler> handlers
+ = new HashMap<String, NotificationHandler>();
+
+ /**
+ * A list of all registered <tt>NotificationChangeListener</tt>s.
+ */
+ private final List<NotificationChangeListener> changeListeners
+ = new Vector<NotificationChangeListener>();
+
+ /**
+ * Creates an instance of <tt>NotificationServiceImpl</tt> by loading all
+ * previously saved notifications.
+ */
+ NotificationServiceImpl()
+ {
+ // Load all previously saved notifications.
+ this.loadNotifications();
+ }
+
+ /**
+ * Creates a new <tt>EventNotification</tt> or obtains the corresponding
+ * existing one and registers a new action in it.
+ *
+ * @param eventType the name of the event (as defined by the plugin that's
+ * registering it) that we are setting an action for.
+ * @param action the <tt>NotificationAction</tt> responsible for
+ * handling the given <tt>actionType</tt>
+ */
+ public void registerNotificationForEvent( String eventType,
+ NotificationAction action)
+ {
+ Notification notification = null;
+
+ if(notifications.containsKey(eventType))
+ notification = notifications.get(eventType);
+ else
+ {
+ notification = new Notification(eventType);
+ notifications.put(eventType, notification);
+
+ this.fireNotificationEventTypeEvent(
+ EVENT_TYPE_ADDED, eventType);
+ }
+
+ Object existingAction = notification.addAction(action);
+
+ // We fire the appropriate event depending on whether this is an
+ // already existing actionType or a new one.
+ if (existingAction != null)
+ {
+ fireNotificationActionTypeEvent(
+ ACTION_CHANGED,
+ eventType,
+ action);
+ }
+ else
+ {
+ fireNotificationActionTypeEvent(
+ ACTION_ADDED,
+ eventType,
+ action);
+ }
+
+ // Save the notification through the ConfigurationService.
+ this.saveNotification( eventType,
+ action,
+ true,
+ false);
+ }
+
+ /**
+ * Creates a new <tt>EventNotification</tt> or obtains the corresponding
+ * existing one and registers a new action in it.
+ *
+ * @param eventType the name of the event (as defined by the plugin that's
+ * registering it) that we are setting an action for.
+ * @param actionType the type of the action that is to be executed when the
+ * specified event occurs (could be one of the ACTION_XXX fields).
+ * @param actionDescriptor a String containing a description of the action
+ * (a URI to the sound file for audio notifications or a command line for
+ * exec action types) that should be executed when the action occurs.
+ * @param defaultMessage the default message to use if no specific message
+ * has been provided when firing the notification.
+ */
+ public void registerNotificationForEvent( String eventType,
+ String actionType,
+ String actionDescriptor,
+ String defaultMessage)
+ {
+ if (logger.isDebugEnabled())
+ logger.debug("Registering event " + eventType + "/" +
+ actionType + "/" + actionDescriptor + "/" + defaultMessage);
+
+ if (actionType.equals(ACTION_SOUND))
+ {
+ registerNotificationForEvent (eventType,
+ new SoundNotificationAction(actionDescriptor, -1));
+ }
+ else if (actionType.equals(ACTION_LOG_MESSAGE))
+ {
+ registerNotificationForEvent (eventType,
+ new LogMessageNotificationAction(
+ LogMessageNotificationAction.INFO_LOG_TYPE));
+ }
+ else if (actionType.equals(ACTION_POPUP_MESSAGE))
+ {
+ registerNotificationForEvent (eventType,
+ new PopupMessageNotificationAction(defaultMessage));
+ }
+ else if (actionType.equals(ACTION_COMMAND))
+ {
+ registerNotificationForEvent (eventType,
+ new CommandNotificationAction(actionDescriptor));
+ }
+ }
+
+ /**
+ * Removes the <tt>EventNotification</tt> corresponding to the given
+ * <tt>eventType</tt> from the table of registered event notifications.
+ *
+ * @param eventType the name of the event (as defined by the plugin that's
+ * registering it) to be removed.
+ */
+ public void removeEventNotification(String eventType)
+ {
+ notifications.remove(eventType);
+
+ this.fireNotificationEventTypeEvent(
+ EVENT_TYPE_REMOVED, eventType);
+ }
+
+ /**
+ * Removes the given actionType from the list of actions registered for the
+ * given <tt>eventType</tt>.
+ *
+ * @param eventType the name of the event (as defined by the plugin that's
+ * registering it) for which we'll remove the notification.
+ * @param actionType the type of the action that is to be executed when the
+ * specified event occurs (could be one of the ACTION_XXX fields).
+ */
+ public void removeEventNotificationAction( String eventType,
+ String actionType)
+ {
+ Notification notification
+ = notifications.get(eventType);
+
+ if(notification == null)
+ return;
+
+ NotificationAction action = notification.getAction(actionType);
+
+ if(action == null)
+ return;
+
+ notification.removeAction(actionType);
+
+ saveNotification(
+ eventType,
+ action,
+ false,
+ false);
+
+ fireNotificationActionTypeEvent(
+ ACTION_REMOVED,
+ eventType,
+ action);
+ }
+
+ /**
+ * Returns an iterator over a list of all events registered in this
+ * notification service. Each line in the returned list consists of
+ * a String, representing the name of the event (as defined by the plugin
+ * that registered it).
+ *
+ * @return an iterator over a list of all events registered in this
+ * notifications service
+ */
+ public Iterable<String> getRegisteredEvents()
+ {
+ return Collections.unmodifiableSet(
+ notifications.keySet());
+ }
+
+ /**
+ * Returns the notification action corresponding to the given
+ * <tt>eventType</tt> and <tt>actionType</tt>.
+ *
+ * @param eventType the type of the event that we'd like to retrieve.
+ * @param actionType the type of the action that we'd like to retrieve a
+ * descriptor for.
+ * @return the notification action of the action to be executed
+ * when an event of the specified type has occurred.
+ */
+ public NotificationAction getEventNotificationAction(
+ String eventType,
+ String actionType)
+ {
+ Notification notification = notifications.get(eventType);
+
+ if(notification == null)
+ return null;
+
+ return notification.getAction(actionType);
+ }
+
+ /**
+ * Adds the given <tt>listener</tt> to the list of change listeners.
+ *
+ * @param listener the listener that we'd like to register to listen for
+ * changes in the event notifications stored by this service.
+ */
+ public void addNotificationChangeListener(
+ NotificationChangeListener listener)
+ {
+ synchronized (changeListeners)
+ {
+ changeListeners.add(listener);
+ }
+ }
+
+ /**
+ * Removes the given <tt>listener</tt> from the list of change listeners.
+ *
+ * @param listener the listener that we'd like to remove
+ */
+ public void removeNotificationChangeListener(
+ NotificationChangeListener listener)
+ {
+ synchronized (changeListeners)
+ {
+ changeListeners.remove(listener);
+ }
+ }
+
+ /**
+ * Adds an object that executes the actual action of a notification action.
+ * If the same action type is added twice, the last added wins.
+ *
+ * @param handler The handler that executes the action.
+ */
+ public void addActionHandler(NotificationHandler handler)
+ {
+ if(handler == null)
+ throw new IllegalArgumentException("handler cannot be null");
+
+ synchronized(handlers)
+ {
+ handlers.put(handler.getActionType(), handler);
+ }
+ }
+
+ /**
+ * Removes an object that executes the actual action of notification action.
+ * @param actionType The handler type to remove.
+ */
+ public void removeActionHandler(String actionType)
+ {
+ if(actionType == null)
+ throw new IllegalArgumentException("actionType cannot be null");
+
+ synchronized(handlers)
+ {
+ handlers.remove(actionType);
+ }
+ }
+
+ /**
+ * Gets a list of handler for the specified action type.
+ *
+ * @param actionType the type for which the list of handlers should be
+ * retrieved or <tt>null</tt> if all handlers shall be returned.
+ */
+ public Iterable<NotificationHandler> getActionHandlers(String actionType)
+ {
+ if (actionType != null)
+ return Collections.singleton(handlers.get(actionType));
+ else
+ return handlers.values();
+ }
+
+ /**
+ * If there is a registered event notification of the given
+ * <tt>eventType</tt> and the event notification is currently activated, the
+ * list of registered actions is executed.
+ *
+ * @param eventType the type of the event that we'd like to fire a
+ * notification for.
+ * @param title the title of the given message
+ * @param message the message to use if and where appropriate (e.g. with
+ * systray or log notification.)
+ * @param icon the icon to show in the notification if and where appropriate
+ * @param tag additional info to be used by the notification handler
+ */
+ public void fireNotification(
+ String eventType,
+ String title,
+ String message,
+ byte[] icon,
+ Object tag)
+ {
+ Notification notification = notifications.get(eventType);
+ if(notification == null || !notification.isActive())
+ return;
+
+ for(NotificationAction action : notification.getActions().values())
+ {
+ String actionType = action.getActionType();
+ if(!action.isEnabled() || !handlers.containsKey(actionType))
+ continue;
+
+ NotificationHandler handler = handlers.get(actionType);
+ if (actionType.equals(ACTION_POPUP_MESSAGE))
+ {
+ ((PopupMessageNotificationHandler) handler)
+ .popupMessage((PopupMessageNotificationAction) action,
+ title, message, icon, tag);
+ }
+ else if (actionType.equals(ACTION_LOG_MESSAGE))
+ {
+ ((LogMessageNotificationHandler) handler)
+ .logMessage((LogMessageNotificationAction) action,
+ message);
+ }
+ else if (actionType.equals(ACTION_SOUND))
+ {
+ ((SoundNotificationHandler) handler)
+ .start((SoundNotificationAction) action);
+ }
+ else if (actionType.equals(ACTION_COMMAND))
+ {
+ ((CommandNotificationHandler) handler)
+ .execute((CommandNotificationAction) action);
+ }
+ }
+ }
+
+ /**
+ * If there is a registered event notification of the given
+ * <tt>eventType</tt> and the event notification is currently activated, we
+ * go through the list of registered actions and execute them.
+ *
+ * @param eventType the type of the event that we'd like to fire a
+ * notification for.
+ */
+ public void fireNotification(String eventType)
+ {
+ this.fireNotification(eventType, null, null, null, null);
+ }
+
+ /**
+ * Saves the event notification given by these parameters through the
+ * <tt>ConfigurationService</tt>.
+ *
+ * @param eventType the name of the event
+ * @param actionType the type of action
+ * @param action the notification action to change
+ */
+ private void saveNotification( String eventType,
+ NotificationAction action,
+ boolean isActive,
+ boolean isDefault)
+ {
+ String eventTypeNodeName = null;
+ String actionTypeNodeName = null;
+
+ List<String> eventTypes = configService
+ .getPropertyNamesByPrefix(NOTIFICATIONS_PREFIX, true);
+
+ for (String eventTypeRootPropName : eventTypes)
+ {
+ String eType = configService.getString(eventTypeRootPropName);
+ if(eType.equals(eventType))
+ eventTypeNodeName = eventTypeRootPropName;
+ }
+
+ // If we didn't find the given event type in the configuration we save
+ // it here.
+ if(eventTypeNodeName == null)
+ {
+ eventTypeNodeName = NOTIFICATIONS_PREFIX
+ + ".eventType"
+ + Long.toString(System.currentTimeMillis());
+
+ configService.setProperty(eventTypeNodeName, eventType);
+ }
+
+ // if we set active/inactive for the whole event notification
+ if(action == null)
+ {
+ configService.setProperty(
+ eventTypeNodeName + ".active",
+ Boolean.toString(isActive));
+ return;
+ }
+
+ // Go through contained actions.
+ String actionPrefix = eventTypeNodeName + ".actions";
+
+ List<String> actionTypes = configService
+ .getPropertyNamesByPrefix(actionPrefix, true);
+
+ for (String actionTypeRootPropName : actionTypes)
+ {
+ String aType = configService.getString(actionTypeRootPropName);
+ if(aType.equals(action.getActionType()))
+ actionTypeNodeName = actionTypeRootPropName;
+ }
+
+ Map<String, Object> configProperties = new HashMap<String, Object>();
+
+ // If we didn't find the given actionType in the configuration we save
+ // it here.
+ if(actionTypeNodeName == null)
+ {
+ actionTypeNodeName = actionPrefix
+ + ".actionType"
+ + Long.toString(System.currentTimeMillis());
+
+ configProperties.put(actionTypeNodeName, action.getActionType());
+ }
+
+ if(action instanceof SoundNotificationAction)
+ {
+ SoundNotificationAction soundAction
+ = (SoundNotificationAction) action;
+
+ configProperties.put(
+ actionTypeNodeName + ".soundFileDescriptor",
+ soundAction.getDescriptor());
+
+ configProperties.put(
+ actionTypeNodeName + ".loopInterval",
+ soundAction.getLoopInterval());
+ }
+ else if(action instanceof PopupMessageNotificationAction)
+ {
+ PopupMessageNotificationAction messageAction
+ = (PopupMessageNotificationAction) action;
+
+ configProperties.put(
+ actionTypeNodeName + ".defaultMessage",
+ messageAction.getDefaultMessage());
+ }
+ else if(action instanceof LogMessageNotificationAction)
+ {
+ LogMessageNotificationAction logMessageAction
+ = (LogMessageNotificationAction) action;
+
+ configProperties.put(
+ actionTypeNodeName + ".logType",
+ logMessageAction.getLogType());
+ }
+ else if(action instanceof CommandNotificationAction)
+ {
+ CommandNotificationAction commandAction
+ = (CommandNotificationAction) action;
+
+ configProperties.put(
+ actionTypeNodeName + ".commandDescriptor",
+ commandAction.getDescriptor());
+ }
+
+ configProperties.put(
+ actionTypeNodeName + ".enabled",
+ Boolean.toString(isActive));
+
+ configProperties.put(
+ actionTypeNodeName + ".default",
+ Boolean.toString(isDefault));
+
+ configService.setProperties(configProperties);
+ }
+
+ /**
+ * Loads all previously saved event notifications.
+ */
+ private void loadNotifications()
+ {
+ List<String> eventTypes = configService
+ .getPropertyNamesByPrefix(NOTIFICATIONS_PREFIX, true);
+
+ for (String eventTypeRootPropName : eventTypes)
+ {
+ boolean isEventActive =
+ isEnabled(eventTypeRootPropName + ".active");
+
+ String eventType
+ = configService.getString(eventTypeRootPropName);
+
+ List<String> actions = configService
+ .getPropertyNamesByPrefix(
+ eventTypeRootPropName + ".actions", true);
+
+ for (String actionPropName : actions)
+ {
+ String actionType = configService.getString(actionPropName);
+
+ NotificationAction action = null;
+
+ if(actionType.equals(ACTION_SOUND))
+ {
+ String soundFileDescriptor
+ = configService.getString(
+ actionPropName + ".soundFileDescriptor");
+
+ String loopInterval
+ = configService.getString(
+ actionPropName + ".loopInterval");
+
+ action = new SoundNotificationAction(
+ soundFileDescriptor,
+ Integer.parseInt(loopInterval));
+ }
+ else if(actionType.equals(ACTION_POPUP_MESSAGE))
+ {
+ String defaultMessage
+ = configService.getString(
+ actionPropName + ".defaultMessage");
+
+ action = new PopupMessageNotificationAction(defaultMessage);
+ }
+ else if(actionType.equals(ACTION_LOG_MESSAGE))
+ {
+ String logType
+ = configService.getString(
+ actionPropName + ".logType");
+
+ action = new LogMessageNotificationAction(logType);
+ }
+ else if(actionType.equals(ACTION_COMMAND))
+ {
+ String commandDescriptor
+ = configService.getString(
+ actionPropName + ".commandDescriptor");
+
+ action = new CommandNotificationAction(commandDescriptor);
+ }
+
+ action.setEnabled(isEnabled(actionPropName + ".enabled"));
+
+ // Load the data in the notifications table.
+ Notification notification = notifications.get(eventType);
+ if(notification == null)
+ {
+ notification = new Notification(eventType);
+ notifications.put(eventType, notification);
+ }
+ notification.setActive(isEventActive);
+ notification.addAction(action);
+ }
+ }
+ }
+
+ private boolean isEnabled(String configProperty)
+ {
+ Object isEnabledObj = configService.getProperty(configProperty);
+
+ // if setting is missing we accept it is true
+ // this way we not affect old saved settings
+ if(isEnabledObj == null)
+ return true;
+ else
+ return Boolean.parseBoolean((String)isEnabledObj);
+ }
+
+ /**
+ * Finds the <tt>EventNotification</tt> corresponding to the given
+ * <tt>eventType</tt> and marks it as activated/deactivated.
+ *
+ * @param eventType the name of the event, which actions should be activated
+ * /deactivated.
+ * @param isActive indicates whether to activate or deactivate the actions
+ * related to the specified <tt>eventType</tt>.
+ */
+ public void setActive(String eventType, boolean isActive)
+ {
+ Notification eventNotification
+ = notifications.get(eventType);
+
+ if(eventNotification == null)
+ return;
+
+ eventNotification.setActive(isActive);
+ saveNotification(eventType, null, isActive, false);
+ }
+
+ /**
+ * Finds the <tt>EventNotification</tt> corresponding to the given
+ * <tt>eventType</tt> and returns its isActive status.
+ *
+ * @param eventType the name of the event (as defined by the plugin that's
+ * registered it) that we are checking.
+ * @return <code>true</code> if actions for the specified <tt>eventType</tt>
+ * are activated, <code>false</code> - otherwise. If the given
+ * <tt>eventType</tt> is not contained in the list of registered event
+ * types - returns <code>false</code>.
+ */
+ public boolean isActive(String eventType)
+ {
+ Notification eventNotification
+ = notifications.get(eventType);
+
+ if(eventNotification == null)
+ return false;
+
+ return eventNotification.isActive();
+ }
+
+ /**
+ * Notifies all registered <tt>NotificationChangeListener</tt>s that a
+ * <tt>NotificationEventTypeEvent</tt> has occurred.
+ *
+ * @param eventType the type of the event, which is one of EVENT_TYPE_XXX
+ * constants declared in the <tt>NotificationEventTypeEvent</tt> class.
+ * @param sourceEventType the <tt>eventType</tt>, for which this event is
+ * about
+ */
+ private void fireNotificationEventTypeEvent(String eventType,
+ String sourceEventType)
+ {
+ if (logger.isDebugEnabled())
+ logger.debug("Dispatching NotificationEventType Change. Listeners="
+ + changeListeners.size()
+ + " evt=" + eventType);
+
+ NotificationEventTypeEvent event
+ = new NotificationEventTypeEvent(this, eventType, sourceEventType);
+
+ for (NotificationChangeListener listener : changeListeners)
+ {
+ if (eventType.equals(EVENT_TYPE_ADDED))
+ {
+ listener.eventTypeAdded(event);
+ }
+ else if (eventType.equals(EVENT_TYPE_REMOVED))
+ {
+ listener.eventTypeRemoved(event);
+ }
+ }
+ }
+
+ /**
+ * Notifies all registered <tt>NotificationChangeListener</tt>s that a
+ * <tt>NotificationActionTypeEvent</tt> has occurred.
+ *
+ * @param eventType the type of the event, which is one of ACTION_XXX
+ * constants declared in the <tt>NotificationActionTypeEvent</tt> class.
+ * @param sourceEventType the <tt>eventType</tt>, which is the parent of the
+ * action
+ * @param action the notification action
+ */
+ private void fireNotificationActionTypeEvent(
+ String eventType,
+ String sourceEventType,
+ NotificationAction action)
+ {
+ NotificationActionTypeEvent event
+ = new NotificationActionTypeEvent( this,
+ eventType,
+ sourceEventType,
+ action);
+
+
+ for(NotificationChangeListener listener : changeListeners)
+ {
+ if (eventType.equals(ACTION_ADDED))
+ {
+ listener.actionAdded(event);
+ }
+ else if (eventType.equals(ACTION_REMOVED))
+ {
+ listener.actionRemoved(event);
+ }
+ else if (eventType.equals(ACTION_CHANGED))
+ {
+ listener.actionChanged(event);
+ }
+ }
+ }
+
+ private boolean isDefault(String eventType, String actionType)
+ {
+ List<String> eventTypes = configService
+ .getPropertyNamesByPrefix(NOTIFICATIONS_PREFIX, true);
+
+ for (String eventTypeRootPropName : eventTypes)
+ {
+ String eType
+ = configService.getString(eventTypeRootPropName);
+
+ if(!eType.equals(eventType))
+ continue;
+
+ List<String> actions = configService
+ .getPropertyNamesByPrefix(
+ eventTypeRootPropName + ".actions", true);
+
+ for (String actionPropName : actions)
+ {
+ String aType
+ = configService.getString(actionPropName);
+
+ if(!aType.equals(actionType))
+ continue;
+
+ Object isDefaultdObj =
+ configService.getProperty(actionPropName + ".default");
+
+ // if setting is missing we accept it is true
+ // this way we override old saved settings
+ if(isDefaultdObj == null)
+ return true;
+ else
+ return Boolean.parseBoolean((String)isDefaultdObj);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Creates a new default <tt>EventNotification</tt> or obtains the
+ * corresponding existing one and registers a new action in it.
+ *
+ * @param eventType the name of the event (as defined by the plugin that's
+ * registering it) that we are setting an action for.
+ * @param action the <tt>NotificationAction</tt> to register
+ */
+ public void registerDefaultNotificationForEvent(
+ String eventType,
+ NotificationAction action)
+ {
+ if(isDefault(eventType, action.getActionType()))
+ {
+ NotificationAction h =
+ getEventNotificationAction(eventType,
+ action.getActionType());
+
+ boolean isNew = false;
+ if(h == null)
+ {
+ isNew = true;
+ h = action;
+ }
+
+ this.saveNotification( eventType,
+ action,
+ h.isEnabled(),
+ true);
+
+ Notification notification = null;
+
+ if(notifications.containsKey(eventType))
+ notification = notifications.get(eventType);
+ else
+ {
+ notification = new Notification(eventType);
+ notifications.put(eventType, notification);
+ }
+
+ notification.addAction(action);
+
+ // We fire the appropriate event depending on whether this is an
+ // already existing actionType or a new one.
+ fireNotificationActionTypeEvent(
+ isNew
+ ? ACTION_ADDED
+ : ACTION_CHANGED,
+ eventType,
+ action);
+ }
+
+ // now store this default events if we want to restore them
+ Notification notification = null;
+
+ if(defaultNotifications.containsKey(eventType))
+ notification = defaultNotifications.get(eventType);
+ else
+ {
+ notification = new Notification(eventType);
+
+ defaultNotifications.put(eventType, notification);
+ }
+
+ notification.addAction(action);
+ }
+
+ /**
+ * Creates a new default <tt>EventNotification</tt> or obtains the corresponding
+ * existing one and registers a new action in it.
+ *
+ * @param eventType the name of the event (as defined by the plugin that's
+ * registering it) that we are setting an action for.
+ * @param actionType the type of the action that is to be executed when the
+ * specified event occurs (could be one of the ACTION_XXX fields).
+ * @param actionDescriptor a String containing a description of the action
+ * (a URI to the sound file for audio notifications or a command line for
+ * exec action types) that should be executed when the action occurs.
+ * @param defaultMessage the default message to use if no specific message
+ * has been provided when firing the notification.
+ */
+ public void registerDefaultNotificationForEvent( String eventType,
+ String actionType,
+ String actionDescriptor,
+ String defaultMessage)
+ {
+ if (logger.isDebugEnabled())
+ logger.debug("Registering default event " + eventType + "/" +
+ actionType + "/" + actionDescriptor + "/" + defaultMessage);
+
+ if(isDefault(eventType, actionType))
+ {
+ NotificationAction action =
+ getEventNotificationAction(eventType, actionType);
+ boolean isNew = false;
+
+ if(action == null)
+ {
+ isNew = true;
+
+ if (actionType.equals(ACTION_SOUND))
+ {
+ action = new SoundNotificationAction(actionDescriptor, -1);
+ }
+ else if (actionType.equals(ACTION_LOG_MESSAGE))
+ {
+ action = new LogMessageNotificationAction(
+ LogMessageNotificationAction.INFO_LOG_TYPE);
+ }
+ else if (actionType.equals(ACTION_POPUP_MESSAGE))
+ {
+ action = new PopupMessageNotificationAction(defaultMessage);
+ }
+ else if (actionType.equals(ACTION_COMMAND))
+ {
+ action = new CommandNotificationAction(actionDescriptor);
+ }
+ }
+
+ this.saveNotification( eventType,
+ action,
+ action.isEnabled(),
+ true);
+
+ Notification notification = null;
+
+ if(notifications.containsKey(eventType))
+ notification = notifications.get(eventType);
+ else
+ {
+ notification = new Notification(eventType);
+ notifications.put(eventType, notification);
+ }
+
+ notification.addAction(action);
+
+ // We fire the appropriate event depending on whether this is an
+ // already existing actionType or a new one.
+ fireNotificationActionTypeEvent(
+ isNew
+ ? ACTION_ADDED
+ : ACTION_CHANGED,
+ eventType,
+ action);
+ }
+
+ // now store this default events if we want to restore them
+ Notification notification = null;
+
+ if(defaultNotifications.containsKey(eventType))
+ notification = defaultNotifications.get(eventType);
+ else
+ {
+ notification = new Notification(eventType);
+ defaultNotifications.put(eventType, notification);
+ }
+
+ NotificationAction action = null;
+ if (actionType.equals(ACTION_SOUND))
+ {
+ action = new SoundNotificationAction(actionDescriptor, -1);
+ }
+ else if (actionType.equals(ACTION_LOG_MESSAGE))
+ {
+ action = new LogMessageNotificationAction(
+ LogMessageNotificationAction.INFO_LOG_TYPE);
+ }
+ else if (actionType.equals(ACTION_POPUP_MESSAGE))
+ {
+ action = new PopupMessageNotificationAction(defaultMessage);
+ }
+ else if (actionType.equals(ACTION_COMMAND))
+ {
+ action = new CommandNotificationAction(actionDescriptor);
+ }
+
+ notification.addAction(action);
+ }
+
+ /**
+ * Deletes all registered events and actions
+ * and registers and saves the default events as current.
+ */
+ public void restoreDefaults()
+ {
+ for (String eventType : new Vector<String>(notifications.keySet()))
+ {
+ Notification notification = notifications.get(eventType);
+
+ for (String actionType
+ : new Vector<String>(notification.getActions().keySet()))
+ removeEventNotificationAction(eventType, actionType);
+
+ removeEventNotification(eventType);
+ }
+
+ for (Map.Entry<String, Notification> entry
+ : defaultNotifications.entrySet())
+ {
+ String eventType = entry.getKey();
+ Notification notification = entry.getValue();
+
+ for (NotificationAction action : notification.getActions().values())
+ registerNotificationForEvent(eventType, action);
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/service/notification/PopupMessageNotificationAction.java b/src/net/java/sip/communicator/service/notification/PopupMessageNotificationAction.java
new file mode 100644
index 0000000..6f43ca2
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/PopupMessageNotificationAction.java
@@ -0,0 +1,41 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+/**
+ * An implementation of the <tt>PopupMessageNotificationHandler</tt> interface.
+ *
+ * @author Yana Stamcheva
+ */
+public class PopupMessageNotificationAction
+ extends NotificationAction
+{
+ private String defaultMessage;
+
+ /**
+ * Creates an instance of <tt>PopupMessageNotificationHandlerImpl</tt> by
+ * specifying the default message to use if no message is specified.
+ *
+ * @param defaultMessage the default message to use if no message is
+ * specified
+ */
+ public PopupMessageNotificationAction(String defaultMessage)
+ {
+ super(NotificationAction.ACTION_POPUP_MESSAGE);
+ this.defaultMessage = defaultMessage;
+ }
+
+ /**
+ * Return the default message to use if no message is specified.
+ *
+ * @return the default message to use if no message is specified.
+ */
+ public String getDefaultMessage()
+ {
+ return defaultMessage;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/notification/PopupMessageNotificationHandler.java b/src/net/java/sip/communicator/service/notification/PopupMessageNotificationHandler.java
index 6df0247..6327afc 100644
--- a/src/net/java/sip/communicator/service/notification/PopupMessageNotificationHandler.java
+++ b/src/net/java/sip/communicator/service/notification/PopupMessageNotificationHandler.java
@@ -6,8 +6,6 @@
*/
package net.java.sip.communicator.service.notification;
-import net.java.sip.communicator.service.systray.*;
-
/**
* The <tt>PopupMessageNotificationHandler</tt> interface is meant to be
* implemented by the notification bundle in order to provide handling of
@@ -16,21 +14,22 @@ import net.java.sip.communicator.service.systray.*;
* @author Yana Stamcheva
*/
public interface PopupMessageNotificationHandler
- extends NotificationActionHandler
+ extends NotificationHandler
{
/**
- * Returns the default message to be used when no message is provided to the
- * <tt>popupMessage</tt> method.
- *
- * @return the default message to be used when no message is provided to the
- * <tt>popupMessage</tt> method.
- */
- public String getDefaultMessage();
-
- /**
* Shows the given <tt>PopupMessage</tt>
*
- * @param message the message to show in the popup
+ * @param action the action to act upon
+ * @param title the title of the given message
+ * @param message the message to use if and where appropriate (e.g. with
+ * systray or log notification.)
+ * @param icon the icon to show in the notification if and where
+ * appropriate
+ * @param tag additional info to be used by the notification handler
*/
- public void popupMessage(PopupMessage message);
+ public void popupMessage(PopupMessageNotificationAction action,
+ String title,
+ String message,
+ byte[] icon,
+ Object tag);
}
diff --git a/src/net/java/sip/communicator/service/notification/SoundNotificationAction.java b/src/net/java/sip/communicator/service/notification/SoundNotificationAction.java
new file mode 100644
index 0000000..879c2f0
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/SoundNotificationAction.java
@@ -0,0 +1,75 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.service.notification;
+
+/**
+ * An implementation of the <tt>SoundNotificationHandlerImpl</tt> interface.
+ *
+ * @author Yana Stamcheva
+ */
+public class SoundNotificationAction
+ extends NotificationAction
+{
+ /**
+ * Interval of milliseconds to wait before repeating the sound. -1 means no
+ * repetition.
+ */
+ private int loopInterval;
+
+ /**
+ * the descriptor pointing to the sound to be played.
+ */
+ private String soundFileDescriptor;
+
+ /**
+ * Creates an instance of <tt>SoundNotification</tt> by
+ * specifying the sound file descriptor. The sound is played once.
+ *
+ * @param soundDescriptor the sound file descriptor
+ */
+ public SoundNotificationAction(String soundDescriptor)
+ {
+ this(soundDescriptor, -1);
+ }
+
+ /**
+ * Creates an instance of <tt>SoundNotification</tt> by
+ * specifying the sound file descriptor and the loop interval.
+ *
+ * @param soundDescriptor the sound file descriptor
+ * @param loopInterval the loop interval
+ */
+ public SoundNotificationAction( String soundDescriptor,
+ int loopInterval)
+ {
+ super(NotificationAction.ACTION_SOUND);
+ this.soundFileDescriptor = soundDescriptor;
+ this.loopInterval = loopInterval;
+ }
+
+ /**
+ * Returns the loop interval. This is the interval of milliseconds to wait
+ * before repeating the sound, when playing a sound in loop. By default this
+ * method returns -1.
+ *
+ * @return the loop interval
+ */
+ public int getLoopInterval()
+ {
+ return loopInterval;
+ }
+
+ /**
+ * Returns the descriptor pointing to the sound to be played.
+ *
+ * @return the descriptor pointing to the sound to be played.
+ */
+ public String getDescriptor()
+ {
+ return soundFileDescriptor;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/notification/SoundNotificationHandler.java b/src/net/java/sip/communicator/service/notification/SoundNotificationHandler.java
index 3dc13e6..f98cb6f 100644
--- a/src/net/java/sip/communicator/service/notification/SoundNotificationHandler.java
+++ b/src/net/java/sip/communicator/service/notification/SoundNotificationHandler.java
@@ -14,30 +14,15 @@ package net.java.sip.communicator.service.notification;
* @author Yana Stamcheva
*/
public interface SoundNotificationHandler
- extends NotificationActionHandler
+ extends NotificationHandler
{
/**
- * Returns the loop interval. This is the interval of milliseconds to wait
- * before repeating the sound, when playing a sound in loop. If this method
- * returns -1 the sound should not played in loop.
- *
- * @return the loop interval
- */
- public int getLoopInterval();
-
- /**
- * Returns the descriptor pointing to the sound to be played.
- *
- * @return the descriptor pointing to the sound to be played.
- */
- public String getDescriptor();
-
- /**
* Start playing the sound pointed by <tt>getDescriotor</tt>. This
* method should check the loopInterval value to distinguish whether to play
* a simple sound or to play it in loop.
+ * @param action the action to act upon
*/
- public void start();
+ public void start(SoundNotificationAction action);
/**
* Stops playing the sound pointing by <tt>getDescriptor</tt>. This method
diff --git a/src/net/java/sip/communicator/service/notification/event/NotificationActionTypeEvent.java b/src/net/java/sip/communicator/service/notification/event/NotificationActionTypeEvent.java
index 3bd7852..8773537 100644
--- a/src/net/java/sip/communicator/service/notification/event/NotificationActionTypeEvent.java
+++ b/src/net/java/sip/communicator/service/notification/event/NotificationActionTypeEvent.java
@@ -40,11 +40,6 @@ public class NotificationActionTypeEvent
public static final String ACTION_CHANGED = "ActionChanged";
/**
- * The type of the notification action that is being added.
- */
- private String sourceActionType = null;
-
- /**
* The type of the event that a new action is being added for.
*/
private String sourceEventType = null;
@@ -54,7 +49,7 @@ public class NotificationActionTypeEvent
* string) that will be performed when notifications are being fired for
* the corresponding event type.
*/
- private NotificationActionHandler actionHandler = null;
+ private NotificationAction actionHandler = null;
/**
* The type of this event. One of the static field constants declared in
@@ -69,35 +64,22 @@ public class NotificationActionTypeEvent
* @param eventType the type of this event. One of the static fields
* declared in this class
* @param sourceEventType the event type for which this event occured
- * @param sourceActionType the action type corresponding to this event
* @param actionHandler the <tt>NotificationActionHandler</tt> that handles
* the given action
*/
public NotificationActionTypeEvent( NotificationService source,
String eventType,
String sourceEventType,
- String sourceActionType,
- NotificationActionHandler actionHandler)
+ NotificationAction actionHandler)
{
super(source);
this.eventType = eventType;
this.sourceEventType = sourceEventType;
- this.sourceActionType = sourceActionType;
this.actionHandler = actionHandler;
}
/**
- * Returns the action type, for which this event is about.
- *
- * @return the action type, for which this event is about.
- */
- public String getSourceActionType()
- {
- return sourceActionType;
- }
-
- /**
* Returns the event type, to which the given action belongs.
*
* @return the event type, to which the given action belongs
@@ -114,7 +96,7 @@ public class NotificationActionTypeEvent
* @return the <tt>NotificationActionHandler</tt> that handles the action,
* for which this event is about.
*/
- public NotificationActionHandler getActionHandler()
+ public NotificationAction getActionHandler()
{
return actionHandler;
}
diff --git a/src/net/java/sip/communicator/service/notification/notification.manifest.mf b/src/net/java/sip/communicator/service/notification/notification.manifest.mf
new file mode 100644
index 0000000..33106a4
--- /dev/null
+++ b/src/net/java/sip/communicator/service/notification/notification.manifest.mf
@@ -0,0 +1,11 @@
+Bundle-Activator: net.java.sip.communicator.service.notification.NotificationServiceActivator
+Bundle-Name: Notifications
+Bundle-Description: An implementation of the Notification service.
+Bundle-Vendor: sip-communicator.org
+Bundle-Version: 0.0.1
+System-Bundle: yes
+Export-Package: net.java.sip.communicator.service.notification,
+ net.java.sip.communicator.service.notification.event
+Import-Package: org.osgi.framework,
+ net.java.sip.communicator.util,
+ net.java.sip.communicator.service.configuration