© 2002 - Lorne Brinkman
www.TheObjectGuy.com
Lorne@TheObjectGuy.com

com.bitfactoryinc.logging
Class LogSocketReader

java.lang.Object
  |
  +--com.bitfactoryinc.logging.LogSocketReader

public class LogSocketReader
extends java.lang.Object
implements java.lang.Runnable

An instance of this class will read LogEntries from a Socket, and subsequently log the LogEntries to it's logger. Instances are typically created via the static method startListening(aPort,aLogSocketReaderReceiver).


Inner Class Summary
static class LogSocketReader.Listener
           
 
Field Summary
private  Logger logger
           
private  java.net.Socket socket
           
private  java.lang.Thread thread
           
 
Constructor Summary
LogSocketReader(java.net.Socket aSocket)
          The best way to create instances of this class is to use the static method StartListening
LogSocketReader(java.net.Socket aSocket, Logger aLogger)
          The best way to create instances of this class is to use the static method StartListening
 
Method Summary
 java.lang.String getHostName()
           
 Logger getLogger()
           
 int getPort()
           
protected  java.net.Socket getSocket()
           
protected  java.lang.Thread getThread()
           
protected  void processLogEntry(LogEntry aLogEntry)
           
protected  void readerClosed()
           
 void run()
           
 void setLogger(Logger newLogger)
           
protected  void setSocket(java.net.Socket newSocket)
           
protected  void setThread(java.lang.Thread newThread)
           
 void start()
           
static LogSocketReader.Listener startListening(int aPort, LogSocketReaderReceiver aReceiver)
          Return a Listener.
 void stop()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

socket

private java.net.Socket socket

logger

private Logger logger

thread

private java.lang.Thread thread
Constructor Detail

LogSocketReader

public LogSocketReader(java.net.Socket aSocket)
The best way to create instances of this class is to use the static method StartListening

LogSocketReader

public LogSocketReader(java.net.Socket aSocket,
                       Logger aLogger)
The best way to create instances of this class is to use the static method StartListening
Method Detail

getHostName

public java.lang.String getHostName()

getLogger

public Logger getLogger()

getPort

public int getPort()

getSocket

protected java.net.Socket getSocket()

getThread

protected java.lang.Thread getThread()

processLogEntry

protected void processLogEntry(LogEntry aLogEntry)

readerClosed

protected void readerClosed()

run

public void run()
Specified by:
run in interface java.lang.Runnable

setLogger

public void setLogger(Logger newLogger)

setSocket

protected void setSocket(java.net.Socket newSocket)

setThread

protected void setThread(java.lang.Thread newThread)

start

public void start()

startListening

public static LogSocketReader.Listener startListening(int aPort,
                                                      LogSocketReaderReceiver aReceiver)
Return a Listener. If listening needs to be stopped, send the stop() message to the Listener

stop

public void stop()

© 2002 - Lorne Brinkman
www.TheObjectGuy.com
Lorne@TheObjectGuy.com