aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java
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/impl/notification/CommandNotificationHandlerImpl.java
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/impl/notification/CommandNotificationHandlerImpl.java')
-rw-r--r--src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java66
1 files changed, 11 insertions, 55 deletions
diff --git a/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java b/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java
index 6634a41..4ab6621 100644
--- a/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java
+++ b/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java
@@ -22,77 +22,33 @@ public class CommandNotificationHandlerImpl
private Logger logger
= Logger.getLogger(CommandNotificationHandlerImpl.class);
- private String commandDescriptor;
-
- private boolean isEnabled = true;
-
/**
- * Creates an instance of <tt>CommandNotificationHandlerImpl</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
+ * {@inheritDoc}
*/
- public CommandNotificationHandlerImpl(String commandDescriptor)
+ public String getActionType()
{
- this.commandDescriptor = commandDescriptor;
+ return NotificationAction.ACTION_COMMAND;
}
/**
- * Executes the <tt>command</tt>, given by the containing
- * <tt>commandDescriptor</tt>.
+ * Executes the command, given by the <tt>commandDescriptor</tt> of the
+ * action.
+ *
+ * @param action the action to act upon.
*/
- public void execute()
+ public void execute(CommandNotificationAction action)
{
- if(StringUtils.isNullOrEmpty(commandDescriptor, true))
+ if(StringUtils.isNullOrEmpty(action.getDescriptor(), true))
return;
try
{
- Runtime.getRuntime().exec(commandDescriptor);
+ Runtime.getRuntime().exec(action.getDescriptor());
}
catch (IOException e)
{
logger.error("Failed execute the following command: "
- + commandDescriptor, e);
+ + action.getDescriptor(), e);
}
}
-
- /**
- * Returns the command descriptor.
- *
- * @return the command descriptor
- */
- public String getDescriptor()
- {
- return commandDescriptor;
- }
-
- /**
- * Returns TRUE if this notification action handler is enabled and FALSE
- * otherwise. While the notification handler for the command action type
- * is disabled no programs will be executed 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 command action type is disabled no programs will be
- * executed 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;
- }
}