public final class CloudTable extends Object
Constructor and Description |
---|
CloudTable(StorageUri uri)
Creates an instance of the
CloudTable class using the specified table URI. |
CloudTable(StorageUri uri,
StorageCredentials credentials)
Creates an instance of the
CloudTable class using the specified table StorageUri and credentials. |
CloudTable(URI uri)
Creates an instance of the
CloudTable class using the specified table URI. |
CloudTable(URI uri,
StorageCredentials credentials)
Creates an instance of the
CloudTable class using the specified table URI and credentials. |
Modifier and Type | Method and Description |
---|---|
void |
create()
Creates the table in the storage service with default request options.
|
void |
create(TableRequestOptions options,
OperationContext opContext)
Creates the table in the storage service, using the specified
TableRequestOptions and
OperationContext . |
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.
|
TablePermissions |
downloadPermissions()
Downloads the permission settings for the table.
|
TablePermissions |
downloadPermissions(TableRequestOptions options,
OperationContext opContext)
Downloads the permissions settings for the table using the specified request options and operation context.
|
ArrayList<TableResult> |
execute(TableBatchOperation batch)
Executes the specified batch operation on a table as an atomic operation.
|
ArrayList<TableResult> |
execute(TableBatchOperation batch,
TableRequestOptions options,
OperationContext opContext)
Executes the specified batch operation on a table as an atomic operation, using the specified
TableRequestOptions and OperationContext . |
TableResult |
execute(TableOperation operation)
Executes the operation on a table.
|
TableResult |
execute(TableOperation operation,
TableRequestOptions options,
OperationContext opContext)
Executes the operation on a table, using the specified
TableRequestOptions and OperationContext . |
<R> Iterable<R> |
execute(TableQuery<?> query,
EntityResolver<R> resolver)
Executes a query, applying the specified
EntityResolver to the result. |
<R> Iterable<R> |
execute(TableQuery<?> query,
EntityResolver<R> resolver,
TableRequestOptions options,
OperationContext opContext)
Executes a query, applying the specified
EntityResolver to the result, using the
specified TableRequestOptions and OperationContext . |
<T extends TableEntity> |
execute(TableQuery<T> query)
Executes a query.
|
<T extends TableEntity> |
execute(TableQuery<T> query,
TableRequestOptions options,
OperationContext opContext)
Executes a query, using the specified
TableRequestOptions and OperationContext . |
<R> ResultSegment<R> |
executeSegmented(TableQuery<?> query,
EntityResolver<R> resolver,
ResultContinuation continuationToken)
Executes a query in segmented mode with the specified
ResultContinuation continuation token,
applying the EntityResolver to the result. |
<R> ResultSegment<R> |
executeSegmented(TableQuery<?> query,
EntityResolver<R> resolver,
ResultContinuation continuationToken,
TableRequestOptions options,
OperationContext opContext)
Executes a query in segmented mode with the specified
ResultContinuation continuation token,
using the specified TableRequestOptions and OperationContext , applying the EntityResolver
to the result. |
<T extends TableEntity> |
executeSegmented(TableQuery<T> query,
ResultContinuation continuationToken)
Executes a query in segmented mode with a
ResultContinuation continuation token. |
<T extends TableEntity> |
executeSegmented(TableQuery<T> query,
ResultContinuation continuationToken,
TableRequestOptions options,
OperationContext opContext)
Executes a query in segmented mode with a
ResultContinuation continuation token,
using the specified TableRequestOptions and OperationContext . |
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(SharedAccessTablePolicy policy,
String accessPolicyIdentifier,
String startPartitionKey,
String startRowKey,
String endPartitionKey,
String endRowKey)
Creates a shared access signature for the table.
|
String |
generateSharedAccessSignature(SharedAccessTablePolicy policy,
String accessPolicyIdentifier,
String startPartitionKey,
String startRowKey,
String endPartitionKey,
String endRowKey,
IPRange ipRange,
SharedAccessProtocols protocols)
Creates a shared access signature for the table.
|
String |
getName()
Gets the name of the table.
|
CloudTableClient |
getServiceClient()
Gets the table service client associated with this queue.
|
StorageUri |
getStorageUri()
Returns the list of URIs for all locations.
|
URI |
getUri()
Gets the absolute URI for this table.
|
void |
uploadPermissions(TablePermissions permissions)
Uploads the table's permissions.
|
void |
uploadPermissions(TablePermissions permissions,
TableRequestOptions options,
OperationContext opContext)
Uploads the table's permissions using the specified request options and operation context.
|
public CloudTable(URI uri) throws StorageException
CloudTable
class using the specified table URI. The table URI must
include a SAS token.uri
- A java.net.URI
object that represents the absolute URI of the table.StorageException
- If a storage service error occurred.public CloudTable(StorageUri uri) throws StorageException
CloudTable
class using the specified table URI. The table URI must
include a SAS token.uri
- A StorageUri
object that represents the absolute URI of the table.StorageException
- If a storage service error occurred.public CloudTable(URI uri, StorageCredentials credentials) throws StorageException
CloudTable
class using the specified table URI and credentials.uri
- A java.net.URI
object that represents the absolute URI of the table.credentials
- A StorageCredentials
object used to authenticate access.StorageException
- If a storage service error occurred.public CloudTable(StorageUri uri, StorageCredentials credentials) throws StorageException
CloudTable
class using the specified table StorageUri and credentials.uri
- A StorageUri
object that represents the absolute StorageUri of the table.credentials
- A StorageCredentials
object used to authenticate access.StorageException
- If a storage service error occurred.public String getName()
String
object that represents the name of the table.public CloudTableClient getServiceClient()
CloudTableClient
object that represents the service client associated with this table.public final StorageUri getStorageUri()
StorageUri
that represents the list of URIs for all locations..public URI getUri()
java.net.URI
object that represents the URI for this table.@DoesServiceRequest public void create() throws StorageException
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.
StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public void create(TableRequestOptions options, OperationContext opContext) throws StorageException
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.
options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null
to use the request options specified on the
CloudTableClient
.opContext
- An OperationContext
object for tracking the current operation. Specify null
to
safely ignore operation context.StorageException
- If an error occurs accessing the storage service, or because the table cannot be
created, or already exists.@DoesServiceRequest public boolean createIfNotExists() throws StorageException
true
if the table is created in the storage service; otherwise false
.StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public boolean createIfNotExists(TableRequestOptions options, OperationContext opContext) throws StorageException
options
- A TableRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudTableClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true
if the table did not already exist and was created; otherwise false
.StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public void delete() throws StorageException
StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public void delete(TableRequestOptions options, OperationContext opContext) throws StorageException
options
- A TableRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudTableClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public boolean deleteIfExists() throws StorageException
true
if the table existed in the storage service and has been deleted; otherwise
false
.StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public boolean deleteIfExists(TableRequestOptions options, OperationContext opContext) throws StorageException
options
- A TableRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudTableClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true
if the table existed in the storage service and has been deleted, otherwise
false
.StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public ArrayList<TableResult> execute(TableBatchOperation batch) throws StorageException
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.
batch
- The TableBatchOperation
object representing the operations to execute on the table.java.util.ArrayList
of TableResult
that contains the results, in order, of
each TableOperation
in the TableBatchOperation
on the named table.StorageException
- if an error occurs accessing the storage service, or the operation fails.@DoesServiceRequest public ArrayList<TableResult> execute(TableBatchOperation batch, TableRequestOptions options, OperationContext opContext) throws StorageException
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.
batch
- The TableBatchOperation
object representing the operations to execute on the table.options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null
to use the request options specified on the
CloudTableClient
.opContext
- An OperationContext
object for tracking the current operation. Specify null
to
safely ignore operation context.java.util.ArrayList
of TableResult
that contains the results, in order, of
each TableOperation
in the TableBatchOperation
on the named table.StorageException
- if an error occurs accessing the storage service, or the operation fails.@DoesServiceRequest public TableResult execute(TableOperation operation) throws StorageException
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.
operation
- The TableOperation
object representing the operation to execute on the table.TableResult
containing the result of executing the TableOperation
on the table.StorageException
- if an error occurs accessing the storage service, or the operation fails.@DoesServiceRequest public TableResult execute(TableOperation operation, TableRequestOptions options, OperationContext opContext) throws StorageException
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.
operation
- The TableOperation
object representing the operation to execute on the table.options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null
to use the request options specified on the
CloudTableClient
.opContext
- An OperationContext
object for tracking the current operation. Specify null
to
safely ignore operation context.TableResult
containing the result of executing the TableOperation
on the table.StorageException
- if an error occurs accessing the storage service, or the operation fails.@DoesServiceRequest public <R> Iterable<R> execute(TableQuery<?> query, EntityResolver<R> resolver)
EntityResolver
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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use.resolver
- An EntityResolver
instance which creates a projection of the table query result entities into
the specified type R
.Iterable
interface containing the projection into type
R
of the results of executing the query.@DoesServiceRequest public <R> Iterable<R> execute(TableQuery<?> query, EntityResolver<R> resolver, TableRequestOptions options, OperationContext opContext)
EntityResolver
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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use.resolver
- An EntityResolver
instance which creates a projection of the table query result entities into
the specified type R
.options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null
to use the request options specified on the
CloudTableClient
.opContext
- An OperationContext
object for tracking the current operation. Specify null
to
safely ignore operation context.Iterable
interface containing the projection into type
R
of the results of executing the query.@DoesServiceRequest public <T extends TableEntity> Iterable<T> execute(TableQuery<T> 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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use,
specialized for a type T implementing TableEntity
.Iterable
interface specialized for type T of the results of
executing the query.@DoesServiceRequest public <T extends TableEntity> Iterable<T> execute(TableQuery<T> query, TableRequestOptions options, OperationContext opContext)
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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use,
specialized for a type T implementing TableEntity
.options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null
to use the request options specified on the
CloudTableClient
.opContext
- An OperationContext
object for tracking the current operation. Specify null
to
safely ignore operation context.Iterable
interface specialized for type T of the results of
executing the query.@DoesServiceRequest public <R> ResultSegment<R> executeSegmented(TableQuery<?> query, EntityResolver<R> resolver, ResultContinuation continuationToken) throws StorageException
ResultContinuation
continuation token,
applying the EntityResolver
to the result.
Executing a query with executeSegmented
allows the query to be resumed after returning partial
results, using information returned by the server in the ResultSegment
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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use.resolver
- An EntityResolver
instance which creates a projection of the table query result entities into
the specified type R
.continuationToken
- A ResultContinuation
object representing a continuation token from the server when the
operation returns a partial result. Specify null
on the initial call. Call the
ResultSegment.getContinuationToken()
method on the result to obtain the
ResultContinuation
object to use in the next call to resume the query.ResultSegment
containing the projection into type R
of the results of executing
the query.StorageException
- if a storage service error occurred during the operation.@DoesServiceRequest public <R> ResultSegment<R> executeSegmented(TableQuery<?> query, EntityResolver<R> resolver, ResultContinuation continuationToken, TableRequestOptions options, OperationContext opContext) throws StorageException
ResultContinuation
continuation token,
using the specified TableRequestOptions
and OperationContext
, applying the EntityResolver
to the result.
Executing a query with executeSegmented
allows the query to be resumed after returning partial
results, using information returned by the server in the ResultSegment
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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use.resolver
- An EntityResolver
instance which creates a projection of the table query result entities into
the specified type R
.continuationToken
- A ResultContinuation
object representing a continuation token from the server when the
operation returns a partial result. Specify null
on the initial call. Call the
ResultSegment.getContinuationToken()
method on the result to obtain the
ResultContinuation
object to use in the next call to resume the query.options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null
to use the request options specified on the
CloudTableClient
.opContext
- An OperationContext
object for tracking the current operation. Specify null
to
safely ignore operation context.ResultSegment
containing the projection into type R
of the results of executing
the query.StorageException
- if a storage service error occurred during the operation.@DoesServiceRequest public <T extends TableEntity> ResultSegment<T> executeSegmented(TableQuery<T> query, ResultContinuation continuationToken) throws StorageException
ResultContinuation
continuation token.
Executing a query with executeSegmented
allows the query to be resumed after returning partial
results, using information returned by the server in the ResultSegment
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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use,
specialized for a type T implementing TableEntity
.continuationToken
- A ResultContinuation
object representing a continuation token from the server when the
operation returns a partial result. Specify null
on the initial call. Call the
ResultSegment.getContinuationToken()
method on the result to obtain the
ResultContinuation
object to use in the next call to resume the query.ResultSegment
specialized for type T of the results of executing the query.StorageException
- if a storage service error occurred during the operation.@DoesServiceRequest public <T extends TableEntity> ResultSegment<T> executeSegmented(TableQuery<T> query, ResultContinuation continuationToken, TableRequestOptions options, OperationContext opContext) throws StorageException
ResultContinuation
continuation token,
using the specified TableRequestOptions
and OperationContext
.
Executing a query with executeSegmented
allows the query to be resumed after returning partial
results, using information returned by the server in the ResultSegment
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.
query
- A TableQuery
instance specifying the table to query and the query parameters to use,
specialized for a type T implementing TableEntity
.continuationToken
- A ResultContinuation
object representing a continuation token from the server when the
operation returns a partial result. Specify null
on the initial call. Call the
ResultSegment.getContinuationToken()
method on the result to obtain the
ResultContinuation
object to use in the next call to resume the query.options
- A TableRequestOptions
object that specifies execution options such as retry policy and timeout
settings for the operation. Specify null
to use the request options specified on the
CloudTableClient
.opContext
- An OperationContext
object for tracking the current operation. Specify null
to
safely ignore operation context.ResultSegment
specialized for type T of the results of executing the query.StorageException
- if a storage service error occurred during the operation.@DoesServiceRequest public boolean exists() throws StorageException
true
if the table exists in the storage service; otherwise false
.StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public boolean exists(TableRequestOptions options, OperationContext opContext) throws StorageException
options
- A TableRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudTableClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true
if the table exists in the storage service, otherwise false
.StorageException
- If a storage service error occurred during the operation.@DoesServiceRequest public void uploadPermissions(TablePermissions permissions) throws StorageException
permissions
- A TablePermissions
object that represents the permissions to upload.StorageException
- If a storage service error occurred.@DoesServiceRequest public void uploadPermissions(TablePermissions permissions, TableRequestOptions options, OperationContext opContext) throws StorageException
permissions
- A TablePermissions
object that represents the permissions to upload.options
- A TableRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudTableClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException
- If a storage service error occurred.@DoesServiceRequest public TablePermissions downloadPermissions() throws StorageException
TablePermissions
object that represents the container's permissions.StorageException
- If a storage service error occurred.@DoesServiceRequest public TablePermissions downloadPermissions(TableRequestOptions options, OperationContext opContext) throws StorageException
options
- A TableRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudTableClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.TablePermissions
object that represents the table's permissions.StorageException
- If a storage service error occurred.public String generateSharedAccessSignature(SharedAccessTablePolicy policy, String accessPolicyIdentifier, String startPartitionKey, String startRowKey, String endPartitionKey, String endRowKey) throws InvalidKeyException, StorageException
policy
- A SharedAccessTablePolicy
object which represents the access policy for the shared access
signature.accessPolicyIdentifier
- A String
which represents a table-level access policy.startPartitionKey
- A String
which represents the starting partition key.startRowKey
- A String
which represents the starting row key.endPartitionKey
- A String
which represents the ending partition key.endRowKey
- A String
which represents the ending end key.String
containing the shared access signature for the table.InvalidKeyException
- If an invalid key was passed.StorageException
- If a storage service error occurred.IllegalArgumentException
- If an unexpected value is passed.public String generateSharedAccessSignature(SharedAccessTablePolicy policy, String accessPolicyIdentifier, String startPartitionKey, String startRowKey, String endPartitionKey, String endRowKey, IPRange ipRange, SharedAccessProtocols protocols) throws InvalidKeyException, StorageException
policy
- A SharedAccessTablePolicy
object which represents the access policy for the shared access
signature.accessPolicyIdentifier
- A String
which represents a table-level access policy.startPartitionKey
- A String
which represents the starting partition key.startRowKey
- A String
which represents the starting row key.endPartitionKey
- A String
which represents the ending partition key.endRowKey
- A String
which represents the ending end key.ipRange
- A IPRange
object containing the range of allowed IP addresses.protocols
- A SharedAccessProtocols
representing the allowed Internet protocols.String
containing the shared access signature for the table.InvalidKeyException
- If an invalid key was passed.StorageException
- If a storage service error occurred.IllegalArgumentException
- If an unexpected value is passed.Copyright © 2018. All Rights Reserved.