Java 8 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Java 8
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Java
8 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Java.
CloudDatastoreRemoteServiceConfig (Google App Engine API for Java)
Stay organized with collections
Save and categorize content based on your preferences.
- java.lang.Object
-
- com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig
-
public abstract class CloudDatastoreRemoteServiceConfig
extends java.lang.Object
User-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 from com.google.appengine.api
. For example:
public 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();
...
}
Outside of tests, the config should not be cleared once it has been set. In tests, the config can
be cleared by calling
clear()
:
@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();
}
By default, this configuration uses
application-default
credentials.
-
-
Method Summary
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CloudDatastoreRemoteServiceConfig
public CloudDatastoreRemoteServiceConfig()
-
Method Detail
-
clear
public static void clear()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003e\u003ccode\u003eCloudDatastoreRemoteServiceConfig\u003c/code\u003e allows configuration of the Cloud Datastore API for use outside of App Engine Standard.\u003c/p\u003e\n"],["\u003cp\u003eBefore using other classes in \u003ccode\u003ecom.google.appengine.api\u003c/code\u003e, you need to use \u003ccode\u003esetConfig\u003c/code\u003e to set the \u003ccode\u003eCloudDatastoreRemoteServiceConfig\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration should be set once and not cleared outside of tests, and \u003ccode\u003eclear\u003c/code\u003e can be used in tests to reset the configuration.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ebuilder\u003c/code\u003e is a static method that can be used to create a new instance of the \u003ccode\u003eCloudDatastoreRemoteServiceConfig.Builder\u003c/code\u003e class to easily configure the \u003ccode\u003eCloudDatastoreRemoteServiceConfig\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration uses application-default credentials by default for authentication with google services.\u003c/p\u003e\n"]]],[],null,["# CloudDatastoreRemoteServiceConfig (Google App Engine API for Java)\n\ncom.google.appengine.api.datastore\n\nClass CloudDatastoreRemoteServiceConfig\n---------------------------------------\n\n- java.lang.Object\n-\n - com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig\n\n-\n\n *** ** * ** ***\n\n \u003cbr /\u003e\n\n ```\n public abstract class CloudDatastoreRemoteServiceConfig\n extends java.lang.Object\n ``` \n User-configurable global properties of Cloud Datastore.\n\n Code not running in App Engine Standard can use the Cloud Datastore API by making a single\n call to [`setConfig(com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig)`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.html#setConfig-com.google.appengine.api.datastore.CloudDatastoreRemoteServiceConfig-) before accessing any other classes from [`com.google.appengine.api`](../../../../../com/google/appengine/api/package-summary.html). For example:\n\n ```\n public static void main(Strings[] args) {\n CloudDatastoreRemoteServiceConfig config = CloudDatastoreRemoteServiceConfig.builder()\n .appId(AppId.create(Location.US_CENTRAL, \"my-project-id\"))\n .build();\n CloudDatastoreRemoteServiceConfig.setConfig(config);\n DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();\n ...\n }\n \n ```\n Outside of tests, the config should not be cleared once it has been set. In tests, the config can be cleared by calling [`clear()`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.html#clear--): \n\n ```\n @Before\n public void before() {\n CloudDatastoreRemoteServiceConfig config = CloudDatastoreRemoteServiceConfig.builder()\n .appId(AppId.create(Location.US_CENTRAL, \"my-project-id\"))\n .emulatorHost(...)\n .build();\n CloudDatastoreRemoteServiceConfig.setConfig(config);\n }\n\n @After\n public void after() {\n CloudDatastoreRemoteServiceConfig.clear();\n }\n \n ```\n By default, this configuration uses [application-default\n credentials](https://developers.google.com/identity/protocols/application-default-credentials).\n\n \u003cbr /\u003e\n\n-\n -\n\n ### Nested Class Summary\n\n \u003c!-- --\u003e\n\n -\n\n ### Constructor Summary\n\n \u003c!-- --\u003e\n\n -\n\n ### Method Summary\n\n -\n\n ### Methods inherited from class java.lang.Object\n\n`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait` \n-\n -\n\n ### Constructor Detail\n\n\n -\n\n #### CloudDatastoreRemoteServiceConfig\n\n ```\n public CloudDatastoreRemoteServiceConfig()\n ```\n\n \u003c!-- --\u003e\n\n -\n\n ### Method Detail\n\n\n -\n\n #### setConfig\n\n ```\n public static void setConfig(CloudDatastoreRemoteServiceConfig config)\n ``` \n Sets the [`CloudDatastoreRemoteServiceConfig`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.html \"class in com.google.appengine.api.datastore\") instance.\n\n Throws:\n : `java.lang.IllegalStateException` - if the [`CloudDatastoreRemoteServiceConfig`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.html \"class in com.google.appengine.api.datastore\") instance has\n already been set and [`clear()`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.html#clear--) has not been called\n : `java.lang.IllegalStateException` - if the provided [`CloudDatastoreRemoteServiceConfig`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.html \"class in com.google.appengine.api.datastore\") is not\n supported in this environment\n\n\n -\n\n #### clear\n\n ```\n public static void clear()\n ``` \n Clears the [`CloudDatastoreRemoteServiceConfig`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.html \"class in com.google.appengine.api.datastore\") instance (if one has been set) as well as the [`ApiProxy`](../../../../../com/google/apphosting/api/ApiProxy.html \"class in com.google.apphosting.api\")'s [`ApiProxy.EnvironmentFactory`](../../../../../com/google/apphosting/api/ApiProxy.EnvironmentFactory.html \"interface in com.google.apphosting.api\") and the [`ApiProxy.Environment`](../../../../../com/google/apphosting/api/ApiProxy.Environment.html \"interface in com.google.apphosting.api\") for the current thread.\n\n This method should only be called in tests.\n\n\n -\n\n #### builder\n\n ```\n public static CloudDatastoreRemoteServiceConfig.Builder builder()\n ``` \n Returns a [`CloudDatastoreRemoteServiceConfig.Builder`](../../../../../com/google/appengine/api/datastore/CloudDatastoreRemoteServiceConfig.Builder.html \"class in com.google.appengine.api.datastore\")."]]