Class UserSearchManager

java.lang.Object
org.jivesoftware.smackx.search.UserSearchManager

public class UserSearchManager extends 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();
 FillableForm answerForm = searchForm.getFillableForm()
 // Fill out the form.
 answerForm.setAnswer("last", "DeMoro");
 ReportedData data = search.getSearchResults(answerForm);
 // Use Returned Data
 
  • Constructor Details

    • UserSearchManager

      public UserSearchManager(org.jivesoftware.smack.XMPPConnection con)
      Creates a new UserSearchManager.
      Parameters:
      con - the XMPPConnection to use.
  • Method Details

    • getSearchForm

      public Form getSearchForm(org.jxmpp.jid.DomainBareJid searchService) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.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:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getSearchResults

      public ReportedData getSearchResults(FillableForm searchForm, org.jxmpp.jid.DomainBareJid searchService) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Submits a search form to the server and returns the resulting information in the form of ReportedData.
      Parameters:
      searchForm - the Form to submit for searching.
      searchService - the name of the search service to use.
      Returns:
      the ReportedData returned 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.
      InterruptedException - if the calling thread was interrupted.
    • getSearchServices

      public List<org.jxmpp.jid.DomainBareJid> getSearchServices() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Returns a collection of search services found on the server.
      Returns:
      a Collection of search services found on 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.
      InterruptedException - if the calling thread was interrupted.