public class PEPService extends Object implements PubSubService, Cacheable
PubSubService for use with XEP-0163: "Personal Eventing via
Pubsub" Version 1.0
Note: Although this class implements Cacheable, instances should only be
cached in caches that have time-based (as opposed to size-based) eviction policies.| Constructor and Description |
|---|
PEPService(XMPPServer server,
String bareJID)
Constructs a PEPService.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNode(Node node)
Adds an already persistent node to the service.
|
void |
broadcast(Node node,
org.xmpp.packet.Message message,
Collection<org.xmpp.packet.JID> jids)
Broadcasts the specified Message containing an event notification to a list
of subscribers to the specified node.
|
boolean |
canCreateNode(org.xmpp.packet.JID creator)
Returns true if the pubsub service allows the specified user to create nodes.
|
org.xmpp.packet.JID |
getAddress()
Returns the XMPP address of the service.
|
Map<String,Map<String,String>> |
getBarePresences()
Returns a registry of the presence's show value of users that subscribed to a node of
the pubsub service and for which the node only delivers notifications for online users
or node subscriptions deliver events based on the user presence show value.
|
int |
getCachedSize()
Returns the approximate size of the Object in bytes.
|
DefaultNodeConfiguration |
getDefaultNodeConfiguration(boolean leafType)
Returns the default node configuration for the specified node type or null
if the specified node type is not supported by the service.
|
AdHocCommandManager |
getManager()
Returns the ad-hoc commands manager used for this service.
|
Node |
getNode(String nodeID)
Returns the
Node that matches the specified node ID or null if
none was found. |
Collection<Node> |
getNodes()
Retuns the collection of nodes hosted by the pubsub service.
|
CollectionNode |
getRootCollectionNode()
Returns the
CollectionNode that acts as the root node of the entire
node hierarchy. |
String |
getServiceID()
Returns a String that uniquely identifies this pubsub service.
|
Collection<String> |
getShowPresences(org.xmpp.packet.JID subscriber)
Returns the show values of the last know presence of all connected resources of the
specified subscriber.
|
boolean |
isCollectionNodesSupported()
Returns true if the pubsub service supports collection nodes.
|
boolean |
isInstantNodeSupported()
Returns true if the pubsub service allows users to create nodes without specifying
the node ID.
|
boolean |
isMultipleSubscriptionsEnabled()
Returns true if a user may have more than one subscription with the node.
|
boolean |
isNodeCreationRestricted() |
boolean |
isServiceAdmin(org.xmpp.packet.JID user)
Returns true if the specified user is a sysadmin of the pubsub service or has
admin privileges.
|
void |
presenceSubscriptionNotRequired(Node node,
org.xmpp.packet.JID user)
Requests the pubsub service to unsubscribe from the presence of the user.
|
void |
presenceSubscriptionRequired(Node node,
org.xmpp.packet.JID user)
Requests the pubsub service to subscribe to the presence of the user.
|
void |
removeNode(String nodeID)
Removes the specified node from the service.
|
void |
send(org.xmpp.packet.Packet packet)
Sends the specified packet.
|
void |
sendLastPublishedItems(org.xmpp.packet.JID recipientJID)
Sends an event notification for the last published item of each leaf node under the
root collection node to the recipient JID.
|
void |
sendNotification(Node node,
org.xmpp.packet.Message message,
org.xmpp.packet.JID recipientJID)
Sends the specified Message containing an event notification to a specific
subscriber of the specified node.
|
public PEPService(XMPPServer server, String bareJID)
server - the XMPP server.bareJID - the bare JID (service ID) of the user owning the service.public void addNode(Node node)
PubSubServiceaddNode in interface PubSubServicenode - the persistent node to add to the service.public void removeNode(String nodeID)
PubSubServiceA future version may support unloading of inactive nodes even though they may still exist in the database.
removeNode in interface PubSubServicenodeID - the ID that uniquely identifies the node in the pubsub service.public Node getNode(String nodeID)
PubSubServiceNode that matches the specified node ID or null if
none was found.getNode in interface PubSubServicenodeID - the ID that uniquely identifies the node in the pubsub service.public Collection<Node> getNodes()
PubSubServicegetNodes in interface PubSubServicepublic CollectionNode getRootCollectionNode()
PubSubServiceCollectionNode that acts as the root node of the entire
node hierarchy. The returned node does not have a node identifier. If collection
nodes is not supported then return null.getRootCollectionNode in interface PubSubServicepublic org.xmpp.packet.JID getAddress()
PubSubServicegetAddress in interface PubSubServicepublic String getServiceID()
PubSubServicegetServiceID in interface PubSubServicepublic DefaultNodeConfiguration getDefaultNodeConfiguration(boolean leafType)
PubSubServicegetDefaultNodeConfiguration in interface PubSubServiceleafType - true when requesting default configuration of leaf nodespublic Collection<String> getShowPresences(org.xmpp.packet.JID subscriber)
PubSubServicegetShowPresences in interface PubSubServicesubscriber - the JID of the subscriber. This is not the JID of the affiliate.public boolean canCreateNode(org.xmpp.packet.JID creator)
PubSubServicecanCreateNode in interface PubSubServicecreator - the JID of the entity trying to create a new node.public boolean isCollectionNodesSupported()
PubSubServiceCollectionNode
may only hold children nodes of type CollectionNode or LeafNode. On the
other hand, LeafNode can only hold PublishedItem.isCollectionNodesSupported in interface PubSubServicepublic boolean isInstantNodeSupported()
PubSubServiceisInstantNodeSupported in interface PubSubServicepublic boolean isMultipleSubscriptionsEnabled()
PubSubServiceisMultipleSubscriptionsEnabled in interface PubSubServicepublic boolean isServiceAdmin(org.xmpp.packet.JID user)
PubSubServiceisServiceAdmin in interface PubSubServiceuser - the user to check if he has admin privileges.public boolean isNodeCreationRestricted()
public void presenceSubscriptionNotRequired(Node node, org.xmpp.packet.JID user)
PubSubServicepresenceSubscriptionNotRequired in interface PubSubServicenode - the node that originated the unsubscription request.user - the JID of the affiliate to unsubscribe from his presence.public void presenceSubscriptionRequired(Node node, org.xmpp.packet.JID user)
PubSubServicepresenceSubscriptionRequired in interface PubSubServicenode - the node that originated the subscription request.user - the JID of the affiliate to subscribe to his presence.public void send(org.xmpp.packet.Packet packet)
PubSubServicesend in interface PubSubServicepacket - the packet to send.public void broadcast(Node node, org.xmpp.packet.Message message, Collection<org.xmpp.packet.JID> jids)
PubSubServicebroadcast in interface PubSubServicenode - the node that triggered the event notification.message - the message containing the event notification.jids - the list of entities to get the event notification.public void sendNotification(Node node, org.xmpp.packet.Message message, org.xmpp.packet.JID recipientJID)
PubSubServicesendNotification in interface PubSubServicenode - the node that triggered the event notification.message - the message containing the event notification.recipientJID - the entity to get the event notification.public void sendLastPublishedItems(org.xmpp.packet.JID recipientJID)
Depending on the subscription configuration the event notifications may or may not have a payload, may not be sent if a keyword (i.e. filter) was defined and it was not matched.
recipientJID - the recipient that is to receive the last published item notifications.public Map<String,Map<String,String>> getBarePresences()
PubSubServicegetBarePresences in interface PubSubServicepublic AdHocCommandManager getManager()
PubSubServicegetManager in interface PubSubServicepublic int getCachedSize()
CacheablegetCachedSize in interface CacheableCopyright © 2003-2008 Jive Software.