Smack

org.jivesoftware.smackx.pubsub
Class PubSubManager

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

public final class PubSubManager
extends 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 LeafNode instances. These instances provide the bulk of the functionality as defined in the pubsub specification XEP-0060.

Author:
Robin Collier

Constructor Summary
PubSubManager(Connection connection)
          Create a pubsub manager associated to the specified connection.
PubSubManager(Connection connection, String toAddress)
          Create a pubsub manager associated to the specified connection where the pubsub requests require a specific to address for packets.
 
Method Summary
 LeafNode createNode()
          Creates an instant node, if supported.
 LeafNode createNode(String id)
          Creates a node with default configuration.
 Node createNode(String name, Form config)
          Creates a node with specified configuration.
 void deleteNode(String nodeId)
          Delete the specified node
 DiscoverItems discoverNodes(String nodeId)
          Get all the nodes that currently exist as a child of the specified collection node.
 List<Affiliation> getAffiliations()
          Gets the affiliations on the root node.
 ConfigureForm getDefaultConfiguration()
          Returns the default settings for Node configuration.
 Node getNode(String id)
          Retrieves the requested node, if it exists.
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PubSubManager

public PubSubManager(Connection connection)
Create a pubsub manager associated to the specified connection. Defaults the service name to pubsub

Parameters:
connection - The XMPP connection

PubSubManager

public PubSubManager(Connection connection,
                     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 LeafNode createNode()
                    throws XMPPException
Creates an instant node, if supported.

Returns:
The node that was created
Throws:
XMPPException

createNode

public LeafNode createNode(String id)
                    throws 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:
XMPPException

createNode

public Node createNode(String name,
                       Form config)
                throws XMPPException
Creates a node with specified configuration. Note: This is the only way to create a collection node.

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:
XMPPException

getNode

public Node getNode(String id)
             throws 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:
XMPPException - The node does not exist

discoverNodes

public DiscoverItems discoverNodes(String nodeId)
                            throws XMPPException
Get all the nodes that currently exist as a child of the specified collection node. If the service does not support collection nodes then all nodes will be returned. To retrieve contents of the root collection node (if it exists), or there is no root collection node, pass null as the nodeId.

Parameters:
nodeId - - The id of the collection node for which the child nodes will be returned.
Returns:
DiscoverItems representing the existing nodes
Throws:
XMPPException

getSubscriptions

public List<Subscription> getSubscriptions()
                                    throws XMPPException
Gets the subscriptions on the root node.

Returns:
List of exceptions
Throws:
XMPPException

getAffiliations

public List<Affiliation> getAffiliations()
                                  throws XMPPException
Gets the affiliations on the root node.

Returns:
List of affiliations
Throws:
XMPPException

deleteNode

public void deleteNode(String nodeId)
                throws XMPPException
Delete the specified node

Parameters:
nodeId -
Throws:
XMPPException

getDefaultConfiguration

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

Returns:
configuration form containing the default settings.
Throws:
XMPPException

getSupportedFeatures

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

Returns:
The supported features
Throws:
XMPPException

Smack

Copyright © 2003-2007 Jive Software.