Class AdminDatastoreService
java.lang.Object
com.google.appengine.api.datastore.AdminDatastoreService
- All Implemented Interfaces:
AsyncDatastoreService
,BaseDatastoreService
An AsyncDatastoreService implementation that is pinned to a specific appId and namesapce. This
implementation ignores the "current" appId provided by
ApiProxy.getCurrentEnvironment().getAppId()
and the "current" namespace provided by
NamespaceManager.get()
. Note, this is particularly important in the following methods:
AsyncDatastoreService.getIndexes()
AsyncDatastoreService.getDatastoreAttributes()
AsyncDatastoreService.allocateIds(String, long)
Query
, Entity
and Key
that
are pinned to the same appId/namespace.
Note: users should not access this class directly.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
static final class
-
Method Summary
Modifier and TypeMethodDescriptionallocateIds
(@Nullable Key parent, String kind, long num) allocateIds
(String kind, long num) beginTransaction
(TransactionOptions options) compositeIndexesForQuery
(Query query) compositeIndexForQuery
(Query query) delete
(@Nullable Transaction txn, Key... keys) delete
(@Nullable Transaction txn, Iterable<Key> keys) get
(@Nullable Transaction txn, Key key) get
(@Nullable Transaction txn, Iterable<Key> keys) Returns allTransaction
s started by this thread upon which no attempt to commit or rollback has been made.getAppId()
Returns the current transaction for this thread, or throws an exception if there is no current transaction.getCurrentTransaction
(Transaction returnedIfNoTxn) Returns the current transaction for this thread, or returns the parameter if there is no current transaction.static AdminDatastoreService
getInstance
(DatastoreServiceConfig config, String appId) Returns an AdminUtils instance for the givenappId
and the "" (empty) namespace.static AdminDatastoreService
getInstance
(DatastoreServiceConfig config, String appId, String namespace) Returns an AdminUtils instance for the givenappId
andnamespace
.static AdminDatastoreService
getInstance
(String appId) Returns an AdminUtils instance for the givenappId
and the "" (empty) namespace.static AdminDatastoreService
getInstance
(String appId, String namespace) Returns an AdminUtils instance for the givenappId
andnamespace
.minimumCompositeIndexesForQuery
(Query query, Collection<Index> indexes) minimumCompositeIndexForQuery
(Query query, Collection<Index> indexes) newEntityBuilder
(String kind) newKeyBuilder
(String kind) newQueryBuilder
(String kind) Prepares a query for execution.prepare
(Transaction txn, Query query) Exhibits the same behavior asBaseDatastoreService.prepare(Query)
, but executes within the provided transaction.put
(@Nullable Transaction txn, Entity entity) put
(@Nullable Transaction txn, Iterable<Entity> entities)
-
Method Details
-
getInstance
Returns an AdminUtils instance for the givenappId
and the "" (empty) namespace. -
getInstance
Returns an AdminUtils instance for the givenappId
andnamespace
. -
getInstance
Returns an AdminUtils instance for the givenappId
and the "" (empty) namespace. -
getInstance
public static AdminDatastoreService getInstance(DatastoreServiceConfig config, String appId, String namespace) Returns an AdminUtils instance for the givenappId
andnamespace
. -
getAppId
-
getNamespace
-
newQueryBuilder
-
newQueryBuilder
-
newKeyBuilder
-
newEntityBuilder
-
compositeIndexForQuery
-
compositeIndexesForQuery
-
minimumCompositeIndexForQuery
-
minimumCompositeIndexesForQuery
-
prepare
Description copied from interface:BaseDatastoreService
Prepares a query for execution.This method returns a
PreparedQuery
which can be used to execute and retrieve results from the datastore forquery
.This operation will not execute in a transaction even if there is a current transaction and the provided query is an ancestor query. This operation also ignores the
ImplicitTransactionManagementPolicy
. If you are preparing an ancestory query and you want it to execute in a transaction, useBaseDatastoreService.prepare(Transaction, Query)
.- Specified by:
prepare
in interfaceBaseDatastoreService
- Parameters:
query
- a notnull Query
.- Returns:
- a not
null PreparedQuery
.
-
prepare
Description copied from interface:BaseDatastoreService
Exhibits the same behavior asBaseDatastoreService.prepare(Query)
, but executes within the provided transaction. It is up to the caller to commit or rollback. Transaction can be null.- Specified by:
prepare
in interfaceBaseDatastoreService
-
getCurrentTransaction
Description copied from interface:BaseDatastoreService
Returns the current transaction for this thread, or throws an exception if there is no current transaction. The current transaction is defined as the result of the most recent, same-thread invocation of beginTransaction() that has not been committed or rolled back.Use this method for when you expect there to be a current transaction and consider it an error if there isn't.
- Specified by:
getCurrentTransaction
in interfaceBaseDatastoreService
- Returns:
- The current transaction.
-
getCurrentTransaction
Description copied from interface:BaseDatastoreService
Returns the current transaction for this thread, or returns the parameter if there is no current transaction. You can usenull
or provide your own object to represent null. SeeBaseDatastoreService.getCurrentTransaction()
for a definition of "current transaction."Use this method when you're not sure if there is a current transaction.
- Specified by:
getCurrentTransaction
in interfaceBaseDatastoreService
- Parameters:
returnedIfNoTxn
- The return value of this method if there is no current transaction. Can be null.- Returns:
- The current transaction, or the parameter that was passed in if there is no current transaction.
-
getActiveTransactions
Description copied from interface:BaseDatastoreService
Returns allTransaction
s started by this thread upon which no attempt to commit or rollback has been made.- Specified by:
getActiveTransactions
in interfaceBaseDatastoreService
-
beginTransaction
Description copied from interface:AsyncDatastoreService
- Specified by:
beginTransaction
in interfaceAsyncDatastoreService
-
beginTransaction
Description copied from interface:AsyncDatastoreService
- Specified by:
beginTransaction
in interfaceAsyncDatastoreService
-
get
Description copied from interface:AsyncDatastoreService
- Specified by:
get
in interfaceAsyncDatastoreService
-
get
Description copied from interface:AsyncDatastoreService
- Specified by:
get
in interfaceAsyncDatastoreService
-
get
Description copied from interface:AsyncDatastoreService
- Specified by:
get
in interfaceAsyncDatastoreService
-
get
Description copied from interface:AsyncDatastoreService
- Specified by:
get
in interfaceAsyncDatastoreService
-
put
Description copied from interface:AsyncDatastoreService
- Specified by:
put
in interfaceAsyncDatastoreService
-
put
Description copied from interface:AsyncDatastoreService
- Specified by:
put
in interfaceAsyncDatastoreService
-
put
Description copied from interface:AsyncDatastoreService
- Specified by:
put
in interfaceAsyncDatastoreService
-
put
Description copied from interface:AsyncDatastoreService
- Specified by:
put
in interfaceAsyncDatastoreService
-
delete
Description copied from interface:AsyncDatastoreService
- Specified by:
delete
in interfaceAsyncDatastoreService
-
delete
Description copied from interface:AsyncDatastoreService
- Specified by:
delete
in interfaceAsyncDatastoreService
-
delete
Description copied from interface:AsyncDatastoreService
- Specified by:
delete
in interfaceAsyncDatastoreService
-
delete
Description copied from interface:AsyncDatastoreService
- Specified by:
delete
in interfaceAsyncDatastoreService
-
allocateIds
Description copied from interface:AsyncDatastoreService
- Specified by:
allocateIds
in interfaceAsyncDatastoreService
-
allocateIds
Description copied from interface:AsyncDatastoreService
- Specified by:
allocateIds
in interfaceAsyncDatastoreService
-
getDatastoreAttributes
Description copied from interface:AsyncDatastoreService
- Specified by:
getDatastoreAttributes
in interfaceAsyncDatastoreService
-
getIndexes
Description copied from interface:AsyncDatastoreService
- Specified by:
getIndexes
in interfaceAsyncDatastoreService
-