]*
This abstract class is overridden to give either a read/write or a readonly
version of this class.
Field Summary |
protected static java.lang.String |
ADMIN_FILE_NAME
The name of the admin file. |
(package private) java.io.File |
adminDataFile
The File object for the admin data file. |
protected java.io.File |
adminDir
The directory where the admin data resides, currently the directory:
Settings.DIRS_ARCREPOSITORY_ADMIN. |
(package private) static java.lang.String |
INVALID_ENTRY_STRING
Deprecated. |
protected java.util.List<java.lang.String> |
knownBitArchives
List containing the names of all knownBitArchives. |
protected java.util.Map<java.lang.String,ArcRepositoryEntry> |
storeEntries
Map containing a mapping from arcfilename to ArcRepositoryEntry. |
protected static java.lang.String |
versionNumber
Admindata version. |
Constructor Summary |
protected |
AdminData()
Common constructor for admin data. |
Method Summary |
java.util.Set<java.lang.String> |
getAllFileNames()
Returns a set of the all arcfile names in the repository. |
java.util.Set<java.lang.String> |
getAllFileNames(Location location,
BitArchiveStoreState state)
Returns a set of the names arcfile names that are in a given state for a
specific bitarchive in the repository. |
java.lang.String |
getCheckSum(java.lang.String arcfileName)
Get Checksum for a given arcfile. |
ArcRepositoryEntry |
getEntry(java.lang.String arcfileName)
Return the ArcRepositoryEntry for a certain arcfileName. |
static ReadOnlyAdminData |
getReadOnlyInstance()
Returns a read-only AdminData instance. |
BitArchiveStoreState |
getState(java.lang.String arcfileName,
java.lang.String bitArchive)
Retrieves the storage state of a file for a specific bitarchive. |
static UpdateableAdminData |
getUpdateableInstance()
Returns the one and only AdminData instance. |
boolean |
hasChecksum(java.lang.String arcfileName)
Deprecated. use hasEntry(filename) instead of hasChecksum(filename).
If hasEntry(filename) is true, we have a recorded a
checksum for the filename as well. |
boolean |
hasEntry(java.lang.String arcfileName)
Check, if there is an entry for a certain arcfile? |
boolean |
hasReplyInfo(java.lang.String arcfileName)
Tells whether there is a replyInfo associated with
the given arcfile. |
boolean |
hasState(java.lang.String arcfileName,
java.lang.String bitArchive)
Returns whether or not a BitArchiveStoreState is registered for the given
ARC file at the given bit archive. |
boolean |
isValidEntry(java.lang.String filename)
Deprecated. This method is deprecated, because the we don't have
any invalid entries now.
Use hasEntry() instead. |
protected void |
read()
Reads the admin data from a file. |
java.lang.String |
toString()
Return info about current object as String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
versionNumber
protected static final java.lang.String versionNumber
- Admindata version.
VersionNumber is the current version
oldVersionNumber is the earlier but still valid version
- See Also:
- Constant Field Values
storeEntries
protected java.util.Map<java.lang.String,ArcRepositoryEntry> storeEntries
- Map containing a mapping from arcfilename to ArcRepositoryEntry.
adminDir
protected java.io.File adminDir
- The directory where the admin data resides, currently the directory:
Settings.DIRS_ARCREPOSITORY_ADMIN.
ADMIN_FILE_NAME
protected static final java.lang.String ADMIN_FILE_NAME
- The name of the admin file.
- See Also:
- Constant Field Values
knownBitArchives
protected java.util.List<java.lang.String> knownBitArchives
- List containing the names of all knownBitArchives.
This list is updated in the setState() method
But only used in the toString() method.
INVALID_ENTRY_STRING
static final java.lang.String INVALID_ENTRY_STRING
- Deprecated.
- See Also:
- Constant Field Values
adminDataFile
final java.io.File adminDataFile
- The File object for the admin data file.
AdminData
protected AdminData()
- Common constructor for admin data. Reads current admin data from admin
data file.
- Throws:
PermissionDenied
- if admin data directory is not accessible
getUpdateableInstance
public static UpdateableAdminData getUpdateableInstance()
- Returns the one and only AdminData instance.
- Returns:
- the one and only AdminData instance.
getReadOnlyInstance
public static ReadOnlyAdminData getReadOnlyInstance()
- Returns a read-only AdminData instance.
- Returns:
- a read-only AdminData instance.
hasEntry
public boolean hasEntry(java.lang.String arcfileName)
- Check, if there is an entry for a certain arcfile?
- Parameters:
arcfileName
- A given arcfile
- Returns:
- true, if there is an entry for the given arcfile
isValidEntry
public boolean isValidEntry(java.lang.String filename)
- Deprecated. This method is deprecated, because the we don't have
any invalid entries now.
Use hasEntry() instead.
- Return true if a valid entry exists for the given filename.
- Parameters:
filename
- A file to check the entry for validity.
- Returns:
- True if the entry exists and is valid.
getEntry
public ArcRepositoryEntry getEntry(java.lang.String arcfileName)
- Return the ArcRepositoryEntry for a certain arcfileName.
Returns null, if not found.
- Parameters:
arcfileName
- a certain filename
- Returns:
- the ArcRepositoryEntry for a certain arcfileName
hasReplyInfo
public boolean hasReplyInfo(java.lang.String arcfileName)
- Tells whether there is a replyInfo associated with
the given arcfile. If the file is not registered,
a warning is logged and false is returned.
- Parameters:
arcfileName
- The arc file we want to reply a store request for.
- Returns:
- Whether setReplyInfo() has been called
(and the replyInfo hasn't been removed since).
hasState
public boolean hasState(java.lang.String arcfileName,
java.lang.String bitArchive)
- Returns whether or not a BitArchiveStoreState is registered for the given
ARC file at the given bit archive.
- Parameters:
arcfileName
- The file to retrieve the state forbitArchive
- The bitarchive to retrieve the state for
- Returns:
- true if BitArchiveStoreState is registered, false otherwise.
getState
public BitArchiveStoreState getState(java.lang.String arcfileName,
java.lang.String bitArchive)
throws UnknownID
- Retrieves the storage state of a file for a specific bitarchive.
- Parameters:
arcfileName
- The file to retrieve the state forbitArchive
- The bitarchive to retrieve the state for
- Returns:
- The storage state
- Throws:
UnknownID
- When no record exists
hasChecksum
public boolean hasChecksum(java.lang.String arcfileName)
- Deprecated. use hasEntry(filename) instead of hasChecksum(filename).
If hasEntry(filename) is true, we have a recorded a
checksum for the filename as well.
- Tells whether we have a registered checksum for the given arc file.
- Parameters:
arcfileName
- A file that someone wants to store.
- Returns:
- True, if there is a recorded checksum for a file of that name,
false otherwise.
getCheckSum
public java.lang.String getCheckSum(java.lang.String arcfileName)
- Get Checksum for a given arcfile.
- Parameters:
arcfileName
- Unique reference to file for which to
retrieve checksum
- Returns:
- checksum the latest registered reference checksum or null,
if no reference checksum is available
- Throws:
UnknownID
- if the file is not registered
read
protected void read()
- Reads the admin data from a file. If the data read is a valid old version
the it is converted to the new version and written to disk.
- Throws:
IOFailure
- on trouble reading from file
getAllFileNames
public java.util.Set<java.lang.String> getAllFileNames()
- Returns a set of the all arcfile names in the repository.
- Returns:
- the set of files in the repository
getAllFileNames
public java.util.Set<java.lang.String> getAllFileNames(Location location,
BitArchiveStoreState state)
- Returns a set of the names arcfile names that are in a given state for a
specific bitarchive in the repository.
- Parameters:
location
- the name of the BAstate
- the state to look for, e.g. BitArchiveStoreState.STATE_COMPLETED
- Returns:
- the set of files in the repository with the given state
toString
public java.lang.String toString()
- Return info about current object as String.
- Overrides:
toString
in class java.lang.Object
- Returns:
- info about current object as String.