|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.realtime.xmpp.dom.DomPacketTools
Helper class for modifying DOM elements to set XMPP fields and create child elements.
Field Summary | |
protected static org.dom4j.DocumentFactory |
m_documentFactory
Our document factory. |
protected static long |
m_nextPacketId
packet id generator. |
Constructor Summary | |
DomPacketTools()
|
Method Summary | |
static org.dom4j.Element |
createQuery(java.lang.String sNamespace)
Create a simple query element. |
static org.dom4j.Element |
createRequestPacket(java.lang.String sName,
java.lang.String sFrom,
java.lang.String sTo)
Create a request packet element. |
static org.dom4j.Element |
createResponsePacket(org.dom4j.Element request)
Create a response packet from a request packet. |
static org.dom4j.Element |
createStanza(java.lang.String sName,
JID from,
JID to)
Create a request packet element. |
static org.dom4j.Element |
createXdbPassword(java.lang.String sPassword)
Create a password entry for the XDB. |
protected static java.lang.String |
nextPacketId()
Provide the next packet id. |
static void |
setError(org.dom4j.Element packet,
int nError,
java.lang.String sMessage)
Set the error on a packet. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static long m_nextPacketId
protected static final org.dom4j.DocumentFactory m_documentFactory
Constructor Detail |
public DomPacketTools()
Method Detail |
public static org.dom4j.Element createRequestPacket(java.lang.String sName, java.lang.String sFrom, java.lang.String sTo)
Create a request packet element. Also generates a packet id.
sName
- The packet name, such as iq, message, or presence.sFrom
- The source of the packet.sTo
- Who the packet is destined for.
public static org.dom4j.Element createStanza(java.lang.String sName, JID from, JID to)
Create a request packet element. Also generates a packet id.
sName
- The packet name, such as iq, message, or presence.
public static org.dom4j.Element createResponsePacket(org.dom4j.Element request)
Create a response packet from a request packet. Uses the request packet to get the 'from', 'to', and packet 'id' fields. Creates the response packet using the same top level element name as the request.
* @param request The packet we are generating a response to. * @return The new response packet.
public static void setError(org.dom4j.Element packet, int nError, java.lang.String sMessage)
Set the error on a packet. Sets a packet attribute named 'type' to error. Adds an <error> element, and sets the code attribute to the given error.
If the message parameter is non-null, then it is used as the PCDATA for the error element.
packet
- The packet to signal as an error.nError
- The error code to place in the code attribute
of the error element.sMessage
- An optional error message.public static org.dom4j.Element createXdbPassword(java.lang.String sPassword)
Create a password entry for the XDB. This is the single database record required for a new user.
sPassword
- The users password.
public static org.dom4j.Element createQuery(java.lang.String sNamespace)
Create a simple query element.
* @param sNamespace The namespace to use. * @return An element named 'query' with the given namespace.
protected static java.lang.String nextPacketId()
Provide the next packet id.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |