@Override public void setHeaders(HttpURLConnection connection, CloudFileShare share, OperationContext context) { if (metadata != null) { FileRequest.addMetadata(connection, metadata, context); } }
/** * Constructs a web request to create a new share. Sign with 0 length. * * @param uri * A <code>java.net.URI</code> object that specifies the absolute URI. * @param fileOptions * A {@link FileRequestOptions} object that specifies execution options such as retry policy and timeout * settings for the operation. Specify <code>null</code> to use the request options specified on the * {@link CloudFileClient}. * @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 properties * The properties to set for the share. * @return a HttpURLConnection configured for the operation. * @throws StorageException * @throws IllegalArgumentException */ public static HttpURLConnection createShare(final URI uri, final FileRequestOptions fileOptions, final OperationContext opContext, final FileShareProperties properties) throws IOException, URISyntaxException, StorageException { final UriQueryBuilder shareBuilder = getShareUriQueryBuilder(); final HttpURLConnection request = BaseRequest.create(uri, fileOptions, shareBuilder, opContext); addProperties(request, properties); return request; }
final OperationContext opContext, final AccessCondition accessCondition, String snapshotVersion, DeleteShareSnapshotsOption deleteSnapshotsOption) throws IOException, URISyntaxException, StorageException { final UriQueryBuilder shareBuilder = getShareUriQueryBuilder(); FileRequest.addShareSnapshot(shareBuilder, snapshotVersion); HttpURLConnection request = BaseRequest.delete(uri, fileOptions, shareBuilder, opContext); if (accessCondition != null) {
IOException, StorageException { final UriQueryBuilder builder = getDirectoryUriQueryBuilder(); addShareSnapshot(builder, snapshotVersion); builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.LIST);
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testFileGetRangeContentMD5Bounds() throws StorageException, IOException, URISyntaxException { { CloudFile file = FileTestHelper.uploadNewFile(this.share, 5 * Constants.MB, null); FileRequestOptions options = new FileRequestOptions(); OperationContext opContext = new OperationContext(); try { FileRequest.getFile(file.getUri(), options, opContext, null, null, 0L, 4L * Constants.MB, true); FileRequest.getFile(file.getUri(), options, opContext, null, null, 0L, 4L * Constants.MB + 1, true); fail("The request for range ContentMD5 should have thrown an Exception for exceeding the limit."); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), String.format("The value of the parameter 'count' should be between 1 and %1d.", Constants.MAX_BLOCK_SIZE)); } } }
String snapshotVersion) throws IOException, URISyntaxException, StorageException { addShareSnapshot(builder, snapshotVersion); HttpURLConnection request = BaseRequest.getProperties(uri, fileOptions, builder, opContext);
addProperties(request, properties);
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, OperationContext context) throws Exception { return FileRequest.deleteFile(file.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { return FileRequest.deleteDirectory(directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, accessCondition); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, OperationContext context) throws Exception { return FileRequest.abortCopy(file.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition, copyId); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, OperationContext context) throws Exception { return FileRequest.copyFrom(file.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, sourceAccessCondition, destinationAccessCondition, source.toASCIIString()); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { final HttpURLConnection request = FileRequest.createDirectory( directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context); return request; }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileShare share, OperationContext context) throws Exception { final HttpURLConnection request = FileRequest.createShare( share.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, share.getProperties()); return request; }
final OperationContext opContext, final AccessCondition accessCondition, String snapshotVersion, DeleteShareSnapshotsOption deleteSnapshotsOption) throws IOException, URISyntaxException, StorageException { final UriQueryBuilder shareBuilder = getShareUriQueryBuilder(); FileRequest.addShareSnapshot(shareBuilder, snapshotVersion); HttpURLConnection request = BaseRequest.delete(uri, fileOptions, shareBuilder, opContext); if (accessCondition != null) {
IOException, StorageException { final UriQueryBuilder builder = getDirectoryUriQueryBuilder(); addShareSnapshot(builder, snapshotVersion); builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.LIST);
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, OperationContext context) throws Exception { // The first time this is called, we have to set the length and offset. // On retries, these will already have values and need not be called. if (this.getOffset() == null) { this.setOffset(fileOffset); } if (this.getLength() == null) { this.setLength(length); } // Only do this when we have support from the service. // AccessCondition tempCondition = (this.getETagLockCondition() != null) ? this.getETagLockCondition() // : accessCondition; return FileRequest.getFile(file.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition, file.getShare().snapshotID, this.getOffset(), this.getLength(), (options.getUseTransactionalContentMD5() && !this.getArePropertiesPopulated())); }
String snapshotVersion) throws IOException, URISyntaxException, StorageException { addShareSnapshot(builder, snapshotVersion); HttpURLConnection request = BaseRequest.getProperties(uri, fileOptions, builder, opContext);
addProperties(request, properties);
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, OperationContext context) throws Exception { return FileRequest.deleteFile(file.getTransformedAddress(context).getUri(this.getCurrentLocation()), options, context, accessCondition); }
@Override public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory directory, OperationContext context) throws Exception { return FileRequest.deleteDirectory(directory.getTransformedAddress().getUri(this.getCurrentLocation()), options, context, accessCondition); }