Java Code Examples for com.microsoft.azure.storage.core.Utility#assertNotNull()

The following examples show how to use com.microsoft.azure.storage.core.Utility#assertNotNull() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableBatchOperation.java    From azure-storage-android with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the table operation at the specified index in the batch operation <code>ArrayList</code>.
 * 
 * @param index
 *            An <code>int</code> which represents the index in the batch operation <code>ArrayList</code> to add
 *            the table operation at.
 * @param element
 *            The {@link TableOperation} to add to the batch operation.
 */
@Override
public void add(final int index, final TableOperation element) {
    Utility.assertNotNull("element", element);

    this.checkSingleQueryPerBatch(element, this.size());

    if (element.getOperationType() == TableOperationType.RETRIEVE) {
        this.lockToPartitionKey(((QueryTableOperation) element).getPartitionKey());
    }
    else {
        this.lockToPartitionKey(element.getEntity().getPartitionKey());
    }

    super.add(index, element);
}
 
Example 2
Source File: LogRecord.java    From azure-storage-android with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes a new instance of the LogRecord class using a LogRecordStreamReader to populate.
 * 
 * @param reader
 *            the LogRecordStreamReader to use to populate the LogRecord.
 * @throws IOException
 * @throws ParseException
 * @throws URISyntaxException
 */
protected LogRecord(LogRecordStreamReader reader) throws IOException, ParseException, URISyntaxException {
    LAST_MODIFIED_TIME_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
    REQUEST_START_TIME_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
    
	Utility.assertNotNull("reader", reader);
    this.versionNumber = reader.readString();
    Utility.assertNotNullOrEmpty("versionNumber", this.versionNumber);

    if (this.versionNumber.equals("1.0")) {
        this.populateVersion1Log(reader);
    }
    else {
        throw new IllegalArgumentException(String.format(SR.LOG_VERSION_UNSUPPORTED, this.versionNumber));
    }
}
 
Example 3
Source File: CloudFile.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies the passed in URI. Then parses it and uses its components to populate this resource's properties.
 * 
 * @param completeUri
 *            A {@link StorageUri} object which represents the complete URI.
 * @param credentials
 *            A {@link StorageCredentials} object used to authenticate access.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws URISyntaxException 
 */
private void parseQueryAndVerify(final StorageUri completeUri, final StorageCredentials credentials)
        throws StorageException, URISyntaxException {
   Utility.assertNotNull("completeUri", completeUri);

    if (!completeUri.isAbsolute()) {
        throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, completeUri.toString()));
    }

    this.storageUri = PathUtility.stripURIQueryAndFragment(completeUri);
    
    final StorageCredentialsSharedAccessSignature parsedCredentials = 
            SharedAccessSignatureHelper.parseQuery(completeUri);

    if (credentials != null && parsedCredentials != null) {
        throw new IllegalArgumentException(SR.MULTIPLE_CREDENTIALS_PROVIDED);
    }

    try {
        final boolean usePathStyleUris = Utility.determinePathStyleFromUri(this.storageUri.getPrimaryUri());
        this.fileServiceClient = new CloudFileClient(PathUtility.getServiceClientBaseAddress(
                this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials);
        this.name = PathUtility.getFileNameFromURI(this.storageUri.getPrimaryUri(), usePathStyleUris);
    }
    catch (final URISyntaxException e) {
        throw Utility.generateNewUnexpectedStorageException(e);
    }

    final HashMap<String, String[]> queryParameters = PathUtility.parseQueryString(completeUri.getQuery());

    final String[] snapshotIDs = queryParameters.get(Constants.QueryConstants.SHARE_SNAPSHOT);
    if (snapshotIDs != null && snapshotIDs.length > 0) {
        this.getShare().snapshotID = snapshotIDs[0];
    }
}
 
Example 4
Source File: IPRange.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an IP Range using the specified single IP address. The IP address must be IPv4.
 * 
 * @param ip
 *            the single IP address
 */
public IPRange(String ip) {
    Utility.assertNotNull("ip", ip);
    IPRange.validateIPAddress(ip);
    
    this.ipMin = ip;
    this.ipMax = ip;
}
 
