Skip navigation links


oracle.idm.util.progress
Class ProgressLogger

java.lang.Object
  extended by oracle.idm.util.progress.ProgressLogger

All Implemented Interfaces:
java.util.EventListener, XmlPrintable, ProgressListener

public class ProgressLogger
extends java.lang.Object
implements ProgressListener, XmlPrintable

This is a convenience class that can be extended by other classes that need to implement the progress listener interface. This implementation maintains a log of progress events and state changes in memory, and optionally logs events to a stream or writer.

See Also:
ProgressListener, ProgressEvent

Field Summary
protected  int eventLimit
           
protected  java.util.LinkedList events
           
protected  XmlPrintWriter log
           
protected  int stateLimit
           
protected  java.util.LinkedList states
           
protected  java.lang.String tag
          Tag used to print the progress logger as an XML element.

 

Constructor Summary
ProgressLogger()
          Creates a progress logger.
ProgressLogger(java.io.File file)
          Creates a progress logger.
ProgressLogger(java.io.File file, boolean append)
          Creates a progress logger.
ProgressLogger(java.io.OutputStream log)
          Creates a progress logger.
ProgressLogger(java.lang.String filename)
          Creates a progress logger.
ProgressLogger(java.lang.String filename, boolean append)
          Creates a progress logger.
ProgressLogger(java.io.Writer log)
          Creates a progress logger.

 

Method Summary
 int getEventLimit()
          Getter for the eventLimit property.
 java.util.LinkedList getEvents()
          Getter for the events property.
 int getStateLimit()
          Getter for the stateLimit property.
 java.util.LinkedList getStates()
          Getter for the states property.
protected  void logEvent(ProgressEvent event)
          Logger for events.
protected  void logState(StateInfo state)
          Logger for states.
 void receiveProgressEvent(ProgressEvent event)
          This implementation of receiveProgressEvent method log the progress event and state change in memory.
 void reset()
          Reset the event and state change log by clearing all entries.
 void setEventLimit(int limit)
          Setter for the eventLimit property.
 void setStateLimit(int limit)
          Setter for the stateLimit property.
protected  void trimEvents()
          Trimmer for events.
protected  void trimStates()
          Trimmer for states.
 void xprint(XmlPrintWriter out)
          Prints progress logger properties to the PrintWriter as an XML element.
protected  void xprintBody(XmlPrintWriter out)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

log

protected XmlPrintWriter log

eventLimit

protected int eventLimit

events

protected java.util.LinkedList events

stateLimit

protected int stateLimit

states

protected java.util.LinkedList states

tag

protected java.lang.String tag
Tag used to print the progress logger as an XML element.

Constructor Detail

ProgressLogger

public ProgressLogger()
Creates a progress logger. If created using this constructor, the listener will maintain a log of events and state changes in memory only.

ProgressLogger

public ProgressLogger(java.lang.String filename)
               throws java.io.FileNotFoundException
Creates a progress logger. If created using this constructor, the listener will maintain a log of events and state changes in memory and log events to the filename.
Throws:
java.io.FileNotFoundException

ProgressLogger

public ProgressLogger(java.lang.String filename,
                      boolean append)
               throws java.io.FileNotFoundException
Creates a progress logger. If created using this constructor, the listener will maintain a log of events and state changes in memory and log events to the filename.
Throws:
java.io.FileNotFoundException

ProgressLogger

public ProgressLogger(java.io.File file)
               throws java.io.FileNotFoundException
Creates a progress logger. If created using this constructor, the listener will maintain a log of events and state changes in memory and log events to the file.
Throws:
java.io.FileNotFoundException

ProgressLogger

public ProgressLogger(java.io.File file,
                      boolean append)
               throws java.io.FileNotFoundException
Creates a progress logger. If created using this constructor, the listener will maintain a log of events and state changes in memory and log events to the file.
Throws:
java.io.FileNotFoundException

ProgressLogger

public ProgressLogger(java.io.OutputStream log)
Creates a progress logger. If created using this constructor, the listener will maintain a log of events and state changes in memory and log events to the stream.

ProgressLogger

public ProgressLogger(java.io.Writer log)
Creates a progress logger. If created using this constructor, the listener will maintain a log of events and state changes in memory and log events to the writer.

Method Detail

reset

public void reset()
Reset the event and state change log by clearing all entries.

getEventLimit

public int getEventLimit()
Getter for the eventLimit property. Value of 0 indicates no limit.
Returns:
int representing the event limit

setEventLimit

public void setEventLimit(int limit)
Setter for the eventLimit property. Use value of 0 to indicate no limit. Default value is 1.
Parameters:
int - representing the event limit

getEvents

public java.util.LinkedList getEvents()
Getter for the events property.
Returns:
List of ProgressEvents.

trimEvents

protected void trimEvents()
Trimmer for events.

logEvent

protected void logEvent(ProgressEvent event)
Logger for events.
Parameters:
ProgressEvent -

getStateLimit

public int getStateLimit()
Getter for the stateLimit property. Value of 0 indicates no limit.
Returns:
int representing the state limit

setStateLimit

public void setStateLimit(int limit)
Setter for the stateLimit property. Use value of 0 to indicate no limit. Default value is 0.
Parameters:
int - representing the state limit

getStates

public java.util.LinkedList getStates()
Getter for the states property.
Returns:
List of StateInfos.

trimStates

protected void trimStates()
Trimmer for states.

logState

protected void logState(StateInfo state)
Logger for states.
Parameters:
StateInfo -

receiveProgressEvent

public void receiveProgressEvent(ProgressEvent event)
This implementation of receiveProgressEvent method log the progress event and state change in memory. If a filename, file, stream or writer was passed in to the listener constructor, the event will also be logged to the filename, file, stream or writer.
Specified by:
receiveProgressEvent in interface ProgressListener
Parameters:
event -

xprint

public void xprint(XmlPrintWriter out)
Prints progress logger properties to the PrintWriter as an XML element.
Specified by:
xprint in interface XmlPrintable
Parameters:
out - PrintWriter for printing progress logger propeties.

xprintBody

protected void xprintBody(XmlPrintWriter out)

Skip navigation links