org.jivesoftware.smackx.pubsub
Class PubSubManager

java.lang.Object
  extended by org.jivesoftware.smackx.pubsub.PubSubManager

public final class PubSubManager
extends java.lang.Object

This is the starting point for access to the pubsub service. It will provide access to general information about the service, as well as create or retrieve pubsub Node instances. These instances provide the bulk of the functionality as defined in the pubsub specification XEP-0060.

Author:
Robin Collier

Constructor Summary
PubSubManager(org.jivesoftware.smack.XMPPConnection connection)
          Create a pubsub manager associated to the specified connection.
PubSubManager(org.jivesoftware.smack.XMPPConnection connection, java.lang.String toAddress)
          Create a pubsub manager associated to the specified connection where the pubsub requests require a specific to address for packets.
 
Method Summary
 Node createNode()
          Creates an instant node, if supported.
 Node createNode(java.lang.String id)
          Creates a node with default configuration.
 Node createNode(java.lang.String name, org.jivesoftware.smackx.Form config)
          Creates a node with specified configuration.
 void deleteNode(java.lang.String nodeId)
          Delete the specified node
 DiscoverItems discoverNodes()
          Get all the nodes that currently exist as standard DiscoverItems.
 java.util.List<Affiliation> getAffiliations()
          Gets the affiliations on the root node.
 ConfigureForm getDefaultConfiguration()
          Returns the default settings for Node configuration.
 Node getNode(java.lang.String id)
          Retrieves the requested node, if it exists.
 java.util.List<Node> getNodes()
          Get all the nodes that currently exist.
 java.util.List<Subscription> getSubscriptions()
          Gets the subscriptions on the root node.
 DiscoverInfo getSupportedFeatures()
          Gets the supported features of the servers pubsub implementation as a standard DiscoverInfo instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PubSubManager

public PubSubManager(org.jivesoftware.smack.XMPPConnection connection)
Create a pubsub manager associated to the specified connection.

Parameters:
connection - The XMPP connection

PubSubManager

public PubSubManager(org.jivesoftware.smack.XMPPConnection connection,
                     java.lang.String toAddress)
Create a pubsub manager associated to the specified connection where the pubsub requests require a specific to address for packets.

Parameters:
connection - The XMPP connection
toAddress - The pubsub specific to address (required for some servers)
Method Detail

createNode

public Node createNode()
                throws org.jivesoftware.smack.XMPPException
Creates an instant node, if supported.

Returns:
The node that was created
Throws:
org.jivesoftware.smack.XMPPException

createNode

public Node createNode(java.lang.String id)
                throws org.jivesoftware.smack.XMPPException
Creates a node with default configuration.

Parameters:
id - The id of the node, which must be unique within the pubsub service
Returns:
The node that was created
Throws:
org.jivesoftware.smack.XMPPException

createNode

public Node createNode(java.lang.String name,
                       org.jivesoftware.smackx.Form config)
                throws org.jivesoftware.smack.XMPPException
Creates a node with specified configuration.

Parameters:
name - The name of the node, which must be unique within the pubsub service
config - The configuration for the node
Returns:
The node that was created
Throws:
org.jivesoftware.smack.XMPPException

getNode

public Node getNode(java.lang.String id)
             throws org.jivesoftware.smack.XMPPException
Retrieves the requested node, if it exists. It will throw an exception if it does not.

Parameters:
id - - The unique id of the node
Returns:
the node
Throws:
org.jivesoftware.smack.XMPPException - The node does not exist

getNodes

public java.util.List<Node> getNodes()
                              throws org.jivesoftware.smack.XMPPException
Get all the nodes that currently exist.

Returns:
Collection of nodes
Throws:
org.jivesoftware.smack.XMPPException

discoverNodes

public DiscoverItems discoverNodes()
                            throws org.jivesoftware.smack.XMPPException
Get all the nodes that currently exist as standard DiscoverItems.

Returns:
DiscoverItems representing the existing nodes
Throws:
org.jivesoftware.smack.XMPPException

getSubscriptions

public java.util.List<Subscription> getSubscriptions()
                                              throws org.jivesoftware.smack.XMPPException
Gets the subscriptions on the root node.

Returns:
List of exceptions
Throws:
org.jivesoftware.smack.XMPPException

getAffiliations

public java.util.List<Affiliation> getAffiliations()
                                            throws org.jivesoftware.smack.XMPPException
Gets the affiliations on the root node.

Returns:
List of affiliations
Throws:
org.jivesoftware.smack.XMPPException

deleteNode

public void deleteNode(java.lang.String nodeId)
                throws org.jivesoftware.smack.XMPPException
Delete the specified node

Parameters:
nodeId -
Throws:
org.jivesoftware.smack.XMPPException

getDefaultConfiguration

public ConfigureForm getDefaultConfiguration()
                                      throws org.jivesoftware.smack.XMPPException
Returns the default settings for Node configuration.

Returns:
configuration form containing the default settings.
Throws:
org.jivesoftware.smack.XMPPException

getSupportedFeatures

public DiscoverInfo getSupportedFeatures()
                                  throws org.jivesoftware.smack.XMPPException
Gets the supported features of the servers pubsub implementation as a standard DiscoverInfo instance.

Returns:
The supported features
Throws:
org.jivesoftware.smack.XMPPException