public final class ChannelAccessWriteNotifyServerMessage extends ChannelAccessWriteNotifyMessage
CA_PROTO_WRITE_NOTIFY
message that is sent
from a server to a client. This message is sent in response to a
ChannelAccessWriteNotifyClientMessage
in order to notify the client
that the write operation has finished.ChannelAccessCommand.CA_PROTO_WRITE_NOTIFY
,
ChannelAccessWriteNotifyMessage
,
ChannelAccessWriteNotifyClientMessage
command, originalMessageHeader
Constructor and Description |
---|
ChannelAccessWriteNotifyServerMessage(ChannelAccessValueType dataType,
int count,
ChannelAccessStatus status,
int operationId)
Creates a
CA_PROTO_WRITE_NOTIFY message. |
Modifier and Type | Method and Description |
---|---|
protected static ChannelAccessWriteNotifyServerMessage |
deserialize(ChannelAccessMessageHeader messageHeader,
ByteSource byteSource)
Constructs a message from a header and a byte source.
|
boolean |
equals(Object obj)
Tells whether the specified object represents the same message.
|
int |
getCount()
Returns the number of value elements that were sent with the client's
write request.
|
ChannelAccessValueType |
getDataType()
Returns the data-type that was sent with the client's write request or
null if the data-type number could not be converted because
it is unknown to this implementation. |
int |
getOperationId()
Returns the client-assigned operation ID.
|
ChannelAccessStatus |
getStatus()
Returns the status of the write operation.
|
int |
hashCode()
Returns a hash code value for this message.
|
protected void |
serialize(ByteSink byteSink,
ChannelAccessVersion version,
int maxPayloadSize,
Charset charset)
Serializes this message to a byte sink.
|
String |
toString()
Returns a string representation of this message.
|
protected void |
verify(ChannelAccessVersion version,
int maxPayloadSize,
Charset charset)
Verifies that this message can be serialized.
|
addByteArrayToStringBuilder, calculatePaddingSize, getCommand, getOriginalMessageHeader, hasOriginalMessageHeader, serializeHeader, verifyHeader
public ChannelAccessWriteNotifyServerMessage(ChannelAccessValueType dataType, int count, ChannelAccessStatus status, int operationId)
CA_PROTO_WRITE_NOTIFY
message. This constructor
should be used to create a message that is supposed to be sent from a
server to a client.dataType
- data type sent with the client's write request (never
null
).count
- count sent with the client's request.status
- status code for the write operation (never null
).
If the write was successful, the
ECA_NORMAL
code should be sent. If an error occurred, the
respective error code should be sent.operationId
- client-assigned ID identifying the write request. This must be
the ID sent with the write request so that the client can
identify the request to which the reply belongs.public ChannelAccessValueType getDataType()
null
if the data-type number could not be converted because
it is unknown to this implementation.null
if
the numeric identifier cannot be mapped to a data type known by
this implementation.public int getCount()
public ChannelAccessStatus getStatus()
ChannelAccessStatus.StatusMessage.ECA_NORMAL
. If the write failed, the status should be the appropriate error code.ECA_NORMAL
for a successful write and the error code
for an error.public int getOperationId()
protected void serialize(ByteSink byteSink, ChannelAccessVersion version, int maxPayloadSize, Charset charset)
ChannelAccessMessage
ChannelAccessMessageCodec
.serialize
in class ChannelAccessMessage
byteSink
- byte sink that is used for writing the serialized data.version
- protocol version to stay compatible with. This is the protocol
version of the peer the message is sent to.maxPayloadSize
- maximum size of the payload.charset
- encoding to use for serializing the string data (e.g. channel
names, error strings, string data-values).protected void verify(ChannelAccessVersion version, int maxPayloadSize, Charset charset)
ChannelAccessMessage
ChannelAccessMessageCodec
.verify
in class ChannelAccessMessage
version
- protocol version to stay compatible with. This is the protocol
version of the peer the message is sent to.maxPayloadSize
- maximum size of the payload.charset
- encoding to use for serializing the string data (e.g. channel
names, error strings, string data-values).public boolean equals(Object obj)
ChannelAccessMessage
Tells whether the specified object represents the same message.
Two messages are considered equal if they are of the same type and have the same headers and payload. For comparing the types, the actual Java type and not just the Channel Access command is compared.
equals
in class ChannelAccessMessage
obj
- reference object with which this object is compared.true
if obj
is a message that is of the
same type and has the same headers and payload as this message.
false
if obj
is null
or of
a different type than this message or differs in the headers or
payload.public int hashCode()
ChannelAccessMessage
Returns a hash code value for this message. This method is supported for the benefit of hash tables. The hash code is calculated as a combination of the hash codes of this messages headers (including the Channel Access command) and its payload (if present).
If two messages are equal (as indicated by the return value of
ChannelAccessMessage.equals(Object)
), they also have the same hash code. However, the
fact that two messages have the same hash code does not imply that they
are equal.
hashCode
in class ChannelAccessMessage
public String toString()
ChannelAccessMessage
toString
in class ChannelAccessMessage
protected static ChannelAccessWriteNotifyServerMessage deserialize(ChannelAccessMessageHeader messageHeader, ByteSource byteSource)
ChannelAccessMessageCodec
.messageHeader
- CA message header.byteSource
- byte source for reading the message's payload (if any).headerOnly
is
false
).BufferUnderflowException
- if there is not enough data in the byte source to read the
complete payload.Copyright © 2014–2016 aquenos GmbH. All rights reserved.