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


Java CloudStorageAccount.createCloudTableClient方法代码示例

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


在下文中一共展示了CloudStorageAccount.createCloudTableClient方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: create

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
public TableClient create() {
    try {
        final CloudStorageAccount storageAccount =
                new CloudStorageAccount(azureTableConfiguration.getStorageCredentialsAccountAndKey(), true);
        final CloudTableClient cloudTableClient = storageAccount.createCloudTableClient();
        final TableRequestOptions defaultOptions = new TableRequestOptions();
        defaultOptions.setRetryPolicyFactory(new RetryLinearRetry(
                Ints.checkedCast(azureTableConfiguration.getRetryInterval().toMilliseconds()),
                azureTableConfiguration.getRetryAttempts()));
        defaultOptions.setTimeoutIntervalInMs(Ints.checkedCast(azureTableConfiguration.getTimeout().toMilliseconds()));
        cloudTableClient.setDefaultRequestOptions(defaultOptions);
        return new TableClient(cloudTableClient);
    } catch (URISyntaxException err) {
        LOGGER.error("Failed to create a TableClient", err);
        throw new IllegalArgumentException(err);
    }
}
 
开发者ID:yammer,项目名称:breakerbox,代码行数:18,代码来源:TableClientFactory.java

示例3: 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

示例4: doInBackground

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
@Override
protected Void doInBackground(String... arg0) {

    act.printSampleStartInfo("TableBasics");

    try {
        // Setup the cloud storage account.
        CloudStorageAccount account = CloudStorageAccount
                .parse(MainActivity.storageConnectionString);

        // Create a table service client.
        tableClient = account.createCloudTableClient();

        // Retrieve a reference to a table.
        // Append a random UUID to the end of the table name so that this
        // sample can be run more than once in quick succession.
        table = tableClient.getTableReference(tableName
                + UUID.randomUUID().toString().replace("-", ""));

        // Create the table if it doesn't already exist.
        table.createIfNotExists();

        // Illustrates how to list the tables.
        this.BasicListing();

        // Illustrates how to form and execute a single insert operation.
        this.BasicInsertEntity();

        // Illustrates how to form and execute a batch operation.
        this.BasicBatch();

        // Illustrates how to form and execute a query operation.
        this.BasicQuery();

        // Illustrates how to form and execute an upsert operation.
        this.BasicUpsert();

        // Illustrates how to form and execute an entity delete operation.
        this.BasicDeleteEntity();

        // Delete the table.
        table.deleteIfExists();

    } catch (Throwable t) {
        act.printException(t);
    }

    act.printSampleCompleteInfo("TableBasics");

    return null;
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:52,代码来源:TableGettingStartedTask.java

示例5: main

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
public static void main(String[] args) throws URISyntaxException,
        StorageException, InvalidKeyException, NoSuchAlgorithmException {
    Utility.printSampleStartInfo("TableResolverAttributes");

    // Retrieve storage account information from connection string
    // How to create a storage connection string -
    // https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/
    CloudStorageAccount storageAccount = CloudStorageAccount
            .parse(Utility.storageConnectionString);
    CloudTableClient client = storageAccount.createCloudTableClient();
    CloudTable table = client.getTableReference("encryptiontableattributes"
            + UUID.randomUUID().toString().replace("-", ""));

    try {
        table.createIfNotExists();

        // Create the IKey used for encryption.
        RsaKey key = new RsaKey("private:key1");

        EncryptedEntity ent = new EncryptedEntity(UUID.randomUUID()
                .toString(), String.valueOf(new Date().getTime()));
        ent.Populate();

        TableRequestOptions insertOptions = new TableRequestOptions();
        insertOptions.setEncryptionPolicy(new TableEncryptionPolicy(key,
                null));

        // Insert Entity
        System.out.println("Inserting the encrypted entity.");
        table.execute(TableOperation.insert(ent), insertOptions, null);

        // For retrieves, a resolver can be set up that will help pick the
        // key based on the key id.
        LocalResolver resolver = new LocalResolver();
        resolver.add(key);

        TableRequestOptions retrieveOptions = new TableRequestOptions();
        retrieveOptions.setEncryptionPolicy(new TableEncryptionPolicy(null,
                resolver));

        // Retrieve Entity
        System.out.println("Retrieving the encrypted entity.");
        TableOperation operation = TableOperation.retrieve(
                ent.getPartitionKey(), ent.getRowKey(),
                EncryptedEntity.class);
        TableResult result = table
                .execute(operation, retrieveOptions, null);
        EncryptedEntity resultEntity = result.getResultAsType();
        System.out.println("EncryptedProperty2 = "
                + resultEntity.getEncryptedProperty2());
    } finally {
        table.deleteIfExists();
        Utility.printSampleCompleteInfo("TableResolverAttributes");
    }
}
 
开发者ID:Azure,项目名称:azure-storage-java,代码行数:56,代码来源:TableGettingStartedAttributes.java

示例6: main

import com.microsoft.azure.storage.CloudStorageAccount; //导入方法依赖的package包/类
/**
 * Executes the sample.
 * 
 * @param args
 *            No input args are expected from users.
 * @throws URISyntaxException
 * @throws InvalidKeyException
 */
public static void main(String[] args) throws InvalidKeyException, URISyntaxException {
    Utility.printSampleStartInfo("TableBasics");

    // Setup the cloud storage account.
    CloudStorageAccount account = CloudStorageAccount.parse(Utility.storageConnectionString);

    // Create a table service client.
    tableClient = account.createCloudTableClient();

    try {
        // Retrieve a reference to a table.
        // Append a random UUID to the end of the table name so that this
        // sample can be run more than once in quick succession.
        table = tableClient.getTableReference(tableName
                + UUID.randomUUID().toString().replace("-", ""));

        // Create the table if it doesn't already exist.
        table.createIfNotExists();

        // Illustrates how to list the tables.
        BasicListing();

        // Illustrates how to form and execute a single insert operation.
        BasicInsertEntity();

        // Illustrates how to form and execute a batch operation.
        BasicBatch();

        // Illustrates how to form and execute a query operation.
        BasicQuery();

        // Illustrates how to form and execute an upsert operation.
        BasicUpsert();

        // Illustrates how to form and execute an entity delete operation.
        BasicDeleteEntity();

        // Delete the table.
        table.deleteIfExists();

    }
    catch (Throwable t) {
        Utility.printException(t);
    }

    Utility.printSampleCompleteInfo("TableBasics");
}
 
开发者ID:Azure,项目名称:azure-storage-java,代码行数:56,代码来源:TableBasics.java


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