• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package io.istio.test;
2 
3 import static io.grpc.MethodDescriptor.generateFullMethodName;
4 
5 /**
6  */
7 @javax.annotation.Generated(
8     value = "by gRPC proto compiler",
9     comments = "Source: test/echo/proto/echo.proto")
10 @io.grpc.stub.annotations.GrpcGenerated
11 public final class EchoTestServiceGrpc {
12 
EchoTestServiceGrpc()13   private EchoTestServiceGrpc() {}
14 
15   public static final String SERVICE_NAME = "proto.EchoTestService";
16 
17   // Static method descriptors that strictly reflect the proto.
18   private static volatile io.grpc.MethodDescriptor<io.istio.test.Echo.EchoRequest,
19       io.istio.test.Echo.EchoResponse> getEchoMethod;
20 
21   @io.grpc.stub.annotations.RpcMethod(
22       fullMethodName = SERVICE_NAME + '/' + "Echo",
23       requestType = io.istio.test.Echo.EchoRequest.class,
24       responseType = io.istio.test.Echo.EchoResponse.class,
25       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
26   public static io.grpc.MethodDescriptor<io.istio.test.Echo.EchoRequest,
getEchoMethod()27       io.istio.test.Echo.EchoResponse> getEchoMethod() {
28     io.grpc.MethodDescriptor<io.istio.test.Echo.EchoRequest, io.istio.test.Echo.EchoResponse> getEchoMethod;
29     if ((getEchoMethod = EchoTestServiceGrpc.getEchoMethod) == null) {
30       synchronized (EchoTestServiceGrpc.class) {
31         if ((getEchoMethod = EchoTestServiceGrpc.getEchoMethod) == null) {
32           EchoTestServiceGrpc.getEchoMethod = getEchoMethod =
33               io.grpc.MethodDescriptor.<io.istio.test.Echo.EchoRequest, io.istio.test.Echo.EchoResponse>newBuilder()
34               .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
35               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Echo"))
36               .setSampledToLocalTracing(true)
37               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
38                   io.istio.test.Echo.EchoRequest.getDefaultInstance()))
39               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
40                   io.istio.test.Echo.EchoResponse.getDefaultInstance()))
41               .setSchemaDescriptor(new EchoTestServiceMethodDescriptorSupplier("Echo"))
42               .build();
43         }
44       }
45     }
46     return getEchoMethod;
47   }
48 
49   private static volatile io.grpc.MethodDescriptor<io.istio.test.Echo.ForwardEchoRequest,
50       io.istio.test.Echo.ForwardEchoResponse> getForwardEchoMethod;
51 
52   @io.grpc.stub.annotations.RpcMethod(
53       fullMethodName = SERVICE_NAME + '/' + "ForwardEcho",
54       requestType = io.istio.test.Echo.ForwardEchoRequest.class,
55       responseType = io.istio.test.Echo.ForwardEchoResponse.class,
56       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
57   public static io.grpc.MethodDescriptor<io.istio.test.Echo.ForwardEchoRequest,
getForwardEchoMethod()58       io.istio.test.Echo.ForwardEchoResponse> getForwardEchoMethod() {
59     io.grpc.MethodDescriptor<io.istio.test.Echo.ForwardEchoRequest, io.istio.test.Echo.ForwardEchoResponse> getForwardEchoMethod;
60     if ((getForwardEchoMethod = EchoTestServiceGrpc.getForwardEchoMethod) == null) {
61       synchronized (EchoTestServiceGrpc.class) {
62         if ((getForwardEchoMethod = EchoTestServiceGrpc.getForwardEchoMethod) == null) {
63           EchoTestServiceGrpc.getForwardEchoMethod = getForwardEchoMethod =
64               io.grpc.MethodDescriptor.<io.istio.test.Echo.ForwardEchoRequest, io.istio.test.Echo.ForwardEchoResponse>newBuilder()
65               .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
66               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ForwardEcho"))
67               .setSampledToLocalTracing(true)
68               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
69                   io.istio.test.Echo.ForwardEchoRequest.getDefaultInstance()))
70               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
71                   io.istio.test.Echo.ForwardEchoResponse.getDefaultInstance()))
72               .setSchemaDescriptor(new EchoTestServiceMethodDescriptorSupplier("ForwardEcho"))
73               .build();
74         }
75       }
76     }
77     return getForwardEchoMethod;
78   }
79 
80   /**
81    * Creates a new async stub that supports all call types for the service
82    */
newStub(io.grpc.Channel channel)83   public static EchoTestServiceStub newStub(io.grpc.Channel channel) {
84     io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceStub> factory =
85       new io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceStub>() {
86         @java.lang.Override
87         public EchoTestServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
88           return new EchoTestServiceStub(channel, callOptions);
89         }
90       };
91     return EchoTestServiceStub.newStub(factory, channel);
92   }
93 
94   /**
95    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
96    */
newBlockingStub( io.grpc.Channel channel)97   public static EchoTestServiceBlockingStub newBlockingStub(
98       io.grpc.Channel channel) {
99     io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceBlockingStub> factory =
100       new io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceBlockingStub>() {
101         @java.lang.Override
102         public EchoTestServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
103           return new EchoTestServiceBlockingStub(channel, callOptions);
104         }
105       };
106     return EchoTestServiceBlockingStub.newStub(factory, channel);
107   }
108 
109   /**
110    * Creates a new ListenableFuture-style stub that supports unary calls on the service
111    */
newFutureStub( io.grpc.Channel channel)112   public static EchoTestServiceFutureStub newFutureStub(
113       io.grpc.Channel channel) {
114     io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceFutureStub> factory =
115       new io.grpc.stub.AbstractStub.StubFactory<EchoTestServiceFutureStub>() {
116         @java.lang.Override
117         public EchoTestServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
118           return new EchoTestServiceFutureStub(channel, callOptions);
119         }
120       };
121     return EchoTestServiceFutureStub.newStub(factory, channel);
122   }
123 
124   /**
125    */
126   public interface AsyncService {
127 
128     /**
129      */
echo(io.istio.test.Echo.EchoRequest request, io.grpc.stub.StreamObserver<io.istio.test.Echo.EchoResponse> responseObserver)130     default void echo(io.istio.test.Echo.EchoRequest request,
131         io.grpc.stub.StreamObserver<io.istio.test.Echo.EchoResponse> responseObserver) {
132       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getEchoMethod(), responseObserver);
133     }
134 
135     /**
136      */
forwardEcho(io.istio.test.Echo.ForwardEchoRequest request, io.grpc.stub.StreamObserver<io.istio.test.Echo.ForwardEchoResponse> responseObserver)137     default void forwardEcho(io.istio.test.Echo.ForwardEchoRequest request,
138         io.grpc.stub.StreamObserver<io.istio.test.Echo.ForwardEchoResponse> responseObserver) {
139       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getForwardEchoMethod(), responseObserver);
140     }
141   }
142 
143   /**
144    * Base class for the server implementation of the service EchoTestService.
145    */
146   public static abstract class EchoTestServiceImplBase
147       implements io.grpc.BindableService, AsyncService {
148 
bindService()149     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
150       return EchoTestServiceGrpc.bindService(this);
151     }
152   }
153 
154   /**
155    * A stub to allow clients to do asynchronous rpc calls to service EchoTestService.
156    */
157   public static final class EchoTestServiceStub
158       extends io.grpc.stub.AbstractAsyncStub<EchoTestServiceStub> {
EchoTestServiceStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)159     private EchoTestServiceStub(
160         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
161       super(channel, callOptions);
162     }
163 
164     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)165     protected EchoTestServiceStub build(
166         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
167       return new EchoTestServiceStub(channel, callOptions);
168     }
169 
170     /**
171      */
echo(io.istio.test.Echo.EchoRequest request, io.grpc.stub.StreamObserver<io.istio.test.Echo.EchoResponse> responseObserver)172     public void echo(io.istio.test.Echo.EchoRequest request,
173         io.grpc.stub.StreamObserver<io.istio.test.Echo.EchoResponse> responseObserver) {
174       io.grpc.stub.ClientCalls.asyncUnaryCall(
175           getChannel().newCall(getEchoMethod(), getCallOptions()), request, responseObserver);
176     }
177 
178     /**
179      */
forwardEcho(io.istio.test.Echo.ForwardEchoRequest request, io.grpc.stub.StreamObserver<io.istio.test.Echo.ForwardEchoResponse> responseObserver)180     public void forwardEcho(io.istio.test.Echo.ForwardEchoRequest request,
181         io.grpc.stub.StreamObserver<io.istio.test.Echo.ForwardEchoResponse> responseObserver) {
182       io.grpc.stub.ClientCalls.asyncUnaryCall(
183           getChannel().newCall(getForwardEchoMethod(), getCallOptions()), request, responseObserver);
184     }
185   }
186 
187   /**
188    * A stub to allow clients to do synchronous rpc calls to service EchoTestService.
189    */
190   public static final class EchoTestServiceBlockingStub
191       extends io.grpc.stub.AbstractBlockingStub<EchoTestServiceBlockingStub> {
EchoTestServiceBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)192     private EchoTestServiceBlockingStub(
193         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
194       super(channel, callOptions);
195     }
196 
197     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)198     protected EchoTestServiceBlockingStub build(
199         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
200       return new EchoTestServiceBlockingStub(channel, callOptions);
201     }
202 
203     /**
204      */
echo(io.istio.test.Echo.EchoRequest request)205     public io.istio.test.Echo.EchoResponse echo(io.istio.test.Echo.EchoRequest request) {
206       return io.grpc.stub.ClientCalls.blockingUnaryCall(
207           getChannel(), getEchoMethod(), getCallOptions(), request);
208     }
209 
210     /**
211      */
forwardEcho(io.istio.test.Echo.ForwardEchoRequest request)212     public io.istio.test.Echo.ForwardEchoResponse forwardEcho(io.istio.test.Echo.ForwardEchoRequest request) {
213       return io.grpc.stub.ClientCalls.blockingUnaryCall(
214           getChannel(), getForwardEchoMethod(), getCallOptions(), request);
215     }
216   }
217 
218   /**
219    * A stub to allow clients to do ListenableFuture-style rpc calls to service EchoTestService.
220    */
221   public static final class EchoTestServiceFutureStub
222       extends io.grpc.stub.AbstractFutureStub<EchoTestServiceFutureStub> {
EchoTestServiceFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)223     private EchoTestServiceFutureStub(
224         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
225       super(channel, callOptions);
226     }
227 
228     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)229     protected EchoTestServiceFutureStub build(
230         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
231       return new EchoTestServiceFutureStub(channel, callOptions);
232     }
233 
234     /**
235      */
echo( io.istio.test.Echo.EchoRequest request)236     public com.google.common.util.concurrent.ListenableFuture<io.istio.test.Echo.EchoResponse> echo(
237         io.istio.test.Echo.EchoRequest request) {
238       return io.grpc.stub.ClientCalls.futureUnaryCall(
239           getChannel().newCall(getEchoMethod(), getCallOptions()), request);
240     }
241 
242     /**
243      */
forwardEcho( io.istio.test.Echo.ForwardEchoRequest request)244     public com.google.common.util.concurrent.ListenableFuture<io.istio.test.Echo.ForwardEchoResponse> forwardEcho(
245         io.istio.test.Echo.ForwardEchoRequest request) {
246       return io.grpc.stub.ClientCalls.futureUnaryCall(
247           getChannel().newCall(getForwardEchoMethod(), getCallOptions()), request);
248     }
249   }
250 
251   private static final int METHODID_ECHO = 0;
252   private static final int METHODID_FORWARD_ECHO = 1;
253 
254   private static final class MethodHandlers<Req, Resp> implements
255       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
256       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
257       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
258       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
259     private final AsyncService serviceImpl;
260     private final int methodId;
261 
MethodHandlers(AsyncService serviceImpl, int methodId)262     MethodHandlers(AsyncService serviceImpl, int methodId) {
263       this.serviceImpl = serviceImpl;
264       this.methodId = methodId;
265     }
266 
267     @java.lang.Override
268     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)269     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
270       switch (methodId) {
271         case METHODID_ECHO:
272           serviceImpl.echo((io.istio.test.Echo.EchoRequest) request,
273               (io.grpc.stub.StreamObserver<io.istio.test.Echo.EchoResponse>) responseObserver);
274           break;
275         case METHODID_FORWARD_ECHO:
276           serviceImpl.forwardEcho((io.istio.test.Echo.ForwardEchoRequest) request,
277               (io.grpc.stub.StreamObserver<io.istio.test.Echo.ForwardEchoResponse>) responseObserver);
278           break;
279         default:
280           throw new AssertionError();
281       }
282     }
283 
284     @java.lang.Override
285     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)286     public io.grpc.stub.StreamObserver<Req> invoke(
287         io.grpc.stub.StreamObserver<Resp> responseObserver) {
288       switch (methodId) {
289         default:
290           throw new AssertionError();
291       }
292     }
293   }
294 
bindService(AsyncService service)295   public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
296     return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
297         .addMethod(
298           getEchoMethod(),
299           io.grpc.stub.ServerCalls.asyncUnaryCall(
300             new MethodHandlers<
301               io.istio.test.Echo.EchoRequest,
302               io.istio.test.Echo.EchoResponse>(
303                 service, METHODID_ECHO)))
304         .addMethod(
305           getForwardEchoMethod(),
306           io.grpc.stub.ServerCalls.asyncUnaryCall(
307             new MethodHandlers<
308               io.istio.test.Echo.ForwardEchoRequest,
309               io.istio.test.Echo.ForwardEchoResponse>(
310                 service, METHODID_FORWARD_ECHO)))
311         .build();
312   }
313 
314   private static abstract class EchoTestServiceBaseDescriptorSupplier
315       implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
EchoTestServiceBaseDescriptorSupplier()316     EchoTestServiceBaseDescriptorSupplier() {}
317 
318     @java.lang.Override
getFileDescriptor()319     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
320       return io.istio.test.Echo.getDescriptor();
321     }
322 
323     @java.lang.Override
getServiceDescriptor()324     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
325       return getFileDescriptor().findServiceByName("EchoTestService");
326     }
327   }
328 
329   private static final class EchoTestServiceFileDescriptorSupplier
330       extends EchoTestServiceBaseDescriptorSupplier {
EchoTestServiceFileDescriptorSupplier()331     EchoTestServiceFileDescriptorSupplier() {}
332   }
333 
334   private static final class EchoTestServiceMethodDescriptorSupplier
335       extends EchoTestServiceBaseDescriptorSupplier
336       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
337     private final String methodName;
338 
EchoTestServiceMethodDescriptorSupplier(String methodName)339     EchoTestServiceMethodDescriptorSupplier(String methodName) {
340       this.methodName = methodName;
341     }
342 
343     @java.lang.Override
getMethodDescriptor()344     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
345       return getServiceDescriptor().findMethodByName(methodName);
346     }
347   }
348 
349   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
350 
getServiceDescriptor()351   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
352     io.grpc.ServiceDescriptor result = serviceDescriptor;
353     if (result == null) {
354       synchronized (EchoTestServiceGrpc.class) {
355         result = serviceDescriptor;
356         if (result == null) {
357           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
358               .setSchemaDescriptor(new EchoTestServiceFileDescriptorSupplier())
359               .addMethod(getEchoMethod())
360               .addMethod(getForwardEchoMethod())
361               .build();
362         }
363       }
364     }
365     return result;
366   }
367 }
368