Package org.jivesoftware.smackx.pep
Class PepManager
- java.lang.Object
-
- org.jivesoftware.smack.Manager
-
- org.jivesoftware.smackx.pep.PepManager
-
public final class PepManager extends 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <E extends ExtensionElement>
booleanaddPepEventListener(java.lang.String node, java.lang.Class<E> extensionElementType, PepEventListener<E> pepEventListener)
boolean
addPepListener(PepListener pepListener)
Deprecated.useaddPepEventListener(String, Class, PepEventListener)
instead.static PepManager
getInstanceFor(XMPPConnection connection)
PubSubManager
getPepPubSubManager()
boolean
isSupported()
LeafNode
publish(java.lang.String nodeId, Item item)
Publish an event.boolean
removePepEventListener(PepEventListener<?> pepEventListener)
boolean
removePepListener(PepListener pepListener)
Deprecated.useremovePepEventListener(PepEventListener)
instead.-
Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
-
-
-
Method Detail
-
getInstanceFor
public static PepManager getInstanceFor(XMPPConnection connection)
-
addPepEventListener
public <E extends 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)
Deprecated.useaddPepEventListener(String, Class, PepEventListener)
instead.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)
Deprecated.useremovePepEventListener(PepEventListener)
instead.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 SmackException.NotConnectedException, java.lang.InterruptedException, SmackException.NoResponseException, 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:
SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.XMPPException.XMPPErrorException
- if there was an XMPP error returned.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 SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException, java.lang.InterruptedException
- Throws:
SmackException.NoResponseException
XMPPException.XMPPErrorException
SmackException.NotConnectedException
java.lang.InterruptedException
-
-