org.duracloud.storage.util
Class StorageProviderUtil

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

public class StorageProviderUtil
extends java.lang.Object

Provides utility methods for Storage Providers

Author:
Bill Branan

Constructor Summary
StorageProviderUtil()
           
 
Method Summary
static java.lang.String compareChecksum(StorageProvider provider, java.lang.String spaceId, java.lang.String contentId, java.lang.String checksum)
          Determines if the checksum for a particular piece of content stored in a StorageProvider matches the expected checksum value.
static boolean contains(java.util.Iterator<java.lang.String> iterator, java.lang.String value)
          Determines if a String value is included in a Iterated list.
static long count(java.util.Iterator<java.lang.String> iterator)
          Determines the number of elements in an iteration.
static java.util.List<java.lang.String> getList(java.util.Iterator<java.lang.String> iterator)
          Creates a list of all of the items in an iteration.
static java.util.Map<java.lang.String,java.lang.String> loadMetadata(java.io.InputStream is)
          Loads a stream containing metadata and populates a map with the metadata name/value pairs.
static java.io.ByteArrayInputStream storeMetadata(java.util.Map<java.lang.String,java.lang.String> metadataMap)
          Converts metadata stored in a Map into a stream for storage purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StorageProviderUtil

public StorageProviderUtil()
Method Detail

loadMetadata

public static java.util.Map<java.lang.String,java.lang.String> loadMetadata(java.io.InputStream is)
                                                                     throws StorageException
Loads a stream containing metadata and populates a map with the metadata name/value pairs.

Parameters:
is -
Returns:
Throws:
StorageException

storeMetadata

public static java.io.ByteArrayInputStream storeMetadata(java.util.Map<java.lang.String,java.lang.String> metadataMap)
                                                  throws StorageException
Converts metadata stored in a Map into a stream for storage purposes.

Parameters:
metadataMap -
Returns:
Throws:
StorageException

compareChecksum

public static java.lang.String compareChecksum(StorageProvider provider,
                                               java.lang.String spaceId,
                                               java.lang.String contentId,
                                               java.lang.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
Throws:
StorageException - if the included checksum does not match the storage provider generated checksum

contains

public static boolean contains(java.util.Iterator<java.lang.String> iterator,
                               java.lang.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(java.util.Iterator<java.lang.String> iterator)
Determines the number of elements in an iteration.

Parameters:
iterator -
Returns:

getList

public static java.util.List<java.lang.String> getList(java.util.Iterator<java.lang.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:


Copyright © 2009-2010 DuraSpace. All Rights Reserved.