/** * Indicates if the iterator has another element. */ @Override @DoesServiceRequest public boolean hasNext() { while (this.currentSegment == null || (!this.currentSegmentIterator.hasNext() && this.currentSegment != null && this.currentSegment .getHasMoreResults())) { try { this.currentSegment = ExecutionEngine.executeWithRetry(this.client, this.parentObject, this.segmentGenerator, this.policyFactory, this.opContext); } catch (final StorageException e) { final NoSuchElementException ex = new NoSuchElementException(SR.ENUMERATION_ERROR); ex.initCause(e); throw ex; } this.currentSegmentIterator = this.currentSegment.getResults().iterator(); if (!this.currentSegmentIterator.hasNext() && !this.currentSegment.getHasMoreResults()) { return false; } } return this.currentSegmentIterator.hasNext(); }
try { request = setupStorageRequest(client, parentObject, task, currentRetryCount, opContext); ExecutionEngine.fireResponseReceivedEvent(opContext, request, task.getResult()); ExecutionEngine.fireErrorReceivingResponseEvent(opContext, request, task.getResult()); ExecutionEngine.fireRequestCompletedEvent(opContext, request, task.getResult()); translatedException == null ? null : translatedException.getMessage()); task.setCurrentLocation(getNextLocation(task.getCurrentLocation(), task.getLocationMode())); Logger.info(opContext, LogConstants.NEXT_LOCATION, task.getCurrentLocation(), task.getLocationMode()); ExecutionEngine.fireRetryingEvent(opContext, task.getConnection(), task.getResult(), retryContext);
ExecutionEngine.fireSendingRequestEvent(opContext, request, task.getResult()); task.setIsSent(true);
try { request = setupStorageRequest(client, parentObject, task, currentRetryCount, opContext); ExecutionEngine.fireResponseReceivedEvent(opContext, request, task.getResult()); ExecutionEngine.fireErrorReceivingResponseEvent(opContext, request, task.getResult()); ExecutionEngine.fireRequestCompletedEvent(opContext, request, task.getResult()); translatedException == null ? null : translatedException.getMessage()); task.setCurrentLocation(getNextLocation(task.getCurrentLocation(), task.getLocationMode())); Logger.info(opContext, LogConstants.NEXT_LOCATION, task.getCurrentLocation(), task.getLocationMode()); ExecutionEngine.fireRetryingEvent(opContext, task.getConnection(), task.getResult(), retryContext);
ExecutionEngine.fireSendingRequestEvent(opContext, request, task.getResult()); task.setIsSent(true);
/** * Reserved for internal use. Performs an insert operation on the specified table, using the specified * {@link TableRequestOptions} and {@link OperationContext}. * <p> * This method will invoke the Insert Entity REST API to execute this table operation, using the Table service * endpoint and storage account credentials in the {@link CloudTableClient} object. * * @param client * A {@link CloudTableClient} instance specifying the Table service endpoint, storage account * credentials, and any additional query parameters. * @param tableName * A <code>String</code> which specifies the name of the table. * @param options * A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. * @param opContext * An {@link OperationContext} object for tracking the current operation. * * @return * A {@link TableResult} which represents the results of executing the operation. * * @throws StorageException * if an error occurs in the storage operation. */ private TableResult performInsert(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { return ExecutionEngine.executeWithRetry(client, this, this.insertImpl(client, tableName, options, opContext), options.getRetryPolicyFactory(), opContext); }
/** * Reserved for internal use. Perform an update operation on the specified table, using the specified * {@link TableRequestOptions} and {@link OperationContext}. * <p> * This method will invoke the Storage Service REST API to execute this table operation, using the Table service * endpoint and storage account credentials in the {@link CloudTableClient} object. * * @param client * A {@link CloudTableClient} instance specifying the Table service endpoint, storage account * credentials, and any additional query parameters. * @param tableName * A <code>String</code> which specifies the name of the table. * @param options * A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. * @param opContext * An {@link OperationContext} object for tracking the current operation. * * @return * A {@link TableResult} which represents the results of executing the operation. * * @throws StorageException * if an error occurs in the storage operation. */ private TableResult performUpdate(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { return ExecutionEngine.executeWithRetry(client, this, this.updateImpl(client, tableName, options, opContext), options.getRetryPolicyFactory(), opContext); }
/** * Reserved for internal use. Perform a merge operation on the specified table, using the specified * {@link TableRequestOptions} and {@link OperationContext}. * <p> * This method will invoke the Merge Entity REST API to execute this table operation, using the Table service * endpoint and storage account credentials in the {@link CloudTableClient} object. * * @param client * A {@link CloudTableClient} instance specifying the Table service endpoint, storage account * credentials, and any additional query parameters. * @param tableName * A <code>String</code> which specifies the name of the table. * @param options * A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. * @param opContext * An {@link OperationContext} object for tracking the current operation. * * @return * A {@link TableResult} which represents the results of executing the operation. * * @throws StorageException * if an error occurs in the storage operation. * @throws IOException */ private TableResult performMerge(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { return ExecutionEngine.executeWithRetry(client, this, this.mergeImpl(client, tableName, options, opContext), options.getRetryPolicyFactory(), opContext); }
/** * Reserved for internal use. Performs a delete operation on the specified table, using the specified * {@link TableRequestOptions} and {@link OperationContext}. * <p> * This method will invoke the <a href="http://msdn.microsoft.com/en-us/library/azure/dd135727.aspx">Delete * Entity</a> REST API to execute this table operation, using the Table service endpoint and storage account * credentials in the {@link CloudTableClient} object. * * @param client * A {@link CloudTableClient} instance specifying the Table service endpoint, storage account * credentials, and any additional query parameters. * @param tableName * A <code>String</code> which specifies the name of the table. * @param options * A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. * @param opContext * An {@link OperationContext} object for tracking the current operation. * * @return * A {@link TableResult} which represents the results of executing the operation. * * @throws StorageException * if an error occurs in the storage operation. */ private TableResult performDelete(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { return ExecutionEngine.executeWithRetry(client, this, this.deleteImpl(client, tableName, options, opContext), options.getRetryPolicyFactory(), opContext); }
/** * Reserved for internal use. Performs an insert operation on the specified table, using the specified * {@link TableRequestOptions} and {@link OperationContext}. * <p> * This method will invoke the Insert Entity REST API to execute this table operation, using the Table service * endpoint and storage account credentials in the {@link CloudTableClient} object. * * @param client * A {@link CloudTableClient} instance specifying the Table service endpoint, storage account * credentials, and any additional query parameters. * @param tableName * A <code>String</code> which specifies the name of the table. * @param options * A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. * @param opContext * An {@link OperationContext} object for tracking the current operation. * * @return * A {@link TableResult} which represents the results of executing the operation. * * @throws StorageException * if an error occurs in the storage operation. */ private TableResult performInsert(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { return ExecutionEngine.executeWithRetry(client, this, this.insertImpl(client, tableName, options, opContext), options.getRetryPolicyFactory(), opContext); }
/** * Indicates if the iterator has another element. */ @Override @DoesServiceRequest public boolean hasNext() { while (this.currentSegment == null || (!this.currentSegmentIterator.hasNext() && this.currentSegment != null && this.currentSegment .getHasMoreResults())) { try { this.currentSegment = ExecutionEngine.executeWithRetry(this.client, this.parentObject, this.segmentGenerator, this.policyFactory, this.opContext); } catch (final StorageException e) { final NoSuchElementException ex = new NoSuchElementException(SR.ENUMERATION_ERROR); ex.initCause(e); throw ex; } this.currentSegmentIterator = this.currentSegment.getResults().iterator(); if (!this.currentSegmentIterator.hasNext() && !this.currentSegment.getHasMoreResults()) { return false; } } return this.currentSegmentIterator.hasNext(); }
/** * Reserved for internal use. Perform a merge operation on the specified table, using the specified * {@link TableRequestOptions} and {@link OperationContext}. * <p> * This method will invoke the Merge Entity REST API to execute this table operation, using the Table service * endpoint and storage account credentials in the {@link CloudTableClient} object. * * @param client * A {@link CloudTableClient} instance specifying the Table service endpoint, storage account * credentials, and any additional query parameters. * @param tableName * A <code>String</code> which specifies the name of the table. * @param options * A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. * @param opContext * An {@link OperationContext} object for tracking the current operation. * * @return * A {@link TableResult} which represents the results of executing the operation. * * @throws StorageException * if an error occurs in the storage operation. * @throws IOException */ private TableResult performMerge(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { return ExecutionEngine.executeWithRetry(client, this, this.mergeImpl(client, tableName, options, opContext), options.getRetryPolicyFactory(), opContext); }
/** * Reserved for internal use. Performs a retrieve operation on the specified table, using the specified * {@link TableRequestOptions} and {@link OperationContext}. * <p> * This method will invoke the Storage Service REST API to execute this table operation, using the Table service * endpoint and storage account credentials in the {@link CloudTableClient} object. * * @param client * A {@link CloudTableClient} instance specifying the Table service endpoint and storage account * credentials to use. * @param tableName * A <code>String</code> containing the name of the table to query. * @param options * A {@link TableRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. * @param opContext * An {@link OperationContext} object for tracking the current operation. * * @return * A {@link TableResult} containing the results of executing the query operation. * * @throws StorageException * if an error occurs in the storage operation. */ protected TableResult performRetrieve(final CloudTableClient client, final String tableName, final TableRequestOptions options, final OperationContext opContext) throws StorageException { return ExecutionEngine.executeWithRetry(client, this, this.retrieveImpl(client, tableName, options), options.getRetryPolicyFactory(), opContext); }
/** * Uploads a block of the blob to the server. * * @param blockId * A <code>String</code> which represents the Base64-encoded Block ID. * @param md5 * A <code>String</code> which represents the MD5 to use if it is set. * @param sourceStream * An {@link InputStream} object to read from. * @param length * A <code>long</code> which represents the length, in bytes, of the stream data, or -1 if unknown. * @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. * @param opContext * An {@link OperationContext} object that is used to track the execution of the operation. * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest private void uploadBlockInternal(final String blockId, final String md5, final InputStream sourceStream, final long length, final AccessCondition accessCondition, final BlobRequestOptions options, final OperationContext opContext) throws StorageException { ExecutionEngine.executeWithRetry(this.blobServiceClient, this, uploadBlockImpl(blockId, md5, sourceStream, length, accessCondition, options, opContext), options.getRetryPolicyFactory(), opContext); }
/** * Uploads a block of the blob to the server. * * @param blockId * A <code>String</code> which represents the Base64-encoded Block ID. * @param md5 * A <code>String</code> which represents the MD5 to use if it is set. * @param sourceStream * An {@link InputStream} object to read from. * @param length * A <code>long</code> which represents the length, in bytes, of the stream data, or -1 if unknown. * @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. * @param opContext * An {@link OperationContext} object that is used to track the execution of the operation. * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest private void uploadBlockInternal(final String blockId, final String md5, final InputStream sourceStream, final long length, final AccessCondition accessCondition, final BlobRequestOptions options, final OperationContext opContext) throws StorageException { ExecutionEngine.executeWithRetry(this.blobServiceClient, this, uploadBlockImpl(blockId, md5, sourceStream, length, accessCondition, options, opContext), options.getRetryPolicyFactory(), opContext); }
return ExecutionEngine.executeWithRetry(client, this, this.retrieveImpl(client, tableName, options), options.getRetryPolicyFactory(), opContext);
@DoesServiceRequest private boolean exists(final boolean primaryOnly, final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException { if (opContext == null) { opContext = new OperationContext(); } opContext.initialize(); options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient); return ExecutionEngine.executeWithRetry(this.fileServiceClient, this, this.existsImpl(primaryOnly, accessCondition, options), options.getRetryPolicyFactory(), opContext); }
@DoesServiceRequest private boolean exists(final boolean primaryOnly, QueueRequestOptions options, OperationContext opContext) throws StorageException { if (opContext == null) { opContext = new OperationContext(); } opContext.initialize(); options = QueueRequestOptions.populateAndApplyDefaults(options, this.queueServiceClient); return ExecutionEngine.executeWithRetry(this.queueServiceClient, this, this.existsImpl(primaryOnly, options), options.getRetryPolicyFactory(), opContext); }
@DoesServiceRequest private final boolean exists(final boolean primaryOnly, final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException { if (opContext == null) { opContext = new OperationContext(); } opContext.initialize(); options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient); return ExecutionEngine.executeWithRetry(this.fileServiceClient, this, this.existsImpl(primaryOnly, accessCondition, options), options.getRetryPolicyFactory(), opContext); }
@DoesServiceRequest private boolean exists(final boolean primaryOnly, final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException { if (opContext == null) { opContext = new OperationContext(); } opContext.initialize(); options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient); return ExecutionEngine.executeWithRetry(this.fileServiceClient, this, this.existsImpl(primaryOnly, accessCondition, options), options.getRetryPolicyFactory(), opContext); }