Package org.jivesoftware.smackx.search
Class UserSearchManager
java.lang.Object
org.jivesoftware.smackx.search.UserSearchManager
The UserSearchManager is a facade built upon Jabber Search Services (XEP-055) to allow for searching
repositories on a Jabber Server. This implementation allows for transparency of implementation of
searching (DataForms or No DataForms), but allows the user to simply use the DataForm model for both
types of support.
XMPPConnection con = new XMPPTCPConnection("jabber.org"); con.login("john", "doe"); UserSearchManager search = new UserSearchManager(con, "users.jabber.org"); Form searchForm = search.getSearchForm(); FillableForm answerForm = searchForm.getFillableForm() // Fill out the form. answerForm.setAnswer("last", "DeMoro"); ReportedData data = search.getSearchResults(answerForm); // Use Returned Data
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetSearchForm
(DomainBareJid searchService) Returns the form to fill out to perform a search.getSearchResults
(FillableForm searchForm, DomainBareJid searchService) Submits a search form to the server and returns the resulting information in the form ofReportedData
.Returns a collection of search services found on the server.
-
Constructor Details
-
UserSearchManager
Creates a new UserSearchManager.- Parameters:
con
- the XMPPConnection to use.
-
-
Method Details
-
getSearchForm
public Form getSearchForm(DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException Returns the form to fill out to perform a search.- Parameters:
searchService
- the search service to query.- Returns:
- the form to fill out to perform a search.
- 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.
-
getSearchResults
public ReportedData getSearchResults(FillableForm searchForm, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException Submits a search form to the server and returns the resulting information in the form ofReportedData
.- Parameters:
searchForm
- theForm
to submit for searching.searchService
- the name of the search service to use.- Returns:
- the ReportedData returned 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.
-
getSearchServices
public List<DomainBareJid> getSearchServices() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedExceptionReturns a collection of search services found on the server.- Returns:
- a Collection of search services found on 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.
-