Class UpdateableAdminData

  • All Implemented Interfaces:
    Admin

    @Deprecated
    public class UpdateableAdminData
    extends AdminData
    implements Admin
    Deprecated.
    Use the database instance instead, DatabaseAdmin.
    Class for accessing and manipulating the administrative data for the ArcRepository. In the current implementation, it consists of a file with a number of lines of the form: filename checksum state timestamp-for-last-state-change [, bitarchive> storestatus timestamp-for-last-state-change]*

    If a line in the admin data file is corrupt, the entry is removed from admindata.

    Notes: If the admindata file does not exist on start-up, the file is created in the constructor. If the admindata file on start-up is the oldversion, the admindata file is migrated to the new version.

    • Method Detail

      • getInstance

        public static UpdateableAdminData getInstance()
        Deprecated.
        Get the singleton instance.
        Returns:
        The singleton
      • addEntry

        public void addEntry​(String filename,
                             StoreMessage replyInfo,
                             String checksum)
        Deprecated.
        Add new entry to the admin data, and persist it to disk.
        Specified by:
        addEntry in interface Admin
        Parameters:
        filename - A filename
        replyInfo - A replyInfo for this entry (may be null)
        checksum - The Checksum for this file
      • addEntry

        public void addEntry​(String filename,
                             StoreMessage replyInfo,
                             String checksum,
                             boolean persistNow)
        Deprecated.
        Add new entry to the admin data, and persist it to disk, if persistNow set to true.
        Parameters:
        filename - A filename
        replyInfo - A replyInfo for this entry (may be null)
        checksum - The Checksum for this file
        persistNow - Shall we persist this entry now?
      • setReplyInfo

        public void setReplyInfo​(String fileName,
                                 StoreMessage replyInfo)
                          throws UnknownID
        Deprecated.
        Records the replyInfo (StoreMessage object) so that it can be retrieved using the given file name.
        Specified by:
        setReplyInfo in interface Admin
        Parameters:
        fileName - An arc file that someone is trying to store.
        replyInfo - A StoreMessage object related to this filename.
        Throws:
        UnknownID - if no info has been registered for the filename.
      • removeReplyInfo

        public StoreMessage removeReplyInfo​(String fileName)
                                     throws UnknownID
        Deprecated.
        Removes the replyInfo associated with arcfileName.
        Specified by:
        removeReplyInfo in interface Admin
        Parameters:
        fileName - A file that we are trying to store.
        Returns:
        the replyInfo associated with arcfileName.
        Throws:
        UnknownID - If the filename is not known. or no replyInfo is associated with arcfileName.
      • setState

        public void setState​(String fileName,
                             String replicaID,
                             ReplicaStoreState state)
                      throws UnknownID,
                             ArgumentNotValid
        Deprecated.
        Sets the store state for the given file on the given bitarchive.
        Specified by:
        setState in interface Admin
        Parameters:
        fileName - A file that is being stored.
        replicaID - A bitarchive.
        state - The state of upload of arcfileName on bitarchiveID.
        Throws:
        UnknownID - If the file does not have a store entry.
        ArgumentNotValid - If the arguments are null or empty
      • setCheckSum

        public void setCheckSum​(String fileName,
                                String checkSum)
                         throws ArgumentNotValid,
                                UnknownID
        Deprecated.
        Set/update the checksum for a given arcfileName in the admindata.
        Specified by:
        setCheckSum in interface Admin
        Parameters:
        fileName - Unique name of file for which to store checksum
        checkSum - The generated (MD5) checksum to be stored in reference table
        Throws:
        UnknownID - if the file is not already registered.
        ArgumentNotValid - If the arcfileName or the checksum is either null or the empty string.
      • close

        public void close()
        Deprecated.
        Makes sure all data is written to disk.
        Specified by:
        close in interface Admin