Example 5
Source File: CloudFileDirectory.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies the passed in URI. Then parses it and uses its components to populate this resource's properties.
 * 
 * @param completeUri
 *            A {@link StorageUri} object which represents the complete URI.
 * @param credentials
 *            A {@link StorageCredentials} object used to authenticate access.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws URISyntaxException 
 */
private void parseQueryAndVerify(final StorageUri completeUri, final StorageCredentials credentials)
        throws StorageException, URISyntaxException {
   Utility.assertNotNull("completeUri", completeUri);

    if (!completeUri.isAbsolute()) {
        throw new IllegalArgumentException(String.format(SR.RELATIVE_ADDRESS_NOT_PERMITTED, completeUri.toString()));
    }

    this.storageUri = PathUtility.stripURIQueryAndFragment(completeUri);
    
    final StorageCredentialsSharedAccessSignature parsedCredentials = 
            SharedAccessSignatureHelper.parseQuery(completeUri);

    if (credentials != null && parsedCredentials != null) {
        throw new IllegalArgumentException(SR.MULTIPLE_CREDENTIALS_PROVIDED);
    }

    try {
        final boolean usePathStyleUris = Utility.determinePathStyleFromUri(this.storageUri.getPrimaryUri());
        this.fileServiceClient = new CloudFileClient(PathUtility.getServiceClientBaseAddress(
                this.getStorageUri(), usePathStyleUris), credentials != null ? credentials : parsedCredentials);
        this.name = PathUtility.getDirectoryNameFromURI(this.storageUri.getPrimaryUri(), usePathStyleUris);
    }
    catch (final URISyntaxException e) {
        throw Utility.generateNewUnexpectedStorageException(e);
    }

    final HashMap<String, String[]> queryParameters = PathUtility.parseQueryString(completeUri.getQuery());

    final String[] snapshotIDs = queryParameters.get(Constants.QueryConstants.SHARE_SNAPSHOT);
    if (snapshotIDs != null && snapshotIDs.length > 0) {
        this.getShare().snapshotID = snapshotIDs[0];
    }
}
 
Example 6
Source File: ServicePropertiesSerializer.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Writes the given metrics properties to the XMLStreamWriter.
 * 
 * @param xmlw
 *            the XMLStreamWriter to write to.
 * @param metrics
 *            the metrics properties to be written.
 * @param metricsName
 *            the type of metrics properties to be written (Hour or Minute)
 * @throws IOException
 *             if there is an error writing the service properties.
 * @throws IllegalStateException
 *             if there is an error writing the service properties.
 * @throws IllegalArgumentException
 *             if there is an error writing the service properties.
 */
private static void writeMetricsProperties(final XmlSerializer xmlw, final MetricsProperties metrics,
        final String metricsName) throws IllegalArgumentException, IllegalStateException, IOException {
    Utility.assertNotNull("metrics.Configuration", metrics.getMetricsLevel());

    // Metrics
    xmlw.startTag(Constants.EMPTY_STRING, metricsName);

    // Version
    Utility.serializeElement(xmlw, Constants.AnalyticsConstants.VERSION_ELEMENT, metrics.getVersion());

    // Enabled
    Utility.serializeElement(xmlw, Constants.AnalyticsConstants.ENABLED_ELEMENT,
            metrics.getMetricsLevel() != MetricsLevel.DISABLED ? Constants.TRUE : Constants.FALSE);

    if (metrics.getMetricsLevel() != MetricsLevel.DISABLED) {
        // Include APIs
        Utility.serializeElement(xmlw, Constants.AnalyticsConstants.INCLUDE_APIS_ELEMENT,
                metrics.getMetricsLevel() == MetricsLevel.SERVICE_AND_API ? Constants.TRUE : Constants.FALSE);
    }

    // Retention Policy
    writeRetentionPolicy(xmlw, metrics.getRetentionIntervalInDays());

    // end Metrics
    xmlw.endTag(Constants.EMPTY_STRING, metricsName);
}
 
