com.edustructures.sifworks
Class SIFMessagePayload

java.lang.Object
  extended by com.edustructures.sifworks.Element
      extended by com.edustructures.sifworks.SIFElement
          extended by com.edustructures.sifworks.SIFMessagePayload
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
SIF_Ack, SIF_Event, SIF_Provide, SIF_Provision, SIF_Register, SIF_Request, SIF_Response, SIF_Subscribe, SIF_SystemControl, SIF_Unprovide, SIF_Unregister, SIF_Unsubscribe

public abstract class SIFMessagePayload
extends SIFElement

A specialization of SIFElement for SIF infrastructure messages such as SIF_Register, SIF_Request, and SIF_Event.

SIFMessagePayload provides methods specific to infrastructure messages, such as retrieving the SIF_Header or its individual fields. When an instance of this class is constructed, it is done so without its SIF_Header element. The getHeader method adds a SIF_Header child if one does not exist, and the class framework takes care of assigning values to the header prior to sending messages.

For consistency the ADK employs the same SIFElement class hierarchy and conventions for SIF Infrastructure messages as it does for SIF Data Objects. Some inherited methods of SIFElement, such as setChanged and setEmpty, have no effect for infrastructure messages.

Version:
ADK 1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.edustructures.sifworks.Element
CURRENT_SERIALIZE_VERSION
 
Constructor Summary
SIFMessagePayload(ElementDef metadata)
          Constructor
 
Method Summary
 SIF_Ack ackError(int category, int code, java.lang.String desc)
          Deprecated. Please use the overload of this method that accepts a SIFErrorCategory as the first parameter
 SIF_Ack ackError(int category, int code, java.lang.String desc, java.lang.String extDesc)
          Deprecated. Please use the overload of this method that accepts a SIFErrorCategory as the first parameter
 SIF_Ack ackError(SIFErrorCategory category, int code, java.lang.String desc)
          Create an error SIF_Ack for this message.
 SIF_Ack ackError(SIFErrorCategory category, int code, java.lang.String desc, java.lang.String extDesc)
          Create an error SIF_Ack for this message.
 SIF_Ack ackFinal()
          Create a Final SIF_Ack for this message.
 SIF_Ack ackImmediate()
          Create an Immediate SIF_Ack for this message.
 SIF_Ack ackIntermediate()
          Create an Intermediate SIF_Ack for this message.
 SIF_Ack ackStatus(int code)
          Create a SIF_Ack for this message.
 java.lang.String getDestinationId()
          Gets the SIF_DestinationId value from this message's header.
 SIF_Header getHeader()
          Returns the SIF_Header element.
 java.lang.String getMsgId()
          Gets the SIF_MsgId value from this message's header.
 java.util.List<SIFContext> getSIFContexts()
          Gets the list of SIFContexts associated with this message.
 SIFVersion getSIFVersion()
          Gets the SIF Version to which this message conforms.
 java.lang.String getSourceId()
          Gets the SIF_SourceId value from this message's header.
 java.util.Calendar getTimestamp()
          Gets the timestamp of this message from the SIF_Timestamp element in the header.
 java.lang.String getVersionAttribute()
          Returns the Version attribute of this SIF_Message.
 java.lang.String getXmlns()
          Returns the XML namespace of this message
 void LogRecv(org.apache.log4j.Category log)
          Utility method called by the class framework to log this SIF_Message upon receipt from a zone.
 void LogSend(org.apache.log4j.Category log)
          Utility method called by the class framework to log this SIF_Message prior to sending it to a zone.
 void setSIFVersion(SIFVersion ver)
          Sets the SIF Version to which this SIF_Message conforms.
 void setVersionAttribute(java.lang.String version)
          Sets the Version attribute of this SIF_Message.
 void setXmlns(java.lang.String xmlns)
          Sets the XML namespace of this message
 
