com.microsoft.azure.storage.table.CloudTable Java Examples

The following examples show how to use com.microsoft.azure.storage.table.CloudTable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AzureTableStore.java    From data-transfer-project with Apache License 2.0 6 votes vote down vote up
@Override
public PortabilityJob findJob(UUID jobId) {
  Preconditions.checkNotNull(jobId, "Job id is null");
  try {

    CloudTable table = tableClient.getTableReference(JOB_TABLE);

    TableOperation retrieve =
        TableOperation.retrieve(
            configuration.getPartitionKey(), jobId.toString(), DataWrapper.class);
    TableResult result = table.execute(retrieve);
    DataWrapper wrapper = result.getResultAsType();
    return configuration.getMapper().readValue(wrapper.getSerialized(), PortabilityJob.class);
  } catch (StorageException | URISyntaxException | IOException e) {
    throw new MicrosoftStorageException("Error finding job: " + jobId, e);
  }
}
 
Example #2
Source File: SecondaryTests.java    From azure-storage-android with Apache License 2.0 6 votes vote down vote up
private static void testTableDownloadPermissions(LocationMode optionsLocationMode, LocationMode clientLocationMode,
        StorageLocation initialLocation, List<RetryContext> retryContextList, List<RetryInfo> retryInfoList)
        throws URISyntaxException, StorageException {
    CloudTableClient client = TestHelper.createCloudTableClient();
    CloudTable table = client.getTableReference(TableTestHelper.generateRandomTableName());

    MultiLocationTestHelper helper = new MultiLocationTestHelper(table.getServiceClient().getStorageUri(),
            initialLocation, retryContextList, retryInfoList);

    table.getServiceClient().getDefaultRequestOptions().setLocationMode(clientLocationMode);
    TableRequestOptions options = new TableRequestOptions();

    options.setLocationMode(optionsLocationMode);
    options.setRetryPolicyFactory(helper.retryPolicy);

    try {
        table.downloadPermissions(options, helper.operationContext);
    }
    catch (StorageException ex) {
        assertEquals(HttpURLConnection.HTTP_NOT_FOUND, ex.getHttpStatusCode());
    }
    finally {
        helper.close();
    }
}
 
Example #3
Source File: AzureStorageTableService.java    From components with Apache License 2.0 6 votes vote down vote up
/**
 * This method create a table after it's deletion.<br/>
 * the table deletion take about 40 seconds to be effective on azure CF.
 * https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Table#Remarks <br/>
 * So we try to wait 50 seconds if the first table creation return an
 * {@link StorageErrorCodeStrings.TABLE_BEING_DELETED } exception code
 * 
 * @param cloudTable
 * 
 * @throws StorageException
 * @throws IOException
 * 
 */
private void createTableAfterDeletion(CloudTable cloudTable) throws StorageException, IOException {
    try {
        cloudTable.create(null, AzureStorageUtils.getTalendOperationContext());
    } catch (TableServiceException e) {
        if (!e.getErrorCode().equals(StorageErrorCodeStrings.TABLE_BEING_DELETED)) {
            throw e;
        }
        LOGGER.warn("Table '{}' is currently being deleted. We'll retry in a few moments...", cloudTable.getName());
        // wait 50 seconds (min is 40s) before retrying.
        // See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Table#Remarks
        try {
            Thread.sleep(50000);
        } catch (InterruptedException eint) {
            throw new IOException("Wait process for recreating table interrupted.");
        }
        cloudTable.create(null, AzureStorageUtils.getTalendOperationContext());
        LOGGER.debug("Table {} created.", cloudTable.getName());
    }
}
 
