org.subethamail.smtp.server
Class CommandHandler

java.lang.Object
  extended by org.subethamail.smtp.server.CommandHandler

public class CommandHandler
extends Object

This class manages execution of a SMTP command.

Author:
Jon Stevens, Scott Hernandez

Constructor Summary
CommandHandler()
           
CommandHandler(Collection<Command> availableCommands)
          Create a command handler with a specific set of commands.
 
Method Summary
 void addCommand(Command command)
          Adds or replaces the specified command.
 boolean containsCommand(String command)
           
 Command getCommand(String commandName)
          Returns the command object corresponding to the specified command name.
 HelpMessage getHelp(String command)
           
 Set<String> getVerbs()
           
 void handleCommand(Session context, String commandString)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandHandler

public CommandHandler()

CommandHandler

public CommandHandler(Collection<Command> availableCommands)
Create a command handler with a specific set of commands.

Parameters:
availableCommands - the available commands (not null) TLS note: wrap commands with RequireTLSCommandWrapper when appropriate.
Method Detail

addCommand

public void addCommand(Command command)
Adds or replaces the specified command.


getCommand

public Command getCommand(String commandName)
Returns the command object corresponding to the specified command name.

Parameters:
commandName - case insensitive name of the command.
Returns:
the command object, or null, if the command is unknown.

containsCommand

public boolean containsCommand(String command)

getVerbs

public Set<String> getVerbs()

handleCommand

public void handleCommand(Session context,
                          String commandString)
                   throws SocketTimeoutException,
                          IOException,
                          DropConnectionException
Throws:
SocketTimeoutException
IOException
DropConnectionException

getHelp

public HelpMessage getHelp(String command)
                    throws CommandException
Returns:
the HelpMessage object for the given command name (verb)
Throws:
CommandException


Copyright © 2006-2012. All Rights Reserved.