Methods inherited from class com.edustructures.sifworks.SIFElement
addChild, addChild, clone, compareGraphTo, create, effectiveSIFVersion, getChild, getChild, getChild, getChild, getChild, getChildCount, getChildList, getChildList, getChildList, getChildren, getChildren, getContent, getContent, getField, getField, getFieldCount, getFields, getFieldValue, getKey, getSIFValue, getTextValue, getXmlId, hasTextValue, removeChild, removeChild, removeChild, removeChild, restoreImplementationDef, setChanged, setChildren, setEmpty, setField, setField, setField, setField, setSIFValue, setTextValue, setXmlId, tag
 
Methods inherited from class com.edustructures.sifworks.Element
compareTo, getElementDef, getParent, getRoot, isChanged, isDoNotEncode, isEmpty, setChanged, setDoNotEncode, setElementDef, setEmpty, setParent, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SIFMessagePayload

public SIFMessagePayload(ElementDef metadata)
Constructor

Method Detail

getHeader

public SIF_Header getHeader()
Returns the SIF_Header element. A new SIF_Header is created for this object if one does not already exist.

Returns:
The infrastructure message header

getXmlns

public java.lang.String getXmlns()
Returns the XML namespace of this message


setXmlns

public void setXmlns(java.lang.String xmlns)
Sets the XML namespace of this message


getVersionAttribute

public java.lang.String getVersionAttribute()
Returns the Version attribute of this SIF_Message.

The Version attribute was introduced in SIF 1.1, which uses the attribute to identify the version of SIF to which a message conforms. Prior versions of SIF encode the version in the namespace.

Returns:
The value of the Version attribute. If a null value is returned, the caller should assume "1.1"
Since:
SIF 1.1

setVersionAttribute

public void setVersionAttribute(java.lang.String version)
Sets the Version attribute of this SIF_Message.

The Version attribute was introduced in SIF 1.1

Parameters:
version - The text for the Version attribute
Since:
SIF 1.1

getSIFVersion

public SIFVersion getSIFVersion()
Gets the SIF Version to which this message conforms.

The SIF Version is determined by first inspecting the Version attribute of the SIF_Message. If present, that attribute identifies the version of SIF to which the version conforms. If not present, the namespace is inspected; if it is in the form "http://www.sifinfo.org/v1.0r1/messages", it is parsed to obtain the version of SIF. If it is in the form "http://www.sifinfo.org/infrastructure/1.x" and no Version attribute is present, the version of SIF is assumed to be "1.1"

Overrides:
getSIFVersion in class SIFElement
Returns:
A SIFVersion encapsulating the version of SIF to which the message conforms, or null if the message does not provide a valid xmlns or Version attribute from which to determine the SIF Version

setSIFVersion

public void setSIFVersion(SIFVersion ver)
Sets the SIF Version to which this SIF_Message conforms.

If the supplied version if SIF 1.1 or later, the Version attribute is assigned a value and the xmlns attribute is set to "http://www.sifinfo.org/infrastructure/major.x". Otherwise, the Version attribute is not set and the xmlns attribute is set to "http://www.sifinfo.org/vversion/messages"

Overrides:
setSIFVersion in class SIFElement
Parameters:
A - SIFVersion instance encapsulating the version of the SIF Specification to which this message conforms

getMsgId

public java.lang.String getMsgId()
Gets the SIF_MsgId value from this message's header.

If the message does not have a SIF_Header element, one is created.

Returns:
The SIF_MsgId value

getSourceId

public java.lang.String getSourceId()
Gets the SIF_SourceId value from this message's header.

If the message does not have a SIF_Header element, one is created.

Returns:
The SIF_SourceId value

getDestinationId

public java.lang.String getDestinationId()
Gets the SIF_DestinationId value from this message's header.

If the message does not have a SIF_Header element, one is created.

Returns:
The SIF_DestinationId value

getTimestamp

public java.util.Calendar getTimestamp()
Gets the timestamp of this message from the SIF_Timestamp element in the header.

