org.apache.james.smtpserver
Class SMTPHandler

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.smtpserver.SMTPHandler
All Implemented Interfaces:
org.apache.avalon.cornerstone.services.connection.ConnectionHandler, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.framework.logger.LogEnabled, SMTPSession

public class SMTPHandler
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements org.apache.avalon.cornerstone.services.connection.ConnectionHandler, org.apache.avalon.excalibur.pool.Poolable, SMTPSession

Provides SMTP functionality by carrying out the server side of the SMTP interaction.

Version:
CVS $Revision: 494012 $ $Date: 2007-01-08 10:23:58 +0000 (Mon, 08 Jan 2007) $

Field Summary
 
Fields inherited from interface org.apache.james.smtpserver.SMTPSession
CURRENT_HELO_MODE, MESG_FAILED, RCPT_LIST, SENDER
 
Constructor Summary
SMTPHandler()
           
 
Method Summary
 void abortMessage()
          this makes the message to be dropped inprotocol
 java.lang.String clearResponseBuffer()
          Clears the response buffer, returning the String of characters in the buffer.
 void endSession()
          this makes the session to close
 java.lang.String getCommandArgument()
          Returns currently process command argument
 java.lang.String getCommandName()
          Returns currently process command name
 SMTPHandlerConfigurationData getConfigurationData()
          Returns SMTPHandler service wide configuration
 java.io.InputStream getInputStream()
          Returns Inputstream for handling messages and commands
 Mail getMail()
          Returns Mail object for message handlers to process
 java.lang.String getRemoteHost()
          Returns host name of the client
 java.lang.String getRemoteIPAddress()
          Returns host ip address of the client
 java.lang.StringBuffer getResponseBuffer()
          Returns ResponseBuffer, this optimizes the unecessary creation of resources by each handler object
 java.lang.String getSessionID()
          Returns the SMTP session id
 java.util.HashMap getState()
          Returns Map that consists of the state of the SMTPSession
 java.lang.String getUser()
          Returns the user name associated with this SMTP interaction.
 Watchdog getWatchdog()
          Returns Watchdog object used for handling timeout
 void handleConnection(java.net.Socket connection)
           
 boolean isAuthRequired()
          Returns whether Authentication is required or not
 boolean isBlockListed()
          Returns the blocklisted status
 boolean isRelayingAllowed()
          Returns whether Relaying is allowed or not
 boolean isSessionEnded()
          Returns the session status
 java.lang.String readCommandLine()
          Reads a line of characters off the command line.
 void resetState()
          Resets message-specific, but not authenticated user, state.
 void setBlockListed(boolean blocklisted)
          Sets the blocklisted value
 void setHandlerChain(SMTPHandlerChain handlerChain)
          Sets the SMTPHandlerChain
 void setMail(Mail mail)
          Sets the MailImpl object for further processing
 void setUser(java.lang.String userID)
          Sets the user name associated with this SMTP interaction.
 boolean useHeloEhloEnforcement()
          Returns whether remote server needs to send HELO/EHLO
 void writeResponse(java.lang.String respString)
          Writes response string to the client
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMTPHandler

public SMTPHandler()
Method Detail

handleConnection

public void handleConnection(java.net.Socket connection)
                      throws java.io.IOException
Specified by:
handleConnection in interface org.apache.avalon.cornerstone.services.connection.ConnectionHandler
Throws:
java.io.IOException
See Also:
ConnectionHandler.handleConnection(Socket)

setHandlerChain

public void setHandlerChain(SMTPHandlerChain handlerChain)
Sets the SMTPHandlerChain

Parameters:
handlerChain - SMTPHandler object

writeResponse

public void writeResponse(java.lang.String respString)
Description copied from interface: SMTPSession
Writes response string to the client

Specified by:
writeResponse in interface SMTPSession
Parameters:
respString - String that needs to send to the client
See Also:
SMTPSession.writeResponse(String)

getCommandName

public java.lang.String getCommandName()
Description copied from interface: SMTPSession
Returns currently process command name

Specified by:
getCommandName in interface SMTPSession
Returns:
current command name
See Also:
SMTPSession.getCommandName()

getCommandArgument

public java.lang.String getCommandArgument()
Description copied from interface: SMTPSession
Returns currently process command argument

Specified by:
getCommandArgument in interface SMTPSession
Returns:
current command argument
See Also:
SMTPSession.getCommandArgument()

getMail

public Mail getMail()
Description copied from interface: SMTPSession
Returns Mail object for message handlers to process

Specified by:
getMail in interface SMTPSession
Returns:
Mail object
See Also:
SMTPSession.getMail()

setMail

public void setMail(Mail mail)
Description copied from interface: SMTPSession
Sets the MailImpl object for further processing

Specified by:
setMail in interface SMTPSession
Parameters:
mail - MailImpl object
See Also:
SMTPSession.setMail(Mail)

getRemoteHost

public java.lang.String getRemoteHost()
Description copied from interface: SMTPSession
Returns host name of the client

Specified by:
getRemoteHost in interface SMTPSession
Returns:
hostname of the client
See Also:
SMTPSession.getRemoteHost()

getRemoteIPAddress

public java.lang.String getRemoteIPAddress()
Description copied from interface: SMTPSession
Returns host ip address of the client

