Skip to content

Commit 0b7d9d7

Browse files
committed
---
yaml --- r: 2763 b: refs/heads/update-datastore c: d3abf25 h: refs/heads/master i: 2761: 387e10c 2759: 8bdfe91
1 parent cae0d78 commit 0b7d9d7

87 files changed

Lines changed: 3109 additions & 1975 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
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: a76e6c40e3a77dc991d404a80287d5240ce8a0d9
8+
refs/heads/update-datastore: d3abf25b6d4b42d278ac2057eddfcf808d0e8830
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ If you are using Maven, add this to your pom.xml file
2727
<dependency>
2828
<groupId>com.google.gcloud</groupId>
2929
<artifactId>gcloud-java</artifactId>
30-
<version>0.1.2</version>
30+
<version>0.1.3</version>
3131
</dependency>
3232
```
3333
If you are using Gradle, add this to your dependencies
3434
```Groovy
35-
compile 'com.google.gcloud:gcloud-java:0.1.2'
35+
compile 'com.google.gcloud:gcloud-java:0.1.3'
3636
```
3737
If you are using SBT, add this to your dependencies
3838
```Scala
39-
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.2"
39+
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.3"
4040
```
4141

4242
Example Applications
@@ -130,7 +130,7 @@ import com.google.gcloud.bigquery.BigQuery;
130130
import com.google.gcloud.bigquery.BigQueryOptions;
131131
import com.google.gcloud.bigquery.Field;
132132
import com.google.gcloud.bigquery.JobStatus;
133-
import com.google.gcloud.bigquery.LoadJobInfo;
133+
import com.google.gcloud.bigquery.JobInfo;
134134
import com.google.gcloud.bigquery.Schema;
135135
import com.google.gcloud.bigquery.TableId;
136136
import com.google.gcloud.bigquery.TableInfo;
@@ -144,7 +144,8 @@ if (info == null) {
144144
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
145145
} else {
146146
System.out.println("Loading data into table " + tableId);
147-
LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
147+
LoadJobConfiguration configuration = LoadJobConfiguration.of(tableId, "gs://bucket/path");
148+
JobInfo loadJob = JobInfo.of(configuration);
148149
loadJob = bigquery.create(loadJob);
149150
while (loadJob.status().state() != JobStatus.State.DONE) {
150151
Thread.sleep(1000L);

branches/update-datastore/RELEASING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ 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+
2931
### To push a snapshot version
3032

3133
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/update-datastore/gcloud-java-bigquery/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ If you are using Maven, add this to your pom.xml file
2020
<dependency>
2121
<groupId>com.google.gcloud</groupId>
2222
<artifactId>gcloud-java-bigquery</artifactId>
23-
<version>0.1.2</version>
23+
<version>0.1.3</version>
2424
</dependency>
2525
```
2626
If you are using Gradle, add this to your dependencies
2727
```Groovy
28-
compile 'com.google.gcloud:gcloud-java-bigquery:0.1.2'
28+
compile 'com.google.gcloud:gcloud-java-bigquery:0.1.3'
2929
```
3030
If you are using SBT, add this to your dependencies
3131
```Scala
32-
libraryDependencies += "com.google.gcloud" % "gcloud-java-bigquery" % "0.1.2"
32+
libraryDependencies += "com.google.gcloud" % "gcloud-java-bigquery" % "0.1.3"
3333
```
3434

3535
Example Application

branches/update-datastore/gcloud-java-bigquery/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>com.google.gcloud</groupId>
1313
<artifactId>gcloud-java-pom</artifactId>
14-
<version>0.1.3-SNAPSHOT</version>
14+
<version>0.1.4-SNAPSHOT</version>
1515
</parent>
1616
<properties>
1717
<site.installationModule>gcloud-java-bigquery</site.installationModule>

branches/update-datastore/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Acl.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -370,22 +370,11 @@ Access toPb() {
370370
}
371371
}
372372

