|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.netarkivet.common.distribute.arcrepository.LocalArcRepositoryClient
public class LocalArcRepositoryClient
A simple implementation of ArcRepositoryClient that just has a number of local directories that it keeps its files in. It doesn't implement credentials checks or checksum storing.
Constructor Summary | |
---|---|
LocalArcRepositoryClient()
Create a new LocalArcRepositoryClient based on current settings. |
Method Summary | |
---|---|
BatchStatus |
batch(FileBatchJob job,
java.lang.String replicaId)
Runs a batch job on each file in the ArcRepository. |
void |
close()
Call on shutdown to release external resources. |
void |
correct(java.lang.String replicaId,
java.lang.String checksum,
java.io.File file,
java.lang.String credentials)
Method for correcting a file in a replica. |
BitarchiveRecord |
get(java.lang.String arcfile,
long index)
Gets a single ARC record out of the ArcRepository. |
java.io.File |
getAllChecksums(java.lang.String replicaId)
Retrieves all the checksum from the replica through a GetAllChecksumMessage. |
java.io.File |
getAllFilenames(java.lang.String replicaId)
Retrieves the names of all the files in the replica through a GetAllFilenamesMessage. |
void |
getFile(java.lang.String arcfilename,
Replica replica,
java.io.File toFile)
Retrieves a file from an ArcRepository and places it in a local file. |
java.io.File |
removeAndGetFile(java.lang.String fileName,
java.lang.String bitarchiveId,
java.lang.String checksum,
java.lang.String credentials)
Remove a file from one part of the ArcRepository, retrieving a copy for security purposes. |
void |
store(java.io.File file)
Store the given file in the ArcRepository. |
void |
updateAdminChecksum(java.lang.String filename,
java.lang.String checksum)
Updates the checksum kept in the ArcRepository for a given file. |
void |
updateAdminData(java.lang.String fileName,
java.lang.String bitarchiveId,
ReplicaStoreState newval)
Updates the administrative data in the ArcRepository for a given file and replica. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalArcRepositoryClient()
Method Detail |
---|
public void close()
close
in interface ArcRepositoryClient
close
in interface HarvesterArcRepositoryClient
close
in interface PreservationArcRepositoryClient
close
in interface ViewerArcRepositoryClient
public void store(java.io.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.
IllegalState
- if file already exists.
ArgumentNotValid
- if file parameter is null or file is not an
existing file.public BitarchiveRecord get(java.lang.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 file
ArgumentNotValid
- on null or empty filenames, or if index is
negative.
IOFailure
- If the get operation failed.public void getFile(java.lang.String arcfilename, Replica replica, java.io.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.toFile
- Filename of a place where the file fetched can be put.
ArgumentNotValid
- if arcfilename is null or empty, or if toFile
is null
IOFailure
- if there are problems reading or writing file, or
the file with the given arcfilename could not be found.public BatchStatus batch(FileBatchJob job, java.lang.String replicaId)
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.replicaId
- The id of the archive to execute the job on.
public void updateAdminData(java.lang.String fileName, java.lang.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(java.lang.String filename, java.lang.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 java.io.File removeAndGetFile(java.lang.String fileName, java.lang.String bitarchiveId, java.lang.String checksum, java.lang.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 in this implementation, may be null.checksum
- The checksum of the file to be removed.credentials
- A string that shows that the user is allowed to
perform this operation.
ArgumentNotValid
- On null or empty parameters for fileName,
checksum or credentials.
IOFailure
- On IO trouble.
PermissionDenied
- On wrong MD5 sum or wrong credentials.public java.io.File getAllChecksums(java.lang.String replicaId)
PreservationArcRepositoryClient
getAllChecksums
in interface PreservationArcRepositoryClient
replicaId
- The id of the replica from which the checksums should
be retrieved.
dk.netarkivet.archive.checksum.GetAllChecksumsMessage
public java.io.File getAllFilenames(java.lang.String replicaId)
PreservationArcRepositoryClient
getAllFilenames
in interface PreservationArcRepositoryClient
replicaId
- The id of the replica from which the list of filenames
should be retrieved.
dk.netarkivet.archive.checksum.GetAllFilenamesMessage
public void correct(java.lang.String replicaId, java.lang.String checksum, java.io.File file, java.lang.String credentials)
PreservationArcRepositoryClient
correct
in interface PreservationArcRepositoryClient
replicaId
- The identification of the replica.file
- The new file to replace the old one.credentials
- The password for allowing to remove a file entry in
the archive.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |