org.placelab.stumbler
Class LogWriter

java.lang.Object
  extended byorg.placelab.stumbler.LogWriter
All Implemented Interfaces:
ShutdownListener, StumblerFunnelUpdateListener

public class LogWriter
extends java.lang.Object
implements StumblerFunnelUpdateListener, ShutdownListener

The LogWriter class is geared toward the type of usage we expect for people using the PlacelabStumbler gui application. That is, they'll open it up, start stumbling, and then save once their finished. So this saves the log text to a temporary file, and then copies it to the destination specified by the user once they request a save.


Field Summary
 java.util.Vector criticalSpotters
           
static int LOG_VERSION
           
static java.lang.String PREAMBLE
           
 
Constructor Summary
LogWriter()
           
LogWriter(java.lang.String path)
           
LogWriter(java.lang.String path, boolean append)
           
 
Method Summary
static int getLogVersion(java.lang.String firstLine)
           
static java.lang.String makeTempFile()
           
 boolean saveFile(java.lang.String to)
           
 boolean setOutputFile(java.lang.String path)
           
 void shutdown()
           
 void stumblerUpdated(java.util.Hashtable updates)
          This message is sent after every StumblerFunnel has new data available Note that this callback is sent in the thread that the StumblerUpdateListener used to subscribe itself to the StumblerFunnel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

criticalSpotters

public java.util.Vector criticalSpotters

PREAMBLE

public static java.lang.String PREAMBLE

LOG_VERSION

public static int LOG_VERSION
Constructor Detail

LogWriter

public LogWriter()
          throws java.io.IOException

LogWriter

public LogWriter(java.lang.String path)
          throws java.io.IOException

LogWriter

public LogWriter(java.lang.String path,
                 boolean append)
          throws java.io.IOException
Method Detail

makeTempFile

public static java.lang.String makeTempFile()
                                     throws java.io.IOException
Throws:
java.io.IOException

getLogVersion

public static int getLogVersion(java.lang.String firstLine)

stumblerUpdated

public void stumblerUpdated(java.util.Hashtable updates)
Description copied from interface: StumblerFunnelUpdateListener
This message is sent after every StumblerFunnel has new data available Note that this callback is sent in the thread that the StumblerUpdateListener used to subscribe itself to the StumblerFunnel.

Specified by:
stumblerUpdated in interface StumblerFunnelUpdateListener
Parameters:
updates - updates each StumblerSpotter keys to its MeasurementPackages for this update.

saveFile

public boolean saveFile(java.lang.String to)
                 throws java.io.IOException
Throws:
java.io.IOException

setOutputFile

public boolean setOutputFile(java.lang.String path)
                      throws java.io.IOException
Throws:
java.io.IOException

shutdown

public void shutdown()
Specified by:
shutdown in interface ShutdownListener