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


Java CloudStorageAccount.parse方法代码示例

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


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

示例1: connectToAzTable

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
/***
 *
 * @param azStorageConnStr
 * @param tableName
 * @param l
   * @return
   */
public CloudTable connectToAzTable(String azStorageConnStr, String tableName) {
	CloudTable cloudTable = null;
	try {
		// Retrieve storage account from connection-string.
		CloudStorageAccount storageAccount = CloudStorageAccount.parse(azStorageConnStr);

		// Create the table client
		CloudTableClient tableClient = storageAccount.createCloudTableClient();

		// Create a cloud table object for the table.
		cloudTable = tableClient.getTableReference(tableName);
		
	} catch (Exception e) 
	{
		logger.warn("Exception in connectToAzTable: "+tableName, e);
	}
	return cloudTable;
}
 
开发者ID:dream-lab,项目名称:echo,代码行数:26,代码来源:InsertAzure.java

示例2: createClient

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
void createClient(AzureStorageSettings azureStorageSettings) {
    try {
        logger.trace("creating new Azure storage client using account [{}], key [{}]",
            azureStorageSettings.getAccount(), azureStorageSettings.getKey());

        String storageConnectionString =
            "DefaultEndpointsProtocol=https;"
                + "AccountName=" + azureStorageSettings.getAccount() + ";"
                + "AccountKey=" + azureStorageSettings.getKey();

        // Retrieve storage account from connection-string.
        CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);

        // Create the blob client.
        CloudBlobClient client = storageAccount.createCloudBlobClient();

        // Register the client
        this.clients.put(azureStorageSettings.getAccount(), client);
    } catch (Exception e) {
        logger.error("can not create azure storage client: {}", e.getMessage());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:AzureStorageServiceImpl.java

示例3: setUpStorageAccount

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
private static CloudBlobContainer setUpStorageAccount(String connectionString, String containerName) {
    try {
        CloudStorageAccount account = CloudStorageAccount.parse(connectionString);
        // Create a blob service client
        CloudBlobClient blobClient = account.createCloudBlobClient();
        CloudBlobContainer container = blobClient.getContainerReference(containerName);
        container.createIfNotExists();
        BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
        // Include public access in the permissions object
        containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
        // Set the permissions on the container
        container.uploadPermissions(containerPermissions);
        return container;
    } catch (StorageException | URISyntaxException | InvalidKeyException e) {
        throw new RuntimeException(e);
    }

}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:19,代码来源:ManageLinuxWebAppStorageAccountConnection.java

示例4: getCloudBlobContainer

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
private CloudBlobContainer getCloudBlobContainer(String accountName, String accountKey, String containerName) {
  CloudBlobContainer container = null;

  if (StringUtils.isNotBlank(containerName)) {
    final String storageConnectionString = "DefaultEndpointsProtocol=https"
      + ";AccountName=" + accountName
      + ";AccountKey=" + accountKey;

    try {
      final CloudStorageAccount account = CloudStorageAccount.parse(storageConnectionString);
      CloudBlobClient serviceClient = account.createCloudBlobClient();

      container = serviceClient.getContainerReference(containerName);
      container.createIfNotExists();
    } catch (StorageException | URISyntaxException | InvalidKeyException e) {
      logger.error("Error connecting to container for account {} and container name {}", accountName, containerName, e);
    }
  }

  return container;
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:22,代码来源:AzureStorageDriver.java

示例5: AzureNotebookRepo

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
public AzureNotebookRepo(ZeppelinConfiguration conf)
    throws URISyntaxException, InvalidKeyException, StorageException {
  this.conf = conf;
  user = conf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_USER);
  shareName = conf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_SHARE);

  CloudStorageAccount account = CloudStorageAccount.parse(
      conf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_AZURE_CONNECTION_STRING));
  CloudFileClient client = account.createCloudFileClient();
  CloudFileShare share = client.getShareReference(shareName);
  share.createIfNotExists();

  CloudFileDirectory userDir = StringUtils.isBlank(user) ?
      share.getRootDirectoryReference() :
      share.getRootDirectoryReference().getDirectoryReference(user);
  userDir.createIfNotExists();

  rootDir = userDir.getDirectoryReference("notebook");
  rootDir.createIfNotExists();
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:21,代码来源:AzureNotebookRepo.java

示例6: testCreateContainer

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
@Before
public void testCreateContainer() {
    try {
        // Retrieve storage account from connection-string.
        CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);

        // Create the blob client.
        CloudBlobClient blobClient = storageAccount.createCloudBlobClient();

        // Get a reference to a container.
        // The container name must be lower case
        container = blobClient.getContainerReference(containerName);

        // Create the container if it does not exist.
        container.createIfNotExists();
    } catch (Exception e) {
        // Output the stack trace.
        e.printStackTrace();
    }
}
 
开发者ID:dzh,项目名称:jframe,代码行数:21,代码来源:TestBlobService.java

