com.googlecode.fascinator.harvester.filesystem
Class DerbyCache

java.lang.Object
  extended by com.googlecode.fascinator.harvester.filesystem.DerbyCache

public class DerbyCache
extends Object

This class is designed to encapsulate all logic required to run a cache backed into a derby database in support of the file system harvester. There are two caches available.

Some form of caching must be enabled to support deletion detection for this plugin.

Author:
Greg Pendlebury

Constructor Summary
DerbyCache(JsonSimpleConfig config)
           
 
Method Summary
 Set<String> getUnsetFlags()
           Used to support deletion detection.
 boolean hasChanged(String oid, File file)
           Check whether or not the file has changed according to the configured cache.
 void purgeUnsetFlags()
           Used to support deletion detection.
 void resetFlags()
           Used to support deletion detection.
 void shutdown()
          Shutdown the database connections and cleanup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DerbyCache

public DerbyCache(JsonSimpleConfig config)
           throws Exception
Throws:
Exception
Method Detail

hasChanged

public boolean hasChanged(String oid,
                          File file)

Check whether or not the file has changed according to the configured cache. The response from this method should be used as an indicator on whether or not to proceed with harvesting the file. In that context:

Parameters:
file - : The file to test.
Returns:
boolean : True if the harvest should proceed, otherwise false.

resetFlags

public void resetFlags()

Used to support deletion detection. Should be called at the beginning of a harvest to reset the flags in the database.


getUnsetFlags

public Set<String> getUnsetFlags()

Used to support deletion detection. This method is called after the harvest, and will return a list of all file paths

Returns:
Set: A list of all object IDs in the cache which have not been 'touched'

purgeUnsetFlags

public void purgeUnsetFlags()

Used to support deletion detection. This method is just for cleanup after the process completes.


shutdown

public void shutdown()
              throws Exception
Shutdown the database connections and cleanup.

Throws:
Exception - if there are errors


Copyright © 2009-2013. All Rights Reserved.