Class BitmagUtils


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

      Constructors 
      Constructor Description
      BitmagUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String generateComponentID()
      Generates a component id, which includes the hostname and a random UUID.
      static org.bitrepository.access.getchecksums.GetChecksumsClient getChecksumsClient()
      Retreive a GetChecksumsClient
      static org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE getChecksumSpec​(org.bitrepository.bitrepositoryelements.ChecksumType checksumType)  
      static java.lang.String getDefaultCollectionID()
      Retrieves the default collectionID to use from settings.
      static org.bitrepository.access.getfile.GetFileClient getFileClient()
      Retreive a GetFileClient
      static org.bitrepository.protocol.FileExchange getFileExchange()
      Method to retrieve the instance of the FileExchange.
      static java.net.URL getFileExchangeBaseURL()
      Method to get the base part of the URL to the file exchange server.
      static org.bitrepository.access.getfileids.GetFileIDsClient getFileIDsClient()
      Retreive a GetFileIDsClient
      static java.util.List<java.lang.String> getKnownCollections()
      Method to get the list of known collections
      static java.util.List<java.lang.String> getKnownPillars​(java.lang.String collectionID)
      Method to get the list of known pillars in a collection
      static org.bitrepository.modify.putfile.PutFileClient getPutFileClient()
      Retreive a PutFileClient
      static org.bitrepository.bitrepositoryelements.ChecksumDataForFileTYPE getValidationChecksum​(java.io.File file, org.bitrepository.bitrepositoryelements.ChecksumSpecTYPE csSpec)
      Creates the data structure for encapsulating the validation checksums for validation of the PutFile operation.
      static void initialize()
      Method to initialize the utility class.
      static void shutdown()
      Method to shutdown the bitrepository connections if such exists.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.util.List<java.lang.String> getKnownPillars​(java.lang.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 java.util.List<java.lang.String> getKnownCollections()
        Method to get the list of known collections
        Returns:
        the list of known collectionIDs
      • generateComponentID

        public static java.lang.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 java.net.URL getFileExchangeBaseURL()
                                                   throws java.net.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:
        java.net.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​(java.io.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 java.lang.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