com.sun.im.service
Class Presence

java.lang.Object
  extended bycom.sun.im.service.Presence
All Implemented Interfaces:
Delegation, java.io.Serializable

public class Presence
extends java.lang.Object
implements java.io.Serializable, Delegation

Version:
See Also:
Serialized Form

Field Summary
 java.lang.String url
           
 
Constructor Summary
Presence(org.netbeans.lib.collab.Presence p)
           
Presence(PresenceTuple tuple)
           
Presence(java.lang.String id)
           
 
Method Summary
 void addNote(java.lang.String text)
          add a note in the default language.
 void addNote(java.lang.String lang, java.lang.String text)
          set the note for a specified language
 void addSerializedCustomElement(java.lang.String sElement, java.lang.String namespaceURI, boolean validateXML)
          add a serialized custom element as a Node.
 void addTuple(PresenceTuple t)
          Add a tuple to this presentity If a tuple with the same tuple id already exists in this presentity, the existing tuple is removed and replaces with the one specified here.
 void addTuple(PresenceTuple[] t)
           
 java.util.List getCustomElements(java.lang.String namespace)
          returns a list of Element objects belonging to a specific XML namespace.
 java.lang.Object getDelegatedObject()
          This method returns the delegated object
 java.lang.String getNamespaces()
          returns string containing all necessary namespace declarations for this presentity.
 java.lang.String getNote()
          get the note for the default language.
 java.lang.String getNote(java.lang.String lang)
          get the note corresponding to a specified language
 java.lang.String getSerializedCustomElements()
          return a concatenation of all custom elements.
 java.lang.String getSerializedCustomElements(java.lang.String namespace)
          return a serialized XML fragment which is a concatenation of all sub-elements belonging to the specified namespace.
 java.util.Collection getTuples()
          do not modify result
 void removeTuple(PresenceTuple t)
           
 void setNamespaces(java.lang.String namespaceList)
          set the namespace list for this presentity.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

url

public java.lang.String url
Constructor Detail

Presence

public Presence(java.lang.String id)

Presence

public Presence(PresenceTuple tuple)

Presence

public Presence(org.netbeans.lib.collab.Presence p)
Method Detail

getTuples

public java.util.Collection getTuples()
do not modify result


addTuple

public void addTuple(PresenceTuple t)
Add a tuple to this presentity If a tuple with the same tuple id already exists in this presentity, the existing tuple is removed and replaces with the one specified here. If custom XML namespaces have been declared in the tuple, they are automatically taken into account when building the serialized presence document.

Parameters:
t - tuple to add

removeTuple

public void removeTuple(PresenceTuple t)

addTuple

public void addTuple(PresenceTuple[] t)

toString

public java.lang.String toString()

setNamespaces

public void setNamespaces(java.lang.String namespaceList)
set the namespace list for this presentity. This method is used by the presence store to generate Presence object based on information stored in the database.

Parameters:
namespaceList - String containing all necessary XML namespace declarations separated by whitespaces.

getNamespaces

public java.lang.String getNamespaces()
returns string containing all necessary namespace declarations for this presentity. The resulting String is ready to be included in a serialized presence element. This method is used by the presence store to generate a String that can be stored in the database. Example:


addSerializedCustomElement

public void addSerializedCustomElement(java.lang.String sElement,
                                       java.lang.String namespaceURI,
                                       boolean validateXML)
                                throws com.sun.im.service.util.XMLProcessingException
add a serialized custom element as a Node. This is used by application to add custom presence sub-elements while buiding a presence document. Note: elements added using this method may not be retrieved immediately using getCustomElement. To do this the presence document needs to be built and then parsed.

Parameters:
sElement - custom tuple sub-element to add in serialized form.
Throws:
com.sun.im.service.util.XMLProcessingException - ill-formed XML or missing or unrecognized namespace prefix

getSerializedCustomElements

public java.lang.String getSerializedCustomElements()
                                             throws com.sun.im.service.util.XMLProcessingException
return a concatenation of all custom elements. This method is used by the presence store to obtain a serialized XML fragment containing all custom elements of this tuple.

Throws:
com.sun.im.service.util.XMLProcessingException

getCustomElements

public java.util.List getCustomElements(java.lang.String namespace)
returns a list of Element objects belonging to a specific XML namespace. This allows applications to retrieve only elements they are interested in and ignore other custom extentions.

Parameters:
namespace - namespace URI or prefix.
Returns:
list of org.w3c.dom.Element objects.

getSerializedCustomElements

public java.lang.String getSerializedCustomElements(java.lang.String namespace)
                                             throws com.sun.im.service.util.XMLProcessingException
return a serialized XML fragment which is a concatenation of all sub-elements belonging to the specified namespace. This allows applications to retrieve only elements they are interested in and ignore other custom extentions.

Parameters:
namespace - XML namespace URI or prefix
Throws:
com.sun.im.service.util.XMLProcessingException

getNote

public java.lang.String getNote(java.lang.String lang)
get the note corresponding to a specified language

Parameters:
lang - language tag
Returns:
note

getNote

public java.lang.String getNote()
get the note for the default language. if there is no note for the default language and there is only one note, this unique note is returned.

Returns:
note

addNote

public void addNote(java.lang.String lang,
                    java.lang.String text)
set the note for a specified language

Parameters:
lang - language tag
text - note content

addNote

public void addNote(java.lang.String text)
add a note in the default language. This overrides any existing note added for the default language

Returns:
note

getDelegatedObject

public java.lang.Object getDelegatedObject()
Description copied from interface: Delegation
This method returns the delegated object

Specified by:
getDelegatedObject in interface Delegation