com.sun.faban.harness.logging
Class LogHandler

java.lang.Object
  extended by com.sun.faban.harness.logging.LogHandler
All Implemented Interfaces:
ProtocolHandler

public class LogHandler
extends Object
implements ProtocolHandler

Protocol handler for log requests.

Author:
Ramesh Ramachandran

Constructor Summary
LogHandler()
           
 
Method Summary
 boolean doContinueResponse()
          Continues writing the response to the channel.
 boolean doProcessRequest(ByteBuffer buffer, int count)
          Analyzes the buffer and return read active status.
 boolean doProcessResponse()
          Creates and writes the response to the channel.
 boolean requestPending()
          Tests the handler whether it needs to further process this request.
 void setConfig(LogConfig config)
          Sets the config object.
 void setKey(SelectionKey key)
          Sets the selection key for subsequent invocations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogHandler

public LogHandler()
Method Detail

setConfig

public void setConfig(LogConfig config)
Sets the config object.

Specified by:
setConfig in interface ProtocolHandler
Parameters:
config - The singleton config object

setKey

public void setKey(SelectionKey key)
Sets the selection key for subsequent invocations.

Specified by:
setKey in interface ProtocolHandler
Parameters:
key - The nio selection key

doProcessRequest

public boolean doProcessRequest(ByteBuffer buffer,
                                int count)
Analyzes the buffer and return read active status.

Specified by:
doProcessRequest in interface ProtocolHandler
Parameters:
buffer - The buffer to look at
count - The number of new bytes in the buffer
Returns:
True if still active, false if done processing

doProcessResponse

public boolean doProcessResponse()
                          throws IOException
Creates and writes the response to the channel. Returns write active status. This method should return true if and only if the non-blocking channel cannot take all the response to be written.

Specified by:
doProcessResponse in interface ProtocolHandler
Returns:
True if still active, false if done processing
Throws:
IOException - Cannot write response to channel

doContinueResponse

public boolean doContinueResponse()
                           throws IOException
Continues writing the response to the channel. This method is only called if the initial write did not manage to write everything to the non-blocking channel.

Specified by:
doContinueResponse in interface ProtocolHandler
Returns:
True if still active, false if done processing
Throws:
IOException - Cannot write response to channel

requestPending

public boolean requestPending()
Tests the handler whether it needs to further process this request.

Specified by:
requestPending in interface ProtocolHandler
Returns:
True if the handler still needs to proceed, false if it is done