Class BookmarkManager


  • public final class BookmarkManager
    extends java.lang.Object
    Provides methods to manage bookmarks in accordance with XEP-0048. Methods for managing URLs and Conferences are provided. It should be noted that some extensions have been made to the XEP. 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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBookmarkedConference​(java.lang.String name, org.jxmpp.jid.EntityBareJid jid, boolean isAutoJoin, org.jxmpp.jid.parts.Resourcepart nickname, java.lang.String password)
      Adds or updates a conference in the bookmarks.
      void addBookmarkedURL​(java.lang.String URL, java.lang.String name, boolean isRSS)
      Adds a new url or updates an already existing url in the bookmarks.
      java.util.List<BookmarkedConference> getBookmarkedConferences()
      Returns all currently bookmarked conferences.
      java.util.List<BookmarkedURL> getBookmarkedURLs()
      Returns an unmodifiable collection of all bookmarked urls.
      static BookmarkManager getBookmarkManager​(org.jivesoftware.smack.XMPPConnection connection)
      Returns the BookmarkManager for a connection, if it doesn't exist it is created.
      boolean isSupported()
      Check if the service supports bookmarks using private data.
      void removeBookmarkedConference​(org.jxmpp.jid.EntityBareJid jid)
      Removes a conference from the bookmarks.
      void removeBookmarkedURL​(java.lang.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​(org.jivesoftware.smack.XMPPConnection connection)
        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:
        java.lang.IllegalArgumentException - when the connection is null.
      • getBookmarkedConferences

        public java.util.List<BookmarkedConference> getBookmarkedConferences()
                                                                      throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                                             org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                                             org.jivesoftware.smack.SmackException.NotConnectedException,
                                                                             java.lang.InterruptedException
        Returns all currently bookmarked conferences.
        Returns:
        returns all currently bookmarked conferences
        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.
        java.lang.InterruptedException - if the calling thread was interrupted.
        See Also:
        BookmarkedConference
      • addBookmarkedConference

        public void addBookmarkedConference​(java.lang.String name,
                                            org.jxmpp.jid.EntityBareJid jid,
                                            boolean isAutoJoin,
                                            org.jxmpp.jid.parts.Resourcepart nickname,
                                            java.lang.String password)
                                     throws org.jivesoftware.smack.SmackException.NoResponseException,
                                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                            org.jivesoftware.smack.SmackException.NotConnectedException,
                                            java.lang.InterruptedException
        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:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - thrown when there is an issue retrieving the current bookmarks from the server.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • removeBookmarkedConference

        public void removeBookmarkedConference​(org.jxmpp.jid.EntityBareJid jid)
                                        throws org.jivesoftware.smack.SmackException.NoResponseException,
                                               org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                               org.jivesoftware.smack.SmackException.NotConnectedException,
                                               java.lang.InterruptedException
        Removes a conference from the bookmarks.
        Parameters:
        jid - the jid of the conference to be removed.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - thrown when there is a problem with the connection attempting to retrieve the bookmarks or persist the bookmarks.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        java.lang.IllegalArgumentException - thrown when the conference being removed is a shared conference
      • getBookmarkedURLs

        public java.util.List<BookmarkedURL> getBookmarkedURLs()
                                                        throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                               org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                               org.jivesoftware.smack.SmackException.NotConnectedException,
                                                               java.lang.InterruptedException
        Returns an unmodifiable collection of all bookmarked urls.
        Returns:
        returns an unmodifiable collection of all bookmarked urls.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - thrown when there is a problem retriving bookmarks from the server.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • addBookmarkedURL

        public void addBookmarkedURL​(java.lang.String URL,
                                     java.lang.String name,
                                     boolean isRSS)
                              throws org.jivesoftware.smack.SmackException.NoResponseException,
                                     org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                     org.jivesoftware.smack.SmackException.NotConnectedException,
                                     java.lang.InterruptedException
        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:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - thrown when there is an error retriving or saving bookmarks from or to the server
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • removeBookmarkedURL

        public void removeBookmarkedURL​(java.lang.String bookmarkURL)
                                 throws org.jivesoftware.smack.SmackException.NoResponseException,
                                        org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                        org.jivesoftware.smack.SmackException.NotConnectedException,
                                        java.lang.InterruptedException
        Removes a url from the bookmarks.
        Parameters:
        bookmarkURL - the url of the bookmark to remove
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - thrown if there is an error retriving or saving bookmarks from or to the server.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the server.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • isSupported

        public boolean isSupported()
                            throws org.jivesoftware.smack.SmackException.NoResponseException,
                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                   org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                   java.lang.InterruptedException
        Check if the service supports bookmarks using private data.
        Returns:
        true if the service supports private data, false otherwise.
        Throws:
        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.
        java.lang.InterruptedException - if the calling thread was interrupted.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        Since:
        4.2
        See Also:
        PrivateDataManager.isSupported()