de.hunsicker.jalopy.storage
Class History

java.lang.Object
  |
  +--de.hunsicker.jalopy.storage.History

public final class History
extends java.lang.Object

History serves as a tracker for file modifications.

The flush() method may be used to synchronously force updates to the backing store. Normal termination of the Java Virtual Machine will not result in the loss of pending updates - an explicit flushing is not required upon termination to ensure that pending updates are made persistent.

This class is thread-safe.

Version:
$Revision: 1.4 $
Author:
Marco Hunsicker

Nested Class Summary
static class History.ChecksumCharArrayWriter
          A writer that calculates a checkum during the writing process.
static class History.Entry
          Represents a history entry.
static class History.Method
          Represents the method used to identify dirty files and changed files.
static class History.Policy
          Represents a history policy.
 
Method Summary
 void add(java.io.File file, java.lang.String packageName, long modification)
          Adds the given file to the history.
 void clear()
          Clears the history.
 void flush()
          Stores the history to the backing store.
 History.Entry get(java.io.File file)
          Returns the history entry for the given file.
static History getInstance()
          Returns the sole instance of this class.
 void remove(java.io.File file)
          Removes the given file from the history.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static History getInstance()
Returns the sole instance of this class.

Returns:
class instance.

add

public void add(java.io.File file,
                java.lang.String packageName,
                long modification)
         throws java.io.IOException
Adds the given file to the history. It will only be added, if it exists and indeed denotes a file (not a directory).

Parameters:
file - file to add.
packageName - the package name of the file to add.
modification - the time the file given was last processed.
Throws:
java.io.IOException - if an I/O error occured, which is possible because a canonical pathname will be constructed.

clear

public void clear()
Clears the history.


flush

public void flush()
           throws java.io.IOException
Stores the history to the backing store.

Throws:
java.io.IOException - if an I/O error occured.

get

public History.Entry get(java.io.File file)
                  throws java.io.IOException
Returns the history entry for the given file.

Parameters:
file - the file to get the corresponding history entry for.
Returns:
the history entry for the given file or null if no entry for the given file exists.
Throws:
java.io.IOException - if an I/O error occured, which is possible because a canonical pathname will be constructed.

remove

public void remove(java.io.File file)
            throws java.io.IOException
Removes the given file from the history.

Parameters:
file - file to remove.
Throws:
java.io.IOException - if an I/O error occured, which is possible because a canonical pathname will be constructed.


Copyright © 1997-2005 Jalopy. All Rights Reserved.