public class TrivialArcRepositoryClient extends Object implements ArcRepositoryClient
Constructor and Description |
---|
TrivialArcRepositoryClient()
Constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
BatchStatus |
batch(FileBatchJob job,
String replicaId,
String... args)
Runs a batch batch job on each file in the ArcRepository.
|
void |
close()
Call on shutdown to release external resources.
|
File |
correct(String replicaId,
String checksum,
File file,
String credentials)
Method for correcting a file in a replica.
|
BitarchiveRecord |
get(String arcfile,
long index)
Gets a single ARC record out of the ArcRepository.
|
File |
getAllChecksums(String replicaId)
Retrieves all the checksum from the replica through a GetAllChecksumMessage.
|
File |
getAllFilenames(String replicaId)
Retrieves the names of all the files in the replica through a GetAllFilenamesMessage.
|
String |
getChecksum(String replicaId,
String filename)
Retrieves the checksum of a specific file.
|
void |
getFile(String arcfilename,
Replica replica,
File toFile)
Retrieves a file from an ArcRepository and places it in a local file.
|
File |
removeAndGetFile(String fileName,
String bitarchiveId,
String checksum,
String credentials)
Remove a file from one part of the ArcRepository, retrieving a copy for security purposes.
|
void |
store(File file)
Store the given file in the ArcRepository.
|
void |
updateAdminChecksum(String filename,
String checksum)
Updates the checksum kept in the ArcRepository for a given file.
|
void |
updateAdminData(String fileName,
String bitarchiveId,
ReplicaStoreState newval)
Updates the administrative data in the ArcRepository for a given file and replica.
|
public TrivialArcRepositoryClient()
public void close()
close
in interface ArcRepositoryClient
close
in interface HarvesterArcRepositoryClient
close
in interface PreservationArcRepositoryClient
close
in interface ViewerArcRepositoryClient
public void store(File file) throws IOFailure, ArgumentNotValid
store
in interface ArcRepositoryClient
store
in interface HarvesterArcRepositoryClient
store
in interface PreservationArcRepositoryClient
file
- A file to be stored. Must exist.IOFailure
- thrown if store is unsuccessful, or failed to clean up files after the store operation.ArgumentNotValid
- if file parameter is null or file is not an existing file.public BitarchiveRecord get(String arcfile, long index) throws ArgumentNotValid
get
in interface ArcRepositoryClient
get
in interface PreservationArcRepositoryClient
get
in interface ViewerArcRepositoryClient
arcfile
- The name of a file containing the desired record.index
- The offset of the desired record in the fileArgumentNotValid
- if arcfile is null or empty, or index is negativeIOFailure
- If the get operation failed.public void getFile(String arcfilename, Replica replica, File toFile)
getFile
in interface ArcRepositoryClient
getFile
in interface PreservationArcRepositoryClient
getFile
in interface ViewerArcRepositoryClient
arcfilename
- Name of the arcfile to retrieve.replica
- The bitarchive to retrieve the data from (not used in this implementation)toFile
- Filename of a place where the file fetched can be put.IOFailure
- if there are problems getting a reply or the file could not be found.public BatchStatus batch(FileBatchJob job, String replicaId, String... args)
batch
in interface ArcRepositoryClient
batch
in interface PreservationArcRepositoryClient
batch
in interface ViewerArcRepositoryClient
job
- An object that implements the FileBatchJob interface. The initialize() method will be called before
processing and the finish() method will be called afterwards. The process() method will be called with each File
entry. An optional function postProcess() allows handling the combined results of the batchjob, e.g. summing the
results, sorting, etc.replicaId
- The archive to execute the job on (not used in this implementation)args
- The arguments for the batchjob.public void updateAdminData(String fileName, String bitarchiveId, ReplicaStoreState newval)
updateAdminData
in interface ArcRepositoryClient
updateAdminData
in interface PreservationArcRepositoryClient
fileName
- The name of a file stored in the ArcRepository.bitarchiveId
- The id of the replica that the administrative data for fileName is wrong for.newval
- What the administrative data will be updated to.public void updateAdminChecksum(String filename, String checksum)
updateAdminChecksum
in interface ArcRepositoryClient
updateAdminChecksum
in interface PreservationArcRepositoryClient
filename
- The name of a file stored in the ArcRepository.checksum
- The new checksum.public File removeAndGetFile(String fileName, String bitarchiveId, String checksum, String credentials)
removeAndGetFile
in interface ArcRepositoryClient
removeAndGetFile
in interface PreservationArcRepositoryClient
fileName
- The name of the file to remove.bitarchiveId
- The id of the replica from which to remove the file (not used)checksum
- The checksum of the file to be removed (not used)credentials
- A string that shows that the user is allowed to perform this operation (not used)public File getAllChecksums(String replicaId)
PreservationArcRepositoryClient
This is the checksum archive alternative to running a ChecksumBatchJob.
getAllChecksums
in interface PreservationArcRepositoryClient
replicaId
- The id of the replica from which the checksums should be retrieved.GetAllChecksumsMessage
public File getAllFilenames(String replicaId)
PreservationArcRepositoryClient
This is the checksum archive alternative to running a FilelistBatchJob.
getAllFilenames
in interface PreservationArcRepositoryClient
replicaId
- The id of the replica from which the list of filenames should be retrieved.GetAllFilenamesMessage
public File correct(String replicaId, String checksum, File file, String credentials)
PreservationArcRepositoryClient
This is the checksum archive method for correcting a file entry in the archive. The bitarchive uses 'removeAndGetFile' followed by a 'store'.
correct
in interface PreservationArcRepositoryClient
replicaId
- The identification of the replica.checksum
- The checksum of the corrupt entry in the archive. It is important to validate that the checksum
actually is wrong before correcting the entry.file
- The new file to replace the old one.credentials
- The password for allowing to remove a file entry in the archive.public String getChecksum(String replicaId, String filename)
PreservationArcRepositoryClient
This is the checksum archive alternative to running a ChecksumJob limited to a specific file.
getChecksum
in interface PreservationArcRepositoryClient
replicaId
- The name of the replica to send the message.filename
- The name of the file for whom the checksum should be retrieved.Copyright © 2005–2018 The Royal Danish Library, the National Library of France and the Austrian National Library.. All rights reserved.