Skip to content

Commit f4b22a4

Browse files
committed
---
yaml --- r: 6061 b: refs/heads/tswast-patch-1 c: d15f2ca h: refs/heads/master i: 6059: 70ac261
1 parent 2fd684f commit f4b22a4

49 files changed

Lines changed: 186 additions & 184 deletions

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
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: fd924e5732122a03a292ee62eb4493f7ac881947
60+
refs/heads/tswast-patch-1: d15f2ca71c9723a1323df40d63da708996e3176b
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ 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 Datastore] (#google-cloud-datastore)
15+
- [Google Cloud Datastore] (https://cloud.google.com/datastore/)
1616

1717
<!---
1818
- [Google Cloud Storage] (https://cloud.google.com/storage/)

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/AuthCredentials.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,9 @@ public static AuthCredentials createForComputeEngine()
181181
/**
182182
* Returns the Application Default Credentials.
183183
*
184-
* <p>
185-
* Returns the Application Default Credentials which are credentials that identify and authorize
186-
* the whole application. This is the built-in service account if running on Google Compute Engine
187-
* or the credentials file from the path in the environment variable
184+
* <p>Returns the Application Default Credentials which are credentials that identify and
185+
* authorize the whole application. This is the built-in service account if running on
186+
* Google Compute Engine or the credentials file from the path in the environment variable
188187
* GOOGLE_APPLICATION_CREDENTIALS.
189188
* </p>
190189
*

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/Service.java

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

1717
package com.google.gcloud;
1818

19-
public interface Service<O extends ServiceOptions> {
20-
O options();
19+
public interface Service<OptionsT extends ServiceOptions<?, OptionsT>> {
20+
OptionsT options();
2121
}

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/ServiceOptions.java

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@
4545
import java.util.regex.Matcher;
4646
import java.util.regex.Pattern;
4747

48-
public abstract class ServiceOptions<R, O extends ServiceOptions<R, O>> implements Serializable {
48+
public abstract class ServiceOptions<
49+
ServiceRpcT,
50+
OptionsT extends ServiceOptions<ServiceRpcT, OptionsT>>
51+
implements Serializable {
4952

5053
private static final String DEFAULT_HOST = "https://www.googleapis.com";
5154
private static final long serialVersionUID = 1203687993961393350L;
@@ -56,7 +59,7 @@ public abstract class ServiceOptions<R, O extends ServiceOptions<R, O>> implemen
5659
private final HttpTransportFactory httpTransportFactory;
5760
private final AuthCredentials authCredentials;
5861
private final RetryParams retryParams;
59-
private final ServiceRpcFactory<R, O> serviceRpcFactory;
62+
private final ServiceRpcFactory<ServiceRpcT, OptionsT> serviceRpcFactory;
6063

6164
public interface HttpTransportFactory extends Serializable {
6265
HttpTransport create();
@@ -88,19 +91,21 @@ public HttpTransport create() {
8891

8992

9093

91-
protected abstract static class Builder<R, O extends ServiceOptions<R, O>,
92-
B extends Builder<R, O, B>> {
94+
protected abstract static class Builder<
95+
ServiceRpcT,
96+
OptionsT extends ServiceOptions<ServiceRpcT, OptionsT>,
97+
B extends Builder<ServiceRpcT, OptionsT, B>> {
9398

9499
private String projectId;
95100
private String host;
96101
private HttpTransportFactory httpTransportFactory;
97102
private AuthCredentials authCredentials;
98103
private RetryParams retryParams;
99-
private ServiceRpcFactory<R, O> serviceRpcFactory;
104+
private ServiceRpcFactory<ServiceRpcT, OptionsT> serviceRpcFactory;
100105

101106
protected Builder() {}
102107

103-
protected Builder(ServiceOptions<R, O> options) {
108+
protected Builder(ServiceOptions<ServiceRpcT, OptionsT> options) {
104109
projectId = options.projectId;
105110
host = options.host;
106111
httpTransportFactory = options.httpTransportFactory;
@@ -109,7 +114,7 @@ protected Builder(ServiceOptions<R, O> options) {
109114
serviceRpcFactory = options.serviceRpcFactory;
110115
}
111116

112-
protected abstract ServiceOptions build();
117+
protected abstract ServiceOptions<ServiceRpcT, OptionsT> build();
113118

114119
@SuppressWarnings("unchecked")
115120
protected B self() {
@@ -141,13 +146,13 @@ public B retryParams(RetryParams retryParams) {
141146
return self();
142147
}
143148

144-
public B serviceRpcFactory(ServiceRpcFactory<R, O> serviceRpcFactory) {
149+
public B serviceRpcFactory(ServiceRpcFactory<ServiceRpcT, OptionsT> serviceRpcFactory) {
145150
this.serviceRpcFactory = serviceRpcFactory;
146151
return self();
147152
}
148153
}
149154

150-
protected ServiceOptions(Builder<R, O, ?> builder) {
155+
protected ServiceOptions(Builder<ServiceRpcT, OptionsT, ?> builder) {
151156
projectId = checkNotNull(builder.projectId != null ? builder.projectId : defaultProject());
152157
host = firstNonNull(builder.host, DEFAULT_HOST);
153158
httpTransportFactory =
@@ -222,7 +227,7 @@ protected static String googleCloudProjectId() {
222227
String section = null;
223228
Pattern projectPattern = Pattern.compile("^project\\s*=\\s*(.*)$");
224229
Pattern sectionPattern = Pattern.compile("^\\[(.*)\\]$");
225-
while((line = reader.readLine()) != null) {
230+
while ((line = reader.readLine()) != null) {
226231
if (line.isEmpty() || line.startsWith(";")) {
227232
continue;
228233
}
@@ -245,7 +250,7 @@ protected static String googleCloudProjectId() {
245250
}
246251

247252
private static boolean isWindows() {
248-
return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).indexOf("windows") > -1;
253+
return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows");
249254
}
250255

251256
protected static String getAppEngineProjectId() {
@@ -288,7 +293,7 @@ public RetryParams retryParams() {
288293
return retryParams != null ? retryParams : RetryParams.noRetries();
289294
}
290295

291-
public ServiceRpcFactory<R, O> serviceRpcFactory() {
296+
public ServiceRpcFactory<ServiceRpcT, OptionsT> serviceRpcFactory() {
292297
return serviceRpcFactory;
293298
}
294299

@@ -297,13 +302,12 @@ public HttpRequestInitializer httpRequestInitializer() {
297302
return authCredentials().httpRequestInitializer(httpTransport, scopes());
298303
}
299304

300-
@Override
301-
public int hashCode() {
305+
protected int baseHashCode() {
302306
return Objects.hash(projectId, host, httpTransportFactory, authCredentials, retryParams,
303307
serviceRpcFactory);
304308
}
305309

306-
protected boolean isEquals(ServiceOptions other) {
310+
protected boolean baseEquals(ServiceOptions<?, ?> other) {
307311
return Objects.equals(projectId, other.projectId)
308312
&& Objects.equals(host, other.host)
309313
&& Objects.equals(httpTransportFactory, other.httpTransportFactory)
@@ -312,14 +316,17 @@ protected boolean isEquals(ServiceOptions other) {
312316
&& Objects.equals(serviceRpcFactory, other.serviceRpcFactory);
313317
}
314318

315-
public abstract Builder<R, O, ?> toBuilder();
319+
public abstract Builder<ServiceRpcT, OptionsT, ?> toBuilder();
316320

317321
/**
318322
* Creates a service RPC using a factory loaded by {@link ServiceLoader}.
319323
*/
320-
protected static <R, O extends ServiceOptions<R, O>> R createRpc(O options,
321-
Class<? extends ServiceRpcFactory<R, O>> factoryClass) {
322-
ServiceRpcFactory<R, O> factory = Iterables.getFirst(ServiceLoader.load(factoryClass), null);
324+
protected static
325+
<ServiceRpcT, OptionsT extends ServiceOptions<ServiceRpcT, OptionsT>>
326+
ServiceRpcT createRpc(OptionsT options,
327+
Class<? extends ServiceRpcFactory<ServiceRpcT, OptionsT>> factoryClass) {
328+
ServiceRpcFactory<ServiceRpcT, OptionsT> factory =
329+
Iterables.getFirst(ServiceLoader.load(factoryClass), null);
323330
return factory == null ? null : factory.create(options);
324331
}
325332
}

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/spi/ServiceRpcFactory.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
* A base interface for all service RPC factories.
2525
* Loading of a factory implementation is done via {@link java.util.ServiceLoader}.
2626
*/
27-
public interface ServiceRpcFactory<S, O extends ServiceOptions> extends Serializable {
27+
public interface ServiceRpcFactory<
28+
ServiceRpcT,
29+
OptionsT extends ServiceOptions<ServiceRpcT, OptionsT>>
30+
extends Serializable {
2831

29-
S create(O options);
32+
ServiceRpcT create(OptionsT options);
3033
}

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseEntity.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@
4040

4141
/**
4242
* A base class for entities (key and properties).
43-
* An entity is Google Cloud Datastore persistent data object.
43+
* An entity is a Google Cloud Datastore persistent data object.
4444
* An entity holds one or more properties, represented by a name (as {@link String})
4545
* and a value (as {@link com.google.gcloud.datastore.Value}), and may be associated with a
4646
* key. For a list of possible values see {@link ValueType}.
4747
*
48-
* @see <a href="https://cloud.google.com/datastore/docs/concepts/entities">Google Cloud Datastore Entities, Properties, and Keys</a>
48+
* @see <a href="https://cloud.google.com/datastore/docs/concepts/entities">Google Cloud Datastore
49+
* Entities, Properties, and Keys</a>
4950
*/
5051
public abstract class BaseEntity<K extends IncompleteKey> extends Serializable<DatastoreV1.Entity> {
5152

@@ -54,7 +55,7 @@ public abstract class BaseEntity<K extends IncompleteKey> extends Serializable<D
5455
private final transient ImmutableSortedMap<String, Value<?>> properties;
5556
private final K key;
5657

57-
abstract static class Builder<K extends IncompleteKey, B extends Builder<K, B>> {
58+
public abstract static class Builder<K extends IncompleteKey, B extends Builder<K, B>> {
5859

5960
private K key;
6061
private final Map<String, Value<?>> properties = new HashMap<>();
@@ -127,7 +128,7 @@ public B remove(String name) {
127128
return self();
128129
}
129130

130-
public B set(String name, Value value) {
131+
public B set(String name, Value<?> value) {
131132
properties.put(name, value);
132133
return self();
133134
}
@@ -187,7 +188,7 @@ public B setNull(String name) {
187188
return self();
188189
}
189190

190-
public abstract BaseEntity build();
191+
public abstract BaseEntity<K> build();
191192
}
192193

193194
BaseEntity(Builder<K, ?> builder) {
@@ -213,7 +214,7 @@ public boolean equals(Object obj) {
213214
if (!(obj instanceof BaseEntity)) {
214215
return false;
215216
}
216-
BaseEntity other = (BaseEntity) obj;
217+
BaseEntity<?> other = (BaseEntity<?>) obj;
217218
return Objects.equals(key, other.key)
218219
&& Objects.equals(properties, other.properties);
219220
}
@@ -254,7 +255,7 @@ public <V extends Value<?>> V getValue(String name) {
254255
}
255256

256257
/**
257-
* Returns true if property is instanceof NullValue.
258+
* Returns true if property is an instance of NullValue.
258259
*
259260
* @throws DatastoreException if not such property.
260261
*/
@@ -375,12 +376,12 @@ ImmutableSortedMap<String, Value<?>> properties() {
375376

376377
@Override
377378
protected Object fromPb(byte[] bytesPb) throws InvalidProtocolBufferException {
378-
Builder builder = emptyBuilder();
379+
Builder<?, ?> builder = emptyBuilder();
379380
builder.fill(DatastoreV1.Entity.parseFrom(bytesPb));
380381
return builder.build();
381382
}
382383

383-
protected abstract Builder emptyBuilder();
384+
protected abstract Builder<?, ?> emptyBuilder();
384385

385386
@Override
386387
protected final DatastoreV1.Entity toPb() {

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BatchImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static class ResponseImpl implements Batch.Response {
3434

3535
private final DatastoreV1.CommitResponse response;
3636

37-
public ResponseImpl(DatastoreV1.CommitResponse response) {
37+
ResponseImpl(DatastoreV1.CommitResponse response) {
3838
this.response = response;
3939
}
4040

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/Datastore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public interface Datastore extends Service<DatastoreOptions>, DatastoreReaderWri
3434

3535

3636
/**
37-
* An Callback for running with a Transactional
37+
* A callback for running with a transactional
3838
* {@link com.google.gcloud.datastore.DatastoreReaderWriter}.
3939
* The associated transaction will be committed after a successful return from the {@code run}
4040
* method. Any propagated exception will cause the transaction to be rolled-back.

branches/tswast-patch-1/gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/DatastoreException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public class DatastoreException extends RuntimeException {
3737
/**
3838
* An error code to represent the failure.
3939
*
40-
* @see <a href="https://cloud.google.com/datastore/docs/concepts/errors#Error_Codes">Google Cloud Datastore error codes</a>
40+
* @see <a href="https://cloud.google.com/datastore/docs/concepts/errors#Error_Codes">Google Cloud
41+
* Datastore error codes</a>
4142
*/
4243
public enum Code {
4344

0 commit comments

Comments
 (0)