Class Bookmarks

java.lang.Object
org.jivesoftware.smackx.bookmarks.Bookmarks
All Implemented Interfaces:
PrivateData

public class Bookmarks extends Object implements PrivateData
Bookmarks is used for storing and retrieving URLS and Conference rooms. Bookmark Storage (XEP-0048) defined a protocol for the storage of bookmarks to conference rooms and other entities in a Jabber user's account. See the following code sample for saving Bookmarks:
 XMPPConnection con = new XMPPTCPConnection("jabber.org");
 con.login("john", "doe");
 Bookmarks bookmarks = new Bookmarks();
 // Bookmark a URL
 BookmarkedURL url = new BookmarkedURL();
 url.setName("Google");
 url.setURL("http://www.jivesoftware.com");
 bookmarks.addURL(url);
 // Bookmark a Conference room.
 BookmarkedConference conference = new BookmarkedConference();
 conference.setName("My Favorite Room");
 conference.setAutoJoin("true");
 conference.setJID("dev@conference.jivesoftware.com");
 bookmarks.addConference(conference);
 // Save Bookmarks using PrivateDataManager.
 PrivateDataManager manager = new PrivateDataManager(con);
 manager.setPrivateData(bookmarks);
 LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org");
 
  • Field Details

  • Constructor Details

    • Bookmarks

      public Bookmarks()
      Required Empty Constructor to use Bookmarks.
  • Method Details

    • addBookmarkedURL

      public void addBookmarkedURL(BookmarkedURL bookmarkedURL)
      Adds a BookmarkedURL.
      Parameters:
      bookmarkedURL - the bookmarked bookmarkedURL.
    • removeBookmarkedURL

      public void removeBookmarkedURL(BookmarkedURL bookmarkedURL)
      Removes a bookmarked bookmarkedURL.
      Parameters:
      bookmarkedURL - the bookmarked bookmarkedURL to remove.
    • clearBookmarkedURLS

      public void clearBookmarkedURLS()
      Removes all BookmarkedURLs from user's bookmarks.
    • addBookmarkedConference

      public void addBookmarkedConference(BookmarkedConference bookmarkedConference)
      Add a BookmarkedConference to bookmarks.
      Parameters:
      bookmarkedConference - the conference to remove.
    • removeBookmarkedConference

      public void removeBookmarkedConference(BookmarkedConference bookmarkedConference)
      Removes a BookmarkedConference.
      Parameters:
      bookmarkedConference - the BookmarkedConference to remove.
    • clearBookmarkedConferences

      public void clearBookmarkedConferences()
      Removes all BookmarkedConferences from Bookmarks.
    • getBookmarkedURLS

      public List<BookmarkedURL> getBookmarkedURLS()
      Returns a Collection of all Bookmarked URLs for this user.
      Returns:
      a collection of all Bookmarked URLs.
    • getBookmarkedConferences

      public List<BookmarkedConference> getBookmarkedConferences()
      Returns a Collection of all Bookmarked Conference for this user.
      Returns:
      a collection of all Bookmarked Conferences.
    • getElementName

      public String getElementName()
      Returns the root element name.
      Specified by:
      getElementName in interface PrivateData
      Returns:
      the element name.
    • getNamespace

      public String getNamespace()
      Returns the root element XML namespace.
      Specified by:
      getNamespace in interface PrivateData
      Returns:
      the namespace.
    • toXML

      public org.jivesoftware.smack.util.XmlStringBuilder toXML()
      Returns the XML representation of the PrivateData.
      Specified by:
      toXML in interface PrivateData
      Returns:
      the private data as XML.