Class PepManager


  • public final class PepManager
    extends org.jivesoftware.smack.Manager
    Manages Personal Event Publishing (XEP-163). A PEPManager provides a high level access to PubSub personal events. It also provides an easy way to hook up custom logic when events are received from another XMPP client through PEPListeners. Use example:
       PepManager pepManager = PepManager.getInstanceFor(smackConnection);
       pepManager.addPepListener(new PepListener() {
           public void eventReceived(EntityBareJid from, EventElement event, Message message) {
               LOGGER.debug("Event received: " + event);
           }
       });
     
    • Method Detail

      • getInstanceFor

        public static PepManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)
      • addPepEventListener

        public <E extends org.jivesoftware.smack.packet.ExtensionElement> boolean addPepEventListener​(java.lang.String node,
                                                                                                      java.lang.Class<E> extensionElementType,
                                                                                                      PepEventListener<E> pepEventListener)
      • removePepEventListener

        public boolean removePepEventListener​(PepEventListener<?> pepEventListener)
      • getPepPubSubManager

        public PubSubManager getPepPubSubManager()
      • addPepListener

        @Deprecated
        public boolean addPepListener​(PepListener pepListener)
        Adds a listener to PEPs. The listener will be fired anytime PEP events are received from remote XMPP clients.
        Parameters:
        pepListener - a roster exchange listener.
        Returns:
        true if pepListener was added.
      • removePepListener

        @Deprecated
        public boolean removePepListener​(PepListener pepListener)
        Removes a listener from PEP events.
        Parameters:
        pepListener - a roster exchange listener.
        Returns:
        true, if pepListener was removed.
      • publish

        public LeafNode publish​(java.lang.String nodeId,
                                Item item)
                         throws org.jivesoftware.smack.SmackException.NotConnectedException,
                                java.lang.InterruptedException,
                                org.jivesoftware.smack.SmackException.NoResponseException,
                                org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                PubSubException.NotALeafNodeException
        Publish an event.
        Parameters:
        nodeId - the ID of the node to publish on.
        item - the item to publish.
        Returns:
        the leaf node the item was published on.
        Throws:
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        PubSubException.NotALeafNodeException - if a PubSub leaf node operation was attempted on a non-leaf node.
      • isSupported

        public boolean isSupported()
                            throws org.jivesoftware.smack.SmackException.NoResponseException,
                                   org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                   org.jivesoftware.smack.SmackException.NotConnectedException,
                                   java.lang.InterruptedException
        Throws:
        org.jivesoftware.smack.SmackException.NoResponseException
        org.jivesoftware.smack.XMPPException.XMPPErrorException
        org.jivesoftware.smack.SmackException.NotConnectedException
        java.lang.InterruptedException