Copyright Microsoft Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
/** * Copyright Microsoft Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
package com.microsoft.azure.storage; import java.util.Date;
Represents the result of a physical request.
/** * Represents the result of a physical request. */
public final class RequestResult {
Represents an exception that occurred while processing the request. This field may be null.
/** * Represents an exception that occurred while processing the request. This field may be <code>null</code>. */
private Exception exception;
Represents the request ID supplied by the storage service.
/** * Represents the request ID supplied by the storage service. */
private String serviceRequestID;
Represents the ContentMD5 header returned by the storage service.
/** * Represents the ContentMD5 header returned by the storage service. */
private String contentMD5;
Represents the date header returned by the storage service.
/** * Represents the date header returned by the storage service. */
private String requestDate;
Represents whether or not the data for a write operation is encrypted on the server-side.
/** * Represents whether or not the data for a write operation is encrypted on the server-side. */
private boolean requestServiceEncrypted;
Represents whether or not the data for a read operation is encrypted on the server-side.
/** * Represents whether or not the data for a read operation is encrypted on the server-side. */
private boolean serviceEncrypted;
Represents the hash for the key used to server-side encrypt with client-provided keys.
/** * Represents the hash for the key used to server-side encrypt with client-provided keys. */
private String encryptionKeySHA256;
Represents the ETag header returned by the storage service.
/** * Represents the ETag header returned by the storage service. */
private String etag;
Represents the start date of the operation.
/** * Represents the start date of the operation. */
private Date startDate;
Represents the HTTP status code for the request.
/** * Represents the HTTP status code for the request. */
private int statusCode = -1;
Represents the HTTP status message for the request.
/** * Represents the HTTP status message for the request. */
private String statusMessage;
Represents the service ErrorCode for the request.
/** * Represents the service ErrorCode for the request. */
private String errorCode;
Represents the stop date of the operation.
/** * Represents the stop date of the operation. */
private Date stopDate;
Location that the request was sent to.
/** * Location that the request was sent to. */
private StorageLocation targetLocation;
Gets the location that the request was sent to.
Returns:A StorageLocation object.
/** * Gets the location that the request was sent to. * * @return A {@link StorageLocation} object. */
public StorageLocation getTargetLocation() { return this.targetLocation; }
Gets the MD5 hash for the request.
Returns:A String which contains the MD5 hash.
/** * Gets the MD5 hash for the request. * * @return A <code>String</code> which contains the MD5 hash. */
public String getContentMD5() { return this.contentMD5; }
Gets the ETag for the request.
Returns:A String which contains the ETag.
/** * Gets the ETag for the request. * * @return A <code>String</code> which contains the ETag. */
public String getEtag() { return this.etag; }
Gets the Exception for the request.
Returns:An Exception.
/** * Gets the <code>Exception</code> for the request. * * @return An <code>Exception</code>. */
public Exception getException() { return this.exception; }
Gets the request date.
Returns:A String which contains the date of the request.
/** * Gets the request date. * * @return A <code>String</code> which contains the date of the request. */
public String getRequestDate() { return this.requestDate; }
Gets whether the request is server-side encrypted.
Returns:A boolean which contains the server-side encryption status of the request.
/** * Gets whether the request is server-side encrypted. * * @return A <code>boolean</code> which contains the server-side encryption status of the request. */
public boolean isRequestServiceEncrypted() { return requestServiceEncrypted; }
Gets whether the result is server-side encrypted.
Returns:A boolean which contains the server-side encryption status of the request.
/** * Gets whether the result is server-side encrypted. * * @return A <code>boolean</code> which contains the server-side encryption status of the request. */
public boolean isServiceEncrypted() { return serviceEncrypted; }
Gets the hash of the key used to server-side encrypt for client-provided keys.
Returns:A base64 encoded string which represents the key hash.
/** * Gets the hash of the key used to server-side encrypt for client-provided keys. * * @return A base64 encoded string which represents the key hash. */
public String getEncryptionKeySHA256() { return encryptionKeySHA256; }
Gets the service request ID.
Returns:A String which contains the service request ID.
/** * Gets the service request ID. * * @return A <code>String</code> which contains the service request ID. */
public String getServiceRequestID() { return this.serviceRequestID; }
Gets the start date for the request.
Returns:A java.util.Date object which contains the start date.
/** * Gets the start date for the request. * * @return A <code>java.util.Date</code> object which contains the start date. */
public Date getStartDate() { return this.startDate; }
Gets the HTTP status code for the request.
Returns:An int which contains the HTTP status code.
/** * Gets the HTTP status code for the request. * * @return An <code>int</code> which contains the HTTP status code. */
public int getStatusCode() { return this.statusCode; }
Gets the HTTP status message for the request.
Returns:A String which contains the HTTP status message.
/** * Gets the HTTP status message for the request. * * @return A <code>String</code> which contains the HTTP status message. */
public String getStatusMessage() { return this.statusMessage; }
Gets the service ErrorCode for the request.
Returns:A String which contains the service ErrorCode.
/** * Gets the service ErrorCode for the request. * * @return A <code>String</code> which contains the service ErrorCode. */
public String getErrorCode() { return this.errorCode; }
Gets the stop date for the request.
Returns:A java.util.Date object which contains the stop date.
/** * Gets the stop date for the request. * * @return A <code>java.util.Date</code> object which contains the stop date. */
public Date getStopDate() { if (this.stopDate == null) { // stop date was not initialized, most likely due to a network exception // if this is null, retries are immediate this.stopDate = new Date(); } return this.stopDate; }
Sets the MD5 hash for the request.
Params:
  • contentMD5 – A String object which contains the MD5 hash to set.
/** * Sets the MD5 hash for the request. * * @param contentMD5 * A <code>String</code> object which contains the MD5 hash to set. */
public void setContentMD5(final String contentMD5) { this.contentMD5 = contentMD5; }
Sets the ETag for the request.
Params:
  • etag – A String object which contains the ETag to set.
/** * Sets the ETag for the request. * * @param etag * A <code>String</code> object which contains the ETag to set. */
public void setEtag(final String etag) { this.etag = etag; }
Sets the Exception for the request.
Params:
  • exception – The Exception to set.
/** * Sets the <code>Exception</code> for the request. * * @param exception * The <code>Exception</code> to set. */
public void setException(final Exception exception) { this.exception = exception; }
Sets the request date.
Params:
  • requestDate – A java.util.Date object which contains the request date to set.
/** * Sets the request date. * * @param requestDate * A <code>java.util.Date</code> object which contains the request date to set. */
public void setRequestDate(final String requestDate) { this.requestDate = requestDate; }
Sets the request's server-encryption status.
Params:
  • requestServiceEncrypted – A boolean object which represents the server-encryption status to set.
/** * Sets the request's server-encryption status. * * @param requestServiceEncrypted * A <code>boolean</code> object which represents the server-encryption status to set. */
public void setRequestServiceEncrypted(boolean requestServiceEncrypted) { this.requestServiceEncrypted = requestServiceEncrypted; }
Sets the server-encryption status.
Params:
  • requestServiceEncrypted – A boolean object which represents the server-encryption status to set.
/** * Sets the server-encryption status. * * @param requestServiceEncrypted * A <code>boolean</code> object which represents the server-encryption status to set. */
public void setServiceEncrypted(boolean requestServiceEncrypted) { this.serviceEncrypted = requestServiceEncrypted; }
Sets the request's key hash for client-provided key requests.
Params:
  • keyHash – The hash of the key, represented by a base64 encoded string.
/** * Sets the request's key hash for client-provided key requests. * * @param keyHash * The hash of the key, represented by a base64 encoded string. */
public void setEncryptionKeySHA256(String keyHash) { this.encryptionKeySHA256 = keyHash; }
Sets the service request ID.
Params:
  • serviceRequestID – A String object which contains the service request ID to set.
/** * Sets the service request ID. * * @param serviceRequestID * A <code>String</code> object which contains the service request ID to set. */
public void setServiceRequestID(final String serviceRequestID) { this.serviceRequestID = serviceRequestID; }
Sets the start date for the request.
Params:
  • startDate – A java.util.Date object which contains the start date to set.
/** * Sets the start date for the request. * * @param startDate * A <code>java.util.Date</code> object which contains the start date to set. */
public void setStartDate(final Date startDate) { this.startDate = startDate; }
Sets the HTTP status code for the request.
Params:
  • statusCode – An int which contains the HTTP status code to set.
/** * Sets the HTTP status code for the request. * * @param statusCode * An <code>int</code> which contains the HTTP status code to set. */
public void setStatusCode(final int statusCode) { this.statusCode = statusCode; }
Sets the HTTP status message for the request.
Params:
  • statusMessage – A String which contains the status message to set.
/** * Sets the HTTP status message for the request. * * @param statusMessage * A <code>String</code> which contains the status message to set. */
public void setStatusMessage(final String statusMessage) { this.statusMessage = statusMessage; }
Sets the service ErrorCode for the request.
Params:
  • errorCode – A String which contains the service ErrorCode to set.
/** * Sets the service ErrorCode for the request. * * @param errorCode * A <code>String</code> which contains the service ErrorCode to set. */
public void setErrorCode(final String errorCode) { this.errorCode = errorCode; }
Sets the stop date for the request.
Params:
  • stopDate – A java.util.Date object which contains the stop date to set.
/** * Sets the stop date for the request. * * @param stopDate * A <code>java.util.Date</code> object which contains the stop date to set. */
public void setStopDate(final Date stopDate) { this.stopDate = stopDate; }
Sets the location that the request was sent to.
Params:
/** * Sets the location that the request was sent to. * * @param targetLocation * A {@link StorageLocation} object to set. */
public void setTargetLocation(StorageLocation targetLocation) { this.targetLocation = targetLocation; } }