373-
/**
374-
* Build an ACL for an {@code entity} and a {@code role}.
375-
*/
376-
public Acl(Entity entity, Role role) {
373+
private Acl(Entity entity, Role role) {
377374
this.entity = checkNotNull(entity);
378375
this.role = role;
379376
}
380377

381-
/**
382-
* Build an ACL for a view entity.
383-
*/
384-
public Acl(View view) {
385-
this.entity = checkNotNull(view);
386-
this.role = null;
387-
}
388-
389378
/**
390379
* Returns the entity for this ACL.
391380
*/
@@ -400,6 +389,23 @@ public Role role() {
400389
return role;
401390
}
402391

392+
/**
393+
* Returns an Acl object.
394+
*
395+
* @param entity the entity for this ACL object
396+
* @param role the role to associate to the {@code entity} object
397+
*/
398+
public static Acl of(Entity entity, Role role) {
399+
return new Acl(entity, role);
400+
}
401+
402+
/**
403+
* Returns an Acl object for a view entity.
404+
*/
405+
public static Acl of(View view) {
406+
return new Acl(view, null);
407+
}
408+
403409
@Override
404410
public int hashCode() {
405411
return Objects.hash(entity, role);
@@ -432,7 +438,7 @@ Access toPb() {
432438
}
433439

434440
static Acl fromPb(Access access) {
435-
return new Acl(Entity.fromPb(access),
441+
return Acl.of(Entity.fromPb(access),
436442
access.getRole() != null ? Role.valueOf(access.getRole()) : null);
437443
}
438444
}

branches/update-datastore/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BaseTableInfo.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,16 @@ public String toString() {
386386
return toStringHelper().toString();
387387
}
388388

389-
@Override
390-
public int hashCode() {
389+
protected final int baseHashCode() {
391390
return Objects.hash(tableId);
392391
}
393392

394-
@Override
395-
public boolean equals(Object obj) {
396-
return obj instanceof BaseTableInfo && Objects.equals(toPb(), ((BaseTableInfo) obj).toPb());
393+
protected final boolean baseEquals(BaseTableInfo tableInfo) {
394+
return Objects.equals(toPb(), tableInfo.toPb());
395+
}
396+
397+
BaseTableInfo setProjectId(String projectId) {
398+
return toBuilder().tableId(tableId().setProjectId(projectId)).build();
397399
}
398400

399401
Table toPb() {

branches/update-datastore/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQuery.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,9 @@ public static JobListOption startPageToken(String pageToken) {
371371
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
372372
* specify only the fields of interest. {@link JobInfo#jobId()}, {@link JobStatus#state()},
373373
* {@link JobStatus#error()} as well as type-specific configuration (e.g.
374-
* {@link QueryJobInfo#query()} for Query Jobs) are always returned, even if not specified.
375-
* {@link JobField#SELF_LINK} and {@link JobField#ETAG} can not be selected when listing jobs.
374+
* {@link QueryJobConfiguration#query()} for Query Jobs) are always returned, even if not
375+
* specified. {@link JobField#SELF_LINK} and {@link JobField#ETAG} can not be selected when
376+
* listing jobs.
376377
*/
377378
public static JobListOption fields(JobField... fields) {
378379
String selector = JobField.selector(fields);
@@ -397,8 +398,8 @@ private JobOption(BigQueryRpc.Option option, Object value) {
397398
* Returns an option to specify the job's fields to be returned by the RPC call. If this option
398399
* is not provided all job's fields are returned. {@code JobOption.fields()} can be used to
399400
* specify only the fields of interest. {@link JobInfo#jobId()} as well as type-specific
400-
* configuration (e.g. {@link QueryJobInfo#query()} for Query Jobs) are always returned, even if
401-
* not specified.
401+
* configuration (e.g. {@link QueryJobConfiguration#query()} for Query Jobs) are always
402+
* returned, even if not specified.
402403
*/
403404
public static JobOption fields(JobField... fields) {
404405
return new JobOption(BigQueryRpc.Option.FIELDS, JobField.selector(fields));
@@ -470,7 +471,7 @@ public static QueryResultsOption maxWaitTime(long maxWaitTime) {
470471
*
471472
* @throws BigQueryException upon failure
472473
*/
473-
<T extends JobInfo> T create(T job, JobOption... options) throws BigQueryException;
474+
JobInfo create(JobInfo job, JobOption... options) throws BigQueryException;
474475

475476
/**
476477
* Returns the requested dataset or {@code null} if not found.
@@ -611,14 +612,14 @@ Page<List<FieldValue>> listTableData(TableId tableId, TableDataListOption... opt
611612
*
612613
* @throws BigQueryException upon failure
613614
*/
614-
<T extends JobInfo> T getJob(String jobId, JobOption... options) throws BigQueryException;
615+
JobInfo getJob(String jobId, JobOption... options) throws BigQueryException;
615616

616617
/**
617618
* Returns the requested job or {@code null} if not found.
618619
*
619620
* @throws BigQueryException upon failure
620621
*/
621-
<T extends JobInfo> T getJob(JobId jobId, JobOption... options) throws BigQueryException;
622+
JobInfo getJob(JobId jobId, JobOption... options) throws BigQueryException;
622623

623624
/**
624625
* Lists the jobs.
@@ -665,9 +666,9 @@ Page<List<FieldValue>> listTableData(TableId tableId, TableDataListOption... opt
665666

666667
/**
667668
* Returns a channel to write data to be inserted into a BigQuery table. Data format and other
668-
* options can be configured using the {@link LoadConfiguration} parameter.
669+
* options can be configured using the {@link WriteChannelConfiguration} parameter.
669670
*
670671
* @throws BigQueryException upon failure
671672
*/
672-
TableDataWriteChannel writer(LoadConfiguration loadConfiguration);
673+
TableDataWriteChannel writer(WriteChannelConfiguration writeChannelConfiguration);
673674
}

branches/update-datastore/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQueryException.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package com.google.gcloud.bigquery;
1818

19-
import com.google.api.client.googleapis.json.GoogleJsonError;
20-
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
2119
import com.google.common.collect.ImmutableSet;
2220
import com.google.gcloud.BaseServiceException;
2321
import com.google.gcloud.RetryHelper.RetryHelperException;
@@ -55,16 +53,11 @@ public BigQueryException(int code, String message, BigQueryError error) {
5553

5654
public BigQueryException(IOException exception) {
5755
super(exception, true);
58-
BigQueryError bigqueryError = null;
59-
if (exception instanceof GoogleJsonResponseException) {
60-
GoogleJsonError error = ((GoogleJsonResponseException) exception).getDetails();
61-
if (error != null && error.getErrors() != null && !error.getErrors().isEmpty()) {
62-
GoogleJsonError.ErrorInfo errorInfo = error.getErrors().get(0);
63-
bigqueryError = new BigQueryError(errorInfo.getReason(), errorInfo.getLocation(),
64-
errorInfo.getMessage(), (String) error.get("debugInfo"));
65-
}
56+
BigQueryError error = null;
57+
if (reason() != null) {
58+
error = new BigQueryError(reason(), location(), getMessage(), debugInfo());
6659
}
67-
this.error = bigqueryError;
60+
this.error = error;
6861
}
6962

7063
/**

0 commit comments

Comments
 (0)