Package org.jivesoftware.smackx.search
Class UserSearch
- java.lang.Object
-
- org.jivesoftware.smack.packet.Stanza
-
- org.jivesoftware.smack.packet.IQ
-
- org.jivesoftware.smack.packet.SimpleIQ
-
- org.jivesoftware.smackx.search.UserSearch
-
- All Implemented Interfaces:
Element
,FullyQualifiedElement
,IqView
,NamedElement
,StanzaView
,TopLevelStreamElement
,XmlLangElement
public class UserSearch extends 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
IQ.IQChildElementXmlStringBuilder, IQ.ResponseType, 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(XMPPConnection con, DomainBareJid searchService)
Returns the form for all search fields supported by the search service.ReportedData
sendSearchForm(XMPPConnection con, DataForm searchForm, DomainBareJid searchService)
Sends the filled out answer form to be sent and queried by the search service.ReportedData
sendSimpleSearchForm(XMPPConnection con, DataForm searchForm, 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, 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.FullyQualifiedElement
getQName
-
Methods inherited from interface org.jivesoftware.smack.packet.IqView
isRequestIQ, isResponseIQ
-
Methods inherited from interface org.jivesoftware.smack.packet.StanzaView
getError, getExtension, getExtension, getExtensions, getExtensions, getExtensions, getFrom, getStanzaId, getTo, hasExtension, hasExtension, hasExtension
-
-
-
-
Field Detail
-
ELEMENT
public static final java.lang.String ELEMENT
- See Also:
- Constant Field Values
-
NAMESPACE
public static final java.lang.String NAMESPACE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
UserSearch
public UserSearch()
Creates a new instance of UserSearch.
-
-
Method Detail
-
getSearchForm
public DataForm getSearchForm(XMPPConnection con, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, 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:
XMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NoResponseException
- if there was no response from the remote entity.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.
-
sendSearchForm
public ReportedData sendSearchForm(XMPPConnection con, DataForm searchForm, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, 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
- theForm
to send for querying.searchService
- the search service to use. (ex. search.jivesoftware.com)- Returns:
- ReportedData the data found from the query.
- Throws:
XMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NoResponseException
- if there was no response from the remote entity.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.
-
sendSimpleSearchForm
public ReportedData sendSimpleSearchForm(XMPPConnection con, DataForm searchForm, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, 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
- theForm
to send for querying.searchService
- the search service to use. (ex. search.jivesoftware.com)- Returns:
- ReportedData the data found from the query.
- Throws:
XMPPException.XMPPErrorException
- if there was an XMPP error returned.SmackException.NoResponseException
- if there was no response from the remote entity.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.
-
-