Skip to content

Commit

Permalink
update PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
shinfan committed Oct 26, 2016
1 parent dd88e23 commit b512686
Show file tree
Hide file tree
Showing 54 changed files with 674 additions and 1,483 deletions.
2 changes: 1 addition & 1 deletion google-cloud-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>0.0.19</version>
<version>0.0.21</version>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import com.google.api.gax.core.ConnectionSettings;
import com.google.api.gax.core.RetrySettings;
import com.google.api.gax.grpc.UnaryApiCallSettings;
import com.google.api.gax.grpc.UnaryCallSettings;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.spi.ServiceRpcFactory;
import com.google.common.annotations.VisibleForTesting;
Expand Down Expand Up @@ -226,7 +226,7 @@ protected ExecutorFactory<ScheduledExecutorService> executorFactory() {
/**
* Returns a builder for API call settings.
*/
protected UnaryApiCallSettings.Builder apiCallSettings() {
protected UnaryCallSettings.Builder apiCallSettings() {
// todo(mziccard): specify timeout these settings:
// retryParams().retryMaxAttempts(), retryParams().retryMinAttempts()
final RetrySettings.Builder builder = RetrySettings.newBuilder()
Expand All @@ -237,7 +237,7 @@ protected UnaryApiCallSettings.Builder apiCallSettings() {
.setInitialRetryDelay(Duration.millis(retryParams().initialRetryDelayMillis()))
.setRetryDelayMultiplier(retryParams().retryDelayBackoffFactor())
.setMaxRetryDelay(Duration.millis(retryParams().maxRetryDelayMillis()));
return UnaryApiCallSettings.newBuilder().setRetrySettingsBuilder(builder);
return UnaryCallSettings.newBuilder().setRetrySettingsBuilder(builder);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
package com.google.cloud.errorreporting.spi.v1beta1;

import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.api.gax.grpc.UnaryCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup;
import com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest;
Expand Down Expand Up @@ -83,8 +83,8 @@ public class ErrorGroupServiceApi implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List<AutoCloseable> closeables = new ArrayList<>();

private final UnaryApiCallable<GetGroupRequest, ErrorGroup> getGroupCallable;
private final UnaryApiCallable<UpdateGroupRequest, ErrorGroup> updateGroupCallable;
private final UnaryCallable<GetGroupRequest, ErrorGroup> getGroupCallable;
private final UnaryCallable<UpdateGroupRequest, ErrorGroup> updateGroupCallable;

private static final PathTemplate GROUP_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}/groups/{group}");
Expand Down Expand Up @@ -130,9 +130,9 @@ protected ErrorGroupServiceApi(ErrorGroupServiceSettings settings) throws IOExce
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);

this.getGroupCallable =
UnaryApiCallable.create(settings.getGroupSettings(), this.channel, this.executor);
UnaryCallable.create(settings.getGroupSettings(), this.channel, this.executor);
this.updateGroupCallable =
UnaryApiCallable.create(settings.updateGroupSettings(), this.channel, this.executor);
UnaryCallable.create(settings.updateGroupSettings(), this.channel, this.executor);

if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
Expand Down Expand Up @@ -226,7 +226,7 @@ private final ErrorGroup getGroup(GetGroupRequest request) {
* }
* </code></pre>
*/
public final UnaryApiCallable<GetGroupRequest, ErrorGroup> getGroupCallable() {
public final UnaryCallable<GetGroupRequest, ErrorGroup> getGroupCallable() {
return getGroupCallable;
}

Expand Down Expand Up @@ -292,7 +292,7 @@ private final ErrorGroup updateGroup(UpdateGroupRequest request) {
* }
* </code></pre>
*/
public final UnaryApiCallable<UpdateGroupRequest, ErrorGroup> updateGroupCallable() {
public final UnaryCallable<UpdateGroupRequest, ErrorGroup> updateGroupCallable() {
return updateGroupCallable;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.google.api.gax.core.RetrySettings;
import com.google.api.gax.grpc.ServiceApiSettings;
import com.google.api.gax.grpc.SimpleCallSettings;
import com.google.api.gax.grpc.UnaryApiCallSettings;
import com.google.api.gax.grpc.UnaryCallSettings;
import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -74,14 +74,6 @@ public class ErrorGroupServiceSettings extends ServiceApiSettings {
private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
ImmutableList.<String>builder().add("https://www.googleapis.com/auth/cloud-platform").build();

/** The default connection settings of the service. */
public static final ConnectionSettings DEFAULT_CONNECTION_SETTINGS =
ConnectionSettings.newBuilder()
.setServiceAddress(DEFAULT_SERVICE_ADDRESS)
.setPort(DEFAULT_SERVICE_PORT)
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES)
.build();

private final SimpleCallSettings<GetGroupRequest, ErrorGroup> getGroupSettings;
private final SimpleCallSettings<UpdateGroupRequest, ErrorGroup> updateGroupSettings;

Expand Down Expand Up @@ -140,7 +132,7 @@ private ErrorGroupServiceSettings(Builder settingsBuilder) throws IOException {

/** Builder for ErrorGroupServiceSettings. */
public static class Builder extends ServiceApiSettings.Builder {
private final ImmutableList<UnaryApiCallSettings.Builder> unaryMethodSettingsBuilders;
private final ImmutableList<UnaryCallSettings.Builder> unaryMethodSettingsBuilders;

private final SimpleCallSettings.Builder<GetGroupRequest, ErrorGroup> getGroupSettings;
private final SimpleCallSettings.Builder<UpdateGroupRequest, ErrorGroup> updateGroupSettings;
Expand Down Expand Up @@ -177,15 +169,15 @@ public static class Builder extends ServiceApiSettings.Builder {
}

private Builder() {
super(DEFAULT_CONNECTION_SETTINGS);
super(s_getDefaultConnectionSettingsBuilder().build());

getGroupSettings = SimpleCallSettings.newBuilder(ErrorGroupServiceGrpc.METHOD_GET_GROUP);

updateGroupSettings =
SimpleCallSettings.newBuilder(ErrorGroupServiceGrpc.METHOD_UPDATE_GROUP);

unaryMethodSettingsBuilders =
ImmutableList.<UnaryApiCallSettings.Builder>of(getGroupSettings, updateGroupSettings);
ImmutableList.<UnaryCallSettings.Builder>of(getGroupSettings, updateGroupSettings);
}

private static Builder createDefault() {
Expand All @@ -211,12 +203,19 @@ private Builder(ErrorGroupServiceSettings settings) {
updateGroupSettings = settings.updateGroupSettings.toBuilder();

unaryMethodSettingsBuilders =
ImmutableList.<UnaryApiCallSettings.Builder>of(getGroupSettings, updateGroupSettings);
ImmutableList.<UnaryCallSettings.Builder>of(getGroupSettings, updateGroupSettings);
}

private static ConnectionSettings.Builder s_getDefaultConnectionSettingsBuilder() {
return ConnectionSettings.newBuilder()
.setServiceAddress(DEFAULT_SERVICE_ADDRESS)
.setPort(DEFAULT_SERVICE_PORT)
.provideCredentialsWith(DEFAULT_SERVICE_SCOPES);
}

@Override
protected ConnectionSettings getDefaultConnectionSettings() {
return DEFAULT_CONNECTION_SETTINGS;
protected ConnectionSettings.Builder getDefaultConnectionSettingsBuilder() {
return s_getDefaultConnectionSettingsBuilder();
}

@Override
Expand Down Expand Up @@ -267,7 +266,7 @@ public Builder setClientLibHeader(String name, String version) {
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllApiMethods(UnaryApiCallSettings.Builder apiCallSettings)
public Builder applyToAllApiMethods(UnaryCallSettings.Builder apiCallSettings)
throws Exception {
super.applyToAllApiMethods(unaryMethodSettingsBuilders, apiCallSettings);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListEventsPagedResponse;
import static com.google.cloud.errorreporting.spi.v1beta1.PagedResponseWrappers.ListGroupStatsPagedResponse;

import com.google.api.gax.grpc.UnaryApiCallable;
import com.google.api.gax.grpc.UnaryCallable;
import com.google.api.gax.protobuf.PathTemplate;
import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest;
import com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse;
Expand Down Expand Up @@ -91,14 +91,12 @@ public class ErrorStatsServiceApi implements AutoCloseable {
private final ScheduledExecutorService executor;
private final List<AutoCloseable> closeables = new ArrayList<>();

private final UnaryApiCallable<ListGroupStatsRequest, ListGroupStatsResponse>
listGroupStatsCallable;
private final UnaryApiCallable<ListGroupStatsRequest, ListGroupStatsPagedResponse>
private final UnaryCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGroupStatsCallable;
private final UnaryCallable<ListGroupStatsRequest, ListGroupStatsPagedResponse>
listGroupStatsPagedCallable;
private final UnaryApiCallable<ListEventsRequest, ListEventsResponse> listEventsCallable;
private final UnaryApiCallable<ListEventsRequest, ListEventsPagedResponse>
listEventsPagedCallable;
private final UnaryApiCallable<DeleteEventsRequest, DeleteEventsResponse> deleteEventsCallable;
private final UnaryCallable<ListEventsRequest, ListEventsResponse> listEventsCallable;
private final UnaryCallable<ListEventsRequest, ListEventsPagedResponse> listEventsPagedCallable;
private final UnaryCallable<DeleteEventsRequest, DeleteEventsResponse> deleteEventsCallable;

private static final PathTemplate PROJECT_PATH_TEMPLATE =
PathTemplate.createWithoutUrlEncoding("projects/{project}");
Expand Down Expand Up @@ -137,17 +135,17 @@ protected ErrorStatsServiceApi(ErrorStatsServiceSettings settings) throws IOExce
this.channel = settings.getChannelProvider().getOrBuildChannel(this.executor);

this.listGroupStatsCallable =
UnaryApiCallable.create(settings.listGroupStatsSettings(), this.channel, this.executor);
UnaryCallable.create(settings.listGroupStatsSettings(), this.channel, this.executor);
this.listGroupStatsPagedCallable =
UnaryApiCallable.createPagedVariant(
UnaryCallable.createPagedVariant(
settings.listGroupStatsSettings(), this.channel, this.executor);
this.listEventsCallable =
UnaryApiCallable.create(settings.listEventsSettings(), this.channel, this.executor);
UnaryCallable.create(settings.listEventsSettings(), this.channel, this.executor);
this.listEventsPagedCallable =
UnaryApiCallable.createPagedVariant(
UnaryCallable.createPagedVariant(
settings.listEventsSettings(), this.channel, this.executor);
this.deleteEventsCallable =
UnaryApiCallable.create(settings.deleteEventsSettings(), this.channel, this.executor);
UnaryCallable.create(settings.deleteEventsSettings(), this.channel, this.executor);

if (settings.getChannelProvider().shouldAutoClose()) {
closeables.add(
Expand Down Expand Up @@ -260,7 +258,7 @@ public final ListGroupStatsPagedResponse listGroupStats(ListGroupStatsRequest re
* }
* </code></pre>
*/
public final UnaryApiCallable<ListGroupStatsRequest, ListGroupStatsPagedResponse>
public final UnaryCallable<ListGroupStatsRequest, ListGroupStatsPagedResponse>
listGroupStatsPagedCallable() {
return listGroupStatsPagedCallable;
}
Expand Down Expand Up @@ -294,7 +292,7 @@ public final ListGroupStatsPagedResponse listGroupStats(ListGroupStatsRequest re
* }
* </code></pre>
*/
public final UnaryApiCallable<ListGroupStatsRequest, ListGroupStatsResponse>
public final UnaryCallable<ListGroupStatsRequest, ListGroupStatsResponse>
listGroupStatsCallable() {
return listGroupStatsCallable;
}
Expand Down Expand Up @@ -377,8 +375,7 @@ public final ListEventsPagedResponse listEvents(ListEventsRequest request) {
* }
* </code></pre>
*/
public final UnaryApiCallable<ListEventsRequest, ListEventsPagedResponse>
listEventsPagedCallable() {
public final UnaryCallable<ListEventsRequest, ListEventsPagedResponse> listEventsPagedCallable() {
return listEventsPagedCallable;
}

Expand Down Expand Up @@ -411,7 +408,7 @@ public final ListEventsPagedResponse listEvents(ListEventsRequest request) {
* }
* </code></pre>
*/
public final UnaryApiCallable<ListEventsRequest, ListEventsResponse> listEventsCallable() {
public final UnaryCallable<ListEventsRequest, ListEventsResponse> listEventsCallable() {
return listEventsCallable;
}

Expand Down Expand Up @@ -481,7 +478,7 @@ private final DeleteEventsResponse deleteEvents(DeleteEventsRequest request) {
* }
* </code></pre>
*/
public final UnaryApiCallable<DeleteEventsRequest, DeleteEventsResponse> deleteEventsCallable() {
public final UnaryCallable<DeleteEventsRequest, DeleteEventsResponse> deleteEventsCallable() {
return deleteEventsCallable;
}

Expand Down
Loading

0 comments on commit b512686

Please sign in to comment.