C - The service client typeP - The type of the parent object, i.e. CloudBlobContainer for downloadAttributes etc.R - The type of the expected resultpublic abstract class StorageRequest<C,P,R> extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
StorageRequest()
Default Ctor.
|
|
StorageRequest(RequestOptions options,
StorageUri storageUri)
Initializes a new instance of the StorageRequest class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyLocationModeToRequest() |
abstract HttpURLConnection |
buildRequest(C client,
P parentObject,
OperationContext context)
Function to construct the request.
|
boolean |
getArePropertiesPopulated() |
HttpURLConnection |
getConnection() |
String |
getContentMD5() |
StorageLocation |
getCurrentLocation() |
long |
getCurrentRequestByteCount() |
AccessCondition |
getETagLockCondition() |
StorageException |
getException() |
Long |
getLength() |
LocationMode |
getLocationMode() |
String |
getLockedETag() |
Long |
getOffset() |
RequestLocationMode |
getRequestLocationMode() |
RequestOptions |
getRequestOptions() |
RequestResult |
getResult() |
InputStream |
getSendStream() |
StorageUri |
getStorageUri() |
protected void |
initialize(OperationContext opContext)
Resets the operation status flags between operations.
|
void |
initializeLocation() |
boolean |
isNonExceptionedRetryableFailure() |
protected boolean |
isSent() |
protected StorageException |
materializeException(OperationContext opContext)
Returns either the held exception from the operation if it is set, otherwise the translated exception.
|
StorageExtendedErrorInformation |
parseErrorDetails()
Returns extended error information for this request.
|
R |
postProcessResponse(HttpURLConnection connection,
P parentObject,
C client,
OperationContext context,
R storageObject)
Post-Stream Retrieval function.
|
abstract R |
preProcessResponse(P parentObject,
C client,
OperationContext context)
Pre-Stream Retrieval function.
|
void |
recoveryAction(OperationContext context)
Recovery action for retries.
|
void |
setArePropertiesPopulated(boolean arePropertiesPopulated) |
void |
setConnection(HttpURLConnection connection) |
void |
setContentMD5(String contentMD5) |
void |
setCurrentLocation(StorageLocation currentLocation) |
void |
setCurrentRequestByteCount(long currentRequestByteCount) |
void |
setETagLockCondition(AccessCondition etagLockCondition) |
protected void |
setException(StorageException exceptionReference) |
void |
setHeaders(HttpURLConnection connection,
P parentObject,
OperationContext context)
Function to set custom headers.
|
protected void |
setIsSent(boolean isSent) |
void |
setLength(Long length) |
void |
setLocationMode(LocationMode locationMode) |
void |
setLockedETag(String lockedETag) |
void |
setNonExceptionedRetryableFailure(boolean nonExceptionedRetryableFailure) |
void |
setOffset(Long offset) |
void |
setRequestLocationMode()
Function to apply the location mode to the request.
|
void |
setRequestLocationMode(RequestLocationMode requestLocationMode) |
protected void |
setRequestOptions(RequestOptions requestOptions) |
void |
setResult(RequestResult result) |
void |
setSendStream(InputStream sendStream) |
void |
setStorageUri(StorageUri storageUri) |
static void |
signBlobQueueAndFileRequest(HttpURLConnection request,
ServiceClient client,
long contentLength,
OperationContext context) |
abstract void |
signRequest(HttpURLConnection connection,
C client,
OperationContext context)
Function to Sign headers.
|
static void |
signTableRequest(HttpURLConnection request,
ServiceClient client,
long contentLength,
OperationContext context) |
void |
validateLocation() |
void |
validateStreamWrite(StreamMd5AndLength descriptor)
Validate the written stream length when length is provided.
|
protected StorageRequest()
public StorageRequest(RequestOptions options, StorageUri storageUri)
options - the RequestOptions to usepublic final StorageException getException()
public final RequestOptions getRequestOptions()
public final RequestResult getResult()
public final HttpURLConnection getConnection()
public final InputStream getSendStream()
public Long getOffset()
public Long getLength()
public final String getLockedETag()
public final String getContentMD5()
public LocationMode getLocationMode()
public RequestLocationMode getRequestLocationMode()
public StorageLocation getCurrentLocation()
public AccessCondition getETagLockCondition()
public boolean getArePropertiesPopulated()
public StorageUri getStorageUri()
public long getCurrentRequestByteCount()
protected boolean isSent()
protected final void initialize(OperationContext opContext)
public final boolean isNonExceptionedRetryableFailure()
protected final StorageException materializeException(OperationContext opContext)
request - the reference to the HttpURLConnection for the operation.opContext - an object used to track the execution of the operationpublic static final void signBlobQueueAndFileRequest(HttpURLConnection request, ServiceClient client, long contentLength, OperationContext context) throws InvalidKeyException, StorageException
InvalidKeyExceptionStorageExceptionpublic static final void signTableRequest(HttpURLConnection request, ServiceClient client, long contentLength, OperationContext context) throws InvalidKeyException, StorageException
InvalidKeyExceptionStorageExceptionpublic void applyLocationModeToRequest()
public void initializeLocation()
public void validateLocation()
protected final void setException(StorageException exceptionReference)
exceptionReference - the exception to setpublic final void setNonExceptionedRetryableFailure(boolean nonExceptionedRetryableFailure)
nonExceptionedRetryableFailure - the nonExceptionedRetryableFailure to setprotected final void setRequestOptions(RequestOptions requestOptions)
requestOptions - the requestOptions to setpublic final void setResult(RequestResult result)
result - the result to setpublic final void setConnection(HttpURLConnection connection)
connection - the connection to setpublic void setSendStream(InputStream sendStream)
sendStream - the stream to send to the serverpublic void setOffset(Long offset)
offset - the stream offset to start copying frompublic void setLength(Long length)
length - the length, in bytes, of the streampublic void setLockedETag(String lockedETag)
lockedETag - the locked ETagpublic void setContentMD5(String contentMD5)
contentMD5 - the contentMD5public void setETagLockCondition(AccessCondition etagLockCondition)
etagLockCondition - the locked ETag conditionpublic void setArePropertiesPopulated(boolean arePropertiesPopulated)
arePropertiesPopulated - the arePropertiesPopulated valuepublic void setLocationMode(LocationMode locationMode)
locationMode - the locationMode valuepublic void setRequestLocationMode(RequestLocationMode requestLocationMode)
requestLocationMode - the requestLocationMode valuepublic void setCurrentLocation(StorageLocation currentLocation)
storageLocation - the storageLocation valuepublic void setStorageUri(StorageUri storageUri)
storageUri - the storageUri valuepublic void setCurrentRequestByteCount(long currentRequestByteCount)
currentRequestByteCount - the currentRequestByteCount to setpublic void setRequestLocationMode()
protected void setIsSent(boolean isSent)
isSent - the isSent valuepublic abstract HttpURLConnection buildRequest(C client, P parentObject, OperationContext context) throws Exception
parentObject - Parent object, i.e. CloudBlobContainer for downloadAttributes etc.context - An 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.Exceptionpublic void setHeaders(HttpURLConnection connection, P parentObject, OperationContext context)
connection - HttpURLConnection configured for the operation.parentObject - Parent object, i.e. CloudBlobContainer for downloadAttributes etc.context - An 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.public abstract void signRequest(HttpURLConnection connection, C client, OperationContext context) throws Exception
connection - HttpURLConnection configured for the operation.client - The service client.context - An 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.Exceptionpublic abstract R preProcessResponse(P parentObject, C client, OperationContext context) throws Exception
command - StorageCommand for the operation.parentObject - Parent object, i.e. CloudBlobContainer for downloadAttributes etc.client - The service client.Exceptionpublic R postProcessResponse(HttpURLConnection connection, P parentObject, C client, OperationContext context, R storageObject) throws Exception
connection - HttpURLConnection configured for the operation.storageObject - An object of the expected result's type.Exceptionpublic void validateStreamWrite(StreamMd5AndLength descriptor) throws StorageException
StorageExceptionpublic void recoveryAction(OperationContext context) throws IOException
IOExceptionpublic StorageExtendedErrorInformation parseErrorDetails()
StorageExtendedErrorInformation object that represents the error details for the specified
request./**
* 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.
*/