Tabnine Logo
ProtobufTranslation
Code IndexAdd Tabnine to your IDE (free)

How to use
ProtobufTranslation
in
org.apache.calcite.avatica.remote

Best Java code snippets using org.apache.calcite.avatica.remote.ProtobufTranslation (Showing top 20 results out of 315)

origin: org.apache.calcite.avatica/avatica-core

 @Override public Response _apply(Request request) {
  try {
   // Serialize the request to "send to the server"
   byte[] serializedRequest = translation.serializeRequest(request);

   // *some transport would normally happen here*

   // Fake deserializing that request somewhere else
   Request request2 = translation.parseRequest(serializedRequest);

   // Serialize the response from the service to "send to the client"
   byte[] serializedResponse = translation.serializeResponse(request2.accept(service));

   // *some transport would normally happen here*

   // Deserialize the response on "the client"
   return translation.parseResponse(serializedResponse);
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
}
origin: org.apache.calcite.avatica/avatica-core

 public Response apply(Response response) throws IOException {
  // Serialize and then re-pare the response
  return translation.parseResponse(translation.serializeResponse(response));
 }
}
origin: org.apache.calcite.avatica/avatica-core

 public Request apply(Request request) throws IOException {
  // Serialize and then re-parse the request
  return translation.parseRequest(translation.serializeRequest(request));
 }
}
origin: org.apache.calcite/calcite-avatica

 @Override public Response _apply(Request request) {
  final Response resp;
  try {
   byte[] response = client.send(translation.serializeRequest(request));
   resp = translation.parseResponse(response);
  } catch (IOException e) {
   // Not a protobuf that we could parse.
   throw new RuntimeException(e);
  }

  // The server had an error, throw an Exception for that.
  if (resp instanceof ErrorResponse) {
   throw ((ErrorResponse) resp).toException();
  }

  return resp;
 }
}
origin: org.apache.calcite/calcite-avatica

FetchResponse response = new FetchResponse(frame, false, false, metadata);
when(translation.parseRequest(serializedRequest)).thenReturn(request);
when(service.apply(request)).thenReturn(response);
when(translation.serializeResponse(response))
  .thenReturn(response.serialize().toByteArray());
origin: org.apache.calcite/calcite-avatica

@Override Service.Request decode(byte[] serializedRequest) throws IOException {
 return translation.parseRequest(serializedRequest);
}
origin: org.apache.calcite/calcite-avatica

 @Override byte[] encode(Response response) throws IOException {
  return translation.serializeResponse(response);
 }
}
origin: org.apache.calcite.avatica/avatica-core

 @Override public Response _apply(Request request) {
  final Response resp;
  byte[] response = null;
  try {
   response = client.send(translation.serializeRequest(request));
  } catch (IOException e) {
   LOG.debug("Failed to execute remote request: {}", request);
   // Failed to get a response from the server for the request.
   throw new RuntimeException(e);
  }

  try {
   resp = translation.parseResponse(response);
  } catch (IOException e) {
   LOG.debug("Failed to deserialize reponse to {}. '{}'", request,
     new String(response, StandardCharsets.UTF_8));
   // Not a protobuf that we could parse.
   throw new RuntimeException(e);
  }

  // The server had an error, throw an Exception for that.
  if (resp instanceof ErrorResponse) {
   throw ((ErrorResponse) resp).toException();
  }

  return resp;
 }
}
origin: org.apache.calcite/calcite-avatica

 public Response apply(Response response) throws IOException {
  // Serialize and then re-pare the response
  return translation.parseResponse(translation.serializeResponse(response));
 }
}
origin: org.apache.calcite/calcite-avatica

 public Request apply(Request request) throws IOException {
  // Serialize and then re-parse the request
  return translation.parseRequest(translation.serializeRequest(request));
 }
}
origin: org.apache.calcite.avatica/avatica-core

FetchResponse response = new FetchResponse(frame, false, false, metadata);
when(translation.parseRequest(serializedRequest)).thenReturn(request);
when(service.apply(request)).thenReturn(response);
when(translation.serializeResponse(response))
  .thenReturn(response.serialize().toByteArray());
origin: org.apache.calcite.avatica/avatica-core

@Override Service.Request decode(byte[] serializedRequest) throws IOException {
 try (final Context ctx = serializationTimer.start()) {
  return translation.parseRequest(serializedRequest);
 }
}
origin: org.apache.calcite.avatica/avatica-core

 @Override byte[] encode(Response response) throws IOException {
  try (final Context ctx = serializationTimer.start()) {
   return translation.serializeResponse(response);
  }
 }
}
origin: apache/calcite-avatica

 @Override public Response _apply(Request request) {
  try {
   // Serialize the request to "send to the server"
   byte[] serializedRequest = translation.serializeRequest(request);

   // *some transport would normally happen here*

   // Fake deserializing that request somewhere else
   Request request2 = translation.parseRequest(serializedRequest);

   // Serialize the response from the service to "send to the client"
   byte[] serializedResponse = translation.serializeResponse(request2.accept(service));

   // *some transport would normally happen here*

   // Deserialize the response on "the client"
   return translation.parseResponse(serializedResponse);
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
}
origin: apache/calcite-avatica

 @Override public Response _apply(Request request) {
  final Response resp;
  byte[] response = null;
  try {
   response = client.send(translation.serializeRequest(request));
  } catch (IOException e) {
   LOG.debug("Failed to execute remote request: {}", request);
   // Failed to get a response from the server for the request.
   throw new RuntimeException(e);
  }

  try {
   resp = translation.parseResponse(response);
  } catch (IOException e) {
   LOG.debug("Failed to deserialize reponse to {}. '{}'", request,
     new String(response, StandardCharsets.UTF_8));
   // Not a protobuf that we could parse.
   throw new RuntimeException(e);
  }

  // The server had an error, throw an Exception for that.
  if (resp instanceof ErrorResponse) {
   throw ((ErrorResponse) resp).toException();
  }

  return resp;
 }
}
origin: apache/calcite-avatica

 public Response apply(Response response) throws IOException {
  // Serialize and then re-pare the response
  return translation.parseResponse(translation.serializeResponse(response));
 }
}
origin: apache/calcite-avatica

 public Request apply(Request request) throws IOException {
  // Serialize and then re-parse the request
  return translation.parseRequest(translation.serializeRequest(request));
 }
}
origin: apache/calcite-avatica

FetchResponse response = new FetchResponse(frame, false, false, metadata);
when(translation.parseRequest(serializedRequest)).thenReturn(request);
when(service.apply(request)).thenReturn(response);
when(translation.serializeResponse(response))
  .thenReturn(response.serialize().toByteArray());
origin: apache/calcite-avatica

@Override Service.Request decode(byte[] serializedRequest) throws IOException {
 try (final Context ctx = serializationTimer.start()) {
  return translation.parseRequest(serializedRequest);
 }
}
origin: apache/calcite-avatica

 @Override byte[] encode(Response response) throws IOException {
  try (final Context ctx = serializationTimer.start()) {
   return translation.serializeResponse(response);
  }
 }
}
org.apache.calcite.avatica.remoteProtobufTranslation

Javadoc

Generic interface to support parsing of serialized protocol buffers between client and server.

Most used methods

  • parseResponse
    Parses a serialized protocol buffer response into a Response.
  • serializeRequest
    Serializes a Request as a protocol buffer.
  • parseRequest
    Parses a serialized protocol buffer request into a Request.
  • serializeResponse
    Serializes a Response as a protocol buffer.

Popular in Java

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setContentView (Activity)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JPanel (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now