com.neeve.pkt
Class PktSubheaderSMA

java.lang.Object
  extended by com.neeve.util.UtlListElement
      extended by com.neeve.pkt.PktSerializable
          extended by com.neeve.pkt.PktBody
              extended by com.neeve.pkt.PktSubheader
                  extended by com.neeve.pkt.PktSubheaderVariable
                      extended by com.neeve.pkt.PktSubheaderSMA
All Implemented Interfaces:
com.neeve.io.IOElasticBuffer.Initializer, com.neeve.io.IOElasticBuffer.Sizer

public final class PktSubheaderSMA
extends PktSubheaderVariable

The SMA packet subheader.

This class is the subheader used by an SMA bus binding to tunnel control information.

This packet subheader header is a versioned entity. The subheader version defines the format of the subheader i.e. what fields comprise the subheader and their relative locations when serialized. A crucial aspect of subheader versioning is that a version N subheader will always be a subset of a version M subheader where N < M i.e. all fields in version N of a subheader will be present and in the same position as fields in version M of the subheader. i.e. a subheader never shrinks or moves fields around. With time, the subheader can only grow. See the setter/getter method documentation for information on which subheader version the fields that they affect belong to.

Threading:
Packet subheaders are not safe for concurrent access by multiple threads.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.neeve.pkt.PktSerializable
PktSerializable.DeserializeContext, PktSerializable.SerializeContext
 
Field Summary
 
Fields inherited from class com.neeve.pkt.PktSubheader
PREAMBLE_LENGTH, PREAMBLE_LENGTH_V1
 
Fields inherited from class com.neeve.util.UtlListElement
count, head, next, prev
 
Method Summary
static PktBody create()
          Creates a default SMA subheader
static PktBody create(Properties props)
          Creates an SMA subheader
 int doGetSerializedLength()
          Invoked to fetch the serialized length of the body
 short getChannelId()
          Get the channel id (V1 Subheader Field).
 String getChannelName()
          Get the channel name (V1 Subheader Field).
 XString getChannelNameAsRaw()
          Get the channel name (V1 Subheader Field).
static short getLatestSubheaderVersion()
          Get the latest subheader version.
 byte getMessageEncodingType()
          Get the message encoding type (V1 Subheader Field).
 short getMessageViewFactoryId()
          Get the message view factory id (V1 Subheader Field).
 short getMessageViewType()
          Get the message view type (V1 Subheader Field).
 int getSender()
          Get the message sender (V1 header Field).
 int getSerializedLength(ByteBuffer buffer, int offset)
          Get the serialized length from the serialized form
 long getSno()
          Get the message sequence number (V1 Subheader Field).
 short getSubheaderVersion()
          Get the header format version (V1 Subheader Field).
 void initialize()
          Invoked by constructor post initialization This method is invoked by the constructor post initialization of the base class.
 void initializeBuffer()
          Implementation of IOElasticBuffer.Initializer.initializeBuffer() The default implementation of this method is no-op.
static void prepare(PktPacket packet, byte encodingType, short vfid, short vtype, int sender, long sno, short chid, XString chname)
          Prepare a packet with an SMA subheader with latest version.
 void setChannelId(short chid)
          Set the channel id (V1 Subheader Field).
 void setChannelName(String chname)
          Set the channel name (V1 Subheader Field).
 void setChannelName(XString chname)
          Set the channel name (V1 Subheader Field).
 void setMessageEncodingType(byte type)
          Set the message encoding type (V1 Subheader Field).
 void setMessageViewFactoryId(short vfid)
          Set the message view factory id (V1 Subheader Field).
 void setMessageViewType(short type)
          Set the message view type (V1 Subheader Field).
 void setSender(int sender)
          Set the message sender (V1 header Field).
 void setSno(long sno)
          Set the message sequence number (V1 Subheader Field).
 String toString()
          Returns a string representation of the object
 
Methods inherited from class com.neeve.pkt.PktSubheader
getType
 
Methods inherited from class com.neeve.pkt.PktBody
deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, dump, getBuffer, getInitialBufferLength, getSerializedLength, getType, isNative, reset, serialize, serialize, serialize, serialize, serialize, serialize, serialize
 
Methods inherited from class com.neeve.pkt.PktSerializable
deserialize, getDeserializationPolicy, getSerializationPolicy, isValidDeserializationPolicy, isValidSerializationPolicy, serialize, setDeserializationPolicy, setSerializationPolicy
 
Methods inherited from class com.neeve.util.UtlListElement
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static PktBody create(Properties props)
Creates an SMA subheader

