org.archive.wayback.resourcestore.locationdb
Class ResourceFileLocationDBUpdater

java.lang.Object
  extended by org.archive.wayback.resourcestore.locationdb.ResourceFileLocationDBUpdater
All Implemented Interfaces:
Shutdownable

public class ResourceFileLocationDBUpdater
extends Object
implements Shutdownable

Class which performs updates on a ResourceFileLocationDB, based on files appearing in a incoming directory. When files are noticed in the "incoming" directory, they are assumed to be in the format serialized by org.archive.wayback.resourcestore.resourcefile.ResourceFileList These files are synchronized with the ResourceFileLocationDB, and deleted. Each file has a logical name, which is assumed to uniquely identify a ResourceFileSource. As an optimization, the last state of each ResouceFileSource is kept in a file under the "state" directory. This allows this class to compute a difference of the last state with the new files in incoming, and only deltas: new files, removed files, and possibly moved files, need to applied to the ResourceFileLocationDB.

Version:
$Date: 2010-09-29 05:28:38 +0700 (Wed, 29 Sep 2010) $, $Revision: 3262 $
Author:
brad

Field Summary
static String TMP_SUFFIX
           
 
Constructor Summary
ResourceFileLocationDBUpdater()
           
 
Method Summary
 ResourceFileLocationDB getDb()
           
 String getIncomingDir()
           
 long getInterval()
           
 String getStateDir()
           
 void init()
           
 void setDb(ResourceFileLocationDB db)
           
 void setIncomingDir(String incomingDir)
           
 void setInterval(long interval)
           
 void setStateDir(String stateDir)
           
 void shutdown()
          Release any resources used by this ResourceIndex cleanly
 boolean synchronize(File update)
           
 int synchronizeIncoming()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TMP_SUFFIX

public static final String TMP_SUFFIX
See Also:
Constant Field Values
Constructor Detail

ResourceFileLocationDBUpdater

public ResourceFileLocationDBUpdater()
Method Detail

init

public void init()

shutdown

public void shutdown()
Description copied from interface: Shutdownable
Release any resources used by this ResourceIndex cleanly

Specified by:
shutdown in interface Shutdownable

synchronizeIncoming

public int synchronizeIncoming()
                        throws IOException
Throws:
IOException

synchronize

public boolean synchronize(File update)
                    throws IOException
Throws:
IOException

getDb

public ResourceFileLocationDB getDb()
Returns:
the db

setDb

public void setDb(ResourceFileLocationDB db)
Parameters:
db - the db to set

getStateDir

public String getStateDir()
Returns:
the stateDir

setStateDir

public void setStateDir(String stateDir)
                 throws IOException
Parameters:
stateDir - the stateDir to set
Throws:
IOException

getIncomingDir

public String getIncomingDir()
Returns:
the incomingDir

setIncomingDir

public void setIncomingDir(String incomingDir)
                    throws IOException
Parameters:
incomingDir - the incomingDir to set
Throws:
IOException

getInterval

public long getInterval()
Returns:
the interval

setInterval

public void setInterval(long interval)
Parameters:
interval - the interval to set


Copyright © 2005-2011 Internet Archive. All Rights Reserved.