Class UserSearchManager

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

public final class UserSearchManager extends org.jivesoftware.smack.Manager
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 connection = …;
 var searchService = UserSearchManager.getSearchServices(connection).get(0);
 var searchManager = UserSearchManager.getInstanceFor(connection);
 var sarchForm = searchManager.getSearchForm(searchService);
 var fillableForm = searchForm.getFillableForm();

 // Check for the required fields in the form and fill them
 fillableForm.setAnswer("search", "John");

 var results = searchOne.search(fillableForm, userSearchService);
 // Use results
 
  • Method Summary

    Modifier and Type
    Method
    Description
    getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
     
    getSearchForm(org.jxmpp.jid.DomainBareJid searchService)
    Returns the form to fill out to perform a search.
    static List<org.jxmpp.jid.DomainBareJid>
    getSearchServices(org.jivesoftware.smack.XMPPConnection connection)
    Returns a collection of search services found on the server.
    search(FillableForm filledForm, org.jxmpp.jid.DomainBareJid searchService)
    Sends the filled out answer form to be sent and queried by the search service.
    sendSimpleSearchForm(DataForm searchForm, org.jxmpp.jid.DomainBareJid searchService)
    Sends the filled out answer form to be sent and queried by the search service.

    Methods inherited from class org.jivesoftware.smack.Manager

    connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInstanceFor

      public static UserSearchManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
    • 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.
    • search

      public ReportedData search(FillableForm filledForm, org.jxmpp.jid.DomainBareJid searchService) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Sends the filled out answer form to be sent and queried by the search service.
      Parameters:
      filledForm - the filled form with the query instructions.
      searchService - the search service to use. (ex. search.jivesoftware.com)
      Returns:
      ReportedData the data found from the query.
      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.
    • sendSimpleSearchForm

      public ReportedData sendSimpleSearchForm(DataForm searchForm, org.jxmpp.jid.DomainBareJid searchService) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Sends the filled out answer form to be sent and queried by the search service.
      Parameters:
      searchForm - the Form to send for querying.
      searchService - the search service to use. (ex. search.jivesoftware.com)
      Returns:
      ReportedData the data found from the query.
      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 static List<org.jxmpp.jid.DomainBareJid> getSearchServices(org.jivesoftware.smack.XMPPConnection connection) 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.
      Parameters:
      connection - the connection to query for search services.
      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.