public final class ChannelAccessAccessRightsMessage extends ChannelAccessMessage
CA_PROTO_ACCESS_RIGHTS
message. This message
is sent from a server to a client via TCP in order to communicate the access
rights for a specific channel. This information might be used by the client
to avoid operations that would be denied due to access control rules being in
effect.ChannelAccessCommand.CA_PROTO_ACCESS_RIGHTS
command, originalMessageHeader
Constructor and Description |
---|
ChannelAccessAccessRightsMessage(int cid,
boolean mayRead,
boolean mayWrite)
Constructor for creating a
CA_PROTO_ACCESS_RIGHTS message. |
Modifier and Type | Method and Description |
---|---|
protected static ChannelAccessAccessRightsMessage |
deserialize(ChannelAccessMessageHeader messageHeader,
ByteSource byteSource)
Constructs a message from a header and a byte source.
|
boolean |
equals(java.lang.Object obj)
Tells whether the specified object represents the same message.
|
int |
getChannelCID()
Returns the channel CID used by the client.
|
int |
hashCode()
Returns a hash code value for this message.
|
boolean |
isMayRead()
Returns a flag indicating whether the client is allowed to read from the
channel.
|
boolean |
isMayWrite()
Returns a flag indicating whether the client is allowed to write to the
channel.
|
protected void |
serialize(ByteSink byteSink,
ChannelAccessVersion version,
int maxPayloadSize,
java.nio.charset.Charset charset)
Serializes this message to a byte sink.
|
java.lang.String |
toString()
Returns a string representation of this message.
|
protected void |
verify(ChannelAccessVersion version,
int maxPayloadSize,
java.nio.charset.Charset charset)
Verifies that this message can be serialized.
|
addByteArrayToStringBuilder, calculatePaddingSize, getCommand, getOriginalMessageHeader, hasOriginalMessageHeader, serializeHeader, verifyHeader
public ChannelAccessAccessRightsMessage(int cid, boolean mayRead, boolean mayWrite)
CA_PROTO_ACCESS_RIGHTS
message.cid
- the channel CID. This is the identifier used by the client to
identify the channel.mayRead
- if true
the client is allowed to read from the
channel.mayWrite
- if true
the client is allowed to write to the
channel.public int getChannelCID()
public boolean isMayRead()
true
if the client may read from the channel,
false
otherwise.public boolean isMayWrite()
true
if the client may write to the channel,
false
otherwise.protected void serialize(ByteSink byteSink, ChannelAccessVersion version, int maxPayloadSize, java.nio.charset.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, java.nio.charset.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(java.lang.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 java.lang.String toString()
ChannelAccessMessage
toString
in class ChannelAccessMessage
protected static ChannelAccessAccessRightsMessage deserialize(ChannelAccessMessageHeader messageHeader, ByteSource byteSource)
ChannelAccessMessageCodec
.messageHeader
- CA message header.byteSource
- byte source for reading the message's payload (if any).java.nio.BufferUnderflowException
- if there is not enough data in the byte source to read the
complete message (including the payload).Copyright © 2014–2017 aquenos GmbH. All rights reserved.