hudson.plugins.im.bot
Class AbstractTextSendingCommand

java.lang.Object
  extended by hudson.plugins.im.bot.BotCommand
      extended by hudson.plugins.im.bot.AbstractTextSendingCommand
All Implemented Interfaces:
hudson.ExtensionPoint
Direct Known Subclasses:
AbortCommand, BuildCommand, CommentCommand, HealthCommand, SetAliasCommand, SnackCommand, StatusCommand, TestResultCommand, UserStatCommand

public abstract class AbstractTextSendingCommand
extends BotCommand

Abstract command for sending a reply back to the sender.

Author:
kutzi

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
AbstractTextSendingCommand()
           
 
Method Summary
 void executeCommand(Bot bot, IMChat chat, IMMessage message, Sender sender, java.lang.String[] args)
          Execute a command.
protected  java.lang.String getErrorReply(Sender sender, CommandException e)
           
protected  JobProvider getJobProvider()
           
protected abstract  java.lang.String getReply(Bot bot, Sender sender, java.lang.String[] args)
          Gets the text reply
 
Methods inherited from class hudson.plugins.im.bot.BotCommand
all, getCommandNames, getHelp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTextSendingCommand

public AbstractTextSendingCommand()
Method Detail

getJobProvider

protected JobProvider getJobProvider()

executeCommand

public final void executeCommand(Bot bot,
                                 IMChat chat,
                                 IMMessage message,
                                 Sender sender,
                                 java.lang.String[] args)
                          throws IMException
Execute a command.

Specified by:
executeCommand in class BotCommand
Parameters:
bot - The bot for which this command runs. Never null.
chat - the IMChat object, may be used to send reply messages
message - the original IMMessage
sender - the command sender
args - arguments passed to the command, where args[0] is the command name itself
Throws:
IMException - if anything goes wrong while communicating with the remote IM server

getReply

protected abstract java.lang.String getReply(Bot bot,
                                             Sender sender,
                                             java.lang.String[] args)
Gets the text reply

Parameters:
bot - The bot for which this command is currently operating. Never be null.
sender - the command sender
args - arguments passed to the command, where args[0] is the command name itself @throws RuntimeException in case of invalid args. This is automatically caught and reported to the sender

getErrorReply

protected java.lang.String getErrorReply(Sender sender,
                                         CommandException e)


Copyright © 2010. All Rights Reserved.