/** * Adds the snapshot. * * @param builder * a query builder. * @param snapshotVersion * the snapshot version to the query builder. * @throws StorageException */ private static void addSnapshot(final UriQueryBuilder builder, final String snapshotVersion) throws StorageException { if (snapshotVersion != null) { builder.add(Constants.QueryConstants.SNAPSHOT, snapshotVersion); } }
/** * Requests the service to start an incremental copy of another page blob's contents, properties, and metadata * to this blob. * * @param sourceSnapshot * A <code>CloudPageBlob</code> object that represents the source blob to copy. Must be a snapshot. * * @return A <code>String</code> which represents the copy ID associated with the copy operation. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException */ @DoesServiceRequest public final String startIncrementalCopy(final CloudPageBlob sourceSnapshot) throws StorageException, URISyntaxException { final UriQueryBuilder builder = new UriQueryBuilder(); builder.add(Constants.QueryConstants.SNAPSHOT, sourceSnapshot.snapshotID); URI sourceUri = builder.addToURI(sourceSnapshot.getTransformedAddress(null).getPrimaryUri()); return this.startIncrementalCopy(sourceUri, null /* destinationAccessCondition */, null /* options */, null /* opContext */); }
/** * Adds the share snapshot if present. * Only for listing files and directories which requires a different query param. * * @param builder * a query builder. * @param snapshotVersion * the share snapshot version to the query builder. * @throws StorageException */ public static void addShareSnapshot(final UriQueryBuilder builder, final String snapshotVersion) throws StorageException { if (snapshotVersion != null) { builder.add(Constants.QueryConstants.SHARE_SNAPSHOT, snapshotVersion); } }
/** * Requests the service to start an incremental copy of another page blob's contents, properties, and metadata * to this blob. * * @param sourceSnapshot * A <code>CloudPageBlob</code> object that represents the source blob to copy. Must be a snapshot. * * @return A <code>String</code> which represents the copy ID associated with the copy operation. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException */ @DoesServiceRequest public final String startIncrementalCopy(final CloudPageBlob sourceSnapshot) throws StorageException, URISyntaxException { final UriQueryBuilder builder = new UriQueryBuilder(); builder.add(Constants.QueryConstants.SNAPSHOT, sourceSnapshot.snapshotID); URI sourceUri = builder.addToURI(sourceSnapshot.getTransformedAddress(null).getPrimaryUri()); return this.startIncrementalCopy(sourceUri, null /* destinationAccessCondition */, null /* options */, null /* opContext */); }
/** * Adds the snapshot. * * @param builder * a query builder. * @param snapshotVersion * the snapshot version to the query builder. * @throws StorageException */ private static void addSnapshot(final UriQueryBuilder builder, final String snapshotVersion) throws StorageException { if (snapshotVersion != null) { builder.add(Constants.QueryConstants.SNAPSHOT, snapshotVersion); } }
/** * Adds the share snapshot if present. * Only for listing files and directories which requires a different query param. * * @param builder * a query builder. * @param snapshotVersion * the share snapshot version to the query builder. * @throws StorageException */ public static void addShareSnapshot(final UriQueryBuilder builder, final String snapshotVersion) throws StorageException { if (snapshotVersion != null) { builder.add(Constants.QueryConstants.SHARE_SNAPSHOT, snapshotVersion); } }
public static HttpURLConnection getAccountInfo(final URI uri, final RequestOptions options, UriQueryBuilder builder, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { if (builder == null) { builder = new UriQueryBuilder(); } builder.add(Constants.QueryConstants.RESOURCETYPE, ACCOUNT); builder.add(Constants.QueryConstants.COMPONENT, PROPERTIES); final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext); retConnection.setRequestMethod("HEAD"); return retConnection; }
/** * Helper to add a name/value pair to a <code>UriQueryBuilder</code> if the value is not null or empty. * * @param builder * The builder to add to. * @param name * The name to add. * @param val * The value to add if not null or empty. * * @throws StorageException * An exception representing any error which occurred during the operation. */ private static void addIfNotNullOrEmpty(UriQueryBuilder builder, String name, String val) throws StorageException { if (!Utility.isNullOrEmpty(val)) { builder.add(name, val); } }
/** * Helper to add a name/value pair to a <code>UriQueryBuilder</code> if the value is not null or empty. * * @param builder * The builder to add to. * @param name * The name to add. * @param val * The value to add if not null or empty. * * @throws StorageException * An exception representing any error which occurred during the operation. */ private static void addIfNotNullOrEmpty(UriQueryBuilder builder, String name, String val) throws StorageException { if (!Utility.isNullOrEmpty(val)) { builder.add(name, val); } }
/** * Creates a web request to get the stats of the service. * * @param uri * The service endpoint. * @param builder * The builder. * @param opContext * an object used to track the execution of the operation * @return a web request for performing the operation. * @throws IOException * @throws URISyntaxException * @throws StorageException */ public static HttpURLConnection getServiceStats(final URI uri, final RequestOptions options, UriQueryBuilder builder, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { if (builder == null) { builder = new UriQueryBuilder(); } builder.add(Constants.QueryConstants.COMPONENT, STATS); builder.add(Constants.QueryConstants.RESOURCETYPE, SERVICE); final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext); retConnection.setRequestMethod("GET"); return retConnection; }
/** * Sets the metadata. Sign with 0 length. * * @param uri * The blob Uri. * @param builder * The builder. * @param opContext * an object used to track the execution of the operation * @return a web request for performing the operation. * @throws StorageException * @throws URISyntaxException * @throws IOException * */ public static HttpURLConnection setMetadata(final URI uri, final RequestOptions options, UriQueryBuilder builder, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { if (builder == null) { builder = new UriQueryBuilder(); } builder.add(Constants.QueryConstants.COMPONENT, METADATA); final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext); retConnection.setFixedLengthStreamingMode(0); retConnection.setDoOutput(true); retConnection.setRequestMethod(Constants.HTTP_PUT); return retConnection; }
/** * Sets the ACL for the queue. Sign with length of aclBytes. * * @param uri * The absolute URI to the queue. * @param queueOptions * A {@link QueueRequestOptions} 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 CloudQueueClient}. * @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 HttpURLConnection configured for the operation. * @throws StorageException * */ public static HttpURLConnection setAcl(final URI uri, final QueueRequestOptions queueOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { final UriQueryBuilder builder = new UriQueryBuilder(); builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.ACL); final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext); request.setDoOutput(true); request.setRequestMethod(Constants.HTTP_PUT); return request; }
/** * Gets the container Uri query builder. * * A <CODE>UriQueryBuilder</CODE> for the container. * * @throws StorageException */ private static UriQueryBuilder getContainerUriQueryBuilder() throws StorageException { final UriQueryBuilder uriBuilder = new UriQueryBuilder(); try { uriBuilder.add(Constants.QueryConstants.RESOURCETYPE, "container"); } catch (final IllegalArgumentException e) { throw Utility.generateNewUnexpectedStorageException(e); } return uriBuilder; }
/** * Gets the share Uri query builder. * * A <CODE>UriQueryBuilder</CODE> for the share. * * @throws StorageException */ private static UriQueryBuilder getShareUriQueryBuilder() throws StorageException { final UriQueryBuilder uriBuilder = new UriQueryBuilder(); try { uriBuilder.add(Constants.QueryConstants.RESOURCETYPE, "share"); } catch (final IllegalArgumentException e) { throw Utility.generateNewUnexpectedStorageException(e); } return uriBuilder; }
/** * Constructs a web request to return the ACL for this queue. Sign with no length specified. * * @param uri * The absolute URI to the container. * @param queueOptions * A {@link QueueRequestOptions} 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 CloudQueueClient}. * @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 HttpURLConnection configured for the operation. * @throws StorageException */ public static HttpURLConnection getAcl(final URI uri, final QueueRequestOptions queueOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { final UriQueryBuilder builder = new UriQueryBuilder(); builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.ACL); final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext); request.setRequestMethod(Constants.HTTP_GET); return request; }
/** * Gets the share Uri query builder. * * A <CODE>UriQueryBuilder</CODE> for the share. * * @throws StorageException */ private static UriQueryBuilder getDirectoryUriQueryBuilder() throws StorageException { final UriQueryBuilder uriBuilder = new UriQueryBuilder(); try { uriBuilder.add(Constants.QueryConstants.RESOURCETYPE, "directory"); } catch (final IllegalArgumentException e) { throw Utility.generateNewUnexpectedStorageException(e); } return uriBuilder; }
/** * Gets the share Uri query builder. * * A <CODE>UriQueryBuilder</CODE> for the share. * * @throws StorageException */ private static UriQueryBuilder getDirectoryUriQueryBuilder() throws StorageException { final UriQueryBuilder uriBuilder = new UriQueryBuilder(); try { uriBuilder.add(Constants.QueryConstants.RESOURCETYPE, "directory"); } catch (final IllegalArgumentException e) { throw Utility.generateNewUnexpectedStorageException(e); } return uriBuilder; }
/** * Gets the container Uri query builder. * * A <CODE>UriQueryBuilder</CODE> for the container. * * @throws StorageException */ private static UriQueryBuilder getContainerUriQueryBuilder() throws StorageException { final UriQueryBuilder uriBuilder = new UriQueryBuilder(); try { uriBuilder.add(Constants.QueryConstants.RESOURCETYPE, "container"); } catch (final IllegalArgumentException e) { throw Utility.generateNewUnexpectedStorageException(e); } return uriBuilder; }
/** * Gets the share Uri query builder. * * A <CODE>UriQueryBuilder</CODE> for the share. * * @throws StorageException */ private static UriQueryBuilder getShareUriQueryBuilder() throws StorageException { final UriQueryBuilder uriBuilder = new UriQueryBuilder(); try { uriBuilder.add(Constants.QueryConstants.RESOURCETYPE, "share"); } catch (final IllegalArgumentException e) { throw Utility.generateNewUnexpectedStorageException(e); } return uriBuilder; }
/** * Constructs a web request to return the ACL for this queue. Sign with no length specified. * * @param uri * The absolute URI to the container. * @param queueOptions * A {@link QueueRequestOptions} 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 CloudQueueClient}. * @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 HttpURLConnection configured for the operation. * @throws StorageException */ public static HttpURLConnection getAcl(final URI uri, final QueueRequestOptions queueOptions, final OperationContext opContext) throws IOException, URISyntaxException, StorageException { final UriQueryBuilder builder = new UriQueryBuilder(); builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.ACL); final HttpURLConnection request = BaseRequest.createURLConnection(uri, queueOptions, builder, opContext); request.setRequestMethod(Constants.HTTP_GET); return request; }