Class BitmagUtils


  • public class BitmagUtils
    extends Object
    Utility class to abstract away the specifics of setting up and obtaining bitrepository.org clients.
    • Constructor Detail

      • BitmagUtils

        public BitmagUtils()
    • Method Detail

      • initialize

        public static void initialize()
        Method to initialize the utility class. Must be called prior to use of any other method as it initializes internal state.
      • getKnownPillars

        public static List<String> getKnownPillars​(String collectionID)
        Method to get the list of known pillars in a collection
        Parameters:
        collectionID - The ID of the collection to obtain pillars for
        Returns:
        the list of known pillarIDs
      • getKnownCollections

        public static List<String> getKnownCollections()
        Method to get the list of known collections
        Returns:
        the list of known collectionIDs
      • generateComponentID

        public static String generateComponentID()
        Generates a component id, which includes the hostname and a random UUID.
        Returns:
        The Bitrepository component id for this NetarchiveSuite application.
      • getFileExchangeBaseURL

        public static URL getFileExchangeBaseURL()
                                          throws MalformedURLException
        Method to get the base part of the URL to the file exchange server.
        Returns:
        URL URL with the base part of the file exchange server.
        Throws:
        MalformedURLException - if the file exchange configuration results in an invalid url
      • getFileExchange

        public static org.bitrepository.protocol.FileExchange getFileExchange()
        Method to retrieve the instance of the FileExchange. To be used for transferring files to and from the FileExchange server
        Returns:
        FileExchange The FileExchange instance
      • getValidationChecksum

        public static org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE getValidationChecksum​(File file,
                                                                                                            org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE csSpec)
        Creates the data structure for encapsulating the validation checksums for validation of the PutFile operation.
        Parameters:
        file - The file to have the checksum calculated.
        csSpec - A given ChecksumSpecTYPE
        Returns:
        The ChecksumDataForFileTYPE for the pillars to validate the PutFile operation.
      • getChecksumSpec

        public static org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE getChecksumSpec​(org.bitrepository.bitrepositoryelements.ChecksumType checksumType)
      • getPutFileClient

        public static org.bitrepository.modify.putfile.PutFileClient getPutFileClient()
        Retreive a PutFileClient
        Returns:
        PutFileClient The PutFileClient
      • getFileIDsClient

        public static org.bitrepository.access.getfileids.GetFileIDsClient getFileIDsClient()
        Retreive a GetFileIDsClient
        Returns:
        GetFileIDsClient The GetFileIDsClient
      • getChecksumsClient

        public static org.bitrepository.access.getchecksums.GetChecksumsClient getChecksumsClient()
        Retreive a GetChecksumsClient
        Returns:
        GetChecksumsClient The GetChecksumsClient
      • getFileClient

        public static org.bitrepository.access.getfile.GetFileClient getFileClient()
        Retreive a GetFileClient
        Returns:
        GetFileClient The GetFileClient
      • getDefaultCollectionID

        public static String getDefaultCollectionID()
        Retrieves the default collectionID to use from settings. If the collectionID is not set it defaults to the environment name.
        Returns:
        The ID of the default collection to execute actions on.
      • shutdown

        public static void shutdown()
                             throws javax.jms.JMSException
        Method to shutdown the bitrepository connections if such exists. Should only be called when all interactions with the bitrepository from this client is done.
        Throws:
        javax.jms.JMSException - if there is trouble shutting down the messagebus connection