|
Openfire 3.3.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.openfire.container.BasicModule
org.jivesoftware.openfire.IQRouter
public class IQRouter
Routes iq packets throughout the server. Routing is based on the recipient and sender addresses. The typical packet will often be routed twice, once from the sender to some internal server component for handling or processing, and then back to the router to be delivered to it's final destination.
Constructor Summary | |
---|---|
IQRouter()
Creates a packet router. |
Method Summary | |
---|---|
void |
addHandler(IQHandler handler)
Adds a new IQHandler to the list of registered handler. |
void |
addIQResultListener(String id,
IQResultListener listener)
Adds an IQResultListener that will be invoked when an IQ result is sent to the
server itself and is of type result or error. |
void |
initialize(XMPPServer server)
Initializes the basic module. |
void |
removeHandler(IQHandler handler)
Removes an IQHandler from the list of registered handler. |
void |
route(IQ packet)
Performs the actual packet routing. |
Methods inherited from class org.jivesoftware.openfire.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 |
---|
public IQRouter()
Method Detail |
---|
public void route(IQ packet)
Performs the actual packet routing.
You routing is considered 'quick' and implementations may not take excessive amounts of time to complete the routing. If routing will take a long amount of time, the actual routing should be done in another thread so this method returns quickly.
Be careful to enforce concurrency DbC of concurrent by synchronizing any accesses to class resources.
packet
- The packet to route
NullPointerException
- If the packet is nullpublic void addHandler(IQHandler handler)
Adds a new IQHandler to the list of registered handler. The new IQHandler will be responsible for handling IQ packet whose namespace matches the namespace of the IQHandler.
An IllegalArgumentException may be thrown if the IQHandler to register was already provided by the server. The server provides a certain list of IQHandlers when the server is started up.
handler
- the IQHandler to add to the list of registered handler.public void removeHandler(IQHandler handler)
Removes an IQHandler from the list of registered handler. The IQHandler to remove was responsible for handling IQ packet whose namespace matches the namespace of the IQHandler.
An IllegalArgumentException may be thrown if the IQHandler to remove was already provided by the server. The server provides a certain list of IQHandlers when the server is started up.
handler
- the IQHandler to remove from the list of registered handler.public void addIQResultListener(String id, IQResultListener listener)
IQResultListener
that will be invoked when an IQ result is sent to the
server itself and is of type result or error. This is a nice way for the server to
send IQ packets to other XMPP entities and be waked up when a response is received back.Once an IQ result was received, the listener will be invoked and removed from the list of listeners.
id
- the id of the IQ packet being sent from the server to an XMPP entity.listener
- the IQResultListener that will be invoked when an answer is receivedpublic 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.
|
Openfire 3.3.0 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |