Skip to content

Commit 62411b9

Browse files
committed
add module, run formatter, fix any failing builds
1 parent b9af31f commit 62411b9

20 files changed

+503
-568
lines changed

datastore-v1-proto-client/pom.xml

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@
1818
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1919
<modelVersion>4.0.0</modelVersion>
2020
<artifactId>datastore-v1-proto-client</artifactId>
21-
<version>1.6.3</version>
21+
<version>1.6.4-SNAPSHOT</version><!-- {x-version-update:datastore-v1-proto-client:current} -->
2222

23-
<name>${project.groupId}:${project.artifactId}</name>
23+
<parent>
24+
<groupId>com.google.cloud</groupId>
25+
<artifactId>google-cloud-datastore-parent</artifactId>
26+
<version>1.106.5-SNAPSHOT</version><!-- {x-version-update:google-cloud-datastore-parent:current} -->
27+
</parent>
2428

2529
<packaging>jar</packaging>
2630
<description>
2731
Low level client for accessing Google Cloud Datastore v1.
2832
</description>
29-
<parent>
30-
<groupId>com.google.cloud.datastore</groupId>
31-
<artifactId>datastore-v1-proto-client-parent</artifactId>
32-
<version>1.6.3</version>
33-
</parent>
3433

3534
<dependencies>
3635
<dependency>
@@ -68,6 +67,21 @@
6867
<artifactId>guava</artifactId>
6968
</dependency>
7069

70+
<dependency>
71+
<groupId>com.google.code.findbugs</groupId>
72+
<artifactId>jsr305</artifactId>
73+
</dependency>
74+
75+
<dependency>
76+
<groupId>com.google.api.grpc</groupId>
77+
<artifactId>proto-google-common-protos</artifactId>
78+
</dependency>
79+
80+
<dependency>
81+
<groupId>com.google.protobuf</groupId>
82+
<artifactId>protobuf-java</artifactId>
83+
</dependency>
84+
7185
<!-- Test dependencies. -->
7286
<dependency>
7387
<groupId>junit</groupId>
@@ -78,31 +92,8 @@
7892
<dependency>
7993
<groupId>com.google.truth</groupId>
8094
<artifactId>truth</artifactId>
95+
<version>1.1.2</version>
8196
<scope>test</scope>
8297
</dependency>
8398
</dependencies>
84-
85-
<build>
86-
<plugins>
87-
<plugin>
88-
<groupId>org.apache.maven.plugins</groupId>
89-
<artifactId>maven-compiler-plugin</artifactId>
90-
</plugin>
91-
92-
<plugin>
93-
<groupId>org.apache.maven.plugins</groupId>
94-
<artifactId>maven-source-plugin</artifactId>
95-
</plugin>
96-
97-
<plugin>
98-
<groupId>org.apache.maven.plugins</groupId>
99-
<artifactId>maven-javadoc-plugin</artifactId>
100-
</plugin>
101-
102-
<plugin>
103-
<groupId>org.apache.maven.plugins</groupId>
104-
<artifactId>maven-gpg-plugin</artifactId>
105-
</plugin>
106-
</plugins>
107-
</build>
10899
</project>

datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/ChecksumEnforcingInputStream.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021 Google LLC. All Rights Reserved.
2+
* Copyright 2021 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
1515
*/
1616
package com.google.datastore.v1.client;
1717