Parameters:
props - The property set to use to qualify creation of the body.

create

public static PktBody create()
Creates a default SMA subheader


prepare

public static void prepare(PktPacket packet,
                           byte encodingType,
                           short vfid,
                           short vtype,
                           int sender,
                           long sno,
                           short chid,
                           XString chname)
Prepare a packet with an SMA subheader with latest version.

Parameters:
packet - The packet to prepare.
encodingType - The message encoding type.
vfid - The message view factory id to set.
vtype - The message view type to set.
sender - The message sender.
sno - The message sequence number.
chid - The channel id to set
chname - The channel name to set (can be null)
Threading:
This method is not safe for concurrent access by multiple threads on the same request and reply.

initialize

public final void initialize()
Description copied from class: PktBody
Invoked by constructor post initialization

This method is invoked by the constructor post initialization of the base class. Its purpose is to notify the body implementation (subclass) to perform any initialization activities that depend on an initialized base class.

The default implementation is a no-op i.e. it does nothing.


doGetSerializedLength

public final int doGetSerializedLength()
Description copied from class: PktBody
Invoked to fetch the serialized length of the body


getSerializedLength

public final int getSerializedLength(ByteBuffer buffer,
                                     int offset)
Description copied from class: PktSubheader
Get the serialized length from the serialized form

Specified by:
getSerializedLength in class PktSubheader

getLatestSubheaderVersion

public static final short getLatestSubheaderVersion()
Get the latest subheader version.

This method returns the latest subheader version i.e. the version used when subheaders are created explicitly i.e. not through deserialization

Threading:
This method is safe for concurrent access by multiple threads

getSubheaderVersion

public final short getSubheaderVersion()
Get the header format version (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setMessageEncodingType

public final void setMessageEncodingType(byte type)
Set the message encoding type (V1 Subheader Field).

Parameters:
type - The message encoding type to set

getMessageEncodingType

public final byte getMessageEncodingType()
Get the message encoding type (V1 Subheader Field).


setMessageViewFactoryId

public final void setMessageViewFactoryId(short vfid)
Set the message view factory id (V1 Subheader Field).

Parameters:
vfid - The id to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getMessageViewFactoryId

public final short getMessageViewFactoryId()
Get the message view factory id (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setMessageViewType

public final void setMessageViewType(short type)
Set the message view type (V1 Subheader Field).

Parameters:
type - The type to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getMessageViewType

public final short getMessageViewType()
Get the message view type (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setSender

public final void setSender(int sender)
Set the message sender (V1 header Field).

Parameters:
sender - The sender to set.

getSender

public final int getSender()
Get the message sender (V1 header Field).


setSno

public final void setSno(long sno)
Set the message sequence number (V1 Subheader Field).

Parameters:
sno - The sequence number to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getSno

public final long getSno()
Get the message sequence number (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setChannelId

public final void setChannelId(short chid)
Set the channel id (V1 Subheader Field).

Parameters:
chid - The id to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getChannelId

public final short getChannelId()
Get the channel id (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setChannelName

public final void setChannelName(String chname)
Set the channel name (V1 Subheader Field).

Threading:
This method is safe for concurrent access by multiple threads

setChannelName

public final void setChannelName(XString chname)
Set the channel name (V1 Subheader Field).

Threading:
This method is safe for concurrent access by multiple threads

getChannelName

public final String getChannelName()
Get the channel name (V1 Subheader Field).

The channel name returned by this method can be null.

Threading:
This method is safe for concurrent access by multiple threads

getChannelNameAsRaw

public final XString getChannelNameAsRaw()
Get the channel name (V1 Subheader Field).

The channel name returned by this method will not be null, but if the channel name is not set the value of XString.isInitialized() will be false and XString.getValue() will return null

The caller must not modify the value of the XString that is returned, and it may not retain the XString beyond the pooling scope of this PktSubheaderSMA.

Threading:
This method is safe for concurrent access by multiple threads

initializeBuffer

public final void initializeBuffer()
Description copied from class: PktBody
Implementation of IOElasticBuffer.Initializer.initializeBuffer()

The default implementation of this method is no-op. The concrete body implementation should override and implement this method if it needs to do buffer initialization.

Specified by:
initializeBuffer in interface com.neeve.io.IOElasticBuffer.Initializer
Overrides:
initializeBuffer in class PktBody

toString

public final String toString()
Returns a string representation of the object

Overrides:
toString in class Object
Threading:
This method is safe for concurrent access by multiple threads


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.