|
Openfire 3.6.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.openfire.container.BasicModule org.jivesoftware.openfire.pubsub.PubSubModule
public class PubSubModule
Module that implements JEP-60: Publish-Subscribe. By default node collections and instant nodes are supported.
Constructor Summary | |
---|---|
PubSubModule()
|
Method Summary | |
---|---|
void |
addNode(Node node)
Adds an already persistent node to the service. |
void |
addSysadmin(String userJID)
|
void |
addUserAllowedToCreate(String userJID)
|
void |
broadcast(Node node,
Message message,
Collection<JID> jids)
Broadcasts the specified Message containing an event notification to a list of subscribers to the specified node. |
boolean |
canCreateNode(JID creator)
Returns true if the pubsub service allows the specified user to create nodes. |
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. |
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. |
XDataFormImpl |
getExtendedInfo(String name,
String node,
JID senderJID)
Returns an XDataForm with the extended information about the entity or null if none. |
Iterator<String> |
getFeatures(String name,
String node,
JID senderJID)
Returns an Iterator (of String) with the supported features. |
Iterator<org.dom4j.Element> |
getIdentities(String name,
String node,
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,
JID senderJID)
Returns an Iterator (of DiscoItem) with the target entity's items or null if none. |
int |
getItemsTaskTimeout()
Returns the timeout value for the published items maintenance task. |
Queue<PublishedItem> |
getItemsToAdd()
Gets the queue that holds the items that need to be added to the database. |
Queue<PublishedItem> |
getItemsToDelete()
Gets the queue that holds the items that need to be deleted from the database. |
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. |
PublishedItemTask |
getPublishedItemTask()
Returns the published item task used for this 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(JID subscriber)
Returns the show values of the last know presence of all connected resources of the specified subscriber. |
Collection<String> |
getSysadmins()
|
Timer |
getTimer()
Returns the timer used for the maintenance process of this service. |
Collection<String> |
getUsersAllowedToCreate()
|
boolean |
hasInfo(String name,
String node,
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(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 |
joinedCluster()
Notification event indicating that this JVM is now part of a cluster. |
void |
joinedCluster(byte[] nodeID)
Notification event indicating that another JVM is now part of a cluster. |
void |
leftCluster()
Notification event indicating that this JVM is no longer part of the cluster. |
void |
leftCluster(byte[] nodeID)
Notification event indicating that another JVM is no longer part of the cluster. |
void |
markedAsSeniorClusterMember()
Notification event indicating that this JVM is now the senior cluster member. |
void |
presenceSubscriptionNotRequired(Node node,
JID user)
Requests the pubsub service to unsubscribe from the presence of the user. |
void |
presenceSubscriptionRequired(Node node,
JID user)
Requests the pubsub service to subscribe to the presence of the user. |
void |
process(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 |
queueItemToAdd(PublishedItem newItem)
Adds the item to the queue of items to add to the database. |
void |
queueItemToRemove(PublishedItem removedItem)
Adds the item to the queue of items to remove from the database. |
void |
removeNode(String nodeID)
Removes the specified node from the service. |
void |
removeSysadmin(String userJID)
|
void |
removeUserAllowedToCreate(String userJID)
|
void |
send(Packet packet)
Sends the specified packet. |
void |
sendNotification(Node node,
Message message,
JID jid)
Sends the specified Message containing an event notification to a specific subscriber of the specified node. |
void |
setItemsTaskTimeout(int timeout)
Sets the timeout value for the published items maintenance task. |
void |
setNodeCreationRestricted(boolean nodeCreationRestricted)
|
void |
setPublishedItemTask(PublishedItemTask task)
Sets the published item task used for this service. |
void |
setServiceEnabled(boolean enabled)
|
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. |
Methods inherited from class org.jivesoftware.openfire.container.BasicModule |
---|
destroy, getName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PubSubModule()
Method Detail |
---|
public void process(Packet packet)
ChannelHandler
process
in interface ChannelHandler
packet
- a packet to process.public String getServiceID()
PubSubService
getServiceID
in interface PubSubService
public boolean canCreateNode(JID creator)
PubSubService
canCreateNode
in interface PubSubService
creator
- the JID of the entity trying to create a new node.
public boolean isServiceAdmin(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
public DefaultNodeConfiguration getDefaultNodeConfiguration(boolean leafType)
PubSubService
getDefaultNodeConfiguration
in interface PubSubService
leafType
- true when requesting default configuration of leaf nodes
public Collection<String> getShowPresences(JID subscriber)
PubSubService
getShowPresences
in interface PubSubService
subscriber
- the JID of the subscriber. This is not the JID of the affiliate.
public void presenceSubscriptionNotRequired(Node node, 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, 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 void queueItemToAdd(PublishedItem newItem)
PubSubService
queueItemToAdd
in interface PubSubService
newItem
- the item to add to the database.public void queueItemToRemove(PublishedItem removedItem)
PubSubService
queueItemToRemove
in interface PubSubService
removedItem
- the item to remove from the database.public String getServiceName()
public String getServiceDomain()
public JID getAddress()
PubSubService
getAddress
in interface PubSubService
getAddress
in interface RoutableChannelHandler
public Collection<String> getUsersAllowedToCreate()
public Collection<String> getSysadmins()
public void addSysadmin(String userJID)
public void removeSysadmin(String userJID)
public boolean isNodeCreationRestricted()
public boolean isMultipleSubscriptionsEnabled()
PubSubService
isMultipleSubscriptionsEnabled
in interface PubSubService
public void setNodeCreationRestricted(boolean nodeCreationRestricted)
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 setServiceEnabled(boolean enabled)
public boolean isServiceEnabled()
setServiceEnabled(boolean)
to
enable or disable the service.
public void joinedCluster()
ClusterEventListener
XMPPServer.getNodeID()
holds the new nodeID value.
When joining the cluster as the senior cluster member the ClusterEventListener.markedAsSeniorClusterMember()
event will be sent right after this event.
At this point the CacheFactory holds clustered caches. That means that modifications to the caches will be reflected in the cluster. The clustered caches were just obtained from the cluster and no local cached data was automatically moved.
joinedCluster
in interface ClusterEventListener
public void joinedCluster(byte[] nodeID)
ClusterEventListener
At this point the CacheFactory of the new node holds clustered caches. That means that modifications to the caches of this JVM will be reflected in the cluster and in particular in the new node.
joinedCluster
in interface ClusterEventListener
nodeID
- ID of the node that joined the cluster.public void leftCluster()
ClusterEventListener
Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were this JVM belonged was marked as "old" then all nodes of that island will get the left cluster event and joined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where this JVM was the senior cluster member and when the islands met again then this JVM stopped being the senior member.
At this point the CacheFactory holds local caches. That means that modifications to the caches will only affect this JVM.
leftCluster
in interface ClusterEventListener
public void leftCluster(byte[] nodeID)
ClusterEventListener
Moreover, if we were in a "split brain" scenario (ie. separated cluster islands) and the island were the other JVM belonged was marked as "old" then all nodes of that island will get the left cluster event and joined cluster events. That means that caches will be reset and thus will need to be repopulated again with fresh data from this JVM. This also includes the case where the other JVM was the senior cluster member and when the islands met again then the other JVM stopped being the senior member.
At this point the CacheFactory of the leaving node holds local caches. That means that modifications to the caches of this JVM will not affect the leaving node but other cluster members.
leftCluster
in interface ClusterEventListener
nodeID
- ID of the node that is left the cluster.public void markedAsSeniorClusterMember()
ClusterEventListener
Moreover, in the case of a "split brain" scenario (ie. separated cluster islands) each
island will have its own senior cluster member. However, when the islands meet again there
could only be one senior cluster member so one of the senior cluster members will stop playing
that role. When that happens the JVM no longer playing that role will receive the
ClusterEventListener.leftCluster()
and ClusterEventListener.joinedCluster()
events.
markedAsSeniorClusterMember
in interface ClusterEventListener
public Iterator<DiscoServerItem> getItems()
ServerItemsProvider
getItems
in interface ServerItemsProvider
public Iterator<org.dom4j.Element> getIdentities(String name, String node, 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, 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 XDataFormImpl getExtendedInfo(String name, String node, 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 boolean hasInfo(String name, String node, 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, 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, Message message, Collection<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(Packet packet)
PubSubService
send
in interface PubSubService
packet
- the packet to send.public void sendNotification(Node node, Message message, 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.
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 Queue<PublishedItem> getItemsToAdd()
PubSubService
getItemsToAdd
in interface PubSubService
public Queue<PublishedItem> getItemsToDelete()
PubSubService
getItemsToDelete
in interface PubSubService
public AdHocCommandManager getManager()
PubSubService
getManager
in interface PubSubService
public PublishedItemTask getPublishedItemTask()
PubSubService
getPublishedItemTask
in interface PubSubService
public void setPublishedItemTask(PublishedItemTask task)
PubSubService
setPublishedItemTask
in interface PubSubService
task
- the PublishedItemTask to set for this service.public Timer getTimer()
PubSubService
getTimer
in interface PubSubService
public int getItemsTaskTimeout()
PubSubService
getItemsTaskTimeout
in interface PubSubService
public void setItemsTaskTimeout(int timeout)
PubSubService
setItemsTaskTimeout
in interface PubSubService
timeout
- the timeout value for the published items maintenance task.public void propertySet(String property, Map<String,Object> params)
PropertyEventListener
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
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.
|
Openfire 3.6.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |