com.echomine.jabber.msg
Class PrivateXmlIQMessage

java.lang.Object
  extended by com.echomine.jabber.JabberMessage
      extended by com.echomine.jabber.JabberJDOMMessage
          extended by com.echomine.jabber.AbstractJabberMessage
              extended by com.echomine.jabber.JabberIQMessage
                  extended by com.echomine.jabber.msg.PrivateXmlIQMessage
All Implemented Interfaces:
JabberMessageParsable

public class PrivateXmlIQMessage
extends JabberIQMessage

This message object helps the developer to work with storing and retrieving Private XML data that is stored with the user through the jabber:iq:private IQ namespace. Normally, this could be client preferences or some sort of data that you want stored on the server so you can retrieve later. In order to store private xml messages, the private xml data that you submit MUST be in its own namespace. Preferably, this namespace does not conflict with any of the namespaces registered with the Jabber Registry. To retrieve the proper XML private data, you must set the namespace and element name that you will be retrieving. You will obtain an error if you do not specify a namespace for the element you want to retrieve. You cannot set xml data for other user except for yourself (ie. you can only send this message to the server). Only one element can be queried per IQ message. However, you may store multiple elements with different namespaces independently on the server without any problems.
Current Implementation: JEP-0049 Version 1.0

Since:
0.8a4

Field Summary
 
Fields inherited from class com.echomine.jabber.JabberIQMessage
TYPE_GET, TYPE_RESULT, TYPE_SET
 
Fields inherited from class com.echomine.jabber.AbstractJabberMessage
TYPE_ERROR
 
Fields inherited from class com.echomine.jabber.JabberMessage
messageID
 
Constructor Summary
PrivateXmlIQMessage()
          defaults to iq type get to retrieve private xml data
PrivateXmlIQMessage(java.lang.String type)
          this constructor is for messages with type.
 
Method Summary
 int getMessageType()
          the default message type is unknown.
 Element getPrivateData(java.lang.String elemName, java.lang.String ns)
          This method gives you the convenience of retrieving the private data you requested in a simpler fashion.
 void setPrivateData(Element pvtdata)
          sets the private data based on the DOM structure that is passed in.
 void setPrivateDataRequest(java.lang.String elemName, java.lang.String ns)
          sets the private data element name and namespace that will be retrieved from the server.
 
Methods inherited from class com.echomine.jabber.AbstractJabberMessage
getErrorMessage, getFrom, getTo, getType, isError, parse, setErrorMessage, setFrom, setTo, setType
 
Methods inherited from class com.echomine.jabber.JabberJDOMMessage
encode, getDOM, getXMLOutputter, setMessageID, toString
 
Methods inherited from class com.echomine.jabber.JabberMessage
getMessageID, getReplyMessage, getTimeout, getXMessage, getXMessages, interrupt, isReplyRequired, isSendXMessages, isSynchronized, replyReceived, setReplyRequired, setSendXMessages, setSynchronized, setTimeout, setXMessage, setXMessages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrivateXmlIQMessage

public PrivateXmlIQMessage(java.lang.String type)
this constructor is for messages with type.


PrivateXmlIQMessage

public PrivateXmlIQMessage()
defaults to iq type get to retrieve private xml data

Method Detail

getPrivateData

public Element getPrivateData(java.lang.String elemName,
                              java.lang.String ns)
This method gives you the convenience of retrieving the private data you requested in a simpler fashion. You specify the element name and the namespace that you used in the request (ie. prefs).

Parameters:
elemName - the element name for the root element of your private data
ns - the namespace that you used to store the private data
Returns:
The element tree that contains the private data your requested, null if none exists

setPrivateData

public void setPrivateData(Element pvtdata)
sets the private data based on the DOM structure that is passed in.

Parameters:
pvtdata - the private data with its own element name and namespace, cannot be null.

setPrivateDataRequest

public void setPrivateDataRequest(java.lang.String elemName,
                                  java.lang.String ns)
sets the private data element name and namespace that will be retrieved from the server. Essentially it creates a private data element automatically for you without any children. it also set the message type to a TYPE_GET.

Parameters:
elemName - the element name to be retrieved
ns - the namespace where the private data is stored

getMessageType

public int getMessageType()
Description copied from class: JabberJDOMMessage
the default message type is unknown. It doesn't mean that there is no type. It just means that there is no known message parser for this particular object.

Overrides:
getMessageType in class JabberIQMessage
Returns:
the message type
See Also:
JabberCode


Copyright © 2001-2005 Echomine. All Rights Reserved.