List of usage examples for org.apache.hadoop.fs.azure AzureNativeFileSystemStore getAccountKeyFromConfiguration
@VisibleForTesting public static String getAccountKeyFromConfiguration(String accountName, Configuration conf) throws KeyProviderException
From source file:com.thinkbiganalytics.kylo.catalog.azure.AzureNativeFileSystemProvider.java
License:Apache License
@Nullable private StorageCredentials getCredentials(@Nonnull final URI uri, @Nonnull final Configuration conf) { // Find account name final String accountName = uri.getHost(); if (StringUtils.isEmpty(accountName)) { throw new CatalogException("catalog.fs.azure.missingAccountName"); }// www. ja va 2s.c om // Find account key final String accountKey; try { accountKey = AzureNativeFileSystemStore.getAccountKeyFromConfiguration(accountName, conf); } catch (final KeyProviderException e) { throw new CatalogException("catalog.fs.azure.invalidAccountKey"); } // Create credentials if (StringUtils.isNotEmpty(accountKey)) { final String rawAccountName = accountName.split("\\.")[0]; return new StorageCredentialsAccountAndKey(rawAccountName, accountKey); } else { return null; } }