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


Java CloudTableClient.downloadServiceProperties方法代码示例

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


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

示例1: corsRules

import com.microsoft.azure.storage.table.CloudTableClient; //导入方法依赖的package包/类
/**
 * Set CORS rules sample.
 * @param tableClient Azure Storage Table Service
 */
private void corsRules(CloudTableClient tableClient) throws StorageException {
    // Get service properties
    System.out.println("Get service properties");
    ServiceProperties originalProps = tableClient.downloadServiceProperties();

    try {
        // Setr CORS rules
        System.out.println("Set CORS rules");
        CorsRule ruleAllowAll = new CorsRule();
        ruleAllowAll.getAllowedOrigins().add("*");
        ruleAllowAll.getAllowedMethods().add(CorsHttpMethods.GET);
        ruleAllowAll.getAllowedHeaders().add("*");
        ruleAllowAll.getExposedHeaders().add("*");
        ServiceProperties props = new ServiceProperties();
        props.getCors().getCorsRules().add(ruleAllowAll);
        tableClient.uploadServiceProperties(props);
    }
    finally {
        // Revert back to original service properties
        tableClient.uploadServiceProperties(originalProps);
    }
}
 
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:27,代码来源:TableAdvanced.java

示例2: callDownloadServiceProperties

import com.microsoft.azure.storage.table.CloudTableClient; //导入方法依赖的package包/类
private ServiceProperties callDownloadServiceProperties(ServiceClient client) throws StorageException {
    if (client.getClass().equals(CloudBlobClient.class)) {
        CloudBlobClient blobClient = (CloudBlobClient) client;
        return blobClient.downloadServiceProperties();
    }
    else if (client.getClass().equals(CloudTableClient.class)) {
        CloudTableClient tableClient = (CloudTableClient) client;
        return tableClient.downloadServiceProperties();
    }
    else if (client.getClass().equals(CloudQueueClient.class)) {
        CloudQueueClient queueClient = (CloudQueueClient) client;
        return queueClient.downloadServiceProperties();
    }
    else {
        fail();
    }
    return null;
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:19,代码来源:ServicePropertiesTests.java

示例3: serviceProperties

import com.microsoft.azure.storage.table.CloudTableClient; //导入方法依赖的package包/类
/**
 * Manage the service properties including logging hour and minute metrics.
 * @param tableClient Azure Storage Table Service
 */
private void serviceProperties(CloudTableClient tableClient) throws StorageException {
    System.out.println("Get service properties");
    ServiceProperties originalProps = tableClient.downloadServiceProperties();

    try {
        System.out.println("Set service properties");
        // Change service properties
        ServiceProperties props = new ServiceProperties();

        props.getLogging().setLogOperationTypes(EnumSet.allOf(LoggingOperations.class));
        props.getLogging().setRetentionIntervalInDays(2);
        props.getLogging().setVersion("1.0");

        final MetricsProperties hours = props.getHourMetrics();
        hours.setMetricsLevel(MetricsLevel.SERVICE_AND_API);
        hours.setRetentionIntervalInDays(1);
        hours.setVersion("1.0");

        final MetricsProperties minutes = props.getMinuteMetrics();
        minutes.setMetricsLevel(MetricsLevel.SERVICE);
        minutes.setRetentionIntervalInDays(1);
        minutes.setVersion("1.0");

        tableClient.uploadServiceProperties(props);

        System.out.println();
        System.out.println("Logging");
        System.out.printf("version: %s%n", props.getLogging().getVersion());
        System.out.printf("retention interval: %d%n", props.getLogging().getRetentionIntervalInDays());
        System.out.printf("operation types: %s%n", props.getLogging().getLogOperationTypes());
        System.out.println();
        System.out.println("Hour Metrics");
        System.out.printf("version: %s%n", props.getHourMetrics().getVersion());
        System.out.printf("retention interval: %d%n", props.getHourMetrics().getRetentionIntervalInDays());
        System.out.printf("operation types: %s%n", props.getHourMetrics().getMetricsLevel());
        System.out.println();
        System.out.println("Minute Metrics");
        System.out.printf("version: %s%n", props.getMinuteMetrics().getVersion());
        System.out.printf("retention interval: %d%n", props.getMinuteMetrics().getRetentionIntervalInDays());
        System.out.printf("operation types: %s%n", props.getMinuteMetrics().getMetricsLevel());
        System.out.println();
    }
    finally {
        // Revert back to original service properties
        tableClient.uploadServiceProperties(originalProps);
    }
}
 
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:52,代码来源:TableAdvanced.java


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