|
1 | | -Google Cloud Java Client |
2 | | -========================== |
3 | | - |
4 | | -Java idiomatic client for [Google Cloud Platform][cloud-platform] services. |
| 1 | +Google Cloud for Java |
| 2 | +===================== |
5 | 3 |
|
6 | 4 | [](https://travis-ci.org/GoogleCloudPlatform/gcloud-java) |
7 | 5 | [](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master) |
8 | 6 |
|
9 | | -- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/) |
10 | | -- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs) |
11 | | -- [Examples] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/examples/package-summary.html) |
12 | | - |
13 | | -This client supports the following Google Cloud Platform services: |
| 7 | +Java idiomatic client for Google Cloud Platform services. Supported APIs include: |
14 | 8 |
|
15 | | -- [Google Cloud Datastore] (https://cloud.google.com/datastore/) |
| 9 | + * Google Cloud Datastore |
16 | 10 |
|
17 | | -<!--- |
18 | | -- [Google Cloud Storage] (https://cloud.google.com/storage/) |
19 | | ----> |
20 | 11 |
|
21 | | -> Note: This client is a work-in-progress, and may occasionally |
| 12 | +> Note: This package is a work-in-progress, and may occasionally |
22 | 13 | > make backwards-incompatible changes. |
23 | 14 |
|
24 | | -Quickstart |
25 | | ----------- |
26 | | -Add this to your pom.xml file |
27 | | -```xml |
28 | | -<dependency> |
29 | | - <groupId>com.google.gcloud</groupId> |
30 | | - <artifactId>gcloud-java</artifactId> |
31 | | - <version>LATEST</version> |
32 | | -</dependency> |
33 | | -``` |
34 | | - |
35 | | -<!--- |
36 | | -Example Applications |
37 | | --------------------- |
38 | 15 |
|
39 | | -- `java-datastore-sample`_ - A sample using Cloud Datastore |
40 | | -.. _java-datastore-sample: https://github.com/GoogleCloudPlatform/java-datastore-sample |
41 | | ----> |
| 16 | +Documentation and examples are available [here](http://googlecloudplatform.github.io/gcloud-java/apidocs). |
42 | 17 |
|
43 | | -Google Cloud Datastore |
44 | | ----------------------- |
| 18 | +## Google Cloud Datastore |
45 | 19 |
|
46 | | -Google [Cloud Datastore][cloud-datastore] is a fully managed, schemaless database for |
47 | | -storing non-relational data. Cloud Datastore automatically scales with |
48 | | -your users and supports ACID transactions, high availability of reads and |
49 | | -writes, strong consistency for reads and ancestor queries, and eventual |
| 20 | +[Google Cloud Datastore][cloud-datastore] ([docs][cloud-datastore-docs]) is a fully |
| 21 | +managed, schemaless database for storing non-relational data. Cloud Datastore |
| 22 | +automatically scales with your users and supports ACID transactions, high availability |
| 23 | +of reads and writes, strong consistency for reads and ancestor queries, and eventual |
50 | 24 | consistency for all other queries. |
51 | 25 |
|
52 | | -See the [Google Cloud Datastore docs][cloud-datastore-activation] for more details on how to activate |
53 | | -Cloud Datastore for your project. |
54 | | - |
55 | | -See the ``gcloud-java`` API [datastore documentation][datastore-api] to learn how to interact |
56 | | -with the Cloud Datastore using this Client Library. |
| 26 | +Follow the [activation instructions][cloud-datastore-activation] to use the Google |
| 27 | +Cloud Datastore API with your project. |
57 | 28 |
|
58 | 29 | ```java |
59 | 30 | import com.google.gcloud.datastore.DatastoreService; |
60 | 31 | import com.google.gcloud.datastore.DatastoreServiceFactory; |
61 | 32 | import com.google.gcloud.datastore.DatastoreServiceOptions; |
62 | | -import com.google.gcloud.datastore.DateTime; |
63 | 33 | import com.google.gcloud.datastore.Entity; |
64 | 34 | import com.google.gcloud.datastore.Key; |
65 | 35 | import com.google.gcloud.datastore.KeyFactory; |
66 | 36 |
|
67 | | -DatastoreServiceOptions options = DatastoreServiceOptions.builder().dataset(DATASET).build(); |
68 | | -DatastoreService datastore = DatastoreServiceFactory.instance().get(options); |
69 | | -KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND); |
| 37 | +DatastoreServiceOptions options = DatastoreServiceOptions.builder().dataset("...").build(); |
| 38 | +DatastoreService datastore = DatastoreServiceFactory.getDefault(options); |
| 39 | +KeyFactory keyFactory = new KeyFactory(datastore).kind("..."); |
70 | 40 | Key key = keyFactory.newKey(keyName); |
71 | 41 | Entity entity = datastore.get(key); |
72 | 42 | if (entity == null) { |
73 | 43 | entity = Entity.builder(key) |
74 | 44 | .set("name", "John Do") |
75 | 45 | .set("age", 30) |
76 | | - .set("access_time", DateTime.now()) |
| 46 | + .set("updated", false) |
77 | 47 | .build(); |
78 | 48 | datastore.put(entity); |
79 | | -} else { |
80 | | - System.out.println("Updating access_time for " + entity.getString("name")); |
81 | | - entity = Entity.builder(entity) |
82 | | - .set("access_time", DateTime.now()) |
83 | | - .build(); |
84 | | - datastore.update(entity); |
85 | 49 | } |
86 | 50 | ``` |
87 | 51 |
|
88 | | -Contributing |
89 | | ------------- |
90 | | - |
91 | | -Contributions to this library are always welcome and highly encouraged. |
92 | | - |
93 | | -See [CONTRIBUTING] for more information on how to get started. |
94 | | - |
95 | | -Java Versions |
96 | | -------------- |
97 | | - |
98 | | -Java 7 or above is required for using this client. |
99 | | - |
100 | | -Versioning |
101 | | ----------- |
102 | | - |
103 | | -This library follows [Semantic Versioning] (http://semver.org/). |
104 | | - |
105 | | -It is currently in major version zero (``0.y.z``), which means that anything |
106 | | -may change at any time and the public API should not be considered |
107 | | -stable. |
108 | | - |
109 | | -License |
110 | | -------- |
111 | | - |
112 | | -Apache 2.0 - See [LICENSE] for more information. |
| 52 | +## Contributing |
113 | 53 |
|
| 54 | +Contributions are welcome. Please, see the |
| 55 | +[CONTRIBUTING](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CONTRIBUTING.md) |
| 56 | +document for details. |
114 | 57 |
|
115 | | -[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CONTRIBUTING.md |
116 | | -[LICENSE]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/LICENSE |
117 | | -[cloud-platform]: https://cloud.google.com/ |
118 | | -[cloud-datastore]: https://cloud.google.com/datastore/docs |
| 58 | +[cloud-datastore]: https://cloud.google.com/datastore/ |
119 | 59 | [cloud-datastore-docs]: https://cloud.google.com/datastore/docs |
120 | 60 | [cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate |
121 | | -[datastore-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/datastore/package-summary.html |
122 | 61 |
|
123 | 62 | [cloud-pubsub]: https://cloud.google.com/pubsub/ |
124 | 63 | [cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs |
|
0 commit comments