Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.openfire.interceptor
Class PacketCopier

    java.lang.Object
      org.jivesoftware.openfire.interceptor.PacketCopier

All Implemented Interfaces:
  ComponentEventListener, PacketInterceptor

    public class PacketCopier

extends Object
implements PacketInterceptor, ComponentEventListener

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`.

Author:
  Gaston Dombiak

Method Summary
`void` | `addSubscriber(org.xmpp.packet.JID componentJID, boolean iqEnabled, boolean messageEnabled, boolean presenceEnabled, boolean incoming, boolean processed)` Creates new subscription for the specified component with the specified settings.
`void` | `componentInfoReceived(org.xmpp.packet.IQ iq)` The server has received a disco#info response from the component.
`void` | `componentRegistered(org.xmpp.packet.JID componentJID)` A component was registered with the Component Manager.
`void` | `componentUnregistered(org.xmpp.packet.JID componentJID)` A component was removed.
`static PacketCopier` | `getInstance()` Returns unique instance of this class.
`void` | `interceptPacket(org.xmpp.packet.Packet packet, Session session, boolean incoming, boolean processed)` Invokes the interceptor on the specified packet.
`void` | `removeSubscriber(org.xmpp.packet.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

### getInstance

    public static PacketCopier getInstance()

  Returns unique instance of this class.

  Returns:
    unique instance of this class.

### addSubscriber

    public void addSubscriber(org.xmpp.packet.JID componentJID,
                              boolean iqEnabled,
                              boolean messageEnabled,
                              boolean presenceEnabled,
                              boolean incoming,
                              boolean processed)

  Creates new subscription for the specified component with the specified settings.

  Parameters:
    `componentJID` - the address of the component connected to the server.
    `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.

### removeSubscriber

    public void removeSubscriber(org.xmpp.packet.JID componentJID)

  Removes the subscription of the specified component.

  Parameters:
    `componentJID` - the address of the component connected to the server.

### interceptPacket

    public void interceptPacket(org.xmpp.packet.Packet packet,
                                Session session,
                                boolean incoming,
                                boolean processed)
                         throws PacketRejectedException

  Description copied from interface: `PacketInterceptor`
  Invokes the interceptor on the specified packet. The interceptor can either modify the packet, or throw a PacketRejectedException to block it from being sent or processed (when read).

  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.

  Specified by:
    `interceptPacket` in interface `PacketInterceptor`
  Parameters:
    `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).
  Throws:
    `PacketRejectedException` - if the packet should be prevented from being processed.

### componentInfoReceived

    public void componentInfoReceived(org.xmpp.packet.IQ iq)

  Description copied from interface: `ComponentEventListener`
  The server has received a disco#info response from the component. Once a component is registered with the server, the server will send a disco#info request to the component to discover if service discover is supported by the component. This event is triggered when the server received the response of the component.

  Specified by:
    `componentInfoReceived` in interface `ComponentEventListener`
  Parameters:
    `iq` - the IQ packet with the disco#info sent by the component.

### componentRegistered

    public void componentRegistered(org.xmpp.packet.JID componentJID)

  Description copied from interface: `ComponentEventListener`
  A component was registered with the Component Manager. At this point the component has been intialized and started. XMPP entities can exchange packets with the component. However, the component is still not listed as a disco#items of the server since the component has not answered the disco#info request sent by the server.

  Specified by:
    `componentRegistered` in interface `ComponentEventListener`
  Parameters:
    `componentJID` - address where the component can be located (e.g. search.myserver.com)

### componentUnregistered

    public void componentUnregistered(org.xmpp.packet.JID componentJID)

  Description copied from interface: `ComponentEventListener`
  A component was removed. This means that no other cluster node has this component and this was the last connection of the component.

  Specified by:
    `componentUnregistered` in interface `ComponentEventListener`
  Parameters:
    `componentJID` - address where the component was located (e.g. search.myserver.com)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.