diff --git a/README.md b/README.md
index 0f54c0c5d1d7..018ce7eee1db 100644
--- a/README.md
+++ b/README.md
@@ -36,16 +36,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java:0.2.6'
+compile 'com.google.cloud:gcloud-java:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java" % "0.2.7"
```
Example Applications
diff --git a/gcloud-java-bigquery/README.md b/gcloud-java-bigquery/README.md
index 86c8a760ad48..bcdeb05c54c5 100644
--- a/gcloud-java-bigquery/README.md
+++ b/gcloud-java-bigquery/README.md
@@ -22,16 +22,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-bigquery
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-bigquery:0.2.6'
+compile 'com.google.cloud:gcloud-java-bigquery:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-bigquery" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-bigquery" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-bigquery/pom.xml b/gcloud-java-bigquery/pom.xml
index 8b29ccb53d71..4d6d5b3e06ff 100644
--- a/gcloud-java-bigquery/pom.xml
+++ b/gcloud-java-bigquery/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-bigquery
diff --git a/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryJobConfiguration.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryJobConfiguration.java
index 73b1403245c7..e540a6e72c70 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryJobConfiguration.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryJobConfiguration.java
@@ -51,6 +51,7 @@ public final class QueryJobConfiguration extends JobConfiguration {
private final Boolean useQueryCache;
private final Boolean flattenResults;
private final Boolean dryRun;
+ private final Boolean useLegacySql;
/**
* Priority levels for a query. If not specified the priority is assumed to be
@@ -87,6 +88,7 @@ public static final class Builder
private Boolean useQueryCache;
private Boolean flattenResults;
private Boolean dryRun;
+ private Boolean useLegacySql;
private Builder() {
super(Type.QUERY);
@@ -106,6 +108,7 @@ private Builder(QueryJobConfiguration jobConfiguration) {
this.useQueryCache = jobConfiguration.useQueryCache;
this.flattenResults = jobConfiguration.flattenResults;
this.dryRun = jobConfiguration.dryRun;
+ this.useLegacySql = jobConfiguration.useLegacySql;
}
private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {
@@ -115,6 +118,7 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur
allowLargeResults = queryConfigurationPb.getAllowLargeResults();
useQueryCache = queryConfigurationPb.getUseQueryCache();
flattenResults = queryConfigurationPb.getFlattenResults();
+ useLegacySql = queryConfigurationPb.getUseLegacySql();
dryRun = configurationPb.getDryRun();
if (queryConfigurationPb.getDestinationTable() != null) {
destinationTable = TableId.fromPb(queryConfigurationPb.getDestinationTable());
@@ -293,6 +297,20 @@ public Builder dryRun(Boolean dryRun) {
return this;
}
+ /**
+ * Sets whether to use BigQuery's legacy SQL dialect for this query. If set to {@code false},
+ * the query will use BigQuery's
+ * Standard SQL. When set to {@code false}, the values of
+ * {@link #allowLargeResults(Boolean)} and {@link #flattenResults(Boolean)} are ignored; query
+ * will be run as if {@link #allowLargeResults(Boolean)} is {@code true} and
+ * {@link #flattenResults(Boolean)} is {@code false}. If not set, legacy SQL dialect is used.
+ * This property is experimental and might be subject to change.
+ */
+ public Builder useLegacySql(Boolean useLegacySql) {
+ this.useLegacySql = useLegacySql;
+ return this;
+ }
+
public QueryJobConfiguration build() {
return new QueryJobConfiguration(this);
}
@@ -313,6 +331,7 @@ private QueryJobConfiguration(Builder builder) {
this.tableDefinitions =
builder.tableDefinitions != null ? ImmutableMap.copyOf(builder.tableDefinitions) : null;
this.dryRun = builder.dryRun;
+ this.useLegacySql = builder.useLegacySql;
}
/**
@@ -426,6 +445,18 @@ public Boolean dryRun() {
return dryRun;
}
+ /**
+ * Returns whether to use BigQuery's legacy SQL dialect for this query. If set to {@code false},
+ * the query will use BigQuery's
+ * Standard SQL. When set to {@code false}, the values of {@link #allowLargeResults()} and
+ * {@link #flattenResults()} are ignored; query will be run as if {@link #allowLargeResults()} is
+ * {@code true} and {@link #flattenResults()} is {@code false}. If not set, legacy SQL dialect is
+ * used. This property is experimental and might be subject to change.
+ */
+ public Boolean useLegacySql() {
+ return useLegacySql;
+ }
+
@Override
public Builder toBuilder() {
return new Builder(this);
@@ -445,7 +476,8 @@ ToStringHelper toStringHelper() {
.add("userDefinedFunctions", userDefinedFunctions)
.add("createDisposition", createDisposition)
.add("writeDisposition", writeDisposition)
- .add("dryRun", dryRun);
+ .add("dryRun", dryRun)
+ .add("useLegacySql", useLegacySql);
}
@Override
@@ -459,7 +491,7 @@ public boolean equals(Object obj) {
public int hashCode() {
return Objects.hash(baseHashCode(), allowLargeResults, createDisposition, destinationTable,
defaultDataset, flattenResults, priority, query, tableDefinitions, useQueryCache,
- userDefinedFunctions, writeDisposition, dryRun);
+ userDefinedFunctions, writeDisposition, dryRun, useLegacySql);
}
@Override
@@ -513,6 +545,9 @@ com.google.api.services.bigquery.model.JobConfiguration toPb() {
if (writeDisposition != null) {
queryConfigurationPb.setWriteDisposition(writeDisposition.toString());
}
+ if (useLegacySql != null) {
+ queryConfigurationPb.setUseLegacySql(useLegacySql);
+ }
return configurationPb.setQuery(queryConfigurationPb);
}
diff --git a/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryRequest.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryRequest.java
index 166e0db9a18d..fba99340cde7 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryRequest.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/QueryRequest.java
@@ -70,6 +70,7 @@ public final class QueryRequest implements Serializable {
private final Long maxWaitTime;
private final Boolean dryRun;
private final Boolean useQueryCache;
+ private final Boolean useLegacySql;
public static final class Builder {
@@ -79,6 +80,7 @@ public static final class Builder {
private Long maxWaitTime;
private Boolean dryRun;
private Boolean useQueryCache;
+ private Boolean useLegacySql;
private Builder() {}
@@ -150,6 +152,17 @@ public Builder useQueryCache(Boolean useQueryCache) {
return this;
}
+ /**
+ * Sets whether to use BigQuery's legacy SQL dialect for this query. If set to {@code false},
+ * the query will use BigQuery's
+ * Standard SQL. If not set, legacy SQL dialect is used. This property is experimental and
+ * might be subject to change.
+ */
+ public Builder useLegacySql(Boolean useLegacySql) {
+ this.useLegacySql = useLegacySql;
+ return this;
+ }
+
public QueryRequest build() {
return new QueryRequest(this);
}
@@ -162,6 +175,7 @@ private QueryRequest(Builder builder) {
maxWaitTime = builder.maxWaitTime;
dryRun = builder.dryRun;
useQueryCache = builder.useQueryCache;
+ useLegacySql = builder.useLegacySql;
}
/**
@@ -218,6 +232,16 @@ public Boolean useQueryCache() {
return useQueryCache;
}
+ /**
+ * Returns whether to use BigQuery's legacy SQL dialect for this query. If set to {@code false},
+ * the query will use BigQuery's
+ * Standard SQL. If not set, legacy SQL dialect is used. This property is experimental and
+ * might be subject to change.
+ */
+ public Boolean useLegacySql() {
+ return useLegacySql;
+ }
+
/**
* Returns a builder for the {@code QueryRequest} object.
*/
@@ -228,7 +252,8 @@ public Builder toBuilder() {
.defaultDataset(defaultDataset)
.maxWaitTime(maxWaitTime)
.dryRun(dryRun)
- .useQueryCache(useQueryCache);
+ .useQueryCache(useQueryCache)
+ .useLegacySql(useLegacySql);
}
@Override
@@ -240,12 +265,14 @@ public String toString() {
.add("maxWaitTime", maxWaitTime)
.add("dryRun", dryRun)
.add("useQueryCache", useQueryCache)
+ .add("useLegacySql", useLegacySql)
.toString();
}
@Override
public int hashCode() {
- return Objects.hash(query, pageSize, defaultDataset, maxWaitTime, dryRun, useQueryCache);
+ return Objects.hash(query, pageSize, defaultDataset, maxWaitTime, dryRun, useQueryCache,
+ useLegacySql);
}
@Override
@@ -281,6 +308,9 @@ com.google.api.services.bigquery.model.QueryRequest toPb() {
if (useQueryCache != null) {
queryRequestPb.setUseQueryCache(useQueryCache);
}
+ if (useLegacySql != null) {
+ queryRequestPb.setUseLegacySql(useLegacySql);
+ }
return queryRequestPb;
}
@@ -315,6 +345,9 @@ static QueryRequest fromPb(com.google.api.services.bigquery.model.QueryRequest q
if (queryRequestPb.getUseQueryCache() != null) {
builder.useQueryCache(queryRequestPb.getUseQueryCache());
}
+ if (queryRequestPb.getUseLegacySql() != null) {
+ builder.useLegacySql(queryRequestPb.getUseLegacySql());
+ }
return builder.build();
}
}
diff --git a/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/StandardTableDefinition.java b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/StandardTableDefinition.java
index ca6a533d0fe7..d6a5bd17a959 100644
--- a/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/StandardTableDefinition.java
+++ b/gcloud-java-bigquery/src/main/java/com/google/cloud/bigquery/StandardTableDefinition.java
@@ -53,9 +53,9 @@ public static class StreamingBuffer implements Serializable {
private static final long serialVersionUID = 822027055549277843L;
private final long estimatedRows;
private final long estimatedBytes;
- private final long oldestEntryTime;
+ private final Long oldestEntryTime;
- StreamingBuffer(long estimatedRows, long estimatedBytes, long oldestEntryTime) {
+ StreamingBuffer(long estimatedRows, long estimatedBytes, Long oldestEntryTime) {
this.estimatedRows = estimatedRows;
this.estimatedBytes = estimatedBytes;
this.oldestEntryTime = oldestEntryTime;
@@ -77,9 +77,9 @@ public long estimatedBytes() {
/**
* Returns the timestamp of the oldest entry in the streaming buffer, in milliseconds since
- * epoch.
+ * epoch. Returns {@code null} if the streaming buffer is empty.
*/
- public long oldestEntryTime() {
+ public Long oldestEntryTime() {
return oldestEntryTime;
}
@@ -111,9 +111,13 @@ Streamingbuffer toPb() {
}
static StreamingBuffer fromPb(Streamingbuffer streamingBufferPb) {
+ Long oldestEntryTime = null;
+ if (streamingBufferPb.getOldestEntryTime() != null) {
+ oldestEntryTime = streamingBufferPb.getOldestEntryTime().longValue();
+ }
return new StreamingBuffer(streamingBufferPb.getEstimatedRows().longValue(),
streamingBufferPb.getEstimatedBytes().longValue(),
- streamingBufferPb.getOldestEntryTime().longValue());
+ oldestEntryTime);
}
}
diff --git a/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java
index 914a6db4d5eb..bafb7f00d934 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryJobConfigurationTest.java
@@ -72,6 +72,7 @@ public class QueryJobConfigurationTest {
private static final boolean ALLOW_LARGE_RESULTS = true;
private static final boolean USE_QUERY_CACHE = false;
private static final boolean FLATTEN_RESULTS = true;
+ private static final boolean USE_LEGACY_SQL = true;
private static final List USER_DEFINED_FUNCTIONS = ImmutableList.of(
UserDefinedFunction.inline("Function"), UserDefinedFunction.fromUri("URI"));
private static final QueryJobConfiguration QUERY_JOB_CONFIGURATION =
@@ -87,6 +88,7 @@ public class QueryJobConfigurationTest {
.flattenResults(FLATTEN_RESULTS)
.userDefinedFunctions(USER_DEFINED_FUNCTIONS)
.dryRun(true)
+ .useLegacySql(USE_LEGACY_SQL)
.build();
@Test
@@ -127,6 +129,7 @@ public void testBuilder() {
assertEquals(USER_DEFINED_FUNCTIONS, QUERY_JOB_CONFIGURATION.userDefinedFunctions());
assertEquals(WRITE_DISPOSITION, QUERY_JOB_CONFIGURATION.writeDisposition());
assertTrue(QUERY_JOB_CONFIGURATION.dryRun());
+ assertTrue(QUERY_JOB_CONFIGURATION.useLegacySql());
}
@Test
@@ -165,5 +168,6 @@ private void compareQueryJobConfiguration(QueryJobConfiguration expected,
assertEquals(expected.useQueryCache(), value.useQueryCache());
assertEquals(expected.userDefinedFunctions(), value.userDefinedFunctions());
assertEquals(expected.writeDisposition(), value.writeDisposition());
+ assertEquals(expected.useLegacySql(), value.useLegacySql());
}
}
diff --git a/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestTest.java b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestTest.java
index f3682aa78457..083167d1ff31 100644
--- a/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestTest.java
+++ b/gcloud-java-bigquery/src/test/java/com/google/cloud/bigquery/QueryRequestTest.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Rule;
import org.junit.Test;
@@ -31,12 +32,14 @@ public class QueryRequestTest {
private static final Boolean DRY_RUN = false;
private static final Long PAGE_SIZE = 42L;
private static final Long MAX_WAIT_TIME = 42000L;
+ private static final Boolean USE_LEGACY_SQL = true;
private static final QueryRequest QUERY_REQUEST = QueryRequest.builder(QUERY)
.useQueryCache(USE_QUERY_CACHE)
.defaultDataset(DATASET_ID)
.dryRun(DRY_RUN)
.pageSize(PAGE_SIZE)
.maxWaitTime(MAX_WAIT_TIME)
+ .useLegacySql(USE_LEGACY_SQL)
.build();
@Rule
@@ -67,6 +70,7 @@ public void testBuilder() {
assertEquals(DRY_RUN, QUERY_REQUEST.dryRun());
assertEquals(PAGE_SIZE, QUERY_REQUEST.pageSize());
assertEquals(MAX_WAIT_TIME, QUERY_REQUEST.maxWaitTime());
+ assertTrue(QUERY_REQUEST.useLegacySql());
thrown.expect(NullPointerException.class);
QueryRequest.builder(null);
}
@@ -80,6 +84,7 @@ public void testOf() {
assertNull(request.dryRun());
assertNull(request.pageSize());
assertNull(request.maxWaitTime());
+ assertNull(request.useLegacySql());
thrown.expect(NullPointerException.class);
QueryRequest.of(null);
}
@@ -104,5 +109,6 @@ private void compareQueryRequest(QueryRequest expected, QueryRequest value) {
assertEquals(expected.dryRun(), value.dryRun());
assertEquals(expected.pageSize(), value.pageSize());
assertEquals(expected.maxWaitTime(), value.maxWaitTime());
+ assertEquals(expected.useLegacySql(), value.useLegacySql());
}
}
diff --git a/gcloud-java-compute/README.md b/gcloud-java-compute/README.md
index 329e7cdbf2d0..2909d4dc50ac 100644
--- a/gcloud-java-compute/README.md
+++ b/gcloud-java-compute/README.md
@@ -22,16 +22,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-compute
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-compute:0.2.6'
+compile 'com.google.cloud:gcloud-java-compute:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-compute" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-compute" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-compute/pom.xml b/gcloud-java-compute/pom.xml
index b7dd5cb572f0..7f0d64d17c19 100644
--- a/gcloud-java-compute/pom.xml
+++ b/gcloud-java-compute/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-compute
diff --git a/gcloud-java-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java b/gcloud-java-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java
index bdf7fa0a57b4..44174c66da15 100644
--- a/gcloud-java-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java
+++ b/gcloud-java-compute/src/main/java/com/google/cloud/compute/DeprecationStatus.java
@@ -96,8 +96,8 @@ public static final class Builder {
*
* @see RFC3339
*/
- // todo(mziccard): remove this method if #732 is closed
- public Builder deleted(String deleted) {
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ Builder deleted(String deleted) {
this.deleted = deleted;
return this;
}
@@ -108,8 +108,8 @@ public Builder deleted(String deleted) {
*
* @see RFC3339
*/
- // todo(mziccard): remove this method if #732 is closed
- public Builder deprecated(String deprecated) {
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ Builder deprecated(String deprecated) {
this.deprecated = deprecated;
return this;
}
@@ -120,8 +120,8 @@ public Builder deprecated(String deprecated) {
*
* @see RFC3339
*/
- // todo(mziccard): remove this method if #732 is closed
- public Builder obsolete(String obsolete) {
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
+ Builder obsolete(String obsolete) {
this.obsolete = obsolete;
return this;
}
@@ -193,7 +193,7 @@ public DeprecationStatus build() {
*
* @see RFC3339
*/
- // todo(mziccard): remove this method if #732 is closed
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
public String deleted() {
return deleted;
}
@@ -205,7 +205,7 @@ public String deleted() {
*
* @see RFC3339
*/
- // todo(mziccard): remove this method if #732 is closed
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
public String deprecated() {
return deprecated;
}
@@ -217,7 +217,7 @@ public String deprecated() {
*
* @see RFC3339
*/
- // todo(mziccard): remove this method if #732 is closed
+ // Wrongly-formatted timestamps were allowed, we must still support them (see #732 for details)
public String obsolete() {
return obsolete;
}
diff --git a/gcloud-java-contrib/README.md b/gcloud-java-contrib/README.md
index ac9d83c2e3c5..ac5755380a7f 100644
--- a/gcloud-java-contrib/README.md
+++ b/gcloud-java-contrib/README.md
@@ -25,16 +25,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-contrib
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-contrib:0.2.6'
+compile 'com.google.cloud:gcloud-java-contrib:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-contrib" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-contrib" % "0.2.7"
```
### gcloud-java-nio-examples
diff --git a/gcloud-java-contrib/gcloud-java-nio-examples/README.md b/gcloud-java-contrib/gcloud-java-nio-examples/README.md
index 637ff5dc0d28..5f12ffa11671 100644
--- a/gcloud-java-contrib/gcloud-java-nio-examples/README.md
+++ b/gcloud-java-contrib/gcloud-java-nio-examples/README.md
@@ -22,12 +22,12 @@ To run this example:
4. Run the sample with:
```
- java -cp gcloud-java-contrib/gcloud-java-nio/target/gcloud-java-nio-0.2.7-SNAPSHOT-shaded.jar:gcloud-java-contrib/gcloud-java-nio-examples/target/gcloud-java-nio-examples-0.2.7-SNAPSHOT.jar com.google.cloud.nio.examples.ListFilesystems
+ java -cp gcloud-java-contrib/gcloud-java-nio/target/gcloud-java-nio-0.2.8-SNAPSHOT-shaded.jar:gcloud-java-contrib/gcloud-java-nio-examples/target/gcloud-java-nio-examples-0.2.8-SNAPSHOT.jar com.google.cloud.nio.examples.ListFilesystems
```
Notice that it lists Google Cloud Storage, which it wouldn't if you ran it without the NIO jar:
```
- java -cp gcloud-java-contrib/gcloud-java-nio-examples/target/gcloud-java-nio-examples-0.2.7-SNAPSHOT.jar com.google.cloud.nio.examples.ListFilesystems
+ java -cp gcloud-java-contrib/gcloud-java-nio-examples/target/gcloud-java-nio-examples-0.2.8-SNAPSHOT.jar com.google.cloud.nio.examples.ListFilesystems
```
The sample doesn't have anything about Google Cloud Storage in it. It gets that ability from the NIO
diff --git a/gcloud-java-contrib/gcloud-java-nio-examples/pom.xml b/gcloud-java-contrib/gcloud-java-nio-examples/pom.xml
index 502296436f53..9a9db48b7fe8 100644
--- a/gcloud-java-contrib/gcloud-java-nio-examples/pom.xml
+++ b/gcloud-java-contrib/gcloud-java-nio-examples/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-contrib
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
nio
diff --git a/gcloud-java-contrib/gcloud-java-nio/README.md b/gcloud-java-contrib/gcloud-java-nio/README.md
index d2022030dc88..79d400a496cd 100644
--- a/gcloud-java-contrib/gcloud-java-nio/README.md
+++ b/gcloud-java-contrib/gcloud-java-nio/README.md
@@ -26,16 +26,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-nio
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-nio:0.2.6'
+compile 'com.google.cloud:gcloud-java-nio:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-nio" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-nio" % "0.2.7"
```
Example Applications
diff --git a/gcloud-java-contrib/gcloud-java-nio/pom.xml b/gcloud-java-contrib/gcloud-java-nio/pom.xml
index 94904c719221..d092bd4e8200 100644
--- a/gcloud-java-contrib/gcloud-java-nio/pom.xml
+++ b/gcloud-java-contrib/gcloud-java-nio/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-contrib
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
nio
diff --git a/gcloud-java-contrib/pom.xml b/gcloud-java-contrib/pom.xml
index cd156a68b150..d8afbd66e025 100644
--- a/gcloud-java-contrib/pom.xml
+++ b/gcloud-java-contrib/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-contrib
diff --git a/gcloud-java-core/README.md b/gcloud-java-core/README.md
index 1ce1f94ec50d..6f34f81917ef 100644
--- a/gcloud-java-core/README.md
+++ b/gcloud-java-core/README.md
@@ -19,16 +19,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-core
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-core:0.2.6'
+compile 'com.google.cloud:gcloud-java-core:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-core" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-core" % "0.2.7"
```
Troubleshooting
diff --git a/gcloud-java-core/pom.xml b/gcloud-java-core/pom.xml
index 98af8188e33f..c09367fccddf 100644
--- a/gcloud-java-core/pom.xml
+++ b/gcloud-java-core/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-core
diff --git a/gcloud-java-datastore/README.md b/gcloud-java-datastore/README.md
index 0265f9cceffe..0a3eb8b221b1 100644
--- a/gcloud-java-datastore/README.md
+++ b/gcloud-java-datastore/README.md
@@ -22,16 +22,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-datastore
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-datastore:0.2.6'
+compile 'com.google.cloud:gcloud-java-datastore:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-datastore" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-datastore" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-datastore/pom.xml b/gcloud-java-datastore/pom.xml
index f0a792322c8b..92631b8da3eb 100644
--- a/gcloud-java-datastore/pom.xml
+++ b/gcloud-java-datastore/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-datastore
diff --git a/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DefaultDatastoreRpc.java b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DefaultDatastoreRpc.java
index 255da4c6e229..9df21d595fb5 100644
--- a/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DefaultDatastoreRpc.java
+++ b/gcloud-java-datastore/src/main/java/com/google/cloud/datastore/spi/DefaultDatastoreRpc.java
@@ -16,6 +16,7 @@
package com.google.cloud.datastore.spi;
+import com.google.api.client.http.HttpTransport;
import com.google.cloud.datastore.DatastoreException;
import com.google.cloud.datastore.DatastoreOptions;
import com.google.datastore.v1beta3.AllocateIdsRequest;
@@ -40,10 +41,12 @@ public class DefaultDatastoreRpc implements DatastoreRpc {
private final com.google.datastore.v1beta3.client.Datastore client;
public DefaultDatastoreRpc(DatastoreOptions options) {
+ HttpTransport transport = options.httpTransportFactory().create();
com.google.datastore.v1beta3.client.DatastoreOptions.Builder clientBuilder =
new com.google.datastore.v1beta3.client.DatastoreOptions.Builder()
.projectId(options.projectId())
- .initializer(options.httpRequestInitializer());
+ .initializer(options.httpRequestInitializer())
+ .transport(transport);
String normalizedHost = options.host() != null ? options.host().toLowerCase() : "";
if (isLocalHost(normalizedHost)) {
clientBuilder = clientBuilder.localHost(removeScheme(normalizedHost));
@@ -100,7 +103,7 @@ private static DatastoreException translate(
}
}
return new DatastoreException(
- exception.getCode().ordinal(), exception.getMessage(), reason, exception);
+ exception.getCode().getNumber(), exception.getMessage(), reason, exception);
}
@Override
diff --git a/gcloud-java-dns/README.md b/gcloud-java-dns/README.md
index f14026402207..e0f6e6d41cdf 100644
--- a/gcloud-java-dns/README.md
+++ b/gcloud-java-dns/README.md
@@ -22,16 +22,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-dns
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-dns:0.2.6'
+compile 'com.google.cloud:gcloud-java-dns:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-dns" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-dns" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-dns/pom.xml b/gcloud-java-dns/pom.xml
index 8c902a414629..b8132f214b77 100644
--- a/gcloud-java-dns/pom.xml
+++ b/gcloud-java-dns/pom.xml
@@ -13,7 +13,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-dns
diff --git a/gcloud-java-examples/README.md b/gcloud-java-examples/README.md
index cb7e6ca6837b..0eed7ca402f5 100644
--- a/gcloud-java-examples/README.md
+++ b/gcloud-java-examples/README.md
@@ -19,16 +19,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-examples
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-examples:0.2.6'
+compile 'com.google.cloud:gcloud-java-examples:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-examples" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-examples" % "0.2.7"
```
To run examples from your command line:
diff --git a/gcloud-java-examples/pom.xml b/gcloud-java-examples/pom.xml
index e7625e2a6b25..6a1052a49e21 100644
--- a/gcloud-java-examples/pom.xml
+++ b/gcloud-java-examples/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-examples
diff --git a/gcloud-java-logging/README.md b/gcloud-java-logging/README.md
index 768b6d4d3385..2f551cb36b57 100644
--- a/gcloud-java-logging/README.md
+++ b/gcloud-java-logging/README.md
@@ -26,16 +26,16 @@ Add this to your pom.xml file
com.google.gcloud
gcloud-java-logging
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-logging:0.2.6'
+compile 'com.google.cloud:gcloud-java-logging:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-logging" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-logging" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-logging/pom.xml b/gcloud-java-logging/pom.xml
index 3e4cb33a905e..c380177d9829 100644
--- a/gcloud-java-logging/pom.xml
+++ b/gcloud-java-logging/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-logging
diff --git a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java
index 0cdccb9de317..ae6825c9fa27 100644
--- a/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java
+++ b/gcloud-java-logging/src/main/java/com/google/cloud/logging/spi/DefaultLoggingRpc.java
@@ -16,6 +16,8 @@
package com.google.cloud.logging.spi;
+import static com.google.common.base.MoreObjects.firstNonNull;
+
import com.google.api.gax.core.RetrySettings;
import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ApiException;
@@ -97,13 +99,18 @@ protected ExecutorFactory executorFactory() {
public DefaultLoggingRpc(LoggingOptions options) throws IOException {
executorFactory = new InternalLoggingOptions(options).executorFactory();
executor = executorFactory.get();
+ String libraryName = options.libraryName();
+ String libraryVersion = firstNonNull(options.libraryVersion(), "");
try {
- ConfigServiceV2Settings.Builder confBuilder =
- ConfigServiceV2Settings.defaultBuilder().provideExecutorWith(executor, false);
- LoggingServiceV2Settings.Builder logBuilder =
- LoggingServiceV2Settings.defaultBuilder().provideExecutorWith(executor, false);
- MetricsServiceV2Settings.Builder metricsBuilder =
- MetricsServiceV2Settings.defaultBuilder().provideExecutorWith(executor, false);
+ ConfigServiceV2Settings.Builder confBuilder = ConfigServiceV2Settings.defaultBuilder()
+ .provideExecutorWith(executor, false)
+ .setClientLibHeader(libraryName, libraryVersion);
+ LoggingServiceV2Settings.Builder logBuilder = LoggingServiceV2Settings.defaultBuilder()
+ .provideExecutorWith(executor, false)
+ .setClientLibHeader(libraryName, libraryVersion);
+ MetricsServiceV2Settings.Builder metricsBuilder = MetricsServiceV2Settings.defaultBuilder()
+ .provideExecutorWith(executor, false)
+ .setClientLibHeader(libraryName, libraryVersion);
// todo(mziccard): PublisherSettings should support null/absent credentials for testing
if (options.host().contains("localhost")
|| options.authCredentials().equals(AuthCredentials.noAuth())) {
diff --git a/gcloud-java-pubsub/README.md b/gcloud-java-pubsub/README.md
index 0a922ff662a5..e46931ca6492 100644
--- a/gcloud-java-pubsub/README.md
+++ b/gcloud-java-pubsub/README.md
@@ -26,16 +26,16 @@ Add this to your pom.xml file
com.google.cloud
gcloud-java-pubsub
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-pubsub:0.2.6'
+compile 'com.google.cloud:gcloud-java-pubsub:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-pubsub" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-pubsub" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-pubsub/pom.xml b/gcloud-java-pubsub/pom.xml
index b68f15199223..6d51a6444f66 100644
--- a/gcloud-java-pubsub/pom.xml
+++ b/gcloud-java-pubsub/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-pubsub
diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java
index 07691e09e1a4..cf10260ddeec 100644
--- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java
+++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/PubSubOptions.java
@@ -31,7 +31,7 @@ public class PubSubOptions extends GrpcServiceOptions SCOPES = ImmutableSet.of(PUBSUB_SCOPE);
- private static final String DEFAULT_HOST = "https://pubsub.googleapis.com";
+ private static final String DEFAULT_HOST = "pubsub.googleapis.com";
public static class DefaultPubSubFactory implements PubSubFactory {
private static final PubSubFactory INSTANCE = new DefaultPubSubFactory();
diff --git a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java
index 11b2948bc995..3ec3b284242c 100644
--- a/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java
+++ b/gcloud-java-pubsub/src/main/java/com/google/cloud/pubsub/spi/DefaultPubSubRpc.java
@@ -18,6 +18,7 @@
import static com.google.common.base.MoreObjects.firstNonNull;
+import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
import com.google.api.gax.grpc.ApiCallSettings;
import com.google.api.gax.grpc.ApiException;
@@ -139,10 +140,20 @@ public DefaultPubSubRpc(PubSubOptions options) throws IOException {
subBuilder.provideChannelWith(channel, true);
} else {
GoogleCredentials credentials = options.authCredentials().credentials();
- pubBuilder.provideChannelWith(
- credentials.createScoped(PublisherSettings.DEFAULT_SERVICE_SCOPES));
- subBuilder.provideChannelWith(
- credentials.createScoped(SubscriberSettings.DEFAULT_SERVICE_SCOPES));
+ ConnectionSettings pubConnectionSettings = ConnectionSettings.newBuilder()
+ .setServiceAddress(options.host())
+ .setPort(PublisherSettings.DEFAULT_SERVICE_PORT)
+ .provideCredentialsWith(
+ credentials.createScoped(PublisherSettings.DEFAULT_SERVICE_SCOPES))
+ .build();
+ ConnectionSettings subConnectionSettings = ConnectionSettings.newBuilder()
+ .setServiceAddress(options.host())
+ .setPort(SubscriberSettings.DEFAULT_SERVICE_PORT)
+ .provideCredentialsWith(
+ credentials.createScoped(SubscriberSettings.DEFAULT_SERVICE_SCOPES))
+ .build();
+ pubBuilder.provideChannelWith(pubConnectionSettings);
+ subBuilder.provideChannelWith(subConnectionSettings);
}
pubBuilder.applyToAllApiMethods(apiCallSettings(options));
subBuilder.applyToAllApiMethods(apiCallSettings(options));
diff --git a/gcloud-java-resourcemanager/README.md b/gcloud-java-resourcemanager/README.md
index 490e7874b969..d8731942255b 100644
--- a/gcloud-java-resourcemanager/README.md
+++ b/gcloud-java-resourcemanager/README.md
@@ -22,16 +22,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-resourcemanager
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-resourcemanager:0.2.6'
+compile 'com.google.cloud:gcloud-java-resourcemanager:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-resourcemanager" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-resourcemanager" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-resourcemanager/pom.xml b/gcloud-java-resourcemanager/pom.xml
index ce4eb03135fa..1d65c565fa64 100644
--- a/gcloud-java-resourcemanager/pom.xml
+++ b/gcloud-java-resourcemanager/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-resourcemanager
diff --git a/gcloud-java-storage/README.md b/gcloud-java-storage/README.md
index d758256c18bd..15c6aa0bb80b 100644
--- a/gcloud-java-storage/README.md
+++ b/gcloud-java-storage/README.md
@@ -22,16 +22,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java-storage
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java-storage:0.2.6'
+compile 'com.google.cloud:gcloud-java-storage:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java-storage" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java-storage" % "0.2.7"
```
Example Application
diff --git a/gcloud-java-storage/pom.xml b/gcloud-java-storage/pom.xml
index c93ba54cd0bd..9d9412772a2d 100644
--- a/gcloud-java-storage/pom.xml
+++ b/gcloud-java-storage/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-storage
diff --git a/gcloud-java-translate/pom.xml b/gcloud-java-translate/pom.xml
index f7c3c55e58f0..20aa12809a89 100644
--- a/gcloud-java-translate/pom.xml
+++ b/gcloud-java-translate/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
gcloud-java-translate
diff --git a/gcloud-java/README.md b/gcloud-java/README.md
index f49176fa28c8..db4b29abf8e1 100644
--- a/gcloud-java/README.md
+++ b/gcloud-java/README.md
@@ -27,16 +27,16 @@ If you are using Maven, add this to your pom.xml file
com.google.cloud
gcloud-java
- 0.2.6
+ 0.2.7
```
If you are using Gradle, add this to your dependencies
```Groovy
-compile 'com.google.cloud:gcloud-java:0.2.6'
+compile 'com.google.cloud:gcloud-java:0.2.7'
```
If you are using SBT, add this to your dependencies
```Scala
-libraryDependencies += "com.google.cloud" % "gcloud-java" % "0.2.6"
+libraryDependencies += "com.google.cloud" % "gcloud-java" % "0.2.7"
```
Troubleshooting
diff --git a/gcloud-java/pom.xml b/gcloud-java/pom.xml
index 486802088722..4ae17bff1d37 100644
--- a/gcloud-java/pom.xml
+++ b/gcloud-java/pom.xml
@@ -11,7 +11,7 @@
com.google.cloud
gcloud-java-pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
diff --git a/pom.xml b/pom.xml
index 05e0412d7abf..9c8895096d03 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.google.cloud
gcloud-java-pom
pom
- 0.2.7-SNAPSHOT
+ 0.2.8-SNAPSHOT
GCloud Java
https://github.com/GoogleCloudPlatform/gcloud-java