Class BitmagArcRepositoryClient

    • Field Detail

      • log

        protected static final org.slf4j.Logger log
        Logging output place.
      • ARCREPOSITORY_GET_TIMEOUT

        public static final String ARCREPOSITORY_GET_TIMEOUT
        settings.common.arcrepositoryClient.getTimeout:
        The setting for how many milliseconds we will wait before giving up on a lookup request to the Arcrepository.
        See Also:
        Constant Field Values
    • Method Detail

      • getInstance

        public static BitmagArcRepositoryClient getInstance()
        Get an instance of this class. This is guaranteed to be a singleton.
        Returns:
        an JMSArcRepositoryClient instance.
      • getFile

        public void getFile​(String arcfilename,
                            Replica replica,
                            File toFile)
                     throws ArgumentNotValid,
                            IOFailure
        Synchronously retrieves a file from a bitarchive and places it in a local file. This implementation retrieves the file using bitrepository.org software.
        Specified by:
        getFile in interface ArcRepositoryClient
        Specified by:
        getFile in interface PreservationArcRepositoryClient
        Specified by:
        getFile in interface ViewerArcRepositoryClient
        Parameters:
        arcfilename - Name of the arcfile to retrieve.
        replica - This parameter is ignored in this implementation. The file is retrieved from the fastest pillar.
        toFile - Filename of a place where the file fetched can be put. If this file already exists it must be empty otherwise this method-call will fail.
        Throws:
        ArgumentNotValid - If the arcfilename are null or empty, or if either replica or toFile is null.
        IOFailure - if there are problems getting a reply or the file could not be found.
      • error

        protected void error​(String errMsg)
        Handle an error situation. Sends a notification, and throws an error.
        Parameters:
        errMsg - The message for the error.
      • batch

        public BatchStatus batch​(FileBatchJob job,
                                 String replicaId,
                                 String... args)
        Runs a batch batch job on each file in the ArcRepository.

        Note: The id for the batchjob is the empty string, which removes the possibility of terminating the batchjob remotely while it is running.

        Specified by:
        batch in interface ArcRepositoryClient
        Specified by:
        batch in interface PreservationArcRepositoryClient
        Specified by:
        batch in interface ViewerArcRepositoryClient
        Parameters:
        job - An object that implements the FileBatchJob interface. The initialize() method will be called before processing and the finish() method will be called afterwards. The process() method will be called with each File entry. An optional function postProcess() allows handling the combined results of the batchjob, e.g. summing the results, sorting, etc.
        replicaId - The archive to execute the job on.
        args - The arguments for the batchjob.
        Returns:
        The status of the batch job after it ended.
      • batch

        public BatchStatus batch​(FileBatchJob job,
                                 String replicaId,
                                 String batchId,
                                 String... args)
                          throws IOFailure,
                                 ArgumentNotValid
        Runs a batch job on each file in the ArcRepository.
        Parameters:
        job - An object that implements the FileBatchJob interface. The initialize() method will be called before processing and the finish() method will be called afterwards. The process() method will be called with each File entry. An optional function postProcess() allows handling the combined results of the batchjob, e.g. summing the results, sorting, etc.
        replicaId - The archive to execute the job on.
        args - The arguments for the batchjob. This is allowed to be null.
        batchId - The id for the batch process.
        Returns:
        The status of the batch job after it ended.
        Throws:
        ArgumentNotValid - If the job is null or the replicaId is either null or the empty string.
        IOFailure - If no result file is returned.
      • correct

        @Deprecated
        public File correct​(String replicaId,
                            String checksum,
                            File file,
                            String credentials)
                     throws IOFailure,
                            ArgumentNotValid
        Deprecated.
        Not implemented. This functionality is delegated to bitrepository software.
        Specified by:
        correct in interface PreservationArcRepositoryClient
        Parameters:
        replicaId - The identification of the replica.
        checksum - The checksum of the corrupt entry in the archive. It is important to validate that the checksum actually is wrong before correcting the entry.
        file - The new file to replace the old one.
        credentials - The password for allowing to remove a file entry in the archive.
        Returns:
        The corrupted file from the archive.
        Throws:
        IOFailure
        ArgumentNotValid
      • uploadFile

        public boolean uploadFile​(File file,
                                  String fileId)
        Attempts to upload a given file.
        Parameters:
        file - The file to upload. Should exist. The packageId is the name of the file
        fileId - The Id of the file to upload
        Returns:
        true if the upload succeeded, false otherwise.