Skip to content

Commit a4badef

Browse files
committed
---
yaml --- r: 249 b: refs/heads/master c: 53170fb h: refs/heads/master i: 247: a75ab97 v: v3
1 parent 399062f commit a4badef

38 files changed

Lines changed: 398 additions & 760 deletions

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 110ab8e839153f67c0f416c213e55a1e9256ecf0
2+
refs/heads/master: 53170fb9e5835716a4bf763823fc0a6f86b4453a

trunk/src/main/java/com/google/gcloud/ServiceOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public AuthCredentials authCredentials() {
283283
}
284284

285285
public RetryParams retryParams() {
286-
return retryParams;
286+
return retryParams != null ? retryParams : RetryParams.noRetries();
287287
}
288288

289289
public ServiceRpcFactory<R, O> serviceRpcFactory() {

trunk/src/main/java/com/google/gcloud/datastore/DatastoreServiceOptions.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class DatastoreServiceOptions extends ServiceOptions<DatastoreRpc, Datast
4444
private final String namespace;
4545
private final boolean force;
4646
private final boolean normalizeDataset;
47+
private transient DatastoreRpc datastoreRpc;
4748

4849
public static class Builder extends
4950
ServiceOptions.Builder<DatastoreRpc, DatastoreServiceOptions, Builder> {
@@ -178,10 +179,15 @@ public boolean equals(Object obj) {
178179
}
179180

180181
DatastoreRpc datastoreRpc() {
182+
if (datastoreRpc != null) {
183+
return datastoreRpc;
184+
}
181185
if (serviceRpcFactory() != null) {
182-
return serviceRpcFactory().create(this);
186+
datastoreRpc = serviceRpcFactory().create(this);
187+
} else {
188+
datastoreRpc = ServiceRpcProvider.datastore(this);
183189
}
184-
return ServiceRpcProvider.datastore(this);
190+
return datastoreRpc;
185191
}
186192

187193
public static DatastoreServiceOptions defaultInstance() {

trunk/src/main/java/com/google/gcloud/examples/StorageExample.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.gcloud.examples;
1818

19-
import com.google.gcloud.RetryParams;
2019
import com.google.gcloud.spi.StorageRpc.Tuple;
2120
import com.google.gcloud.storage.BatchRequest;
2221
import com.google.gcloud.storage.BatchResponse;
@@ -499,8 +498,7 @@ public static void main(String... args) throws Exception {
499498
printUsage();
500499
return;
501500
}
502-
StorageServiceOptions.Builder optionsBuilder =
503-
StorageServiceOptions.builder().retryParams(RetryParams.getDefaultInstance());
501+
StorageServiceOptions.Builder optionsBuilder = StorageServiceOptions.builder();
504502
StorageAction action;
505503
if (args.length >= 2 && !ACTIONS.containsKey(args[0])) {
506504
optionsBuilder.projectId(args[0]);

trunk/src/main/java/com/google/gcloud/storage/Acl.java

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,16 @@ protected String value() {
6161
}
6262

6363
@Override
64-
public boolean equals(Object o) {
65-
if (this == o) {
66-
return true;
67-
}
68-
if (o == null || getClass() != o.getClass()) {
69-
return false;
70-
}
71-
Entity entity = (Entity) o;
72-
return Objects.equals(type, entity.type) &&
73-
Objects.equals(value, entity.value);
64+
public int hashCode() {
65+
return Objects.hash(type, value);
7466
}
7567

7668
@Override
77-
public int hashCode() {
78-
return Objects.hash(type, value);
69+
public boolean equals(Object obj) {
70+
if (obj == null || !getClass().isAssignableFrom(obj.getClass())) {
71+
return false;
72+
}
73+
return Objects.equals(toPb(), ((Entity)obj).toPb());
7974
}
8075

8176
@Override
@@ -100,9 +95,6 @@ static Entity fromPb(String entity) {
10095
if (entity.startsWith("group-")) {
10196
return new Group(entity.substring(6));
10297
}
103-
if (entity.startsWith("domain-")) {
104-
return new Domain(entity.substring(7));
105-
}
10698
if (entity.startsWith("project-")) {
10799
int idx = entity.indexOf('-', 8);
108100
String team = entity.substring(8, idx);
@@ -186,7 +178,7 @@ enum ProjectRole {
186178
OWNERS, EDITORS, VIEWERS
187179
}
188180

189-
public Project(ProjectRole pRole, String projectId) {
181+
Project(ProjectRole pRole, String projectId) {
190182
super(Type.PROJECT, pRole.name().toLowerCase() + "-" + projectId);
191183
this.pRole = pRole;
192184
this.projectId = projectId;
@@ -228,24 +220,6 @@ public Role role() {
228220
return role;
229221
}
230222

231-
@Override
232-
public int hashCode() {
233-
return Objects.hash(entity, role);
234-
}
235-
236-
@Override
237-
public boolean equals(Object obj) {
238-
if (this == obj) {
239-
return true;
240-
}
241-
if (obj == null || getClass() != obj.getClass()) {
242-
return false;
243-
}
244-
final Acl other = (Acl) obj;
245-
return Objects.equals(this.entity, other.entity)
246-
&& Objects.equals(this.role, other.role);
247-
}
248-
249223
BucketAccessControl toBucketPb() {
250224
BucketAccessControl bucketPb = new BucketAccessControl();
251225
bucketPb.setRole(role().toString());

trunk/src/main/java/com/google/gcloud/storage/BatchRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ public boolean equals(Object obj) {
9696
&& Objects.equals(toGet, other.toGet);
9797
}
9898

99-
Map<Blob, Iterable<BlobSourceOption>> toDelete() {
99+
public Map<Blob, Iterable<BlobSourceOption>> toDelete() {
100100
return toDelete;
101101
}
102102

103-
Map<Blob, Iterable<BlobTargetOption>> toUpdate() {
103+
public Map<Blob, Iterable<BlobTargetOption>> toUpdate() {
104104
return toUpdate;
105105
}
106106

107-
Map<Blob, Iterable<BlobSourceOption>> toGet() {
107+
public Map<Blob, Iterable<BlobSourceOption>> toGet() {
108108
return toGet;
109109
}
110110

trunk/src/main/java/com/google/gcloud/storage/BatchResponse.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,16 @@ public static class Result<T extends Serializable> implements Serializable {
4343
private final StorageServiceException exception;
4444

4545

46-
Result(T value) {
46+
public Result(T value) {
4747
this.value = value;
4848
this.exception = null;
4949
}
5050

51-
Result(StorageServiceException exception) {
51+
public Result(StorageServiceException exception) {
5252
this.exception = exception;
5353
this.value = null;
5454
}
5555

56-
static <T extends Serializable> Result<T> of(T value) {
57-
return new Result<>(value);
58-
}
59-
6056
/**
6157
* Returns the result.
6258
*
@@ -112,7 +108,7 @@ static <T extends Serializable> Result<T> empty() {
112108
}
113109
}
114110

115-
BatchResponse(List<Result<Boolean>> deleteResult, List<Result<Blob>> updateResult,
111+
public BatchResponse(List<Result<Boolean>> deleteResult, List<Result<Blob>> updateResult,
116112
List<Result<Blob>> getResult) {
117113
this.deleteResult = ImmutableList.copyOf(deleteResult);
118114
this.updateResult = ImmutableList.copyOf(updateResult);

trunk/src/main/java/com/google/gcloud/storage/BlobReadChannelImpl.java

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)