Example #4
Source File: StorageAccountTests.java    From azure-storage-android with Apache License 2.0 6 votes vote down vote up
@Test
public void testCloudStorageAccountClientUriVerify() throws URISyntaxException, StorageException {
    StorageCredentialsAccountAndKey cred = new StorageCredentialsAccountAndKey(ACCOUNT_NAME, ACCOUNT_KEY);
    CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(cred, true);

    CloudBlobClient blobClient = cloudStorageAccount.createCloudBlobClient();
    CloudBlobContainer container = blobClient.getContainerReference("container1");
    assertEquals(cloudStorageAccount.getBlobEndpoint().toString() + "/container1", container.getUri().toString());

    CloudQueueClient queueClient = cloudStorageAccount.createCloudQueueClient();
    CloudQueue queue = queueClient.getQueueReference("queue1");
    assertEquals(cloudStorageAccount.getQueueEndpoint().toString() + "/queue1", queue.getUri().toString());

    CloudTableClient tableClient = cloudStorageAccount.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("table1");
    assertEquals(cloudStorageAccount.getTableEndpoint().toString() + "/table1", table.getUri().toString());

    CloudFileClient fileClient = cloudStorageAccount.createCloudFileClient();
    CloudFileShare share = fileClient.getShareReference("share1");
    assertEquals(cloudStorageAccount.getFileEndpoint().toString() + "/share1", share.getUri().toString());
}
 
Example #5
Source File: AzureTableStore.java    From data-transfer-project with Apache License 2.0 6 votes vote down vote up
private void remove(UUID jobId, String tableName) throws IOException {
  try {

    CloudTable table = tableClient.getTableReference(tableName);
    TableOperation retrieve =
        TableOperation.retrieve(
            configuration.getPartitionKey(), jobId.toString(), DataWrapper.class);
    TableResult result = table.execute(retrieve);
    DataWrapper wrapper = result.getResultAsType();

    TableOperation delete = TableOperation.delete(wrapper);
    table.execute(delete);

  } catch (StorageException | URISyntaxException e) {
    throw new IOException("Error removing data for job: " + jobId, e);
  }
}
 
Example #6
Source File: AzureTableStore.java    From data-transfer-project with Apache License 2.0 6 votes vote down vote up
private void create(String rowKey, String tableName, String state, Object type)
    throws IOException {
  try {

    CloudTable table = tableClient.getTableReference(tableName);

    String serializedJob = configuration.getMapper().writeValueAsString(type);
    DataWrapper wrapper =
        new DataWrapper(
            configuration.getPartitionKey(), rowKey, state, serializedJob); // job id used as key
    TableOperation insert = TableOperation.insert(wrapper);
    table.execute(insert);
  } catch (JsonProcessingException | StorageException | URISyntaxException e) {
    throw new IOException("Error creating data for rowKey: " + rowKey, e);
  }
}
 
Example #7
Source File: AzureTableStore.java    From data-transfer-project with Apache License 2.0 5 votes vote down vote up
private <T> T find(Class<T> type, String rowKey, String tableName) {
  try {

    CloudTable table = tableClient.getTableReference(tableName);
    TableOperation retrieve =
        TableOperation.retrieve(configuration.getPartitionKey(), rowKey, DataWrapper.class);
    TableResult result = table.execute(retrieve);
    DataWrapper wrapper = result.getResultAsType();
    return configuration.getMapper().readValue(wrapper.getSerialized(), type);
  } catch (StorageException | IOException | URISyntaxException e) {
    throw new MicrosoftStorageException("Error finding data for rowKey: " + rowKey, e);
  }
}
 
Example #8
Source File: AzureStorageClient.java    From azure-kusto-java with MIT License 5 votes vote down vote up
void azureTableInsertEntity(String tableUri, TableServiceEntity entity) throws StorageException,
        URISyntaxException {
    // Ensure
    Ensure.stringIsNotBlank(tableUri, "tableUri");
    Ensure.argIsNotNull(entity, "entity");

    CloudTable table = new CloudTable(new URI(tableUri));
    // Create an operation to add the new customer to the table basics table.
    TableOperation insert = TableOperation.insert(entity);
    // Submit the operation to the table service.
    table.execute(insert);
}
 
