|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MessageInfo
Provides information about an XML message, such as envelope and header attributes,
the source of the message, and optionally the raw XML document that comprises
the message. A concrete implementation of this interface is available for each
messaging protocol supported by the ADK. For instance, the SIFMessageInfo
class provides access to specific information regarding Schools Interoperability
Framework SIF_Message envelopes and SIF_Header headers.
Using MessageInfo in Message Handlers
A MessageInfo instance is passed as a parameter to message handlers such as
Publisher.onRequest and Subscriber.onEvent.
Cast the parameter to a concrete type to obtain protocol-specific information
about the message. For example, the following shows how to obtain the value of
the SIF_SourceId and SIF_MsgId elements from the
SIF_Header, as well as the version of SIF declared by the
SIF_Message envelope:
public void onEvent( Event event, Zone zone, MessageInfo info )
{
// Cast to SIFMessageInfo to get SIF-specific header info
SIFMessageInfo inf = (SIFMessageInfo)info;
// Obtain SIF-specific header values
String sourceId = inf.getSourceId();
String msgId = inf.getMsgId();
SIFVersion version = inf.getSIFVersion();
// Display some information about this SIF_Event...
System.out.println( "SIF_Event message with ID " + msgId +
" received from agent " + sourceId +
" in zone " + zone.getZoneId() + "."
" This is a SIF " + version.toString() + " message." );
...
When the adk.keepMessageContent agent property is enabled, the
getMessage() method will return the XML document that was received as a
single String. When this option is disabled (the default), the ADK does not keep
a copy of raw message content in memory and will return a null value.
| Method Summary | |
|---|---|
java.lang.String |
getAttribute(java.lang.String attr)
Gets the value of an attribute. |
java.lang.String[] |
getAttributeNames()
Gets the names of all attributes. |
java.lang.String |
getMessage()
Gets the content of the raw XML message |
java.lang.String |
getPayloadTag()
Gets the payload message element tag |
byte |
getPayloadType()
Gets the payload message type |
Zone |
getZone()
Gets the zone from which the message originated |
void |
setAttribute(java.lang.String attr,
java.lang.String value)
Sets the value of an attribute. |
| Method Detail |
|---|
byte getPayloadType()
MSGTYP_ constant (e.g. SIFDTD.MSGTYPE_REQUEST)java.lang.String getPayloadTag()
Zone getZone()
java.lang.String getAttribute(java.lang.String attr)
attr - The name of the attribute
null if not definedsetAttribute(java.lang.String, java.lang.String),
getAttributeNames()
void setAttribute(java.lang.String attr,
java.lang.String value)
attr - The attribute namevalue - The attribute valuegetAttributeNames(),
getAttribute(java.lang.String)java.lang.String[] getAttributeNames()
getAttribute methodgetAttribute(java.lang.String),
setAttribute(java.lang.String, java.lang.String)java.lang.String getMessage()
adk.keepMessageContent agent property is disabled (the
default), null is returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||