org.subethamail.smtp.server
Class CommandHandler

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

public class CommandHandler
extends java.lang.Object

This class manages execution of a SMTP command.

Author:
Jon Stevens

Constructor Summary
CommandHandler()
          Populates a default set of commands based on what is in the CommandRegistry.
CommandHandler(java.util.Collection<Command> availableCommands)
          Pass in a Collection of Command objects.
 
Method Summary
 void addCommand(Command command)
          Adds a new command to the map.
 boolean containsCommand(java.lang.String command)
          Does the map contain the named command?
protected  Command getCommandFromString(java.lang.String commandString)
          Given a string, find the Command object.
 void handleAuthChallenge(ConnectionContext context, java.lang.String commandString)
          Executes an auth command.
 void handleCommand(ConnectionContext context, java.lang.String commandString)
          Calls the execute method on a command.
 void handleCommand(ConnectionContext context, java.lang.String commandString, Command command)
          Calls the execute method on a command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandHandler

public CommandHandler()
Populates a default set of commands based on what is in the CommandRegistry.


CommandHandler

public CommandHandler(java.util.Collection<Command> availableCommands)
Pass in a Collection of Command objects.

Parameters:
availableCommands -
Method Detail

addCommand

public void addCommand(Command command)
Adds a new command to the map.

Parameters:
command -

containsCommand

public boolean containsCommand(java.lang.String command)
Does the map contain the named command?

Parameters:
command -
Returns:
true if the command exists

handleCommand

public void handleCommand(ConnectionContext context,
                          java.lang.String commandString)
                   throws java.net.SocketTimeoutException,
                          java.io.IOException
Calls the execute method on a command.

Parameters:
context -
commandString -
Throws:
java.net.SocketTimeoutException
java.io.IOException

handleCommand

public void handleCommand(ConnectionContext context,
                          java.lang.String commandString,
                          Command command)
                   throws java.net.SocketTimeoutException,
                          java.io.IOException
Calls the execute method on a command.

Parameters:
context -
commandString -
Throws:
java.net.SocketTimeoutException
java.io.IOException

handleAuthChallenge

public void handleAuthChallenge(ConnectionContext context,
                                java.lang.String commandString)
                         throws java.net.SocketTimeoutException,
                                java.io.IOException
Executes an auth command.

Parameters:
context -
commandString -
Throws:
java.net.SocketTimeoutException
java.io.IOException

getCommandFromString

protected Command getCommandFromString(java.lang.String commandString)
                                throws UnknownCommandException,
                                       InvalidCommandNameException
Given a string, find the Command object.

Parameters:
commandString -
Returns:
The command object.
Throws:
UnknownCommandException
InvalidCommandNameException


Copyright © 2011 SubEthaSMTP. All Rights Reserved. Build version: UNVERSIONED