Write your own commands
Writing a JabberWatcher command is simple :
- a command is a class, or a package (list of classes). The main class of the command must extend org.wawax.jabberwatcher.commands.AbstractCommand

JabberWatcher provides several methods and services accessibles from your command.
Methods inherited from AbstractCommands :
- getParams() : contains all the command parameters in an hashtable.
- getUser() : get the current user object.
- getFrom() : return the sender’s jabberid.
- getLogger() : the log4j command logger. This variable is used to log message from your command, using the JabberWatcher’s logging system.
Services available :
- JabberConnexionService : manage connection with jabber server.
- JDBCService : provides access to JDBC backend.
Hello world command code :
package org.wawax.jabberwatcher.commands;
import org.wawax.jabberwatcher.exceptions.CommandParameterException;
import org.wawax.jabberwatcher.services.JabberConnexionService;
public class TestCommand extends AbstractCommand {
public void execute() {
JabberConnexionService.sendChat(getFrom(),”Hello world”);
}
public void preexecute() {
}
public void postexecute() {
}
public boolean checkParameters() throws CommandParameterException {
return false;
}
}