Skip to content

Commit d6e40fb

Browse files
committed
---
yaml --- r: 3505 b: refs/heads/pubsub-alpha c: 2bf4925 h: refs/heads/master i: 3503: 6d9b85a
1 parent a8b3b64 commit d6e40fb

177 files changed

Lines changed: 7161 additions & 16186 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 36a62ef856d199f8efd09501b5ba65c422c01f23
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 7406918e071dd2c5677a638ae2a06e7592b6542c
5-
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
5+
refs/heads/pubsub-alpha: 2bf4925cb3fa8fa782b78de164e3a841bf5fdf4f
66
refs/heads/update-datastore: 47aae517c2cb33f1dccd909adaced73ec9d0f4df
77
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
88
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd

branches/pubsub-alpha/README.md

Lines changed: 54 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
66
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
77
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
88
[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java.svg)
9-
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
109

1110
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
1211
- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs)
@@ -28,32 +27,32 @@ If you are using Maven, add this to your pom.xml file
2827
<dependency>
2928
<groupId>com.google.gcloud</groupId>
3029
<artifactId>gcloud-java</artifactId>
31-
<version>0.1.3</version>
30+
<version>0.1.2</version>
3231
</dependency>
3332
```
3433
If you are using Gradle, add this to your dependencies
3534
```Groovy
36-
compile 'com.google.gcloud:gcloud-java:0.1.3'
35+
compile 'com.google.gcloud:gcloud-java:0.1.2'
3736
```
3837
If you are using SBT, add this to your dependencies
3938
```Scala
40-
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.3"
39+
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.2"
4140
```
4241

4342
Example Applications
4443
--------------------
4544

46-
- [`BigQueryExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
45+
- [`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
4746
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
4847
- [`Bookshelf`](https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/bookshelf) - An App Engine app that manages a virtual bookshelf.
4948
- This app uses `gcloud-java` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
50-
- [`DatastoreExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
49+
- [`DatastoreExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
5150
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/DatastoreExample.html).
52-
- [`ResourceManagerExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
51+
- [`ResourceManagerExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
5352
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/ResourceManagerExample.html).
54-
- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managed_vms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
55-
- Read about how it works on the example's [README page](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/managed_vms/sparkjava#how-does-it-work).
56-
- [`StorageExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
53+
- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managedvms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
54+
- Read about how it works on the example's [README page](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/managedvms/sparkjava#how-does-it-work).
55+
- [`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
5756
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).
5857

5958
Specifying a Project ID
@@ -124,39 +123,38 @@ Google Cloud BigQuery (Alpha)
124123
125124
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
126125
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
127-
Complete source code can be found at
128-
[CreateTableAndLoadData.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/CreateTableAndLoadData.java).
129126
130127
```java
128+
import com.google.gcloud.bigquery.BaseTableInfo;
131129
import com.google.gcloud.bigquery.BigQuery;
132130
import com.google.gcloud.bigquery.BigQueryOptions;
133131
import com.google.gcloud.bigquery.Field;
134-
import com.google.gcloud.bigquery.FormatOptions;
135-
import com.google.gcloud.bigquery.Job;
132+
import com.google.gcloud.bigquery.JobStatus;
133+
import com.google.gcloud.bigquery.LoadJobInfo;
136134
import com.google.gcloud.bigquery.Schema;
137-
import com.google.gcloud.bigquery.StandardTableDefinition;
138-
import com.google.gcloud.bigquery.Table;
139135
import com.google.gcloud.bigquery.TableId;
140136
import com.google.gcloud.bigquery.TableInfo;
141137
142138
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
143139
TableId tableId = TableId.of("dataset", "table");
144-
Table table = bigquery.getTable(tableId);
145-
if (table == null) {
140+
BaseTableInfo info = bigquery.getTable(tableId);
141+
if (info == null) {
146142
System.out.println("Creating table " + tableId);
147143
Field integerField = Field.of("fieldName", Field.Type.integer());
148-
Schema schema = Schema.of(integerField);
149-
table = bigquery.create(TableInfo.of(tableId, StandardTableDefinition.of(schema)));
150-
}
151-
System.out.println("Loading data into table " + tableId);
152-
Job loadJob = table.load(FormatOptions.csv(), "gs://bucket/path");
153-
while (!loadJob.isDone()) {
154-
Thread.sleep(1000L);
155-
}
156-
if (loadJob.status().error() != null) {
157-
System.out.println("Job completed with errors");
144+
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
158145
} else {
159-
System.out.println("Job succeeded");
146+
System.out.println("Loading data into table " + tableId);
147+
LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
148+
loadJob = bigquery.create(loadJob);
149+
while (loadJob.status().state() != JobStatus.State.DONE) {
150+
Thread.sleep(1000L);
151+
loadJob = bigquery.getJob(loadJob.jobId());
152+
}
153+
if (loadJob.status().error() != null) {
154+
System.out.println("Job completed with errors");
155+
} else {
156+
System.out.println("Job succeeded");
157+
}
160158
}
161159
```
162160
@@ -170,32 +168,8 @@ Google Cloud Datastore
170168
171169
#### Preview
172170
173-
Here are two code snippets showing simple usage examples from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
174-
175-
The first snippet shows how to create a Datastore entity. Complete source code can be found at
176-
[CreateEntity.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/CreateEntity.java).
177-
178-
```java
179-
import com.google.gcloud.datastore.Datastore;
180-
import com.google.gcloud.datastore.DatastoreOptions;
181-
import com.google.gcloud.datastore.DateTime;
182-
import com.google.gcloud.datastore.Entity;
183-
import com.google.gcloud.datastore.Key;
184-
import com.google.gcloud.datastore.KeyFactory;
171+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
185172
186-
Datastore datastore = DatastoreOptions.defaultInstance().service();
187-
KeyFactory keyFactory = datastore.newKeyFactory().kind("keyKind");
188-
Key key = keyFactory.newKey("keyName");
189-
Entity entity = Entity.builder(key)
190-
.set("name", "John Doe")
191-
.set("age", 30)
192-
.set("access_time", DateTime.now())
193-
.build();
194-
datastore.put(entity);
195-
```
196-
The second snippet shows how to update a Datastore entity if it exists. Complete source code can be
197-
found at
198-
[UpdateEntity.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/UpdateEntity.java).
199173
```java
200174
import com.google.gcloud.datastore.Datastore;
201175
import com.google.gcloud.datastore.DatastoreOptions;
@@ -205,10 +179,17 @@ import com.google.gcloud.datastore.Key;
205179
import com.google.gcloud.datastore.KeyFactory;
206180
207181
Datastore datastore = DatastoreOptions.defaultInstance().service();
208-
KeyFactory keyFactory = datastore.newKeyFactory().kind("keyKind");
209-
Key key = keyFactory.newKey("keyName");
182+
KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
183+
Key key = keyFactory.newKey(keyName);
210184
Entity entity = datastore.get(key);
211-
if (entity != null) {
185+
if (entity == null) {
186+
entity = Entity.builder(key)
187+
.set("name", "John Do")
188+
.set("age", 30)
189+
.set("access_time", DateTime.now())
190+
.build();
191+
datastore.put(entity);
192+
} else {
212193
System.out.println("Updating access_time for " + entity.getString("name"));
213194
entity = Entity.builder(entity)
214195
.set("access_time", DateTime.now())
@@ -226,26 +207,22 @@ Google Cloud Resource Manager (Alpha)
226207
#### Preview
227208
228209
Here is a code snippet showing a simple usage example. Note that you must supply Google SDK credentials for this service, not other forms of authentication listed in the [Authentication section](#authentication).
229-
Complete source code can be found at
230-
[UpdateAndListProjects.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/UpdateAndListProjects.java).
210+
231211
```java
232-
import com.google.gcloud.resourcemanager.Project;
212+
import com.google.gcloud.resourcemanager.ProjectInfo;
233213
import com.google.gcloud.resourcemanager.ResourceManager;
234214
import com.google.gcloud.resourcemanager.ResourceManagerOptions;
235215
236216
import java.util.Iterator;
237217
238218
ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
239-
Project project = resourceManager.get("some-project-id"); // Use an existing project's ID
240-
if (project != null) {
241-
Project newProject = project.toBuilder()
242-
.addLabel("launch-status", "in-development")
243-
.build()
244-
.replace();
245-
System.out.println("Updated the labels of project " + newProject.projectId()
246-
+ " to be " + newProject.labels());
247-
}
248-
Iterator<Project> projectIterator = resourceManager.list().iterateAll();
219+
ProjectInfo myProject = resourceManager.get("some-project-id"); // Use an existing project's ID
220+
ProjectInfo newProjectInfo = resourceManager.replace(myProject.toBuilder()
221+
.addLabel("launch-status", "in-development").build());
222+
System.out.println("Updated the labels of project " + newProjectInfo.projectId()
223+
+ " to be " + newProjectInfo.labels());
224+
// List all the projects you have permission to view.
225+
Iterator<ProjectInfo> projectIterator = resourceManager.list().iterateAll();
249226
System.out.println("Projects I can view:");
250227
while (projectIterator.hasNext()) {
251228
System.out.println(projectIterator.next().projectId());
@@ -262,28 +239,8 @@ Google Cloud Storage
262239
263240
#### Preview
264241
265-
Here are two code snippets showing simple usage examples from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
266-
267-
The first snippet shows how to create a Storage blob. Complete source code can be found at
268-
[CreateBlob.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateBlob.java).
269-
270-
```java
271-
import static java.nio.charset.StandardCharsets.UTF_8;
272-
273-
import com.google.gcloud.storage.Blob;
274-
import com.google.gcloud.storage.BlobId;
275-
import com.google.gcloud.storage.BlobInfo;
276-
import com.google.gcloud.storage.Storage;
277-
import com.google.gcloud.storage.StorageOptions;
242+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
278243
279-
Storage storage = StorageOptions.defaultInstance().service();
280-
BlobId blobId = BlobId.of("bucket", "blob_name");
281-
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
282-
Blob blob = storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
283-
```
284-
The second snippet shows how to update a Storage blob if it exists. Complete source code can be
285-
found at
286-
[UpdateBlob.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/UpdateBlob.java).
287244
```java
288245
import static java.nio.charset.StandardCharsets.UTF_8;
289246
@@ -297,8 +254,12 @@ import java.nio.channels.WritableByteChannel;
297254
298255
Storage storage = StorageOptions.defaultInstance().service();
299256
BlobId blobId = BlobId.of("bucket", "blob_name");
300-
Blob blob = storage.get(blobId);
301-
if (blob != null) {
257+
Blob blob = Blob.get(storage, blobId);
258+
if (blob == null) {
259+
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
260+
storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
261+
} else {
262+
System.out.println("Updating content for " + blobId.name());
302263
byte[] prevContent = blob.content();
303264
System.out.println(new String(prevContent, UTF_8));
304265
WritableByteChannel channel = blob.writer();

branches/pubsub-alpha/RELEASING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ As mentioned before, there is an optional version argument. By default, the scr
2626

2727
6. Create and merge in another PR to reflect the updated project version. For an example of what this PR should look like, see [#227](https://github.com/GoogleCloudPlatform/gcloud-java/pull/227).
2828

29-
7. Be sure to update App Engine documentation and [java-docs-samples](https://github.com/GoogleCloudPlatform/java-docs-samples) code as necessary. See directions [here](https://docs.google.com/a/google.com/document/d/1SS3xNn2v0qW7EadGUPBUAPIQAH5VY6WSFmT17ZjjUVE/edit?usp=sharing).
30-
3129
### To push a snapshot version
3230

3331
Pushing a snapshot is completely automated. If "-SNAPSHOT" is included in the version denoted by the base directory's pom.xml, then an updated artifact will be pushed to the snapshot repository when Travis CI successfully completes a non-PR build.

branches/pubsub-alpha/codacy-conf.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)