Example 7
Source File: BlobRequestOptions.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Applies defaults to the options passed in.
 * 
 * @param modifiedOptions
 *          The options to apply defaults to.
 */
protected static void applyDefaults(final BlobRequestOptions modifiedOptions, final BlobType blobtype) {
    Utility.assertNotNull("modifiedOptions", modifiedOptions);
    RequestOptions.applyBaseDefaultsInternal(modifiedOptions);
    
    if (modifiedOptions.getAbsorbConditionalErrorsOnRetry() == null) {
        modifiedOptions.setAbsorbConditionalErrorsOnRetry(false);
    }
    
    if (blobtype == BlobType.APPEND_BLOB) {
        // Append blobs must be done in serial.
        modifiedOptions.setConcurrentRequestCount(1);
    } else if (modifiedOptions.getConcurrentRequestCount() == null) {
        modifiedOptions.setConcurrentRequestCount(BlobConstants.DEFAULT_CONCURRENT_REQUEST_COUNT);
    } 

    if (modifiedOptions.getSingleBlobPutThresholdInBytes() == null) {
        modifiedOptions.setSingleBlobPutThresholdInBytes(BlobConstants.DEFAULT_SINGLE_BLOB_PUT_THRESHOLD_IN_BYTES);
    }

    if (modifiedOptions.getUseTransactionalContentMD5() == null) {
        modifiedOptions.setUseTransactionalContentMD5(false);
    }

    if (modifiedOptions.getStoreBlobContentMD5() == null) {
        if (blobtype != BlobType.UNSPECIFIED) {
            modifiedOptions.setStoreBlobContentMD5(blobtype == BlobType.BLOCK_BLOB);   
        }
    }

    if (modifiedOptions.getDisableContentMD5Validation() == null) {
        modifiedOptions.setDisableContentMD5Validation(false);
    }
}
 
Example 8
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an enumerable collection of log blobs, retrieved lazily.
 * 
 * @param service
 *            A {@link StorageService} enumeration value that indicates which storage service to use.
 * @param startTime
 *            A <code>java.util.Date</code> object representing the start of the time range for which logs should
 *            be retrieved.
 * @param endTime
 *            A <code>java.util.Date</code> object representing the end of the time range for which logs should
 *            be retrieved.
 * @param operations
 *            A {@link LoggingOperations} enumeration set that indicates which log types to return.
 * @param details
 *            A {@link BlobListingDetails} enumeration set that indicates whether or not blob metadata should
 *            be returned. None or METADATA are the only valid values.
 * @param options
 *            A {@link BlobRequestOptions} object that specifies additional options for the request.
 * @param operationContext
 *            An {@link OperationContext} object that represents the context for the current operation.
 * @return
 *         An enumerable collection of objects that implement {@link ListBlobItem} and are retrieved lazily.
 * @throws StorageException
 * @throws URISyntaxException
 */
public Iterable<ListBlobItem> listLogBlobs(StorageService service, Date startTime, Date endTime,
        EnumSet<LoggingOperations> operations, BlobListingDetails details, BlobRequestOptions options,
        OperationContext operationContext) throws StorageException, URISyntaxException {
    Utility.assertNotNull("service", service);
    if (operations == null) {
        operations = EnumSet.allOf(LoggingOperations.class);
    }

    if (!(details == null || details.equals(BlobListingDetails.METADATA))) {
        throw new IllegalArgumentException(SR.INVALID_LISTING_DETAILS);
    }

    if (operations.equals(EnumSet.noneOf(LoggingOperations.class))) {
        throw new IllegalArgumentException(SR.INVALID_LOGGING_LEVEL);
    }

    EnumSet<BlobListingDetails> metadataDetails;
    if (details != null
            && (details.equals(BlobListingDetails.METADATA) || !operations.equals(EnumSet
                    .allOf(LoggingOperations.class)))) {
        metadataDetails = EnumSet.of(BlobListingDetails.METADATA);
    }
    else {
        metadataDetails = EnumSet.noneOf(BlobListingDetails.class);
    }

    return new LogBlobIterable(this.getLogDirectory(service), startTime, endTime, operations, metadataDetails,
            options, operationContext);
}
 
