| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_PROPERTY_NAME
The property used in the Datastore to get the key of the entity.
|
static String |
LOCAL_HOST_ENV_VAR
Name of the environment variable used to set the local host.
|
static String |
PRIVATE_KEY_FILE_ENV_VAR
Name of the environment variable used to set the private key file.
|
static String |
PROJECT_ID_ENV_VAR
Name of the environment variable used to set the project ID.
|
static String |
SCATTER_PROPERTY_NAME
The property used in the Datastore to give us a random distribution.
|
static String |
SERVICE_ACCOUNT_ENV_VAR
Name of the environment variable used to set the service account.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
getBoolean(com.google.datastore.v1.Value value) |
static com.google.protobuf.ByteString |
getByteString(com.google.datastore.v1.Value value) |
static Datastore |
getDatastoreFromEnv() |
static double |
getDouble(com.google.datastore.v1.Value value) |
static com.google.datastore.v1.Entity |
getEntity(com.google.datastore.v1.Value value) |
static com.google.datastore.v1.Key |
getKey(com.google.datastore.v1.Value value) |
static Comparator<com.google.datastore.v1.Key> |
getKeyComparator() |
static List<com.google.datastore.v1.Value> |
getList(com.google.datastore.v1.Value value) |
static long |
getLong(com.google.datastore.v1.Value value) |
static DatastoreOptions.Builder |
getOptionsFromEnv()
Constructs a
Datastore from environment variables and/or the Compute Engine metadata
server. |
static String |
getProjectIdFromComputeEngine()
Gets the project ID from the Compute Engine metadata server.
|
static QuerySplitter |
getQuerySplitter()
Gets a
QuerySplitter. |
static com.google.api.client.auth.oauth2.Credential |
getServiceAccountCredential(String serviceAccountId,
PrivateKey privateKey,
Collection<String> serviceAccountScopes)
Constructs credentials for the given account and key.
|
static com.google.api.client.auth.oauth2.Credential |
getServiceAccountCredential(String serviceAccountId,
String privateKeyFile)
Constructs credentials for the given account and key.
|
static com.google.api.client.auth.oauth2.Credential |
getServiceAccountCredential(String serviceAccountId,
String privateKeyFile,
Collection<String> serviceAccountScopes)
Constructs credentials for the given account and key file.
|
static String |
getString(com.google.datastore.v1.Value value) |
static long |
getTimestamp(com.google.datastore.v1.Value value) |
static com.google.datastore.v1.Filter.Builder |
makeAncestorFilter(com.google.datastore.v1.Key ancestor)
Makes an ancestor filter.
|
static com.google.datastore.v1.Filter.Builder |
makeAndFilter(com.google.datastore.v1.Filter... subfilters)
Make a composite filter from the given sub-filters using AND to combine filters.
|
static com.google.datastore.v1.Filter.Builder |
makeAndFilter(Iterable<com.google.datastore.v1.Filter> subfilters)
Make a composite filter from the given sub-filters using AND to combine filters.
|
static com.google.datastore.v1.Mutation.Builder |
makeDelete(com.google.datastore.v1.Key key) |
static com.google.datastore.v1.Filter.Builder |
makeFilter(String property,
com.google.datastore.v1.PropertyFilter.Operator operator,
com.google.datastore.v1.Value.Builder value)
Make a filter on a property for use in a query.
|
static com.google.datastore.v1.Filter.Builder |
makeFilter(String property,
com.google.datastore.v1.PropertyFilter.Operator operator,
com.google.datastore.v1.Value value)
Make a filter on a property for use in a query.
|
static com.google.datastore.v1.Mutation.Builder |
makeInsert(com.google.datastore.v1.Entity entity) |
static com.google.datastore.v1.Key.Builder |
makeKey(Object... elements)
Make a key from the specified path of kind/id-or-name pairs
and/or Keys.
|
static com.google.datastore.v1.PropertyOrder.Builder |
makeOrder(String property,
com.google.datastore.v1.PropertyOrder.Direction direction)
Make a sort order for use in a query.
|
static com.google.datastore.v1.PropertyReference.Builder |
makePropertyReference(String propertyName)
Make a property reference for use in a query.
|
static com.google.datastore.v1.Mutation.Builder |
makeUpdate(com.google.datastore.v1.Entity entity) |
static com.google.datastore.v1.Mutation.Builder |
makeUpsert(com.google.datastore.v1.Entity entity) |
static com.google.datastore.v1.Value.Builder |
makeValue(boolean value)
Make a boolean value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.protobuf.ByteString blob)
Make a ByteString value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(Date date)
Make a timestamp value given a date.
|
static com.google.datastore.v1.Value.Builder |
makeValue(double value)
Make a floating point value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.datastore.v1.Entity.Builder entity)
Make a entity value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.datastore.v1.Entity entity)
Make an entity value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(Iterable<com.google.datastore.v1.Value> values)
Make an array value containing the specified values.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.datastore.v1.Key.Builder key)
Make a key value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.datastore.v1.Key key)
Make a key value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.type.LatLng.Builder value)
Makes a GeoPoint value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.type.LatLng value)
Makes a GeoPoint value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(long key)
Make an integer value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(String value)
Make a string value.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.datastore.v1.Value.Builder value1,
com.google.datastore.v1.Value.Builder value2,
com.google.datastore.v1.Value.Builder... rest)
Make an array value containing the specified values.
|
static com.google.datastore.v1.Value.Builder |
makeValue(com.google.datastore.v1.Value value1,
com.google.datastore.v1.Value value2,
com.google.datastore.v1.Value... rest)
Make a list value containing the specified values.
|
static Date |
toDate(com.google.datastore.v1.Value value)
Convert a timestamp value into a
Date clipping off the microseconds. |
public static final String SCATTER_PROPERTY_NAME
public static final String KEY_PROPERTY_NAME
public static final String PROJECT_ID_ENV_VAR
public static final String LOCAL_HOST_ENV_VAR
public static final String SERVICE_ACCOUNT_ENV_VAR
public static final String PRIVATE_KEY_FILE_ENV_VAR
public static com.google.api.client.auth.oauth2.Credential getServiceAccountCredential(String serviceAccountId, String privateKeyFile) throws GeneralSecurityException, IOException
serviceAccountId - service account ID (typically an e-mail address).privateKeyFile - the file name from which to get the private key.nullGeneralSecurityExceptionIOExceptionpublic static com.google.api.client.auth.oauth2.Credential getServiceAccountCredential(String serviceAccountId, String privateKeyFile, Collection<String> serviceAccountScopes) throws GeneralSecurityException, IOException
serviceAccountId - service account ID (typically an e-mail address).privateKeyFile - the file name from which to get the private key.serviceAccountScopes - Collection of OAuth scopes to use with the the service
account flow or null if not.nullGeneralSecurityExceptionIOExceptionpublic static com.google.api.client.auth.oauth2.Credential getServiceAccountCredential(String serviceAccountId, PrivateKey privateKey, Collection<String> serviceAccountScopes) throws GeneralSecurityException, IOException
serviceAccountId - service account ID (typically an e-mail address).privateKey - the private key for the given account.serviceAccountScopes - Collection of OAuth scopes to use with the the service
account flow or null if not.nullGeneralSecurityExceptionIOExceptionpublic static DatastoreOptions.Builder getOptionsFromEnv() throws GeneralSecurityException, IOException
Datastore from environment variables and/or the Compute Engine metadata
server.
The project ID is determined from, in order of preference:
Credentials are taken from, in order of preference:
GeneralSecurityExceptionIOExceptionpublic static String getProjectIdFromComputeEngine()
null if the
project ID cannot be determined (because, for instance, the code is not running on Compute
Engine).public static Datastore getDatastoreFromEnv() throws GeneralSecurityException, IOException
GeneralSecurityExceptionIOExceptiongetOptionsFromEnv()public static QuerySplitter getQuerySplitter()
QuerySplitter.
The returned QuerySplitter.getSplits(com.google.datastore.v1.Query, com.google.datastore.v1.PartitionId, int, com.google.datastore.v1.client.Datastore) cannot accept a query that contains inequality
filters, a sort filter, or a missing kind.public static Comparator<com.google.datastore.v1.Key> getKeyComparator()
public static com.google.datastore.v1.PropertyOrder.Builder makeOrder(String property, com.google.datastore.v1.PropertyOrder.Direction direction)
public static com.google.datastore.v1.Filter.Builder makeAncestorFilter(com.google.datastore.v1.Key ancestor)
public static com.google.datastore.v1.Filter.Builder makeFilter(String property, com.google.datastore.v1.PropertyFilter.Operator operator, com.google.datastore.v1.Value value)
public static com.google.datastore.v1.Filter.Builder makeFilter(String property, com.google.datastore.v1.PropertyFilter.Operator operator, com.google.datastore.v1.Value.Builder value)
public static com.google.datastore.v1.Filter.Builder makeAndFilter(com.google.datastore.v1.Filter... subfilters)
public static com.google.datastore.v1.Filter.Builder makeAndFilter(Iterable<com.google.datastore.v1.Filter> subfilters)
public static com.google.datastore.v1.PropertyReference.Builder makePropertyReference(String propertyName)
public static com.google.datastore.v1.Value.Builder makeValue(Iterable<com.google.datastore.v1.Value> values)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.datastore.v1.Value value1,
com.google.datastore.v1.Value value2,
com.google.datastore.v1.Value... rest)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.datastore.v1.Value.Builder value1,
com.google.datastore.v1.Value.Builder value2,
com.google.datastore.v1.Value.Builder... rest)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.datastore.v1.Key key)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.datastore.v1.Key.Builder key)
public static com.google.datastore.v1.Value.Builder makeValue(long key)
public static com.google.datastore.v1.Value.Builder makeValue(double value)
public static com.google.datastore.v1.Value.Builder makeValue(boolean value)
public static com.google.datastore.v1.Value.Builder makeValue(String value)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.datastore.v1.Entity entity)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.datastore.v1.Entity.Builder entity)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.protobuf.ByteString blob)
public static com.google.datastore.v1.Value.Builder makeValue(Date date)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.type.LatLng value)
public static com.google.datastore.v1.Value.Builder makeValue(com.google.type.LatLng.Builder value)
public static com.google.datastore.v1.Key.Builder makeKey(Object... elements)
The id-or-name values must be either String, Long, Integer or Short.
The last id-or-name value may be omitted, in which case an entity without an id is created (for use with automatic id allocation).
The PartitionIds of all Keys in the path must be equal. The returned Key.Builder will use this PartitionId.
public static double getDouble(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain a double.public static com.google.datastore.v1.Key getKey(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain a key.public static com.google.protobuf.ByteString getByteString(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain a blob.public static com.google.datastore.v1.Entity getEntity(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain an entity.public static String getString(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain a string.public static boolean getBoolean(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain a boolean.public static long getLong(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain a long.public static long getTimestamp(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain a timestamp.public static List<com.google.datastore.v1.Value> getList(com.google.datastore.v1.Value value)
IllegalArgumentException - if the value does not contain an array.public static Date toDate(com.google.datastore.v1.Value value)
Date clipping off the microseconds.value - a timestamp value to convertDateIllegalArgumentException - if the value does not contain a timestamp.public static com.google.datastore.v1.Mutation.Builder makeInsert(com.google.datastore.v1.Entity entity)
entity - the entity to insertpublic static com.google.datastore.v1.Mutation.Builder makeUpdate(com.google.datastore.v1.Entity entity)
entity - the entity to updatepublic static com.google.datastore.v1.Mutation.Builder makeUpsert(com.google.datastore.v1.Entity entity)
entity - the entity to upsertpublic static com.google.datastore.v1.Mutation.Builder makeDelete(com.google.datastore.v1.Key key)
key - the key of the entity to deleteCopyright © 2017. All rights reserved.