示例7: validateWasbFileSystem

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
private void validateWasbFileSystem(FileSystem fileSystem, String fileSystemType) throws URISyntaxException, InvalidKeyException, StorageException {
    String accountName = fileSystem.getParameter(WasbFileSystemConfiguration.ACCOUNT_NAME, String.class);
    String accountKey = fileSystem.getParameter(WasbFileSystemConfiguration.ACCOUNT_KEY, String.class);
    String connectionString = "DefaultEndpointsProtocol=https;AccountName=" + accountName + ";AccountKey=" + accountKey;
    CloudStorageAccount storageAccount = CloudStorageAccount.parse(connectionString);
    CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
    CloudBlobContainer containerReference = blobClient.getContainerReference(TEST_CONTAINER + System.nanoTime());
    try {
        containerReference.createIfNotExists();
        containerReference.delete();
    } catch (StorageException e) {
        if (e.getCause() instanceof UnknownHostException) {
            throw new CloudConnectorException("The provided account does not belong to a valid storage account");
        }
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:17,代码来源:AzureSetup.java

示例8: getLogDataTable

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
/**
 * For the Azure Log Store, the underlying table to use
 *
 * @param storageConnectionString
 *
 * @return
 *
 * @throws URISyntaxException
 * @throws StorageException
 * @throws InvalidKeyException
 */
@Provides
@Named("logdata")
public CloudTable getLogDataTable(@Named("azure.storage-connection-string") String storageConnectionString,
                                  @Named("azure.logging-table")
		                                  String logTableName) throws URISyntaxException, StorageException, InvalidKeyException
{
	// Retrieve storage account from connection-string.
	CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);

	// Create the table client.
	CloudTableClient tableClient = storageAccount.createCloudTableClient();

	// Create the table if it doesn't exist.
	CloudTable table = tableClient.getTableReference(logTableName);
	table.createIfNotExists();

	return table;
}
 
开发者ID:petergeneric,项目名称:stdlib,代码行数:30,代码来源:ServiceManagerGuiceModule.java

示例9: getContainer

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
private CloudBlobContainer getContainer() throws Exception {
    // Retrieve storage account from connection-string.

    CloudStorageAccount storageAccount = CloudStorageAccount
            .parse(storageConnectionString);

    // Create the blob client.
    CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
    Timber.d(blobClient.getEndpoint().toString());
    // Get a reference to a container.
    // The container name must be lower case
    CloudBlobContainer container = blobClient.getContainerReference(CONTAINER_NAME);

    return container;
}
 
开发者ID:BANKEX,项目名称:smart-asset-iot-android-demo,代码行数:16,代码来源:ImageManager.java

示例10: getCloudStorageAccount

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
protected CloudStorageAccount getCloudStorageAccount(final FunctionApp app) throws Exception {
    final AppSetting internalStorageSetting = app.appSettings().get(INTERNAL_STORAGE_KEY);
    if (internalStorageSetting == null || StringUtils.isEmpty(internalStorageSetting.value())) {
        logError(INTERNAL_STORAGE_NOT_FOUND);
        throw new Exception(INTERNAL_STORAGE_NOT_FOUND);
    }
    logDebug(INTERNAL_STORAGE_CONNECTION_STRING + internalStorageSetting.value());
    return CloudStorageAccount.parse(internalStorageSetting.value());
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:10,代码来源:MSDeployArtifactHandlerImpl.java

示例11: getStorageAccount

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
@Bean
public CloudStorageAccount getStorageAccount() throws InvalidKeyException, URISyntaxException {
    String cs = String.format("DefaultEndpointsProtocol=http;AccountName=%s;AccountKey=%s",
            azureStorageProperties.getName(),
            azureStorageProperties.getKey());
    return CloudStorageAccount.parse(cs);
}
 
开发者ID:Azure,项目名称:CityPower-Build-Sample,代码行数:8,代码来源:AzureStorageConfig.java

示例12: getStorageAccount

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
@Bean
public CloudStorageAccount getStorageAccount() throws InvalidKeyException, URISyntaxException {
	String cs = String.format("DefaultEndpointsProtocol=http;AccountName=%s;AccountKey=%s",
			azureStorageProperties.getName(),
			azureStorageProperties.getKey());
	return CloudStorageAccount.parse(cs);
}
 
开发者ID:Azure,项目名称:CityPower-Build-Sample,代码行数:8,代码来源:AzureStorageConfig.java

示例13: getContainer

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
private static CloudBlobContainer getContainer() throws Exception {
    // Retrieve storage account from connection-string.

    CloudStorageAccount storageAccount = CloudStorageAccount
            .parse(storageConnectionString);

    // Create the blob client.
    CloudBlobClient blobClient = storageAccount.createCloudBlobClient();

    // Get a reference to a container.
    // The container name must be lower case
    CloudBlobContainer container = blobClient.getContainerReference("images");

    return container;
}
 
开发者ID:Azure-Samples,项目名称:storage-blob-android-photo-uploader,代码行数:16,代码来源:ImageManager.java

示例14: AzureStore

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
@SuppressWarnings("resource")
public AzureStore() throws InvalidKeyException, URISyntaxException,
		StorageException, IOException {
	FileReader fileReader = new FileReader("/secret/azure.key");
	BufferedReader bufferedReader = new BufferedReader(fileReader);
	String accountName = bufferedReader.readLine();
	String accountKey = bufferedReader.readLine();
	CloudStorageAccount account = CloudStorageAccount
			.parse("DefaultEndpointsProtocol=http;" + "AccountName="
					+ accountName + ";" + "AccountKey=" + accountKey);
	CloudBlobClient serviceClient = account.createCloudBlobClient();
	container = serviceClient
			.getContainerReference(Constants.AZURE_CONTAINER_NAME);
	container.createIfNotExists();
}
 
开发者ID:darshanmaiya,项目名称:MCSFS,代码行数:16,代码来源:AzureStore.java

示例15: getAccount

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
@Override
public CloudStorageAccount getAccount() {
    String envValue = System.getenv(storageConnectionStringEnvKey);
    if (envValue == null || envValue == "")
        throw new IllegalStateException("No " + storageConnectionStringEnvKey + " environment variable was provided while trying to load the Azure Storage Connection String");

    try {
        return CloudStorageAccount.parse(envValue);
    } catch (URISyntaxException | InvalidKeyException | IllegalArgumentException e) {
        throw new IllegalStateException(e);
    }
}
 
开发者ID:Exorath,项目名称:ServiceCommons,代码行数:13,代码来源:EnvironmentAzureStorageProvider.java


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