CloudTableClient Class
- java.
lang. Object - ServiceClient
- com.
microsoft. azure. storage. table. CloudTableClient
- com.
public class CloudTableClient extends ServiceClient
Provides a service client for accessing the Microsoft Azure Table service.
The CloudTableClient class encapsulates the base URI for the Table service endpoint and the credentials for accessing the storage account, and provides methods to create, delete, list, and query tables, as well as methods to execute operations and queries on table entities. These methods invoke Storage Service REST API operations to make the requests and obtain the results that are returned.
A Table service endpoint is the base URI for Table service resources, including the DNS name of the storage account:
For more information, see the MSDN topic Addressing Table Service Resources.
The credentials can be a combination of the storage account name and a key, or a shared access signature. For more information, see the MSDN topic Authenticating Access to Your Storage Account.
Constructor Summary
Constructor | Description |
---|---|
CloudTableClient(final StorageUri baseUri, StorageCredentials credentials) |
Initializes an instance of the class using a Table service endpoint and storage account credentials. |
CloudTableClient(final URI baseUri, StorageCredentials credentials) |
Initializes an instance of the class using a Table service endpoint and storage account credentials. |
Method Summary
Modifier and Type | Method and Description |
---|---|
final Service |
downloadServiceProperties()
Retrieves the current ServiceProperties for the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations. |
final Service |
downloadServiceProperties(TableRequestOptions options, OperationContext opContext)
Retrieves the current ServiceProperties for the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations. |
<T extends Table |
executeQuerySegmentedImpl(final TableQuery<T> queryToExecute, final EntityResolver<R> resolver, final ResultContinuation continuationToken, TableRequestOptions options, OperationContext opContext)
Reserved for internal use. Executes a segmented query operation using the specified retry and timeout policies. |
<T extends Table |
generateIteratorForQuery(final TableQuery<T> queryRef, final EntityResolver<R> resolver, TableRequestOptions options, OperationContext opContext)
Reserved for internal use. Generates an iterator for a segmented query operation. |
Table |
getDefaultRequestOptions()
Gets the TableRequestOptions that is used for requests associated with this |
Service |
getServiceStats()
Queries the service for the ServiceStats. |
Service |
getServiceStats(TableRequestOptions options, OperationContext opContext)
Queries the given storage service for the ServiceStats. |
Cloud |
getTableReference(final String tableName)
Gets a CloudTable object with the specified name. |
final Storage |
getTransformedEndPoint(final OperationContext opContext) |
boolean |
isUsePathStyleUris()
Indicates whether path-style URIs are used. |
Iterable<String> |
listTables()
Lists the table names in the storage account. This method invokes the Query Tables REST API to list the table names, using the Table service endpoint and storage account credentials of this instance. |
Iterable<String> |
listTables(final String prefix)
Lists the table names in the storage account that match the specified prefix. This method invokes the Query Tables REST API to list the table names that match the prefix, using the Table service endpoint and storage account credentials of this instance. |
Iterable<String> |
listTables(final String prefix, final TableRequestOptions options, final OperationContext opContext)
Lists the table names in the storage account that match the specified prefix, using the specified TableRequestOptions and OperationContext. This method invokes the Query Tables REST API to list the table names that match the prefix, 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. |
Result |
listTablesSegmented()
Lists the table names in the storage account in segmented mode. This method allows listing of tables to be resumed after returning a partial set of results, using information returned by the server in the ResultSegment<T> object. This method invokes the Query Tables REST API to list the table names, using the Table service endpoint and storage account credentials of this instance. |
Result |
listTablesSegmented(final String prefix)
Lists the table names in the storage account that match the specified prefix in segmented mode. This method allows listing of tables to be resumed after returning a partial set of results, using information returned by the server in the ResultSegment<T> object. This method invokes the Query Tables REST API to list the table names that match the prefix, using the Table service endpoint and storage account credentials of this instance. |
Result |
listTablesSegmented(final String prefix, final Integer maxResults, final ResultContinuation continuationToken, final TableRequestOptions options, final OperationContext opContext)
Lists up to the specified maximum of the table names in the storage account that match the specified prefix in a resumable mode with the specified ResultContinuation continuation token, using the specified TableRequestOptions and OperationContext. This method allows listing of tables to be resumed after returning a page of results, using information returned by the server in the ResultSegment<T> object. This method invokes the Query Tables REST API to list the table names that match the prefix, 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. |
void |
setDefaultRequestOptions(TableRequestOptions defaultRequestOptions)
Sets the TableRequestOptions that is used for any table accessed with this object. |
void |
uploadServiceProperties(final ServiceProperties properties)
Uploads a new ServiceProperties configuration to the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations. |
void |
uploadServiceProperties(final ServiceProperties properties, TableRequestOptions options, OperationContext opContext)
Uploads a new ServiceProperties configuration to the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations. |
Inherited Members
Constructor Details
CloudTableClient
public CloudTableClient(final StorageUri baseUri, StorageCredentials credentials)
Initializes an instance of the class using a Table service endpoint and storage account credentials.
Parameters:
CloudTableClient
public CloudTableClient(final URI baseUri, StorageCredentials credentials)
Initializes an instance of the class using a Table service endpoint and storage account credentials.
Parameters:
java.net.URI
object that represents the Table service endpoint used to initialize the client.
Method Details
downloadServiceProperties
public final ServiceProperties downloadServiceProperties()
Retrieves the current ServiceProperties for the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations.
Returns:
Throws:
downloadServiceProperties
public final ServiceProperties downloadServiceProperties(TableRequestOptions options, OperationContext opContext)
Retrieves the current ServiceProperties for the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations.
Parameters:
null
will use the default request options from the associated service client ( CloudBlobClient).
Returns:
Throws:
executeQuerySegmentedImpl
protected
Reserved for internal use. Executes a segmented query operation using the specified retry and timeout policies.
Parameters:
R
. Pass null
to return the results as the table entity type.
null
for an initial query.
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
Throws:
generateIteratorForQuery
protected
Reserved for internal use. Generates an iterator for a segmented query operation.
Parameters:
R
. Pass null
to return the results as the table entity type.
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
Iterable
specialized for the TableEntity or EntityResolver<T> type returned by the query.getDefaultRequestOptions
public TableRequestOptions getDefaultRequestOptions()
Gets the TableRequestOptions that is used for requests associated with this
Returns:
CloudTableClient
getServiceStats
public ServiceStats getServiceStats()
Queries the service for the ServiceStats.
Returns:
ServiceStats for the given storage service
Throws:
getServiceStats
public ServiceStats getServiceStats(TableRequestOptions options, OperationContext opContext)
Queries the given storage service for the ServiceStats.
Parameters:
null
will use the default request options from the associated service client ( CloudBlobClient).
Returns:
ServiceStats for the given storage service
Throws:
getTableReference
public CloudTable getTableReference(final String tableName)
Gets a CloudTable object with the specified name.
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".
Returns:
Throws:
getTransformedEndPoint
protected final StorageUri getTransformedEndPoint(final OperationContext opContext)
Parameters:
isUsePathStyleUris
protected boolean isUsePathStyleUris()
Indicates whether path-style URIs are used.
Returns:
true
if path-style URIs are used; otherwise false
.
listTables
public Iterable
Lists the table names in the storage account.
This method invokes the Query Tables REST API to list the table names, using the Table service endpoint and storage account credentials of this instance.
Returns:
Iterable
collection of the table names in the storage account retrieved lazily.listTables
public Iterable
Lists the table names in the storage account that match the specified prefix.
This method invokes the Query Tables REST API to list the table names that match the prefix, using the Table service endpoint and storage account credentials of this instance.
Parameters:
String
containing the prefix to match on table names to return.
Returns:
Iterable
collection of the table names in the storage account retrieved lazily that match the specified prefix.listTables
public Iterable
Lists the table names in the storage account that match the specified prefix, using the specified TableRequestOptions and OperationContext.
This method invokes the Query Tables REST API to list the table names that match the prefix, 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:
String
containing the prefix to match on table names to return.
null
to use the request options specified on the CloudTableClient.
null
to safely ignore operation context.
Returns:
Iterable
collection of the table names in the storage account retrieved lazily that match the specified prefix.listTablesSegmented
public ResultSegment
Lists the table names in the storage account in segmented mode. This method allows listing of tables to be resumed after returning a partial set of results, using information returned by the server in the ResultSegment<T> object.
This method invokes the Query Tables REST API to list the table names, using the Table service endpoint and storage account credentials of this instance.
Returns:
String
objects containing table names in the storage account.Throws:
listTablesSegmented
public ResultSegment
Lists the table names in the storage account that match the specified prefix in segmented mode. This method allows listing of tables to be resumed after returning a partial set of results, using information returned by the server in the ResultSegment<T> object.
This method invokes the Query Tables REST API to list the table names that match the prefix, using the Table service endpoint and storage account credentials of this instance.
Parameters:
String
containing the prefix to match on table names to return.
Returns:
String
objects containing table names matching the prefix in the storage account.Throws:
listTablesSegmented
public ResultSegment
Lists up to the specified maximum of the table names in the storage account that match the specified prefix in a resumable mode with the specified ResultContinuation continuation token, using the specified TableRequestOptions and OperationContext. This method allows listing of tables to be resumed after returning a page of results, using information returned by the server in the ResultSegment<T> object.
This method invokes the Query Tables REST API to list the table names that match the prefix, 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:
String
containing the prefix to match on table names to return.
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:
String
objects containing table names in the storage account.Throws:
setDefaultRequestOptions
public void setDefaultRequestOptions(TableRequestOptions defaultRequestOptions)
Sets the TableRequestOptions that is used for any table accessed with this object.
Parameters:
uploadServiceProperties
public void uploadServiceProperties(final ServiceProperties properties)
Uploads a new ServiceProperties configuration to the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations.
Parameters:
Throws:
uploadServiceProperties
public void uploadServiceProperties(final ServiceProperties properties, TableRequestOptions options, OperationContext opContext)
Uploads a new ServiceProperties configuration to the given storage service. This includes Logging, HourMetrics, MinuteMetrics and CORS configurations.
Parameters:
null
will use the default request options from the associated service client ( CloudBlobClient).
Throws: