Package rocks.xmpp.extensions.sm
Class AbstractStreamManager
- java.lang.Object
-
- rocks.xmpp.extensions.sm.AbstractStreamManager
-
- All Implemented Interfaces:
ExtensionProtocol
,StreamFeatureNegotiator<StreamManagement>
,DiscoverableInfo
- Direct Known Subclasses:
ClientStreamManager
public abstract class AbstractStreamManager extends Object implements StreamFeatureNegotiator<StreamManagement>, ExtensionProtocol, DiscoverableInfo
Contains stream management logic which is shared between clients and servers.- See Also:
- XEP-0198: Stream Management
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getFeatures()
Gets the features.String
getNamespace()
The protocol's main namespace.Predicate<Stanza>
getRequestStrategy()
Gets the request strategy.void
incrementInboundStanzaCount()
Increments the inbound stanza count.boolean
isEnabled()
Indicates whether this protocol is enabled.void
markUnacknowledged(Stanza stanza)
Marks a stanza as unacknowledged.StreamNegotiationResult
processNegotiation(Object element)
Processes a feature protocol element or the feature element itself.void
setEnabled(boolean enabled)
void
setRequestStrategy(Predicate<Stanza> requestStrategy)
Sets the request strategy.-
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
-
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.
-
setEnabled
public final void setEnabled(boolean enabled)
-
getRequestStrategy
public final Predicate<Stanza> getRequestStrategy()
Gets the request strategy.- Returns:
- The request strategy.
- See Also:
RequestStrategies
-
setRequestStrategy
public final void setRequestStrategy(Predicate<Stanza> requestStrategy)
Sets the request strategy.- Parameters:
requestStrategy
- The request strategy.- See Also:
RequestStrategies
-
getNamespace
public final String getNamespace()
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespace
in interfaceExtensionProtocol
- Returns:
- "urn:xmpp:sm:3"
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfo
Gets the features.- Specified by:
getFeatures
in interfaceDiscoverableInfo
- Returns:
- The features.
-
processNegotiation
public StreamNegotiationResult processNegotiation(Object element) throws StreamNegotiationException
Description copied from interface:StreamFeatureNegotiator
Processes a feature protocol element or the feature element itself.- Specified by:
processNegotiation
in interfaceStreamFeatureNegotiator<StreamManagement>
- Parameters:
element
- The XML element, which belongs to the feature negotiation, e.g.<challenge/>
for SASL negotiation or the feature element itself, e.g.<mechanisms/>
.- Returns:
- The result of the feature negotiation.
- Throws:
StreamNegotiationException
- Any exception which might be thrown during a feature negotiation.
-
incrementInboundStanzaCount
public void incrementInboundStanzaCount()
Increments the inbound stanza count.
-
markUnacknowledged
public void markUnacknowledged(Stanza stanza)
Marks a stanza as unacknowledged.- Parameters:
stanza
- The stanza.
-
-