Class CommonReply
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 -
Constructor Summary
ConstructorsConstructorDescriptionCommonReply(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
Methods inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoReply
getIdMethods inherited from class pt.unl.fct.di.novasys.babel.generic.ProtoIPC
getType
-
Field Details
-
EMPTY_MSG
- See Also:
-
-
Constructor Details
-
CommonReply
Constructs a CommonReply with a given status and protocol identifier.- Parameters:
status- status of the replyprotoID- the protocol identifier
-
CommonReply
Constructs a CommonReply with a given status, protocol identifier and a message explaining the reply status.- Parameters:
status- status of the replymessage- message explaining the reply statusprotoID- the protocol identifier
-
CommonReply
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 replymessage- message explaining the reply statusreqID- 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
Gets the reply status (e.g., OK, ERROR, NOT_SUPPORTED, etc.)- Returns:
- the reply status.
-
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
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.
-