If the message does not have a SIF_Header element, one is created with a timestamp equal to the current time.

Returns:
The message timestamp

getSIFContexts

public java.util.List<SIFContext> getSIFContexts()
Gets the list of SIFContexts associated with this message.

Returns:

ackImmediate

public SIF_Ack ackImmediate()
Create an Immediate SIF_Ack for this message.

Returns:
A new SIF_Ack instance where the SIF_Status/SIF_Code value is set to a value of "1" and SIF_Ack header values are derived from this message's header values

ackIntermediate

public SIF_Ack ackIntermediate()
Create an Intermediate SIF_Ack for this message.

Returns:
A new SIF_Ack instance where the SIF_Status/SIF_Code value is set to a value of "2" and SIF_Ack header values are derived from this message's header values

ackFinal

public SIF_Ack ackFinal()
Create a Final SIF_Ack for this message.

Returns:
A new SIF_Ack instance where the SIF_Status/SIF_Code value is set to a value of "3" and SIF_Ack header values are derived from this message's header values

ackStatus

public SIF_Ack ackStatus(int code)
Create a SIF_Ack for this message.

Parameters:
code - The SIF_Status/SIF_Code value
Returns:
A new SIF_Ack instance where the SIF_Status/SIF_Code value is set to the specified value and SIF_Ack header values are derived from this message's header values

ackError

public SIF_Ack ackError(int category,
                        int code,
                        java.lang.String desc)
Deprecated. Please use the overload of this method that accepts a SIFErrorCategory as the first parameter

Create an error SIF_Ack for this message.

Parameters:
category - The value of the SIF_Error/SIF_Category element
code - The value of the SIF_Error/SIF_Code element
desc - The value of the SIF_Error/SIF_Desc element
Returns:
A new SIF_Ack instance with a SIF_Error element and SIF_Ack header values derived from this message's header values

ackError

public SIF_Ack ackError(SIFErrorCategory category,
                        int code,
                        java.lang.String desc)
Create an error SIF_Ack for this message.

Parameters:
category - The value of the SIF_Error/SIF_Category element
code - The value of the SIF_Error/SIF_Code element
desc - The value of the SIF_Error/SIF_Desc element
Returns:
A new SIF_Ack instance with a SIF_Error element and SIF_Ack header values derived from this message's header values

ackError

public SIF_Ack ackError(int category,
                        int code,
                        java.lang.String desc,
                        java.lang.String extDesc)
Deprecated. Please use the overload of this method that accepts a SIFErrorCategory as the first parameter

Create an error SIF_Ack for this message.

Parameters:
category - The value of the SIF_Error/SIF_Category element
code - The value of the SIF_Error/SIF_Code element
desc - The value of the SIF_Error/SIF_Desc element
extDesc - The value of the SIF_Error/SIF_ExtendedDesc element
Returns:
A new SIF_Ack instance with a SIF_Error element and SIF_Ack header values derived from this message's header values

ackError

public SIF_Ack ackError(SIFErrorCategory category,
                        int code,
                        java.lang.String desc,
                        java.lang.String extDesc)
Create an error SIF_Ack for this message.

Parameters:
category - The value of the SIF_Error/SIF_Category element
code - The value of the SIF_Error/SIF_Code element
desc - The value of the SIF_Error/SIF_Desc element
extDesc - The value of the SIF_Error/SIF_ExtendedDesc element
Returns:
A new SIF_Ack instance with a SIF_Error element and SIF_Ack header values derived from this message's header values

LogSend

public void LogSend(org.apache.log4j.Category log)
Utility method called by the class framework to log this SIF_Message prior to sending it to a zone.

Parameters:
log - The Log4j Category instance representing the destination Zone

LogRecv

public void LogRecv(org.apache.log4j.Category log)
Utility method called by the class framework to log this SIF_Message upon receipt from a zone.

Parameters:
log - The Log4j Category instance representing the source Zone


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.