Class ProtobufTranslationImpl
java.lang.Object
org.apache.calcite.avatica.remote.ProtobufTranslationImpl
- All Implemented Interfaces:
ProtobufTranslation
Implementation of
ProtobufTranslationImpl that translates
protobuf requests to POJO requests.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.calcite.avatica.remote.ProtobufTranslationImpl.RequestTranslatorgetParserForRequest(String className) Fetches the concrete message's Parser implementation.static org.apache.calcite.avatica.remote.ProtobufTranslationImpl.ResponseTranslatorgetParserForResponse(String className) Fetches the concrete message's Parser implementation.parseRequest(byte[] bytes) Parses a serialized protocol buffer request into aService.Request.parseResponse(byte[] bytes) Parses a serialized protocol buffer response into aService.Response.byte[]serializeRequest(Service.Request request) Serializes aService.Requestas a protocol buffer.byte[]serializeResponse(Service.Response response) Serializes aService.Responseas a protocol buffer.
-
Constructor Details
-
ProtobufTranslationImpl
public ProtobufTranslationImpl()
-
-
Method Details
-
getParserForRequest
public static org.apache.calcite.avatica.remote.ProtobufTranslationImpl.RequestTranslator getParserForRequest(String className) Fetches the concrete message's Parser implementation.- Parameters:
className- The protocol buffer class name- Returns:
- The Parser for the class
- Throws:
IllegalArgumentException- If the argument is null or if a Parser for the given class name is not found.
-
getParserForResponse
public static org.apache.calcite.avatica.remote.ProtobufTranslationImpl.ResponseTranslator getParserForResponse(String className) Fetches the concrete message's Parser implementation.- Parameters:
className- The protocol buffer class name- Returns:
- The Parser for the class
- Throws:
IllegalArgumentException- If the argument is null or if a Parser for the given class name is not found.
-
serializeResponse
Description copied from interface:ProtobufTranslationSerializes aService.Responseas a protocol buffer.- Specified by:
serializeResponsein interfaceProtobufTranslation- Parameters:
response- The response to serialize- Throws:
IOException- If there are errors during serialization
-
serializeRequest
Description copied from interface:ProtobufTranslationSerializes aService.Requestas a protocol buffer.- Specified by:
serializeRequestin interfaceProtobufTranslation- Parameters:
request- The request to serialize- Throws:
IOException- If there are errors during serialization
-
parseRequest
Description copied from interface:ProtobufTranslationParses a serialized protocol buffer request into aService.Request.- Specified by:
parseRequestin interfaceProtobufTranslation- Parameters:
bytes- Serialized protocol buffer request from client- Returns:
- A Request object for the given bytes
- Throws:
IOException- If the protocol buffer cannot be deserialized
-
parseResponse
Description copied from interface:ProtobufTranslationParses a serialized protocol buffer response into aService.Response.- Specified by:
parseResponsein interfaceProtobufTranslation- Parameters:
bytes- Serialized protocol buffer request from server- Returns:
- The Response object for the given bytes
- Throws:
IOException- If the protocol buffer cannot be deserialized
-