dk.netarkivet.archive.arcrepositoryadmin
Class UpdateableAdminData
java.lang.Object
dk.netarkivet.archive.arcrepositoryadmin.AdminData
dk.netarkivet.archive.arcrepositoryadmin.UpdateableAdminData
public class UpdateableAdminData
- extends AdminData
Class for accessing and manipulating the administrative data for
the ArcRepository.
In the current implementation, it consists of a file with a number of lines
of the form:
[, ]*
If a line in the admin data file is corrupt, the entry is removed
from admindata.
Notes: If the admindata file does not exist on start-up, the
file is created in the constructor.
If the admindata file on start-up is the oldversion,
the admindata file is migrated to the new version.
Method Summary |
void |
addEntry(java.lang.String filename,
StoreMessage replyInfo,
java.lang.String checksum,
ArchiveStoreState generalState)
Add new entry to the admin data, and persist it to disk. |
void |
addEntry(java.lang.String filename,
StoreMessage replyInfo,
java.lang.String checksum,
ArchiveStoreState generalState,
boolean persistNow)
Add new entry to the ddmin data, and persist it to disk,
if persistNow set to true. |
void |
close()
Makes sure all data is written to disk. |
static UpdateableAdminData |
getInstance()
Get the singletont instance. |
StoreMessage |
removeReplyInfo(java.lang.String arcfileName)
Removes the replyInfo associated with arcfileName. |
void |
setCheckSum(java.lang.String arcfileName,
java.lang.String checkSum)
Set/update the checksum for a given arcfileName in the admindata. |
void |
setReplyInfo(java.lang.String arcfileName,
StoreMessage replyInfo)
Records the replyInfo (StoreMessage object) so that it can be retrieved
using the given file name. |
void |
setState(java.lang.String arcfileName,
java.lang.String bitarchiveID,
BitArchiveStoreState state)
Sets the store state for the given file on the given bitarchive. |
Methods inherited from class dk.netarkivet.archive.arcrepositoryadmin.AdminData |
getAllFileNames, getAllFileNames, getCheckSum, getEntry, getReadOnlyInstance, getState, getUpdateableInstance, hasChecksum, hasEntry, hasReplyInfo, hasState, isValidEntry, read, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
getInstance
public static UpdateableAdminData getInstance()
- Get the singletont instance.
- Returns:
- The singleton
addEntry
public void addEntry(java.lang.String filename,
StoreMessage replyInfo,
java.lang.String checksum,
ArchiveStoreState generalState)
- Add new entry to the admin data, and persist it to disk.
- Parameters:
filename
- A filenamereplyInfo
- A replyInfo for this entry (may be null)checksum
- The Checksum for this filegeneralState
- The generalState for this entry
addEntry
public void addEntry(java.lang.String filename,
StoreMessage replyInfo,
java.lang.String checksum,
ArchiveStoreState generalState,
boolean persistNow)
- Add new entry to the ddmin data, and persist it to disk,
if persistNow set to true.
- Parameters:
filename
- A filenamereplyInfo
- A replyInfo for this entry (may be null)checksum
- The Checksum for this filegeneralState
- The generalState for this entrypersistNow
- Shall we persist this entry now?
setReplyInfo
public void setReplyInfo(java.lang.String arcfileName,
StoreMessage replyInfo)
throws UnknownID
- Records the replyInfo (StoreMessage object) so that it can be retrieved
using the given file name.
- Parameters:
arcfileName
- An arc file that someone is trying to store.replyInfo
- A StoreMessage object related to this filename.
- Throws:
UnknownID
- if no info has been registered for arcfilename
removeReplyInfo
public StoreMessage removeReplyInfo(java.lang.String arcfileName)
throws UnknownID
- Removes the replyInfo associated with arcfileName.
- Parameters:
arcfileName
- A file that we are trying to store.
- Returns:
- the replyInfo associated with arcfileName.
- Throws:
UnknownID
- If the arcfilename is not known.
or no replyInfo is associated with arcfileName.
setState
public void setState(java.lang.String arcfileName,
java.lang.String bitarchiveID,
BitArchiveStoreState state)
throws UnknownID
- Sets the store state for the given file on the given bitarchive.
- Parameters:
arcfileName
- A file that is being stored.bitarchiveID
- A bitarchive.state
- The state of upload of arcfileName on bitarchiveID.
- Throws:
UnknownID
- If the arcfile does not have a store entry.
ArgumentNotValid
- If the arguments are null or empty
setCheckSum
public void setCheckSum(java.lang.String arcfileName,
java.lang.String checkSum)
- Set/update the checksum for a given arcfileName in the admindata.
- Parameters:
arcfileName
- Unique name of file for which to store checksumcheckSum
- The generated (MD5) checksum to be stored in reference table
- Throws:
UnknownID
- if the file is not already registered.
close
public void close()
- Makes sure all data is written to disk.