Interface MessageSerializer<M>


public interface MessageSerializer<M>
Serializes data to and from Gremlin Server. Typically, the object being serialized or deserialized will be an item from an Iterator as returned from the ScriptEngine or an incoming RequestMessage. MessageSerializer instances are instantiated to a cache via ServiceLoader and indexed based on the mime types they support. If a mime type is supported more than once, the first MessageSerializer instance loaded for that mime type is assigned. If a mime type is not found the server default is chosen. The default may change from version to version so it is best to not rely on it when developing applications and to always be explicit in specifying the type you wish to bind to.
Author:
Stephen Mallette (http://stephen.genoprime.com)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.slf4j.Logger
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    configure(Map<String,Object> config, Map<String,Graph> graphs)
    Configure the serializer with mapper settings as required.
    org.apache.tinkerpop.gremlin.util.message.RequestMessage
    deserializeBinaryRequest(io.netty.buffer.ByteBuf msg)
    Deserialize a Netty ByteBuf into a RequestMessage.
    org.apache.tinkerpop.gremlin.util.message.ResponseMessage
    deserializeBinaryResponse(io.netty.buffer.ByteBuf msg)
    Deserialize a Netty ByteBuf into a RequestMessage.
    Gets the "mapper" that performs the underlying serialization work.
    The list of mime types that the serializer supports.
    org.apache.tinkerpop.gremlin.util.message.ResponseMessage
    readChunk(io.netty.buffer.ByteBuf byteBuf, boolean isFirstChunk)
     
    io.netty.buffer.ByteBuf
    serializeRequestAsBinary(org.apache.tinkerpop.gremlin.util.message.RequestMessage requestMessage, io.netty.buffer.ByteBufAllocator allocator)
    Serialize a ResponseMessage to a Netty ByteBuf.
    io.netty.buffer.ByteBuf
    serializeResponseAsBinary(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator)
    Serialize a ResponseMessage to a Netty ByteBuf.
    io.netty.buffer.ByteBuf
    writeChunk(Object aggregate, io.netty.buffer.ByteBufAllocator allocator)
     
    io.netty.buffer.ByteBuf
    writeErrorFooter(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator)
     
    io.netty.buffer.ByteBuf
    writeFooter(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator)
     
    io.netty.buffer.ByteBuf
    writeHeader(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator)
     
  • Field Details

    • logger

      static final org.slf4j.Logger logger
  • Method Details

    • getMapper

      M getMapper()
      Gets the "mapper" that performs the underlying serialization work.
    • serializeResponseAsBinary

      io.netty.buffer.ByteBuf serializeResponseAsBinary(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Serialize a ResponseMessage to a Netty ByteBuf.
      Parameters:
      responseMessage - The response message to serialize to bytes.
      allocator - The Netty allocator for the ByteBuf to return back.
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • serializeRequestAsBinary

      io.netty.buffer.ByteBuf serializeRequestAsBinary(org.apache.tinkerpop.gremlin.util.message.RequestMessage requestMessage, io.netty.buffer.ByteBufAllocator allocator) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Serialize a ResponseMessage to a Netty ByteBuf.
      Parameters:
      requestMessage - The request message to serialize to bytes.
      allocator - The Netty allocator for the ByteBuf to return back.
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • deserializeBinaryRequest

      org.apache.tinkerpop.gremlin.util.message.RequestMessage deserializeBinaryRequest(io.netty.buffer.ByteBuf msg) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Deserialize a Netty ByteBuf into a RequestMessage.
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • deserializeBinaryResponse

      org.apache.tinkerpop.gremlin.util.message.ResponseMessage deserializeBinaryResponse(io.netty.buffer.ByteBuf msg) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Deserialize a Netty ByteBuf into a RequestMessage.
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • mimeTypesSupported

      String[] mimeTypesSupported()
      The list of mime types that the serializer supports. They should be ordered in preferred ordered where the greatest fidelity match is first.
    • configure

      default void configure(Map<String,Object> config, Map<String,Graph> graphs)
      Configure the serializer with mapper settings as required. The default implementation does not perform any function and it is up to the interface implementation to determine how the configuration will be executed and what its requirements are. An implementation may choose to use the list of available graphs to help initialize a serializer. The implementation should account for the possibility of a null value being provided for that parameter.
    • writeHeader

      io.netty.buffer.ByteBuf writeHeader(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • writeChunk

      io.netty.buffer.ByteBuf writeChunk(Object aggregate, io.netty.buffer.ByteBufAllocator allocator) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • writeFooter

      io.netty.buffer.ByteBuf writeFooter(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • writeErrorFooter

      io.netty.buffer.ByteBuf writeErrorFooter(org.apache.tinkerpop.gremlin.util.message.ResponseMessage responseMessage, io.netty.buffer.ByteBufAllocator allocator) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException
    • readChunk

      org.apache.tinkerpop.gremlin.util.message.ResponseMessage readChunk(io.netty.buffer.ByteBuf byteBuf, boolean isFirstChunk) throws org.apache.tinkerpop.gremlin.util.ser.SerializationException
      Throws:
      org.apache.tinkerpop.gremlin.util.ser.SerializationException