org.apache.james.pop3server
Class POP3Handler

java.lang.Object
  extended by org.apache.james.pop3server.POP3Handler
All Implemented Interfaces:
POP3Session, ProtocolHandler

public class POP3Handler
extends java.lang.Object
implements POP3Session, ProtocolHandler

The handler class for POP3 connections.


Constructor Summary
POP3Handler()
           
 
Method Summary
 java.lang.String clearResponseBuffer()
          Clears the response buffer, returning the String of characters in the buffer.
 void endSession()
          this makes the session to close
 void errorHandler(java.lang.RuntimeException e)
          Provides errorHandling
 java.util.List getBackupUserMailbox()
          Returns the backup mailbox
 java.lang.String getCommandArgument()
          Returns currently process command argument
 java.lang.String getCommandName()
          Returns currently process command name
 POP3HandlerConfigurationData getConfigurationData()
          Returns POP3Handler service wide configuration
 int getHandlerState()
          Returns the current handler state
 java.io.OutputStream getOutputStream()
          Returns the raw output stream
 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.util.HashMap getState()
          Returns Map that consists of the state of the POP3Session
 java.lang.String getUser()
          Returns the user name associated with this POP3 interaction.
 MailRepository getUserInbox()
          Returns the current user inbox
 java.util.List getUserMailbox()
          Returns the mail list contained in the mailbox
 Watchdog getWatchdog()
          Returns Watchdog object used for handling timeout
 void handleProtocol()
          Handle the protocol
 boolean isSessionEnded()
          Returns the session status
 java.lang.String readCommandLine()
          Reads a line of characters off the command line.
 void resetHandler()
          Resets the handler data to a basic state.
 void resetState()
          Resets message-specific, but not authenticated user, state.
 void setBackupUserMailbox(java.util.List backupUserMailbox)
          Sets a new backup mailbox content
 void setConfigurationData(java.lang.Object theData)
          Set the configuration data for the handler.
 void setHandlerChain(POP3HandlerChain handlerChain)
          Sets the POP3HandlerChain
 void setHandlerState(int handlerState)
          Sets the new handler state
 void setProtocolHandlerHelper(ProtocolHandlerHelper phh)
          Injects the ProtocolHandlerHelper service
 void setUser(java.lang.String userID)
          Sets the user name associated with this POP3 interaction.
 void setUserInbox(MailRepository userInbox)
          Sets the user's mail repository
 void setUserMailbox(java.util.List userMailbox)
          Sets a new mailbox content
 void writeResponse(java.lang.String respString)
          Writes response string to the client
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POP3Handler

public POP3Handler()
Method Detail

setConfigurationData

public void setConfigurationData(java.lang.Object theData)
Set the configuration data for the handler.

Specified by:
setConfigurationData in interface ProtocolHandler
Parameters:
theData - the configuration data

handleProtocol

public void handleProtocol()
                    throws java.io.IOException
Description copied from interface: ProtocolHandler
Handle the protocol

Specified by:
handleProtocol in interface ProtocolHandler
Throws:
java.io.IOException - get thrown if an IO error is detected
See Also:
AbstractJamesHandler.handleProtocol()

errorHandler

public void errorHandler(java.lang.RuntimeException e)
Description copied from interface: ProtocolHandler
Provides errorHandling

Specified by:
errorHandler in interface ProtocolHandler
Parameters:
e - exception
See Also:
AbstractJamesHandler.errorHandler(java.lang.RuntimeException)

resetHandler

public void resetHandler()
Resets the handler data to a basic state.

Specified by:
resetHandler in interface ProtocolHandler

readCommandLine

public final java.lang.String readCommandLine()
                                       throws java.io.IOException
Reads a line of characters off the command line.

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

getRemoteHost

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

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

getRemoteIPAddress

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

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

endSession

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

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

isSessionEnded

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

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

resetState

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

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

getState

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

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

getUser

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

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

setUser

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

Specified by:
setUser in interface POP3Session
Parameters:
userID - the user name
See Also:
POP3Session.setUser(java.lang.String)

getResponseBuffer

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

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

clearResponseBuffer

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

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

getWatchdog

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

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

setHandlerChain

public void setHandlerChain(POP3HandlerChain handlerChain)
Sets the POP3HandlerChain

Parameters:
handlerChain - POP3Handler object

writeResponse

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

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

getCommandName

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

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

getCommandArgument

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

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

getConfigurationData

public POP3HandlerConfigurationData getConfigurationData()
Description copied from interface: POP3Session
Returns POP3Handler service wide configuration

Specified by:
getConfigurationData in interface POP3Session
Returns:
POP3HandlerConfigurationData
See Also:
POP3Session.getConfigurationData()

getHandlerState

public int getHandlerState()
Description copied from interface: POP3Session
Returns the current handler state

Specified by:
getHandlerState in interface POP3Session
Returns:
handler state
See Also:
POP3Session.getHandlerState()

setHandlerState

public void setHandlerState(int handlerState)
Description copied from interface: POP3Session
Sets the new handler state

Specified by:
setHandlerState in interface POP3Session
Parameters:
handlerState - state
See Also:
POP3Session.setHandlerState(int)

getUserInbox

public MailRepository getUserInbox()
Description copied from interface: POP3Session
Returns the current user inbox

Specified by:
getUserInbox in interface POP3Session
Returns:
MailRepository
See Also:
POP3Session.getUserInbox()

setUserInbox

public void setUserInbox(MailRepository userInbox)
Description copied from interface: POP3Session
Sets the user's mail repository

Specified by:
setUserInbox in interface POP3Session
Parameters:
userInbox - userInbox
See Also:
POP3Session.setUserInbox(org.apache.james.services.MailRepository)

getUserMailbox

public java.util.List getUserMailbox()
Description copied from interface: POP3Session
Returns the mail list contained in the mailbox

Specified by:
getUserMailbox in interface POP3Session
Returns:
mailbox content
See Also:
POP3Session.getUserMailbox()

setUserMailbox

public void setUserMailbox(java.util.List userMailbox)
Description copied from interface: POP3Session
Sets a new mailbox content

Specified by:
setUserMailbox in interface POP3Session
Parameters:
userMailbox - mailbox
See Also:
POP3Session.setUserMailbox(java.util.List)

getBackupUserMailbox

public java.util.List getBackupUserMailbox()
Description copied from interface: POP3Session
Returns the backup mailbox

Specified by:
getBackupUserMailbox in interface POP3Session
Returns:
list backup
See Also:
POP3Session.getBackupUserMailbox()

setBackupUserMailbox

public void setBackupUserMailbox(java.util.List backupUserMailbox)
Description copied from interface: POP3Session
Sets a new backup mailbox content

Specified by:
setBackupUserMailbox in interface POP3Session
Parameters:
backupUserMailbox - the mailbox backup
See Also:
POP3Session.setUserMailbox(List)

getOutputStream

public java.io.OutputStream getOutputStream()
Description copied from interface: POP3Session
Returns the raw output stream

Specified by:
getOutputStream in interface POP3Session
Returns:
the raw outputstream
See Also:
POP3Session.getOutputStream()

setProtocolHandlerHelper

public void setProtocolHandlerHelper(ProtocolHandlerHelper phh)
Description copied from interface: ProtocolHandler
Injects the ProtocolHandlerHelper service

Specified by:
setProtocolHandlerHelper in interface ProtocolHandler
Parameters:
phh - service
See Also:
ProtocolHandler.setProtocolHandlerHelper(org.apache.james.socket.ProtocolHandlerHelper)


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