Wildfire 3.2.4 Javadoc

org.jivesoftware.wildfire.disco
Class IQDiscoInfoHandler

java.lang.Object
  extended by org.jivesoftware.wildfire.container.BasicModule
      extended by org.jivesoftware.wildfire.handler.IQHandler
          extended by org.jivesoftware.wildfire.disco.IQDiscoInfoHandler
All Implemented Interfaces:
ChannelHandler, Module

public class IQDiscoInfoHandler
extends IQHandler

IQDiscoInfoHandler is responsible for handling disco#info requests. This class holds a map with the main entities and the associated DiscoInfoProvider. We are considering the host of the recipient JIDs as main entities. It's the DiscoInfoProvider responsibility to provide information about 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 DiscoInfoProviders. Now we receive a disco#info request for the following JID: "room@conference.localhost" which is a disco request for a MUC room. So IQDiscoInfoHandler will look for the DiscoInfoProvider 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 info specific to the JID's name which in this case is "room". Among the information that a room could provide we could find its identity and the features it supports (e.g. 'muc_passwordprotected', 'muc_unmoderated', etc.). Finally, after we have collected all the information provided by the provider we will add it 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.

Author:
Gaston Dombiak

Field Summary
 
Fields inherited from class org.jivesoftware.wildfire.handler.IQHandler
deliverer, sessionManager
 
Constructor Summary
IQDiscoInfoHandler()
           
 
Method Summary
 boolean addServerFeature(String namespace)
          Adds one specific feature to the information returned whenever a disco for information is made against the server.
 IQHandlerInfo getInfo()
          Returns the handler information to help generically handle IQ packets.
 IQ handleIQ(IQ packet)
          Handles the received IQ packet.
 void initialize(XMPPServer server)
          Initializes the basic module.
protected  void removeProvider(String name)
          Removes the DiscoInfoProvider related to a given entity.
 void removeServerFeature(String namespace)
          Removes a feature from the information returned whenever a disco for information is made against the server.
 void removeServerNodeInfoProvider(String node)
          Removes the DiscoInfoProvider to use when a disco#info packet is sent to the server itself and the specified node.
protected  void setProvider(String name, DiscoInfoProvider provider)
          Sets that a given DiscoInfoProvider will provide information about a given entity.
 void setServerNodeInfoProvider(String node, DiscoInfoProvider provider)
          Sets the DiscoInfoProvider to use when a disco#info packet is sent to the server itself and the specified node.
 
Methods inherited from class org.jivesoftware.wildfire.handler.IQHandler
process
 
Methods inherited from class org.jivesoftware.wildfire.container.BasicModule
destroy, getName, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IQDiscoInfoHandler

public IQDiscoInfoHandler()
Method Detail

getInfo

public IQHandlerInfo getInfo()
Description copied from class: IQHandler
Returns the handler information to help generically handle IQ packets. IQHandlers that aren't local server iq handlers (e.g. chatbots, transports, etc) return null.

Specified by:
getInfo in class IQHandler
Returns:
The IQHandlerInfo for this handler

handleIQ

public IQ handleIQ(IQ packet)
Description copied from class: IQHandler
Handles the received IQ packet.

Specified by:
handleIQ in class IQHandler
Parameters:
packet - the IQ packet to handle.
Returns:
the response to send back.

setServerNodeInfoProvider

public void setServerNodeInfoProvider(String node,
                                      DiscoInfoProvider provider)
Sets the DiscoInfoProvider to use when a disco#info packet is sent to the server itself and the specified node. For instance, if node matches "http://jabber.org/protocol/offline" then a special DiscoInfoProvider should be use to return information about offline messages.

Parameters:
node - the node that the provider will handle.
provider - the DiscoInfoProvider that will handle disco#info packets sent with the specified node.

removeServerNodeInfoProvider

public void removeServerNodeInfoProvider(String node)
Removes the DiscoInfoProvider to use when a disco#info packet is sent to the server itself and the specified node.

Parameters:
node - the node that the provider was handling.

setProvider

protected void setProvider(String name,
                           DiscoInfoProvider provider)
Sets that a given DiscoInfoProvider will provide information about a given entity. This message must be used when new modules (e.g. MUC) are implemented and need to provide information about them.

Parameters:
name - the name of the entity.
provider - the DiscoInfoProvider that will provide the entity's information.

removeProvider

protected void removeProvider(String name)
Removes the DiscoInfoProvider related to a given entity.

Parameters:
name - the name of the entity.

addServerFeature

public boolean addServerFeature(String namespace)
Adds one specific feature to the information returned whenever a disco for information is made against the server.

Parameters:
namespace - the namespace identifying the new server feature.
Returns:
true if the new feature was successfully added.

removeServerFeature

public void removeServerFeature(String namespace)
Removes a feature from the information returned whenever a disco for information is made against the server.

Parameters:
namespace - the namespace of the feature to be removed.

initialize

public void initialize(XMPPServer server)
Description copied from class: BasicModule

Initializes the basic module.

Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.

Specified by:
initialize in interface Module
Overrides:
initialize in class IQHandler
Parameters:
server - the server hosting this module.

Wildfire 3.2.4 Javadoc

Copyright © 2003-2007 Jive Software.