Exemple #1
0
 public final com.google.protobuf.Message getResponsePrototype(
     com.google.protobuf.Descriptors.MethodDescriptor method) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.getResponsePrototype() given method " + "descriptor for wrong service type.");
   }
   switch (method.getIndex()) {
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }
 public final com.google.protobuf.Message getRequestPrototype(
     com.google.protobuf.Descriptors.MethodDescriptor method) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.getRequestPrototype() given method " + "descriptor for wrong service type.");
   }
   switch (method.getIndex()) {
     case 0:
       return socialite.proto.QueryProtos.QueryStr.getDefaultInstance();
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }
 public final com.google.protobuf.Message getResponsePrototype(
     com.google.protobuf.Descriptors.MethodDescriptor method) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.getResponsePrototype() given method " + "descriptor for wrong service type.");
   }
   switch (method.getIndex()) {
     case 0:
       return jp.go.nict.langrid.client.protobuf.proto.TranslationProtos.TranslateResponse
           .getDefaultInstance();
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }
Exemple #4
0
 public final void callMethod(
     com.google.protobuf.Descriptors.MethodDescriptor method,
     com.google.protobuf.RpcController controller,
     com.google.protobuf.Message request,
     com.google.protobuf.RpcCallback<com.google.protobuf.Message> done) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.callMethod() given method descriptor for wrong " + "service type.");
   }
   switch (method.getIndex()) {
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }
 @NotNull
 public HttpUriRequest createRequest(
     @NotNull Descriptors.MethodDescriptor method, @NotNull Message request)
     throws IOException, URISyntaxException {
   final HttpPost post =
       new HttpPost(
           baseUri.resolve(
               method.getService().getName().toLowerCase()
                   + "/"
                   + method.getName().toLowerCase()
                   + format.getSuffix()));
   post.setHeader(HttpHeaders.CONTENT_TYPE, format.getMimeType());
   post.setHeader(HttpHeaders.CONTENT_ENCODING, StandardCharsets.UTF_8.name());
   final ByteArrayOutputStream stream = new ByteArrayOutputStream();
   format.write(request, stream, StandardCharsets.UTF_8);
   post.setEntity(new ByteArrayEntity(stream.toByteArray()));
   return post;
 }
 public final com.google.protobuf.Message getResponsePrototype(
     com.google.protobuf.Descriptors.MethodDescriptor method) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.getResponsePrototype() given method " + "descriptor for wrong service type.");
   }
   switch (method.getIndex()) {
     case 0:
       return org.apache.wasp.ipc.protobuf.generated.TestProtos.EmptyResponseProto
           .getDefaultInstance();
     case 1:
       return org.apache.wasp.ipc.protobuf.generated.TestProtos.EchoResponseProto
           .getDefaultInstance();
     case 2:
       return org.apache.wasp.ipc.protobuf.generated.TestProtos.EmptyResponseProto
           .getDefaultInstance();
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }
 public final void callMethod(
     com.google.protobuf.Descriptors.MethodDescriptor method,
     com.google.protobuf.RpcController controller,
     com.google.protobuf.Message request,
     com.google.protobuf.RpcCallback<com.google.protobuf.Message> done) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.callMethod() given method descriptor for wrong " + "service type.");
   }
   switch (method.getIndex()) {
     case 0:
       this.run(
           controller,
           (socialite.proto.QueryProtos.QueryStr) request,
           com.google.protobuf.RpcUtil.<socialite.proto.QueryProtos.Nothing>specializeCallback(
               done));
       return;
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }
 public final void callMethod(
     com.google.protobuf.Descriptors.MethodDescriptor method,
     com.google.protobuf.RpcController controller,
     com.google.protobuf.Message request,
     com.google.protobuf.RpcCallback<com.google.protobuf.Message> done) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.callMethod() given method descriptor for wrong " + "service type.");
   }
   switch (method.getIndex()) {
     case 0:
       this.translate(
           controller,
           (jp.go.nict.langrid.client.protobuf.proto.TranslationProtos.TranslateRequest) request,
           com.google.protobuf.RpcUtil
               .<jp.go.nict.langrid.client.protobuf.proto.TranslationProtos.TranslateResponse>
                   specializeCallback(done));
       return;
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }
 @Override
 public void callMethod(
     @NotNull Descriptors.MethodDescriptor method,
     @NotNull RpcController controller,
     @NotNull Message request,
     @NotNull RpcCallback<Message> done) {
   try {
     done.run(service.callBlockingMethod(method, controller, request));
   } catch (ServiceException e) {
     log.error("Blocking method error " + method.getFullName(), e);
     done.run(null);
   }
 }
 public final void callMethod(
     com.google.protobuf.Descriptors.MethodDescriptor method,
     com.google.protobuf.RpcController controller,
     com.google.protobuf.Message request,
     com.google.protobuf.RpcCallback<com.google.protobuf.Message> done) {
   if (method.getService() != getDescriptor()) {
     throw new java.lang.IllegalArgumentException(
         "Service.callMethod() given method descriptor for wrong " + "service type.");
   }
   switch (method.getIndex()) {
     case 0:
       this.ping(
           controller,
           (org.apache.wasp.ipc.protobuf.generated.TestProtos.EmptyRequestProto) request,
           com.google.protobuf.RpcUtil
               .<org.apache.wasp.ipc.protobuf.generated.TestProtos.EmptyResponseProto>
                   specializeCallback(done));
       return;
     case 1:
       this.echo(
           controller,
           (org.apache.wasp.ipc.protobuf.generated.TestProtos.EchoRequestProto) request,
           com.google.protobuf.RpcUtil
               .<org.apache.wasp.ipc.protobuf.generated.TestProtos.EchoResponseProto>
                   specializeCallback(done));
       return;
     case 2:
       this.error(
           controller,
           (org.apache.wasp.ipc.protobuf.generated.TestProtos.EmptyRequestProto) request,
           com.google.protobuf.RpcUtil
               .<org.apache.wasp.ipc.protobuf.generated.TestProtos.EmptyResponseProto>
                   specializeCallback(done));
       return;
     default:
       throw new java.lang.AssertionError("Can't get here.");
   }
 }