|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.archive.arcrepositoryadmin.ReplicaCacheHelpers
public final class ReplicaCacheHelpers
Helper methods used by ReplicaCacheDatabase
.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
The log. |
Method Summary | |
---|---|
protected static long |
addFileInformation(java.lang.String file,
Replica replica,
java.sql.Connection con)
Add information about one file in a given replica. |
protected static void |
createReplicaFileInfoEntriesInDB(long fileId,
java.sql.Connection con)
When a new file is inserted into the database, each replica gets a new entry in the replicafileinfo table for this file. |
protected static boolean |
existsReplicaFileInfoInDB(long fileid,
java.lang.String replicaID,
java.sql.Connection con)
Method for checking whether a replicafileinfo is in the database. |
protected static boolean |
existsReplicaInDB(Replica rep,
java.sql.Connection con)
Method for testing whether a replica already is within the database. |
protected static void |
fileChecksumVote(long fileId,
java.sql.Connection con)
The method for voting about the checksum of a file. |
protected static ReplicaFileInfo |
getReplicaFileInfo(long replicaFileInfoGuid,
java.sql.Connection con)
Method for retrieving ReplicaFileInfo entry in the database. |
protected static long |
insertFileIntoDB(java.lang.String filename,
java.sql.Connection connection)
Method to create a new entry in the file table in the database. |
protected static void |
insertReplicaIntoDB(Replica rep,
java.sql.Connection con)
Method for inserting a Replica into the replica table. |
static long |
processChecksumline(java.lang.String filename,
java.lang.String checksum,
Replica replica,
java.sql.Connection con)
Process checksum information about one file in a given replica. |
protected static java.lang.String |
retrieveChecksumForReplicaFileInfoEntry(long fileGuid,
java.lang.String repId,
java.sql.Connection con)
Retrieves the checksum for a specific entry in the replicafileinfo table identified by the file guid and the replica id. |
protected static ChecksumStatus |
retrieveChecksumStatusForReplicaFileInfoEntry(long fileGuid,
java.lang.String repId,
java.sql.Connection con)
Retrieves the checksum status for a specific entry in the replicafileinfo table identified by the file guid and the replica id. |
protected static int |
retrieveFileListStatusFromReplicaFileInfo(java.lang.String filename,
java.lang.String replicaId,
java.sql.Connection con)
Method for retrieving the filelist_status for the entry in the replicafileinfo table associated with the given filename for the replica identified with a given id. |
protected static java.lang.String |
retrieveFilenameForFileId(long fileId,
java.sql.Connection con)
Method for retrieving the filename from the entry in the file table which has the fileId as file_id. |
protected static long |
retrieveGuidForFilenameOnReplica(java.lang.String filename,
java.lang.String replicaId,
java.sql.Connection con)
Retrieve the guid stored for a filename on a given replica. |
protected static long |
retrieveIdForFile(java.lang.String filename,
java.sql.Connection con)
Retrieves the file_id for the corresponding filename. |
protected static java.util.List<java.lang.String> |
retrieveIdsFromFileTable(java.sql.Connection con)
Method for retrieving all the file IDs within the database. |
protected static java.util.List<java.lang.String> |
retrieveIdsFromReplicaFileInfoTable(java.sql.Connection con)
Method for retrieving all the ReplicaFileInfo GUIDs within the database. |
protected static java.util.List<java.lang.String> |
retrieveIdsFromReplicaTable(java.sql.Connection con)
Method for retrieving the replica IDs within the database. |
protected static long |
retrieveReplicaFileInfoGuid(long fileId,
java.lang.String replicaId,
java.sql.Connection con)
Method for retrieving the replicafileinfo_guid for a specific instance defined from the fileId and the replicaId. |
protected static java.util.Set<java.lang.Long> |
retrieveReplicaFileInfoGuidsForReplica(java.lang.String replicaId,
java.sql.Connection con)
Method for retrieving the list of all the replicafileinfo_guids for a specific replica. |
protected static java.util.List<ReplicaFileInfo> |
retrieveReplicaFileInfosWithChecksum(java.util.List<java.lang.Long> rfiGuids,
java.sql.Connection con)
Method for retrieving the data for the wanted entries in the replicafileinfo table. |
protected static java.util.List<java.lang.String> |
retrieveReplicaIdsWithOKChecksumStatus(java.lang.String filename,
java.sql.Connection con)
Method for retrieving the list of replica, where the file with the given name has the checksum_status 'OK'. |
protected static ReplicaType |
retrieveReplicaType(java.lang.String replicaId,
java.sql.Connection con)
Method for retrieving the replica type for a specific replica. |
protected static ReplicaStoreState |
retrieveUploadStatus(long fileGuid,
java.lang.String repId,
java.sql.Connection con)
Retrieves the UploadStatus for a specific entry in the replicafileinfo table identified by the file guid and the replica id. |
protected static void |
setChecksumlistDateForReplica(Replica rep,
java.sql.Date date,
java.sql.Connection con)
Method for setting the checksum_updated field for a given replica in the replica table to a specified value. |
protected static void |
setFilelistDateForReplica(Replica rep,
java.sql.Date date,
java.sql.Connection con)
Method for setting the filelist_updated field for a given replica in the replica table to a specified value. |
protected static void |
updateChecksumDateForReplica(Replica rep,
java.sql.Connection con)
Method for updating the checksum_updated field for a given replica in the replica table. |
protected static void |
updateFilelistDateForReplica(Replica rep,
java.sql.Connection connection)
Method for updating the filelist_updated field for a given replica in the replica table. |
protected static void |
updateReplicaFileInfo(long replicafileinfoGuid,
java.lang.String checksum,
java.sql.Date date,
ReplicaStoreState state,
java.sql.Connection con)
Method for updating an entry in the replicafileinfo table. |
protected static void |
updateReplicaFileInfo(long replicafileinfoGuid,
java.lang.String checksum,
ReplicaStoreState state,
java.sql.Connection con)
Method for updating an entry in the replicafileinfo table. |
protected static void |
updateReplicaFileInfoChecksum(long replicafileinfoId,
java.lang.String checksum,
java.sql.Connection con)
This is used for updating a replicafileinfo instance based on the results of a checksumjob. |
protected static void |
updateReplicaFileInfoChecksumCorrupt(long replicafileinfoId,
java.sql.Connection con)
Method for updating the checksum status of a replicafileinfo instance. |
protected static void |
updateReplicaFileInfoChecksumOk(long replicafileinfoId,
java.sql.Connection con)
Method for updating the checksum status of a replicafileinfo instance. |
protected static void |
updateReplicaFileInfoChecksumUnknown(long replicafileinfoId,
java.sql.Connection con)
Method for updating the checksum status of a replicafileinfo instance. |
protected static void |
updateReplicaFileInfoFilelist(long replicafileinfoId,
java.sql.Connection con)
Method for updating the filelist of a replicafileinfo instance. |
protected static void |
updateReplicaFileInfoMissingFromFilelist(long replicafileinfoId,
java.sql.Connection con)
Method for updating the filelist of a replicafileinfo instance. |
protected static java.lang.String |
vote(java.util.List<java.lang.String> checksums)
Method for finding the checksum which is present most times in the list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
Method Detail |
---|
protected static boolean existsReplicaFileInfoInDB(long fileid, java.lang.String replicaID, java.sql.Connection con) throws IllegalState
fileid
- The id of the file.replicaID
- The id of the replica.con
- An open connection to the archive database
IllegalState
- If more than one copy of the replicafileinfo is
placed in the database.protected static void insertReplicaIntoDB(Replica rep, java.sql.Connection con) throws IOFailure
rep
- The Replica to insert into the replica table.con
- An open connection to the archive database
IOFailure
- If a SQLException is caught.protected static long insertFileIntoDB(java.lang.String filename, java.sql.Connection connection) throws IllegalState
filename
- The filename for the new entry in the file table.connection
- An open connection to the archive database
IllegalState
- If the file cannot be inserted into the database.protected static void createReplicaFileInfoEntriesInDB(long fileId, java.sql.Connection con) throws IllegalState
fileId
- The id for the file.con
- An open connection to the archive database
IllegalState
- If the file could not be entered into the database.protected static java.util.List<java.lang.String> retrieveIdsFromReplicaTable(java.sql.Connection con)
con
- An open connection to the archive database
protected static java.util.List<java.lang.String> retrieveIdsFromFileTable(java.sql.Connection con)
con
- An open connection to the archive database
protected static java.util.List<java.lang.String> retrieveIdsFromReplicaFileInfoTable(java.sql.Connection con)
con
- An open connection to the archive database
protected static long retrieveIdForFile(java.lang.String filename, java.sql.Connection con)
filename
- The entry in the filename list where the corresponding
file_id should be found.con
- An open connection to the archive database
protected static long retrieveReplicaFileInfoGuid(long fileId, java.lang.String replicaId, java.sql.Connection con)
fileId
- The identifier for the file.replicaId
- The identifier for the replica.con
- An open connection to the archive database
protected static java.util.Set<java.lang.Long> retrieveReplicaFileInfoGuidsForReplica(java.lang.String replicaId, java.sql.Connection con)
replicaId
- The id for the replica to contain the files.con
- An open connection to the archiveDatabase.
protected static ReplicaType retrieveReplicaType(java.lang.String replicaId, java.sql.Connection con)
replicaId
- The id of the replica.con
- An open connection to the archiveDatabase.
protected static java.util.List<java.lang.String> retrieveReplicaIdsWithOKChecksumStatus(java.lang.String filename, java.sql.Connection con)
filename
- The name of the file.con
- An open connection to the archive database
protected static java.lang.String retrieveFilenameForFileId(long fileId, java.sql.Connection con)
fileId
- The file_id of the entry in the file table for which to
retrieve the filename.con
- An open connection to the archive database
protected static int retrieveFileListStatusFromReplicaFileInfo(java.lang.String filename, java.lang.String replicaId, java.sql.Connection con)
filename
- the filename of the file for which you want a status.replicaId
- The identifier of the replicacon
- An open connection to the archive database
protected static void updateReplicaFileInfoChecksum(long replicafileinfoId, java.lang.String checksum, java.sql.Connection con)
replicafileinfoId
- The unique id for the replicafileinfo.checksum
- The new checksum for the entry.con
- An open connection to the archive databaseprotected static void updateReplicaFileInfoFilelist(long replicafileinfoId, java.sql.Connection con)
replicafileinfoId
- The id of the replicafileinfo.con
- An open connection to the archive databaseprotected static void updateReplicaFileInfoMissingFromFilelist(long replicafileinfoId, java.sql.Connection con)
replicafileinfoId
- The id of the replicafileinfo.con
- An open connection to the archive databaseprotected static void updateReplicaFileInfoChecksumCorrupt(long replicafileinfoId, java.sql.Connection con)
replicafileinfoId
- The id of the replicafileinfo.con
- An open connection to the archive databaseprotected static long retrieveGuidForFilenameOnReplica(java.lang.String filename, java.lang.String replicaId, java.sql.Connection con)
filename
- a given filenamereplicaId
- An identifier for a replica.con
- An open connection to the archive database
protected static void updateReplicaFileInfoChecksumUnknown(long replicafileinfoId, java.sql.Connection con)
replicafileinfoId
- The id of the replicafileinfo.con
- An open connection to the archive databaseprotected static void updateReplicaFileInfoChecksumOk(long replicafileinfoId, java.sql.Connection con)
replicafileinfoId
- The id of the replicafileinfo.con
- An open connection to the archive databaseprotected static void updateChecksumDateForReplica(Replica rep, java.sql.Connection con)
rep
- The replica which has just been updated.con
- An open connection to the archive databaseprotected static void updateFilelistDateForReplica(Replica rep, java.sql.Connection connection)
rep
- The replica which has just been updated.connection
- An open connection to the archive databaseprotected static void setFilelistDateForReplica(Replica rep, java.sql.Date date, java.sql.Connection con)
rep
- The replica which has just been updated.date
- The date for the last filelist update.con
- An open connection to the archive databaseprotected static void setChecksumlistDateForReplica(Replica rep, java.sql.Date date, java.sql.Connection con)
rep
- The replica which has just been updated.date
- The date for the last checksum update.con
- An open connection to the archive databaseprotected static boolean existsReplicaInDB(Replica rep, java.sql.Connection con)
rep
- The replica to find in the database.con
- An open connection to the archive database
protected static ReplicaFileInfo getReplicaFileInfo(long replicaFileInfoGuid, java.sql.Connection con)
replicaFileInfoGuid
- The guid for the specific replicafileinfo.con
- An open connection to the archive database
protected static java.util.List<ReplicaFileInfo> retrieveReplicaFileInfosWithChecksum(java.util.List<java.lang.Long> rfiGuids, java.sql.Connection con)
rfiGuids
- The list of guids for the entries in the replicafileinfo
table which is wanted.con
- An open connection to the archive database
protected static void updateReplicaFileInfo(long replicafileinfoGuid, java.lang.String checksum, ReplicaStoreState state, java.sql.Connection con) throws IOFailure
replicafileinfoGuid
- The guid to update.checksum
- The new checksum for the entry.state
- The state for the upload.con
- An open connection to the archive database
IOFailure
- If an error occurs in the database connection.protected static void updateReplicaFileInfo(long replicafileinfoGuid, java.lang.String checksum, java.sql.Date date, ReplicaStoreState state, java.sql.Connection con) throws IOFailure
replicafileinfoGuid
- The guid to update.checksum
- The new checksum for the entry.date
- The date for the update.state
- The status for the upload.con
- An open connection to the archive database
IOFailure
- If an error occurs in the connection to the database.protected static ReplicaStoreState retrieveUploadStatus(long fileGuid, java.lang.String repId, java.sql.Connection con)
fileGuid
- The id of the file.repId
- The id of the replica.con
- An open connection to the archive database
protected static java.lang.String retrieveChecksumForReplicaFileInfoEntry(long fileGuid, java.lang.String repId, java.sql.Connection con)
fileGuid
- The guid of the file in the file table.repId
- The id of the replica.con
- An open connection to the archive database
protected static ChecksumStatus retrieveChecksumStatusForReplicaFileInfoEntry(long fileGuid, java.lang.String repId, java.sql.Connection con)
fileGuid
- The guid of the file in the file table.repId
- The id of the replica.con
- An open connection to the archive database
protected static java.lang.String vote(java.util.List<java.lang.String> checksums)
checksums
- The list of checksum to vote about.
protected static void fileChecksumVote(long fileId, java.sql.Connection con)
fileId
- The id for the file to vote about.con
- An open connection to the archive databaseprotected static long addFileInformation(java.lang.String file, Replica replica, java.sql.Connection con)
file
- The name of a filereplica
- A replicacon
- An open connection to the ArchiveDatabase
public static long processChecksumline(java.lang.String filename, java.lang.String checksum, Replica replica, java.sql.Connection con)
filename
- The name of a filechecksum
- The checksum of that file.replica
- A replicacon
- An open connection to the ArchiveDatabase
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |