Openfire 3.9.3 Javadoc

org.jivesoftware.openfire.pubsub
Class PubSubPersistenceManager

java.lang.Object
  extended by org.jivesoftware.openfire.pubsub.PubSubPersistenceManager

public class PubSubPersistenceManager
extends Object

A manager responsible for ensuring node persistence.

Author:
Matt Tucker

Constructor Summary
PubSubPersistenceManager()
           
 
Method Summary
static void createDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
          Creates a new default node configuration for the specified service.
static void createNode(Node node)
          Creates and stores the node configuration in the database.
static void flushPendingItems()
          Flush the cache(s) of items to be persisted (itemsToAdd) and deleted (itemsToDelete).
static void flushPendingItems(boolean sendToCluster)
          Flush the cache(s) of items to be persisted (itemsToAdd) and deleted (itemsToDelete).
static PublishedItem getLastPublishedItem(LeafNode node)
          Fetches the last published item for the specified node.
static PublishedItem getPublishedItem(LeafNode node, String itemID)
           
static List<PublishedItem> getPublishedItems(LeafNode node)
          Fetches all the results for the specified node, limited by LeafNode.getMaxPublishedItems().
static List<PublishedItem> getPublishedItems(LeafNode node, int maxRows)
          Fetches all the results for the specified node, limited by LeafNode.getMaxPublishedItems().
static DefaultNodeConfiguration loadDefaultConfiguration(PubSubService service, boolean isLeafType)
          Loads from the database the default node configuration for the specified node type and pubsub service.
static void loadNode(PubSubService service, String nodeId)
          Loads all nodes from the database and adds them to the PubSub service.
static void loadNodes(PubSubService service)
          Loads all nodes from the database and adds them to the PubSub service.
static void loadSubscription(PubSubService service, Node node, String subId)
           
static void purgeNode(LeafNode leafNode)
           
static void removeAffiliation(Node node, NodeAffiliate affiliate)
          Removes the affiliation and subsription state of the user from the DB.
static boolean removeNode(Node node)
          Removes the specified node from the DB.
static void removePublishedItem(PublishedItem item)
          Removes the specified published item from the DB.
static void removeSubscription(NodeSubscription subscription)
          Removes the subscription of the user from the DB.
static void saveAffiliation(Node node, NodeAffiliate affiliate, boolean create)
          Update the DB with the new affiliation of the user in the node.
static void savePublishedItem(PublishedItem item)
          Creates and stores the published item in the database.
static void saveSubscription(Node node, NodeSubscription subscription, boolean create)
          Updates the DB with the new subsription of the user to the node.
static void shutdown()
           
static void updateDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
          Updates the default node configuration for the specified service.
static void updateNode(Node node)
          Updates the node configuration in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PubSubPersistenceManager

public PubSubPersistenceManager()
Method Detail

createNode

public static void createNode(Node node)
Creates and stores the node configuration in the database.

Parameters:
node - The newly created node.

updateNode

public static void updateNode(Node node)
Updates the node configuration in the database.

Parameters:
node - The updated node.

removeNode

public static boolean removeNode(Node node)
Removes the specified node from the DB.

Parameters:
node - The node that is being deleted.
Returns:
true If the operation was successful.

loadNodes

public static void loadNodes(PubSubService service)
Loads all nodes from the database and adds them to the PubSub service.

Parameters:
service - the pubsub service that is hosting the nodes.

loadNode

public static void loadNode(PubSubService service,
                            String nodeId)
Loads all nodes from the database and adds them to the PubSub service.

Parameters:
service - the pubsub service that is hosting the nodes.

loadSubscription

public static void loadSubscription(PubSubService service,
                                    Node node,
                                    String subId)

saveAffiliation

public static void saveAffiliation(Node node,
                                   NodeAffiliate affiliate,
                                   boolean create)
Update the DB with the new affiliation of the user in the node.

Parameters:
node - The node where the affiliation of the user was updated.
affiliate - The new affiliation of the user in the node.
create - True if this is a new affiliate.

removeAffiliation

public static void removeAffiliation(Node node,
                                     NodeAffiliate affiliate)
Removes the affiliation and subsription state of the user from the DB.

Parameters:
node - The node where the affiliation of the user was updated.
affiliate - The existing affiliation and subsription state of the user in the node.

saveSubscription

public static void saveSubscription(Node node,
                                    NodeSubscription subscription,
                                    boolean create)
Updates the DB with the new subsription of the user to the node.

Parameters:
node - The node where the user has subscribed to.
subscription - The new subscription of the user to the node.
create - True if this is a new affiliate.

removeSubscription

public static void removeSubscription(NodeSubscription subscription)
Removes the subscription of the user from the DB.

Parameters:
subscription - The existing subsription of the user to the node.

savePublishedItem

public static void savePublishedItem(PublishedItem item)
Creates and stores the published item in the database. Note that the item will be cached temporarily before being flushed asynchronously to the database. The write cache can be tuned using the following two properties:
   "xmpp.pubsub.flush.max" - maximum items in the cache (-1 to disable cache)
   "xmpp.pubsub.flush.timer" - number of seconds between cache flushes
 

Parameters:
item - The published item to save.

flushPendingItems

public static void flushPendingItems()
Flush the cache(s) of items to be persisted (itemsToAdd) and deleted (itemsToDelete).


flushPendingItems

public static void flushPendingItems(boolean sendToCluster)
Flush the cache(s) of items to be persisted (itemsToAdd) and deleted (itemsToDelete).

Parameters:
sendToCluster - If true, delegate to cluster members, otherwise local only

removePublishedItem

public static void removePublishedItem(PublishedItem item)
Removes the specified published item from the DB.

Parameters:
item - The published item to delete.

loadDefaultConfiguration

public static DefaultNodeConfiguration loadDefaultConfiguration(PubSubService service,
                                                                boolean isLeafType)
Loads from the database the default node configuration for the specified node type and pubsub service.

Parameters:
service - the default node configuration used by this pubsub service.
isLeafType - true if loading default configuration for leaf nodes.
Returns:
the loaded default node configuration for the specified node type and service or null if none was found.

createDefaultConfiguration

public static void createDefaultConfiguration(PubSubService service,
                                              DefaultNodeConfiguration config)
Creates a new default node configuration for the specified service.

Parameters:
service - the default node configuration used by this pubsub service.
config - the default node configuration to create in the database.

updateDefaultConfiguration

public static void updateDefaultConfiguration(PubSubService service,
                                              DefaultNodeConfiguration config)
Updates the default node configuration for the specified service.

Parameters:
service - the default node configuration used by this pubsub service.
config - the default node configuration to update in the database.

getPublishedItems

public static List<PublishedItem> getPublishedItems(LeafNode node)
Fetches all the results for the specified node, limited by LeafNode.getMaxPublishedItems().

Parameters:
node - the leaf node to load its published items.

getPublishedItems

public static List<PublishedItem> getPublishedItems(LeafNode node,
                                                    int maxRows)
Fetches all the results for the specified node, limited by LeafNode.getMaxPublishedItems().

Parameters:
node - the leaf node to load its published items.

getLastPublishedItem

public static PublishedItem getLastPublishedItem(LeafNode node)
Fetches the last published item for the specified node.

Parameters:
node - the leaf node to load its last published items.

getPublishedItem

public static PublishedItem getPublishedItem(LeafNode node,
                                             String itemID)

purgeNode

public static void purgeNode(LeafNode leafNode)

shutdown

public static void shutdown()

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.