Package kr.ac.konkuk.ccslab.cm.event
Class CMUserEvent
java.lang.Object
kr.ac.konkuk.ccslab.cm.entity.CMObject
kr.ac.konkuk.ccslab.cm.event.CMEvent
kr.ac.konkuk.ccslab.cm.event.CMUserEvent
The CMUserEvent is a user-defined event that can consist of different types of
arbitrary fields.
-
Field Summary
Fields inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
m_bytes, m_nByteNum, m_nID, m_strDistributionGroup, m_strDistributionSession, m_strHandlerGroup, m_strHandlerSession, m_strReceiver, m_strSender
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindEventField
(int nDataType, String strFieldName) Searches for the event field.Returns a list of all event fields.protected int
byte[]
getEventBytesField
(String strFieldName) Returns the byte array of the given field.getEventField
(int nDataType, String strFieldName) Returns the field value in this event.Returns the string ID of this event.protected void
void
Removes all fields of this event.void
removeEventField
(int nDataType, String strFieldName) Removes an event field from this event.void
setEventBytesField
(String strFieldName, int nByteNum, byte[] bytes) Sets and adds bytes data as a new field to this event.void
setEventField
(int nDataType, String strFieldName, String strFieldValue) Sets and adds a new event field to this event.void
setStringID
(String strID) Sets a string ID of this event.protected void
unmarshallBody
(ByteBuffer msg) Methods inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
allocate, equals, getDistributionGroup, getDistributionSession, getHandlerGroup, getHandlerSession, getID, getInt2BytesFromByteBuffer, getReceiver, getSender, getStringFromByteBuffer, marshall, marshallHeader, putInt2BytesToByteBuffer, putStringToByteBuffer, setByteNum, setDistributionGroup, setDistributionSession, setHandlerGroup, setHandlerSession, setID, setReceiver, setSender, toString, unmarshall, unmarshallHeader
-
Constructor Details
-
CMUserEvent
public CMUserEvent()Creates an instance of the CMUserEvent. -
CMUserEvent
-
-
Method Details
-
getAllEventFields
Returns a list of all event fields.- Returns:
- the list of event fields.
-
setStringID
Sets a string ID of this event.- Parameters:
strID
- - the string ID.
-
getStringID
Returns the string ID of this event.- Returns:
- - the string ID.
The initial value is "defaultID".
-
setEventField
Sets and adds a new event field to this event.- Parameters:
nDataType
- - the data type of the field.The following 5 types are possible:
CMInfo.CM_INT : int type
CMInfo.CM_LONG : long type
CMInfo.CM_FLOAT : float type
CMInfo.CM_DOUBLE : double type
CMInfo.CM_STR : StringstrFieldName
- - the field name.strFieldValue
- - the field value.
-
setEventBytesField
Sets and adds bytes data as a new field to this event.- Parameters:
strFieldName
- - the field name.nByteNum
- - the number of bytes.bytes
- - the byte array.
-
getEventField
Returns the field value in this event.- Parameters:
nDataType
- - the field type.The field type is one of followings:
CMInfo.CM_INT : int type
CMInfo.CM_LONG : long type
CMInfo.CM_FLOAT : float type
CMInfo.CM_DOUBLE : double type
CMInfo.CM_STR : StringstrFieldName
- - the field name.- Returns:
- - the field value if the field is found; null otherwise.
-
getEventBytesField
Returns the byte array of the given field.- Parameters:
strFieldName
- - the field name- Returns:
- - the byte array if the field is found; null otherwise.
-
findEventField
Searches for the event field.- Parameters:
nDataType
- - the field type.The field type is one of followings:
CMInfo.CM_INT : int type
CMInfo.CM_LONG : long type
CMInfo.CM_FLOAT : float type
CMInfo.CM_DOUBLE : double type
CMInfo.CM_STR : StringstrFieldName
- - the field name.- Returns:
- the event field if found; null otherwise.
-
removeEventField
Removes an event field from this event.- Parameters:
nDataType
- - the field type.The field type is one of followings:
CMInfo.CM_INT : int type
CMInfo.CM_LONG : long type
CMInfo.CM_FLOAT : float type
CMInfo.CM_DOUBLE : double type
CMInfo.CM_STR : StringstrFieldName
- - field name.
-
removeAllEventFields
public void removeAllEventFields()Removes all fields of this event. -
getByteNum
protected int getByteNum()- Overrides:
getByteNum
in classCMEvent
-
marshallBody
protected void marshallBody()- Specified by:
marshallBody
in classCMEvent
-
unmarshallBody
- Specified by:
unmarshallBody
in classCMEvent
-