Specified by:
getRemoteIPAddress in interface SMTPSession
Returns:
host ip address of the client
See Also:
SMTPSession.getRemoteIPAddress()

endSession

public void endSession()
Description copied from interface: SMTPSession
this makes the session to close

Specified by:
endSession in interface SMTPSession
See Also:
SMTPSession.endSession()

isSessionEnded

public boolean isSessionEnded()
Description copied from interface: SMTPSession
Returns the session status

Specified by:
isSessionEnded in interface SMTPSession
Returns:
if the session is open or closed
See Also:
SMTPSession.isSessionEnded()

resetState

public void resetState()
Description copied from interface: SMTPSession
Resets message-specific, but not authenticated user, state.

Specified by:
resetState in interface SMTPSession
See Also:
SMTPSession.resetState()

getState

public java.util.HashMap getState()
Description copied from interface: SMTPSession
Returns Map that consists of the state of the SMTPSession

Specified by:
getState in interface SMTPSession
Returns:
map of the current SMTPSession state
See Also:
SMTPSession.getState()

getConfigurationData

public SMTPHandlerConfigurationData getConfigurationData()
Description copied from interface: SMTPSession
Returns SMTPHandler service wide configuration

Specified by:
getConfigurationData in interface SMTPSession
Returns:
SMTPHandlerConfigurationData
See Also:
SMTPSession.getConfigurationData()

isBlockListed

public boolean isBlockListed()
Description copied from interface: SMTPSession
Returns the blocklisted status

Specified by:
isBlockListed in interface SMTPSession
Returns:
blocklisted
See Also:
SMTPSession.isBlockListed()

setBlockListed

public void setBlockListed(boolean blocklisted)
Description copied from interface: SMTPSession
Sets the blocklisted value

Specified by:
setBlockListed in interface SMTPSession
See Also:
SMTPSession.setBlockListed(boolean)

isRelayingAllowed

public boolean isRelayingAllowed()
Description copied from interface: SMTPSession
Returns whether Relaying is allowed or not

Specified by:
isRelayingAllowed in interface SMTPSession
Returns:
the relaying status
See Also:
SMTPSession.isRelayingAllowed()

isAuthRequired

public boolean isAuthRequired()
Description copied from interface: SMTPSession
Returns whether Authentication is required or not

Specified by:
isAuthRequired in interface SMTPSession
Returns:
authentication required or not
See Also:
SMTPSession.isAuthRequired()

useHeloEhloEnforcement

public boolean useHeloEhloEnforcement()
Description copied from interface: SMTPSession
Returns whether remote server needs to send HELO/EHLO

Specified by:
useHeloEhloEnforcement in interface SMTPSession
Returns:
HELO/EHLO required or not
See Also:
SMTPSession.useHeloEhloEnforcement()

getUser

public java.lang.String getUser()
Description copied from interface: SMTPSession
Returns the user name associated with this SMTP interaction.

Specified by:
getUser in interface SMTPSession
Returns:
the user name
See Also:
SMTPSession.getUser()

setUser

public void setUser(java.lang.String userID)
Description copied from interface: SMTPSession
Sets the user name associated with this SMTP interaction.

Specified by:
setUser in interface SMTPSession
See Also:
org.apache.james.smtpserver.SMTPSession#setUser()

getResponseBuffer

public java.lang.StringBuffer getResponseBuffer()
Description copied from interface: SMTPSession
Returns ResponseBuffer, this optimizes the unecessary creation of resources by each handler object

Specified by:
getResponseBuffer in interface SMTPSession
Returns:
responseBuffer
See Also:
SMTPSession.getResponseBuffer()

clearResponseBuffer

public java.lang.String clearResponseBuffer()
Description copied from interface: SMTPSession
Clears the response buffer, returning the String of characters in the buffer.

Specified by:
clearResponseBuffer in interface SMTPSession
Returns:
the data in the response buffer
See Also:
SMTPSession.clearResponseBuffer()

readCommandLine

public final java.lang.String readCommandLine()
                                       throws java.io.IOException
Description copied from interface: SMTPSession
Reads a line of characters off the command line.

Specified by:
readCommandLine in interface SMTPSession
Returns:
the trimmed input line
Throws:
java.io.IOException - if an exception is generated reading in the input characters
See Also:
SMTPSession.readCommandLine()

getWatchdog

public Watchdog getWatchdog()
Description copied from interface: SMTPSession
Returns Watchdog object used for handling timeout

Specified by:
getWatchdog in interface SMTPSession
Returns:
Watchdog object
See Also:
SMTPSession.getWatchdog()

getInputStream

public java.io.InputStream getInputStream()
Description copied from interface: SMTPSession
Returns Inputstream for handling messages and commands

Specified by:
getInputStream in interface SMTPSession
Returns:
InputStream object
See Also:
SMTPSession.getInputStream()

getSessionID

public java.lang.String getSessionID()
Description copied from interface: SMTPSession
Returns the SMTP session id

Specified by:
getSessionID in interface SMTPSession
Returns:
SMTP session id
See Also:
SMTPSession.getSessionID()

abortMessage

public void abortMessage()
Description copied from interface: SMTPSession
this makes the message to be dropped inprotocol

Specified by:
abortMessage in interface SMTPSession
See Also:
SMTPSession.abortMessage()


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.