Smack

org.jivesoftware.smackx.bookmark
Class BookmarkManager

java.lang.Object
  extended by org.jivesoftware.smackx.bookmark.BookmarkManager

public class BookmarkManager
extends Object

Provides methods to manage bookmarks in accordance with JEP-0048. Methods for managing URLs and Conferences are provided.

It should be noted that some extensions have been made to the JEP. There is an attribute on URLs that marks a url as a news feed and also a sub-element can be added to either a URL or conference indicated that it is shared amongst all users on a server.

Author:
Alexander Wenckus

Method Summary
 void addBookmarkedConference(String name, String jid, boolean isAutoJoin, String nickname, String password)
          Adds or updates a conference in the bookmarks.
 void addBookmarkedURL(String URL, String name, boolean isRSS)
          Adds a new url or updates an already existing url in the bookmarks.
 Collection<BookmarkedConference> getBookmarkedConferences()
          Returns all currently bookmarked conferences.
 Collection<BookmarkedURL> getBookmarkedURLs()
          Returns an unmodifiable collection of all bookmarked urls.
static BookmarkManager getBookmarkManager(Connection connection)
          Returns the BookmarkManager for a connection, if it doesn't exist it is created.
 void removeBookmarkedConference(String jid)
          Removes a conference from the bookmarks.
 void removeBookmarkedURL(String bookmarkURL)
          Removes a url from the bookmarks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBookmarkManager

public static BookmarkManager getBookmarkManager(Connection connection)
                                          throws XMPPException
Returns the BookmarkManager for a connection, if it doesn't exist it is created.

Parameters:
connection - the connection for which the manager is desired.
Returns:
Returns the BookmarkManager for a connection, if it doesn't exist it is created.
Throws:
XMPPException - Thrown if the connection is null or has not yet been authenticated.

getBookmarkedConferences

public Collection<BookmarkedConference> getBookmarkedConferences()
                                                          throws XMPPException
Returns all currently bookmarked conferences.

Returns:
returns all currently bookmarked conferences
Throws:
XMPPException - thrown when there was an error retrieving the current bookmarks from the server.
See Also:
BookmarkedConference

addBookmarkedConference

public void addBookmarkedConference(String name,
                                    String jid,
                                    boolean isAutoJoin,
                                    String nickname,
                                    String password)
                             throws XMPPException
Adds or updates a conference in the bookmarks.

Parameters:
name - the name of the conference
jid - the jid of the conference
isAutoJoin - whether or not to join this conference automatically on login
nickname - the nickname to use for the user when joining the conference
password - the password to use for the user when joining the conference
Throws:
XMPPException - thrown when there is an issue retrieving the current bookmarks from the server.

removeBookmarkedConference

public void removeBookmarkedConference(String jid)
                                throws XMPPException
Removes a conference from the bookmarks.

Parameters:
jid - the jid of the conference to be removed.
Throws:
XMPPException - thrown when there is a problem with the connection attempting to retrieve the bookmarks or persist the bookmarks.
IllegalArgumentException - thrown when the conference being removed is a shared conference

getBookmarkedURLs

public Collection<BookmarkedURL> getBookmarkedURLs()
                                            throws XMPPException
Returns an unmodifiable collection of all bookmarked urls.

Returns:
returns an unmodifiable collection of all bookmarked urls.
Throws:
XMPPException - thrown when there is a problem retriving bookmarks from the server.

addBookmarkedURL

public void addBookmarkedURL(String URL,
                             String name,
                             boolean isRSS)
                      throws XMPPException
Adds a new url or updates an already existing url in the bookmarks.

Parameters:
URL - the url of the bookmark
name - the name of the bookmark
isRSS - whether or not the url is an rss feed
Throws:
XMPPException - thrown when there is an error retriving or saving bookmarks from or to the server

removeBookmarkedURL

public void removeBookmarkedURL(String bookmarkURL)
                         throws XMPPException
Removes a url from the bookmarks.

Parameters:
bookmarkURL - the url of the bookmark to remove
Throws:
XMPPException - thrown if there is an error retriving or saving bookmarks from or to the server.

Smack

Copyright © 2003-2007 Jive Software.