public final class BitarchiveClient extends Object implements ReplicaClient
Modifier and Type | Method and Description |
---|---|
void |
close()
Release jms connections.
|
GetMessage |
get(String arcfile,
long index)
Submit a get request to the bitarchive.
|
static BitarchiveClient |
getInstance(ChannelID allBaIn,
ChannelID anyBaIn,
ChannelID theBamonIn)
Factory that establish the connection to the server.
|
ReplicaType |
getType()
Retrieves the type of replica.
|
BatchMessage |
sendBatchJob(BatchMessage bMsg)
Submit an already constructed get message to the archive.
|
BatchMessage |
sendBatchJob(ChannelID replyChannel,
FileBatchJob job)
Submit a batch job to the archive.
|
void |
sendBatchTerminationMessage(String batchID)
Sends a message to terminate a running batchjob.
|
void |
sendCorrectMessage(CorrectMessage msg)
For correcting an erroneous entry in the archive.
|
void |
sendGetAllChecksumsMessage(GetAllChecksumsMessage msg)
Method for sending the GetAllChecksumMessage to the ChecksumReplica.
|
void |
sendGetAllFilenamesMessage(GetAllFilenamesMessage msg)
Method for sending a GetAllFilenamesMessage to a checksum archive.
|
GetChecksumMessage |
sendGetChecksumMessage(ChannelID replyChannel,
String filename)
Method for retrieving the checksum of a specific arcfile within the archive.
|
void |
sendGetChecksumMessage(GetChecksumMessage msg)
Method for retrieving the checksum of a specific arcfile within the archive.
|
void |
sendGetFileMessage(GetFileMessage msg)
Submit an already constructed getfile message to the archive.
|
void |
sendGetMessage(GetMessage msg)
Submit an already constructed batch message to the archive.
|
void |
sendRemoveAndGetFileMessage(RemoveAndGetFileMessage msg)
Forward the message to ALL_BA.
|
void |
sendUploadMessage(RemoteFile rf,
String precomputedChecksum)
Submit an upload request to the bitarchive.
|
public static BitarchiveClient getInstance(ChannelID allBaIn, ChannelID anyBaIn, ChannelID theBamonIn) throws IOFailure
allBaIn
- topic to all bitarchivesanyBaIn
- queue to one of the bitarchivestheBamonIn
- queue to the bitarchive monitorIOFailure
- If there is a problem making the connection.public GetMessage get(String arcfile, long index)
arcfile
- The file containing the requested recordindex
- Offset of the ARC record in the filepublic void sendGetMessage(GetMessage msg)
sendGetMessage
in interface ReplicaClient
msg
- the message to be processed by the get command.public void sendGetFileMessage(GetFileMessage msg)
sendGetFileMessage
in interface ReplicaClient
msg
- get file message to retrieve.public void sendRemoveAndGetFileMessage(RemoveAndGetFileMessage msg)
sendRemoveAndGetFileMessage
in interface ReplicaClient
msg
- the message to forward.public void sendBatchTerminationMessage(String batchID) throws ArgumentNotValid
batchID
- The ID of the batchjob to terminate.ArgumentNotValid
- If the batchID is either null or the empty string.public void sendUploadMessage(RemoteFile rf, String precomputedChecksum) throws IOFailure, ArgumentNotValid
sendUploadMessage
in interface ReplicaClient
rf
- The file to upload.precomputedChecksum
- A precomputed checksumIOFailure
- If access to file denied.ArgumentNotValid
- If arcfile is null.public BatchMessage sendBatchJob(BatchMessage bMsg) throws ArgumentNotValid
sendBatchJob
in interface ReplicaClient
bMsg
- a BatchMessage.ArgumentNotValid
- If message is null.public BatchMessage sendBatchJob(ChannelID replyChannel, FileBatchJob job) throws ArgumentNotValid, IOFailure
sendBatchJob
in interface ReplicaClient
replyChannel
- The channel that the reply of this job should be sent to.job
- The job that should be run on the bit archive handled by this client.ArgumentNotValid
- If any parameter was null.IOFailure
- If sending the batch message did not succeed.public void close()
close
in interface ReplicaClient
public void sendCorrectMessage(CorrectMessage msg) throws ArgumentNotValid
sendCorrectMessage
in interface ReplicaClient
msg
- The correct message to correct the bad entry in the archive.ArgumentNotValid
- If the CorrectMessage is null.public void sendGetAllFilenamesMessage(GetAllFilenamesMessage msg) throws ArgumentNotValid
sendGetAllFilenamesMessage
in interface ReplicaClient
msg
- The GetAllFilenamesMessage, which will be sent through the jms connection to the checksum archive.ArgumentNotValid
- If the GetAllFilenamesMessage is null.public void sendGetAllChecksumsMessage(GetAllChecksumsMessage msg) throws ArgumentNotValid
sendGetAllChecksumsMessage
in interface ReplicaClient
msg
- The GetAllChecksumMessage, which will be sent through the jms connection to the checksum archive.ArgumentNotValid
- If the GetAllChecksumsMessage is null.public void sendGetChecksumMessage(GetChecksumMessage msg) throws ArgumentNotValid
sendGetChecksumMessage
in interface ReplicaClient
msg
- The GetChecksumMessage which will be sent to the checksum archive though the jms connection.ArgumentNotValid
- If the GetChecksumMessage is null.public GetChecksumMessage sendGetChecksumMessage(ChannelID replyChannel, String filename) throws ArgumentNotValid
sendGetChecksumMessage
in interface ReplicaClient
replyChannel
- The channel where the reply should be sent.filename
- The GetChecksumMessage which has been sent to the checksum archive though the jms connection.ArgumentNotValid
- If the reply channel is null or if the filename is either null or the empty string.public ReplicaType getType()
getType
in interface ReplicaClient
Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.