Skip to content

Commit 932fdc8

Browse files
committed
---
yaml --- r: 2131 b: refs/heads/pubsub-alpha c: 4aa8a97 h: refs/heads/master i: 2129: 2e037a0 2127: 57176b8
1 parent cfffeee commit 932fdc8

47 files changed

Lines changed: 800 additions & 2131 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
@@ -3,7 +3,7 @@ refs/heads/master: 689bbb466df4b2d5d2483d6edb8ac5c7c7f7c6fa
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
6-
refs/heads/pubsub-alpha: 5da46e88aa54da4901ec8c7efe218507e312e125
6+
refs/heads/pubsub-alpha: 4aa8a97ef59b6e46d56e0ff0667e0d584672b87f
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
88
refs/heads/update-datastore: 482954f2c5055231e5b3122ea91d2ba00ce8187c
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

branches/pubsub-alpha/CONTRIBUTING.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ Using maven for build/test
1515
After you cloned the repository use Maven for building and running the tests.
1616
Maven 3.0+ is required.
1717

18-
When downloading the source, we recommend you obtain service account credentials.
19-
These credentials will allow you to run integration tests using `mvn verify` in command line.
20-
Follow step 2 of the [authentication instructions](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) to generate and use JSON service account credentials.
21-
22-
It's also important to test that changes don't break compatibility with App/Compute Engine and when running elsewhere.
23-
To run tests on different platforms, try deploying the apps available on the [gcloud-java-examples](https://github.com/GoogleCloudPlatform/gcloud-java-examples) repository.
24-
End-to-end tests should ensure that gcloud-java works when running on the
25-
26-
* App Engine production environment (see the docs for [uploading your app to production App Engine](https://cloud.google.com/appengine/docs/java/tools/maven#uploading_your_app_to_production_app_engine))
27-
* App Engine development server (see the docs for [testing your app with the development server](https://cloud.google.com/appengine/docs/java/tools/maven#testing_your_app_with_the_development_server))
28-
* Compute Engine (see the [Getting Started Guide](https://cloud.google.com/compute/docs/quickstart), and be sure to [enable the appropriate APIs](https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication#on-google-compute-engine))
29-
* Your desktop (using `mvn exec:java`, for example)
30-
31-
When changes are made to authentication and project ID-related code, authentication and project ID inference should be tested using all relevant methods detailed in the [authentication docs](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) and [project ID docs](https://github.com/GoogleCloudPlatform/gcloud-java#specifying-a-project-id).
3218

3319
Adding Features
3420
---------------

branches/pubsub-alpha/README.md

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
1212

1313
This client supports the following Google Cloud Platform services:
1414

15-
- [Google Cloud BigQuery] (#google-cloud-bigquery)
1615
- [Google Cloud Datastore] (#google-cloud-datastore)
17-
- [Google Cloud Resource Manager] (#google-cloud-resource-manager)
1816
- [Google Cloud Storage] (#google-cloud-storage)
17+
- [Google Cloud Resource Manager] (#google-cloud-resource-manager)
18+
- [Google Cloud BigQuery] (#google-cloud-bigquery)
1919

2020
> Note: This client is a work-in-progress, and may occasionally
2121
> make backwards-incompatible changes.
@@ -42,14 +42,14 @@ libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.1"
4242
Example Applications
4343
--------------------
4444

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
46-
- 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).
4745
- [`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
4846
- 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).
49-
- [`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
50-
- 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).
5147
- [`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
5248
- 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).
49+
- [`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
50+
- 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).
51+
- [`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
52+
- 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).
5353

5454
Specifying a Project ID
5555
-----------------------
@@ -109,51 +109,6 @@ Next, choose a method for authenticating API requests from within your project:
109109
4. Google Cloud SDK credentials
110110
5. Compute Engine credentials
111111
112-
Google Cloud BigQuery
113-
----------------------
114-
115-
- [API Documentation][bigquery-api]
116-
- [Official Documentation][cloud-bigquery-docs]
117-
118-
#### Preview
119-
120-
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
121-
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
122-
123-
```java
124-
import com.google.gcloud.bigquery.BaseTableInfo;
125-
import com.google.gcloud.bigquery.BigQuery;
126-
import com.google.gcloud.bigquery.BigQueryOptions;
127-
import com.google.gcloud.bigquery.Field;
128-
import com.google.gcloud.bigquery.JobStatus;
129-
import com.google.gcloud.bigquery.LoadJobInfo;
130-
import com.google.gcloud.bigquery.Schema;
131-
import com.google.gcloud.bigquery.TableId;
132-
import com.google.gcloud.bigquery.TableInfo;
133-
134-
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
135-
TableId tableId = TableId.of("dataset", "table");
136-
BaseTableInfo info = bigquery.getTable(tableId);
137-
if (info == null) {
138-
System.out.println("Creating table " + tableId);
139-
Field integerField = Field.of("fieldName", Field.Type.integer());
140-
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
141-
} else {
142-
System.out.println("Loading data into table " + tableId);
143-
LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
144-
loadJob = bigquery.create(loadJob);
145-
while (loadJob.status().state() != JobStatus.State.DONE) {
146-
Thread.sleep(1000L);
147-
loadJob = bigquery.getJob(loadJob.jobId());
148-
}
149-
if (loadJob.status().error() != null) {
150-
System.out.println("Job completed with errors");
151-
} else {
152-
System.out.println("Job succeeded");
153-
}
154-
}
155-
```
156-
157112
Google Cloud Datastore
158113
----------------------
159114
@@ -194,6 +149,45 @@ if (entity == null) {
194149
}
195150
```
196151
152+
Google Cloud Storage
153+
----------------------
154+
155+
- [API Documentation][storage-api]
156+
- [Official Documentation][cloud-storage-docs]
157+
158+
*Follow the [activation instructions][cloud-storage-activation] to use the Google Cloud Storage API with your project.*
159+
160+
#### Preview
161+
162+
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.
163+
164+
```java
165+
import static java.nio.charset.StandardCharsets.UTF_8;
166+
167+
import com.google.gcloud.storage.Blob;
168+
import com.google.gcloud.storage.BlobId;
169+
import com.google.gcloud.storage.Storage;
170+
import com.google.gcloud.storage.StorageOptions;
171+
172+
import java.nio.ByteBuffer;
173+
import java.nio.channels.WritableByteChannel;
174+
175+
Storage storage = StorageOptions.defaultInstance().service();
176+
BlobId blobId = BlobId.of("bucket", "blob_name");
177+
Blob blob = Blob.load(storage, blobId);
178+
if (blob == null) {
179+
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
180+
storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
181+
} else {
182+
System.out.println("Updating content for " + blobId.name());
183+
byte[] prevContent = blob.content();
184+
System.out.println(new String(prevContent, UTF_8));
185+
WritableByteChannel channel = blob.writer();
186+
channel.write(ByteBuffer.wrap("Updated content".getBytes(UTF_8)));
187+
channel.close();
188+
}
189+
```
190+
197191
Google Cloud Resource Manager
198192
----------------------
199193
@@ -225,42 +219,48 @@ while (projectIterator.hasNext()) {
225219
}
226220
```
227221
228-
Google Cloud Storage
222+
Google Cloud BigQuery
229223
----------------------
230224
231-
- [API Documentation][storage-api]
232-
- [Official Documentation][cloud-storage-docs]
233-
234-
*Follow the [activation instructions][cloud-storage-activation] to use the Google Cloud Storage API with your project.*
225+
- [API Documentation][bigquery-api]
226+
- [Official Documentation][cloud-bigquery-docs]
235227
236228
#### Preview
237229
238-
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.
230+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
231+
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
239232
240233
```java
241-
import static java.nio.charset.StandardCharsets.UTF_8;
242-
243-
import com.google.gcloud.storage.Blob;
244-
import com.google.gcloud.storage.BlobId;
245-
import com.google.gcloud.storage.Storage;
246-
import com.google.gcloud.storage.StorageOptions;
247-
248-
import java.nio.ByteBuffer;
249-
import java.nio.channels.WritableByteChannel;
234+
import com.google.gcloud.bigquery.BaseTableInfo;
235+
import com.google.gcloud.bigquery.BigQuery;
236+
import com.google.gcloud.bigquery.BigQueryOptions;
237+
import com.google.gcloud.bigquery.Field;
238+
import com.google.gcloud.bigquery.JobStatus;
239+
import com.google.gcloud.bigquery.LoadJobInfo;
240+
import com.google.gcloud.bigquery.Schema;
241+
import com.google.gcloud.bigquery.TableId;
242+
import com.google.gcloud.bigquery.TableInfo;
250243
251-
Storage storage = StorageOptions.defaultInstance().service();
252-
BlobId blobId = BlobId.of("bucket", "blob_name");
253-
Blob blob = Blob.load(storage, blobId);
254-
if (blob == null) {
255-
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
256-
storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
244+
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
245+
TableId tableId = TableId.of("dataset", "table");
246+
BaseTableInfo info = bigquery.getTable(tableId);
247+
if (info == null) {
248+
System.out.println("Creating table " + tableId);
249+
Field integerField = Field.of("fieldName", Field.Type.integer());
250+
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
257251
} else {
258-
System.out.println("Updating content for " + blobId.name());
259-
byte[] prevContent = blob.content();
260-
System.out.println(new String(prevContent, UTF_8));
261-
WritableByteChannel channel = blob.writer();
262-
channel.write(ByteBuffer.wrap("Updated content".getBytes(UTF_8)));
263-
channel.close();
252+
System.out.println("Loading data into table " + tableId);
253+
LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
254+
loadJob = bigquery.create(loadJob);
255+
while (loadJob.status().state() != JobStatus.State.DONE) {
256+
Thread.sleep(1000L);
257+
loadJob = bigquery.getJob(loadJob.jobId());
258+
}
259+
if (loadJob.status().error() != null) {
260+
System.out.println("Job completed with errors");
261+
} else {
262+
System.out.println("Job succeeded");
263+
}
264264
}
265265
```
266266

branches/pubsub-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BaseTableInfo.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ public enum Type {
9494
private final Long expirationTime;
9595
private final Long lastModifiedTime;
9696

97-
/**
98-
* Base builder for tables.
99-
*
100-
* @param <T> the table type.
101-
* @param <B> the table builder.
102-
*/
10397
public abstract static class Builder<T extends BaseTableInfo, B extends Builder<T, B>> {
10498

10599
private String etag;

0 commit comments

Comments
 (0)