Class ArcRepositoryServer
- java.lang.Object
-
- dk.netarkivet.archive.distribute.ArchiveMessageHandler
-
- dk.netarkivet.archive.arcrepository.distribute.ArcRepositoryServer
-
- All Implemented Interfaces:
ArchiveMessageVisitor
,CleanupIF
,javax.jms.MessageListener
public class ArcRepositoryServer extends ArchiveMessageHandler implements CleanupIF
Listens on the queue "TheArcrepos" and submits the messages to a corresponding visit method on BitarchiveClient.
-
-
Constructor Summary
Constructors Constructor Description ArcRepositoryServer(ArcRepository ar)
Creates and adds a ArcRepositoryMessageHandler as listener on the "TheArcrepos"-queue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup()
Used to clean up a class from within a shutdown hook.void
close()
Removes the ArcRepositoryMessageHandler as listener.void
visit(AdminDataMessage msg)
Update the admin data in the arcrepository.void
visit(StoreMessage msg)
Forwards the call to the ArcRepository.store() method with the StoreMessage as parameter.void
visit(BatchMessage msg)
Resends a batch message to the requested bitarchive.void
visit(BatchReplyMessage msg)
Forwards the handling of batch replies to the arc repository.void
visit(GetFileMessage msg)
Forwards a getfile message to requested bitarchive replica.void
visit(GetMessage msg)
Forwards a get message to the local bitarchive.void
visit(RemoveAndGetFileMessage msg)
Request a file to be deleted from bitarchives.void
visit(UploadMessage msg)
Forwards the handling of upload replies to the arc repository.void
visit(CorrectMessage msg)
Method for handling CorrectMessages.void
visit(GetAllChecksumsMessage msg)
Method for retrieving all the checksums from a replica.void
visit(GetAllFilenamesMessage msg)
For retrieving all the filenames from a replica.void
visit(GetChecksumMessage msg)
Method for handling the results of a GetChecksumMessage.-
Methods inherited from class dk.netarkivet.archive.distribute.ArchiveMessageHandler
onMessage, visit, visit
-
-
-
-
Constructor Detail
-
ArcRepositoryServer
public ArcRepositoryServer(ArcRepository ar)
Creates and adds a ArcRepositoryMessageHandler as listener on the "TheArcrepos"-queue.- Parameters:
ar
- the ArcRepository
-
-
Method Detail
-
visit
public void visit(StoreMessage msg)
Forwards the call to the ArcRepository.store() method with the StoreMessage as parameter. In case of exception when calling store, a reply message is sent containing the message set as NotOK.- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- the message to be processed by the store command.
-
visit
public void visit(RemoveAndGetFileMessage msg)
Request a file to be deleted from bitarchives. This request will be handled by the bitarchives, and the bitarchive containing the file will reply with the removed file if succesful, or with a notOk message if unsuccesful.Will send a not-ok reply on exceptions handling this request.
- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- the message to be processed
-
visit
public void visit(AdminDataMessage msg)
Update the admin data in the arcrepository. Reply aftwerwards. Will reply with notOk on exceptions.- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- the message to be processed
-
visit
public void visit(UploadMessage msg) throws ArgumentNotValid
Forwards the handling of upload replies to the arc repository. Will log errors, but otherwise ignore.- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- a UploadMessage- Throws:
ArgumentNotValid
- If the message is null.
-
visit
public void visit(BatchReplyMessage msg) throws ArgumentNotValid
Forwards the handling of batch replies to the arc repository. Will log errors, but otherwise ignore.- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- a BatchReplyMessage- Throws:
ArgumentNotValid
- If the message is null.
-
visit
public void visit(BatchMessage msg) throws ArgumentNotValid
Resends a batch message to the requested bitarchive.Note that this circumvents the ArcRepository entirely and that the reply goes directly back to whoever set the message.
- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- the batch message to be resend.- Throws:
ArgumentNotValid
- if parameters are null
-
visit
public void visit(GetMessage msg) throws ArgumentNotValid
Forwards a get message to the local bitarchive.Note that this circumvents the ArcRepository entirely and that the reply goes directly back to whoever sent the message.
- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- the message to be processed by the get command.- Throws:
ArgumentNotValid
- If the message is null.
-
visit
public void visit(GetFileMessage msg) throws ArgumentNotValid
Forwards a getfile message to requested bitarchive replica.Note that this circumvents the ArcRepository entirely and that the reply goes directly back to whoever set the message.
- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- the message to be processed by the get command.- Throws:
ArgumentNotValid
- If one of the arguments are null.
-
visit
public void visit(GetAllFilenamesMessage msg) throws ArgumentNotValid
For retrieving all the filenames from a replica.- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- The message to be processed.- Throws:
ArgumentNotValid
- If the argument is null.
-
visit
public void visit(GetAllChecksumsMessage msg) throws ArgumentNotValid
Method for retrieving all the checksums from a replica.- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- The GetAllChecksumsMessage.- Throws:
ArgumentNotValid
- If the GetAllChecksumsMessage is null.
-
visit
public void visit(GetChecksumMessage msg)
Method for handling the results of a GetChecksumMessage. This should be handled similar to a ReplyBatchMessage, when a batchjob has run on a single file.- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- The GetChecksumMessage message.
-
visit
public void visit(CorrectMessage msg) throws ArgumentNotValid
Method for handling CorrectMessages. This message is just sent along to the corresponding replica archive, where the 'bad' entry will be corrected (made backup of and then replaced).- Specified by:
visit
in interfaceArchiveMessageVisitor
- Overrides:
visit
in classArchiveMessageHandler
- Parameters:
msg
- The message for correcting a bad entry in an archive.- Throws:
ArgumentNotValid
- If the CorrectMessage is null.
-
close
public void close()
Removes the ArcRepositoryMessageHandler as listener.
-
-