org.abstracthorizon.danube.support.logging
Class LoggingConnection

java.lang.Object
  extended by org.abstracthorizon.danube.connection.ConnectionWrapper
      extended by org.abstracthorizon.danube.support.logging.LoggingConnection
All Implemented Interfaces:
Adaptable, Connection

public class LoggingConnection
extends ConnectionWrapper

Logging connection

Author:
Daniel Sendula

Field Summary
protected  LoggingInputStream inputStream
          Wrapped input stream
protected  OutputStream logOutputStream
          Log output stream
protected  LoggingOutputStream outputStream
          Wrapped output stream
 
Fields inherited from class org.abstracthorizon.danube.connection.ConnectionWrapper
connection, logger
 
Constructor Summary
LoggingConnection(Connection connection, OutputStream logOutputStream, boolean directional, boolean temporaryLog)
          Constructor.
 
Method Summary
<T> T
adapt(Class<T> cls)
          Adopts this object using supplied adopter manager
 OutputStream getDebugOutputStream()
          Returns logger output stream.
 InputStream getInputStream()
          Retruns logged input stream
 OutputStream getOutputStream()
          Returns logged output stream
 boolean isLogging()
          Returns if logging is switched on or off
 boolean isTermporaryLog()
          Returns is logging temporary or not
 void setLogging(boolean logging)
          Turns logging on or off
 void setTemporaryLog(boolean temporaryLog)
          Sets flag if log is temporary or not
 
Methods inherited from class org.abstracthorizon.danube.connection.ConnectionWrapper
close, isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputStream

protected LoggingInputStream inputStream
Wrapped input stream


outputStream

protected LoggingOutputStream outputStream
Wrapped output stream


logOutputStream

protected OutputStream logOutputStream
Log output stream

Constructor Detail

LoggingConnection

public LoggingConnection(Connection connection,
                         OutputStream logOutputStream,
                         boolean directional,
                         boolean temporaryLog)
Constructor.

Parameters:
connection - wrapped connection
logOutputStream - log output stream
directional - is logging directional
temporaryLog - is log temporary log
Method Detail

adapt

public <T> T adapt(Class<T> cls)
Description copied from class: ConnectionWrapper
Adopts this object using supplied adopter manager

Specified by:
adapt in interface Adaptable
Overrides:
adapt in class ConnectionWrapper
Parameters:
cls - class to be adopted to
Returns:
this connection adopted to asked class

getInputStream

public InputStream getInputStream()
Retruns logged input stream

Returns:
logged input stream

getOutputStream

public OutputStream getOutputStream()
Returns logged output stream

Returns:
logged output stream

getDebugOutputStream

public OutputStream getDebugOutputStream()
Returns logger output stream. It is useful for making other log statements directly to it.

Returns:
logger output stream

setLogging

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

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

isLogging

public boolean isLogging()
Returns if logging is switched on or off

Returns:
true logging is switched on or off

setTemporaryLog

public void setTemporaryLog(boolean temporaryLog)
Sets flag if log is temporary or not

Parameters:
temporaryLog - is log temporary or not

isTermporaryLog

public boolean isTermporaryLog()
Returns is logging temporary or not

Returns:
is logging temporary or not


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