Package rocks.xmpp.extensions.reach
Class ReachabilityManager
- java.lang.Object
-
- rocks.xmpp.core.stanza.AbstractIQHandler
-
- rocks.xmpp.extensions.reach.ReachabilityManager
-
- All Implemented Interfaces:
ExtensionProtocol
,InboundMessageHandler
,InboundPresenceHandler
,IQHandler
,OutboundPresenceHandler
,DiscoverableInfo
public final class ReachabilityManager extends AbstractIQHandler implements InboundPresenceHandler, OutboundPresenceHandler, InboundMessageHandler, ExtensionProtocol, DiscoverableInfo
Allows to query for reachability addresses of another contact, automatically responds to reachability queries and notifies Consumers, when the reachability of a contact has changed either via presence or PEP.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addReachabilityAddress(Address address)
Adds a reachability address.void
addReachabilityListener(Consumer<ReachabilityEvent> reachabilityListener)
Adds a reachability listener, which allows to listen for reachability updates.Set<String>
getFeatures()
Gets the features.String
getNamespace()
The protocol's main namespace.List<Address>
getReachabilityAddresses()
Gets the reachability address as unmodifiable list.void
handleInboundMessage(MessageEvent e)
Handles an inbound message.void
handleInboundPresence(PresenceEvent e)
Handles an inbound presence.void
handleOutboundPresence(PresenceEvent e)
Handles an outbound presence.boolean
isEnabled()
Indicates whether this protocol is enabled.boolean
removeReachabilityAddress(Address address)
Removes a reachability address.void
removeReachabilityListener(Consumer<ReachabilityEvent> reachabilityListener)
Removes a previously added reachability listener.AsyncResult<List<Address>>
requestReachabilityAddresses(Jid contact)
Requests the reachability addresses of a contact.-
Methods inherited from class rocks.xmpp.core.stanza.AbstractIQHandler
getPayloadClass, handleRequest
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface rocks.xmpp.extensions.disco.model.info.DiscoverableInfo
getExtensions, getIdentities
-
-
-
-
Method Detail
-
getReachabilityAddresses
public List<Address> getReachabilityAddresses()
Gets the reachability address as unmodifiable list.- Returns:
- The reachability addresses.
-
addReachabilityAddress
public boolean addReachabilityAddress(Address address)
Adds a reachability address.- Parameters:
address
- The reachability address.- Returns:
- True, if the address was added.
- See Also:
removeReachabilityAddress(Address)
-
removeReachabilityAddress
public boolean removeReachabilityAddress(Address address)
Removes a reachability address.- Parameters:
address
- The reachability address.- Returns:
- True, if the address was removed.
- See Also:
addReachabilityAddress(Address)
-
addReachabilityListener
public void addReachabilityListener(Consumer<ReachabilityEvent> reachabilityListener)
Adds a reachability listener, which allows to listen for reachability updates.- Parameters:
reachabilityListener
- The listener.- See Also:
removeReachabilityListener(Consumer)
-
removeReachabilityListener
public void removeReachabilityListener(Consumer<ReachabilityEvent> reachabilityListener)
Removes a previously added reachability listener.- Parameters:
reachabilityListener
- The listener.- See Also:
addReachabilityListener(Consumer)
-
requestReachabilityAddresses
public AsyncResult<List<Address>> requestReachabilityAddresses(Jid contact)
Requests the reachability addresses of a contact.- Parameters:
contact
- The contact.- Returns:
- The async result with the reachability addresses.
-
handleInboundPresence
public final void handleInboundPresence(PresenceEvent e)
Description copied from interface:InboundPresenceHandler
Handles an inbound presence.- Specified by:
handleInboundPresence
in interfaceInboundPresenceHandler
- Parameters:
e
- The presence event.
-
handleInboundMessage
public final void handleInboundMessage(MessageEvent e)
Description copied from interface:InboundMessageHandler
Handles an inbound message.- Specified by:
handleInboundMessage
in interfaceInboundMessageHandler
- Parameters:
e
- The message event.
-
handleOutboundPresence
public final void handleOutboundPresence(PresenceEvent e)
Description copied from interface:OutboundPresenceHandler
Handles an outbound presence.- Specified by:
handleOutboundPresence
in interfaceOutboundPresenceHandler
- Parameters:
e
- The presence event.
-
getNamespace
public final String getNamespace()
Description copied from interface:ExtensionProtocol
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespace
in interfaceExtensionProtocol
- Returns:
- The main namespace.
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocol
Indicates whether this protocol is enabled.- Specified by:
isEnabled
in interfaceExtensionProtocol
- Returns:
- true, if enabled; false if disabled.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfo
Gets the features.- Specified by:
getFeatures
in interfaceDiscoverableInfo
- Returns:
- The features.
-
-