11/*
2- * Copyright 2016 Google Inc. All Rights Reserved .
2+ * Copyright 2016, Google Inc. All rights reserved .
33 *
4- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5- * in compliance with the License. You may obtain a copy of the License at
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
67 *
7- * http://www.apache.org/licenses/LICENSE-2.0
8+ * http://www.apache.org/licenses/LICENSE-2.0
89 *
9- * Unless required by applicable law or agreed to in writing, software distributed under the License
10- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11- * or implied. See the License for the specific language governing permissions and limitations under
12- * the License.
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
1315 */
1416package com .google .cloud .errorreporting .spi .v1beta1 ;
1517
16- import com .google .api .gax .core .ConnectionSettings ;
18+ import com .google .api .gax .core .GoogleCredentialsProvider ;
1719import com .google .api .gax .core .RetrySettings ;
20+ import com .google .api .gax .grpc .ChannelProvider ;
21+ import com .google .api .gax .grpc .ExecutorProvider ;
22+ import com .google .api .gax .grpc .InstantiatingChannelProvider ;
23+ import com .google .api .gax .grpc .InstantiatingExecutorProvider ;
1824import com .google .api .gax .grpc .ServiceApiSettings ;
1925import com .google .api .gax .grpc .SimpleCallSettings ;
2026import com .google .api .gax .grpc .UnaryCallSettings ;
21- import com .google .auth .Credentials ;
2227import com .google .common .collect .ImmutableList ;
2328import com .google .common .collect .ImmutableMap ;
2429import com .google .common .collect .ImmutableSet ;
2833import com .google .devtools .clouderrorreporting .v1beta1 .ErrorGroupServiceGrpc ;
2934import com .google .devtools .clouderrorreporting .v1beta1 .GetGroupRequest ;
3035import com .google .devtools .clouderrorreporting .v1beta1 .UpdateGroupRequest ;
31- import io .grpc .ManagedChannel ;
3236import io .grpc .Status ;
3337import java .io .IOException ;
34- import java .util .List ;
35- import java .util .concurrent .ScheduledExecutorService ;
3638import org .joda .time .Duration ;
3739
3840// AUTO-GENERATED DOCUMENTATION AND CLASS
@@ -87,6 +89,11 @@ public SimpleCallSettings<UpdateGroupRequest, ErrorGroup> updateGroupSettings()
8789 return updateGroupSettings ;
8890 }
8991
92+ /** Returns a builder for the default ExecutorProvider for this service. */
93+ public static InstantiatingExecutorProvider .Builder defaultExecutorProviderBuilder () {
94+ return InstantiatingExecutorProvider .newBuilder ();
95+ }
96+
9097 /** Returns the default service address. */
9198 public static String getDefaultServiceAddress () {
9299 return DEFAULT_SERVICE_ADDRESS ;
@@ -102,6 +109,19 @@ public static ImmutableList<String> getDefaultServiceScopes() {
102109 return DEFAULT_SERVICE_SCOPES ;
103110 }
104111
112+ /** Returns a builder for the default credentials for this service. */
113+ public static GoogleCredentialsProvider .Builder defaultCredentialsProviderBuilder () {
114+ return GoogleCredentialsProvider .newBuilder ().setScopesToApply (DEFAULT_SERVICE_SCOPES );
115+ }
116+
117+ /** Returns a builder for the default ChannelProvider for this service. */
118+ public static InstantiatingChannelProvider .Builder defaultChannelProviderBuilder () {
119+ return InstantiatingChannelProvider .newBuilder ()
120+ .setServiceAddress (DEFAULT_SERVICE_ADDRESS )
121+ .setPort (DEFAULT_SERVICE_PORT )
122+ .setCredentialsProvider (defaultCredentialsProviderBuilder ().build ());
123+ }
124+
105125 /** Returns a builder for this class with recommended defaults. */
106126 public static Builder defaultBuilder () {
107127 return Builder .createDefault ();
@@ -118,13 +138,7 @@ public Builder toBuilder() {
118138 }
119139
120140 private ErrorGroupServiceSettings (Builder settingsBuilder ) throws IOException {
121- super (
122- settingsBuilder .getChannelProvider (),
123- settingsBuilder .getExecutorProvider (),
124- settingsBuilder .getGeneratorName (),
125- settingsBuilder .getGeneratorVersion (),
126- settingsBuilder .getClientLibName (),
127- settingsBuilder .getClientLibVersion ());
141+ super (settingsBuilder .getExecutorProvider (), settingsBuilder .getChannelProvider ());
128142
129143 getGroupSettings = settingsBuilder .getGroupSettings ().build ();
130144 updateGroupSettings = settingsBuilder .updateGroupSettings ().build ();
@@ -169,7 +183,7 @@ public static class Builder extends ServiceApiSettings.Builder {
169183 }
170184
171185 private Builder () {
172- super (s_getDefaultConnectionSettingsBuilder ().build ());
186+ super (defaultChannelProviderBuilder ().build ());
173187
174188 getGroupSettings = SimpleCallSettings .newBuilder (ErrorGroupServiceGrpc .METHOD_GET_GROUP );
175189
@@ -206,57 +220,15 @@ private Builder(ErrorGroupServiceSettings settings) {
206220 ImmutableList .<UnaryCallSettings .Builder >of (getGroupSettings , updateGroupSettings );
207221 }
208222
209- private static ConnectionSettings .Builder s_getDefaultConnectionSettingsBuilder () {
210- return ConnectionSettings .newBuilder ()
211- .setServiceAddress (DEFAULT_SERVICE_ADDRESS )
212- .setPort (DEFAULT_SERVICE_PORT )
213- .provideCredentialsWith (DEFAULT_SERVICE_SCOPES );
214- }
215-
216- @ Override
217- protected ConnectionSettings .Builder getDefaultConnectionSettingsBuilder () {
218- return s_getDefaultConnectionSettingsBuilder ();
219- }
220-
221- @ Override
222- public Builder provideExecutorWith (ScheduledExecutorService executor , boolean shouldAutoClose ) {
223- super .provideExecutorWith (executor , shouldAutoClose );
224- return this ;
225- }
226-
227- @ Override
228- public Builder provideChannelWith (ManagedChannel channel , boolean shouldAutoClose ) {
229- super .provideChannelWith (channel , shouldAutoClose );
230- return this ;
231- }
232-
233- @ Override
234- public Builder provideChannelWith (ConnectionSettings settings ) {
235- super .provideChannelWith (settings );
236- return this ;
237- }
238-
239- @ Override
240- public Builder provideChannelWith (Credentials credentials ) {
241- super .provideChannelWith (credentials );
242- return this ;
243- }
244-
245- @ Override
246- public Builder provideChannelWith (List <String > scopes ) {
247- super .provideChannelWith (scopes );
248- return this ;
249- }
250-
251223 @ Override
252- public Builder setGeneratorHeader ( String name , String version ) {
253- super .setGeneratorHeader ( name , version );
224+ public Builder setExecutorProvider ( ExecutorProvider executorProvider ) {
225+ super .setExecutorProvider ( executorProvider );
254226 return this ;
255227 }
256228
257229 @ Override
258- public Builder setClientLibHeader ( String name , String version ) {
259- super .setClientLibHeader ( name , version );
230+ public Builder setChannelProvider ( ChannelProvider channelProvider ) {
231+ super .setChannelProvider ( channelProvider );
260232 return this ;
261233 }
262234
0 commit comments