com.google.appengine.api.datastore
Class CloudDatastoreRemoteServiceConfig
- java.lang.Object
 - 
- com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig
 
 
- 
public abstract class CloudDatastoreRemoteServiceConfig extends java.lang.ObjectUser-configurable global properties of Cloud Datastore.Code not running in App Engine Standard can use the Cloud Datastore API by making a single call to
setConfig(com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig)before accessing any other classes fromcom.google.appengine.api. For example: Outside of tests, the config should not be cleared once it has been set. In tests, the config can be cleared by callingpublic static void main(Strings[] args) { CloudDatastoreRemoteServiceConfig config = CloudDatastoreRemoteServiceConfig.builder() .appId(AppId.create(Location.US_CENTRAL, "my-project-id")) .build(); CloudDatastoreRemoteServiceConfig.setConfig(config); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); ... }clear(): By default, this configuration uses application-default credentials.@Before public void before() { CloudDatastoreRemoteServiceConfig config = CloudDatastoreRemoteServiceConfig.builder() .appId(AppId.create(Location.US_CENTRAL, "my-project-id")) .emulatorHost(...) .build(); CloudDatastoreRemoteServiceConfig.setConfig(config); } @After public void after() { CloudDatastoreRemoteServiceConfig.clear(); } 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classCloudDatastoreRemoteServiceConfig.AppIdAn App Engine application ID.static classCloudDatastoreRemoteServiceConfig.BuilderBuilder forCloudDatastoreRemoteServiceConfig. 
- 
Constructor Summary
Constructors Constructor and Description CloudDatastoreRemoteServiceConfig() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static CloudDatastoreRemoteServiceConfig.Builderbuilder()Returns aCloudDatastoreRemoteServiceConfig.Builder.static voidclear()Clears theCloudDatastoreRemoteServiceConfiginstance (if one has been set) as well as theApiProxy'sApiProxy.EnvironmentFactoryand theApiProxy.Environmentfor the current thread.static voidsetConfig(CloudDatastoreRemoteServiceConfig config)Sets theCloudDatastoreRemoteServiceConfiginstance. 
 - 
 
- 
- 
Method Detail
- 
setConfig
public static void setConfig(CloudDatastoreRemoteServiceConfig config)
Sets theCloudDatastoreRemoteServiceConfiginstance.- Throws:
 java.lang.IllegalStateException- if theCloudDatastoreRemoteServiceConfiginstance has already been set andclear()has not been calledjava.lang.IllegalStateException- if the providedCloudDatastoreRemoteServiceConfigis not supported in this environment
 
- 
clear
public static void clear()
Clears theCloudDatastoreRemoteServiceConfiginstance (if one has been set) as well as theApiProxy'sApiProxy.EnvironmentFactoryand theApiProxy.Environmentfor the current thread.This method should only be called in tests.
 
- 
builder
public static CloudDatastoreRemoteServiceConfig.Builder builder()
Returns aCloudDatastoreRemoteServiceConfig.Builder. 
 - 
 
 -