org.soyatec.windowsazure.blob
Interface IBlobContainer


public interface IBlobContainer

The BlobContainer class is used to access and enumerate blobs in the container. Storage key credentials are needed to access private blobs but not for public blobs.


Field Summary
static java.lang.String ROOT_CONTAINER
          The root container.
 
Method Summary
 void clearSharedAccessUrl()
          Clear shared access url.
 void clearSSLProperty()
           
 boolean copyBlob(java.lang.String destContainer, java.lang.String destBlobName, java.lang.String sourceBlobName)
          Copies a blob to a destination within the storage account.
 boolean copyBlob(java.lang.String destContainer, java.lang.String destBlobName, java.lang.String sourceBlobName, org.soyatec.windowsazure.internal.util.NameValueCollection metadata, IBlobConstraints constraints)
          Copies a blob to a destination within the storage account.
 IBlockBlob createBlockBlob(IBlobProperties blobProperties, IBlobContents blobContents)
          Create a new block blob.
 IPageBlob createPageBlob(IBlobProperties blobProperties, int size, org.soyatec.windowsazure.internal.util.NameValueCollection headerParameters)
          Create a new page blob.
 boolean deleteBlob(java.lang.String name)
          Delete a blob with the given name.
 boolean deleteBlobIfNotModified(IBlobProperties blob)
          Delete a blob with the given name if the blob has not been modified since it was last obtained.
 org.soyatec.windowsazure.blob.internal.ContainerAccessControl getAccessControl()
          Get the access control permissions associated with the container.
 java.lang.String getAccountName()
           
 java.net.URI getBaseUri()
           
 IBlob getBlobReference(java.lang.String name)
          Get a reference to a Blob object with a specified name.
 IBlockBlob getBlockBlobReference(java.lang.String name)
          Get a reference to a Blob object with a specified name.
 java.sql.Timestamp getLastModifiedTime()
           
 java.lang.String getName()
           
 IPageBlob getPageBlobReference(java.lang.String name)
          Get a reference to a Blob object with a specified name.
 IContainerProperties getProperties()
          Get the properties for the container if it exists.
 IRetryPolicy getRetryPolicy()
           
 org.soyatec.windowsazure.internal.util.TimeSpan getTimeout()
           
 java.net.URI getUri()
           
 boolean isBlobExist(java.lang.String blobName)
          Check if the blob exists
 boolean isContainerExist()
          Check if the blob container exists
 boolean isUsePathStyleUris()
          Indicates whether to use/generate path-style or host-style URIs.
 java.lang.String leaseBlob(IBlobProperties blobProperties, LeaseMode mode, org.soyatec.windowsazure.internal.util.NameValueCollection headerParameters)
          The Lease Blob operation establishes and manages a one-minute lock on a blob for write operations.
 java.util.Iterator<IBlobProperties> listBlobs()
          Enumerates all blobs
 java.util.Iterator<IBlobProperties> listBlobs(java.lang.String prefix, boolean combineCommonPrefixes)
          Enumerates all blobs with a given prefix.
 java.util.Iterator<IBlobProperties> listBlobs(java.lang.String prefix, boolean combineCommonPrefixes, int maxResults)
          Enumerates all blobs with a given prefix.
 void setAccessControl(IContainerAccessControl acl)
          Set the access control permissions associated with the container.
 void setMetadata(org.soyatec.windowsazure.internal.util.NameValueCollection metadata)
           
 void setRetryPolicy(IRetryPolicy retryPolicy)
           
 void setSSLProperty(java.lang.String keystore, java.lang.String keystorePasswd, java.lang.String truststore, java.lang.String truststorepasswd, java.lang.String keyalias)
           
 void setTimeout(org.soyatec.windowsazure.internal.util.TimeSpan timeout)
           
 void setUri(java.net.URI containerUri)
           
 IBlockBlob updateBlockBlob(IBlobProperties blobProperties, IBlobContents blobContents)
          Update a existing blob.
 void useSharedAccessUrl(ISharedAccessUrl url)
          Use shared access URl.
 

Field Detail

ROOT_CONTAINER

static final java.lang.String ROOT_CONTAINER
The root container.

See Also:
Constant Field Values
Method Detail

setSSLProperty

void setSSLProperty(java.lang.String keystore,
                    java.lang.String keystorePasswd,
                    java.lang.String truststore,
                    java.lang.String truststorepasswd,
                    java.lang.String keyalias)

