BlobProperties
class.
*/
@@ -150,6 +160,8 @@ public BlobProperties(final BlobProperties other) {
this.pageBlobSequenceNumber = other.pageBlobSequenceNumber;
this.serverEncrypted = other.serverEncrypted;
this.isIncrementalCopy = other.isIncrementalCopy;
+ this.premiumPageBlobTier = other.premiumPageBlobTier;
+ this.isBlobTierInferredTier = other.isBlobTierInferredTier;
}
/**
@@ -271,6 +283,13 @@ public Date getLastModified() {
return this.lastModified;
}
+ /**
+ * Gets a value indicating if the tier of the premium page blob has been inferred.
+ *
+ * @return A {@Link java.lang.Boolean} object which represents if the blob tier was inferred.
+ */
+ public Boolean getInferredBlobTier() { return this.isBlobTierInferredTier; }
+
/**
* Gets the lease status for the blob.
*
@@ -315,7 +334,16 @@ public long getLength() {
public Long getPageBlobSequenceNumber() {
return this.pageBlobSequenceNumber;
}
-
+
+ /**
+ * If using a premium account and the blob is a page blob, gets the tier of the blob.
+ * @return A {@link PremiumPageBlobTier} object which represents the tier of the blob
+ * or null
if the tier has not been set.
+ */
+ public PremiumPageBlobTier getPremiumPageBlobTier() {
+ return this.premiumPageBlobTier;
+ }
+
/**
* Gets the blob's server-side encryption status;
*
@@ -512,4 +540,22 @@ protected void setServerEncrypted(boolean serverEncrypted) {
protected void setIncrementalCopy(boolean isIncrementalCopy) {
this.isIncrementalCopy = isIncrementalCopy;
}
+
+ /**
+ * Sets the tier of the page blob. This is only supported for premium accounts.
+ * @param premiumPageBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ */
+ protected void setPremiumPageBlobTier(PremiumPageBlobTier premiumPageBlobTier) {
+ this.premiumPageBlobTier = premiumPageBlobTier;
+ }
+
+ /**
+ * Sets whether the blob tier is inferred.
+ * @param isBlobTierInferredTier
+ * A {@Link java.lang.Boolean} which specifies if the blob tier is inferred.
+ */
+ protected void setBlobTierInferredTier(Boolean isBlobTierInferredTier) {
+ this.isBlobTierInferredTier = isBlobTierInferredTier;
+ }
}
\ No newline at end of file
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobRequest.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobRequest.java
index 7fe4e69b9c22..8be31ddcf6aa 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobRequest.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobRequest.java
@@ -54,6 +54,8 @@ final class BlobRequest {
private static final String SNAPSHOTS_QUERY_ELEMENT_NAME = "snapshots";
+ private static final String TIER_QUERY_ELEMENT_NAME = "tier";
+
private static final String UNCOMMITTED_BLOBS_QUERY_ELEMENT_NAME = "uncommittedblobs";
/**
@@ -219,6 +221,8 @@ public static HttpURLConnection appendBlock(final URI uri, final BlobRequestOpti
* The snapshot version, if the source blob is a snapshot.
* @param incrementalCopy
* A boolean indicating whether or not this is an incremental copy.
+ * @param premiumPageBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
* @return a HttpURLConnection configured for the operation.
* @throws StorageException
* an exception representing any error which occurred during the operation.
@@ -229,7 +233,7 @@ public static HttpURLConnection appendBlock(final URI uri, final BlobRequestOpti
public static HttpURLConnection copyFrom(final URI uri, final BlobRequestOptions blobOptions,
final OperationContext opContext, final AccessCondition sourceAccessCondition,
final AccessCondition destinationAccessCondition, String source, final String sourceSnapshotID,
- final boolean incrementalCopy)
+ final boolean incrementalCopy, final PremiumPageBlobTier premiumPageBlobTier)
throws StorageException, IOException, URISyntaxException {
if (sourceSnapshotID != null) {
@@ -252,6 +256,10 @@ public static HttpURLConnection copyFrom(final URI uri, final BlobRequestOptions
request.setRequestProperty(Constants.HeaderConstants.COPY_SOURCE_HEADER, source);
+ if (premiumPageBlobTier != null) {
+ request.setRequestProperty(BlobConstants.ACCESS_TIER_HEADER, String.valueOf(premiumPageBlobTier));
+ }
+
if (sourceAccessCondition != null) {
sourceAccessCondition.applySourceConditionToRequest(request);
}
@@ -1146,6 +1154,44 @@ public static HttpURLConnection listContainers(final URI uri, final BlobRequestO
public static HttpURLConnection putBlob(final URI uri, final BlobRequestOptions blobOptions,
final OperationContext opContext, final AccessCondition accessCondition, final BlobProperties properties,
final BlobType blobType, final long pageBlobSize) throws IOException, URISyntaxException, StorageException {
+ return BlobRequest.putBlob(uri, blobOptions, opContext, accessCondition, properties, blobType, pageBlobSize, null /* premiumPageBlobTier */);
+ }
+
+ /**
+ * Constructs a HttpURLConnection to upload a blob. Sign with blob length, or -1 for pageblob create.
+ *
+ * @param uri
+ * A java.net.URI
object that specifies the absolute URI.
+ * @param blobOptions
+ * A {@link BlobRequestOptions} object that specifies execution options such as retry policy and timeout
+ * settings for the operation. Specify null
to use the request options specified on the
+ * {@link CloudBlobClient}.
+ * @param opContext
+ * An {@link OperationContext} object that represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ * @param accessCondition
+ * An {@link AccessCondition} object that represents the access conditions for the blob.
+ * @param properties
+ * The properties to set for the blob.
+ * @param blobType
+ * The type of the blob.
+ * @param pageBlobSize
+ * For a page blob, the size of the blob. This parameter is ignored for block blobs.
+ * @param premiumPageBlobTier
+ * A {@link PremiumPageBlobTier} object representing the tier to set.
+ * @return a HttpURLConnection to use to perform the operation.
+ * @throws IOException
+ * if there is an error opening the connection
+ * @throws URISyntaxException
+ * if the resource URI is invalid
+ * @throws StorageException
+ * an exception representing any error which occurred during the operation.
+ * @throws IllegalArgumentException
+ */
+ public static HttpURLConnection putBlob(final URI uri, final BlobRequestOptions blobOptions,
+ final OperationContext opContext, final AccessCondition accessCondition, final BlobProperties properties,
+ final BlobType blobType, final long pageBlobSize, final PremiumPageBlobTier premiumPageBlobTier) throws IOException, URISyntaxException, StorageException {
if (blobType == BlobType.UNSPECIFIED) {
throw new IllegalArgumentException(SR.BLOB_TYPE_NOT_DEFINED);
}
@@ -1165,6 +1211,11 @@ public static HttpURLConnection putBlob(final URI uri, final BlobRequestOptions
request.setRequestProperty(BlobConstants.BLOB_TYPE_HEADER, BlobConstants.PAGE_BLOB);
request.setRequestProperty(BlobConstants.SIZE, String.valueOf(pageBlobSize));
+ if (premiumPageBlobTier != null)
+ {
+ request.setRequestProperty(BlobConstants.ACCESS_TIER_HEADER, String.valueOf(premiumPageBlobTier));
+ }
+
properties.setLength(pageBlobSize);
}
else if (blobType == BlobType.BLOCK_BLOB){
@@ -1227,6 +1278,48 @@ public static HttpURLConnection putBlock(final URI uri, final BlobRequestOptions
return request;
}
+
+ /**
+ * Constructs a HttpURLConnection to set the the tier on a page blob.
+ * This API is only supported for premium accounts.
+ *
+ * @param uri
+ * A java.net.URI
object that specifies the absolute URI.
+ * @param blobOptions
+ * A {@link BlobRequestOptions} object that specifies execution options such as retry policy and timeout
+ * settings for the operation. Specify null
to use the request options specified on the
+ * {@link CloudBlobClient}.
+ * @param opContext
+ * An {@link OperationContext} object that represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object representing the tier to set.
+ * @return a HttpURLConnection to use to perform the operation.
+ * @throws IOException
+ * if there is an error opening the connection
+ * @throws URISyntaxException
+ * if the resource URI is invalid
+ * @throws StorageException
+ * an exception representing any error which occurred during the operation.
+ * @throws IllegalArgumentException
+ */
+ public static HttpURLConnection setBlobTier(final URI uri, final BlobRequestOptions blobOptions,
+ final OperationContext opContext, final String premiumBlobTier)
+ throws IOException, URISyntaxException, StorageException {
+ final UriQueryBuilder builder = new UriQueryBuilder();
+ builder.add(Constants.QueryConstants.COMPONENT, TIER_QUERY_ELEMENT_NAME);
+
+ final HttpURLConnection request = createURLConnection(uri, builder, blobOptions, opContext);
+
+ request.setDoOutput(true);
+ request.setRequestMethod(Constants.HTTP_PUT);
+ request.setFixedLengthStreamingMode(0);
+ request.setRequestProperty(Constants.HeaderConstants.CONTENT_LENGTH, "0");
+ request.setRequestProperty(BlobConstants.ACCESS_TIER_HEADER, premiumBlobTier);
+
+ return request;
+ }
/**
* Constructs a HttpURLConnection to write a blob by specifying the list of block IDs that make up the blob. Sign
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobResponse.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobResponse.java
index c31f05ab898a..0e26efa41847 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobResponse.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobResponse.java
@@ -124,6 +124,26 @@ else if (!Utility.isNullOrEmpty(xContentLengthHeader)) {
properties.setAppendBlobCommittedBlockCount(Integer.parseInt(comittedBlockCount));
}
+ // Get the tier of the blob
+ final String premiumBlobTierString = request.getHeaderField(BlobConstants.ACCESS_TIER_HEADER);
+
+ if (properties.getBlobType().equals(BlobType.PAGE_BLOB))
+ {
+ PremiumPageBlobTier premiumPageBlobTier = PremiumPageBlobTier.parse(premiumBlobTierString);
+ properties.setPremiumPageBlobTier(premiumPageBlobTier);
+ }
+ else if (properties.getBlobType().equals(BlobType.UNSPECIFIED)) {
+ PremiumPageBlobTier premiumPageBlobTier = PremiumPageBlobTier.parse(premiumBlobTierString);
+ if (!premiumPageBlobTier.equals(PremiumPageBlobTier.UNKNOWN)) {
+ properties.setPremiumPageBlobTier(premiumPageBlobTier);
+ }
+ }
+
+ final String tierInferredString = request.getHeaderField(BlobConstants.ACCESS_TIER_INFERRED_HEADER);
+ if (!Utility.isNullOrEmpty(tierInferredString)) {
+ properties.setBlobTierInferredTier(Boolean.parseBoolean(tierInferredString));
+ }
+
final String incrementalCopyHeaderString =
request.getHeaderField(Constants.HeaderConstants.INCREMENTAL_COPY);
if (!Utility.isNullOrEmpty(incrementalCopyHeaderString)) {
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudAppendBlob.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudAppendBlob.java
index 03cae586d9c6..b54f3be8323c 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudAppendBlob.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudAppendBlob.java
@@ -34,6 +34,7 @@
import com.microsoft.azure.storage.StorageCredentials;
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.StorageUri;
+import com.microsoft.azure.storage.core.BaseResponse;
import com.microsoft.azure.storage.core.ExecutionEngine;
import com.microsoft.azure.storage.core.SR;
import com.microsoft.azure.storage.core.StorageRequest;
@@ -309,7 +310,7 @@ public Void preProcessResponse(CloudBlob blob, CloudBlobClient client, Operation
}
blob.updateEtagAndLastModifiedFromResponse(this.getConnection());
- this.getResult().setRequestServiceEncrypted(CloudBlob.isServerRequestEncrypted(this.getConnection()));
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
blob.getProperties().setLength(0);
return null;
}
@@ -460,7 +461,7 @@ public Long preProcessResponse(CloudAppendBlob blob, CloudBlobClient client, Ope
blob.updateEtagAndLastModifiedFromResponse(this.getConnection());
blob.updateCommittedBlockCountFromResponse(this.getConnection());
- this.getResult().setRequestServiceEncrypted(CloudBlob.isServerRequestEncrypted(this.getConnection()));
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return appendOffset;
}
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java
index 961d211f256f..ad64655b3a56 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java
@@ -44,6 +44,7 @@
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.StorageLocation;
import com.microsoft.azure.storage.StorageUri;
+import com.microsoft.azure.storage.core.BaseResponse;
import com.microsoft.azure.storage.core.ExecutionEngine;
import com.microsoft.azure.storage.core.Logger;
import com.microsoft.azure.storage.core.NetworkInputStream;
@@ -681,6 +682,43 @@ public final String startCopy(final URI source) throws StorageException {
*/
@DoesServiceRequest
public final String startCopy(final URI source, final AccessCondition sourceAccessCondition,
+ final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)
+ throws StorageException {
+ return this.startCopy(source, null /* premiumPageBlobTier */, sourceAccessCondition, destinationAccessCondition, options, opContext);
+ }
+
+ /**
+ * Requests the service to start copying a URI's contents, properties, and metadata to a new blob, using the
+ * specified premium page blob tier, access conditions, lease ID, request options, and operation context.
+ * + * Note: Setting the premiumPageBlobTier is only supported for premium accounts. + *
+ * @param source + * Ajava.net.URI
The source URI. URIs for resources outside of Azure
+ * may only be copied into block blobs.
+ * @param premiumPageBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ * @param sourceAccessCondition
+ * An {@link AccessCondition} object that represents the access conditions for the source.
+ * @param destinationAccessCondition
+ * An {@link AccessCondition} object that represents the access conditions for the destination.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request.
+ * Specifying null
will use the default request options from the associated
+ * service client ({@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object that represents the context for the current operation.
+ * This object is used to track requests to the storage service, and to provide additional
+ * runtime information about the operation.
+ *
+ * @return A String
which represents the copy ID associated with the copy operation.
+ *
+ * @throws StorageException
+ * If a storage service error occurred.
+ *
+ */
+ @DoesServiceRequest
+ protected final String startCopy(final URI source, final PremiumPageBlobTier premiumPageBlobTier, final AccessCondition sourceAccessCondition,
final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)
throws StorageException {
if (opContext == null) {
@@ -691,12 +729,12 @@ public final String startCopy(final URI source, final AccessCondition sourceAcce
options = BlobRequestOptions.populateAndApplyDefaults(options, this.properties.getBlobType(), this.blobServiceClient);
return ExecutionEngine.executeWithRetry(this.blobServiceClient, this,
- this.startCopyImpl(source, false /* incrementalCopy */, sourceAccessCondition, destinationAccessCondition, options),
+ this.startCopyImpl(source, false /* incrementalCopy */, premiumPageBlobTier, sourceAccessCondition, destinationAccessCondition, options),
options.getRetryPolicyFactory(), opContext);
}
protected StorageRequestString
which specifies the directory delimiter to use.
- * @param usePathStyleUris
+ * @param container
* A {@link CloudBlobContainer} object which represents the blob container.
*
* @return A String
which represents the parent address for a blob URI.
@@ -2937,8 +2979,4 @@ protected static String getParentNameFromURI(final StorageUri resourceAddress, f
return parentName;
}
-
- protected static boolean isServerRequestEncrypted(HttpURLConnection connection) {
- return Constants.TRUE.equals(connection.getHeaderField(Constants.HeaderConstants.SERVER_REQUEST_ENCRYPTED));
- }
}
\ No newline at end of file
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlockBlob.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlockBlob.java
index 4664bbc99bf5..411752dcd745 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlockBlob.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlockBlob.java
@@ -20,6 +20,7 @@
import javax.crypto.Cipher;
import javax.xml.stream.XMLStreamException;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -379,7 +380,7 @@ public Void preProcessResponse(CloudBlob blob, CloudBlobClient client, Operation
}
blob.updateEtagAndLastModifiedFromResponse(this.getConnection());
- this.getResult().setRequestServiceEncrypted(CloudBlob.isServerRequestEncrypted(this.getConnection()));
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
@@ -920,7 +921,7 @@ public Void preProcessResponse(CloudBlob blob, CloudBlobClient client, Operation
}
blob.updateEtagAndLastModifiedFromResponse(this.getConnection());
- this.getResult().setRequestServiceEncrypted(CloudBlob.isServerRequestEncrypted(this.getConnection()));
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
@@ -1116,7 +1117,7 @@ public Void preProcessResponse(CloudBlob blob, CloudBlobClient client, Operation
return null;
}
- this.getResult().setRequestServiceEncrypted(CloudBlob.isServerRequestEncrypted(this.getConnection()));
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudPageBlob.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudPageBlob.java
index 53863bed5171..8553b0519837 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudPageBlob.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudPageBlob.java
@@ -14,9 +14,7 @@
*/
package com.microsoft.azure.storage.blob;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
@@ -35,6 +33,7 @@
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.StorageUri;
import com.microsoft.azure.storage.core.Base64;
+import com.microsoft.azure.storage.core.BaseResponse;
import com.microsoft.azure.storage.core.ExecutionEngine;
import com.microsoft.azure.storage.core.RequestLocationMode;
import com.microsoft.azure.storage.core.SR;
@@ -214,6 +213,41 @@ public final String startCopy(final CloudPageBlob sourceBlob) throws StorageExce
*/
@DoesServiceRequest
public final String startCopy(final CloudPageBlob sourceBlob, final AccessCondition sourceAccessCondition,
+ final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)
+ throws StorageException, URISyntaxException {
+ return this.startCopy(sourceBlob, null /* premiumBlobTier */, sourceAccessCondition, destinationAccessCondition, options, opContext);
+ }
+
+ /**
+ * Requests the service to start copying a blob's contents, properties, and metadata to a new blob, using the
+ * specified blob tier, access conditions, lease ID, request options, and operation context.
+ *
+ * @param sourceBlob
+ * A CloudPageBlob
object that represents the source blob to copy.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ * @param sourceAccessCondition
+ * An {@link AccessCondition} object that represents the access conditions for the source blob.
+ * @param destinationAccessCondition
+ * An {@link AccessCondition} object that represents the access conditions for the destination blob.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
+ * null
will use the default request options from the associated service client (
+ * {@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object that represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ *
+ * @return A String
which represents the copy ID associated with the copy operation.
+ *
+ * @throws StorageException
+ * If a storage service error occurred.
+ * @throws URISyntaxException
+ *
+ */
+ @DoesServiceRequest
+ public final String startCopy(final CloudPageBlob sourceBlob, final PremiumPageBlobTier premiumBlobTier, final AccessCondition sourceAccessCondition,
final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)
throws StorageException, URISyntaxException {
Utility.assertNotNull("sourceBlob", sourceBlob);
@@ -224,7 +258,7 @@ public final String startCopy(final CloudPageBlob sourceBlob, final AccessCondit
source = sourceBlob.getServiceClient().getCredentials().transformUri(sourceBlob.getSnapshotQualifiedUri());
}
- return this.startCopy(source, sourceAccessCondition, destinationAccessCondition, options, opContext);
+ return this.startCopy(source, premiumBlobTier, sourceAccessCondition, destinationAccessCondition, options, opContext);
}
/**
@@ -343,7 +377,7 @@ public final String startIncrementalCopy(final URI sourceSnapshot,
options = BlobRequestOptions.populateAndApplyDefaults(options, this.properties.getBlobType(), this.blobServiceClient);
return ExecutionEngine.executeWithRetry(this.blobServiceClient, this,
- this.startCopyImpl(sourceSnapshot, true /* incrementalCopy */, null /* sourceAccesCondition */,
+ this.startCopyImpl(sourceSnapshot, true /* incrementalCopy */, null /* premiumPageBlobTier */, null /* sourceAccesCondition */,
destinationAccessCondition, options),
options.getRetryPolicyFactory(), opContext);
}
@@ -435,6 +469,36 @@ public void create(final long length) throws StorageException {
this.create(length, null /* accessCondition */, null /* options */, null /* opContext */);
}
+ /**
+ * Creates a page blob using the specified request options and operation context. If the blob already exists,
+ * this will replace it. To instead throw an error if the blob already exists, use
+ * {@link AccessCondition#generateIfNotExistsCondition()}.
+ *
+ * @param length
+ * A long
which represents the size, in bytes, of the page blob.
+ * @param accessCondition
+ * An {@link AccessCondition} object which represents the access conditions for the blob.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
+ * null
will use the default request options from the associated service client (
+ * {@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object which represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ *
+ * @throws IllegalArgumentException
+ * If the length is not a multiple of 512.
+ *
+ * @throws StorageException
+ * If a storage service error occurred.
+ */
+ @DoesServiceRequest
+ public void create(final long length, final AccessCondition accessCondition, BlobRequestOptions options,
+ OperationContext opContext) throws StorageException {
+ this.create(length, null /* premiumBlobTier */, accessCondition, options, opContext);
+ }
+
/**
* Creates a page blob using the specified request options and operation context. If the blob already exists,
* this will replace it. To instead throw an error if the blob already exists, use
@@ -442,6 +506,8 @@ public void create(final long length) throws StorageException {
*
* @param length
* A long
which represents the size, in bytes, of the page blob.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
* @param accessCondition
* An {@link AccessCondition} object which represents the access conditions for the blob.
* @param options
@@ -460,7 +526,7 @@ public void create(final long length) throws StorageException {
* If a storage service error occurred.
*/
@DoesServiceRequest
- public void create(final long length, final AccessCondition accessCondition, BlobRequestOptions options,
+ public void create(final long length, final PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition, BlobRequestOptions options,
OperationContext opContext) throws StorageException {
assertNoWriteOperationForSnapshot();
@@ -475,10 +541,10 @@ public void create(final long length, final AccessCondition accessCondition, Blo
options = BlobRequestOptions.populateAndApplyDefaults(options, BlobType.PAGE_BLOB, this.blobServiceClient);
ExecutionEngine.executeWithRetry(this.blobServiceClient, this,
- this.createImpl(length, accessCondition, options), options.getRetryPolicyFactory(), opContext);
+ this.createImpl(length, premiumBlobTier, accessCondition, options), options.getRetryPolicyFactory(), opContext);
}
- private StorageRequest
+ * To avoid overwriting and instead throw an error, please pass in an {@link AccessCondition} generated using
+ * {@link AccessCondition#generateIfNotExistsCondition()}.
+ *
+ * @param length
+ * A
@@ -58,6 +63,15 @@ public Date getLastModified() {
return this.lastModified;
}
+ /**
+ * Gets the directory's server-side encryption status.
+ *
+ * @return A long
which represents the length, in bytes, of the stream to create. This value must be
+ * a multiple of 512.
+ * @param accessCondition
+ * An {@link AccessCondition} object which represents the access conditions for the blob.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
+ * null
will use the default request options from the associated service client (
+ * {@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object which represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ *
+ * @return A {@link BlobOutputStream} object used to write data to the blob.
+ *
+ * @throws StorageException
+ * If a storage service error occurred.
+ */
+ @DoesServiceRequest
+ public BlobOutputStream openWriteNew(final long length, AccessCondition accessCondition,
+ BlobRequestOptions options, OperationContext opContext) throws StorageException {
+ return openOutputStreamInternal(length, null /* premiumBlobTier */, accessCondition, options, opContext);
}
/**
@@ -869,6 +973,8 @@ public BlobOutputStream openWriteNew(final long length) throws StorageException
* @param length
* A long
which represents the length, in bytes, of the stream to create. This value must be
* a multiple of 512.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
* @param accessCondition
* An {@link AccessCondition} object which represents the access conditions for the blob.
* @param options
@@ -886,9 +992,9 @@ public BlobOutputStream openWriteNew(final long length) throws StorageException
* If a storage service error occurred.
*/
@DoesServiceRequest
- public BlobOutputStream openWriteNew(final long length, AccessCondition accessCondition,
+ public BlobOutputStream openWriteNew(final long length, final PremiumPageBlobTier premiumBlobTier, AccessCondition accessCondition,
BlobRequestOptions options, OperationContext opContext) throws StorageException {
- return openOutputStreamInternal(length, accessCondition, options, opContext);
+ return openOutputStreamInternal(length, premiumBlobTier, accessCondition, options, opContext);
}
/**
@@ -900,6 +1006,8 @@ public BlobOutputStream openWriteNew(final long length, AccessCondition accessCo
* A long
which represents the length, in bytes, of the stream to create. This value must be
* a multiple of 512 or null if the
* page blob already exists.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
* @param accessCondition
* An {@link AccessCondition} object which represents the access conditions for the blob.
* @param options
@@ -916,7 +1024,7 @@ public BlobOutputStream openWriteNew(final long length, AccessCondition accessCo
* @throws StorageException
* If a storage service error occurred.
*/
- private BlobOutputStream openOutputStreamInternal(Long length, AccessCondition accessCondition,
+ private BlobOutputStream openOutputStreamInternal(Long length, PremiumPageBlobTier premiumBlobTier, AccessCondition accessCondition,
BlobRequestOptions options, OperationContext opContext) throws StorageException {
if (opContext == null) {
opContext = new OperationContext();
@@ -943,9 +1051,8 @@ private BlobOutputStream openOutputStreamInternal(Long length, AccessCondition a
throw new IllegalArgumentException(SR.INVALID_PAGE_BLOB_LENGTH);
}
- this.create(length, accessCondition, options, opContext);
+ this.create(length, premiumBlobTier, accessCondition, options, opContext);
}
-
else {
if (options.getEncryptionPolicy() != null) {
throw new IllegalArgumentException(SR.ENCRYPTION_NOT_SUPPORTED_FOR_EXISTING_BLOBS);
@@ -1050,7 +1157,7 @@ public Void preProcessResponse(CloudPageBlob blob, CloudBlobClient client, Opera
blob.updateEtagAndLastModifiedFromResponse(this.getConnection());
blob.updateSequenceNumberFromResponse(this.getConnection());
- this.getResult().setRequestServiceEncrypted(CloudBlob.isServerRequestEncrypted(this.getConnection()));
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
};
@@ -1152,6 +1259,71 @@ public Void preProcessResponse(CloudPageBlob blob, CloudBlobClient client, Opera
return putRequest;
}
+ /**
+ * Uploads a blob from data in a byte array. If the blob already exists on the service, it will be overwritten.
+ *
+ * @param buffer
+ * A byte
array which represents the data to write to the blob.
+ * @param offset
+ * A int
which represents the offset of the byte array from which to start the data upload.
+ * @param length
+ * An int
which represents the number of bytes to upload from the input buffer.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ * @param accessCondition
+ * An {@link AccessCondition} object that represents the access conditions for the blob.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
+ * null
will use the default request options from the associated service client (
+ * {@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object that represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ *
+ * @throws StorageException
+ * If a storage service error occurred.
+ * @throws IOException
+ */
+ public void uploadFromByteArray(final byte[] buffer, final int offset, final int length, final PremiumPageBlobTier premiumBlobTier,
+ final AccessCondition accessCondition, BlobRequestOptions options, OperationContext opContext)
+ throws StorageException, IOException {
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(buffer, offset, length);
+ this.upload(inputStream, length, premiumBlobTier, accessCondition, options, opContext);
+ inputStream.close();
+ }
+
+ /**
+ * Uploads a blob from a file. If the blob already exists on the service, it will be overwritten.
+ *
+ * @param path
+ * A String
which represents the path to the file to be uploaded.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ * @param accessCondition
+ * An {@link AccessCondition} object that represents the access conditions for the blob.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
+ * null
will use the default request options from the associated service client (
+ * {@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object that represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ *
+ * @throws StorageException
+ * If a storage service error occurred.
+ * @throws IOException
+ */
+ public void uploadFromFile(final String path, final PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition, BlobRequestOptions options,
+ OperationContext opContext) throws StorageException, IOException {
+ File file = new File(path);
+ long fileLength = file.length();
+ InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
+ this.upload(inputStream, fileLength, premiumBlobTier, accessCondition, options, opContext);
+ inputStream.close();
+ }
+
/**
* Uploads the source stream data to the page blob. If the blob already exists on the service, it will be
* overwritten.
@@ -1170,13 +1342,13 @@ public Void preProcessResponse(CloudPageBlob blob, CloudBlobClient client, Opera
@Override
@DoesServiceRequest
public void upload(final InputStream sourceStream, final long length) throws StorageException, IOException {
- this.upload(sourceStream, length, null /* accessCondition */, null /* options */, null /* opContext */);
+ this.upload(sourceStream, length, null /* premiumBlobTier */, null /* accessCondition */, null /* options */, null /* opContext */);
}
/**
* Uploads the source stream data to the page blob using the specified lease ID, request options, and operation
* context. If the blob already exists on the service, it will be overwritten.
- *
+ *
* @param sourceStream
* An {@link InputStream} object to read from.
* @param length
@@ -1192,7 +1364,7 @@ public void upload(final InputStream sourceStream, final long length) throws Sto
* An {@link OperationContext} object which represents the context for the current operation. This object
* is used to track requests to the storage service, and to provide additional runtime information about
* the operation.
- *
+ *
* @throws IOException
* If an I/O exception occurred.
* @throws StorageException
@@ -1201,6 +1373,39 @@ public void upload(final InputStream sourceStream, final long length) throws Sto
@Override
@DoesServiceRequest
public void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition,
+ BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException {
+ this.upload(sourceStream, length, null /* premiumBlobTier*/, accessCondition, options, opContext);
+ }
+
+ /**
+ * Uploads the source stream data to the page blob using the specified lease ID, request options, and operation
+ * context. If the blob already exists on the service, it will be overwritten.
+ *
+ * @param sourceStream
+ * An {@link InputStream} object to read from.
+ * @param length
+ * A long
which represents the length, in bytes, of the stream data. This must be great than
+ * zero and a multiple of 512.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ * @param accessCondition
+ * An {@link AccessCondition} object which represents the access conditions for the blob.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
+ * null
will use the default request options from the associated service client (
+ * {@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object which represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ *
+ * @throws IOException
+ * If an I/O exception occurred.
+ * @throws StorageException
+ * If a storage service error occurred.
+ */
+ @DoesServiceRequest
+ public void upload(final InputStream sourceStream, final long length, final PremiumPageBlobTier premiumBlobTier, final AccessCondition accessCondition,
BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException {
assertNoWriteOperationForSnapshot();
@@ -1224,7 +1429,7 @@ public void upload(final InputStream sourceStream, final long length, final Acce
sourceStream.mark(Constants.MAX_MARK_LENGTH);
}
- final BlobOutputStream streamRef = this.openWriteNew(length, accessCondition, options, opContext);
+ final BlobOutputStream streamRef = this.openWriteNew(length, premiumBlobTier, accessCondition, options, opContext);
try {
streamRef.write(sourceStream, length);
}
@@ -1365,4 +1570,84 @@ public void setStreamWriteSizeInBytes(final int streamWriteSizeInBytes) {
this.streamWriteSizeInBytes = streamWriteSizeInBytes;
}
+
+ /**
+ * Sets the blob tier on a page blob on a premium storage account.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ * @throws StorageException
+ * If a storage service error occurred.
+ */
+ @DoesServiceRequest
+ public void uploadPremiumPageBlobTier(final PremiumPageBlobTier premiumBlobTier) throws StorageException {
+ this.uploadPremiumPageBlobTier(premiumBlobTier, null /* options */, null /* opContext */);
+ }
+
+ /**
+ * Sets the tier on a page blob on a premium storage account.
+ * @param premiumBlobTier
+ * A {@link PremiumPageBlobTier} object which represents the tier of the blob.
+ * @param options
+ * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
+ * null
will use the default request options from the associated service client (
+ * {@link CloudBlobClient}).
+ * @param opContext
+ * An {@link OperationContext} object which represents the context for the current operation. This object
+ * is used to track requests to the storage service, and to provide additional runtime information about
+ * the operation.
+ * @throws StorageException
+ * If a storage service error occurred.
+ */
+ @DoesServiceRequest
+ public void uploadPremiumPageBlobTier(final PremiumPageBlobTier premiumBlobTier, BlobRequestOptions options,
+ OperationContext opContext) throws StorageException {
+ assertNoWriteOperationForSnapshot();
+ Utility.assertNotNull("premiumBlobTier", premiumBlobTier);
+
+ if (opContext == null) {
+ opContext = new OperationContext();
+ }
+
+ options = BlobRequestOptions.populateAndApplyDefaults(options, BlobType.PAGE_BLOB, this.blobServiceClient);
+
+ ExecutionEngine.executeWithRetry(this.blobServiceClient, this,
+ this.uploadPremiumPageBlobTierImpl(premiumBlobTier, options), options.getRetryPolicyFactory(), opContext);
+ }
+
+ private StorageRequestString
which contains the premium page blob tier to parse.
+ *
+ * @return A PremiumPageBlobTier
value that represents the premium page blob tier.
+ */
+ protected static PremiumPageBlobTier parse(final String premiumBlobTierString) {
+ if (Utility.isNullOrEmpty(premiumBlobTierString)) {
+ return UNKNOWN;
+ }
+ else if ("p4".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P4;
+ }
+ else if ("p6".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P6;
+ }
+ else if ("p10".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P10;
+ }
+ else if ("p20".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P20;
+ }
+ else if ("p30".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P30;
+ }
+ else if ("p40".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P40;
+ }
+ else if ("p50".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P50;
+ }
+ else if ("p60".equals(premiumBlobTierString.toLowerCase(Locale.US))) {
+ return P60;
+ }
+ else {
+ return UNKNOWN;
+ }
+ }
+}
\ No newline at end of file
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseResponse.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseResponse.java
index 555fa0a9ea81..68b75b0d8b91 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseResponse.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseResponse.java
@@ -80,6 +80,16 @@ public static String getRequestId(final HttpURLConnection request) {
return request.getHeaderField(Constants.HeaderConstants.REQUEST_ID_HEADER);
}
+ /**
+ * Gets if the request was encrypted by the server.
+ * @param request
+ * The response from the server.
+ * @return A boolean indicating if the request was encrypted by the server.
+ */
+ public static boolean isServerRequestEncrypted(HttpURLConnection request) {
+ return Constants.TRUE.equals(request.getHeaderField(Constants.HeaderConstants.SERVER_REQUEST_ENCRYPTED));
+ }
+
/**
* Returns all the header/value pairs with the given prefix.
*
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
index 6c899a532327..12063f87b5cb 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
@@ -50,6 +50,7 @@
import com.microsoft.azure.storage.blob.CloudBlob;
import com.microsoft.azure.storage.blob.CloudBlobClient;
import com.microsoft.azure.storage.core.Base64;
+import com.microsoft.azure.storage.core.BaseResponse;
import com.microsoft.azure.storage.core.ExecutionEngine;
import com.microsoft.azure.storage.core.Logger;
import com.microsoft.azure.storage.core.NetworkInputStream;
@@ -667,6 +668,7 @@ public Void preProcessResponse(CloudFile file, CloudFileClient client, Operation
}
file.updateEtagAndLastModifiedFromResponse(this.getConnection());
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
@@ -2284,6 +2286,7 @@ public Void preProcessResponse(CloudFile file, CloudFileClient client, Operation
}
file.updateEtagAndLastModifiedFromResponse(this.getConnection());
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
};
@@ -2376,6 +2379,7 @@ public Void preProcessResponse(CloudFile file, CloudFileClient client, Operation
}
file.updateEtagAndLastModifiedFromResponse(this.getConnection());
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
};
@@ -2462,6 +2466,7 @@ public Void preProcessResponse(CloudFile file, CloudFileClient client, Operation
}
file.updateEtagAndLastModifiedFromResponse(this.getConnection());
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
};
@@ -2544,6 +2549,7 @@ public Void preProcessResponse(CloudFile file, CloudFileClient client, Operation
file.getProperties().setLength(size);
file.updateEtagAndLastModifiedFromResponse(this.getConnection());
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
};
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java
index b2d063e6cf6d..0caf8fd5ba1b 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java
@@ -34,6 +34,7 @@
import com.microsoft.azure.storage.StorageErrorCodeStrings;
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.StorageUri;
+import com.microsoft.azure.storage.core.BaseResponse;
import com.microsoft.azure.storage.core.ExecutionEngine;
import com.microsoft.azure.storage.core.LazySegmentedIterable;
import com.microsoft.azure.storage.core.ListResponse;
@@ -238,6 +239,7 @@ public Void preProcessResponse(CloudFileDirectory directory, CloudFileClient cli
final FileDirectoryAttributes attributes = FileResponse
.getFileDirectoryAttributes(this.getConnection(), client.isUsePathStyleUris());
directory.setProperties(attributes.getProperties());
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
};
@@ -629,6 +631,7 @@ public Void preProcessResponse(CloudFileDirectory directory, CloudFileClient cli
}
directory.updatePropertiesFromResponse(this.getConnection());
+ this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection()));
return null;
}
};
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileDirectoryProperties.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileDirectoryProperties.java
index c6dcfd3cc803..525f2d22ca1f 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileDirectoryProperties.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileDirectoryProperties.java
@@ -33,6 +33,11 @@ public final class FileDirectoryProperties {
*/
private Date lastModified;
+ /**
+ * Represents the directory's server-side encryption status.
+ */
+ private boolean serverEncrypted;
+
/**
* Gets the ETag value of the directory.
* boolean
which specifies the directory's encryption status.
+ */
+ public boolean isServerEncrypted() {
+ return serverEncrypted;
+ }
+
/**
* Sets the ETag value on the directory.
*
@@ -68,6 +82,16 @@ protected void setEtag(final String etag) {
this.etag = etag;
}
+ /**
+ * Sets the directory's server-side encryption status.
+ *
+ * @param serverEncrypted
+ * A boolean
which specifies the encryption status to set.
+ */
+ protected void setServerEncrypted(boolean serverEncrypted) {
+ this.serverEncrypted = serverEncrypted;
+ }
+
/**
* Sets the last modified time on the directory.
*
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileProperties.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileProperties.java
index f0ded017f865..9194fba375ba 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileProperties.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileProperties.java
@@ -76,6 +76,11 @@ public final class FileProperties {
*/
private Date lastModified;
+ /**
+ * Represents the file's server-side encryption status.
+ */
+ private boolean serverEncrypted;
+
/**
* Creates an instance of the FileProperties
class.
*/
@@ -100,6 +105,7 @@ public FileProperties(final FileProperties other) {
this.etag = other.etag;
this.length = other.length;
this.lastModified = other.lastModified;
+ this.serverEncrypted = other.serverEncrypted;
}
/**
@@ -203,6 +209,15 @@ public long getLength() {
return this.length;
}
+ /**
+ * Gets the file's server-side encryption status.
+ *
+ * @return A boolean
which specifies the file's encryption status.
+ */
+ public boolean isServerEncrypted() {
+ return serverEncrypted;
+ }
+
/**
* Sets the cache control value for the file.
*
@@ -262,7 +277,17 @@ public void setContentMD5(final String contentMD5) {
public void setContentType(final String contentType) {
this.contentType = contentType;
}
-
+
+ /**
+ * Sets the file's server-side encryption status.
+ *
+ * @param serverEncrypted
+ * A boolean
which specifies the encryption status to set.
+ */
+ protected void setServerEncrypted(boolean serverEncrypted) {
+ this.serverEncrypted = serverEncrypted;
+ }
+
/**
* Sets the copy state value for the file.
*
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileResponse.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileResponse.java
index 14d7bcfcd98c..fe9a0090701f 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileResponse.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/FileResponse.java
@@ -125,6 +125,8 @@ public static FileDirectoryAttributes getFileDirectoryAttributes(final HttpURLCo
directoryProperties.setEtag(BaseResponse.getEtag(request));
directoryProperties.setLastModified(new Date(request.getLastModified()));
directoryAttributes.setMetadata(getMetadata(request));
+ directoryProperties.setServerEncrypted(
+ Constants.TRUE.equals(request.getHeaderField(Constants.HeaderConstants.SERVER_ENCRYPTED)));
return directoryAttributes;
}
@@ -161,6 +163,8 @@ public static FileAttributes getFileAttributes(final HttpURLConnection request,
properties.setContentType(request.getHeaderField(Constants.HeaderConstants.CONTENT_TYPE));
properties.setEtag(BaseResponse.getEtag(request));
properties.setCopyState(FileResponse.getCopyState(request));
+ properties.setServerEncrypted(
+ Constants.TRUE.equals(request.getHeaderField(Constants.HeaderConstants.SERVER_ENCRYPTED)));
final Calendar lastModifiedCalendar = Calendar.getInstance(Utility.LOCALE_US);
lastModifiedCalendar.setTimeZone(Utility.UTC_ZONE);
diff --git a/pom.xml b/pom.xml
index ac91bbaf98fe..e36ef55894d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@