java.lang.Object
pt.unl.fct.di.novasys.babel.generic.ProtoIPC
pt.unl.fct.di.novasys.babel.generic.ProtoReply
pt.unl.fct.di.novasys.babel.protocols.storage.replies.common.CommonReply
Direct Known Subclasses:
CommonExecuteReply, CreateCollectionReply, CreateKeySpaceReply, ModifyCollectionReply, ModifyKeySpaceReply

public abstract class CommonReply extends pt.unl.fct.di.novasys.babel.generic.ProtoReply
An abstract class common to all replies issued by the storage layer. This class stores the status of the operation (i.e., OK, ERROR, CONFLICT, etc.), as well as an optional message explaining the reply status.
  • Nested Class Summary

    Nested classes/interfaces inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoIPC

    pt.unl.fct.di.novasys.babel.generic.ProtoIPC.Type
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CommonReply(CommonOperationStatus status, short protoID)
    Constructs a CommonReply with a given status and protocol identifier.
    CommonReply(CommonOperationStatus status, String message, short protoID)
    Constructs a CommonReply with a given status, protocol identifier and a message explaining the reply status.
    CommonReply(CommonOperationStatus status, String message, String reqID, short protoID)
    Constructs a CommonReply with a given status, protocol identifier and a message explaining the reply status.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets an optional message detailing the reply status.
    Gets the requestID associated with the reply.
    Gets the reply status (e.g., OK, ERROR, NOT_SUPPORTED, etc.)
    boolean
    Checks if there is a requestID associated with the reply.

    Methods inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoReply

    getId

    Methods inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoIPC

    getType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • CommonReply

      public CommonReply(CommonOperationStatus status, short protoID)
      Constructs a CommonReply with a given status and protocol identifier.
      Parameters:
      status - status of the reply
      protoID - the protocol identifier
    • CommonReply

      public CommonReply(CommonOperationStatus status, String message, short protoID)
      Constructs a CommonReply with a given status, protocol identifier and a message explaining the reply status.
      Parameters:
      status - status of the reply
      message - message explaining the reply status
      protoID - the protocol identifier
    • CommonReply

      public CommonReply(CommonOperationStatus status, String message, String reqID, short protoID)
      Constructs a CommonReply with a given status, protocol identifier and a message explaining the reply status. Additionally, the reply also stores the request identifier associated with the reply.
      Parameters:
      status - status of the reply
      message - message explaining the reply status
      reqID - the request identifier associated with the reply. This can used to associate a specific request with its reply.
      protoID - the protocol identifier
  • Method Details

    • getStatus

      public CommonOperationStatus getStatus()
      Gets the reply status (e.g., OK, ERROR, NOT_SUPPORTED, etc.)
      Returns:
      the reply status.
    • getMessage

      public String getMessage()
      Gets an optional message detailing the reply status. If no message was passed in the constructor, a null is returned.
      Returns:
      the message if one is available or null otherwise.
    • getReqID

      public String getReqID()
      Gets the requestID associated with the reply. If no requestID was passed in the constructor, this method will return an empty string.
      Returns:
      the requestID, or an empty string if none was passed in the constructor.
    • hasReqID

      public boolean hasReqID()
      Checks if there is a requestID associated with the reply.
      Returns:
      true if it there is a requestID associated with the reply, or false otherwise.