Example #9
Source File: TableReportIngestionResult.java    From azure-kusto-java with MIT License 5 votes vote down vote up
@Override
public List<IngestionStatus> getIngestionStatusCollection() throws StorageException, URISyntaxException {
    List<IngestionStatus> results = new LinkedList<>();
    for (IngestionStatusInTableDescription descriptor : descriptors) {
        CloudTable table = new CloudTable(new URI(descriptor.TableConnectionString));
        TableOperation operation = TableOperation.retrieve(descriptor.PartitionKey, descriptor.RowKey,
                IngestionStatus.class);
        results.add(table.execute(operation).getResultAsType());
    }

    return results;
}
 
Example #10
Source File: AzureStorageTableService.java    From components with Apache License 2.0 5 votes vote down vote up
public void handleActionOnTable(String tableName, ActionOnTable actionTable)
        throws IOException, StorageException, InvalidKeyException, URISyntaxException {

    // FIXME How does this will behave in a distributed runtime ? See where to place correctly this
    // instruction...
    CloudTable cloudTable = connection.getCloudStorageAccount().createCloudTableClient().getTableReference(tableName);
    switch (actionTable) {
    case Create_table:
        cloudTable.create(null, AzureStorageUtils.getTalendOperationContext());
        break;
    case Create_table_if_does_not_exist:
        cloudTable.createIfNotExists(null, AzureStorageUtils.getTalendOperationContext());
        break;
    case Drop_and_create_table:
        cloudTable.delete(null, AzureStorageUtils.getTalendOperationContext());
        createTableAfterDeletion(cloudTable);
        break;
    case Drop_table_if_exist_and_create:
        cloudTable.deleteIfExists(null, AzureStorageUtils.getTalendOperationContext());
        createTableAfterDeletion(cloudTable);
        break;
    case Default:
    default:
        return;
    }

}
 
Example #11
Source File: AzureTableStore.java    From data-transfer-project with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateJob(UUID jobId, PortabilityJob job, JobUpdateValidator validator)
    throws IOException {

  Preconditions.checkNotNull(jobId, "Job is null");

  Preconditions.checkNotNull(job, "Job is null");

  try {

    CloudTable table = tableClient.getTableReference(JOB_TABLE);

    String serializedJob = configuration.getMapper().writeValueAsString(job);
    DataWrapper wrapper =
        new DataWrapper(
            configuration.getPartitionKey(),
            jobId.toString(),
            job.jobAuthorization().state().name(),
            serializedJob);

    if (validator != null) {
      PortabilityJob previousJob = findJob(jobId);
      if (previousJob == null) {
        throw new IOException("Could not find record for jobId: " + jobId);
      }

      validator.validate(previousJob, job);
    }

    TableOperation insert = TableOperation.insertOrReplace(wrapper);
    table.execute(insert);

  } catch (JsonProcessingException | StorageException | URISyntaxException e) {
    throw new IOException("Error updating job: " + jobId, e);
  }
}
 
Example #12
Source File: AzureTableStore.java    From data-transfer-project with Apache License 2.0 5 votes vote down vote up
@Override
public UUID findFirst(JobAuthorization.State jobState) {
  try {
    String partitionFilter =
        generateFilterCondition(
            "PartitionKey", TableQuery.QueryComparisons.EQUAL, configuration.getPartitionKey());
    String stateFilter =
        generateFilterCondition(
            "State",
            TableQuery.QueryComparisons.EQUAL,
            jobState.name()); // properties are converted to capitalized by the storage API

    String combinedFilter =
        TableQuery.combineFilters(partitionFilter, TableQuery.Operators.AND, stateFilter);

    TableQuery<DataWrapper> query =
        TableQuery.from(DataWrapper.class).where(combinedFilter).take(1);

    CloudTable table = tableClient.getTableReference(JOB_TABLE);
    Iterator<DataWrapper> iter = table.execute(query).iterator();
    if (!iter.hasNext()) {
      return null;
    }
    return UUID.fromString(iter.next().getRowKey());
  } catch (StorageException | URISyntaxException e) {
    throw new MicrosoftStorageException("Error finding first job", e);
  }
}
 
