Class RoutableFactories60.DocumentMessageFactory

java.lang.Object
com.yahoo.documentapi.messagebus.protocol.AbstractRoutableFactory
com.yahoo.documentapi.messagebus.protocol.RoutableFactories60.DocumentMessageFactory
All Implemented Interfaces:
RoutableFactory
Direct Known Subclasses:
RoutableFactories60.CreateVisitorMessageFactory, RoutableFactories60.DestroyVisitorMessageFactory, RoutableFactories60.DocumentListMessageFactory, RoutableFactories60.DocumentSummaryMessageFactory, RoutableFactories60.EmptyBucketsMessageFactory, RoutableFactories60.GetBucketListMessageFactory, RoutableFactories60.GetBucketStateMessageFactory, RoutableFactories60.GetDocumentMessageFactory, RoutableFactories60.MapVisitorMessageFactory, RoutableFactories60.PutDocumentMessageFactory, RoutableFactories60.QueryResultMessageFactory, RoutableFactories60.RemoveDocumentMessageFactory, RoutableFactories60.RemoveLocationMessageFactory, RoutableFactories60.SearchResultMessageFactory, RoutableFactories60.StatBucketMessageFactory, RoutableFactories60.UpdateDocumentMessageFactory, RoutableFactories60.VisitorInfoMessageFactory
Enclosing class:
RoutableFactories60

public abstract static class RoutableFactories60.DocumentMessageFactory extends AbstractRoutableFactory
Implements the shared factory logic required for DocumentMessage objects, and it offers a more convenient interface for implementing RoutableFactory.
Author:
Simon Thoresen Hult
  • Constructor Details

    • DocumentMessageFactory

      public DocumentMessageFactory()
  • Method Details

    • doEncode

      protected abstract boolean doEncode(DocumentMessage msg, com.yahoo.document.serialization.DocumentSerializer serializer)
      This method encodes the given message using the given serializer. You are guaranteed to only receive messages of the type that this factory was registered for.

      This method is NOT exception safe. Return false to signal failure.

      Parameters:
      msg - The message to encode.
      serializer - The serializer to use for encoding.
      Returns:
      True if the message was encoded.
    • doDecode

      protected abstract DocumentMessage doDecode(com.yahoo.document.serialization.DocumentDeserializer deserializer)
      This method decodes a message from the given deserializer. You are guaranteed to only receive byte buffers generated by a previous call to doEncode(DocumentMessage, DocumentSerializer).

      This method is NOT exception safe. Return null to signal failure.

      Parameters:
      deserializer - The deserializer to use for decoding.
      Returns:
      The decoded message.
    • encode

      public boolean encode(com.yahoo.messagebus.Routable obj, com.yahoo.document.serialization.DocumentSerializer out)
      Description copied from interface: RoutableFactory

      This method encodes the content of the given routable into a byte buffer that can later be decoded using the RoutableFactory.decode(DocumentDeserializer) method.

      Return false to signal failure.

      This method is NOT exception safe.

      Parameters:
      obj - The routable to encode.
      out - The buffer to write into.
      Returns:
      True if the routable could be encoded.
    • decode

      public com.yahoo.messagebus.Routable decode(com.yahoo.document.serialization.DocumentDeserializer in, LoadTypeSet loadTypes)
      Description copied from interface: RoutableFactory

      This method decodes the given byte bufer to a routable.

      Return false to signal failure.

      This method is NOT exception safe.

      Parameters:
      in - The buffer to read from.
      loadTypes - The LoadTypeSet to inject into the Routable.
      Returns:
      The decoded routable.