Package org.jivesoftware.smackx.search
Class UserSearchManager
- java.lang.Object
-
- org.jivesoftware.smackx.search.UserSearchManager
-
public class UserSearchManager extends java.lang.Object
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(); Form answerForm = searchForm.createAnswerForm(); answerForm.setAnswer("last", "DeMoro"); ReportedData data = search.getSearchResults(answerForm); // Use Returned Data
-
-
Constructor Summary
Constructors Constructor Description UserSearchManager(XMPPConnection con)
Creates a new UserSearchManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataForm
getSearchForm(DomainBareJid searchService)
Returns the form to fill out to perform a search.ReportedData
getSearchResults(DataForm searchForm, DomainBareJid searchService)
Submits a search form to the server and returns the resulting information in the form ofReportedData
.java.util.List<DomainBareJid>
getSearchServices()
Returns a collection of search services found on the server.
-
-
-
Constructor Detail
-
UserSearchManager
public UserSearchManager(XMPPConnection con)
Creates a new UserSearchManager.- Parameters:
con
- the XMPPConnection to use.
-
-
Method Detail
-
getSearchForm
public DataForm getSearchForm(DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.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.java.lang.InterruptedException
- if the calling thread was interrupted.
-
getSearchResults
public ReportedData getSearchResults(DataForm searchForm, DomainBareJid searchService) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.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.java.lang.InterruptedException
- if the calling thread was interrupted.
-
getSearchServices
public java.util.List<DomainBareJid> getSearchServices() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
Returns 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.java.lang.InterruptedException
- if the calling thread was interrupted.
-
-