|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.edustructures.sifworks.SIFMessageInfo
public class SIFMessageInfo
Encapsulates information about a SIF_Message, including its
payload type, header fields, and raw XML message content.
An instance of this class is passed to the MessageInfo parameter of all ADK message handlers like Subscriber.onEvent, Publisher.onQuery, and QueryResults.onQueryResults so that implementations of those methods can access header fields or XML content associated with an incoming message. Callers should cast the MessageInfo object to a SIFMessageInfo type in order to call the methods of this class that are specific to the Schools Interoperability Framework.
Note that raw XML content is only retained if the "adk.messaging.keepMessageContent"
agent property is enabled. Otherwise, the getMessage method
returns a null value. Refer to the AgentProperties class for a
description of all agent and zone properties.
To use SIFMessageInfo, cast the MessageInfo parameter as shown below.
public void onEvent( Event event, Zone zone, MessageInfo info )
{
SIFMessageInfo inf = (SIFMessageInfo)info;
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." );
...
| Constructor Summary | |
|---|---|
SIFMessageInfo()
Called by the ADK to construct a SIFMessageInfo instance |
|
SIFMessageInfo(SIFMessagePayload msg,
Zone zone)
Called by the ADK to construct a SIFMessageInfo |
|
| 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. |
int |
getAuthenticationLevel()
Gets the value of the optional SIF_Security/SIF_SecureChannel/SIF_AuthenticationLevel header element |
java.lang.String |
getDestinationId()
Gets the value of the SIF_DestinationId header element |
int |
getEncryptionLevel()
Gets the value of the optional SIF_Security/SIF_SecureChannel/SIF_EncryptionLevel header element |
SIFVersion |
getLatestSIFRequestVersion()
For SIF_Request messages, gets the latest SIF version that was requested by the requestor and is supported by the ADK |
int |
getMaxBufferSize()
For SIF_Request messages, gets the maximum packet size of result packets |
java.lang.String |
getMessage()
Gets the content of the raw XML message |
java.lang.Boolean |
getMorePackets()
For SIF_Response messages, determines if more packets are to be expected |
java.lang.String |
getMsgId()
Gets the value of the SIF_MsgId header element |
java.lang.Integer |
getPacketNumber()
For SIF_Response messages, gets the packet number |
java.lang.String |
getPayloadTag()
Gets the SIF payload message element tag. |
byte |
getPayloadType()
Gets the SIF payload message type. |
SIFContext[] |
getSIFContexts()
Gets the SIFContexts that this message applies to |
SIF_Header |
getSIFHeader()
Gets the SIF_Header encapsulated by this object. |
RequestInfo |
getSIFRequestInfo()
For SIF_Responze messages, returns information about the original SIF_Request, including any custom user data that was assigned to the Query.setUserData(Serializable) member. |
java.lang.String |
getSIFRequestMsgId()
For SIF_Response messages, gets the SIF_MsgId of the associated SIF_Request. |
ElementDef |
getSIFRequestObjectType()
For SIF_Request messages, identifies the type of object requested |
SIFVersion[] |
getSIFRequestVersions()
For SIF_Request messages, gets the SIF versions responses should conform to. |
SIFVersion |
getSIFVersion()
Gets the version of SIF associated with the message. |
java.lang.String |
getSourceId()
Gets the value of the SIF_SourceId header element |
java.util.Calendar |
getTimestamp()
Gets the SIF_Message header timestamp. |
Zone |
getZone()
Gets the zone from which the message originated. |
SIFMessageInfo |
parse(org.xml.sax.InputSource is,
boolean keepMessage,
Zone zone)
Preparses a raw SIF_Message to extract its header information and payload element type. |
void |
setAttribute(java.lang.String attr,
java.lang.String value)
Sets the value of an attribute. |
void |
setSIFHeader(SIF_Header header)
Assigns a SIF_Header to this message info. |
void |
setSIFRequestInfo(RequestInfo requestInfo)
For SIF_Responze messages, returns information about the original SIF_Request, including any custom user data that was assigned to the Query.setUserData(Serializable) member. |
void |
setSIFRequestMsgId(java.lang.String msgId)
For SIF_Response messages, sets the SIF_MsgId of the associated SIF_Request message. |
void |
setSIFRequestObjectType(ElementDef objType)
For SIF_Request messages, identifies the type of object requested |
void |
setSIFRequestVersion(SIFVersion... versions)
For SIF_Request messages, sets the SIF version that responses should conform to. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SIFMessageInfo()
public SIFMessageInfo(SIFMessagePayload msg,
Zone zone)
msg - The SIF_Messagezone - The associated zone| Method Detail |
|---|
public void setSIFHeader(SIF_Header header)
header - a SIF_Header instancegetSIFHeader()public SIF_Header getSIFHeader()
setSIFHeader method.setSIFHeader(com.edustructures.sifworks.infra.SIF_Header)public Zone getZone()
getZone in interface MessageInfopublic byte getPayloadType()
getPayloadType in interface MessageInfoMSGTYP_ constant from the SIFDTD class
(e.g. SIFDTD.MSGTYPE_REQUEST)public java.lang.String getPayloadTag()
getPayloadTag in interface MessageInfopublic java.util.Calendar getTimestamp()
SIF_Header/SIF_Date and SIF_Header/SIF_Time
element values as a Date instance, identifying the time and date the
message was sent#getTimeZonepublic java.lang.String getMsgId()
SIF_MsgId header element
SIF_Header/SIF_MsgId element, the
unique GUID assigned to the message by its senderpublic java.lang.String getSourceId()
SIF_SourceId header element
SIF_Header/SIF_SourceId element,
which identifies the agent that originated the messagepublic java.lang.String getDestinationId()
SIF_DestinationId header element
SIF_Header/SIF_SourceId element.
When present, it identifies the agent to which the message should be routed
by the zone integration server.public int getAuthenticationLevel()
SIF_Security/SIF_SecureChannel/SIF_AuthenticationLevel header element
public int getEncryptionLevel()
SIF_Security/SIF_SecureChannel/SIF_EncryptionLevel header element
public java.lang.String getMessage()
getMessage in interface MessageInfoadk.keepMessageContent agent or zone property has
a value of "false" (the default), null is returned.public SIFVersion getSIFVersion()
#getSIFRequestVersionpublic void setSIFRequestMsgId(java.lang.String msgId)
msgId - The value to assign to the SIF_Header/SIF_RequestMsgId
elementpublic java.lang.String getSIFRequestMsgId()
SIF_Header/SIF_RequestMsgId element, or
null if the message encapsulated by this SIFMessageInfo instance is not a
SIF_Response messagepublic void setSIFRequestVersion(SIFVersion... versions)
version - A SIFVersion instance identifying the version of the specification
that SIF_Responses should conform to.getSIFVersion()public SIFVersion[] getSIFRequestVersions()
SIF_Request/SIF_Version element or
null if the message is not a SIF_Request messagepublic SIFVersion getLatestSIFRequestVersion()
SIF_Request/SIF_Version element or
null if the message is not a SIF_Request messagepublic void setSIFRequestInfo(RequestInfo requestInfo)
Query.setUserData(Serializable) member.
requestInfo - a RequestInfo object representing the SIF_RequestgetSIFRequestInfo()public RequestInfo getSIFRequestInfo()
Query.setUserData(Serializable) member.
setSIFRequestInfo(RequestInfo)public void setSIFRequestObjectType(ElementDef objType)
objType - An ElementDef constant from the SIFDTD classpublic ElementDef getSIFRequestObjectType()
public java.lang.Integer getPacketNumber()
SIF_Response/SIF_PacketNumber
element or null if the message is not a SIF_Response messagepublic java.lang.Boolean getMorePackets()
SIF_Response/SIF_MorePackets
element or null if the message is not a SIF_Response message or the
element is missing.public int getMaxBufferSize()
SIF_Request/SIF_MaxBufferSize
element or zero if the message is not a SIF_Request message or the
buffer size could not be converted to an integerpublic java.lang.String getAttribute(java.lang.String attr)
MessageInfo
getAttribute in interface MessageInfoattr - The name of the attribute
null if not definedMessageInfo.setAttribute(java.lang.String, java.lang.String),
MessageInfo.getAttributeNames()
public void setAttribute(java.lang.String attr,
java.lang.String value)
MessageInfo
setAttribute in interface MessageInfoattr - The attribute namevalue - The attribute valueMessageInfo.getAttributeNames(),
MessageInfo.getAttribute(java.lang.String)public java.lang.String[] getAttributeNames()
MessageInfo
getAttributeNames in interface MessageInfogetAttribute methodMessageInfo.getAttribute(java.lang.String),
MessageInfo.setAttribute(java.lang.String, java.lang.String)
public SIFMessageInfo parse(org.xml.sax.InputSource is,
boolean keepMessage,
Zone zone)
throws java.io.IOException,
ADKMessagingException
keepContent is true, the
message content is preserved as-is in the returned SIFMessageInfo object
and can be retrieved by calling getMessage on that object.
For SIF_Ack messages, the value of <SIF_OriginalMsgId>
and <SIF_OriginalSourceId> are parsed and stored in
the SIFMessageInfo object. These are the only non-header elements that
are parsed.
is - The source of the SIF_Message to preparse
java.io.IOException
ADKMessagingExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic SIFContext[] getSIFContexts()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||