dk.netarkivet.archive.checksum.distribute
Class ChecksumArchiveServer

java.lang.Object
  extended by dk.netarkivet.archive.distribute.ArchiveMessageHandler
      extended by dk.netarkivet.archive.checksum.distribute.ChecksumArchiveServer
All Implemented Interfaces:
ArchiveMessageVisitor, CleanupIF, javax.jms.MessageListener
Direct Known Subclasses:
ChecksumFileServer

public abstract class ChecksumArchiveServer
extends ArchiveMessageHandler
implements CleanupIF

Any subclass must be invoked through a method called 'getInstance'.


Field Summary
protected  java.lang.String checksumAppId
          The unique id for this instance.
protected  JMSConnection jmsCon
          The JMS connection.
protected  ChannelID theCR
          The channel used for communication.
 
Constructor Summary
ChecksumArchiveServer()
           
 
Method Summary
abstract  void cleanup()
          Method for cleaning up.
(package private) abstract  void close()
          Method for closing.
abstract  java.lang.String getAppId()
          Method for retrieving the application id.
abstract  void visit(CorrectMessage msg)
          Requiring all inheritors of this interface to handle the CorrectMessage.
abstract  void visit(GetAllChecksumsMessage msg)
          Requiring all inheritors of this interface to handle the GetAllChecksumMessage.
abstract  void visit(GetAllFilenamesMessage msg)
          Requiring all inheritors of this interface to handle the GetAllFilenamesMessage.
abstract  void visit(GetChecksumMessage msg)
          Requiring all inheritors of this interface to handle the GetChecksumMessage.
abstract  void visit(UploadMessage msg)
          Requiring all inheritors of this interface to handle the UploadMessage.
 
Methods inherited from class dk.netarkivet.archive.distribute.ArchiveMessageHandler
onMessage, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jmsCon

protected JMSConnection jmsCon
The JMS connection.


checksumAppId

protected java.lang.String checksumAppId
The unique id for this instance.


theCR

protected ChannelID theCR
The channel used for communication.

Constructor Detail

ChecksumArchiveServer

public ChecksumArchiveServer()
Method Detail

close

abstract void close()
Method for closing.


cleanup

public abstract void cleanup()
Method for cleaning up.

Specified by:
cleanup in interface CleanupIF

getAppId

public abstract java.lang.String getAppId()
Method for retrieving the application id.

Returns:
The application id.

visit

public abstract void visit(UploadMessage msg)
Requiring all inheritors of this interface to handle the UploadMessage. The data should be fetched and put into the archive.

Specified by:
visit in interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - The UploadMessage to be handled.

visit

public abstract void visit(CorrectMessage msg)
Requiring all inheritors of this interface to handle the CorrectMessage. If an entry in the archive corresponds to the 'wrong' entry described in the CorrectMessage, then the file in the CorrectMessage should replace the current entry in the archive.

Specified by:
visit in interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - The CorrectMessage to be handled.

visit

public abstract void visit(GetChecksumMessage msg)
Requiring all inheritors of this interface to handle the GetChecksumMessage. The checksum of the wanted entry in the archive should be fetched and returned.

Specified by:
visit in interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - The GetChecksumMessage to be handled.

visit

public abstract void visit(GetAllChecksumsMessage msg)
Requiring all inheritors of this interface to handle the GetAllChecksumMessage. The entire archive should be put into a file corresponding to a ChecksumJob file, then made into a remote file and sent back through the reply.

Specified by:
visit in interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - The GetAllChecksumMessage to be handled.

visit

public abstract void visit(GetAllFilenamesMessage msg)
Requiring all inheritors of this interface to handle the GetAllFilenamesMessage. The filenames of all the entries in the archive should be placed in a file corresponding to a FilelistJob and sent back through the reply.

Specified by:
visit in interface ArchiveMessageVisitor
Overrides:
visit in class ArchiveMessageHandler
Parameters:
msg - The GetAllFilenamesMessage to be handled.