Example #13
Source File: GenericTests.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testUserAgentString() throws URISyntaxException, StorageException {
    // Test with a blob request
    CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
    CloudBlobContainer container = blobClient.getContainerReference("container1");
    OperationContext sendingRequestEventContext = new OperationContext();
    sendingRequestEventContext.getSendingRequestEventHandler().addListener(new StorageEvent<SendingRequestEvent>() {

        @Override
        public void eventOccurred(SendingRequestEvent eventArg) {
            assertEquals(
                    Constants.HeaderConstants.USER_AGENT_PREFIX
                            + "/"
                            + Constants.HeaderConstants.USER_AGENT_VERSION
                            + " "
                            + String.format(Utility.LOCALE_US, "(Android %s; %s; %s)",
                            android.os.Build.VERSION.RELEASE, android.os.Build.BRAND,
                            android.os.Build.MODEL), ((HttpURLConnection) eventArg.getConnectionObject())
                            .getRequestProperty(Constants.HeaderConstants.USER_AGENT));
        }
    });
    container.exists(null, null, sendingRequestEventContext);

    // Test with a queue request
    CloudQueueClient queueClient = TestHelper.createCloudQueueClient();
    CloudQueue queue = queueClient.getQueueReference("queue1");
    queue.exists(null, sendingRequestEventContext);

    // Test with a table request
    CloudTableClient tableClient = TestHelper.createCloudTableClient();
    CloudTable table = tableClient.getTableReference("table1");
    table.exists(null, sendingRequestEventContext);
}
 
Example #14
Source File: MaximumExecutionTimeTests.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
@Test
@Category({ DevFabricTests.class, DevStoreTests.class, SecondaryTests.class })
public void testTableMaximumExecutionTime() throws URISyntaxException, StorageException {
    OperationContext opContext = new OperationContext();
    setDelay(opContext, 2500);
    
    opContext.getResponseReceivedEventHandler().addListener(new StorageEvent<ResponseReceivedEvent>() {

        @Override
        public void eventOccurred(ResponseReceivedEvent eventArg) {
            // Set status code to 500 to force a retry
            eventArg.getRequestResult().setStatusCode(500);
        }
    });

    // set the maximum execution time
    TableRequestOptions options = new TableRequestOptions();
    options.setMaximumExecutionTimeInMs(2000);
    options.setTimeoutIntervalInMs(1000);

    CloudTableClient tableClient = TestHelper.createCloudTableClient();
    CloudTable table = tableClient.getTableReference(generateRandomName("share"));

    try {
        // 1. insert entity will fail as the table does not exist
        // 2. the executor will attempt to retry as we set the status code to 500
        // 3. maximum execution time should prevent the retry from being made
        DynamicTableEntity ent = new DynamicTableEntity("partition", "row");
        TableOperation insert = TableOperation.insert(ent);
        table.execute(insert, options, opContext);
        fail("Maximum execution time was reached but request did not fail.");
    }
    catch (StorageException e) {
        assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getMessage());
    }
}
 
Example #15
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the minute metrics table for a specific storage service.
 * 
 * @param service
 *            A {@link StorageService} enumeration value that indicates which storage service to use.
 * @param location
 *            A {@link StorageLocation} enumeration value that indicates which storage location to use.
 * @return
 *         The <code>CloudTable</code> object for the storage service.
 * @throws URISyntaxException
 * @throws StorageException
 */
public CloudTable getMinuteMetricsTable(StorageService service, StorageLocation location)
        throws URISyntaxException, StorageException {
    Utility.assertNotNull("service", service);
    if (location == null) {
        location = StorageLocation.PRIMARY;
    }

    switch (service) {
        case BLOB:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_BLOB);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_BLOB);
            }
        case FILE:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_FILE);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_FILE);
            }
        case QUEUE:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_QUEUE);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_QUEUE);
            }
        case TABLE:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_TABLE);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_TABLE);
            }
        default:
            throw new IllegalArgumentException(SR.INVALID_STORAGE_SERVICE);
    }
}
 
