Class UserSearch

  • All Implemented Interfaces:
    org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.FullyQualifiedElement, org.jivesoftware.smack.packet.IqView, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.StanzaView, org.jivesoftware.smack.packet.TopLevelStreamElement, org.jivesoftware.smack.packet.XmlLangElement

    public class UserSearch
    extends org.jivesoftware.smack.packet.SimpleIQ
    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.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  UserSearch.Provider
      Internal Search service Provider.
      • Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ

        org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder, org.jivesoftware.smack.packet.IQ.ResponseType, org.jivesoftware.smack.packet.IQ.Type
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ELEMENT  
      static java.lang.String NAMESPACE  
      • Fields inherited from class org.jivesoftware.smack.packet.IQ

        IQ_ELEMENT, QUERY_ELEMENT
      • Fields inherited from class org.jivesoftware.smack.packet.Stanza

        DEFAULT_LANGUAGE, ITEM, language, TEXT
    • Constructor Summary

      Constructors 
      Constructor Description
      UserSearch()
      Creates a new instance of UserSearch.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DataForm getSearchForm​(org.jivesoftware.smack.XMPPConnection con, org.jxmpp.jid.DomainBareJid searchService)
      Returns the form for all search fields supported by the search service.
      ReportedData sendSearchForm​(org.jivesoftware.smack.XMPPConnection con, DataForm searchForm, org.jxmpp.jid.DomainBareJid searchService)
      Sends the filled out answer form to be sent and queried by the search service.
      ReportedData sendSimpleSearchForm​(org.jivesoftware.smack.XMPPConnection con, DataForm searchForm, org.jxmpp.jid.DomainBareJid searchService)
      Sends the filled out answer form to be sent and queried by the search service.
      • Methods inherited from class org.jivesoftware.smack.packet.SimpleIQ

        getIQChildElementBuilder
      • Methods inherited from class org.jivesoftware.smack.packet.IQ

        createErrorResponse, createErrorResponse, createErrorResponse, createResultIQ, getChildElementName, getChildElementNamespace, getChildElementQName, getChildElementXML, getElementName, getType, isRequestIQ, isResponseIQ, setType, toString, toXML
      • Methods inherited from class org.jivesoftware.smack.packet.Stanza

        addCommonAttributes, addExtension, addExtensions, appendErrorIfExists, getDefaultLanguage, getError, getExtension, getExtension, getExtension, getExtensionElement, getExtensions, getExtensions, getExtensions, getExtensions, getExtensionsMap, getFrom, getLanguage, getNamespace, getStanzaId, getTo, hasExtension, hasExtension, hasStanzaIdSet, logCommonAttributes, overrideExtension, removeExtension, removeExtension, setError, setError, setFrom, setLanguage, setNewStanzaId, setStanzaId, setStanzaId, setTo, throwIfNoStanzaId
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.jivesoftware.smack.packet.Element

        toXML, toXML
      • Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement

        getQName
      • Methods inherited from interface org.jivesoftware.smack.packet.StanzaView

        getError, getExtension, getExtension, getExtensions, getExtensions, getExtensions, getFrom, getStanzaId, getTo, hasExtension, hasExtension, hasExtension
    • Constructor Detail

      • UserSearch

        public UserSearch()
        Creates a new instance of UserSearch.
    • Method Detail

      • getSearchForm

        public DataForm getSearchForm​(org.jivesoftware.smack.XMPPConnection con,
                                      org.jxmpp.jid.DomainBareJid searchService)
                               throws org.jivesoftware.smack.SmackException.NoResponseException,
                                      org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                      org.jivesoftware.smack.SmackException.NotConnectedException,
                                      java.lang.InterruptedException
        Returns the form for all search fields supported by the search service.
        Parameters:
        con - the current XMPPConnection.
        searchService - the search service to use. (ex. search.jivesoftware.com)
        Returns:
        the search form received by the server.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendSearchForm

        public ReportedData sendSearchForm​(org.jivesoftware.smack.XMPPConnection con,
                                           DataForm searchForm,
                                           org.jxmpp.jid.DomainBareJid searchService)
                                    throws org.jivesoftware.smack.SmackException.NoResponseException,
                                           org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                           org.jivesoftware.smack.SmackException.NotConnectedException,
                                           java.lang.InterruptedException
        Sends the filled out answer form to be sent and queried by the search service.
        Parameters:
        con - the current XMPPConnection.
        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:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • sendSimpleSearchForm

        public ReportedData sendSimpleSearchForm​(org.jivesoftware.smack.XMPPConnection con,
                                                 DataForm searchForm,
                                                 org.jxmpp.jid.DomainBareJid searchService)
                                          throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                 org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                 org.jivesoftware.smack.SmackException.NotConnectedException,
                                                 java.lang.InterruptedException
        Sends the filled out answer form to be sent and queried by the search service.
        Parameters:
        con - the current XMPPConnection.
        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:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.