diff options
author | Yana Stamcheva <yana@jitsi.org> | 2007-08-22 15:58:08 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2007-08-22 15:58:08 +0000 |
commit | 5c8f2119360d839ae007ec5ba36855668f212637 (patch) | |
tree | d9de819667695ea07af3b37f81163354d7343583 /src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java | |
parent | 80b489dfea8ab16d81a958b9c8a033ff844bee97 (diff) | |
download | jitsi-5c8f2119360d839ae007ec5ba36855668f212637.zip jitsi-5c8f2119360d839ae007ec5ba36855668f212637.tar.gz jitsi-5c8f2119360d839ae007ec5ba36855668f212637.tar.bz2 |
notification service implementation
Diffstat (limited to 'src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java')
-rw-r--r-- | src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java b/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java new file mode 100644 index 0000000..fe01332 --- /dev/null +++ b/src/net/java/sip/communicator/impl/notification/CommandNotificationHandlerImpl.java @@ -0,0 +1,66 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.notification; + +import java.io.*; + +import net.java.sip.communicator.service.notification.*; +import net.java.sip.communicator.util.*; + +/** + * An implementation of the <tt>CommandNotificationHandler</tt> interface. + * + * @author Yana Stamcheva + */ +public class CommandNotificationHandlerImpl + implements CommandNotificationHandler +{ + private Logger logger + = Logger.getLogger(CommandNotificationHandlerImpl.class); + + private String commandDescriptor; + + /** + * 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 + */ + public CommandNotificationHandlerImpl(String commandDescriptor) + { + this.commandDescriptor = commandDescriptor; + } + + /** + * Executes the <tt>command</tt>, given by the containing + * <tt>commandDescriptor</tt>. + */ + public void execute() + { + try + { + Runtime.getRuntime().exec(commandDescriptor); + } + catch (IOException e) + { + logger.error("Failed execute the following command: " + + commandDescriptor, e); + } + } + + /** + * Returns the command descriptor. + * + * @return the command descriptor + */ + public String getDescriptor() + { + return commandDescriptor; + } +} |