Example #16
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the hour metrics table for a specific storage service.
 * 
 * @param service
 *            A {@link StorageService} enumeration value that indicates which storage service to use.
 * @param location
 *            A {@link StorageLocation} enumeration value that indicates which storage location to use.
 * @return
 *         The {@link CloudTable} object for the storage service.
 * @throws URISyntaxException
 * @throws StorageException
 */
public CloudTable getHourMetricsTable(StorageService service, StorageLocation location) throws URISyntaxException,
        StorageException {
    Utility.assertNotNull("service", service);
    if (location == null) {
        location = StorageLocation.PRIMARY;
    }

    switch (service) {
        case BLOB:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_BLOB);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_BLOB);
            }
            
        case FILE:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_FILE);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_FILE);
            }
            
        case QUEUE:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_QUEUE);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_QUEUE);
            }
            
        case TABLE:
            if (location == StorageLocation.PRIMARY) {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_TABLE);
            }
            else {
                return this.tableClient.getTableReference(
                        Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_TABLE);
            }
            
        default:
            throw new IllegalArgumentException(SR.INVALID_STORAGE_SERVICE);
    }
}
 
Example #17
Source File: AzureStorageTableService.java    From components with Apache License 2.0 4 votes vote down vote up
public ArrayList<TableResult> executeOperation(String tableName, TableBatchOperation batchOpe)
        throws InvalidKeyException, URISyntaxException, StorageException {

    CloudTable cloudTable = connection.getCloudStorageAccount().createCloudTableClient().getTableReference(tableName);
    return cloudTable.execute(batchOpe, null, AzureStorageUtils.getTalendOperationContext());
}
 
Example #18
Source File: CloudAnalyticsClientTests.java    From azure-storage-android with Apache License 2.0 4 votes vote down vote up
/**
 * Test table getters.
 *
 * @throws StorageException
 * @throws URISyntaxException
 */
@Test
public void testCloudAnalyticsClientGetTables() throws URISyntaxException, StorageException {
    CloudTable blobHourPrimary = this.client.getHourMetricsTable(StorageService.BLOB);
    CloudTable blobHourSecondary = this.client.getHourMetricsTable(StorageService.BLOB, StorageLocation.SECONDARY);
    CloudTable fileHourPrimary = this.client.getHourMetricsTable(StorageService.FILE);
    CloudTable fileHourSecondary = this.client.getHourMetricsTable(StorageService.FILE, StorageLocation.SECONDARY);
    CloudTable queueHourPrimary = this.client.getHourMetricsTable(StorageService.QUEUE, StorageLocation.PRIMARY);
    CloudTable queueHourSecondary = this.client.getHourMetricsTable(StorageService.QUEUE, StorageLocation.SECONDARY);
    CloudTable tableHourPrimary = this.client.getHourMetricsTable(StorageService.TABLE, StorageLocation.PRIMARY);
    CloudTable tableHourSecondary = this.client.getHourMetricsTable(StorageService.TABLE, StorageLocation.SECONDARY);

    CloudTable blobMinutePrimary = this.client.getMinuteMetricsTable(StorageService.BLOB);
    CloudTable blobMinuteSecondary = this.client.getMinuteMetricsTable(StorageService.BLOB, StorageLocation.SECONDARY);
    CloudTable fileMinutePrimary = this.client.getMinuteMetricsTable(StorageService.FILE);
    CloudTable fileMinuteSecondary = this.client.getMinuteMetricsTable(StorageService.FILE, StorageLocation.SECONDARY);
    CloudTable queueMinutePrimary = this.client.getMinuteMetricsTable(StorageService.QUEUE, StorageLocation.PRIMARY);
    CloudTable queueMinuteSecondary = this.client.getMinuteMetricsTable(StorageService.QUEUE, StorageLocation.SECONDARY);
    CloudTable tableMinutePrimary = this.client.getMinuteMetricsTable(StorageService.TABLE, StorageLocation.PRIMARY);
    CloudTable tableMinuteSecondary = this.client.getMinuteMetricsTable(StorageService.TABLE, StorageLocation.SECONDARY);

    CloudTable capacity = this.client.getCapacityTable();

    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_BLOB, blobHourPrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_BLOB, blobHourSecondary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_FILE, fileHourPrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_FILE, fileHourSecondary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_QUEUE, queueHourPrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_QUEUE, queueHourSecondary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_PRIMARY_TRANSACTIONS_TABLE, tableHourPrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_HOUR_SECONDARY_TRANSACTIONS_TABLE, tableHourSecondary.getName());

    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_BLOB, blobMinutePrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_BLOB, blobMinuteSecondary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_FILE, fileMinutePrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_FILE, fileMinuteSecondary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_QUEUE, queueMinutePrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_QUEUE, queueMinuteSecondary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_PRIMARY_TRANSACTIONS_TABLE, tableMinutePrimary.getName());
    assertEquals(Constants.AnalyticsConstants.METRICS_MINUTE_SECONDARY_TRANSACTIONS_TABLE, tableMinuteSecondary.getName());

    assertEquals(Constants.AnalyticsConstants.METRICS_CAPACITY_BLOB, capacity.getName());
}
 