clearSSLProperty

void clearSSLProperty()

useSharedAccessUrl

void useSharedAccessUrl(ISharedAccessUrl url)
Use shared access URl.

Parameters:
url -

clearSharedAccessUrl

void clearSharedAccessUrl()
Clear shared access url. User need to call explicitly.


setMetadata

void setMetadata(org.soyatec.windowsazure.internal.util.NameValueCollection metadata)
                 throws StorageException
Parameters:
The - metadata for the container to set
metadata - The metadata for the container. Can be null to indicate no metadata
Throws:
StorageException

isContainerExist

boolean isContainerExist()
                         throws StorageException
Check if the blob container exists

Returns:
True if the container exists, false otherwise.
Throws:
StorageException

isBlobExist

boolean isBlobExist(java.lang.String blobName)
                    throws StorageException
Check if the blob exists

Parameters:
blobName - of the BLOB.
Returns:
true if the blob exists, false otherwise.
Throws:
StorageException

listBlobs

java.util.Iterator<IBlobProperties> listBlobs()
                                              throws StorageException
Enumerates all blobs

Returns:
Blobs list
Throws:
StorageException

listBlobs

java.util.Iterator<IBlobProperties> listBlobs(java.lang.String prefix,
                                              boolean combineCommonPrefixes)
                                              throws StorageException
Enumerates all blobs with a given prefix.

Parameters:
prefix -
combineCommonPrefixes - If true common prefixes with "/" as separator
Returns:
The list of blob properties and common prefixes
Throws:
StorageException

listBlobs

java.util.Iterator<IBlobProperties> listBlobs(java.lang.String prefix,
                                              boolean combineCommonPrefixes,
                                              int maxResults)
                                              throws StorageException
Enumerates all blobs with a given prefix.

Parameters:
prefix -
combineCommonPrefixes - If true common prefixes with "/" as separator
maxResults - Specifies the maximum number of blobs to return per call to Azure storage. This does NOT affect list size returned by this function.
Returns:
The list of blob properties and common prefixes
Throws:
StorageException

setAccessControl

void setAccessControl(IContainerAccessControl acl)
                      throws StorageException
Set the access control permissions associated with the container.

Parameters:
acl - The permission to set
Throws:
StorageException

getAccessControl

org.soyatec.windowsazure.blob.internal.ContainerAccessControl getAccessControl()
                                                                               throws StorageException
Get the access control permissions associated with the container.

Throws:
StorageException

getProperties

IContainerProperties getProperties()
                                   throws StorageException
Get the properties for the container if it exists.

Returns:
The properties for the container if it exists, null otherwise
Throws:
StorageException

copyBlob

boolean copyBlob(java.lang.String destContainer,
                 java.lang.String destBlobName,
                 java.lang.String sourceBlobName)
                 throws StorageException
Copies a blob to a destination within the storage account.

Note
The Copy Blob operation is available only in the 2009-04-14 version of the Blob service. It is currently available only in Windows Azure storage, and not in development storage, nor within the StorageClient sample included in the Windows Azure SDK.

Parameters:
destContainer - the destination blob container;
destBlobName - the destination blob's name;
sourceBlobName - the source blob's name;
Returns:
Throws:
StorageException

copyBlob

boolean copyBlob(java.lang.String destContainer,
                 java.lang.String destBlobName,
                 java.lang.String sourceBlobName,
                 org.soyatec.windowsazure.internal.util.NameValueCollection metadata,
                 IBlobConstraints constraints)
                 throws StorageException
Copies a blob to a destination within the storage account.

Note
The Copy Blob operation is available only in the 2009-04-14 version of the Blob service. It is currently available only in Windows Azure storage, and not in development storage, nor within the StorageClient sample included in the Windows Azure SDK.

Parameters:
destContainer - the destination blob container;
destBlobName - the destination blob's name;
sourceBlobName - the source blob's name;
metadata - The metadata for the Blob. Can be null to indicate no metadata;
constraints - The blob constraints for the blob copy operation.
Returns:
Throws:
StorageException

deleteBlob

boolean deleteBlob(java.lang.String name)
                   throws StorageException
Delete a blob with the given name.

Parameters:
name - The name of the blob
Returns:
true if the blob exists and was successfully deleted, false if the blob does not exist
Throws:
StorageException

deleteBlobIfNotModified

