1 /* 2 * Copyright 2022 Google LLC 3 * 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 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 package io.grafeas.v1.stub; 18 19 import static io.grafeas.v1.GrafeasClient.ListNoteOccurrencesPagedResponse; 20 import static io.grafeas.v1.GrafeasClient.ListNotesPagedResponse; 21 import static io.grafeas.v1.GrafeasClient.ListOccurrencesPagedResponse; 22 23 import com.google.api.gax.core.BackgroundResource; 24 import com.google.api.gax.core.BackgroundResourceAggregation; 25 import com.google.api.gax.grpc.GrpcCallSettings; 26 import com.google.api.gax.grpc.GrpcStubCallableFactory; 27 import com.google.api.gax.rpc.ClientContext; 28 import com.google.api.gax.rpc.UnaryCallable; 29 import com.google.common.collect.ImmutableMap; 30 import com.google.longrunning.stub.GrpcOperationsStub; 31 import com.google.protobuf.Empty; 32 import io.grafeas.v1.BatchCreateNotesRequest; 33 import io.grafeas.v1.BatchCreateNotesResponse; 34 import io.grafeas.v1.BatchCreateOccurrencesRequest; 35 import io.grafeas.v1.BatchCreateOccurrencesResponse; 36 import io.grafeas.v1.CreateNoteRequest; 37 import io.grafeas.v1.CreateOccurrenceRequest; 38 import io.grafeas.v1.DeleteNoteRequest; 39 import io.grafeas.v1.DeleteOccurrenceRequest; 40 import io.grafeas.v1.GetNoteRequest; 41 import io.grafeas.v1.GetOccurrenceNoteRequest; 42 import io.grafeas.v1.GetOccurrenceRequest; 43 import io.grafeas.v1.ListNoteOccurrencesRequest; 44 import io.grafeas.v1.ListNoteOccurrencesResponse; 45 import io.grafeas.v1.ListNotesRequest; 46 import io.grafeas.v1.ListNotesResponse; 47 import io.grafeas.v1.ListOccurrencesRequest; 48 import io.grafeas.v1.ListOccurrencesResponse; 49 import io.grafeas.v1.Note; 50 import io.grafeas.v1.Occurrence; 51 import io.grafeas.v1.UpdateNoteRequest; 52 import io.grafeas.v1.UpdateOccurrenceRequest; 53 import io.grpc.MethodDescriptor; 54 import io.grpc.protobuf.ProtoUtils; 55 import java.io.IOException; 56 import java.util.concurrent.TimeUnit; 57 import javax.annotation.Generated; 58 59 // AUTO-GENERATED DOCUMENTATION AND CLASS. 60 /** 61 * gRPC stub implementation for the Grafeas service API. 62 * 63 * <p>This class is for advanced usage and reflects the underlying API directly. 64 */ 65 @Generated("by gapic-generator-java") 66 public class GrpcGrafeasStub extends GrafeasStub { 67 private static final MethodDescriptor<GetOccurrenceRequest, Occurrence> 68 getOccurrenceMethodDescriptor = 69 MethodDescriptor.<GetOccurrenceRequest, Occurrence>newBuilder() 70 .setType(MethodDescriptor.MethodType.UNARY) 71 .setFullMethodName("grafeas.v1.Grafeas/GetOccurrence") 72 .setRequestMarshaller( 73 ProtoUtils.marshaller(GetOccurrenceRequest.getDefaultInstance())) 74 .setResponseMarshaller(ProtoUtils.marshaller(Occurrence.getDefaultInstance())) 75 .build(); 76 77 private static final MethodDescriptor<ListOccurrencesRequest, ListOccurrencesResponse> 78 listOccurrencesMethodDescriptor = 79 MethodDescriptor.<ListOccurrencesRequest, ListOccurrencesResponse>newBuilder() 80 .setType(MethodDescriptor.MethodType.UNARY) 81 .setFullMethodName("grafeas.v1.Grafeas/ListOccurrences") 82 .setRequestMarshaller( 83 ProtoUtils.marshaller(ListOccurrencesRequest.getDefaultInstance())) 84 .setResponseMarshaller( 85 ProtoUtils.marshaller(ListOccurrencesResponse.getDefaultInstance())) 86 .build(); 87 88 private static final MethodDescriptor<DeleteOccurrenceRequest, Empty> 89 deleteOccurrenceMethodDescriptor = 90 MethodDescriptor.<DeleteOccurrenceRequest, Empty>newBuilder() 91 .setType(MethodDescriptor.MethodType.UNARY) 92 .setFullMethodName("grafeas.v1.Grafeas/DeleteOccurrence") 93 .setRequestMarshaller( 94 ProtoUtils.marshaller(DeleteOccurrenceRequest.getDefaultInstance())) 95 .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) 96 .build(); 97 98 private static final MethodDescriptor<CreateOccurrenceRequest, Occurrence> 99 createOccurrenceMethodDescriptor = 100 MethodDescriptor.<CreateOccurrenceRequest, Occurrence>newBuilder() 101 .setType(MethodDescriptor.MethodType.UNARY) 102 .setFullMethodName("grafeas.v1.Grafeas/CreateOccurrence") 103 .setRequestMarshaller( 104 ProtoUtils.marshaller(CreateOccurrenceRequest.getDefaultInstance())) 105 .setResponseMarshaller(ProtoUtils.marshaller(Occurrence.getDefaultInstance())) 106 .build(); 107 108 private static final MethodDescriptor< 109 BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse> 110 batchCreateOccurrencesMethodDescriptor = 111 MethodDescriptor 112 .<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse>newBuilder() 113 .setType(MethodDescriptor.MethodType.UNARY) 114 .setFullMethodName("grafeas.v1.Grafeas/BatchCreateOccurrences") 115 .setRequestMarshaller( 116 ProtoUtils.marshaller(BatchCreateOccurrencesRequest.getDefaultInstance())) 117 .setResponseMarshaller( 118 ProtoUtils.marshaller(BatchCreateOccurrencesResponse.getDefaultInstance())) 119 .build(); 120 121 private static final MethodDescriptor<UpdateOccurrenceRequest, Occurrence> 122 updateOccurrenceMethodDescriptor = 123 MethodDescriptor.<UpdateOccurrenceRequest, Occurrence>newBuilder() 124 .setType(MethodDescriptor.MethodType.UNARY) 125 .setFullMethodName("grafeas.v1.Grafeas/UpdateOccurrence") 126 .setRequestMarshaller( 127 ProtoUtils.marshaller(UpdateOccurrenceRequest.getDefaultInstance())) 128 .setResponseMarshaller(ProtoUtils.marshaller(Occurrence.getDefaultInstance())) 129 .build(); 130 131 private static final MethodDescriptor<GetOccurrenceNoteRequest, Note> 132 getOccurrenceNoteMethodDescriptor = 133 MethodDescriptor.<GetOccurrenceNoteRequest, Note>newBuilder() 134 .setType(MethodDescriptor.MethodType.UNARY) 135 .setFullMethodName("grafeas.v1.Grafeas/GetOccurrenceNote") 136 .setRequestMarshaller( 137 ProtoUtils.marshaller(GetOccurrenceNoteRequest.getDefaultInstance())) 138 .setResponseMarshaller(ProtoUtils.marshaller(Note.getDefaultInstance())) 139 .build(); 140 141 private static final MethodDescriptor<GetNoteRequest, Note> getNoteMethodDescriptor = 142 MethodDescriptor.<GetNoteRequest, Note>newBuilder() 143 .setType(MethodDescriptor.MethodType.UNARY) 144 .setFullMethodName("grafeas.v1.Grafeas/GetNote") 145 .setRequestMarshaller(ProtoUtils.marshaller(GetNoteRequest.getDefaultInstance())) 146 .setResponseMarshaller(ProtoUtils.marshaller(Note.getDefaultInstance())) 147 .build(); 148 149 private static final MethodDescriptor<ListNotesRequest, ListNotesResponse> 150 listNotesMethodDescriptor = 151 MethodDescriptor.<ListNotesRequest, ListNotesResponse>newBuilder() 152 .setType(MethodDescriptor.MethodType.UNARY) 153 .setFullMethodName("grafeas.v1.Grafeas/ListNotes") 154 .setRequestMarshaller(ProtoUtils.marshaller(ListNotesRequest.getDefaultInstance())) 155 .setResponseMarshaller(ProtoUtils.marshaller(ListNotesResponse.getDefaultInstance())) 156 .build(); 157 158 private static final MethodDescriptor<DeleteNoteRequest, Empty> deleteNoteMethodDescriptor = 159 MethodDescriptor.<DeleteNoteRequest, Empty>newBuilder() 160 .setType(MethodDescriptor.MethodType.UNARY) 161 .setFullMethodName("grafeas.v1.Grafeas/DeleteNote") 162 .setRequestMarshaller(ProtoUtils.marshaller(DeleteNoteRequest.getDefaultInstance())) 163 .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) 164 .build(); 165 166 private static final MethodDescriptor<CreateNoteRequest, Note> createNoteMethodDescriptor = 167 MethodDescriptor.<CreateNoteRequest, Note>newBuilder() 168 .setType(MethodDescriptor.MethodType.UNARY) 169 .setFullMethodName("grafeas.v1.Grafeas/CreateNote") 170 .setRequestMarshaller(ProtoUtils.marshaller(CreateNoteRequest.getDefaultInstance())) 171 .setResponseMarshaller(ProtoUtils.marshaller(Note.getDefaultInstance())) 172 .build(); 173 174 private static final MethodDescriptor<BatchCreateNotesRequest, BatchCreateNotesResponse> 175 batchCreateNotesMethodDescriptor = 176 MethodDescriptor.<BatchCreateNotesRequest, BatchCreateNotesResponse>newBuilder() 177 .setType(MethodDescriptor.MethodType.UNARY) 178 .setFullMethodName("grafeas.v1.Grafeas/BatchCreateNotes") 179 .setRequestMarshaller( 180 ProtoUtils.marshaller(BatchCreateNotesRequest.getDefaultInstance())) 181 .setResponseMarshaller( 182 ProtoUtils.marshaller(BatchCreateNotesResponse.getDefaultInstance())) 183 .build(); 184 185 private static final MethodDescriptor<UpdateNoteRequest, Note> updateNoteMethodDescriptor = 186 MethodDescriptor.<UpdateNoteRequest, Note>newBuilder() 187 .setType(MethodDescriptor.MethodType.UNARY) 188 .setFullMethodName("grafeas.v1.Grafeas/UpdateNote") 189 .setRequestMarshaller(ProtoUtils.marshaller(UpdateNoteRequest.getDefaultInstance())) 190 .setResponseMarshaller(ProtoUtils.marshaller(Note.getDefaultInstance())) 191 .build(); 192 193 private static final MethodDescriptor<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse> 194 listNoteOccurrencesMethodDescriptor = 195 MethodDescriptor.<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse>newBuilder() 196 .setType(MethodDescriptor.MethodType.UNARY) 197 .setFullMethodName("grafeas.v1.Grafeas/ListNoteOccurrences") 198 .setRequestMarshaller( 199 ProtoUtils.marshaller(ListNoteOccurrencesRequest.getDefaultInstance())) 200 .setResponseMarshaller( 201 ProtoUtils.marshaller(ListNoteOccurrencesResponse.getDefaultInstance())) 202 .build(); 203 204 private final UnaryCallable<GetOccurrenceRequest, Occurrence> getOccurrenceCallable; 205 private final UnaryCallable<ListOccurrencesRequest, ListOccurrencesResponse> 206 listOccurrencesCallable; 207 private final UnaryCallable<ListOccurrencesRequest, ListOccurrencesPagedResponse> 208 listOccurrencesPagedCallable; 209 private final UnaryCallable<DeleteOccurrenceRequest, Empty> deleteOccurrenceCallable; 210 private final UnaryCallable<CreateOccurrenceRequest, Occurrence> createOccurrenceCallable; 211 private final UnaryCallable<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse> 212 batchCreateOccurrencesCallable; 213 private final UnaryCallable<UpdateOccurrenceRequest, Occurrence> updateOccurrenceCallable; 214 private final UnaryCallable<GetOccurrenceNoteRequest, Note> getOccurrenceNoteCallable; 215 private final UnaryCallable<GetNoteRequest, Note> getNoteCallable; 216 private final UnaryCallable<ListNotesRequest, ListNotesResponse> listNotesCallable; 217 private final UnaryCallable<ListNotesRequest, ListNotesPagedResponse> listNotesPagedCallable; 218 private final UnaryCallable<DeleteNoteRequest, Empty> deleteNoteCallable; 219 private final UnaryCallable<CreateNoteRequest, Note> createNoteCallable; 220 private final UnaryCallable<BatchCreateNotesRequest, BatchCreateNotesResponse> 221 batchCreateNotesCallable; 222 private final UnaryCallable<UpdateNoteRequest, Note> updateNoteCallable; 223 private final UnaryCallable<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse> 224 listNoteOccurrencesCallable; 225 private final UnaryCallable<ListNoteOccurrencesRequest, ListNoteOccurrencesPagedResponse> 226 listNoteOccurrencesPagedCallable; 227 228 private final BackgroundResource backgroundResources; 229 private final GrpcOperationsStub operationsStub; 230 private final GrpcStubCallableFactory callableFactory; 231 create(GrafeasStubSettings settings)232 public static final GrpcGrafeasStub create(GrafeasStubSettings settings) throws IOException { 233 return new GrpcGrafeasStub(settings, ClientContext.create(settings)); 234 } 235 create(ClientContext clientContext)236 public static final GrpcGrafeasStub create(ClientContext clientContext) throws IOException { 237 return new GrpcGrafeasStub(GrafeasStubSettings.newBuilder().build(), clientContext); 238 } 239 create( ClientContext clientContext, GrpcStubCallableFactory callableFactory)240 public static final GrpcGrafeasStub create( 241 ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { 242 return new GrpcGrafeasStub( 243 GrafeasStubSettings.newBuilder().build(), clientContext, callableFactory); 244 } 245 246 /** 247 * Constructs an instance of GrpcGrafeasStub, using the given settings. This is protected so that 248 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 249 */ GrpcGrafeasStub(GrafeasStubSettings settings, ClientContext clientContext)250 protected GrpcGrafeasStub(GrafeasStubSettings settings, ClientContext clientContext) 251 throws IOException { 252 this(settings, clientContext, new GrpcGrafeasCallableFactory()); 253 } 254 255 /** 256 * Constructs an instance of GrpcGrafeasStub, using the given settings. This is protected so that 257 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 258 */ GrpcGrafeasStub( GrafeasStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory)259 protected GrpcGrafeasStub( 260 GrafeasStubSettings settings, 261 ClientContext clientContext, 262 GrpcStubCallableFactory callableFactory) 263 throws IOException { 264 this.callableFactory = callableFactory; 265 this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); 266 267 GrpcCallSettings<GetOccurrenceRequest, Occurrence> getOccurrenceTransportSettings = 268 GrpcCallSettings.<GetOccurrenceRequest, Occurrence>newBuilder() 269 .setMethodDescriptor(getOccurrenceMethodDescriptor) 270 .setParamsExtractor( 271 request -> { 272 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 273 params.put("name", String.valueOf(request.getName())); 274 return params.build(); 275 }) 276 .build(); 277 GrpcCallSettings<ListOccurrencesRequest, ListOccurrencesResponse> 278 listOccurrencesTransportSettings = 279 GrpcCallSettings.<ListOccurrencesRequest, ListOccurrencesResponse>newBuilder() 280 .setMethodDescriptor(listOccurrencesMethodDescriptor) 281 .setParamsExtractor( 282 request -> { 283 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 284 params.put("parent", String.valueOf(request.getParent())); 285 return params.build(); 286 }) 287 .build(); 288 GrpcCallSettings<DeleteOccurrenceRequest, Empty> deleteOccurrenceTransportSettings = 289 GrpcCallSettings.<DeleteOccurrenceRequest, Empty>newBuilder() 290 .setMethodDescriptor(deleteOccurrenceMethodDescriptor) 291 .setParamsExtractor( 292 request -> { 293 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 294 params.put("name", String.valueOf(request.getName())); 295 return params.build(); 296 }) 297 .build(); 298 GrpcCallSettings<CreateOccurrenceRequest, Occurrence> createOccurrenceTransportSettings = 299 GrpcCallSettings.<CreateOccurrenceRequest, Occurrence>newBuilder() 300 .setMethodDescriptor(createOccurrenceMethodDescriptor) 301 .setParamsExtractor( 302 request -> { 303 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 304 params.put("parent", String.valueOf(request.getParent())); 305 return params.build(); 306 }) 307 .build(); 308 GrpcCallSettings<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse> 309 batchCreateOccurrencesTransportSettings = 310 GrpcCallSettings 311 .<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse>newBuilder() 312 .setMethodDescriptor(batchCreateOccurrencesMethodDescriptor) 313 .setParamsExtractor( 314 request -> { 315 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 316 params.put("parent", String.valueOf(request.getParent())); 317 return params.build(); 318 }) 319 .build(); 320 GrpcCallSettings<UpdateOccurrenceRequest, Occurrence> updateOccurrenceTransportSettings = 321 GrpcCallSettings.<UpdateOccurrenceRequest, Occurrence>newBuilder() 322 .setMethodDescriptor(updateOccurrenceMethodDescriptor) 323 .setParamsExtractor( 324 request -> { 325 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 326 params.put("name", String.valueOf(request.getName())); 327 return params.build(); 328 }) 329 .build(); 330 GrpcCallSettings<GetOccurrenceNoteRequest, Note> getOccurrenceNoteTransportSettings = 331 GrpcCallSettings.<GetOccurrenceNoteRequest, Note>newBuilder() 332 .setMethodDescriptor(getOccurrenceNoteMethodDescriptor) 333 .setParamsExtractor( 334 request -> { 335 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 336 params.put("name", String.valueOf(request.getName())); 337 return params.build(); 338 }) 339 .build(); 340 GrpcCallSettings<GetNoteRequest, Note> getNoteTransportSettings = 341 GrpcCallSettings.<GetNoteRequest, Note>newBuilder() 342 .setMethodDescriptor(getNoteMethodDescriptor) 343 .setParamsExtractor( 344 request -> { 345 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 346 params.put("name", String.valueOf(request.getName())); 347 return params.build(); 348 }) 349 .build(); 350 GrpcCallSettings<ListNotesRequest, ListNotesResponse> listNotesTransportSettings = 351 GrpcCallSettings.<ListNotesRequest, ListNotesResponse>newBuilder() 352 .setMethodDescriptor(listNotesMethodDescriptor) 353 .setParamsExtractor( 354 request -> { 355 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 356 params.put("parent", String.valueOf(request.getParent())); 357 return params.build(); 358 }) 359 .build(); 360 GrpcCallSettings<DeleteNoteRequest, Empty> deleteNoteTransportSettings = 361 GrpcCallSettings.<DeleteNoteRequest, Empty>newBuilder() 362 .setMethodDescriptor(deleteNoteMethodDescriptor) 363 .setParamsExtractor( 364 request -> { 365 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 366 params.put("name", String.valueOf(request.getName())); 367 return params.build(); 368 }) 369 .build(); 370 GrpcCallSettings<CreateNoteRequest, Note> createNoteTransportSettings = 371 GrpcCallSettings.<CreateNoteRequest, Note>newBuilder() 372 .setMethodDescriptor(createNoteMethodDescriptor) 373 .setParamsExtractor( 374 request -> { 375 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 376 params.put("parent", String.valueOf(request.getParent())); 377 return params.build(); 378 }) 379 .build(); 380 GrpcCallSettings<BatchCreateNotesRequest, BatchCreateNotesResponse> 381 batchCreateNotesTransportSettings = 382 GrpcCallSettings.<BatchCreateNotesRequest, BatchCreateNotesResponse>newBuilder() 383 .setMethodDescriptor(batchCreateNotesMethodDescriptor) 384 .setParamsExtractor( 385 request -> { 386 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 387 params.put("parent", String.valueOf(request.getParent())); 388 return params.build(); 389 }) 390 .build(); 391 GrpcCallSettings<UpdateNoteRequest, Note> updateNoteTransportSettings = 392 GrpcCallSettings.<UpdateNoteRequest, Note>newBuilder() 393 .setMethodDescriptor(updateNoteMethodDescriptor) 394 .setParamsExtractor( 395 request -> { 396 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 397 params.put("name", String.valueOf(request.getName())); 398 return params.build(); 399 }) 400 .build(); 401 GrpcCallSettings<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse> 402 listNoteOccurrencesTransportSettings = 403 GrpcCallSettings.<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse>newBuilder() 404 .setMethodDescriptor(listNoteOccurrencesMethodDescriptor) 405 .setParamsExtractor( 406 request -> { 407 ImmutableMap.Builder<String, String> params = ImmutableMap.builder(); 408 params.put("name", String.valueOf(request.getName())); 409 return params.build(); 410 }) 411 .build(); 412 413 this.getOccurrenceCallable = 414 callableFactory.createUnaryCallable( 415 getOccurrenceTransportSettings, settings.getOccurrenceSettings(), clientContext); 416 this.listOccurrencesCallable = 417 callableFactory.createUnaryCallable( 418 listOccurrencesTransportSettings, settings.listOccurrencesSettings(), clientContext); 419 this.listOccurrencesPagedCallable = 420 callableFactory.createPagedCallable( 421 listOccurrencesTransportSettings, settings.listOccurrencesSettings(), clientContext); 422 this.deleteOccurrenceCallable = 423 callableFactory.createUnaryCallable( 424 deleteOccurrenceTransportSettings, settings.deleteOccurrenceSettings(), clientContext); 425 this.createOccurrenceCallable = 426 callableFactory.createUnaryCallable( 427 createOccurrenceTransportSettings, settings.createOccurrenceSettings(), clientContext); 428 this.batchCreateOccurrencesCallable = 429 callableFactory.createUnaryCallable( 430 batchCreateOccurrencesTransportSettings, 431 settings.batchCreateOccurrencesSettings(), 432 clientContext); 433 this.updateOccurrenceCallable = 434 callableFactory.createUnaryCallable( 435 updateOccurrenceTransportSettings, settings.updateOccurrenceSettings(), clientContext); 436 this.getOccurrenceNoteCallable = 437 callableFactory.createUnaryCallable( 438 getOccurrenceNoteTransportSettings, 439 settings.getOccurrenceNoteSettings(), 440 clientContext); 441 this.getNoteCallable = 442 callableFactory.createUnaryCallable( 443 getNoteTransportSettings, settings.getNoteSettings(), clientContext); 444 this.listNotesCallable = 445 callableFactory.createUnaryCallable( 446 listNotesTransportSettings, settings.listNotesSettings(), clientContext); 447 this.listNotesPagedCallable = 448 callableFactory.createPagedCallable( 449 listNotesTransportSettings, settings.listNotesSettings(), clientContext); 450 this.deleteNoteCallable = 451 callableFactory.createUnaryCallable( 452 deleteNoteTransportSettings, settings.deleteNoteSettings(), clientContext); 453 this.createNoteCallable = 454 callableFactory.createUnaryCallable( 455 createNoteTransportSettings, settings.createNoteSettings(), clientContext); 456 this.batchCreateNotesCallable = 457 callableFactory.createUnaryCallable( 458 batchCreateNotesTransportSettings, settings.batchCreateNotesSettings(), clientContext); 459 this.updateNoteCallable = 460 callableFactory.createUnaryCallable( 461 updateNoteTransportSettings, settings.updateNoteSettings(), clientContext); 462 this.listNoteOccurrencesCallable = 463 callableFactory.createUnaryCallable( 464 listNoteOccurrencesTransportSettings, 465 settings.listNoteOccurrencesSettings(), 466 clientContext); 467 this.listNoteOccurrencesPagedCallable = 468 callableFactory.createPagedCallable( 469 listNoteOccurrencesTransportSettings, 470 settings.listNoteOccurrencesSettings(), 471 clientContext); 472 473 this.backgroundResources = 474 new BackgroundResourceAggregation(clientContext.getBackgroundResources()); 475 } 476 getOperationsStub()477 public GrpcOperationsStub getOperationsStub() { 478 return operationsStub; 479 } 480 481 @Override getOccurrenceCallable()482 public UnaryCallable<GetOccurrenceRequest, Occurrence> getOccurrenceCallable() { 483 return getOccurrenceCallable; 484 } 485 486 @Override listOccurrencesCallable()487 public UnaryCallable<ListOccurrencesRequest, ListOccurrencesResponse> listOccurrencesCallable() { 488 return listOccurrencesCallable; 489 } 490 491 @Override 492 public UnaryCallable<ListOccurrencesRequest, ListOccurrencesPagedResponse> listOccurrencesPagedCallable()493 listOccurrencesPagedCallable() { 494 return listOccurrencesPagedCallable; 495 } 496 497 @Override deleteOccurrenceCallable()498 public UnaryCallable<DeleteOccurrenceRequest, Empty> deleteOccurrenceCallable() { 499 return deleteOccurrenceCallable; 500 } 501 502 @Override createOccurrenceCallable()503 public UnaryCallable<CreateOccurrenceRequest, Occurrence> createOccurrenceCallable() { 504 return createOccurrenceCallable; 505 } 506 507 @Override 508 public UnaryCallable<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse> batchCreateOccurrencesCallable()509 batchCreateOccurrencesCallable() { 510 return batchCreateOccurrencesCallable; 511 } 512 513 @Override updateOccurrenceCallable()514 public UnaryCallable<UpdateOccurrenceRequest, Occurrence> updateOccurrenceCallable() { 515 return updateOccurrenceCallable; 516 } 517 518 @Override getOccurrenceNoteCallable()519 public UnaryCallable<GetOccurrenceNoteRequest, Note> getOccurrenceNoteCallable() { 520 return getOccurrenceNoteCallable; 521 } 522 523 @Override getNoteCallable()524 public UnaryCallable<GetNoteRequest, Note> getNoteCallable() { 525 return getNoteCallable; 526 } 527 528 @Override listNotesCallable()529 public UnaryCallable<ListNotesRequest, ListNotesResponse> listNotesCallable() { 530 return listNotesCallable; 531 } 532 533 @Override listNotesPagedCallable()534 public UnaryCallable<ListNotesRequest, ListNotesPagedResponse> listNotesPagedCallable() { 535 return listNotesPagedCallable; 536 } 537 538 @Override deleteNoteCallable()539 public UnaryCallable<DeleteNoteRequest, Empty> deleteNoteCallable() { 540 return deleteNoteCallable; 541 } 542 543 @Override createNoteCallable()544 public UnaryCallable<CreateNoteRequest, Note> createNoteCallable() { 545 return createNoteCallable; 546 } 547 548 @Override 549 public UnaryCallable<BatchCreateNotesRequest, BatchCreateNotesResponse> batchCreateNotesCallable()550 batchCreateNotesCallable() { 551 return batchCreateNotesCallable; 552 } 553 554 @Override updateNoteCallable()555 public UnaryCallable<UpdateNoteRequest, Note> updateNoteCallable() { 556 return updateNoteCallable; 557 } 558 559 @Override 560 public UnaryCallable<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse> listNoteOccurrencesCallable()561 listNoteOccurrencesCallable() { 562 return listNoteOccurrencesCallable; 563 } 564 565 @Override 566 public UnaryCallable<ListNoteOccurrencesRequest, ListNoteOccurrencesPagedResponse> listNoteOccurrencesPagedCallable()567 listNoteOccurrencesPagedCallable() { 568 return listNoteOccurrencesPagedCallable; 569 } 570 571 @Override close()572 public final void close() { 573 try { 574 backgroundResources.close(); 575 } catch (RuntimeException e) { 576 throw e; 577 } catch (Exception e) { 578 throw new IllegalStateException("Failed to close resource", e); 579 } 580 } 581 582 @Override shutdown()583 public void shutdown() { 584 backgroundResources.shutdown(); 585 } 586 587 @Override isShutdown()588 public boolean isShutdown() { 589 return backgroundResources.isShutdown(); 590 } 591 592 @Override isTerminated()593 public boolean isTerminated() { 594 return backgroundResources.isTerminated(); 595 } 596 597 @Override shutdownNow()598 public void shutdownNow() { 599 backgroundResources.shutdownNow(); 600 } 601 602 @Override awaitTermination(long duration, TimeUnit unit)603 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 604 return backgroundResources.awaitTermination(duration, unit); 605 } 606 } 607