Search in sources :

Example 1 with ProtoMapper

use of org.apache.servicecomb.foundation.protobuf.ProtoMapper in project java-chassis by ServiceComb.

the class OperationProtobuf method initRequestCodec.

private void initRequestCodec(ScopedProtobufSchemaManager scopedProtobufSchemaManager, Invocation invocation) {
    ProtoMapper mapper = scopedProtobufSchemaManager.getOrCreateProtoMapper(invocation.getSchemaMeta());
    Message requestMessage = mapper.getRequestMessage(invocation.getOperationMeta().getOperationId());
    if (!invocation.isConsumer()) {
        initProducerRequestCodec(invocation, requestMessage, mapper);
    } else {
        initConsumerRequestCodec(invocation, requestMessage, mapper);
    }
}
Also used : Message(io.protostuff.compiler.model.Message) ProtoMapper(org.apache.servicecomb.foundation.protobuf.ProtoMapper)

Example 2 with ProtoMapper

use of org.apache.servicecomb.foundation.protobuf.ProtoMapper in project incubator-servicecomb-java-chassis by apache.

the class OperationProtobuf method initRequestCodec.

private void initRequestCodec(ScopedProtobufSchemaManager scopedProtobufSchemaManager, Invocation invocation) {
    ProtoMapper mapper = scopedProtobufSchemaManager.getOrCreateProtoMapper(invocation.getSchemaMeta());
    Message requestMessage = mapper.getRequestMessage(invocation.getOperationMeta().getOperationId());
    if (!invocation.isConsumer()) {
        initProducerRequestCodec(invocation, requestMessage, mapper);
    } else {
        initConsumerRequestCodec(invocation, requestMessage, mapper);
    }
}
Also used : Message(io.protostuff.compiler.model.Message) ProtoMapper(org.apache.servicecomb.foundation.protobuf.ProtoMapper)

Example 3 with ProtoMapper

use of org.apache.servicecomb.foundation.protobuf.ProtoMapper in project java-chassis by ServiceComb.

the class OperationProtobuf method initResponseCodec.

private void initResponseCodec(ScopedProtobufSchemaManager scopedProtobufSchemaManager, Invocation invocation) {
    ProtoMapper mapper = scopedProtobufSchemaManager.getOrCreateProtoMapper(invocation.getSchemaMeta());
    Message responseMessage = mapper.getResponseMessage(invocation.getOperationMeta().getOperationId());
    JavaType responseType = invocation.findResponseType(Status.OK.getStatusCode());
    if (!invocation.isConsumer()) {
        initProviderResponseCode(responseMessage, mapper, responseType);
    } else {
        initConsumerResponseCode(responseMessage, mapper, responseType);
    }
    anyResponseRootSerializer = new ResponseRootSerializer(mapper.createRootSerializer(ProtoConst.ANY, Object.class), false, true);
    anyResponseRootDeserializer = new ResponseRootDeserializer<>(mapper.createRootDeserializer(ProtoConst.ANY, Object.class), false);
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType) Message(io.protostuff.compiler.model.Message) ProtoMapper(org.apache.servicecomb.foundation.protobuf.ProtoMapper)

Example 4 with ProtoMapper

use of org.apache.servicecomb.foundation.protobuf.ProtoMapper in project incubator-servicecomb-java-chassis by apache.

the class OperationProtobuf method initResponseCodec.

private void initResponseCodec(ScopedProtobufSchemaManager scopedProtobufSchemaManager, Invocation invocation) {
    ProtoMapper mapper = scopedProtobufSchemaManager.getOrCreateProtoMapper(invocation.getSchemaMeta());
    Message responseMessage = mapper.getResponseMessage(invocation.getOperationMeta().getOperationId());
    JavaType responseType = invocation.findResponseType(Status.OK.getStatusCode());
    if (!invocation.isConsumer()) {
        initProviderResponseCode(responseMessage, mapper, responseType);
    } else {
        initConsumerResponseCode(responseMessage, mapper, responseType);
    }
    anyResponseRootSerializer = new ResponseRootSerializer(mapper.createRootSerializer(ProtoConst.ANY, Object.class), false, true);
    anyResponseRootDeserializer = new ResponseRootDeserializer<>(mapper.createRootDeserializer(ProtoConst.ANY, Object.class), false);
}
Also used : JavaType(com.fasterxml.jackson.databind.JavaType) Message(io.protostuff.compiler.model.Message) ProtoMapper(org.apache.servicecomb.foundation.protobuf.ProtoMapper)

Aggregations

Message (io.protostuff.compiler.model.Message)4 ProtoMapper (org.apache.servicecomb.foundation.protobuf.ProtoMapper)4 JavaType (com.fasterxml.jackson.databind.JavaType)2