Class StorageProviderUtil

java.lang.Object
org.duracloud.storage.util.StorageProviderUtil

public class StorageProviderUtil extends Object
Provides utility methods for Storage Providers
Author:
Bill Branan
  • Method Details

    • loadProperties

      public static Map<String,String> loadProperties(InputStream is) throws StorageException
      Loads a stream containing properties and populates a map with the properties name/value pairs.
      Parameters:
      is -
      Returns:
      Throws:
      StorageException
    • storeProperties

      public static ByteArrayInputStream storeProperties(Map<String,String> propertiesMap) throws StorageException
      Converts properties stored in a Map into a stream for storage purposes.
      Parameters:
      propertiesMap -
      Returns:
      Throws:
      StorageException
    • compareChecksum

      public static String compareChecksum(StorageProvider provider, String spaceId, String contentId, String checksum) throws StorageException
      Determines if the checksum for a particular piece of content stored in a StorageProvider matches the expected checksum value.
      Parameters:
      provider - The StorageProvider where the content was stored
      spaceId - The Space in which the content was stored
      contentId - The Id of the content
      checksum - The content checksum, either provided or computed
      Throws:
      StorageException - if the included checksum does not match the storage provider generated checksum
    • compareChecksum

      public static String compareChecksum(String providerChecksum, String spaceId, String contentId, String checksum) throws ChecksumMismatchException
      Determines if two checksum values are equal
      Parameters:
      providerChecksum - The checksum provided by the StorageProvider
      spaceId - The Space in which the content was stored
      contentId - The Id of the content
      checksum - The content checksum, either provided or computed
      Throws:
      ChecksumMismatchException - if the included checksum does not match the storage provider generated checksum
    • contains

      public static boolean contains(Iterator<String> iterator, String value)
      Determines if a String value is included in a Iterated list. The iteration is only run as far as necessary to determine if the value is included in the underlying list.
      Parameters:
      iterator -
      value -
      Returns:
    • count

      public static long count(Iterator<String> iterator)
      Determines the number of elements in an iteration.
      Parameters:
      iterator -
      Returns:
    • getList

      public static List<String> getList(Iterator<String> iterator)
      Creates a list of all of the items in an iteration. Be wary of using this for Iterations of very long lists.
      Parameters:
      iterator -
      Returns:
    • createContentProperties

      public static Map<String,String> createContentProperties(String absolutePath, String creator)
      Generates a map of all client-side default content properties to be added with new content.
      Parameters:
      absolutePath -
      creator -
      Returns:
    • removeCalculatedProperties

      public static Map<String,String> removeCalculatedProperties(Map<String,String> contentProperties)
      Returns a new map with the calculated properties removed. If null, null is returned.
      Parameters:
      contentProperties -
      Returns: