Class ChecksumFileServer

  • All Implemented Interfaces:
    ArchiveMessageVisitor, CleanupIF, javax.jms.MessageListener

    public class ChecksumFileServer
    extends ChecksumArchiveServer
    The server for the ChecksumFileApplication. Used for communication between the ArcRepository and the checksum archive.
    • Field Detail

      • cs

        protected ChecksumArchive cs
        The archive which contain the actual data.
      • APPLICATION_ID_SEPARATOR

        public static final String APPLICATION_ID_SEPARATOR
        The character to separate the applicationInstanceId and the IP address.
        See Also:
        Constant Field Values
    • Method Detail

      • getInstance

        public static ChecksumFileServer getInstance()
        Returns the unique instance of this class.

        The server creates an instance of the checksum it creates access to and starts to listen to a JMS messages on the incoming JMS queue.

        Should this do the heart beats to a monitor? This would be quite odd, since Checksum does not use a monitor.

        Returns:
        This instance.
      • close

        public void close()
        Method for closing the instance.
      • getAppId

        public String getAppId()
        Method for retrieving the identification of this application.
        Specified by:
        getAppId in class ChecksumArchiveServer
        Returns:
        The id of this application.
      • createAppId

        protected String createAppId()
        Method for creating the identification for this application.
        Returns:
        The id of this application.
      • visit

        public void visit​(CorrectMessage msg)
                   throws ArgumentNotValid
        Method for correcting an entry in the archive. It start by ensuring that the file exists, then it checks the credentials. Then it is checked whether the "bad entry" does have the "bad checksum". If no problems occurred, then the bad entry will be corrected by the archive (the bad entry is removed from the archive file and put into the "wrong entry" file. Then the new entry is placed in the archive file.

        If it fails in any of the above, then the method fails (throws an exception which is caught and use for replying NotOk to the message).

        Specified by:
        visit in interface ArchiveMessageVisitor
        Specified by:
        visit in class ChecksumArchiveServer
        Parameters:
        msg - The message containing the correct instance of the file to correct.
        Throws:
        ArgumentNotValid - If the correct message is null.