com.echomine.jabber.msg
Class ServiceItem

java.lang.Object
  extended by com.echomine.jabber.msg.ServiceItem

public class ServiceItem
extends java.lang.Object

Supporting class to work with the Service Discovery protocol. This class contains one instance of a service item as present in a service items result. This class also supports the action "view" (on top of "update" and "remove") to support Flexible Offline Message Retrieval.

Since:
0.8a4
See Also:
ServiceItemsIQMessage

Field Summary
static java.lang.String ACTION_REMOVE
           
static java.lang.String ACTION_UPDATE
           
static java.lang.String ACTION_VIEW
           
 
Constructor Summary
ServiceItem(Element serviceElem)
          constructor that will parse the incoming element for the element data
ServiceItem(JID jid)
          construct a service item with the required attributes set
ServiceItem(JID jid, java.lang.String name)
          constructs a service item based on the following attributes
ServiceItem(JID jid, java.lang.String name, java.lang.String node)
          constructs a service item based on the following attributes
 
Method Summary
 Element encode()
           
 java.lang.String getAction()
           
 JID getJID()
           
 java.lang.String getName()
           
 java.lang.String getNode()
           
 void parse(Element serviceElem)
          parses the element for all the data.
 void setAction(java.lang.String action)
          sets the action type of this item.
 void setJID(JID jid)
          sets the JID of the item
 void setName(java.lang.String name)
          sets the name/description of the item
 void setNode(java.lang.String node)
          sets the node name associated with the item Node attributes SHOULD be used only when trying to provide or query information which is not directly addressable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_VIEW

public static final java.lang.String ACTION_VIEW
See Also:
Constant Field Values

ACTION_UPDATE

public static final java.lang.String ACTION_UPDATE
See Also:
Constant Field Values

ACTION_REMOVE

public static final java.lang.String ACTION_REMOVE
See Also:
Constant Field Values
Constructor Detail

ServiceItem

public ServiceItem(JID jid)
construct a service item with the required attributes set


ServiceItem

public ServiceItem(JID jid,
                   java.lang.String name)
constructs a service item based on the following attributes

Parameters:
jid - the jid of the item
name - the optional name/description of the item, may be null

ServiceItem

public ServiceItem(JID jid,
                   java.lang.String name,
                   java.lang.String node)
constructs a service item based on the following attributes

Parameters:
jid - the jid of the item
name - the optional name/description of the item, may be null
node - the optional node name of the item, may be null

ServiceItem

public ServiceItem(Element serviceElem)
            throws ParseException
constructor that will parse the incoming element for the element data

Throws:
ParseException
Method Detail

getJID

public JID getJID()
Returns:
the JID of the item

setJID

public void setJID(JID jid)
sets the JID of the item


getName

public java.lang.String getName()
Returns:
the optional name/description of the item

setName

public void setName(java.lang.String name)
sets the name/description of the item


getNode

public java.lang.String getNode()
Returns:
the optional node name associated with the item, null if none exist

setNode

public void setNode(java.lang.String node)
sets the node name associated with the item Node attributes SHOULD be used only when trying to provide or query information which is not directly addressable. Node attributes SHOULD NOT be empty, and implementations MUST treat empty node attributes the same as no node attribute being present.


getAction

public java.lang.String getAction()
Returns:
the action type associated with this item, or null if none exists

setAction

public void setAction(java.lang.String action)
sets the action type of this item. Must be either null, ACTION_UPDATE, ACTION_REMOVE


parse

public void parse(Element serviceElem)
           throws ParseException
parses the element for all the data. This will also reset all the variables inside this class. Thus, the instance can be reused for multiple parsing without any problems.

Parameters:
serviceElem - the element that contains the service item
Throws:
ParseException

encode

public Element encode()


Copyright © 2001-2005 Echomine. All Rights Reserved.