Search in sources :

Example 6 with StorageCredentialsAccountAndKey

use of com.microsoft.azure.storage.StorageCredentialsAccountAndKey in project hadoop by apache.

the class LocalSASKeyGeneratorImpl method getStorageAccountInstance.

/**
   * Helper method that creates CloudStorageAccount Instance using the
   * storage account key.
   * @param accountName Name of the storage account
   * @param accountKey Storage Account key
   * @return CloudStorageAccount instance for the storage account.
   * @throws SASKeyGenerationException
   */
private CloudStorageAccount getStorageAccountInstance(String accountName, String accountKey) throws SASKeyGenerationException {
    if (!storageAccountMap.containsKey(accountName)) {
        CloudStorageAccount account = null;
        try {
            account = new CloudStorageAccount(new StorageCredentialsAccountAndKey(accountName, accountKey));
        } catch (URISyntaxException uriSyntaxEx) {
            throw new SASKeyGenerationException("Encountered URISyntaxException " + "for account " + accountName, uriSyntaxEx);
        }
        storageAccountMap.put(accountName, account);
    }
    return storageAccountMap.get(accountName);
}
Also used : CloudStorageAccount(com.microsoft.azure.storage.CloudStorageAccount) URISyntaxException(java.net.URISyntaxException) StorageCredentialsAccountAndKey(com.microsoft.azure.storage.StorageCredentialsAccountAndKey)

Aggregations

StorageCredentialsAccountAndKey (com.microsoft.azure.storage.StorageCredentialsAccountAndKey)6 JndiRegistry (org.apache.camel.impl.JndiRegistry)3 CloudStorageAccount (com.microsoft.azure.storage.CloudStorageAccount)2 StorageCredentials (com.microsoft.azure.storage.StorageCredentials)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1