com.echomine.jabber.msg
Class SearchIQMessage

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.SearchIQMessage
All Implemented Interfaces:
JabberCode, JabberMessageParsable

public class SearchIQMessage
extends JabberIQMessage
implements JabberCode

This message works with the jabber:iq:search namespace. The jabber:iq:search namespace is used to search for users in a directory. Such a directory is usually called a Jabber User Directory or JUD; the largest such directory on the Jabber network is that hosted at users.jabber.org on the jabber.org public Jabber server. Users may add, update, or delete their information to this directory using the jabber:iq:register namespace; they may also search for other users in the directory using the jabber:iq:search namespace. The specific fields available for searching are determined by the implementation; however, the possible search fields are limited to those documented herein (i.e., the namespace is not extensible). The basic functionality is for a user to query a directory regarding the possible search fields, to send a search query, and to receive search results. There is currently no mechanism for paging through results or limiting the number of "hits". TODO: addFields, addField, getFields are similar to RegisterIQMessage. Should refactor when get a chance.

Current Implementation: JEP-0055 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
 
Fields inherited from interface com.echomine.jabber.JabberCode
MSG_CHAT, MSG_INIT, MSG_IQ, MSG_IQ_AGENTS, MSG_IQ_AUTH, MSG_IQ_BROWSE, MSG_IQ_DISCO_INFO, MSG_IQ_DISCO_ITEMS, MSG_IQ_GATEWAY, MSG_IQ_LAST, MSG_IQ_OOB, MSG_IQ_PRIVATE, MSG_IQ_REGISTER, MSG_IQ_ROSTER, MSG_IQ_SEARCH, MSG_IQ_TIME, MSG_IQ_VACATION, MSG_IQ_VCARD, MSG_IQ_VERSION, MSG_IQ_XMLRPC, MSG_PRESENCE, MSG_UNKNOWN, MSG_X_DATA, MSG_X_DELAY, MSG_X_EVENT, MSG_X_EXPIRE, MSG_X_OOB, MSG_X_PGP_ENCRYPTED, MSG_X_PGP_SIGNED, MSG_X_ROSTER, PARSER_CHAT, PARSER_IQ, PARSER_IQ_AGENTS, PARSER_IQ_AUTH, PARSER_IQ_BROWSE, PARSER_IQ_DISCO_INFO, PARSER_IQ_DISCO_ITEMS, PARSER_IQ_GATEWAY, PARSER_IQ_LAST, PARSER_IQ_OOB, PARSER_IQ_PRIVATE, PARSER_IQ_REGISTER, PARSER_IQ_ROSTER, PARSER_IQ_SEARCH, PARSER_IQ_TIME, PARSER_IQ_VACATION, PARSER_IQ_VCARD, PARSER_IQ_VERSION, PARSER_IQ_XMLRPC, PARSER_PRESENCE, PARSER_X_DATA, PARSER_X_DELAY, PARSER_X_EVENT, PARSER_X_EXPIRE, PARSER_X_OOB, PARSER_X_PGP_ENCRYPTED, PARSER_X_PGP_SIGNED, PARSER_X_ROSTER, XMLNS_CHAT, XMLNS_ERROR_STANZA, XMLNS_ERROR_STREAM, XMLNS_IQ, XMLNS_IQ_AGENTS, XMLNS_IQ_AUTH, XMLNS_IQ_BROWSE, XMLNS_IQ_DISCO_INFO, XMLNS_IQ_DISCO_ITEMS, XMLNS_IQ_GATEWAY, XMLNS_IQ_LAST, XMLNS_IQ_OOB, XMLNS_IQ_PRIVATE, XMLNS_IQ_REGISTER, XMLNS_IQ_ROSTER, XMLNS_IQ_SEARCH, XMLNS_IQ_TIME, XMLNS_IQ_VACATION, XMLNS_IQ_VCARD, XMLNS_IQ_VERSION, XMLNS_IQ_XMLRPC, XMLNS_PRESENCE, XMLNS_STREAM, XMLNS_X_DATA, XMLNS_X_DELAY, XMLNS_X_EVENT, XMLNS_X_EXPIRE, XMLNS_X_OOB, XMLNS_X_PGP_ENCRYPTED, XMLNS_X_PGP_SIGNED, XMLNS_X_ROSTER
 
Constructor Summary
SearchIQMessage()
          sets the default to be of iq type "get"
SearchIQMessage(java.lang.String type)
          this constructor is for creating outgoing messages.
 
Method Summary
 void addField(java.lang.String name, java.lang.String value)
          normally used to add fields that should be sent to the server when registering a new account or updating a current one.
 void addFields(java.util.HashMap fields)
          this method allows you to add multiple fields at once.
 java.util.HashMap getFields()
          this is used normally for incoming messages to retrieve the fields that are returned.
 int getMessageType()
          the default message type is unknown.
 java.util.List getResultItems()
          retrieves the list of search result items if there are any.
 
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

SearchIQMessage

public SearchIQMessage(java.lang.String type)
this constructor is for creating outgoing messages. It is here to be used by subclasses. The constructor simply creates a default element tree with the as the top top level tag and as its child, and then sets the message to use that tree.


SearchIQMessage

public SearchIQMessage()
sets the default to be of iq type "get"

Method Detail

addField

public void addField(java.lang.String name,
                     java.lang.String value)
normally used to add fields that should be sent to the server when registering a new account or updating a current one. You could update the fields that you want. If this is a new account message, you should definitely include the username and password in here.

Parameters:
name - the name of the field
value - the value that is associated with the name

addFields

public void addFields(java.util.HashMap fields)
this method allows you to add multiple fields at once. The hashtable contains strings for names and values.


getFields

public java.util.HashMap getFields()
this is used normally for incoming messages to retrieve the fields that are returned.

Returns:
hash map of name/value string pairs that contain the information inside the message.

getResultItems

public java.util.List getResultItems()
retrieves the list of search result items if there are any. If none exists, then an empty list will be returned.

Returns:
the list of SearchItem objects, empty if none exists.
Throws:
java.lang.IllegalStateException - if the message type is not a result type

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:
a message code that is unique to the message
See Also:
JabberCode


Copyright © 2001-2005 Echomine. All Rights Reserved.