public class PubSubModule extends BasicModule implements ServerItemsProvider, DiscoInfoProvider, DiscoItemsProvider, RoutableChannelHandler, PubSubService, PropertyEventListener
Constructor and Description |
---|
PubSubModule() |
Modifier and Type | Method and Description |
---|---|
void |
addNode(Node node)
Adds an already persistent node to the service.
|
void |
addSysadmin(String userJID) |
void |
addUserAllowedToCreate(String userJID) |
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.
|
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.
|
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. |
org.xmpp.forms.DataForm |
getExtendedInfo(String name,
String node,
org.xmpp.packet.JID senderJID)
Returns an XDataForm with the extended information about the entity or null if none.
|
Set<org.xmpp.forms.DataForm> |
getExtendedInfos(String name,
String node,
org.xmpp.packet.JID senderJID)
Returns a collection of XDataForm with the extended information about the
entity or an empty collection if none.
|
Iterator<String> |
getFeatures(String name,
String node,
org.xmpp.packet.JID senderJID)
Returns an Iterator (of String) with the supported features.
|
Iterator<org.dom4j.Element> |
getIdentities(String name,
String node,
org.xmpp.packet.JID senderJID)
Returns an Iterator (of Element) with the target entity's identities.
|
Iterator<DiscoServerItem> |
getItems()
Returns an Iterator (of DiscoServerItem) with the items associated with the server or null
if none.
|
Iterator<DiscoItem> |
getItems(String name,
String node,
org.xmpp.packet.JID senderJID)
Returns an Iterator (of DiscoItem) with the target entity's items or null if none.
|
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 |
getServiceDomain() |
String |
getServiceID()
Returns a String that uniquely identifies this pubsub service.
|
String |
getServiceName() |
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.
|
Collection<String> |
getSysadmins() |
Collection<String> |
getUsersAllowedToCreate() |
boolean |
hasInfo(String name,
String node,
org.xmpp.packet.JID senderJID)
Returns true if we can provide information related to the requested name and node.
|
void |
initialize(XMPPServer server)
Initializes the basic module.
|
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.
|
boolean |
isServiceEnabled()
Returns true if the service is available.
|
void |
markedAsSeniorClusterMember() |
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 |
process(org.xmpp.packet.Packet packet)
Process an XMPP packet.
|
void |
propertyDeleted(String property,
Map<String,Object> params)
A property was deleted.
|
void |
propertySet(String property,
Map<String,Object> params)
A property was set.
|
void |
removeNode(String nodeID)
Removes the specified node from the service.
|
void |
removeSysadmin(String userJID) |
void |
removeUserAllowedToCreate(String userJID) |
void |
send(org.xmpp.packet.Packet packet)
Sends the specified packet.
|
void |
sendNotification(Node node,
org.xmpp.packet.Message message,
org.xmpp.packet.JID jid)
Sends the specified Message containing an event notification to a specific
subscriber of the specified node.
|
void |
setIQDiscoInfoHandler(IQDiscoInfoHandler iqDiscoInfoHandler) |
void |
setIQDiscoItemsHandler(IQDiscoItemsHandler iqDiscoItemsHandler) |
void |
setNodeCreationRestricted(boolean nodeCreationRestricted) |
void |
setServiceEnabled(boolean enabled) |
void |
setSysadmins(Collection<String> userJIDs) |
void |
setUserAllowedToCreate(Collection<String> userJIDs) |
void |
start()
Starts the basic module.
|
void |
stop()
Stops the basic module.
|
void |
xmlPropertyDeleted(String property,
Map<String,Object> params)
An XML property was deleted.
|
void |
xmlPropertySet(String property,
Map<String,Object> params)
An XML property was set.
|
destroy, getName
public void process(org.xmpp.packet.Packet packet)
ChannelHandler
process
in interface ChannelHandler<org.xmpp.packet.Packet>
packet
- a packet to process.public String getServiceID()
PubSubService
getServiceID
in interface PubSubService
public boolean canCreateNode(org.xmpp.packet.JID creator)
PubSubService
canCreateNode
in interface PubSubService
creator
- the JID of the entity trying to create a new node.public boolean isServiceAdmin(org.xmpp.packet.JID user)
PubSubService
isServiceAdmin
in interface PubSubService
user
- the user to check if he has admin privileges.public boolean isInstantNodeSupported()
PubSubService
isInstantNodeSupported
in interface PubSubService
public boolean isCollectionNodesSupported()
PubSubService
CollectionNode
may only hold children nodes of type CollectionNode
or LeafNode
. On the
other hand, LeafNode
can only hold PublishedItem
.isCollectionNodesSupported
in interface PubSubService
public CollectionNode getRootCollectionNode()
PubSubService
CollectionNode
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 PubSubService
null
if collection nodes is not supported.public DefaultNodeConfiguration getDefaultNodeConfiguration(boolean leafType)
PubSubService
null
if the specified node type is not supported by the service.getDefaultNodeConfiguration
in interface PubSubService
leafType
- true when requesting default configuration of leaf nodesnull
if the specified node type is not supported by the service.public Collection<String> getShowPresences(org.xmpp.packet.JID subscriber)
PubSubService
online
value. The rest of the possible show values as defined in RFC 3921.getShowPresences
in interface PubSubService
subscriber
- the JID of the subscriber. This is not the JID of the affiliate.public void presenceSubscriptionNotRequired(Node node, org.xmpp.packet.JID user)
PubSubService
presenceSubscriptionNotRequired
in interface PubSubService
node
- 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)
PubSubService
presenceSubscriptionRequired
in interface PubSubService
node
- the node that originated the subscription request.user
- the JID of the affiliate to subscribe to his presence.public String getServiceName()
public String getServiceDomain()
public org.xmpp.packet.JID getAddress()
RoutableChannelHandler
getAddress
in interface PubSubService
getAddress
in interface RoutableChannelHandler
public Collection<String> getUsersAllowedToCreate()
public Collection<String> getSysadmins()
public void setSysadmins(Collection<String> userJIDs)
public void addSysadmin(String userJID)
public void removeSysadmin(String userJID)
public boolean isNodeCreationRestricted()
public boolean isMultipleSubscriptionsEnabled()
PubSubService
subid
attribute.isMultipleSubscriptionsEnabled
in interface PubSubService
public void setNodeCreationRestricted(boolean nodeCreationRestricted)
public void setUserAllowedToCreate(Collection<String> userJIDs)
public void addUserAllowedToCreate(String userJID)
public void removeUserAllowedToCreate(String userJID)
public void initialize(XMPPServer server)
BasicModule
Initializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
initialize
in interface Module
initialize
in class BasicModule
server
- the server hosting this module.public void start()
BasicModule
Starts the basic module.
Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.
start
in interface Module
start
in class BasicModule
public void stop()
BasicModule
Stops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
stop
in interface Module
stop
in class BasicModule
public void setIQDiscoItemsHandler(IQDiscoItemsHandler iqDiscoItemsHandler)
public void setIQDiscoInfoHandler(IQDiscoInfoHandler iqDiscoInfoHandler)
public void setServiceEnabled(boolean enabled)
public boolean isServiceEnabled()
setServiceEnabled(boolean)
to
enable or disable the service.public void markedAsSeniorClusterMember()
public Iterator<DiscoServerItem> getItems()
ServerItemsProvider
getItems
in interface ServerItemsProvider
public Iterator<org.dom4j.Element> getIdentities(String name, String node, org.xmpp.packet.JID senderJID)
DiscoInfoProvider
getIdentities
in interface DiscoInfoProvider
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.public Iterator<String> getFeatures(String name, String node, org.xmpp.packet.JID senderJID)
DiscoInfoProvider
getFeatures
in interface DiscoInfoProvider
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.public org.xmpp.forms.DataForm getExtendedInfo(String name, String node, org.xmpp.packet.JID senderJID)
DiscoInfoProvider
getExtendedInfo
in interface DiscoInfoProvider
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.public Set<org.xmpp.forms.DataForm> getExtendedInfos(String name, String node, org.xmpp.packet.JID senderJID)
DiscoInfoProvider
getExtendedInfos
in interface DiscoInfoProvider
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.public boolean hasInfo(String name, String node, org.xmpp.packet.JID senderJID)
DiscoInfoProvider
hasInfo
in interface DiscoInfoProvider
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.public Iterator<DiscoItem> getItems(String name, String node, org.xmpp.packet.JID senderJID)
DiscoItemsProvider
getItems
in interface DiscoItemsProvider
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco items request.public void broadcast(Node node, org.xmpp.packet.Message message, Collection<org.xmpp.packet.JID> jids)
PubSubService
broadcast
in interface PubSubService
node
- 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 send(org.xmpp.packet.Packet packet)
PubSubService
send
in interface PubSubService
packet
- the packet to send.public void sendNotification(Node node, org.xmpp.packet.Message message, org.xmpp.packet.JID jid)
PubSubService
sendNotification
in interface PubSubService
node
- the node that triggered the event notification.message
- the message containing the event notification.jid
- the entity to get the event notification.public Node getNode(String nodeID)
PubSubService
Node
that matches the specified node ID or null
if
none was found.getNode
in interface PubSubService
nodeID
- the ID that uniquely identifies the node in the pubsub service.null
if none was found.public Collection<Node> getNodes()
PubSubService
getNodes
in interface PubSubService
public void addNode(Node node)
PubSubService
addNode
in interface PubSubService
node
- the persistent node to add to the service.public void removeNode(String nodeID)
PubSubService
A future version may support unloading of inactive nodes even though they may still exist in the database.
removeNode
in interface PubSubService
nodeID
- the ID that uniquely identifies the node in the pubsub service.public Map<String,Map<String,String>> getBarePresences()
PubSubService
getBarePresences
in interface PubSubService
public AdHocCommandManager getManager()
PubSubService
getManager
in interface PubSubService
public void propertySet(String property, Map<String,Object> params)
PropertyEventListener
params
will contain the
the value of the property under the key value
.propertySet
in interface PropertyEventListener
property
- the name of the property.params
- event parameters.public void propertyDeleted(String property, Map<String,Object> params)
PropertyEventListener
propertyDeleted
in interface PropertyEventListener
property
- the name of the property deleted.params
- event parameters.public void xmlPropertySet(String property, Map<String,Object> params)
PropertyEventListener
params
will contain the
the value of the property under the key value
.xmlPropertySet
in interface PropertyEventListener
property
- the name of the property.params
- event parameters.public void xmlPropertyDeleted(String property, Map<String,Object> params)
PropertyEventListener
xmlPropertyDeleted
in interface PropertyEventListener
property
- the name of the property.params
- event parameters.Copyright © 2003–2020 Ignite Realtime. All rights reserved.