org.abstracthorizon.danube.support.logging.debug
Class DebugConsoleLoggingConnectionHandler

java.lang.Object
  extended by org.abstracthorizon.danube.support.logging.debug.DebugConsoleLoggingConnectionHandler
All Implemented Interfaces:
ConnectionHandler

public class DebugConsoleLoggingConnectionHandler
extends Object
implements ConnectionHandler

Connection handler that logs connection to a file.

Author:
Daniel Sendula

Field Summary
protected  Pattern addressPattern
          Client socket address pattern
protected  org.slf4j.Logger logger
          Logger
 
Constructor Summary
DebugConsoleLoggingConnectionHandler()
          Constructor
 
Method Summary
 String getAddressPattern()
          Returns address pattern.
 ConnectionHandler getConnectionHandler()
          Returns connection handler
 void handleConnection(Connection connection)
          This method wrapps connection to logging connection and passes it further.
 boolean isDirectional()
          Is logging directional or not
 boolean isLogging()
          Returns if logging is switched on or off.
 boolean isResolveRemoteHostNames()
          Returns if host names should be resolved or not.
 void setAddressPattern(String addressPatternString)
          Sets socket address pattern.
 void setConnectionHandler(ConnectionHandler connectionHandler)
          Sets connection handler
 void setDirectional(boolean directional)
          Sets for logging to be directional or not
 void setLogging(boolean logging)
          Switches logging on or off
 void setResolveRemoteHostNames(boolean resolveRemoteHostNames)
          Sets if remote host names are to be resolved or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger


addressPattern

protected Pattern addressPattern
Client socket address pattern

Constructor Detail

DebugConsoleLoggingConnectionHandler

public DebugConsoleLoggingConnectionHandler()
Constructor

Method Detail

getAddressPattern

public String getAddressPattern()
Returns address pattern.

Returns:
returns address pattern.

setAddressPattern

public void setAddressPattern(String addressPatternString)
Sets socket address pattern. Only socket host addresses (or names, see {@link #setResolveRemoteHostNames(boolean)) that match this pattern will create log files or temporary log files.

Parameters:
addressPatternString -

getConnectionHandler

public ConnectionHandler getConnectionHandler()
Returns connection handler

Returns:
connection handler

setConnectionHandler

public void setConnectionHandler(ConnectionHandler connectionHandler)
Sets connection handler

Parameters:
connectionHandler - connection handler

isDirectional

public boolean isDirectional()
Is logging directional or not

Returns:
if logging is directional

setDirectional

public void setDirectional(boolean directional)
Sets for logging to be directional or not

Parameters:
directional - is logging directional or not

isLogging

public boolean isLogging()
Returns if logging is switched on or off. If it is switched off no logging will occur for current connection

Returns:
if logging is switched on or off

setLogging

public void setLogging(boolean logging)
Switches logging on or off

Parameters:
logging - true if logging is to be switched on

isResolveRemoteHostNames

public boolean isResolveRemoteHostNames()
Returns if host names should be resolved or not. It is used in matching remote socket address (setAddressPattern(String))

Returns:
if host names should be resolved or not.

setResolveRemoteHostNames

public void setResolveRemoteHostNames(boolean resolveRemoteHostNames)
Sets if remote host names are to be resolved or not. It is used in matching remote socket address (setAddressPattern(String))

Parameters:
resolveRemoteHostNames -

handleConnection

public void handleConnection(Connection connection)
This method wrapps connection to logging connection and passes it further. Will connection be wrapped or not depetns on isLogging(), getAddressPattern() and #isTempLogging().

Specified by:
handleConnection in interface ConnectionHandler
Parameters:
connection - original connection


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.