org.stanwood.media.actions
Class SeenDatabase

java.lang.Object
  extended by org.stanwood.media.xml.XMLParser
      extended by org.stanwood.media.actions.SeenDatabase

public class SeenDatabase
extends XMLParser

This class is used to maintain a list of files that have been seen by the actions in media directories


Field Summary
 
Fields inherited from class org.stanwood.media.xml.XMLParser
DTD_WEB_LOCATION, SCHEMA_WEB_LOCATION
 
Constructor Summary
SeenDatabase(java.io.File configDir)
          The constructor
 
Method Summary
 boolean isSeen(java.io.File mediaDirectory, java.io.File file)
          Used to work out if a file has been seen already
 void markAsSeen(java.io.File mediaDirectory, java.io.File file)
          Used to mark a file as seen after actions have seen it
 void read(IProgressMonitor progress)
          Used to read the database from disk
 void removeFile(java.io.File mediaDirectory, java.io.File file)
          Used to remove files from the Seen database
 void renamedFile(java.io.File mediaDirectory, java.io.File oldFile, java.io.File newFile)
          Used to notify the seen database when a file has been renamed
 void write(IProgressMonitor parentMonitor)
          Used to write the database to disc
 
Methods inherited from class org.stanwood.media.xml.XMLParser
createDocBuilder, createFactory, deleteNode, domToStr, encodeAttributeValue, firstChild, getAttribute, getElement, getFirstChildElement, getFloatFromXML, getIntegerFromXML, getLastChildElement, getLongFromXML, getSchema, getStringFromXML, getStringFromXMLOrNull, getURLFromXML, getURLFromXMLOrNull, hasNode, parse, parse, parse, quoteXPathQuery, selectChildNodes, selectNodeList, selectSingleNode, strToDom, strToDom, strToDom, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeenDatabase

public SeenDatabase(java.io.File configDir)
The constructor

Parameters:
configDir - The configuration directory
Method Detail

isSeen

public boolean isSeen(java.io.File mediaDirectory,
                      java.io.File file)
Used to work out if a file has been seen already

Parameters:
mediaDirectory - The media directory the file lives in
file - The file
Returns:
True if seen, otherwise false

markAsSeen

public void markAsSeen(java.io.File mediaDirectory,
                       java.io.File file)
Used to mark a file as seen after actions have seen it

Parameters:
mediaDirectory - The media directory the file lives in
file - The file

write

public void write(IProgressMonitor parentMonitor)
           throws java.io.FileNotFoundException
Used to write the database to disc

Parameters:
parentMonitor - Parent progress monitor
Throws:
java.io.FileNotFoundException - Thrown if their is a problem

read

public void read(IProgressMonitor progress)
          throws java.io.FileNotFoundException,
                 XMLParserException
Used to read the database from disk

Parameters:
progress - Progress monitor
Throws:
java.io.FileNotFoundException - Thrown if their is a problem
XMLParserException - Thrown if possible to parse file

renamedFile

public void renamedFile(java.io.File mediaDirectory,
                        java.io.File oldFile,
                        java.io.File newFile)
Used to notify the seen database when a file has been renamed

Parameters:
mediaDirectory - The media directory the file is located in
oldFile - The old filename
newFile - The new filename

removeFile

public void removeFile(java.io.File mediaDirectory,
                       java.io.File file)
Used to remove files from the Seen database

Parameters:
mediaDirectory - The media directory of the file to remove
file - The file to remove