Example #19
Source File: AzureStorageTableService.java    From components with Apache License 2.0 4 votes vote down vote up
public TableResult executeOperation(String tableName, TableOperation ope)
        throws InvalidKeyException, URISyntaxException, StorageException {

    CloudTable cloudTable = connection.getCloudStorageAccount().createCloudTableClient().getTableReference(tableName);
    return cloudTable.execute(ope, null, AzureStorageUtils.getTalendOperationContext());
}
 
Example #20
Source File: AzureStorageTableService.java    From components with Apache License 2.0 4 votes vote down vote up
public Iterable<DynamicTableEntity> executeQuery(String tableName, TableQuery<DynamicTableEntity> partitionQuery)
        throws InvalidKeyException, URISyntaxException, StorageException {

    CloudTable cloudTable = connection.getCloudStorageAccount().createCloudTableClient().getTableReference(tableName);
    return cloudTable.execute(partitionQuery, null, AzureStorageUtils.getTalendOperationContext());
}
 
Example #21
Source File: TableUtils.java    From samza with Apache License 2.0 4 votes vote down vote up
public CloudTable getTable() {
  return table;
}
 
Example #22
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the hour metrics table for a specific storage service.
 * 
 * @param service
 *            A {@link StorageService} enumeration value that indicates which storage service to use.
 * @return
 *         The {@link CloudTable} object for the storage service.
 * @throws URISyntaxException
 * @throws StorageException
 */
public CloudTable getHourMetricsTable(StorageService service) throws URISyntaxException, StorageException {
    return this.getHourMetricsTable(service, null);
}
 
Example #23
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the minute metrics table for a specific storage service.
 * 
 * @param service
 *            A {@link StorageService} enumeration value that indicates which storage service to use.
 * @return
 *         The {@link CloudTable} object for the storage service.
 * @throws URISyntaxException
 * @throws StorageException
 */
public CloudTable getMinuteMetricsTable(StorageService service) throws URISyntaxException, StorageException {
    return this.getMinuteMetricsTable(service, null);
}
 
Example #24
Source File: CloudAnalyticsClient.java    From azure-storage-android with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the capacity metrics table for the blob service.
 * 
 * @return
 *         A {@link CloudTable} object.
 * @throws URISyntaxException
 * @throws StorageException
 */
public CloudTable getCapacityTable() throws URISyntaxException, StorageException {
    return this.tableClient.getTableReference(Constants.AnalyticsConstants.METRICS_CAPACITY_BLOB);
}