|
1 | | -git-demo |
2 | | -======== |
| 1 | +Google Cloud for Java |
| 2 | +===================== |
| 3 | + |
| 4 | +[](https://travis-ci.org/GoogleCloudPlatform/gcloud-java) |
| 5 | + |
| 6 | +Java idiomatic client for Google Cloud Platform services. Supported APIs include: |
| 7 | + |
| 8 | + * Google Cloud Datastore |
| 9 | + |
| 10 | + |
| 11 | +> Note: This package is a work-in-progress, and may occasionally |
| 12 | +> make backwards-incompatible changes. |
| 13 | +
|
| 14 | +Documentation and examples are available [here](https://github.com/GoogleCloudePlatform/gcloud-java/gh-pages/docs). |
| 15 | + |
| 16 | +## Google Cloud Datastore |
| 17 | + |
| 18 | +[Google Cloud Datastore][cloud-datastore] ([docs][cloud-datastore-docs]) is a fully |
| 19 | +managed, schemaless database for storing non-relational data. Cloud Datastore |
| 20 | +automatically scales with your users and supports ACID transactions, high availability |
| 21 | +of reads and writes, strong consistency for reads and ancestor queries, and eventual |
| 22 | +consistency for all other queries. |
| 23 | + |
| 24 | +Follow the [activation instructions][cloud-datastore-activation] to use the Google |
| 25 | +Cloud Datastore API with your project. |
| 26 | + |
| 27 | + import com.google.gcloud.datastore.DatastoreService; |
| 28 | + import com.google.gcloud.datastore.DatastoreServiceFactory; |
| 29 | + import com.google.gcloud.datastore.DatastoreServiceOptions; |
| 30 | + import com.google.gcloud.datastore.Entity; |
| 31 | + import com.google.gcloud.datastore.Key; |
| 32 | + import com.google.gcloud.datastore.KeyFactory; |
| 33 | + |
| 34 | + DatastoreServiceOptions options = DatastoreServiceOptions.builder().dataset("...").build(); |
| 35 | + DatastoreService datastore = DatastoreServiceFactory.getDefault(options); |
| 36 | + KeyFactory keyFactory = new KeyFactory(datastore).kind("..."); |
| 37 | + Key key = keyFactory.newKey(keyName); |
| 38 | + Entity entity = datastore.get(key); |
| 39 | + if (entity == null) { |
| 40 | + entity = Entity.builder(key) |
| 41 | + .set("name", "John Do") |
| 42 | + .set("age", 30) |
| 43 | + .set("updated", false) |
| 44 | + .build(); |
| 45 | + datastore.put(entity); |
| 46 | + } |
| 47 | + |
| 48 | +## Contributing |
| 49 | + |
| 50 | +Contributions are welcome. Please, see the |
| 51 | +[CONTRIBUTING](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CONTRIBUTING.md) |
| 52 | +document for details. |
| 53 | + |
| 54 | +[cloud-datastore]: https://cloud.google.com/datastore/ |
| 55 | +[cloud-datastore-docs]: https://cloud.google.com/datastore/docs |
| 56 | +[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate |
| 57 | + |
| 58 | +[cloud-pubsub]: https://cloud.google.com/pubsub/ |
| 59 | +[cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs |
| 60 | + |
| 61 | +[cloud-storage]: https://cloud.google.com/storage/ |
| 62 | +[cloud-storage-docs]: https://cloud.google.com/storage/docs/overview |
| 63 | +[cloud-storage-create-bucket]: https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets |
0 commit comments