org.jlab.coda.cMsg
Class cMsgMessageFull

java.lang.Object
  extended by org.jlab.coda.cMsg.cMsgMessage
      extended by org.jlab.coda.cMsg.cMsgMessageFull
All Implemented Interfaces:
java.lang.Cloneable

public class cMsgMessageFull
extends cMsgMessage

This class contains the full functionality of a message. It extends the class that users have access to by defining setters and getters that the user has no need of. This class is for use only by packages that are part of the cMsg implementation. This whole class is really a private form of the cMsgMessage class.


Field Summary
 
Fields inherited from class org.jlab.coda.cMsg.cMsgMessage
allFields, expandedPayload, hasPayload, isBigEndian, isGetRequest, isGetResponse, isNullGetResponse, payloadFieldsOnly, systemFieldsOnly, wasSent
 
Constructor Summary
cMsgMessageFull()
          Constructor.
cMsgMessageFull(cMsgMessage m)
          Constructor using existing cMsgMessage type of message.
cMsgMessageFull(java.io.File file)
          Constructor reading file generated by writing cMsgMessage.toString() output.
cMsgMessageFull(java.lang.String XML)
          Constructor using XML string generated by cMsgMessage.toString().
 
Method Summary
 java.lang.Object clone()
          Clone this object.
 cMsgMessageFull copy()
          Creates a complete copy of this message.
 boolean expandedPayload()
          Does this message have a payload that consists of objects in a hashmap (ie.
 void expandedPayload(boolean ep)
          Set the "expanded-payload" bit of a message.
 void expandPayload()
          If this message is unexpanded (has a non-null payloadText field but no items in its payload hashmap), then expand the payload text into a hashmap containing all cMsgPayloadItems.
 int getReceiverSubscribeId()
          Get receiverSubscribe id number.
 void makeNullResponse(cMsgMessageFull msg)
          Converts existing message to null response of supplied message.
 void makeResponse(cMsgMessageFull msg)
          Converts existing message to response of supplied message.
 cMsgMessageFull nullResponse()
          Creates a proper response message to this message which was sent by a client calling sendAndGet.
 cMsgMessageFull response()
          Creates a proper response message to this message which was sent by a client calling sendAndGet.
 void setContext(cMsgMessageContextInterface context)
          Sets the object containing information about the context of the callback receiving this message.
 void setDomain(java.lang.String domain)
          Set domain this message exists in.
 int setFieldsFromText(java.lang.String text, int flag)
          This method makes the protected method cMsgMessage.setFieldsFromText(java.lang.String, int) available to other cMsg system classes.
 void setGetRequest(boolean getRequest)
          Specify whether this message is a "sendAndGet" request.
 void setInfo(int info)
          Set the info member.
 void setPayloadText(java.lang.String payloadText)
          Sets the String representation of the compound payload of this message.
 void setReceiver(java.lang.String receiver)
          Set message receiver.
 void setReceiverHost(java.lang.String receiverHost)
          Set message receiver's host computer.
 void setReceiverSubscribeId(int receiverSubscribeId)
          Set receiverSubscribe id number.
 void setReceiverTime(java.util.Date time)
          Set time message was receivered.
 void setSender(java.lang.String sender)
          Set message sender.
 void setSenderHost(java.lang.String senderHost)
          Set message sender's host computer.
 void setSenderTime(java.util.Date time)
          Set time message was sent.
 void setSenderToken(int senderToken)
          Set sender's token.
 void setSysMsgId(int sysMsgId)
          Set system id of message.
 void setVersion(int version)
          Sets the version number of this message.
 
Methods inherited from class org.jlab.coda.cMsg.cMsgMessage
addPayloadItem, addSenderToHistory, clearPayload, copyPayload, getByteArray, getByteArrayEndian, getByteArrayLength, getByteArrayOffset, getContext, getDomain, getHistoryLengthMax, getInfo, getItemsText, getPayloadItem, getPayloadItems, getPayloadNames, getPayloadSize, getPayloadText, getReceiver, getReceiverHost, getReceiverTime, getSender, getSenderHost, getSenderTime, getSenderToken, getSubject, getSysMsgId, getText, getType, getUserInt, getUserTime, getVersion, hasPayload, hasPayload, isGetRequest, isGetResponse, isNullGetResponse, makeNullResponse, makeResponse, needToSwap, payloadPrintout, removePayloadItem, removePayloadItem, setByteArray, setByteArray, setByteArrayEndian, setByteArrayLength, setByteArrayNoCopy, setByteArrayNoCopy, setByteArrayOffset, setGetResponse, setHistoryLengthMax, setNullGetResponse, setSubject, setText, setType, setUserInt, setUserTime, toString, updatePayloadText
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

cMsgMessageFull

public cMsgMessageFull()
Constructor.


cMsgMessageFull

public cMsgMessageFull(java.lang.String XML)
                throws cMsgException
Constructor using XML string generated by cMsgMessage.toString().

Parameters:
XML - XML string
Throws:
cMsgException - if trouble parsing string

cMsgMessageFull

public cMsgMessageFull(java.io.File file)
                throws cMsgException
Constructor reading file generated by writing cMsgMessage.toString() output.

Parameters:
file - file containing XML description of message
Throws:
cMsgException - if trouble reading file or parsing file contents

cMsgMessageFull

public cMsgMessageFull(cMsgMessage m)
Constructor using existing cMsgMessage type of message.

Parameters:
m - regular message to create a full message from
Method Detail

clone

public java.lang.Object clone()
Clone this object.

Overrides:
clone in class cMsgMessage
Returns:
a cMsgMessageFull object which is a copy of this message

copy

public cMsgMessageFull copy()
Creates a complete copy of this message.

Overrides:
copy in class cMsgMessage
Returns:
copy of this message.

response

public cMsgMessageFull response()
                         throws cMsgException
Creates a proper response message to this message which was sent by a client calling sendAndGet.

Overrides:
response in class cMsgMessage
Returns:
message with the response fields properly set.
Throws:
cMsgException - if this message was not sent from a "sendAndGet" method call

nullResponse

public cMsgMessageFull nullResponse()
                             throws cMsgException
Creates a proper response message to this message which was sent by a client calling sendAndGet. In this case, the response message is marked as a null response.

Overrides:
nullResponse in class cMsgMessage
Returns:
message with the response fields properly set so original sender gets a null
Throws:
cMsgException - if this message was not sent from a "sendAndGet" method call

makeResponse

public void makeResponse(cMsgMessageFull msg)
Converts existing message to response of supplied message.

Parameters:
msg - message this message will be made a response to

makeNullResponse

public void makeNullResponse(cMsgMessageFull msg)
Converts existing message to null response of supplied message.

Parameters:
msg - message this message will be made a null response to

setSysMsgId

public void setSysMsgId(int sysMsgId)
Set system id of message. Used by the system in doing sendAndGet.

Parameters:
sysMsgId - system id of message.

setDomain

public void setDomain(java.lang.String domain)
Set domain this message exists in.

Parameters:
domain - domain this message exists in.

setGetRequest

public void setGetRequest(boolean getRequest)
Specify whether this message is a "sendAndGet" request.

Parameters:
getRequest - true if this message is a "sendAndGet" request

setInfo

public void setInfo(int info)
Set the info member.

Parameters:
info - value of info member

setVersion

public void setVersion(int version)
Sets the version number of this message. The version number must be the same as the version number of the cMsg package - given by cMsgConstants.version.

Parameters:
version - version number of message

setSender

public void setSender(java.lang.String sender)
Set message sender.

Parameters:
sender - message sender.

setSenderHost

public void setSenderHost(java.lang.String senderHost)
Set message sender's host computer.

Parameters:
senderHost - message sender's host computer.

setSenderTime

public void setSenderTime(java.util.Date time)
Set time message was sent.

Parameters:
time - time message sent.

setSenderToken

public void setSenderToken(int senderToken)
Set sender's token. Used by the system in doing sendAndGet.

Parameters:
senderToken - sender's token.

setReceiver

public void setReceiver(java.lang.String receiver)
Set message receiver.

Parameters:
receiver - message receiver.

setReceiverHost

public void setReceiverHost(java.lang.String receiverHost)
Set message receiver's host computer.

Parameters:
receiverHost - message receiver's host computer.

setReceiverTime

public void setReceiverTime(java.util.Date time)
Set time message was receivered.

Parameters:
time - time message received.

getReceiverSubscribeId

public int getReceiverSubscribeId()
Get receiverSubscribe id number.

Overrides:
getReceiverSubscribeId in class cMsgMessage
Returns:
id number

setReceiverSubscribeId

public void setReceiverSubscribeId(int receiverSubscribeId)
Set receiverSubscribe id number.

Parameters:
receiverSubscribeId - id number

setContext

public void setContext(cMsgMessageContextInterface context)
Sets the object containing information about the context of the callback receiving this message.

Parameters:
context - object containing information about the context of the callback receiving this message

setPayloadText

public void setPayloadText(java.lang.String payloadText)
Sets the String representation of the compound payload of this message.

Parameters:
payloadText - payloadText of this message.

expandedPayload

public boolean expandedPayload()
Does this message have a payload that consists of objects in a hashmap (ie. is "expanded")? Or does it simply have a payloadText field which has not been expanded.

Returns:
true if message has an expanded payload, else false.

expandedPayload

public void expandedPayload(boolean ep)
Set the "expanded-payload" bit of a message.

Parameters:
ep - boolean which is true if msg has an expanded payload, else false

expandPayload

public void expandPayload()
If this message is unexpanded (has a non-null payloadText field but no items in its payload hashmap), then expand the payload text into a hashmap containing all cMsgPayloadItems.


setFieldsFromText

public int setFieldsFromText(java.lang.String text,
                             int flag)
                      throws cMsgException
This method makes the protected method cMsgMessage.setFieldsFromText(java.lang.String, int) available to other cMsg system classes.

Overrides:
setFieldsFromText in class cMsgMessage
Parameters:
text - string sent over network to be unmarshalled
flag - if cMsgMessage.systemFieldsOnly, set system msg fields only, if cMsgMessage.payloadFieldsOnly set payload msg fields only, and if cMsgMessage.allFields set both
Returns:
index index pointing just past last character in text that was parsed
Throws:
cMsgException - if the text is in a bad format or the text arg is null