com.valhalla.jbother.jabber.smack
Class Bookmark

java.lang.Object
  extended by com.valhalla.jbother.jabber.smack.Bookmark
All Implemented Interfaces:
org.jivesoftware.smackx.packet.PrivateData

public class Bookmark
extends java.lang.Object
implements org.jivesoftware.smackx.packet.PrivateData

Represents jabber bookmarks (JEP-0048)

Author:
George Weinberg To create bookmarks on the server, create the bookmark object, use the addURL and addConference methods to add all the bookmarks, and call the PrivateDataManager.setData method on the bookmark. to retrieve bookmarks from the server, register the BookmarkProvider class with a PrivateDataManager, then callthe getPrivateData method. There are two types of bookmarks, urls and conferences. This class will not allow you to add two urls or two conferences with the same name, but an url may have the same name as a conference, and bookmarks created with other apps might have duplicate names, the spec doesn't seem to address the point of whether such duplicates should be allowed.

Nested Class Summary
 class Bookmark.Conference
           
 class Bookmark.URL
          Represents an URL bookmark.
 
Constructor Summary
Bookmark()
          Constructor
 
Method Summary
 boolean addConference(java.lang.String name, java.lang.String jid, java.lang.String nick, java.lang.String password, boolean autojoin)
          adds a Conference (jabber conference room) bookmark.
 boolean addURL(java.lang.String name, java.lang.String value)
          adds a URL bookmark
 Bookmark.Conference getConference(java.lang.String name)
           
 java.util.Iterator getConferences()
           
 java.lang.String getElementName()
          Returns the name of the XML element representing the bookmark (query)
 java.lang.String getNamespace()
          Returns the string "jabber:iq:private"
 Bookmark.URL getURL(java.lang.String name)
           
 java.util.Iterator getURLs()
          Returns an iterator over the URL bookmarks
 void removeConference(Bookmark.Conference c)
           
 java.lang.String toXML()
          Returns an XML representaion of the bookmark, according to JEP-48
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bookmark

public Bookmark()
Constructor

Method Detail

addURL

public boolean addURL(java.lang.String name,
                      java.lang.String value)
adds a URL bookmark

Parameters:
name - a name which will represent the url bookmark
value - a string representing the url
Returns:
whether or not the url was successfully added to the Bookmark object

removeConference

public void removeConference(Bookmark.Conference c)

addConference

public boolean addConference(java.lang.String name,
                             java.lang.String jid,
                             java.lang.String nick,
                             java.lang.String password,
                             boolean autojoin)
adds a Conference (jabber conference room) bookmark. nick and pasword may be null

Parameters:
name - a name which will represent the conference bookmark
jid - the jid of the conference
nick - a nickname representing the participant which will be displyed to the other participants in the conference
password - password to join the conference
autojoin - indicates whether the client should attempt to join the conference immediately upon connection
Returns:
whether or not the bookmark was successfully added to the Bookmark object

getURLs

public java.util.Iterator getURLs()
Returns an iterator over the URL bookmarks


getConferences

public java.util.Iterator getConferences()
Returns:
an iterator over the Conference bookmarks

getURL

public Bookmark.URL getURL(java.lang.String name)
Parameters:
name - the name of the url
Returns:
the first url with the given name, or null if no url with that name exists

getConference

public Bookmark.Conference getConference(java.lang.String name)
Parameters:
name - the name of the url
Returns:
the first url with the given name, or null if no conferenence with that name exists

getElementName

public java.lang.String getElementName()
Returns the name of the XML element representing the bookmark (query)

Specified by:
getElementName in interface org.jivesoftware.smackx.packet.PrivateData

getNamespace

public java.lang.String getNamespace()
Returns the string "jabber:iq:private"

Specified by:
getNamespace in interface org.jivesoftware.smackx.packet.PrivateData

toXML

public java.lang.String toXML()
Returns an XML representaion of the bookmark, according to JEP-48

Specified by:
toXML in interface org.jivesoftware.smackx.packet.PrivateData