|
Openfire 3.3.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jivesoftware.openfire.interceptor.PacketCopier
public class PacketCopier
Packet interceptor that notifies of packets activity to components that previously subscribed to the notificator. Notifications to components will be made using a Message sent to the component itself. The Message will include an extension that will contain the intercepted packet as well as extra information such us incoming and processed.
Method Summary | |
---|---|
void |
addSubscriber(JID componentJID,
Component component,
boolean iqEnabled,
boolean messageEnabled,
boolean presenceEnabled,
boolean incoming,
boolean processed)
Creates new subscription for the specified component with the specified settings. |
void |
componentInfoReceived(Component component,
IQ iq)
The server has received a disco#info response from the component. |
void |
componentRegistered(Component component,
JID componentJID)
A component was registered with the Component Manager. |
void |
componentUnregistered(Component component,
JID componentJID)
A component was removed. |
static PacketCopier |
getInstance()
Returns unique instance of this class. |
void |
interceptPacket(Packet packet,
Session session,
boolean incoming,
boolean processed)
Invokes the interceptor on the specified packet. |
void |
removeSubscriber(JID componentJID)
Removes the subscription of the specified component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static PacketCopier getInstance()
public void addSubscriber(JID componentJID, Component component, boolean iqEnabled, boolean messageEnabled, boolean presenceEnabled, boolean incoming, boolean processed)
componentJID
- the address of the component connected to the server.component
- the component that will be notified of packet activity.iqEnabled
- true if interested in IQ packets of any type.messageEnabled
- true if interested in Message packets.presenceEnabled
- true if interested in Presence packets.incoming
- true if interested in incoming traffic. false means outgoing.processed
- true if want to be notified after packets were processed.public void removeSubscriber(JID componentJID)
componentJID
- the address of the component connected to the server.public void interceptPacket(Packet packet, Session session, boolean incoming, boolean processed) throws PacketRejectedException
PacketInterceptor
An exception can only be thrown when processed is false which means that the read packet has not been processed yet or the packet was not sent yet. If the exception is thrown with a "read" packet then the sender of the packet will receive an answer with an error. But if the exception is thrown with a "sent" packet then nothing will happen.
Note that for each packet, every interceptor will be called twice: once before processing is complete (processing==true) and once after processing is complete. Typically, an interceptor will want to ignore one or the other case.
interceptPacket
in interface PacketInterceptor
packet
- the packet to take action on.session
- the session that received or is sending the packet.incoming
- flag that indicates if the packet was read by the server or sent from
the server.processed
- flag that indicates if the action (read/send) was performed. (PRE vs. POST).
PacketRejectedException
- if the packet should be prevented from being processed.public void componentInfoReceived(Component component, IQ iq)
ComponentEventListener
componentInfoReceived
in interface ComponentEventListener
component
- the component that answered the disco#info request.iq
- the IQ packet with the disco#info sent by the component.public void componentRegistered(Component component, JID componentJID)
ComponentEventListener
componentRegistered
in interface ComponentEventListener
component
- the newly added component.componentJID
- address where the component can be located (e.g. search.myserver.com)public void componentUnregistered(Component component, JID componentJID)
ComponentEventListener
componentUnregistered
in interface ComponentEventListener
component
- the removed component.componentJID
- address where the component was located (e.g. search.myserver.com)
|
Openfire 3.3.3 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |