org.apache.oodt.commons.util
Class MemoryLogger

java.lang.Object
  extended by org.apache.oodt.commons.util.MemoryLogger
All Implemented Interfaces:
PropertyChangeListener, EventListener, LogListener

public class MemoryLogger
extends Object
implements LogListener

In-memory logger. This logger maintains log messages in memory.

Author:
Kelly

Field Summary
static int DEF_SIZE
          The default size of the message cache, 32.
 
Constructor Summary
MemoryLogger()
          Create a memory logger.
MemoryLogger(int size)
          Create a memory logger.
 
Method Summary
 List getMessages()
          Get the list of messages logged so far.
 int getSize()
          Get the maximum size of the cache.
 void messageLogged(LogEvent event)
          A message got logged.
 void propertyChange(PropertyChangeEvent ignore)
           
 void setSize(int size)
          Set the maximum size of the cache.
 void streamStarted(LogEvent ignore)
          A stream got started.
 void streamStopped(LogEvent ignore)
          A stream was stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_SIZE

public static final int DEF_SIZE
The default size of the message cache, 32.

See Also:
Constant Field Values
Constructor Detail

MemoryLogger

public MemoryLogger()
Create a memory logger. The size of the message cache comes from the system property org.apache.oodt.commons.util.MemoryLogger.size, or DEF_SIZE if that property isn't specified.


MemoryLogger

public MemoryLogger(int size)
Create a memory logger.

Parameters:
size - Size of the message cache.
Method Detail

getMessages

public List getMessages()
Get the list of messages logged so far. This returns a list of Strings in time order.

Returns:
A list of message strings.

getSize

public int getSize()
Get the maximum size of the cache.

Returns:
The maximum size of the cache.

setSize

public void setSize(int size)
Set the maximum size of the cache.

Parameters:
size - The new maximum cache size.

streamStarted

public void streamStarted(LogEvent ignore)
Description copied from interface: LogListener
A stream got started. The event contains the details of stream start, including

Specified by:
streamStarted in interface LogListener
Parameters:
ignore - The logging event.

streamStopped

public void streamStopped(LogEvent ignore)
Description copied from interface: LogListener
A stream was stopped. The event contains the detail of the stream stop, which is the name of the stream, from LogEvent.getStream() or EventObject.getSource() (always a String).

Specified by:
streamStopped in interface LogListener
Parameters:
ignore - The logging event.

propertyChange

public void propertyChange(PropertyChangeEvent ignore)
Specified by:
propertyChange in interface PropertyChangeListener

messageLogged

public void messageLogged(LogEvent event)
Description copied from interface: LogListener
A message got logged. The event contains the details of the message, including

Specified by:
messageLogged in interface LogListener
Parameters:
event - The logging event.


Copyright © 1999-2013
Apache OODT. All Rights Reserved.