CloudTable Class
- java.
lang. Object - com.
microsoft. azure. storage. table. CloudTable
- com.
public class CloudTable
Represents a table in the Microsoft Azure Table service.
Constructor Summary
Constructor | Description |
---|---|
CloudTable(final StorageUri uri) |
Creates an instance of the class using the specified table URI. The table URI must include a SAS token. |
CloudTable(final StorageUri uri, final StorageCredentials credentials) |
Creates an instance of the class using the specified table StorageUri and credentials. |
CloudTable(final String tableName, final CloudTableClient client) |
Creates an instance of the class using the specified name and client. |
CloudTable(final URI uri) |
Creates an instance of the class using the specified table URI. The table URI must include a SAS token. |
CloudTable(final URI uri, final StorageCredentials credentials) |
Creates an instance of the class using the specified table URI and credentials. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
create()
Creates the table in the storage service with default request options. This method invokes the Create Table REST API to create the specified table, using the Table service endpoint and storage account credentials of this instance. |
void |
create(TableRequestOptions options, OperationContext opContext)
Creates the table in the storage service, using the specified TableRequestOptions and OperationContext. This method invokes the Create Table REST API to create the specified table, using the Table service endpoint and storage account credentials of this instance. Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation. |
boolean |
createIfNotExists()
Creates the table in the storage service using default request options if it does not already exist. |
boolean |
createIfNotExists(TableRequestOptions options, OperationContext opContext)
Creates the table in the storage service with the specified request options and operation context, if it does not already exist. |
void |
delete()
Deletes the table from the storage service. |
void |
delete(TableRequestOptions options, OperationContext opContext)
Deletes the table from the storage service, using the specified request options and operation context. |
boolean |
deleteIfExists()
Deletes the table from the storage service, if it exists. |
boolean |
deleteIfExists(TableRequestOptions options, OperationContext opContext)
Deletes the table from the storage service using the specified request options and operation context, if it exists. |
Table |
downloadPermissions()
Downloads the permission settings for the table. |
Table |
downloadPermissions(TableRequestOptions options, OperationContext opContext)
Downloads the permissions settings for the table using the specified request options and operation context. |
ArrayList<Table |
execute(final TableBatchOperation batch)
Executes the specified batch operation on a table as an atomic operation. A batch operation may contain up to 100 individual table operations, with the requirement that each operation entity must have same partition key. Only one retrieve operation is allowed per batch. Note that the total payload of a batch operation is limited to 4MB. This method invokes an Entity Group Transaction on the REST API to execute the specified batch operation on the table as an atomic unit, using the Table service endpoint and storage account credentials of this instance. |
ArrayList<Table |
execute(final TableBatchOperation batch, TableRequestOptions options, OperationContext opContext)
Executes the specified batch operation on a table as an atomic operation, using the specified TableRequestOptions and OperationContext. A batch operation may contain up to 100 individual table operations, with the requirement that each operation entity must have same partition key. Only one retrieve operation is allowed per batch. Note that the total payload of a batch operation is limited to 4MB. This method invokes an Entity Group Transaction on the REST API to execute the specified batch operation on the table as an atomic unit, using the Table service endpoint and storage account credentials of this instance. Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation. |
Table |
execute(final TableOperation operation)
Executes the operation on a table. This method will invoke the Table Service REST API to execute the specified operation on the table, using the Table service endpoint and storage account credentials of this instance. |
Table |
execute(final TableOperation operation, final TableRequestOptions options, final OperationContext opContext)
Executes the operation on a table, using the specified TableRequestOptions and OperationContext. This method will invoke the Table Service REST API to execute the specified operation on the table, using the Table service endpoint and storage account credentials of this instance. Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation. |
<R> Iterable<R> |
execute(final TableQuery<?> query, final EntityResolver<R> resolver)
Executes a query, applying the specified EntityResolver<T> to the result. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. |
<R> Iterable<R> |
execute(final TableQuery<?> query, final EntityResolver<R> resolver, final TableRequestOptions options, final OperationContext opContext)
Executes a query, applying the specified EntityResolver<T> to the result, using the specified TableRequestOptions and OperationContext. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation. |
<T extends Table |
execute(final TableQuery<T> query)
Executes a query. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. |
<T extends Table |
execute(final TableQuery<T> query, final TableRequestOptions options, final OperationContext opContext)
Executes a query, using the specified TableRequestOptions and OperationContext. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation. |
<R> Result |
executeSegmented(final TableQuery<?> query, final EntityResolver<R> resolver, final ResultContinuation continuationToken)
Executes a query in segmented mode with the specified ResultContinuation continuation token, applying the EntityResolver<T> to the result. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. |
<R> Result |
executeSegmented(final TableQuery<?> query, final EntityResolver<R> resolver, final ResultContinuation continuationToken, final TableRequestOptions options, final OperationContext opContext)
Executes a query in segmented mode with the specified ResultContinuation continuation token, using the specified TableRequestOptions and OperationContext, applying the EntityResolver<T> to the result. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation. |
<T extends Table |
executeSegmented(final TableQuery<T> query, final ResultContinuation continuationToken)
Executes a query in segmented mode with a ResultContinuation continuation token. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. |
<T extends Table |
executeSegmented(final TableQuery<T> query, final ResultContinuation continuationToken, final TableRequestOptions options, final OperationContext opContext)
Executes a query in segmented mode with a ResultContinuation continuation token, using the specified TableRequestOptions and OperationContext. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object. This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance. Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation. |
boolean |
exists()
Returns a value that indicates whether the table exists in the storage service. |
boolean |
exists(TableRequestOptions options, OperationContext opContext)
Returns a value that indicates whether the table exists in the storage service, using the specified request options and operation context. |
String |
generateSharedAccessSignature(final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey)
Creates a shared access signature for the table. |
String |
generateSharedAccessSignature(final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey, final IPRange ipRange, final SharedAccessProtocols protocols)
Creates a shared access signature for the table. |
String |
getName()
Gets the name of the table. |
Cloud |
getServiceClient()
Gets the table service client associated with this queue. |
final Storage |
getStorageUri()
Returns the list of URIs for all locations. |
URI |
getUri()
Gets the absolute URI for this table. |
void |
uploadPermissions(final TablePermissions permissions)
Uploads the table's permissions. |
void |
uploadPermissions(final TablePermissions permissions, TableRequestOptions options, OperationContext opContext)
Uploads the table's permissions using the specified request options and operation context. |
Constructor Details
CloudTable
public CloudTable(final StorageUri uri)
Creates an instance of the class using the specified table URI. The table URI must include a SAS token.
Parameters:
Throws:
CloudTable
public CloudTable(final StorageUri uri, final StorageCredentials credentials)
Creates an instance of the class using the specified table StorageUri and credentials.
Parameters:
Throws:
CloudTable
protected CloudTable(final String tableName, final CloudTableClient client)
Creates an instance of the class using the specified name and client.
Parameters:
String
which represents the name of the table, which must adhere to table naming rules. The table name should not include any path separator characters (/). Table names are case insensitive, must be unique within an account and must be between 3-63 characters long. Table names must start with an cannot begin with a numeric character and may only contain alphanumeric characters. Some table names are reserved, including "table".
Throws:
CloudTable
public CloudTable(final URI uri)
Creates an instance of the class using the specified table URI. The table URI must include a SAS token.
Parameters:
java.net.URI
object that represents the absolute URI of the table.
Throws:
CloudTable
public CloudTable(final URI uri, final StorageCredentials credentials)
Creates an instance of the class using the specified table URI and credentials.
Parameters:
java.net.URI
object that represents the absolute URI of the table.
Throws:
Method Details
create
public void create()
Creates the table in the storage service with default request options.
This method invokes the Create Table REST API to create the specified table, using the Table service endpoint and storage account credentials of this instance.
Throws:
create
public void create(TableRequestOptions options, OperationContext opContext)
Creates the table in the storage service, using the specified TableRequestOptions and OperationContext.
This method invokes the Create Table REST API to create the specified table, using the Table service endpoint and storage account credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation.
Parameters:
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Throws:
createIfNotExists
public boolean createIfNotExists()
Creates the table in the storage service using default request options if it does not already exist.
Returns:
true
if the table is created in the storage service; otherwise false
.
Throws:
createIfNotExists
public boolean createIfNotExists(TableRequestOptions options, OperationContext opContext)
Creates the table in the storage service with the specified request options and operation context, if it does not already exist.
Parameters:
null
will use the default request options from the associated service client ( CloudTableClient).
Returns:
true
if the table did not already exist and was created; otherwise false
.
Throws:
delete
public void delete()
Deletes the table from the storage service.
Throws:
delete
public void delete(TableRequestOptions options, OperationContext opContext)
Deletes the table from the storage service, using the specified request options and operation context.
Parameters:
null
will use the default request options from the associated service client ( CloudTableClient).
Throws:
deleteIfExists
public boolean deleteIfExists()
Deletes the table from the storage service, if it exists.
Returns:
true
if the table existed in the storage service and has been deleted; otherwise false
.
Throws:
deleteIfExists
public boolean deleteIfExists(TableRequestOptions options, OperationContext opContext)
Deletes the table from the storage service using the specified request options and operation context, if it exists.
Parameters:
null
will use the default request options from the associated service client ( CloudTableClient).
Returns:
true
if the table existed in the storage service and has been deleted, otherwise false
.Throws:
downloadPermissions
public TablePermissions downloadPermissions()
Downloads the permission settings for the table.
Returns:
Throws:
downloadPermissions
public TablePermissions downloadPermissions(TableRequestOptions options, OperationContext opContext)
Downloads the permissions settings for the table using the specified request options and operation context.
Parameters:
null
will use the default request options from the associated service client ( CloudTableClient).
Returns:
Throws:
execute
public ArrayList
Executes the specified batch operation on a table as an atomic operation. A batch operation may contain up to 100 individual table operations, with the requirement that each operation entity must have same partition key. Only one retrieve operation is allowed per batch. Note that the total payload of a batch operation is limited to 4MB.
This method invokes an Entity Group Transaction on the REST API to execute the specified batch operation on the table as an atomic unit, using the Table service endpoint and storage account credentials of this instance.
Parameters:
Returns:
java.util.ArrayList
of TableResult that contains the results, in order, of each TableOperation in the TableBatchOperation on the named table.Throws:
execute
public ArrayList
Executes the specified batch operation on a table as an atomic operation, using the specified TableRequestOptions and OperationContext. A batch operation may contain up to 100 individual table operations, with the requirement that each operation entity must have same partition key. Only one retrieve operation is allowed per batch. Note that the total payload of a batch operation is limited to 4MB.
This method invokes an Entity Group Transaction on the REST API to execute the specified batch operation on the table as an atomic unit, using the Table service endpoint and storage account credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation.
Parameters:
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
java.util.ArrayList
of TableResult that contains the results, in order, of each TableOperation in the TableBatchOperation on the named table.Throws:
execute
public TableResult execute(final TableOperation operation)
Executes the operation on a table.
This method will invoke the Table Service REST API to execute the specified operation on the table, using the Table service endpoint and storage account credentials of this instance.
Parameters:
Returns:
Throws:
execute
public TableResult execute(final TableOperation operation, final TableRequestOptions options, final OperationContext opContext)
Executes the operation on a table, using the specified TableRequestOptions and OperationContext.
This method will invoke the Table Service REST API to execute the specified operation on the table, using the Table service endpoint and storage account credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation.
Parameters:
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
Throws:
execute
public
Executes a query, applying the specified EntityResolver<T> to the result.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Parameters:
R
.
Returns:
Iterable
interface containing the projection into type R
of the results of executing the query.execute
public
Executes a query, applying the specified EntityResolver<T> to the result, using the specified TableRequestOptions and OperationContext.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation.
Parameters:
R
.
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
Iterable
interface containing the projection into type R
of the results of executing the query.execute
public
Executes a query.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Parameters:
Returns:
Iterable
interface specialized for type T of the results of executing the query.execute
public
Executes a query, using the specified TableRequestOptions and OperationContext.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation.
Parameters:
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
Iterable
interface specialized for type T of the results of executing the query.executeSegmented
public
Executes a query in segmented mode with the specified ResultContinuation continuation token, applying the EntityResolver<T> to the result. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Parameters:
R
.
null
on the initial call. Call the getContinuationToken() method on the result to obtain the ResultContinuation object to use in the next call to resume the query.
Returns:
R
of the results of executing the query.Throws:
executeSegmented
public
Executes a query in segmented mode with the specified ResultContinuation continuation token, using the specified TableRequestOptions and OperationContext, applying the EntityResolver<T> to the result. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation.
Parameters:
R
.
null
on the initial call. Call the getContinuationToken() method on the result to obtain the ResultContinuation object to use in the next call to resume the query.
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
R
of the results of executing the query.Throws:
executeSegmented
public
Executes a query in segmented mode with a ResultContinuation continuation token. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Parameters:
null
on the initial call. Call the getContinuationToken() method on the result to obtain the ResultContinuation object to use in the next call to resume the query.
Returns:
Throws:
executeSegmented
public
Executes a query in segmented mode with a ResultContinuation continuation token, using the specified TableRequestOptions and OperationContext. Executing a query with allows the query to be resumed after returning partial results, using information returned by the server in the ResultSegment<T> object.
This method will invoke a Query Entities operation on the Table Service REST API to query the table, using the Table service endpoint and storage account credentials of this instance.
Use the TableRequestOptions to override execution options such as the timeout or retry policy for the operation.
Parameters:
null
on the initial call. Call the getContinuationToken() method on the result to obtain the ResultContinuation object to use in the next call to resume the query.
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
Throws:
exists
public boolean exists()
Returns a value that indicates whether the table exists in the storage service.
Returns:
true
if the table exists in the storage service; otherwise false
.
Throws:
exists
public boolean exists(TableRequestOptions options, OperationContext opContext)
Returns a value that indicates whether the table exists in the storage service, using the specified request options and operation context.
Parameters:
null
will use the default request options from the associated service client ( CloudTableClient).
Returns:
true
if the table exists in the storage service, otherwise false
.
Throws:
generateSharedAccessSignature
public String generateSharedAccessSignature(final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey)
Creates a shared access signature for the table.
Parameters:
String
which represents a table-level access policy.
String
which represents the starting partition key.
String
which represents the starting row key.
String
which represents the ending partition key.
String
which represents the ending end key.
Returns:
String
containing the shared access signature for the table.Throws:
generateSharedAccessSignature
public String generateSharedAccessSignature(final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey, final IPRange ipRange, final SharedAccessProtocols protocols)
Creates a shared access signature for the table.
Parameters:
String
which represents a table-level access policy.
String
which represents the starting partition key.
String
which represents the starting row key.
String
which represents the ending partition key.
String
which represents the ending end key.
Returns:
String
containing the shared access signature for the table.Throws:
getName
public String getName()
Gets the name of the table.
Returns:
String
object that represents the name of the table.getServiceClient
public CloudTableClient getServiceClient()
Gets the table service client associated with this queue.
Returns:
getStorageUri
public final StorageUri getStorageUri()
Returns the list of URIs for all locations.
Returns:
getUri
public URI getUri()
Gets the absolute URI for this table.
Returns:
java.net.URI
object that represents the URI for this table.uploadPermissions
public void uploadPermissions(final TablePermissions permissions)
Uploads the table's permissions.
Parameters:
Throws:
uploadPermissions
public void uploadPermissions(final TablePermissions permissions, TableRequestOptions options, OperationContext opContext)
Uploads the table's permissions using the specified request options and operation context.
Parameters:
null
will use the default request options from the associated service client ( CloudTableClient).
Throws: