Class AdminDatastoreService
- java.lang.Object
-
- com.google.appengine.api.datastore.AdminDatastoreService
-
- All Implemented Interfaces:
AsyncDatastoreService,BaseDatastoreService
public final class AdminDatastoreService extends Object implements AsyncDatastoreService
An AsyncDatastoreService implementation that is pinned to a specific appId and namesapce. This implementation ignores the "current" appId provided byApiProxy.getCurrentEnvironment().getAppId()and the "current" namespace provided byNamespaceManager.get(). Note, this is particularly important in the following methods:AsyncDatastoreService.getIndexes()AsyncDatastoreService.getDatastoreAttributes()AsyncDatastoreService.allocateIds(String, long)
Query,EntityandKeythat are pinned to the same appId/namespace.Note: users should not access this class directly.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAdminDatastoreService.EntityBuilderstatic classAdminDatastoreService.KeyBuilderstatic classAdminDatastoreService.QueryBuilder
-
Method Summary
-
-
-
Method Detail
-
getInstance
public static AdminDatastoreService getInstance(String appId)
Returns an AdminUtils instance for the givenappIdand the "" (empty) namespace.
-
getInstance
public static AdminDatastoreService getInstance(String appId, String namespace)
Returns an AdminUtils instance for the givenappIdandnamespace.
-
getInstance
public static AdminDatastoreService getInstance(DatastoreServiceConfig config, String appId)
Returns an AdminUtils instance for the givenappIdand the "" (empty) namespace.
-
getInstance
public static AdminDatastoreService getInstance(DatastoreServiceConfig config, String appId, String namespace)
Returns an AdminUtils instance for the givenappIdandnamespace.
-
getAppId
public String getAppId()
-
getNamespace
public String getNamespace()
-
newQueryBuilder
public AdminDatastoreService.QueryBuilder newQueryBuilder()
-
newQueryBuilder
public AdminDatastoreService.QueryBuilder newQueryBuilder(String kind)
-
newKeyBuilder
public AdminDatastoreService.KeyBuilder newKeyBuilder(String kind)
-
newEntityBuilder
public AdminDatastoreService.EntityBuilder newEntityBuilder(String kind)
-
minimumCompositeIndexForQuery
public Index minimumCompositeIndexForQuery(Query query, Collection<Index> indexes)
-
minimumCompositeIndexesForQuery
public Set<Index> minimumCompositeIndexesForQuery(Query query, Collection<Index> indexes)
-
prepare
public PreparedQuery prepare(Query query)
Description copied from interface:BaseDatastoreServicePrepares a query for execution.This method returns a
PreparedQuerywhich 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:
preparein interfaceBaseDatastoreService- Parameters:
query- a notnull Query.- Returns:
- a not
null PreparedQuery.
-
prepare
public PreparedQuery prepare(Transaction txn, Query query)
Description copied from interface:BaseDatastoreServiceExhibits 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:
preparein interfaceBaseDatastoreService
-
getCurrentTransaction
public Transaction getCurrentTransaction()
Description copied from interface:BaseDatastoreServiceReturns 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:
getCurrentTransactionin interfaceBaseDatastoreService- Returns:
- The current transaction.
-
getCurrentTransaction
public Transaction getCurrentTransaction(Transaction returnedIfNoTxn)
Description copied from interface:BaseDatastoreServiceReturns the current transaction for this thread, or returns the parameter if there is no current transaction. You can usenullor 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:
getCurrentTransactionin 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
public Collection<Transaction> getActiveTransactions()
Description copied from interface:BaseDatastoreServiceReturns allTransactions started by this thread upon which no attempt to commit or rollback has been made.- Specified by:
getActiveTransactionsin interfaceBaseDatastoreService
-
beginTransaction
public Future<Transaction> beginTransaction()
Description copied from interface:AsyncDatastoreService- Specified by:
beginTransactionin interfaceAsyncDatastoreService
-
beginTransaction
public Future<Transaction> beginTransaction(TransactionOptions options)
Description copied from interface:AsyncDatastoreService- Specified by:
beginTransactionin interfaceAsyncDatastoreService
-
get
public Future<Entity> get(Key key)
Description copied from interface:AsyncDatastoreService- Specified by:
getin interfaceAsyncDatastoreService
-
get
public Future<Entity> get(@Nullable Transaction txn, Key key)
Description copied from interface:AsyncDatastoreService- Specified by:
getin interfaceAsyncDatastoreService
-
get
public Future<Map<Key,Entity>> get(Iterable<Key> keys)
Description copied from interface:AsyncDatastoreService- Specified by:
getin interfaceAsyncDatastoreService
-
get
public Future<Map<Key,Entity>> get(@Nullable Transaction txn, Iterable<Key> keys)
Description copied from interface:AsyncDatastoreService- Specified by:
getin interfaceAsyncDatastoreService
-
put
public Future<Key> put(Entity entity)
Description copied from interface:AsyncDatastoreService- Specified by:
putin interfaceAsyncDatastoreService
-
put
public Future<Key> put(@Nullable Transaction txn, Entity entity)
Description copied from interface:AsyncDatastoreService- Specified by:
putin interfaceAsyncDatastoreService
-
put
public Future<List<Key>> put(Iterable<Entity> entities)
Description copied from interface:AsyncDatastoreService- Specified by:
putin interfaceAsyncDatastoreService
-
put
public Future<List<Key>> put(@Nullable Transaction txn, Iterable<Entity> entities)
Description copied from interface:AsyncDatastoreService- Specified by:
putin interfaceAsyncDatastoreService
-
delete
public Future<Void> delete(Key... keys)
Description copied from interface:AsyncDatastoreService- Specified by:
deletein interfaceAsyncDatastoreService
-
delete
public Future<Void> delete(@Nullable Transaction txn, Key... keys)
Description copied from interface:AsyncDatastoreService- Specified by:
deletein interfaceAsyncDatastoreService
-
delete
public Future<Void> delete(Iterable<Key> keys)
Description copied from interface:AsyncDatastoreService- Specified by:
deletein interfaceAsyncDatastoreService
-
delete
public Future<Void> delete(@Nullable Transaction txn, Iterable<Key> keys)
Description copied from interface:AsyncDatastoreService- Specified by:
deletein interfaceAsyncDatastoreService
-
allocateIds
public Future<KeyRange> allocateIds(String kind, long num)
Description copied from interface:AsyncDatastoreService- Specified by:
allocateIdsin interfaceAsyncDatastoreService
-
allocateIds
public Future<KeyRange> allocateIds(@Nullable Key parent, String kind, long num)
Description copied from interface:AsyncDatastoreService- Specified by:
allocateIdsin interfaceAsyncDatastoreService
-
getDatastoreAttributes
public Future<DatastoreAttributes> getDatastoreAttributes()
Description copied from interface:AsyncDatastoreService- Specified by:
getDatastoreAttributesin interfaceAsyncDatastoreService
-
getIndexes
public Future<Map<Index,Index.IndexState>> getIndexes()
Description copied from interface:AsyncDatastoreService- Specified by:
getIndexesin interfaceAsyncDatastoreService
-
-