|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.realtime.xmpp.dom.DomPacketSender
Helper class to send a packet and then wait for a response from the server. This class includes a timer that contrains the amount of time it will wait for a response packet. If you want to customize the timer, use the send( packet, timeout ) method.
Field Summary | |
static long |
DEFAULT_PACKET_TIMEOUT
The default packet timeout in milliseconds. |
protected java.lang.Object |
m_packetMonitor
Packet ready monitor. |
protected org.dom4j.Element |
m_response
The response to our sent packet. |
protected java.lang.String |
m_sPacketId
The packet id we have sent. |
protected Xmpp2DomTransformer |
m_transformer
The XMPP to DOM transformer we should receive packets from. |
Constructor Summary | |
DomPacketSender(Xmpp2DomTransformer transformer)
Construct a packet sender to work with the DOM transformer. |
Method Summary | |
void |
incomingPacket(org.dom4j.Element packet)
Signal a new packet has arrived from the stream. |
org.dom4j.Element |
query(XmppQuery request)
Send a packet and wait for the response for a finite amount of time. |
org.dom4j.Element |
query(XmppQuery request,
long timeout)
Send a packet and wait for the response for a finite amount of time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Object m_packetMonitor
protected Xmpp2DomTransformer m_transformer
protected java.lang.String m_sPacketId
protected org.dom4j.Element m_response
public static final long DEFAULT_PACKET_TIMEOUT
Constructor Detail |
public DomPacketSender(Xmpp2DomTransformer transformer)
Construct a packet sender to work with the DOM transformer.
transformer
- The XMPP to DOM transformer to register
with.Method Detail |
public void incomingPacket(org.dom4j.Element packet)
Signal a new packet has arrived from the stream. The packet id is matched against the outgoing packets id, and if matching, will unblock the send() method and return the incoming packet as the result.
If the request packet did not have an id, then the first packet received will automatically match and be considered the response.
incomingPacket
in interface DomPacketListener
packet
- The XMPP packet as a DOM element.public org.dom4j.Element query(XmppQuery request) throws java.io.IOException
Send a packet and wait for the response for a finite amount of time. Uses the DEFAULT_PACKET_TIMEOUT value of 20 seconds.
request
- The packet to send.
java.io.IOException
- Generated when there is a problem writing
the outgoing packet to the Jabber server.public org.dom4j.Element query(XmppQuery request, long timeout) throws java.io.IOException
Send a packet and wait for the response for a finite amount of time.
request
- The packet to send.timeout
- The maximum length of time, in milliseconds,
to wait for a response.
java.io.IOException
- Generated when there is a problem writing
the outgoing packet to the Jabber server.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |