Smack

org.jivesoftware.smackx.search
Class UserSearch

java.lang.Object
  extended by org.jivesoftware.smack.packet.Packet
      extended by org.jivesoftware.smack.packet.IQ
          extended by org.jivesoftware.smackx.search.UserSearch

public class UserSearch
extends IQ

Implements the protocol currently used to search information repositories on the Jabber network. To date, the jabber:iq:search protocol has been used mainly to search for people who have registered with user directories (e.g., the "Jabber User Directory" hosted at users.jabber.org). However, the jabber:iq:search protocol is not limited to user directories, and could be used to search other Jabber information repositories (such as chatroom directories) or even to provide a Jabber interface to conventional search engines.

The basic functionality is to query an information repository regarding the possible search fields, to send a search query, and to receive search results.

Author:
Derek DeMoro

Nested Class Summary
static class UserSearch.Provider
          Internal Search service Provider.
 
Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ
IQ.Type
 
Field Summary
 
Fields inherited from class org.jivesoftware.smack.packet.Packet
DEFAULT_LANGUAGE, ID_NOT_AVAILABLE
 
Constructor Summary
UserSearch()
          Creates a new instance of UserSearch.
 
Method Summary
 java.lang.String getChildElementXML()
          Returns the sub-element XML section of the IQ packet, or null if there isn't one.
 Form getSearchForm(Connection con, java.lang.String searchService)
          Returns the form for all search fields supported by the search service.
 ReportedData sendSearchForm(Connection con, Form searchForm, java.lang.String searchService)
          Sends the filled out answer form to be sent and queried by the search service.
 ReportedData sendSimpleSearchForm(Connection con, Form searchForm, java.lang.String searchService)
          Sends the filled out answer form to be sent and queried by the search service.
 
Methods inherited from class org.jivesoftware.smack.packet.IQ
createErrorResponse, createResultIQ, getType, setType, toXML
 
Methods inherited from class org.jivesoftware.smack.packet.Packet
addExtension, addExtensions, deleteProperty, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getProperty, getPropertyNames, getTo, getXmlns, hashCode, nextID, removeExtension, setDefaultXmlns, setError, setFrom, setPacketID, setProperty, setTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserSearch

public UserSearch()
Creates a new instance of UserSearch.

Method Detail

getChildElementXML

public java.lang.String getChildElementXML()
Description copied from class: IQ
Returns the sub-element XML section of the IQ packet, or null if there isn't one. Packet extensions must be included, if any are defined.

Extensions of this class must override this method.

Specified by:
getChildElementXML in class IQ
Returns:
the child element section of the IQ XML.

getSearchForm

public Form getSearchForm(Connection con,
                          java.lang.String searchService)
                   throws XMPPException
Returns the form for all search fields supported by the search service.

Parameters:
con - the current Connection.
searchService - the search service to use. (ex. search.jivesoftware.com)
Returns:
the search form received by the server.
Throws:
XMPPException - thrown if a server error has occurred.

sendSearchForm

public ReportedData sendSearchForm(Connection con,
                                   Form searchForm,
                                   java.lang.String searchService)
                            throws XMPPException
Sends the filled out answer form to be sent and queried by the search service.

Parameters:
con - the current Connection.
searchForm - the Form to send for querying.
searchService - the search service to use. (ex. search.jivesoftware.com)
Returns:
ReportedData the data found from the query.
Throws:
XMPPException - thrown if a server error has occurred.

sendSimpleSearchForm

public ReportedData sendSimpleSearchForm(Connection con,
                                         Form searchForm,
                                         java.lang.String searchService)
                                  throws XMPPException
Sends the filled out answer form to be sent and queried by the search service.

Parameters:
con - the current Connection.
searchForm - the Form to send for querying.
searchService - the search service to use. (ex. search.jivesoftware.com)
Returns:
ReportedData the data found from the query.
Throws:
XMPPException - thrown if a server error has occurred.

Smack

Copyright © 2003-2007 Jive Software.