Smack

org.jivesoftware.smackx.search
Class UserSearchManager

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

public class UserSearchManager
extends Object

The UserSearchManager is a facade built upon Jabber Search Services (JEP-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.

 Connection con = new XMPPConnection("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
 

Author:
Derek DeMoro

Constructor Summary
UserSearchManager(Connection con)
          Creates a new UserSearchManager.
 
Method Summary
 Form getSearchForm(String searchService)
          Returns the form to fill out to perform a search.
 ReportedData getSearchResults(Form searchForm, String searchService)
          Submits a search form to the server and returns the resulting information in the form of ReportedData
 Collection<String> getSearchServices()
          Returns a collection of search services found on the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserSearchManager

public UserSearchManager(Connection con)
Creates a new UserSearchManager.

Parameters:
con - the Connection to use.
Method Detail

getSearchForm

public Form getSearchForm(String searchService)
                   throws XMPPException
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 - thrown if a server error has occurred.

getSearchResults

public ReportedData getSearchResults(Form searchForm,
                                     String searchService)
                              throws XMPPException
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:
XMPPException - thrown if a server error has occurred.

getSearchServices

public Collection<String> getSearchServices()
                                     throws XMPPException
Returns a collection of search services found on the server.

Returns:
a Collection of search services found on the server.
Throws:
XMPPException - thrown if a server error has occurred.

Smack

Copyright © 2003-2007 Jive Software.