当前位置: 首页>>代码示例>>Java>>正文


Java ServiceClient类代码示例

本文整理汇总了Java中com.microsoft.azure.storage.ServiceClient的典型用法代码示例。如果您正苦于以下问题:Java ServiceClient类的具体用法?Java ServiceClient怎么用?Java ServiceClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServiceClient类属于com.microsoft.azure.storage包,在下文中一共展示了ServiceClient类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: signBlobQueueAndFileRequest

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signBlobQueueAndFileRequest(HttpURLConnection request, ServiceClient client,
        long contentLength, OperationContext context) throws InvalidKeyException, StorageException {
    if (client.getAuthenticationScheme() == AuthenticationScheme.SHAREDKEYFULL) {
        StorageCredentialsHelper.signBlobAndQueueRequest(client.getCredentials(), request, contentLength, context);
    }
    else {
        StorageCredentialsHelper.signBlobAndQueueRequestLite(client.getCredentials(), request, contentLength,
                context);
    }
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:11,代码来源:StorageRequest.java

示例2: signTableRequest

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signTableRequest(HttpURLConnection request, ServiceClient client, long contentLength,
        OperationContext context) throws InvalidKeyException, StorageException {
    if (client.getAuthenticationScheme() == AuthenticationScheme.SHAREDKEYFULL) {
        StorageCredentialsHelper.signTableRequest(client.getCredentials(), request, contentLength, context);
    }
    else {
        StorageCredentialsHelper.signTableRequestLite(client.getCredentials(), request, contentLength, context);
    }
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:10,代码来源:StorageRequest.java

示例3: generateSharedAccessSignatureHashForQueueAndTable

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
 * Get the signature hash embedded inside the Shared Access Signature for queue and table service.
 * 
 * @param permissions
 *            The permissions for a shared access signature.
 * @param startTime
 *            The start time for a shared access signature.
 * @param expiryTime
 *            The expiry time for a shared access signature.
 * @param resourceName
 *            The canonical resource string, unescaped.
 * @param accessPolicyIdentifier
 *            An optional identifier for the policy.
 * @param client
 *            Reference to the ServiceClient.
 * @param opContext
 *            An object used to track the execution of the operation.
 * @return
 *         the signature hash embedded inside the Shared Access Signature.
 * @throws InvalidKeyException
 * @throws StorageException
 */
private static String generateSharedAccessSignatureHashForQueueAndTable(final SharedAccessPolicy policy,
        final String resourceName, final String accessPolicyIdentifier, final boolean useTableSas,
        final String startPartitionKey, final String startRowKey, final String endPartitionKey,
        final String endRowKey, final ServiceClient client, final OperationContext opContext)
        throws InvalidKeyException, StorageException {
    Utility.assertNotNullOrEmpty("resourceName", resourceName);
    Utility.assertNotNull("client", client);

    String permissions = null;
    Date startTime = null;
    Date expiryTime = null;

    if (policy != null) {
        permissions = policy.permissionsToString();
        startTime = policy.getSharedAccessStartTime();
        expiryTime = policy.getSharedAccessExpiryTime();
    }

    String stringToSign = String.format("%s\n%s\n%s\n%s\n%s\n%s", permissions == null ? Constants.EMPTY_STRING
            : permissions, Utility.getUTCTimeOrEmpty(startTime), Utility.getUTCTimeOrEmpty(expiryTime),
            resourceName, accessPolicyIdentifier == null ? Constants.EMPTY_STRING : accessPolicyIdentifier,
            Constants.HeaderConstants.TARGET_STORAGE_VERSION);

    if (useTableSas) {
        stringToSign = String.format("%s\n%s\n%s\n%s\n%s", stringToSign,
                startPartitionKey == null ? Constants.EMPTY_STRING : startPartitionKey,
                startRowKey == null ? Constants.EMPTY_STRING : startRowKey,
                endPartitionKey == null ? Constants.EMPTY_STRING : endPartitionKey,
                endRowKey == null ? Constants.EMPTY_STRING : endRowKey);
    }

    stringToSign = Utility.safeDecode(stringToSign);
    final String signature = StorageCredentialsHelper.computeHmac256(client.getCredentials(), stringToSign,
            opContext);

    // add logging
    return signature;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:61,代码来源:SharedAccessSignatureHelper.java

示例4: generateSharedAccessSignatureHashForBlobAndFile

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
 * Get the signature hash embedded inside the Shared Access Signature for the blob or file service.
 * 
 * @param policy
 *            The shared access policy to hash.
 * @param headers
 *            The optional header values to set for a blob or file accessed with this shared access signature.
 * @param accessPolicyIdentifier
 *            An optional identifier for the policy.
 * @param resourceName
 *            The resource name.
 * @param ipRange
 *            The range of IP addresses to hash.
 * @param protocols
 *            The Internet protocols to hash.
 * @param client
 *            The ServiceClient associated with the object.
 *            
 * @return The signature hash embedded inside the Shared Access Signature.
 * @throws InvalidKeyException
 * @throws StorageException
 */
public static String generateSharedAccessSignatureHashForBlobAndFile(final SharedAccessPolicy policy,
        SharedAccessHeaders headers, final String accessPolicyIdentifier, final String resourceName,
        final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client)
        throws InvalidKeyException, StorageException {
    
    String stringToSign = generateSharedAccessSignatureStringToSign(
            policy, resourceName, ipRange, protocols, accessPolicyIdentifier);

    String cacheControl = null;
    String contentDisposition = null;
    String contentEncoding = null;
    String contentLanguage = null;
    String contentType = null;
    if (headers != null) {
        cacheControl = headers.getCacheControl();
        contentDisposition = headers.getContentDisposition();
        contentEncoding = headers.getContentEncoding();
        contentLanguage = headers.getContentLanguage();
        contentType = headers.getContentType();
    }
        
    stringToSign = String.format("%s\n%s\n%s\n%s\n%s\n%s", stringToSign,
            cacheControl == null ? Constants.EMPTY_STRING : cacheControl,
            contentDisposition == null ? Constants.EMPTY_STRING : contentDisposition,
            contentEncoding == null ? Constants.EMPTY_STRING : contentEncoding,
            contentLanguage == null ? Constants.EMPTY_STRING : contentLanguage,
            contentType == null ? Constants.EMPTY_STRING : contentType);
    
    return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:53,代码来源:SharedAccessSignatureHelper.java

示例5: generateSharedAccessSignatureHashForBlob

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
 * Get the signature hash embedded inside the Shared Access Signature for blob service.
 * 
 * @param permissions
 *            The permissions for a shared access signature.
 * @param startTime
 *            The start time for a shared access signature.
 * @param expiryTime
 *            The expiry time for a shared access signature.
 * @param resourceName
 *            The canonical resource string, unescaped.
 * @param accessPolicyIdentifier
 *            An optional identifier for the policy.
 * @param client
 *            Reference to the ServiceClient.
 * @param opContext
 *            An object used to track the execution of the operation.
 * @param headers
 *            The optional header values to set for a blob returned with this SAS.
 * @return
 *         The signature hash embedded inside the Shared Access Signature.
 * @throws InvalidKeyException
 * @throws StorageException
 */
private static String generateSharedAccessSignatureHashForBlob(final SharedAccessPolicy policy,
        final String resourceName, final String accessPolicyIdentifier, final ServiceClient client,
        final OperationContext opContext, final SharedAccessBlobHeaders headers) throws InvalidKeyException,
        StorageException {
    Utility.assertNotNullOrEmpty("resourceName", resourceName);
    Utility.assertNotNull("client", client);

    String permissions = null;
    Date startTime = null;
    Date expiryTime = null;

    if (policy != null) {
        permissions = policy.permissionsToString();
        startTime = policy.getSharedAccessStartTime();
        expiryTime = policy.getSharedAccessExpiryTime();
    }

    String cacheControl = null;
    String contentDisposition = null;
    String contentEncoding = null;
    String contentLanguage = null;
    String contentType = null;

    if (headers != null) {
        cacheControl = headers.getCacheControl();
        contentDisposition = headers.getContentDisposition();
        contentEncoding = headers.getContentEncoding();
        contentLanguage = headers.getContentLanguage();
        contentType = headers.getContentType();
    }

    String stringToSign = String.format("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
            permissions == null ? Constants.EMPTY_STRING : permissions, Utility.getUTCTimeOrEmpty(startTime),
            Utility.getUTCTimeOrEmpty(expiryTime), resourceName,
            accessPolicyIdentifier == null ? Constants.EMPTY_STRING : accessPolicyIdentifier,
            Constants.HeaderConstants.TARGET_STORAGE_VERSION, cacheControl == null ? Constants.EMPTY_STRING
                    : cacheControl, contentDisposition == null ? Constants.EMPTY_STRING : contentDisposition,
            contentEncoding == null ? Constants.EMPTY_STRING : contentEncoding,
            contentLanguage == null ? Constants.EMPTY_STRING : contentLanguage,
            contentType == null ? Constants.EMPTY_STRING : contentType);

    stringToSign = Utility.safeDecode(stringToSign);
    final String signature = StorageCredentialsHelper.computeHmac256(client.getCredentials(), stringToSign,
            opContext);

    // add logging
    return signature;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:73,代码来源:SharedAccessSignatureHelper.java

示例6: signBlobQueueAndFileRequest

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signBlobQueueAndFileRequest(HttpURLConnection request, ServiceClient client,
        long contentLength, OperationContext context) throws InvalidKeyException, StorageException {
    StorageCredentialsHelper.signBlobQueueAndFileRequest(client.getCredentials(), request, contentLength, context);
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:5,代码来源:StorageRequest.java

示例7: signTableRequest

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
public static final void signTableRequest(HttpURLConnection request, ServiceClient client, long contentLength,
        OperationContext context) throws InvalidKeyException, StorageException {
    StorageCredentialsHelper.signTableRequest(client.getCredentials(), request, contentLength, context);
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:5,代码来源:StorageRequest.java

示例8: generateSharedAccessSignatureHashForTable

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
 * Get the signature hash embedded inside the Shared Access Signature for the table service.
 * 
 * @param policy
 *            The shared access policy to hash.
 * @param accessPolicyIdentifier
 *            An optional identifier for the policy.
 * @param resourceName
 *            The resource name.
 * @param ipRange
 *            The range of IP addresses to hash.
 * @param protocols
 *            The Internet protocols to hash.
 * @param startPartitionKey
 *            An optional restriction of the beginning of the range of partition keys to hash.
 * @param startRowKey
 *            An optional restriction of the beginning of the range of row keys to hash.
 * @param endPartitionKey
 *            An optional restriction of the end of the range of partition keys to hash.
 * @param endRowKey
 *            An optional restriction of the end of the range of row keys to hash.
 * @param client
 *            The ServiceClient associated with the object.
 *            
 * @return The signature hash embedded inside the Shared Access Signature.
 * @throws InvalidKeyException
 * @throws StorageException
 */
public static String generateSharedAccessSignatureHashForTable(
        final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String resourceName,
        final IPRange ipRange, final SharedAccessProtocols protocols, final String startPartitionKey,
        final String startRowKey, final String endPartitionKey, final String endRowKey, final ServiceClient client)
        throws InvalidKeyException, StorageException {

    String stringToSign = generateSharedAccessSignatureStringToSign(
            policy, resourceName, ipRange, protocols, accessPolicyIdentifier);
    
    stringToSign = String.format("%s\n%s\n%s\n%s\n%s", stringToSign,
            startPartitionKey == null ? Constants.EMPTY_STRING : startPartitionKey,
            startRowKey == null ? Constants.EMPTY_STRING : startRowKey,
            endPartitionKey == null ? Constants.EMPTY_STRING : endPartitionKey,
            endRowKey == null ? Constants.EMPTY_STRING : endRowKey);
    
    return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:46,代码来源:SharedAccessSignatureHelper.java

示例9: generateSharedAccessSignatureHashForQueue

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
 * Get the signature hash embedded inside the Shared Access Signature for queue service.
 * 
 * @param policy
 *            The shared access policy to hash.
 * @param accessPolicyIdentifier
 *            An optional identifier for the policy.
 * @param resourceName
 *            The resource name.
 * @param client
 *            The ServiceClient associated with the object.
 * @param opContext
 *            An object used to track the execution of the operation
 * @return The signature hash embedded inside the Shared Access Signature.
 * @throws InvalidKeyException
 * @throws StorageException
 */

public static String generateSharedAccessSignatureHashForQueue(final SharedAccessQueuePolicy policy,
        final String accessPolicyIdentifier, final String resourceName, final ServiceClient client,
        final OperationContext opContext) throws InvalidKeyException, StorageException {
    return generateSharedAccessSignatureHashForQueueAndTable(policy, resourceName, accessPolicyIdentifier, false,
            null, null, null, null, client, opContext);
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:25,代码来源:SharedAccessSignatureHelper.java

示例10: generateSharedAccessSignatureHashForTable

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
 * Get the signature hash embedded inside the Shared Access Signature for blob service.
 * 
 * @param policy
 *            The shared access policy to hash.
 * @param accessPolicyIdentifier
 *            An optional identifier for the policy.
 * @param resourceName
 *            The resource name.
 * @param client
 *            The ServiceClient associated with the object.
 * @param opContext
 *            An object used to track the execution of the operation
 * @return The signature hash embedded inside the Shared Access Signature.
 * @throws InvalidKeyException
 * @throws StorageException
 */
public static String generateSharedAccessSignatureHashForTable(final SharedAccessTablePolicy policy,
        final String accessPolicyIdentifier, final String resourceName, final String startPartitionKey,
        final String startRowKey, final String endPartitionKey, final String endRowKey, final ServiceClient client,
        final OperationContext opContext) throws InvalidKeyException, StorageException {
    return generateSharedAccessSignatureHashForQueueAndTable(policy, resourceName, accessPolicyIdentifier, true,
            startPartitionKey, startRowKey, endPartitionKey, endRowKey, client, opContext);

}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:26,代码来源:SharedAccessSignatureHelper.java

示例11: generateSharedAccessSignatureHashForQueue

import com.microsoft.azure.storage.ServiceClient; //导入依赖的package包/类
/**
 * Get the signature hash embedded inside the Shared Access Signature for queue service.
 * 
 * @param policy
 *            The shared access policy to hash.
 * @param accessPolicyIdentifier
 *            An optional identifier for the policy.
 * @param resourceName
 *            The resource name.
 * @param ipRange
 *            The range of IP addresses to hash.
 * @param protocols
 *            The Internet protocols to hash.
 * @param client
 *            The ServiceClient associated with the object.
 *            
 * @return The signature hash embedded inside the Shared Access Signature.
 * @throws InvalidKeyException
 * @throws StorageException
 */

public static String generateSharedAccessSignatureHashForQueue(
        final SharedAccessQueuePolicy policy, final String accessPolicyIdentifier, final String resourceName,
        final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client)
        throws InvalidKeyException, StorageException {
    
    final String stringToSign = generateSharedAccessSignatureStringToSign(
            policy, resourceName, ipRange, protocols, accessPolicyIdentifier);
    
    return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:32,代码来源:SharedAccessSignatureHelper.java


注:本文中的com.microsoft.azure.storage.ServiceClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。