javax.wireless.messaging
Interface Message

All Known Subinterfaces:
BinaryMessage, MultipartMessage, TextMessage

public interface Message

This is the base interface for derived interfaces that represent various types of messages. This package is designed to work with Message objects that may contain different elements depending on the underlying messaging protocol. This is different from Datagrams that are assumed always to be just blocks of binary data. An adapter specification for a given messaging protocol may define further interfaces derived from the Message interfaces included in this generic specification.

The wireless messaging protocols that are accessed via this API are typically of store-and-forward nature, unlike network layer datagrams. Thus, the messages will usually reach the recipient, even if the recipient is not connected at the time of sending the message. This may happen significantly later if the recipient is disconnected for a long time. Sending, and possibly also receiving, these wireless messages typically involves a financial cost to the end user that cannot be neglected. Therefore, applications should not send many messages unnecessarily.

This interface contains the functionality common to all messages. Concrete object instances representing a message will typically implement other (sub)interfaces providing access to the content and other information in the message which is dependent on the type of the message.

Object instances implementing this interface are just containers for the data that is passed in. The setAddress() method just sets the value of the address in the data container without any checking whether the value is valid in any way.

Since:
JDE 4.0.0

Method Summary
 String getAddress()
          Returns the address associated with this message.
 Date getTimestamp()
          Returns the timestamp indicating when this message has been sent.
 void setAddress(String addr)
          Sets the address associated with this message, that is, the address returned by the getAddress method.
 

Method Detail

getAddress

public String getAddress()
Returns the address associated with this message.

If this is a message to be sent, then this address is the recipient's address.

If this is a message that has been received, then this address is the sender's address.

Returns null, if the address for the message is not set.

Note:This design allows responses to be sent to a received message by reusing the same Message object and just replacing the payload. The address field can normally be kept untouched (unless the messaging protocol requires some special handling of the address).

The returned address uses the same URL string syntax that Connector.open() uses to obtain this MessageConnection.

Returns:
the address of this message, or null if the address is not set
Since:
JDE 4.0.0
See Also:
setAddress(String)

getTimestamp

public Date getTimestamp()

Returns the timestamp indicating when this message has been sent.

Returns:
Date indicating the timestamp in the message or null if the timestamp is not set or if the time information is not available in the underlying protocol message
Since:
JDE 4.0.0

setAddress

public void setAddress(String addr)

Sets the address associated with this message, that is, the address returned by the getAddress method. The address may be set to null.

The address MUST use the same URL string syntax that Connector.open() uses to obtain this MessageConnection.

Parameters:
addr - address for the message
Since:
JDE 4.0.0
See Also:
getAddress()



Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.