public final class DatabaseAdmin extends Object implements Admin
Modifier and Type | Method and Description |
---|---|
void |
addEntry(String filename,
StoreMessage msg,
String checksum)
Method for adding an entry for administration.
|
void |
close()
Close and cleanup of this class.
|
Set<String> |
getAllFileNames()
Retrieves a set of the names for all the known files.
|
Set<String> |
getAllFileNames(Replica rep,
ReplicaStoreState state)
Retrieves a set with the name of the files with a specific ReplicaStoreState in a specific replica.
|
String |
getCheckSum(String filename)
Retrieves the checksum of a given file.
|
static DatabaseAdmin |
getInstance()
Retrieval of a singleton DatabaseAdmin.
|
ReplicaStoreState |
getState(String filename,
String replicaChannelName)
Returns the ReplicaStoreState of a given file in a specific replica.
|
boolean |
hasEntry(String filename)
Method for telling whether a file entry exists.
|
boolean |
hasReplyInfo(String filename)
Determines whether the StoreMessage of a given file exists.
|
boolean |
hasState(String filename,
String repChannelId)
Determines whether a given file in a specific replica has a valid replica store state.
|
StoreMessage |
removeReplyInfo(String filename)
Retrieves the StoreMessage of a specific file.
|
void |
setCheckSum(String filename,
String checksum)
Sets the checksum of a given file.
|
void |
setReplyInfo(String filename,
StoreMessage msg)
Assign a StoreMessage to a specific filename.
|
void |
setState(String filename,
String repChannelId,
ReplicaStoreState state)
Sets the store state of an entry to a specific value.
|
public static DatabaseAdmin getInstance()
public void addEntry(String filename, StoreMessage msg, String checksum) throws ArgumentNotValid
addEntry
in interface Admin
filename
- The name of the file to be stored.msg
- The StoreMessage of the entry.checksum
- The checksum of the entry.ArgumentNotValid
- If either the filename or checksum is either null or the empty string.public boolean hasEntry(String filename) throws ArgumentNotValid
hasEntry
in interface Admin
filename
- The name of the file, the existence of whose entry is to be determined.ArgumentNotValid
- If the filename is either null or empty.public ReplicaStoreState getState(String filename, String replicaChannelName) throws ArgumentNotValid
getState
in interface Admin
filename
- The name of the file for the ReplicaStoreState.replicaChannelName
- The name of the identification channel for uniquely identifying the replica of for the
ReplicaStoreState.ArgumentNotValid
- If the filename or the replica id is null or the empty string.public boolean hasState(String filename, String repChannelId) throws ArgumentNotValid
TODO Find out if the assumption that all upload states besides UNKNOWN_UPLOAD_STATE are acceptable!
hasState
in interface Admin
filename
- The name of the file for the ReplicaStoreState.repChannelId
- The identification channel of the replica for the ReplicaStoreState.ArgumentNotValid
- If either the filenames or the replica identification channel is null or the empty
string.public void setState(String filename, String repChannelId, ReplicaStoreState state) throws ArgumentNotValid
setState
in interface Admin
filename
- The name of the file for the entry.repChannelId
- The identification channel of the replica for the entry.state
- The new state for the entry.ArgumentNotValid
- If the ReplicaStoreState is null, or if either the filename or the replica
identification channel is either null or the empty string.public boolean hasReplyInfo(String filename) throws ArgumentNotValid
hasReplyInfo
in interface Admin
filename
- The name of the file to which the existence of the StoreMessage should be determined.ArgumentNotValid
- If the filename is null or the empty string.public StoreMessage removeReplyInfo(String filename) throws ArgumentNotValid
removeReplyInfo
in interface Admin
filename
- The name of the file whose StoreMessage should be retrieved.ArgumentNotValid
- If the filename is either null or the empty string.public void setReplyInfo(String filename, StoreMessage msg) throws ArgumentNotValid
setReplyInfo
in interface Admin
filename
- The name of the file to have a StoreMessage assigned.msg
- The StoreMessage to be assigned to a file.ArgumentNotValid
- If the StoreMessage is null or if the filename is either null or the empty string.public String getCheckSum(String filename) throws ArgumentNotValid
getCheckSum
in interface Admin
filename
- The name of the file, whose checksum should be retrieved.ArgumentNotValid
- If the filename is either null or the empty string.public void setCheckSum(String filename, String checksum) throws ArgumentNotValid, IllegalState
It should not be possible to change the checksum in the database through arcrepository.
setCheckSum
in interface Admin
filename
- The name of the file to have the checksum changed.checksum
- The new checksum for the file.ArgumentNotValid
- If either the filename or the checksum is either null or the empty string.IllegalState
- Always, since it is not allowed for arcrepository to change the checksum of a completed
upload.public Set<String> getAllFileNames()
getAllFileNames
in interface Admin
public Set<String> getAllFileNames(Replica rep, ReplicaStoreState state) throws ArgumentNotValid
getAllFileNames
in interface Admin
rep
- The replica where the files belong.state
- The ReplicaStoreState for the files.ArgumentNotValid
- If the Replica or the ReplicaStoreState is null.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.