|
Openfire 3.4.3 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.handler.IQHandler org.jivesoftware.openfire.disco.IQDiscoItemsHandler
public class IQDiscoItemsHandler
IQDiscoItemsHandler is responsible for handling disco#items requests. This class holds a map with the main entities and the associated DiscoItemsProvider. We are considering the host of the recipient JIDs as main entities. It's the DiscoItemsProvider responsibility to provide the items associated with the JID's name together with any possible requested node.
For example, let's have in the entities map the following entries: "localhost" and "conference.localhost". Associated with each entry we have different DiscoItemsProvider. Now we receive a disco#items request for the following JID: "room@conference.localhost" which is a disco request for a MUC room. So IQDiscoItemsHandler will look for the DiscoItemsProvider associated with the JID's host which in this case is "conference.localhost". Once we have located the provider we will delegate to the provider the responsibility to provide the items specific to the JID's name which in this case is "room". Depending on the implementation, the items could be the list of existing occupants if that information is publicly available. Finally, after we have collected all the items provided by the provider we will add them to the reply. On the other hand, if no provider was found or the provider has no information for the requested name/node then a not-found error will be returned.
Publishing of client items is still not supported.
Field Summary | |
---|---|
static String |
NAMESPACE_DISCO_ITEMS
|
Fields inherited from class org.jivesoftware.openfire.handler.IQHandler |
---|
deliverer, sessionManager |
Constructor Summary | |
---|---|
IQDiscoItemsHandler()
|
Method Summary | |
---|---|
void |
addComponentItem(String jid,
String name)
Registers a new disco item for a component. |
void |
addComponentItem(String jid,
String node,
String name)
Registers a new disco item for a component. |
void |
addServerItemsProvider(ServerItemsProvider provider)
Adds the items provided by the new service that implements the ServerItemsProvider interface. |
Iterator<String> |
getFeatures()
Returns an Iterator (of String) with the supported features by the server. |
IQHandlerInfo |
getInfo()
Returns the handler information to help generically handle IQ packets. |
Iterator<org.dom4j.Element> |
getUserItems(String name,
JID senderJID)
Returns an Iterator (of Element) with the target entity's items or null if none. |
IQ |
handleIQ(IQ packet)
Handles the received IQ packet. |
void |
initialize(XMPPServer server)
Initializes the basic module. |
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 |
removeComponentItem(String jid)
Removes a disco item for a component that has been removed from the server. |
protected void |
removeProvider(String name)
Removes the DiscoItemsProvider related to a given entity. |
void |
removeServerItemsProvider(ServerItemsProvider provider)
Removes the provided items as a service of the service. |
void |
removeServerNodeInfoProvider(String node)
Removes the DiscoItemsProvider to use when a disco#items packet is sent to the server itself and the specified node. |
protected void |
setProvider(String name,
DiscoItemsProvider provider)
Sets that a given DiscoItemsProvider will provide the items related to a given entity. |
void |
setServerNodeInfoProvider(String node,
DiscoItemsProvider provider)
Sets the DiscoItemsProvider to use when a disco#items packet is sent to the server itself and the specified node. |
void |
start()
Starts the basic module. |
Methods inherited from class org.jivesoftware.openfire.handler.IQHandler |
---|
process |
Methods inherited from class org.jivesoftware.openfire.container.BasicModule |
---|
destroy, getName, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NAMESPACE_DISCO_ITEMS
Constructor Detail |
---|
public IQDiscoItemsHandler()
Method Detail |
---|
public IQHandlerInfo getInfo()
IQHandler
getInfo
in class IQHandler
public IQ handleIQ(IQ packet)
IQHandler
handleIQ
in class IQHandler
packet
- the IQ packet to handle.
protected void setProvider(String name, DiscoItemsProvider provider)
name
- the name of the entity.provider
- the DiscoItemsProvider that will provide the entity's items.protected void removeProvider(String name)
name
- the name of the entity.public void addServerItemsProvider(ServerItemsProvider provider)
provider
- the ServerItemsProvider that provides new server items.public void removeServerItemsProvider(ServerItemsProvider provider)
provider
- The provider that is being removed.public void setServerNodeInfoProvider(String node, DiscoItemsProvider provider)
node
- the node that the provider will handle.provider
- the DiscoItemsProvider that will handle disco#items packets sent with the
specified node.public void removeServerNodeInfoProvider(String node)
node
- the node that the provider was handling.public void addComponentItem(String jid, String name)
jid
- the jid of the component.name
- the discovered name of the component.public void addComponentItem(String jid, String node, String name)
jid
- the jid of the component.node
- the node that complements the jid address.name
- the discovered name of the component.public void removeComponentItem(String jid)
jid
- the jid of the component being removed.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 IQHandler
server
- the server hosting this module.public void start() throws IllegalStateException
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
IllegalStateException
- If start is called before initialize
successfully returnspublic Iterator<String> getFeatures()
ServerFeaturesProvider
getFeatures
in interface ServerFeaturesProvider
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<org.dom4j.Element> getUserItems(String name, JID senderJID)
UserItemsProvider
getUserItems
in interface UserItemsProvider
name
- the recipient JID's name.senderJID
- the XMPPAddress of user that sent the disco items request.
|
Openfire 3.4.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |