Examples of RexProSerializer


Examples of com.tinkerpop.rexster.protocol.serializer.RexProSerializer

            logger.debug(String.format("Received message [version:%s][message type:%s][body length:%s][body:%s]",
                    messageVersion, messageType, bodyLength, sb.toString().trim()));
        }

        try {
            RexProSerializer serializer;
            if (serializerType == msgPackSerializer.getSerializerId()){
                serializer = msgPackSerializer;
            } else if (serializerType == jsonSerializer.getSerializerId()) {
                serializer = jsonSerializer;
            } else {
                throw new RexProException(String.format("unknown serializer type: %s", serializerType));
            }

            RexProMessage message = null;
            if (messageType == MessageType.SCRIPT_REQUEST) {
                message = serializer.deserialize(messageAsBytes, ScriptRequestMessage.class);
            } else if (messageType == MessageType.SESSION_REQUEST) {
                message = serializer.deserialize(messageAsBytes, SessionRequestMessage.class);
            } else if (messageType == MessageType.SESSION_RESPONSE) {
                message = serializer.deserialize(messageAsBytes, SessionResponseMessage.class);
            } else if (messageType == MessageType.ERROR) {
                message = serializer.deserialize(messageAsBytes, ErrorResponseMessage.class);
            } else if (messageType == MessageType.SCRIPT_RESPONSE) {
                message = serializer.deserialize(messageAsBytes, ScriptResponseMessage.class);
            }

            if (message == null) {
                logger.warn(String.format("Message did not match the specified type [%s]", messageType));
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.serializer.RexProSerializer

        RexProMessage msg = container.getMessage();

        byte[] rexProMessageAsBytes = new byte[0];

        try {
            RexProSerializer serializer;
            if (serializerType == msgPackSerializer.getSerializerId()){
                serializer = msgPackSerializer;
            } else if (serializerType == jsonSerializer.getSerializerId()) {
                serializer = jsonSerializer;
            } else {
                throw new RexProException(String.format("unknown serializer type: %s", serializerType));
            }

            if (msg instanceof SessionResponseMessage) {
                rexProMessageAsBytes = serializer.serialize((SessionResponseMessage) msg, SessionResponseMessage.class);
            } else if (msg instanceof ErrorResponseMessage) {
                rexProMessageAsBytes = serializer.serialize((ErrorResponseMessage) msg, ErrorResponseMessage.class);
            } else if (msg instanceof ScriptRequestMessage) {
                rexProMessageAsBytes = serializer.serialize((ScriptRequestMessage) msg, ScriptRequestMessage.class);
            } else if (msg instanceof SessionRequestMessage) {
                rexProMessageAsBytes = serializer.serialize((SessionRequestMessage) msg, SessionRequestMessage.class);
            } else if (msg instanceof ScriptResponseMessage) {
                rexProMessageAsBytes = serializer.serialize((ScriptResponseMessage) msg, ScriptResponseMessage.class);
            }

        } catch (Exception ex) {
            // if there's an error during serialization with msgpack this could tank.  the script will already
            // have executed and likely committed with success.  just means the response won't get back cleanly
View Full Code Here

Examples of com.tinkerpop.rexster.protocol.serializer.RexProSerializer

        serializeMessage();
    }

    private void serializeMessage() throws IOException {
        try {
            RexProSerializer serializer = getSerializer();
            if (responseMessage instanceof SessionResponseMessage) {
                responseBytes = serializer.serialize((SessionResponseMessage) responseMessage, SessionResponseMessage.class);
            } else if (responseMessage instanceof ErrorResponseMessage) {
                responseBytes = serializer.serialize((ErrorResponseMessage) responseMessage, ErrorResponseMessage.class);
            } else if (responseMessage instanceof ScriptResponseMessage) {
                responseBytes = serializer.serialize((ScriptResponseMessage) responseMessage, ScriptResponseMessage.class);
            } else {
                throw new Exception();
            }

        } catch (Exception ex) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.