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
,IqView
,NamedElement
,StanzaView
,TopLevelStreamElement
,XmlElement
,XmlLangElement
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
Modifier and TypeClassDescriptionstatic class
Internal Search service Provider.Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ
IQ.IQChildElementXmlStringBuilder, IQ.ResponseType, IQ.Type
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptiongetSearchForm
(XMPPConnection con, DomainBareJid searchService) Returns the form for all search fields supported by the search service.sendSearchForm
(XMPPConnection con, DataForm searchForm, DomainBareJid searchService) Sends the filled out answer form to be sent and queried by the search service.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, 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, getExtensionElement, getExtensions, getExtensions, getExtensions, getExtensions, getExtensionsMap, getFrom, getLanguage, getNamespace, getStanzaId, getTo, hasExtension, hasExtension, hasStanzaIdSet, logCommonAttributes, overrideExtension, removeExtension, setError, setFrom, setNewStanzaId, 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.IqView
isRequestIQ, isResponseIQ
Methods inherited from interface org.jivesoftware.smack.packet.StanzaView
getError, getExtension, getExtension, getExtensions, getExtensions, getExtensions, getFrom, getStanzaId, getTo, hasExtension, hasExtension, hasExtension
Methods inherited from interface org.jivesoftware.smack.packet.XmlElement
getQName
-
Field Details
-
ELEMENT
- See Also:
-
NAMESPACE
- See Also:
-
-
Constructor Details
-
UserSearch
public UserSearch()Creates a new instance of UserSearch.
-
-
Method Details
-
getSearchForm
public DataForm getSearchForm(XMPPConnection con, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, 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.InterruptedException
- if the calling thread was interrupted.
-
sendSearchForm
public ReportedData sendSearchForm(XMPPConnection con, DataForm searchForm, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, 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.InterruptedException
- if the calling thread was interrupted.
-
sendSimpleSearchForm
public ReportedData sendSimpleSearchForm(XMPPConnection con, DataForm searchForm, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, 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.InterruptedException
- if the calling thread was interrupted.
-