Smack

org.jivesoftware.smackx.pubsub.packet
Class PubSub

java.lang.Object
  extended by org.jivesoftware.smack.packet.Packet
      extended by org.jivesoftware.smack.packet.IQ
          extended by org.jivesoftware.smackx.pubsub.packet.PubSub

public class PubSub
extends IQ

The standard PubSub extension of an IQ packet. This is the topmost element of all pubsub requests and replies as defined in the Publish-Subscribe specification.

Author:
Robin Collier

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jivesoftware.smack.packet.IQ
IQ.Type
 
Field Summary
 
Fields inherited from class org.jivesoftware.smack.packet.Packet
DEFAULT_LANGUAGE, ID_NOT_AVAILABLE
 
Constructor Summary
PubSub()
           
 
Method Summary
 java.lang.String getChildElementXML()
          Returns the XML representation of a pubsub element according the specification.
 java.lang.String getElementName()
          Returns the XML element name of the extension sub-packet root element.
 PacketExtension getExtension(PubSubElementType elem)
           
 java.lang.String getNamespace()
          Returns the XML namespace of the extension sub-packet root element.
 PubSubNamespace getPubSubNamespace()
          Returns the current value of the namespace.
 void setPubSubNamespace(PubSubNamespace ns)
          Set the namespace for the packet if it something other than the default case of PubSubNamespace.BASIC.
 
Methods inherited from class org.jivesoftware.smack.packet.IQ
createErrorResponse, createResultIQ, getType, setType, toXML
 
Methods inherited from class org.jivesoftware.smack.packet.Packet
addExtension, addExtensions, deleteProperty, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getProperty, getPropertyNames, getTo, getXmlns, hashCode, nextID, removeExtension, setDefaultXmlns, setError, setFrom, setPacketID, setProperty, setTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PubSub

public PubSub()
Method Detail

getElementName

public java.lang.String getElementName()
Returns the XML element name of the extension sub-packet root element.

Returns:
the XML element name of the packet extension.

getNamespace

public java.lang.String getNamespace()
Returns the XML namespace of the extension sub-packet root element. According the specification the namespace is http://jabber.org/protocol/pubsub with a specific fragment depending on the request. The namespace is defined at XMPP Registrar at The default value has no fragment.

Returns:
the XML namespace of the packet extension.

setPubSubNamespace

public void setPubSubNamespace(PubSubNamespace ns)
Set the namespace for the packet if it something other than the default case of PubSubNamespace.BASIC. The getNamespace() method will return the result of calling PubSubNamespace.getXmlns() on the specified enum.

Parameters:
ns - - The new value for the namespace.

getExtension

public PacketExtension getExtension(PubSubElementType elem)

getPubSubNamespace

public PubSubNamespace getPubSubNamespace()
Returns the current value of the namespace. The getNamespace() method will return the result of calling PubSubNamespace.getXmlns() this value.

Returns:
The current value of the namespace.

getChildElementXML

public java.lang.String getChildElementXML()
Returns the XML representation of a pubsub element according the specification. The XML representation will be inside of an iq packet like in the following example:
 <iq type='set' id="MlIpV-4" to="pubsub.gato.home" from="gato3@gato.home/Smack">
     <pubsub xmlns="http://jabber.org/protocol/pubsub">
                      :
         Specific request extension
                      :
     </pubsub>
 </iq>
 

Specified by:
getChildElementXML in class IQ
Returns:
the child element section of the IQ XML.

Smack

Copyright © 2003-2007 Jive Software.