public class PubSubPersistenceManager extends Object
Constructor and Description |
---|
PubSubPersistenceManager() |
Modifier and Type | Method and Description |
---|---|
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.
|
public static void createNode(Node node)
node
- The newly created node.public static void updateNode(Node node)
node
- The updated node.public static boolean removeNode(Node node)
node
- The node that is being deleted.public static void loadNodes(PubSubService service)
service
- the pubsub service that is hosting the nodes.public static void loadNode(PubSubService service, String nodeId)
service
- the pubsub service that is hosting the nodes.public static void loadSubscription(PubSubService service, Node node, String subId)
public static void saveAffiliation(Node node, NodeAffiliate affiliate, boolean create)
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.public static void removeAffiliation(Node node, NodeAffiliate affiliate)
node
- The node where the affiliation of the user was updated.affiliate
- The existing affiliation and subsription state of the user in the node.public static void saveSubscription(Node node, NodeSubscription subscription, boolean create)
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.public static void removeSubscription(NodeSubscription subscription)
subscription
- The existing subsription of the user to the node.public static void savePublishedItem(PublishedItem item)
"xmpp.pubsub.flush.max" - maximum items in the cache (-1 to disable cache) "xmpp.pubsub.flush.timer" - number of seconds between cache flushes
item
- The published item to save.public static void flushPendingItems()
public static void flushPendingItems(boolean sendToCluster)
sendToCluster
- If true, delegate to cluster members, otherwise local onlypublic static void removePublishedItem(PublishedItem item)
item
- The published item to delete.public static DefaultNodeConfiguration loadDefaultConfiguration(PubSubService service, boolean isLeafType)
service
- the default node configuration used by this pubsub service.isLeafType
- true if loading default configuration for leaf nodes.public static void createDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
service
- the default node configuration used by this pubsub service.config
- the default node configuration to create in the database.public static void updateDefaultConfiguration(PubSubService service, DefaultNodeConfiguration config)
service
- the default node configuration used by this pubsub service.config
- the default node configuration to update in the database.public static List<PublishedItem> getPublishedItems(LeafNode node)
LeafNode.getMaxPublishedItems()
.node
- the leaf node to load its published items.public static List<PublishedItem> getPublishedItems(LeafNode node, int maxRows)
LeafNode.getMaxPublishedItems()
.node
- the leaf node to load its published items.public static PublishedItem getLastPublishedItem(LeafNode node)
node
- the leaf node to load its last published items.public static PublishedItem getPublishedItem(LeafNode node, String itemID)
public static void purgeNode(LeafNode leafNode)
public static void shutdown()
Copyright © 2003-2008 Jive Software.