Class BitarchiveServer

    • Field Detail

      • batchProcesses

        public Map<String,​Thread> batchProcesses
        Map between running batchjob processes and their message id.
    • Constructor Detail

      • BitarchiveServer

        protected BitarchiveServer()
                            throws UnknownID,
                                   PermissionDenied
        The server creates an instance of the bitarchive it provides access to and starts to listen to JMS messages on the incoming jms queue

        Also, heartbeats are sent out at regular intervals to the Bitarchive Monitor, to tell that this bitarchive is alive.

        Throws:
        UnknownID - - if there was no heartbeat frequency or temp dir defined in settings or if the bitarchiveid cannot be created.
        PermissionDenied - - if the temporary directory or the file directory cannot be written
    • Method Detail

      • getInstance

        public static BitarchiveServer getInstance()
                                            throws ArgumentNotValid,
                                                   UnknownID
        Returns the unique instance of this class The server creates an instance of the bitarchive it provides access to and starts to listen to JMS messages on the incomming jms queue

        Also, heartbeats are sent out at regular intervals to the Bitarchive Monitor, to tell that this bitarchive is alive.

        Returns:
        the instance
        Throws:
        UnknownID - - if there was no heartbeat frequency defined in settings
        ArgumentNotValid - - if the heartbeat frequency in settings is invalid or either argument is null
      • close

        public void close()
        Ends the heartbeat sender before next loop and removes the server as listener on allBa and anyBa. Closes the bitarchive. Calls cleanup.
      • cleanup

        public void cleanup()
        Ends the heartbeat sender before next loop.
        Specified by:
        cleanup in interface CleanupIF
      • visit

        public void visit​(RemoveAndGetFileMessage msg)
                   throws ArgumentNotValid
        Removes an arcfile from the bitarchive and returns the removed file as an remotefile.

        Answers OK if the file is actually removed. Answers notOk if the file exists with wrong checksum or wrong credentials Doesn't answer if the file doesn't exist.

        This method always generates a warning when deleting a file.

        Before the file is removed it is verified that - the file exists in the bitarchive - the file has the correct checksum - the supplied credentials are correct

        Specified by:
        visit in interface ArchiveMessageVisitor
        Overrides:
        visit in class ArchiveMessageHandler
        Parameters:
        msg - a container for remove request
        Throws:
        ArgumentNotValid - If the RemoveAndGetFileMessage is null.
      • getBitarchiveAppId

        public String getBitarchiveAppId()
        Returns a String that identifies this bit archive application (within the bit archive, i.e. either with id ONE or TWO)
        Returns:
        String with IP address of this host and, if specified, the APPLICATION_INSTANCE_ID from settings