From 44ac07c8579633b9a050b95b91e89851c26c6d5a Mon Sep 17 00:00:00 2001 From: Daniel Fiala Date: Wed, 24 Apr 2024 12:01:25 +0200 Subject: [PATCH] feat(transcoding): added support for path parameter and query parameters --- .../grpc/GrpcTranscodingMarshaller.java | 3 +- .../grpc/deployment/GrpcClientBuildItem.java | 2 - .../quarkus/grpc/deployment/GrpcDotNames.java | 14 +++- .../deployment/GrpcTranscodingProcessor.java | 20 ++++- .../resources/dev-ui/qwc-grpc-services.js | 73 +++++++++---------- .../protoc/plugin/MutinyGrpcGenerator.java | 7 +- .../grpc/auth/GrpcSecurityInterceptor.java | 6 +- .../grpc/runtime/GrpcServerRecorder.java | 25 ++++++- .../grpc/runtime/GrpcTranscodingRecorder.java | 6 +- .../io/quarkus/grpc/runtime/Interceptors.java | 6 +- .../runtime/config/GrpcConfiguration.java | 6 +- .../grpc/runtime/devmode/GrpcServices.java | 8 +- .../runtime/reflection/GrpcServerIndex.java | 10 ++- .../reflection/ReflectionServiceV1.java | 16 +++- .../reflection/ReflectionServiceV1alpha.java | 6 +- .../stork/GrpcLoadBalancerProvider.java | 15 +++- .../stork/GrpcStorkServiceDiscovery.java | 18 ++++- .../grpc/runtime/stork/StorkGrpcChannel.java | 19 ++++- .../stork/StorkMeasuringGrpcInterceptor.java | 8 +- .../VertxStorkMeasuringGrpcInterceptor.java | 8 +- .../grpc/runtime/supports/Channels.java | 25 ++++++- .../EventLoopBlockingCheckInterceptor.java | 6 +- .../supports/IOThreadClientInterceptor.java | 10 ++- .../runtime/supports/SSLConfigHelper.java | 7 +- .../blocking/BlockingServerInterceptor.java | 12 ++- .../GrpcDuplicatedContextGrpcInterceptor.java | 6 +- .../GrpcRequestContextGrpcInterceptor.java | 6 +- .../transcoding/GrpcTranscodingBridge.java | 9 ++- .../transcoding/GrpcTranscodingRequest.java | 8 +- .../quarkus/grpc/spi/GrpcBuilderProvider.java | 7 +- 30 files changed, 291 insertions(+), 81 deletions(-) diff --git a/extensions/grpc/api/src/main/java/io/quarkus/grpc/GrpcTranscodingMarshaller.java b/extensions/grpc/api/src/main/java/io/quarkus/grpc/GrpcTranscodingMarshaller.java index 3c59820c0f061f..4b917bd6e2b434 100644 --- a/extensions/grpc/api/src/main/java/io/quarkus/grpc/GrpcTranscodingMarshaller.java +++ b/extensions/grpc/api/src/main/java/io/quarkus/grpc/GrpcTranscodingMarshaller.java @@ -10,7 +10,8 @@ import org.jboss.logging.Logger; -import com.google.protobuf.*; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.Message; import com.google.protobuf.util.JsonFormat; import io.grpc.MethodDescriptor; diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientBuildItem.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientBuildItem.java index 34facd278f88d5..8d4f329330cd7f 100644 --- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientBuildItem.java +++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientBuildItem.java @@ -7,8 +7,6 @@ import org.jboss.jandex.DotName; import io.quarkus.builder.item.MultiBuildItem; -import io.quarkus.grpc.deployment.GrpcClientBuildItem.ClientInfo; -import io.quarkus.grpc.deployment.GrpcClientBuildItem.ClientType; public final class GrpcClientBuildItem extends MultiBuildItem { diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcDotNames.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcDotNames.java index 375ec78157f0a0..cdefebfd64c12d 100644 --- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcDotNames.java +++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcDotNames.java @@ -13,7 +13,19 @@ import io.grpc.stub.AbstractBlockingStub; import io.grpc.stub.AbstractStub; import io.quarkus.gizmo.MethodDescriptor; -import io.quarkus.grpc.*; +import io.quarkus.grpc.GlobalInterceptor; +import io.quarkus.grpc.GrpcClient; +import io.quarkus.grpc.GrpcService; +import io.quarkus.grpc.GrpcTranscodingMethod; +import io.quarkus.grpc.MutinyBean; +import io.quarkus.grpc.MutinyClient; +import io.quarkus.grpc.MutinyGrpc; +import io.quarkus.grpc.MutinyService; +import io.quarkus.grpc.MutinyStub; +import io.quarkus.grpc.MutinyTranscodingService; +import io.quarkus.grpc.RegisterClientInterceptor; +import io.quarkus.grpc.RegisterInterceptor; +import io.quarkus.grpc.RegisterInterceptors; import io.quarkus.grpc.runtime.supports.Channels; import io.quarkus.grpc.runtime.supports.GrpcClientConfigProvider; import io.smallrye.common.annotation.Blocking; diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcTranscodingProcessor.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcTranscodingProcessor.java index 9bacc0f09d87ef..72e408aa2e6ad4 100644 --- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcTranscodingProcessor.java +++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcTranscodingProcessor.java @@ -1,8 +1,17 @@ package io.quarkus.grpc.deployment; -import java.util.*; - -import org.jboss.jandex.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.jboss.jandex.AnnotationInstance; +import org.jboss.jandex.AnnotationTarget; +import org.jboss.jandex.ClassInfo; +import org.jboss.jandex.DotName; +import org.jboss.jandex.MethodInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,7 +22,10 @@ import io.quarkus.arc.processor.BuiltinScope; import io.quarkus.deployment.Capabilities; import io.quarkus.deployment.Capability; -import io.quarkus.deployment.annotations.*; +import io.quarkus.deployment.annotations.BuildProducer; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.Consume; +import io.quarkus.deployment.annotations.ExecutionTime; import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; diff --git a/extensions/grpc/deployment/src/main/resources/dev-ui/qwc-grpc-services.js b/extensions/grpc/deployment/src/main/resources/dev-ui/qwc-grpc-services.js index 7a505a4861051d..93d2781d3ecbb7 100644 --- a/extensions/grpc/deployment/src/main/resources/dev-ui/qwc-grpc-services.js +++ b/extensions/grpc/deployment/src/main/resources/dev-ui/qwc-grpc-services.js @@ -1,9 +1,8 @@ -import { QwcHotReloadElement, html, css} from 'qwc-hot-reload-element'; -import { JsonRpc } from 'jsonrpc'; -import { columnBodyRenderer } from '@vaadin/grid/lit.js'; -import { gridRowDetailsRenderer } from '@vaadin/grid/lit.js'; -import { observeState } from 'lit-element-state'; -import { themeState } from 'theme-state'; +import {css, html, QwcHotReloadElement} from 'qwc-hot-reload-element'; +import {JsonRpc} from 'jsonrpc'; +import {columnBodyRenderer, gridRowDetailsRenderer} from '@vaadin/grid/lit.js'; +import {observeState} from 'lit-element-state'; +import {themeState} from 'theme-state'; import '@quarkus-webcomponents/codeblock'; import '@vaadin/progress-bar'; import '@vaadin/grid'; @@ -18,7 +17,7 @@ import '@vaadin/button'; /** * This component shows the Grpc Services */ -export class QwcGrpcServices extends observeState(QwcHotReloadElement) { +export class QwcGrpcServices extends observeState(QwcHotReloadElement) { jsonRpc = new JsonRpc(this); streamsMap = new Map(); @@ -64,7 +63,7 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { _testerButtons: {state: true} }; - constructor() { + constructor() { super(); this._detailsOpenedItem = []; this._streamsMap = new Map(); @@ -85,13 +84,13 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { } hotReload(){ - this.jsonRpc.getServices().then(jsonRpcResponse => { + this.jsonRpc.getServices().then(jsonRpcResponse => { this._services = jsonRpcResponse.result; this._forceUpdate(); }); } - render() { + render() { if(this._services){ return html` - `; + `; }else{ return html``; } } - + _statusRenderer(service){ if(service.status === "SERVING"){ return html``; @@ -147,36 +146,36 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { return html``; } } - + _nameRenderer(service){ return html`${service.name}`; } - + _serviceClassRenderer(service){ return html`${service.serviceClass}`; } - + _methodsRenderer(service){ return html`
${service.methods.map(method => html`${this._methodRenderer(method)}` )}
`; } - + _methodRenderer(method){ return html`${method.type} ${method.bareMethodName}`; } - + _testRenderer(service){ if(service.hasTestableMethod){ return html``; } } - + _testerRenderer(service){ - + if(service.methods.length > 1 ){ - + return html` ${service.methods.map(method => html`${this._methodTesterTabHeadingRenderer(service.name, method)}` @@ -193,21 +192,21 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { `; } } - + _tabSelectedChanged(service, n){ let method = service.methods[n]; this._testerContent = this._methodTesterRenderer(service, method); this._testerButtons = this._renderCommandButtons(service, method); this._forceUpdate(); } - + _methodTesterTabHeadingRenderer(serviceName,method) { return html` ${method.bareMethodName} ${method.type} `; } - + _methodTesterRenderer(service, method){ return html` @@ -230,7 +229,7 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { `; } - + _renderCommandButtons(service, method){ if(this._streamsMap.size >=0){ if(method.type == 'UNARY'){ @@ -244,7 +243,7 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { } } } - + _keypress(e, service, method){ if(method.type == 'UNARY' || !this._isRunning(service.name, method)){ if ((e.keyCode == 10 || e.keyCode == 13) && e.ctrlKey){ // ctlr-enter @@ -252,26 +251,26 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { } } } - + _isRunning(serviceName, method){ let id = this._id(serviceName, method); return this._streamsMap.has(id); } - + _id(serviceName, method){ - return serviceName + "_" + method.bareMethodName + "_" + method.type; + return serviceName + "_" + method.bareMethodName + "_" + method.type; } - + _clear(serviceName, method){ this._requestTextArea(serviceName, method).clear(); this._responseTextArea(serviceName, method).clear(); } - + _default(serviceName, method){ let pv = JSON.parse(method.prototype); this._requestTextArea(serviceName, method).populatePrettyJson(JSON.stringify(pv)); } - + _test(service, method){ let textArea = this._requestTextArea(service.name, method); let content = textArea.getAttribute('value'); @@ -306,7 +305,7 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { this._forceUpdate(); } } - + _forceUpdate(){ if(this._detailsOpenedItem.length > 0){ let itemZero = this._detailsOpenedItem[0]; @@ -314,21 +313,21 @@ export class QwcGrpcServices extends observeState(QwcHotReloadElement) { this._detailsOpenedItem.push(itemZero); } } - + _requestTextArea(serviceName, method){ return this.shadowRoot.getElementById(this._requestId(serviceName, method)); } - + _responseTextArea(serviceName, method){ return this.shadowRoot.getElementById(this._responseId(serviceName, method)); } - + _requestId(serviceName, method){ return serviceName + '/' + method.bareMethodName + '_request'; } - + _responseId(serviceName, method){ return serviceName + '/' + method.bareMethodName + '_response'; } } -customElements.define('qwc-grpc-services', QwcGrpcServices); \ No newline at end of file +customElements.define('qwc-grpc-services', QwcGrpcServices); diff --git a/extensions/grpc/protoc/src/main/java/io/quarkus/grpc/protoc/plugin/MutinyGrpcGenerator.java b/extensions/grpc/protoc/src/main/java/io/quarkus/grpc/protoc/plugin/MutinyGrpcGenerator.java index 5a32fe04615d15..7fe3bbe94cd8b8 100644 --- a/extensions/grpc/protoc/src/main/java/io/quarkus/grpc/protoc/plugin/MutinyGrpcGenerator.java +++ b/extensions/grpc/protoc/src/main/java/io/quarkus/grpc/protoc/plugin/MutinyGrpcGenerator.java @@ -1,6 +1,11 @@ package io.quarkus.grpc.protoc.plugin; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/auth/GrpcSecurityInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/auth/GrpcSecurityInterceptor.java index f270a4bb114c7a..7399a5088d942f 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/auth/GrpcSecurityInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/auth/GrpcSecurityInterceptor.java @@ -6,7 +6,11 @@ import static io.quarkus.vertx.http.runtime.security.QuarkusHttpUser.DEFERRED_IDENTITY_KEY; import static io.smallrye.common.vertx.VertxContext.isDuplicatedContext; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.Executor; import java.util.function.Consumer; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java index e0195df4d659e7..8aded4bb4940a6 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java @@ -8,7 +8,15 @@ import java.io.UncheckedIOException; import java.net.BindException; import java.time.Duration; -import java.util.*; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -22,7 +30,13 @@ import org.jboss.logging.Logger; import grpc.health.v1.HealthOuterClass; -import io.grpc.*; +import io.grpc.BindableService; +import io.grpc.Server; +import io.grpc.ServerBuilder; +import io.grpc.ServerInterceptor; +import io.grpc.ServerInterceptors; +import io.grpc.ServerMethodDefinition; +import io.grpc.ServerServiceDefinition; import io.grpc.netty.NettyServerBuilder; import io.quarkus.arc.Arc; import io.quarkus.arc.InstanceHandle; @@ -48,8 +62,13 @@ import io.quarkus.runtime.annotations.Recorder; import io.quarkus.vertx.http.runtime.PortSystemProperties; import io.quarkus.virtual.threads.VirtualThreadsRecorder; -import io.vertx.core.*; +import io.vertx.core.AbstractVerticle; +import io.vertx.core.AsyncResult; import io.vertx.core.Context; +import io.vertx.core.DeploymentOptions; +import io.vertx.core.Handler; +import io.vertx.core.Promise; +import io.vertx.core.Vertx; import io.vertx.ext.web.Route; import io.vertx.ext.web.Router; import io.vertx.ext.web.RoutingContext; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcTranscodingRecorder.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcTranscodingRecorder.java index b20ff878593ff5..47a9882e785411 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcTranscodingRecorder.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcTranscodingRecorder.java @@ -18,7 +18,11 @@ import io.quarkus.grpc.GrpcTranscodingDescriptor; import io.quarkus.grpc.MutinyTranscodingService; import io.quarkus.grpc.auth.GrpcSecurityInterceptor; -import io.quarkus.grpc.runtime.transcoding.*; +import io.quarkus.grpc.runtime.transcoding.GrpcTranscodingBridge; +import io.quarkus.grpc.runtime.transcoding.GrpcTranscodingContainer; +import io.quarkus.grpc.runtime.transcoding.GrpcTranscodingMetadata; +import io.quarkus.grpc.runtime.transcoding.GrpcTranscodingMethod; +import io.quarkus.grpc.runtime.transcoding.GrpcTranscodingServer; import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Recorder; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/Interceptors.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/Interceptors.java index b893187c06b899..64e05244925ebc 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/Interceptors.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/Interceptors.java @@ -1,6 +1,10 @@ package io.quarkus.grpc.runtime; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Set; import jakarta.enterprise.inject.Any; import jakarta.enterprise.inject.spi.Prioritized; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcConfiguration.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcConfiguration.java index 9d6096960b5c57..1cc2406f666c66 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcConfiguration.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/config/GrpcConfiguration.java @@ -2,7 +2,11 @@ import java.util.Map; -import io.quarkus.runtime.annotations.*; +import io.quarkus.runtime.annotations.ConfigDocMapKey; +import io.quarkus.runtime.annotations.ConfigDocSection; +import io.quarkus.runtime.annotations.ConfigItem; +import io.quarkus.runtime.annotations.ConfigPhase; +import io.quarkus.runtime.annotations.ConfigRoot; /** * gRPC configuration root. diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java index ff8191c63ca6cf..ce3e554f1397b9 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/devmode/GrpcServices.java @@ -1,6 +1,12 @@ package io.quarkus.grpc.runtime.devmode; -import java.util.*; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import jakarta.inject.Inject; import jakarta.inject.Singleton; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/GrpcServerIndex.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/GrpcServerIndex.java index 4800a489152728..5c1dece314e527 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/GrpcServerIndex.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/GrpcServerIndex.java @@ -2,7 +2,15 @@ import static com.google.protobuf.Descriptors.FileDescriptor; -import java.util.*; +import java.util.ArrayDeque; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; import java.util.function.Function; import com.google.protobuf.Descriptors; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1.java index 1af6bf5c6fa57a..0f57ad617c4f01 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1.java @@ -2,14 +2,26 @@ import static com.google.protobuf.Descriptors.FileDescriptor; -import java.util.*; +import java.util.ArrayDeque; +import java.util.HashSet; +import java.util.List; +import java.util.Queue; +import java.util.Set; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Supplier; import io.grpc.ServerServiceDefinition; import io.grpc.Status; -import io.grpc.reflection.v1.*; +import io.grpc.reflection.v1.ErrorResponse; +import io.grpc.reflection.v1.ExtensionNumberResponse; +import io.grpc.reflection.v1.ExtensionRequest; +import io.grpc.reflection.v1.FileDescriptorResponse; +import io.grpc.reflection.v1.ListServiceResponse; +import io.grpc.reflection.v1.MutinyServerReflectionGrpc; +import io.grpc.reflection.v1.ServerReflectionRequest; +import io.grpc.reflection.v1.ServerReflectionResponse; +import io.grpc.reflection.v1.ServiceResponse; import io.smallrye.mutiny.Multi; public class ReflectionServiceV1 extends MutinyServerReflectionGrpc.ServerReflectionImplBase { diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1alpha.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1alpha.java index 2de46bd4540551..1caafa1a4425bf 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1alpha.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/reflection/ReflectionServiceV1alpha.java @@ -2,7 +2,11 @@ import static com.google.protobuf.Descriptors.FileDescriptor; -import java.util.*; +import java.util.ArrayDeque; +import java.util.HashSet; +import java.util.List; +import java.util.Queue; +import java.util.Set; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Supplier; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcLoadBalancerProvider.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcLoadBalancerProvider.java index 92e659d4d1f92d..ef24163c1870a3 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcLoadBalancerProvider.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcLoadBalancerProvider.java @@ -5,13 +5,24 @@ import static io.quarkus.grpc.runtime.stork.StorkMeasuringCollector.STORK_MEASURE_TIME; import static io.quarkus.grpc.runtime.stork.StorkMeasuringCollector.STORK_SERVICE_INSTANCE; -import java.util.*; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicReference; import org.jboss.logging.Logger; -import io.grpc.*; +import io.grpc.ConnectivityState; +import io.grpc.ConnectivityStateInfo; +import io.grpc.EquivalentAddressGroup; +import io.grpc.LoadBalancer; +import io.grpc.LoadBalancerProvider; +import io.grpc.NameResolver; +import io.grpc.Status; import io.grpc.internal.JsonUtil; import io.smallrye.stork.Stork; import io.smallrye.stork.api.Service; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcStorkServiceDiscovery.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcStorkServiceDiscovery.java index c73c31559a6bbc..ccfc477a44fb04 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcStorkServiceDiscovery.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/GrpcStorkServiceDiscovery.java @@ -1,13 +1,25 @@ package io.quarkus.grpc.runtime.stork; -import java.net.*; -import java.util.*; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.URI; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.jboss.logging.Logger; import com.google.common.base.Preconditions; -import io.grpc.*; +import io.grpc.Attributes; +import io.grpc.EquivalentAddressGroup; +import io.grpc.NameResolver; +import io.grpc.NameResolverProvider; +import io.grpc.Status; import io.smallrye.mutiny.Uni; import io.smallrye.stork.Stork; import io.smallrye.stork.api.Service; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java index c8fb547b48a398..51e79954346477 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkGrpcChannel.java @@ -6,8 +6,17 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.UnknownHostException; -import java.util.*; -import java.util.concurrent.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executor; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import javax.annotation.Nullable; @@ -15,7 +24,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.grpc.*; +import io.grpc.CallOptions; +import io.grpc.Channel; +import io.grpc.ClientCall; +import io.grpc.Deadline; +import io.grpc.MethodDescriptor; import io.grpc.internal.DelayedClientCall; import io.quarkus.grpc.runtime.config.StorkConfig; import io.smallrye.mutiny.Uni; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkMeasuringGrpcInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkMeasuringGrpcInterceptor.java index df50f33eb1f817..bd23be1764674d 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkMeasuringGrpcInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/StorkMeasuringGrpcInterceptor.java @@ -5,7 +5,13 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.spi.Prioritized; -import io.grpc.*; +import io.grpc.CallOptions; +import io.grpc.Channel; +import io.grpc.ClientCall; +import io.grpc.ClientInterceptor; +import io.grpc.Context; +import io.grpc.Metadata; +import io.grpc.MethodDescriptor; import io.smallrye.stork.api.ServiceInstance; @ApplicationScoped diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/VertxStorkMeasuringGrpcInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/VertxStorkMeasuringGrpcInterceptor.java index eb852de00636b4..07f5d3a3d53d4e 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/VertxStorkMeasuringGrpcInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/stork/VertxStorkMeasuringGrpcInterceptor.java @@ -8,7 +8,13 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.spi.Prioritized; -import io.grpc.*; +import io.grpc.CallOptions; +import io.grpc.Channel; +import io.grpc.ClientCall; +import io.grpc.ClientInterceptor; +import io.grpc.Context; +import io.grpc.Metadata; +import io.grpc.MethodDescriptor; import io.smallrye.stork.api.ServiceInstance; /** diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java index 80d7851c9948d8..aafa71bdbb8807 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java @@ -5,7 +5,12 @@ import static io.grpc.netty.NettyChannelBuilder.DEFAULT_FLOW_CONTROL_WINDOW; import static io.quarkus.grpc.runtime.GrpcTestPortUtils.testPort; import static io.quarkus.grpc.runtime.config.GrpcClientConfiguration.DNS; -import static io.quarkus.grpc.runtime.supports.SSLConfigHelper.*; +import static io.quarkus.grpc.runtime.supports.SSLConfigHelper.configureJksKeyCertOptions; +import static io.quarkus.grpc.runtime.supports.SSLConfigHelper.configureJksTrustOptions; +import static io.quarkus.grpc.runtime.supports.SSLConfigHelper.configurePemKeyCertOptions; +import static io.quarkus.grpc.runtime.supports.SSLConfigHelper.configurePemTrustOptions; +import static io.quarkus.grpc.runtime.supports.SSLConfigHelper.configurePfxKeyCertOptions; +import static io.quarkus.grpc.runtime.supports.SSLConfigHelper.configurePfxTrustOptions; import java.io.IOException; import java.io.InputStream; @@ -14,7 +19,14 @@ import java.nio.file.Files; import java.nio.file.Path; import java.time.Duration; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.OptionalInt; +import java.util.OptionalLong; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -24,7 +36,14 @@ import org.eclipse.microprofile.context.ManagedExecutor; import org.jboss.logging.Logger; -import io.grpc.*; +import io.grpc.CallOptions; +import io.grpc.Channel; +import io.grpc.ClientCall; +import io.grpc.ClientInterceptor; +import io.grpc.ClientInterceptors; +import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; +import io.grpc.MethodDescriptor; import io.grpc.netty.GrpcSslContexts; import io.grpc.netty.NegotiationType; import io.grpc.netty.NettyChannelBuilder; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/EventLoopBlockingCheckInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/EventLoopBlockingCheckInterceptor.java index 84a3d330502711..ce43d7c7490de9 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/EventLoopBlockingCheckInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/EventLoopBlockingCheckInterceptor.java @@ -1,6 +1,10 @@ package io.quarkus.grpc.runtime.supports; -import io.grpc.*; +import io.grpc.CallOptions; +import io.grpc.Channel; +import io.grpc.ClientCall; +import io.grpc.ClientInterceptor; +import io.grpc.MethodDescriptor; import io.vertx.core.Context; public class EventLoopBlockingCheckInterceptor implements ClientInterceptor { diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/IOThreadClientInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/IOThreadClientInterceptor.java index d12df232f7be05..a8aabb2d540221 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/IOThreadClientInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/IOThreadClientInterceptor.java @@ -3,7 +3,15 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.spi.Prioritized; -import io.grpc.*; +import io.grpc.CallOptions; +import io.grpc.Channel; +import io.grpc.ClientCall; +import io.grpc.ClientInterceptor; +import io.grpc.ForwardingClientCall; +import io.grpc.ForwardingClientCallListener; +import io.grpc.Metadata; +import io.grpc.MethodDescriptor; +import io.grpc.Status; import io.quarkus.grpc.GlobalInterceptor; import io.vertx.core.Context; import io.vertx.core.Vertx; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/SSLConfigHelper.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/SSLConfigHelper.java index 9f6a97e1385bc1..c1fd55c77b16a4 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/SSLConfigHelper.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/SSLConfigHelper.java @@ -1,7 +1,12 @@ package io.quarkus.grpc.runtime.supports; import io.quarkus.grpc.runtime.config.TlsClientConfig; -import io.vertx.core.net.*; +import io.vertx.core.net.JksOptions; +import io.vertx.core.net.KeyCertOptions; +import io.vertx.core.net.PemKeyCertOptions; +import io.vertx.core.net.PemTrustOptions; +import io.vertx.core.net.PfxOptions; +import io.vertx.core.net.TCPSSLOptions; public class SSLConfigHelper { diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/blocking/BlockingServerInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/blocking/BlockingServerInterceptor.java index 0c3bebe3df8667..047d67adce374c 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/blocking/BlockingServerInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/blocking/BlockingServerInterceptor.java @@ -1,6 +1,10 @@ package io.quarkus.grpc.runtime.supports.blocking; -import java.util.*; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; @@ -12,7 +16,11 @@ import org.jboss.logging.Logger; -import io.grpc.*; +import io.grpc.Context; +import io.grpc.Metadata; +import io.grpc.ServerCall; +import io.grpc.ServerCallHandler; +import io.grpc.ServerInterceptor; import io.quarkus.arc.Arc; import io.quarkus.arc.InjectableContext; import io.quarkus.arc.InjectableContext.ContextState; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcDuplicatedContextGrpcInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcDuplicatedContextGrpcInterceptor.java index 8da518290afd4f..675f6338aaa11f 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcDuplicatedContextGrpcInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcDuplicatedContextGrpcInterceptor.java @@ -13,7 +13,11 @@ import org.jboss.logging.Logger; -import io.grpc.*; +import io.grpc.Metadata; +import io.grpc.ServerCall; +import io.grpc.ServerCallHandler; +import io.grpc.ServerInterceptor; +import io.grpc.StatusException; import io.quarkus.grpc.ExceptionHandlerProvider; import io.quarkus.grpc.GlobalInterceptor; import io.quarkus.grpc.runtime.Interceptors; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcRequestContextGrpcInterceptor.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcRequestContextGrpcInterceptor.java index de867a16bc6d7a..af46d32a512685 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcRequestContextGrpcInterceptor.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/context/GrpcRequestContextGrpcInterceptor.java @@ -5,7 +5,11 @@ import org.jboss.logging.Logger; -import io.grpc.*; +import io.grpc.ForwardingServerCallListener; +import io.grpc.Metadata; +import io.grpc.ServerCall; +import io.grpc.ServerCallHandler; +import io.grpc.ServerInterceptor; import io.quarkus.arc.Arc; import io.quarkus.arc.InjectableContext; import io.quarkus.arc.ManagedContext; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingBridge.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingBridge.java index c491f049e4fd37..ae4c293d8c826e 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingBridge.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingBridge.java @@ -5,7 +5,14 @@ import java.net.UnknownHostException; import java.util.List; -import io.grpc.*; +import io.grpc.Attributes; +import io.grpc.Grpc; +import io.grpc.Metadata; +import io.grpc.MethodDescriptor; +import io.grpc.ServerCall; +import io.grpc.ServerCallHandler; +import io.grpc.ServerMethodDefinition; +import io.grpc.Status; import io.vertx.core.net.SocketAddress; import io.vertx.grpc.common.GrpcError; import io.vertx.grpc.common.GrpcStatus; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingRequest.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingRequest.java index 3e99885cdf8e73..f1f835696a9d54 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingRequest.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/transcoding/GrpcTranscodingRequest.java @@ -22,7 +22,13 @@ import io.vertx.core.json.Json; import io.vertx.core.streams.ReadStream; import io.vertx.core.streams.impl.InboundBuffer; -import io.vertx.grpc.common.*; +import io.vertx.grpc.common.CodecException; +import io.vertx.grpc.common.GrpcError; +import io.vertx.grpc.common.GrpcMessage; +import io.vertx.grpc.common.GrpcMessageDecoder; +import io.vertx.grpc.common.GrpcMessageEncoder; +import io.vertx.grpc.common.GrpcReadStream; +import io.vertx.grpc.common.ServiceName; import io.vertx.grpc.common.impl.GrpcMethodCall; import io.vertx.grpc.server.GrpcServerRequest; import io.vertx.grpc.server.GrpcServerResponse; diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/spi/GrpcBuilderProvider.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/spi/GrpcBuilderProvider.java index 5ef21628d0b4b6..5c4627e7fd0c66 100644 --- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/spi/GrpcBuilderProvider.java +++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/spi/GrpcBuilderProvider.java @@ -7,7 +7,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.grpc.*; +import io.grpc.ManagedChannelBuilder; +import io.grpc.Server; +import io.grpc.ServerBuilder; +import io.grpc.ServerInterceptor; +import io.grpc.ServerMethodDefinition; +import io.grpc.ServerServiceDefinition; import io.quarkus.grpc.runtime.config.GrpcClientConfiguration; import io.quarkus.grpc.runtime.config.GrpcServerConfiguration; import io.quarkus.runtime.LaunchMode;