18-
import com.google.common.annotations.VisibleForTesting;
1918
import com.google.api.client.http.HttpResponse;
19+
import com.google.common.annotations.VisibleForTesting;
2020
import java.io.IOException;
2121
import java.io.InputStream;
2222
import java.security.MessageDigest;
@@ -27,16 +27,14 @@ class ChecksumEnforcingInputStream extends InputStream {
2727
private final MessageDigest messageDigest;
2828
private final String expectedChecksum;
2929

30-
ChecksumEnforcingInputStream(InputStream originalInputStream,
31-
HttpResponse response,
32-
MessageDigest digest) {
30+
ChecksumEnforcingInputStream(
31+
InputStream originalInputStream, HttpResponse response, MessageDigest digest) {
3332
this(originalInputStream, EndToEndChecksumHandler.getChecksumHeader(response), digest);
3433
}
3534

3635
@VisibleForTesting
37-
ChecksumEnforcingInputStream(InputStream originalInputStream,
38-
String checksum,
39-
MessageDigest digest) {
36+
ChecksumEnforcingInputStream(
37+
InputStream originalInputStream, String checksum, MessageDigest digest) {
4038
delegate = originalInputStream;
4139
expectedChecksum = checksum;
4240
messageDigest = digest;

datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/Datastore.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,22 @@ public class Datastore {
4646
this.remoteRpc = remoteRpc;
4747
}
4848

49-
/**
50-
* Reset the RPC count.
51-
*/
49+
/** Reset the RPC count. */
5250
public void resetRpcCount() {
5351
remoteRpc.resetRpcCount();
5452
}
5553

5654
/**
57-
* Returns the number of RPC calls made since the client was created
58-
* or {@link #resetRpcCount} was called.
55+
* Returns the number of RPC calls made since the client was created or {@link #resetRpcCount} was
56+
* called.
5957
*/
6058
public int getRpcCount() {
6159
return remoteRpc.getRpcCount();
6260
}
6361

6462
private DatastoreException invalidResponseException(String method, IOException exception) {
65-
return RemoteRpc.makeException(remoteRpc.getUrl(), method, Code.UNAVAILABLE,
66-
"Invalid response", exception);
63+
return RemoteRpc.makeException(
64+
remoteRpc.getUrl(), method, Code.UNAVAILABLE, "Invalid response", exception);
6765
}
6866

6967
public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException {

datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreEmulator.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ public class DatastoreEmulator extends Datastore {
7878
private final DatastoreEmulatorOptions options;
7979

8080
/** Internal state lifecycle management. */
81-
enum State {NEW, STARTED, STOPPED}
81+
enum State {
82+
NEW,
83+
STARTED,
84+
STOPPED
85+
}
8286

8387
private volatile State state = State.NEW;
8488

datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreException.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717

1818
import com.google.rpc.Code;
1919

20-
/**
21-
* Indicates an error in a {@link Datastore} call.
22-
*/
20+
/** Indicates an error in a {@link Datastore} call. */
2321
public class DatastoreException extends Exception {
2422
private final String methodName;
2523
private final Code code;
@@ -30,20 +28,16 @@ public DatastoreException(String methodName, Code code, String message, Throwabl
3028
this.code = code;
3129
}
3230

33-
/**
34-
* @return the canonical error code
35-
*/
31+
/** @return the canonical error code */
3632
public Code getCode() {
3733
return code;
3834
}
3935

40-
/**
41-
* @return the datastore method name
42-
*/
36+
/** @return the datastore method name */
4337
public String getMethodName() {
4438
return methodName;
4539
}
46-
40+
4741
@Override
4842
public String toString() {
4943
return String.format("%s, code=%s", super.toString(), code);

datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreFactory.java

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.api.client.http.HttpRequestFactory;
2222
import com.google.api.client.http.HttpTransport;
2323
import com.google.api.client.http.javanet.NetHttpTransport;
24-
2524
import java.net.URI;
2625
import java.net.URISyntaxException;
2726
import java.util.Arrays;
@@ -32,9 +31,7 @@
3231
import java.util.logging.Logger;
3332
import java.util.logging.StreamHandler;
3433

35-
/**
36-
* Client factory for {@link Datastore}.
37-
*/
34+
/** Client factory for {@link Datastore}. */
3835
public class DatastoreFactory {
3936

4037
// Lazy load this because we might be running inside App Engine and this
@@ -54,19 +51,16 @@ public static DatastoreFactory get() {
5451
}
5552

5653
/**
57-
* Provides access to a datastore using the provided options. Logs
58-
* into the application using the credentials available via these
59-
* options.
54+
* Provides access to a datastore using the provided options. Logs into the application using the
55+
* credentials available via these options.
6056
*
6157
* @throws IllegalArgumentException if the server or credentials weren't provided.
6258
*/
6359
public Datastore create(DatastoreOptions options) {
6460
return new Datastore(newRemoteRpc(options));
6561
}
6662

67-
/**
68-
* Constructs a Google APIs HTTP client with the associated credentials.
69-
*/
63+
/** Constructs a Google APIs HTTP client with the associated credentials. */
7064
public HttpRequestFactory makeClient(DatastoreOptions options) {
7165
Credential credential = options.getCredential();
7266
HttpTransport transport = options.getTransport();
@@ -77,9 +71,7 @@ public HttpRequestFactory makeClient(DatastoreOptions options) {
7771
return transport.createRequestFactory(credential);
7872
}
7973

80-
/**
81-
* Starts logging datastore method calls to the console. (Useful within tests.)
82-
*/
74+
/** Starts logging datastore method calls to the console. (Useful within tests.) */
8375
public static void logMethodCalls() {
8476
Logger logger = Logger.getLogger(Datastore.class.getName());
8577
logger.setLevel(Level.FINE);
@@ -88,24 +80,21 @@ public static void logMethodCalls() {
8880
}
8981
}
9082

91-
/**
92-
* Build a valid datastore URL.
93-
*/
83+
/** Build a valid datastore URL. */
9484
String buildProjectEndpoint(DatastoreOptions options) {
9585
if (options.getProjectEndpoint() != null) {
9686
return options.getProjectEndpoint();
9787
}
9888
// DatastoreOptions ensures either project endpoint or project ID is set.
9989
String projectId = checkNotNull(options.getProjectId());
10090
if (options.getHost() != null) {
101-
return validateUrl(String.format("https://%s/%s/projects/%s",
102-
options.getHost(), VERSION, projectId));
91+
return validateUrl(
92+
String.format("https://%s/%s/projects/%s", options.getHost(), VERSION, projectId));
10393
} else if (options.getLocalHost() != null) {
104-
return validateUrl(String.format("http://%s/%s/projects/%s",
105-
options.getLocalHost(), VERSION, projectId));
94+
return validateUrl(
95+
String.format("http://%s/%s/projects/%s", options.getLocalHost(), VERSION, projectId));
10696
}
107-
return validateUrl(String.format("%s/%s/projects/%s",
108-
DEFAULT_HOST, VERSION, projectId));
97+
return validateUrl(String.format("%s/%s/projects/%s", DEFAULT_HOST, VERSION, projectId));
10998
}
11099

111100
protected RemoteRpc newRemoteRpc(DatastoreOptions options) {
@@ -127,12 +116,13 @@ private static String validateUrl(String url) {
127116
private static synchronized StreamHandler getStreamHandler() {
128117
if (methodHandler == null) {
129118
methodHandler = new ConsoleHandler();
130-
methodHandler.setFormatter(new Formatter() {
131-
@Override
132-
public String format(LogRecord record) {
133-
return record.getMessage() + "\n";
134-
}
135-
});
119+
methodHandler.setFormatter(
120+
new Formatter() {
121+
@Override
122+
public String format(LogRecord record) {
123+
return record.getMessage() + "\n";
124+
}
125+
});
136126
methodHandler.setLevel(Level.FINE);
137127
}
138128
return methodHandler;

0 commit comments

Comments
 (0)