Class TestArcRepositoryClient
- java.lang.Object
-
- dk.netarkivet.common.arcrepository.TrivialArcRepositoryClient
-
- dk.netarkivet.common.arcrepository.TestArcRepositoryClient
-
- All Implemented Interfaces:
ArcRepositoryClient
,HarvesterArcRepositoryClient
,PreservationArcRepositoryClient
,ViewerArcRepositoryClient
,AutoCloseable
public class TestArcRepositoryClient extends TrivialArcRepositoryClient
A local-file based arc repository client. Given one or more directories with ARC files, this client will serve them out like a normal arcrepository.
-
-
Field Summary
Fields Modifier and Type Field Description File
arcDir
int
batchCounter
How many times batch has been calledboolean
batchMustDie
Whether the batch call should die with an exceptionint
batchPauseMilliseconds
How many milliseconds the batch should pause before runningFile
tmpDir
-
Constructor Summary
Constructors Constructor Description TestArcRepositoryClient(File arcdir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchStatus
batch(FileBatchJob job, String replicaId, String... args)
Runs a batch batch job on each file in the ArcRepository.BitarchiveRecord
get(String arcfile, long index)
Gets a single ARC record out of the ArcRepository.void
getFile(String arcfilename, Replica replica, File toFile)
Retrieves a file from an ArcRepository and places it in a local file.-
Methods inherited from class dk.netarkivet.common.arcrepository.TrivialArcRepositoryClient
close, correct, getAllChecksums, getAllFilenames, getChecksum, removeAndGetFile, store, updateAdminChecksum, updateAdminData
-
-
-
-
Field Detail
-
arcDir
public File arcDir
-
batchCounter
public int batchCounter
How many times batch has been called
-
batchMustDie
public boolean batchMustDie
Whether the batch call should die with an exception
-
batchPauseMilliseconds
public int batchPauseMilliseconds
How many milliseconds the batch should pause before running
-
tmpDir
public File tmpDir
-
-
Constructor Detail
-
TestArcRepositoryClient
public TestArcRepositoryClient(File arcdir)
-
-
Method Detail
-
getFile
public void getFile(String arcfilename, Replica replica, File toFile)
Description copied from class:TrivialArcRepositoryClient
Retrieves a file from an ArcRepository and places it in a local file.- Specified by:
getFile
in interfaceArcRepositoryClient
- Specified by:
getFile
in interfacePreservationArcRepositoryClient
- Specified by:
getFile
in interfaceViewerArcRepositoryClient
- Overrides:
getFile
in classTrivialArcRepositoryClient
- Parameters:
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.
-
get
public BitarchiveRecord get(String arcfile, long index) throws ArgumentNotValid
Description copied from class:TrivialArcRepositoryClient
Gets a single ARC record out of the ArcRepository.- Specified by:
get
in interfaceArcRepositoryClient
- Specified by:
get
in interfacePreservationArcRepositoryClient
- Specified by:
get
in interfaceViewerArcRepositoryClient
- Overrides:
get
in classTrivialArcRepositoryClient
- Parameters:
arcfile
- The name of a file containing the desired record.index
- The offset of the desired record in the file- Returns:
- a BitarchiveRecord-object, or null if request times out or object is not found.
- Throws:
ArgumentNotValid
- if arcfile is null or empty, or index is negative
-
batch
public BatchStatus batch(FileBatchJob job, String replicaId, String... args)
Description copied from class:TrivialArcRepositoryClient
Runs a batch batch job on each file in the ArcRepository.- Specified by:
batch
in interfaceArcRepositoryClient
- Specified by:
batch
in interfacePreservationArcRepositoryClient
- Specified by:
batch
in interfaceViewerArcRepositoryClient
- Overrides:
batch
in classTrivialArcRepositoryClient
- Parameters:
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.- Returns:
- The status of the batch job after it ended.
-
-