org.oreodata.standalone
Class DefaultDataLogger

java.lang.Object
  |
  +--org.oreodata.standalone.DefaultDataLogger
All Implemented Interfaces:
DataListener, DataLogger, java.util.EventListener

public class DefaultDataLogger
extends java.lang.Object
implements DataLogger

A DataListener implementation that logs data events to a file.

Author:
Jonathan Revusky

Constructor Summary
DefaultDataLogger(OreoDataSource dataSource, java.io.File logFile, boolean useXML, java.lang.String encoding)
          Creates a new DefaultDataLogger
 
Method Summary
 org.xml.sax.InputSource asInputSource()
           
 void handleEvent(DataEvent event)
          handle the event when the OreoDataSource we are listening to has modified data
 void init(java.util.Properties properties)
          used in the startup phase to initialize the object based on properties.
protected  void logEventXML(DataEvent event)
          log the transaction in an XML format.
 void rotateLogs()
          Method that starts a new log file, archiving the present one etcetera.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDataLogger

public DefaultDataLogger(OreoDataSource dataSource,
                         java.io.File logFile,
                         boolean useXML,
                         java.lang.String encoding)
                  throws java.io.IOException
Creates a new DefaultDataLogger

Parameters:
dataSource - the data source to listen to.
logFile - the location of the file (must be writeable)
useXML - whether to log in XML format.
encoding - the character encoding (only applicable if useXML is true)
Method Detail

init

public void init(java.util.Properties properties)
          throws java.io.IOException
Description copied from interface: DataListener
used in the startup phase to initialize the object based on properties. Note that the properties are typically defined in an XML file.

Specified by:
init in interface DataListener
java.io.IOException

handleEvent

public void handleEvent(DataEvent event)
                 throws java.io.IOException
Description copied from interface: DataListener
handle the event when the OreoDataSource we are listening to has modified data

Specified by:
handleEvent in interface DataListener
java.io.IOException

logEventXML

protected void logEventXML(DataEvent event)
                    throws java.io.IOException
log the transaction in an XML format.

java.io.IOException

asInputSource

public org.xml.sax.InputSource asInputSource()
                                      throws java.io.IOException
Specified by:
asInputSource in interface DataLogger
Returns:
an InputSource for reloading a datasource from the log
java.io.IOException

rotateLogs

public void rotateLogs()
                throws java.io.IOException
Description copied from interface: DataLogger
Method that starts a new log file, archiving the present one etcetera.

Specified by:
rotateLogs in interface DataLogger
java.io.IOException