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 java.lang.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$, $Revision$
Author:
brad

Field Summary
static java.lang.String TMP_SUFFIX
           
 
Constructor Summary
ResourceFileLocationDBUpdater()
           
 
Method Summary
 ResourceFileLocationDB getDb()
           
 java.lang.String getIncomingDir()
           
 long getInterval()
           
 java.lang.String getStateDir()
           
 void init()
           
 void setDb(ResourceFileLocationDB db)
           
 void setIncomingDir(java.lang.String incomingDir)
           
 void setInterval(long interval)
           
 void setStateDir(java.lang.String stateDir)
           
 void shutdown()
           
 boolean synchronize(java.io.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 java.lang.String TMP_SUFFIX
See Also:
Constant Field Values
Constructor Detail

ResourceFileLocationDBUpdater

public ResourceFileLocationDBUpdater()
Method Detail

init

public void init()

shutdown

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

synchronizeIncoming

public int synchronizeIncoming()
                        throws java.io.IOException
Throws:
java.io.IOException

synchronize

public boolean synchronize(java.io.File update)
                    throws java.io.IOException
Throws:
java.io.IOException

getDb

public ResourceFileLocationDB getDb()
Returns:
the db

setDb

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

getStateDir

public java.lang.String getStateDir()
Returns:
the stateDir

setStateDir

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

getIncomingDir

public java.lang.String getIncomingDir()
Returns:
the incomingDir

setIncomingDir

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

getInterval

public long getInterval()
Returns:
the interval

setInterval

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


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