Example 9
Source File: TableRequestOptions.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Applies defaults to the options passed in.
 * 
 * @param modifiedOptions
 *          The options to apply defaults to.
 */
protected static void applyDefaults(final TableRequestOptions modifiedOptions) {
    Utility.assertNotNull("modifiedOptions", modifiedOptions);
    RequestOptions.applyBaseDefaultsInternal(modifiedOptions);
    if (modifiedOptions.getTablePayloadFormat() == null) {
        modifiedOptions.setTablePayloadFormat(TablePayloadFormat.Json);
    }
    
    if (modifiedOptions.getDateBackwardCompatibility() == null) {
        modifiedOptions.setDateBackwardCompatibility(false);
    }
}
 
Example 10
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Returns an enumerable collection of log records, retrieved lazily.
 * 
 * @param service
 *            A {@link StorageService} enumeration value that indicates which storage service to use.
 * @param startTime
 *            A <code>java.util.Date</code> object representing the start of the time range for which logs should
 *            be retrieved.
 * @param endTime
 *            A <code>java.util.Date</code> object representing the end of the time range for which logs should
 *            be retrieved.
 * @param options
 *            A {@link BlobRequestOptions} object that specifies additional options for the request.
 * @param operationContext
 *            An {@link OperationContext} object that represents the context for the current operation.
 * @return
 *         An enumerable collection of objects that implement {@link ListBlobItem} and are retrieved lazily.
 * @throws StorageException
 * @throws URISyntaxException
 */
public Iterable<LogRecord> listLogRecords(StorageService service, Date startTime, Date endTime,
        BlobRequestOptions options, OperationContext operationContext) throws StorageException, URISyntaxException {
    Utility.assertNotNull("service", service);
    EnumSet<LoggingOperations> operations = EnumSet.allOf(LoggingOperations.class);
    EnumSet<BlobListingDetails> metadataDetails = EnumSet.noneOf(BlobListingDetails.class);
    Iterator<ListBlobItem> blobIterator = new LogBlobIterable(this.getLogDirectory(service), startTime, endTime,
            operations, metadataDetails, options, operationContext).iterator();

    return new LogRecordIterable(blobIterator);
}
 
Example 11
Source File: CloudFile.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Requests the service to start copying a file's contents, properties, and metadata to a new file,
 * using the specified access conditions, lease ID, request options, and operation context.
 *
 * @param sourceBlob
 *            A <code>CloudBlob</code> object that represents the source blob to copy.
 * @param sourceAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the source blob.
 * @param destinationAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the destination file.
 * @param options
 *            A {@link BlobRequestOptions} object that specifies any additional options for the request.
 *            Specifying <code>null</code> will use the default request options from the associated
 *            service client ({@link CloudBlobClient}).
 * @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 <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 startCopy(final CloudBlob sourceBlob, final AccessCondition sourceAccessCondition,
        final AccessCondition destinationAccessCondition, FileRequestOptions options, OperationContext opContext)
        throws StorageException, URISyntaxException {
    Utility.assertNotNull("sourceBlob", sourceBlob);

    URI source = sourceBlob.getSnapshotQualifiedUri();
    if (sourceBlob.getServiceClient() != null && sourceBlob.getServiceClient().getCredentials() != null)
    {
        source = sourceBlob.getServiceClient().getCredentials().transformUri(sourceBlob.getSnapshotQualifiedUri());
    }

    return this.startCopy(source, sourceAccessCondition, destinationAccessCondition, options, opContext);
}
 
Example 12
Source File: CloudBlockBlob.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Requests the service to start copying a file's contents, properties, and metadata to a new block blob,
 * using the specified access conditions, lease ID, request options, and operation context.
 *
 * @param sourceFile
 *            A <code>CloudFile</code> object that represents the source file to copy.
 * @param sourceAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the source file.
 * @param destinationAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the destination block blob.
 * @param options
 *            A {@link BlobRequestOptions} object that specifies any additional options for the request.
 *            Specifying <code>null</code> will use the default request options from the associated
 *            service client ({@link CloudBlobClient}).
 * @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 <code>String</code> which represents the copy ID associated with the copy operation.
 *
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws URISyntaxException
 *             If the resource URI is invalid.
 */
