Package pygar.communication
Class PmessageJMSv0
java.lang.Object
pygar.communication.PmessageBase
pygar.communication.PmessageJMSv0
- All Implemented Interfaces:
java.io.Serializable
@ThreadSafe public class PmessageJMSv0 extends PmessageBase implements java.io.Serializable
The PmessageJMSv0 class extends the PmessageBase class to provide a message type
with additional fields. Instances of this class can be send
as a JMS Message with relatively little effort. This implementation is limited to
relatively small files because it allocates a byte buffer to hold the contents of
any file that should be sent with the message. A more robust implementation would
send the file in blocks with careful attention to potential network errors.
Note that a file body is sent in two fields. A name field holds the name of the file without the path. The path is deleted because it has no general value in a distributed system. Second, the content of the file is contained in a byte array.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description int
bodyTypeInt
byte[]
fileContent
java.lang.String
fileName
java.lang.String
text
Fields inherited from class pygar.communication.PmessageBase
brokerId, marketId, recipientId, senderId, sessionId, subject
-
Constructor Summary
Constructors Constructor Description PmessageJMSv0()
PmessageJMSv0(java.lang.String myID, java.lang.String recipient, java.lang.String eventName, java.lang.String s)
PmessageJMSv0(Pmessage msg)
conversion constructor from the sibling type PmessagePmessageJMSv0(PmessageJMSv0 msg)
copy constructor -
Method Summary
Modifier and Type Method Description byte[]
getFileContent()
java.lang.String
getFileName()
java.lang.String
getText()
PmessageBase
makePmessageBase()
Upcast a PmessageJMSv0 to a PmessageBase possibly discarding fieldsvoid
setFileContent(byte[] bytes)
void
setFileName(java.lang.String name)
void
setText(java.lang.String stringBody)
Methods inherited from class pygar.communication.PmessageBase
getBrokerId, getMarketId, getRecipientId, getSenderId, getSessionId, getSubject, partialPrint, setBrokerId, setMarketId, setRecipientId, setSenderId, setSessionId, setSubject
-
Field Details
-
text
public java.lang.String text -
fileName
public java.lang.String fileName -
fileContent
public byte[] fileContent -
bodyTypeInt
public int bodyTypeInt
-
-
Constructor Details
-
PmessageJMSv0
copy constructor- Parameters:
msg
-
-
PmessageJMSv0
public PmessageJMSv0() -
PmessageJMSv0
public PmessageJMSv0(java.lang.String myID, java.lang.String recipient, java.lang.String eventName, java.lang.String s) -
PmessageJMSv0
conversion constructor from the sibling type Pmessage
-
-
Method Details
-
makePmessageBase
Upcast a PmessageJMSv0 to a PmessageBase possibly discarding fields- Returns:
-
setText
public void setText(java.lang.String stringBody) -
getText
public java.lang.String getText() -
setFileName
public void setFileName(java.lang.String name) -
getFileName
public java.lang.String getFileName() -
setFileContent
public void setFileContent(byte[] bytes) -
getFileContent
public byte[] getFileContent()
-