dk.netarkivet.archive.arcrepository.distribute
Class ArcRepositoryServer

java.lang.Object
  extended by dk.netarkivet.archive.distribute.ArchiveMessageHandler
      extended by dk.netarkivet.archive.arcrepository.distribute.ArcRepositoryServer
All Implemented Interfaces:
ArchiveMessageVisitor, javax.jms.MessageListener

public class ArcRepositoryServer
extends ArchiveMessageHandler

Listens on the queue "TheArcrepos" and submits the messages to a corresponding visit method on BitarchiveClient.


Constructor Summary
ArcRepositoryServer(ArcRepository ar)
          Creates and adds a ArcRepositoryMessageHandler as listener on the "TheArcrepos"-queue.
 
Method Summary
 void close()
          Removes the ArcRepositoryMessageHandler as listener.
 void visit(AdminDataMessage msg)
          Update the admin data in the arcrepository.
 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.
 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(StoreMessage msg)
          Forwards the call to the ArcRepository.store() method with the StoreMessage as parameter.
 void visit(UploadMessage msg)
          Forwards the handling of upload replies to the arc repository.
 
Methods inherited from class dk.netarkivet.archive.distribute.ArchiveMessageHandler
onMessage, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
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 interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
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 interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - the message to be processed

visit

public void visit(UploadMessage msg)
Forwards the handling of upload replies to the arc repository. Will log errors, but otherwise ignore.

Specified by:
visit in interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - a UploadMessage

visit

public void visit(BatchReplyMessage msg)
Forwards the handling of batch replies to the arc repository. Will log errors, but otherwise ignore.

Specified by:
visit in interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - a BatchReplyMessage

visit

public void visit(BatchMessage msg)
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 interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - the batch message to be resend
Throws:
ArgumentNotValid - if parameters are null

visit

public void visit(GetMessage msg)
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 interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - the message to be processed by the get command.

visit

public void visit(GetFileMessage msg)
Forwards a getfile message to 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 interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - the message to be processed by the get command.
Throws:
ArgumentNotValid - If one of the arguments are null.

close

public void close()
Removes the ArcRepositoryMessageHandler as listener.