@DoesServiceRequest
public final String startCopy(final CloudFile sourceFile, final AccessCondition sourceAccessCondition,
        final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)
        throws StorageException, URISyntaxException {
    Utility.assertNotNull("sourceFile", sourceFile);
    return this.startCopy(
            sourceFile.getServiceClient().getCredentials().transformUri(sourceFile.getUri()),
            sourceAccessCondition, destinationAccessCondition, options, opContext);
}
 
Example 13
Source File: CloudAppendBlob.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Requests the service to start copying a append blob's contents, properties, and metadata to a new append blob,
 * using the specified access conditions, lease ID, request options, and operation context.
 *
 * @param sourceBlob
 *            A <code>CloudAppendBlob</code> object that represents the source blob to copy.
 * @param sourceAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the source blob.
 * @param destinationAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the destination blob.
 * @param options
 *            A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
 *            <code>null</code> will use the default request options from the associated service client (
 *            {@link CloudBlobClient}).
 * @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 <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 startCopy(final CloudAppendBlob sourceBlob, final AccessCondition sourceAccessCondition,
        final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)
        throws StorageException, URISyntaxException {
    Utility.assertNotNull("sourceBlob", sourceBlob);

    URI source = sourceBlob.getSnapshotQualifiedUri();
    if (sourceBlob.getServiceClient() != null && sourceBlob.getServiceClient().getCredentials() != null)
    {
        source = sourceBlob.getServiceClient().getCredentials().transformUri(sourceBlob.getSnapshotQualifiedUri());
    }

    return this.startCopy(source, sourceAccessCondition, destinationAccessCondition, options, opContext);
}
 
Example 14
Source File: CloudBlob.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Creates an instance of the <code>CloudBlob</code> class using the specified type, name, snapshot ID, and
 * container.
 *
 * @param type
 *            A {@link BlobType} value which represents the type of the blob.
 * @param blobName
 *            Name of the blob.
 * @param snapshotID
 *            A <code>String</code> that represents the snapshot version, if applicable.
 * @param container
 *            The reference to the parent container.
 * @throws URISyntaxException
 *             If the resource URI is invalid.
 */
protected CloudBlob(final BlobType type, String blobName, String snapshotID, CloudBlobContainer container)
        throws URISyntaxException {
    Utility.assertNotNullOrEmpty("blobName", blobName);
    Utility.assertNotNull("container", container);

    this.storageUri = PathUtility.appendPathToUri(container.getStorageUri(), blobName);
    this.name = blobName;
    this.blobServiceClient = container.getServiceClient();
    this.container = container;
    this.snapshotID = snapshotID;
    this.properties = new BlobProperties(type);
}
 
Example 15
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Initializes a new instance of the <code>CloudAnalyticsClient</code> class using the specified blob and table
 * service endpoints and account credentials.
 * 
 * @param blobStorageUri
 *            A {@link StorageUri} object containing the Blob service endpoint to use to create the client.
 * @param tableStorageUri
 *            A {@link StorageUri} object containing the Table service endpoint to use to create the client.
 * @param credentials
 *            A {@link StorageCredentials} object.
 */
public CloudAnalyticsClient(StorageUri blobStorageUri, StorageUri tableStorageUri, StorageCredentials credentials) {
    Utility.assertNotNull("blobStorageUri", blobStorageUri);
    Utility.assertNotNull("tableStorageUri", tableStorageUri);

    this.blobClient = new CloudBlobClient(blobStorageUri, credentials);
    this.tableClient = new CloudTableClient(tableStorageUri, credentials);
}
 
