com.echomine.jabber.msg
Class ServiceItemsIQMessage

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.ServiceItemsIQMessage
All Implemented Interfaces:
JabberMessageParsable

public class ServiceItemsIQMessage
extends JabberIQMessage

Implementation class for working with the Items namespace of the JEP-0030 Service Discovery protocol. The service discovery protocol is a new protocol that will eventually replace the older JEP-0094 Agent Information and JEP-0011 Browsing specs.

Note that this JEP is still considered Experimental. Thus, the protocol may well not have been implemented on the server side. Even though the older Agents namespace is deprecated, it does not mean that you should stop using it. It also doesn't mean that you should use the new disco protocol judiciously without checking to make sure it is supported by the remote server. How would you know? For now, you will just have to try both and see what happens.

Read up on the list of categories, namespaces, and types at the Jabber Registry for an up-to-date list that you may use. The registrar is located at http://www.jabber.org/registrar/

Current Implementation: JEP-0030 Version 2.0

Since:
0.8a4
See Also:
ServiceInfoIQMessage

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
ServiceItemsIQMessage()
           
ServiceItemsIQMessage(java.lang.String type)
          defaults to iq type get for retrieval or for parsing incoming messages
 
Method Summary
 void addItem(ServiceItem serviceItem)
          Adds a new service item to the message
 java.lang.String encode()
          The default encoding will serialize the DOM Tree.
 java.util.List getItems()
           
 int getMessageType()
          the default message type is unknown.
 java.lang.String getNode()
           
 JabberMessage parse(JabberMessageParser parser, Element msgTree)
          parses the message.
 void setNode(java.lang.String node)
          sets the node name so that further subnode items can be retrieved.
 
Methods inherited from class com.echomine.jabber.AbstractJabberMessage
getErrorMessage, getFrom, getTo, getType, isError, setErrorMessage, setFrom, setTo, setType
 
Methods inherited from class com.echomine.jabber.JabberJDOMMessage
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

ServiceItemsIQMessage

public ServiceItemsIQMessage(java.lang.String type)
defaults to iq type get for retrieval or for parsing incoming messages


ServiceItemsIQMessage

public ServiceItemsIQMessage()
Method Detail

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 id
See Also:
JabberCode

addItem

public void addItem(ServiceItem serviceItem)
Adds a new service item to the message

Parameters:
serviceItem - a service item

getItems

public java.util.List getItems()
Returns:
a non-modifiable list of ServiceItem objects

setNode

public void setNode(java.lang.String node)
sets the node name so that further subnode items can be retrieved.

Parameters:
node - the node name to query further

getNode

public java.lang.String getNode()
Returns:
the node name of the message if available, null otherwise

parse

public JabberMessage parse(JabberMessageParser parser,
                           Element msgTree)
                    throws ParseException
Description copied from class: AbstractJabberMessage
parses the message. The parser is really not used

Specified by:
parse in interface JabberMessageParsable
Overrides:
parse in class AbstractJabberMessage
Throws:
ParseException

encode

public java.lang.String encode()
                        throws ParseException
Description copied from class: JabberJDOMMessage
The default encoding will serialize the DOM Tree. If there are X Messages, it will also get included one level below the main "root" element. By one level below, it means that the X Messages will be put as children of the DOM Tree's main element. If this is not a desired behavior, you will need to override and encode your own message.

Overrides:
encode in class JabberJDOMMessage
Throws:
ParseException - if something went wrong during encoding


Copyright © 2001-2005 Echomine. All Rights Reserved.