boolean deleteBlobIfNotModified(IBlobProperties blob)
                                throws StorageException
Delete a blob with the given name if the blob has not been modified since it was last obtained. Use this method for optimistic concurrency to avoid deleting a blob that has been modified since the last time you retrieved it

Parameters:
blob - A blob object (typically previously obtained from a GetBlob call)
Returns:
true if the blob exists and was successfully deleted, false if the blob does not exist or was not deleted because the blob was modified.
Throws:
StorageException

createPageBlob

IPageBlob createPageBlob(IBlobProperties blobProperties,
                         int size,
                         org.soyatec.windowsazure.internal.util.NameValueCollection headerParameters)
                         throws StorageException
Create a new page blob.

Parameters:
blobProperties - The properties of blob.
size - The maximum size for page blob
headerParameters - The header parameters.
Throws:
StorageException

getBaseUri

java.net.URI getBaseUri()
Returns:
The base URI of the blob storate service.

getAccountName

java.lang.String getAccountName()
Returns:
The name of the storage account.

getName

java.lang.String getName()
Returns:
The name of the blob container.

isUsePathStyleUris

boolean isUsePathStyleUris()
Indicates whether to use/generate path-style or host-style URIs.

Returns:
true/false

getUri

java.net.URI getUri()
Returns:
The URI of the container.

getLastModifiedTime

java.sql.Timestamp getLastModifiedTime()
Returns:
The timestamp for last modification of container.

getTimeout

org.soyatec.windowsazure.internal.util.TimeSpan getTimeout()
Returns:
The time out for each request to the storage service.

getRetryPolicy

IRetryPolicy getRetryPolicy()
Returns:
The retry policy used for retrying requests.

setTimeout

void setTimeout(org.soyatec.windowsazure.internal.util.TimeSpan timeout)
Parameters:
timeout - The time out for each request to the storage service.

setRetryPolicy

void setRetryPolicy(IRetryPolicy retryPolicy)
Parameters:
retryPolicy - The retry policy used for retrying requests.

setUri

void setUri(java.net.URI containerUri)
Parameters:
containerUri - The URI of the container.

leaseBlob

java.lang.String leaseBlob(IBlobProperties blobProperties,
                           LeaseMode mode,
                           org.soyatec.windowsazure.internal.util.NameValueCollection headerParameters)
                           throws StorageException
The Lease Blob operation establishes and manages a one-minute lock on a blob for write operations.

Parameters:
blobProperties - The properties of the blob
mode - Lease Blob mode for this operation. There are four modes: Acquire, to request a new lease. Renew, to renew an existing lease. Release, to free the lease if it is no longer needed so that another client may immediately acquire a lease against the blob. Break, to end the lease but ensure that another client cannot acquire a new lease until the current lease period has expired.
headerParameters -
Returns:
Throws:
StorageException

updateBlockBlob

IBlockBlob updateBlockBlob(IBlobProperties blobProperties,
                           IBlobContents blobContents)
                           throws StorageException
Update a existing blob.

Parameters:
blobProperties - The properties of the blob
blobContents - The contents of the blob
Returns:
If the blob already exists, update the blob, else throw a exception. The LastModifiedTime property of is set as a result of this call. This method also has an effect on the ETag values that are managed by the service.
Throws:
StorageException

createBlockBlob

IBlockBlob createBlockBlob(IBlobProperties blobProperties,
                           IBlobContents blobContents)
                           throws StorageException
Create a new block blob.

Parameters:
blobProperties - The properties of the blob
blobContents - The contents of the blob
Returns:
the create blob. The LastModifiedTime property of is set as a result of this call. This method also has an effect on the ETag values that are managed by the service.
Throws:
StorageException

getBlockBlobReference

IBlockBlob getBlockBlobReference(java.lang.String name)
                                 throws StorageException
Get a reference to a Blob object with a specified name.

Parameters:
name - The name of the blob
Returns:
The blob
Throws:
StorageException

getPageBlobReference

IPageBlob getPageBlobReference(java.lang.String name)
                               throws StorageException
Get a reference to a Blob object with a specified name.

Parameters:
name - The name of the blob
Returns:
The blob
Throws:
StorageException

getBlobReference

IBlob getBlobReference(java.lang.String name)
                       throws StorageException
Get a reference to a Blob object with a specified name.

Parameters:
name - The name of the blob
Returns:
The blob
Throws:
StorageException