Example 16
Source File: CloudPageBlob.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Requests the service to start copying a blob's contents, properties, and metadata to a new blob, using the
 * specified blob tier, access conditions, lease ID, request options, and operation context.
 *
 * @param sourceBlob
 *            A <code>CloudPageBlob</code> object that represents the source blob to copy.
 * @param premiumBlobTier
 *            A {@link PremiumPageBlobTier} object which represents the tier of the blob.
 * @param sourceAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the source blob.
 * @param destinationAccessCondition
 *            An {@link AccessCondition} object that represents the access conditions for the destination blob.
 * @param options
 *            A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying
 *            <code>null</code> will use the default request options from the associated service client (
 *            {@link CloudBlobClient}).
 * @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 <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 startCopy(final CloudPageBlob sourceBlob, final PremiumPageBlobTier premiumBlobTier, final AccessCondition sourceAccessCondition,
        final AccessCondition destinationAccessCondition, BlobRequestOptions options, OperationContext opContext)
        throws StorageException, URISyntaxException {
    Utility.assertNotNull("sourceBlob", sourceBlob);

    URI source = sourceBlob.getSnapshotQualifiedUri();
    if (sourceBlob.getServiceClient() != null && sourceBlob.getServiceClient().getCredentials() != null)
    {
        source = sourceBlob.getServiceClient().getCredentials().transformUri(sourceBlob.getSnapshotQualifiedUri());
    }

    return this.startCopy(source, premiumBlobTier, sourceAccessCondition, destinationAccessCondition, options, opContext);
}
 
Example 17
Source File: QueueRequestOptions.java    From azure-storage-android with Apache License 2.0 2 votes vote down vote up
/**
 * Applies defaults to the options passed in.
 * 
 * @param modifiedOptions
 *          The options to apply defaults to.
 */
protected static void applyDefaults(QueueRequestOptions modifiedOptions) {
    Utility.assertNotNull("modifiedOptions", modifiedOptions);
    RequestOptions.applyBaseDefaultsInternal(modifiedOptions);
}
 
Example 18
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 2 votes vote down vote up
/**
 * Returns an enumerable collection of log records, retrieved lazily.
 * 
 * @param logBlobs
 *            An {@link Iterable} of blobs to parse LogRecords from.
 * @return
 *         An enumerable collection of objects that implement {@link LogRecords} and are retrieved lazily.
 * @throws StorageException
 * @throws URISyntaxException
 */
public static Iterable<LogRecord> parseLogBlobs(Iterable<ListBlobItem> logBlobs) {
    Utility.assertNotNull("logBlobs", logBlobs);

    return new LogRecordIterable(logBlobs.iterator());
}
 
Example 19
Source File: TableOperation.java    From azure-storage-android with Apache License 2.0 2 votes vote down vote up
/**
 * A static factory method returning a {@link TableOperation} instance to replace the specified entity in
 * Microsoft Azure storage, or insert it if it does not exist. To execute this {@link TableOperation} on a given
 * table, call
 * the {@link CloudTable#execute(TableOperation)} method on a {@link CloudTableClient} instance with
 * the table name and the {@link TableOperation} as arguments.
 * 
 * @param entity
 *            The object instance implementing {@link TableEntity} to associate with the operation.
 * @return
 *         A new {@link TableOperation} instance for inserting or replacing the table entity.
 */
public static TableOperation insertOrReplace(final TableEntity entity) {
    Utility.assertNotNull("entity", entity);
    return new TableOperation(entity, TableOperationType.INSERT_OR_REPLACE);
}
 
Example 20
Source File: TableOperation.java    From azure-storage-android with Apache License 2.0 2 votes vote down vote up
/**
 * A static factory method returning a {@link TableOperation} instance to merge the specified table entity into
 * Microsoft Azure storage. To execute this {@link TableOperation} on a given table, call the
 * {@link CloudTable#execute(TableOperation)} method on a {@link CloudTableClient} instance with the
 * 
 * @param entity
 *            The object instance implementing {@link TableEntity} to associate with the operation.
 * @return
 *         A new {@link TableOperation} instance for merging the table entity.
 */
public static TableOperation merge(final TableEntity entity) {
    Utility.assertNotNull("entity", entity);
    Utility.assertNotNullOrEmpty("entity etag", entity.getEtag());
    return new TableOperation(entity, TableOperationType.MERGE);
}