org.apache.james.socket
Class DelegatingJamesHandler

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.james.socket.AbstractJamesHandler
          extended by org.apache.james.socket.DelegatingJamesHandler
All Implemented Interfaces:
org.apache.avalon.cornerstone.services.connection.ConnectionHandler, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, ProtocolHandlerHelper

public class DelegatingJamesHandler
extends AbstractJamesHandler
implements ProtocolHandlerHelper

Common Handler code


Field Summary
protected  ProtocolHandler protocolHandler
           
 
Fields inherited from class org.apache.james.socket.AbstractJamesHandler
dnsServer, in, inReader, out, outs, remoteHost, remoteIP, socket, theWatchdog
 
Constructor Summary
DelegatingJamesHandler(ProtocolHandler delegated)
           
 
Method Summary
 void defaultErrorHandler(java.lang.RuntimeException e)
          Provides basic errorhandling cleanup.
protected  void errorHandler(java.lang.RuntimeException e)
          Method which will be colled on error
 org.apache.avalon.framework.logger.Logger getAvalonLogger()
          Provides logging facility to the handler.
 CRLFTerminatedReader getInputReader()
          Returns a CRLF terminated line reader
 java.io.InputStream getInputStream()
          Returns the raw input stream
 java.io.OutputStream getOutputStream()
          Returns the raw outputstream
 java.io.PrintWriter getOutputWriter()
          Returns the printwriter.
 java.lang.String getRemoteHost()
          getter for the remote hostname
 java.lang.String getRemoteIP()
          getter for the remote ip
 java.net.Socket getSocket()
          Provides access to the socket
 Watchdog getWatchdog()
          The watchdog is used to deal with timeouts.
 void handleProtocol()
          Handle the protocol
 void resetHandler()
          Resets the handler data to a basic state.
 void setConfigurationData(java.lang.Object theData)
          This method will be implemented checking for the correct class type.
 
Methods inherited from class org.apache.james.socket.AbstractJamesHandler
getName, handleConnection, initHandler, service, setDnsServer, setName, setStreamDumpDir, setWatchdog, toString, writeLoggedFlushedResponse, writeLoggedResponse
 
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, wait, wait, wait
 
Methods inherited from interface org.apache.james.socket.ProtocolHandlerHelper
getName, writeLoggedFlushedResponse, writeLoggedResponse
 

Field Detail

protocolHandler

protected ProtocolHandler protocolHandler
Constructor Detail

DelegatingJamesHandler

public DelegatingJamesHandler(ProtocolHandler delegated)
Method Detail

setConfigurationData

public void setConfigurationData(java.lang.Object theData)
This method will be implemented checking for the correct class type.

Specified by:
setConfigurationData in class AbstractJamesHandler
Parameters:
theData - Configuration Bean.

handleProtocol

public void handleProtocol()
                    throws java.io.IOException
Handle the protocol

Specified by:
handleProtocol in class AbstractJamesHandler
Throws:
java.io.IOException - get thrown if an IO error is detected

resetHandler

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

Specified by:
resetHandler in class AbstractJamesHandler

errorHandler

protected void errorHandler(java.lang.RuntimeException e)
Description copied from class: AbstractJamesHandler
Method which will be colled on error

Overrides:
errorHandler in class AbstractJamesHandler
Parameters:
e - the RuntimeException
See Also:
AbstractJamesHandler.errorHandler(java.lang.RuntimeException)

defaultErrorHandler

public void defaultErrorHandler(java.lang.RuntimeException e)
Description copied from interface: ProtocolHandlerHelper
Provides basic errorhandling cleanup.

Specified by:
defaultErrorHandler in interface ProtocolHandlerHelper
Parameters:
e - the runtimeexception
See Also:
ProtocolHandlerHelper.defaultErrorHandler(java.lang.RuntimeException)

getRemoteIP

public java.lang.String getRemoteIP()
Description copied from interface: ProtocolHandlerHelper
getter for the remote ip

Specified by:
getRemoteIP in interface ProtocolHandlerHelper
Returns:
remote ip
See Also:
ProtocolHandlerHelper.getRemoteIP()

getInputReader

public CRLFTerminatedReader getInputReader()
Description copied from interface: ProtocolHandlerHelper
Returns a CRLF terminated line reader

Specified by:
getInputReader in interface ProtocolHandlerHelper
Returns:
line reader
See Also:
ProtocolHandlerHelper.getInputReader()

getInputStream

public java.io.InputStream getInputStream()
Description copied from interface: ProtocolHandlerHelper
Returns the raw input stream

Specified by:
getInputStream in interface ProtocolHandlerHelper
Returns:
the raw inputstream
See Also:
ProtocolHandlerHelper.getInputStream()

getOutputStream

public java.io.OutputStream getOutputStream()
Description copied from interface: ProtocolHandlerHelper
Returns the raw outputstream

Specified by:
getOutputStream in interface ProtocolHandlerHelper
Returns:
outputstream
See Also:
ProtocolHandlerHelper.getOutputStream()

getOutputWriter

public java.io.PrintWriter getOutputWriter()
Description copied from interface: ProtocolHandlerHelper
Returns the printwriter.

Specified by:
getOutputWriter in interface ProtocolHandlerHelper
Returns:
the output printwriter
See Also:
ProtocolHandlerHelper.getOutputWriter()

getRemoteHost

public java.lang.String getRemoteHost()
Description copied from interface: ProtocolHandlerHelper
getter for the remote hostname

Specified by:
getRemoteHost in interface ProtocolHandlerHelper
Returns:
remote hostname
See Also:
ProtocolHandlerHelper.getRemoteHost()

getAvalonLogger

public org.apache.avalon.framework.logger.Logger getAvalonLogger()
Description copied from interface: ProtocolHandlerHelper
Provides logging facility to the handler.

Specified by:
getAvalonLogger in interface ProtocolHandlerHelper
Returns:
logger instance
See Also:
ProtocolHandlerHelper.getAvalonLogger()

getWatchdog

public Watchdog getWatchdog()
Description copied from interface: ProtocolHandlerHelper
The watchdog is used to deal with timeouts.

Specified by:
getWatchdog in interface ProtocolHandlerHelper
Returns:
the watchdog instance
See Also:
ProtocolHandlerHelper.getWatchdog()

getSocket

public java.net.Socket getSocket()
Description copied from interface: ProtocolHandlerHelper
Provides access to the socket

Specified by:
getSocket in interface ProtocolHandlerHelper
Returns:
socket
See Also:
ProtocolHandlerHelper.getSocket()


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