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.StringgetNamespace()The protocol's main namespace.Predicate<Stanza>getRequestStrategy()Gets the request strategy.voidincrementInboundStanzaCount()Increments the inbound stanza count.booleanisEnabled()Indicates whether this protocol is enabled.voidmarkUnacknowledged(Stanza stanza)Marks a stanza as unacknowledged.StreamNegotiationResultprocessNegotiation(Object element)Processes a feature protocol element or the feature element itself.voidsetEnabled(boolean enabled)voidsetRequestStrategy(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:ExtensionProtocolIndicates whether this protocol is enabled.- Specified by:
isEnabledin 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:
getNamespacein interfaceExtensionProtocol- Returns:
- "urn:xmpp:sm:3"
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfoGets the features.- Specified by:
getFeaturesin interfaceDiscoverableInfo- Returns:
- The features.
-
processNegotiation
public StreamNegotiationResult processNegotiation(Object element) throws StreamNegotiationException
Description copied from interface:StreamFeatureNegotiatorProcesses a feature protocol element or the feature element itself.- Specified by:
processNegotiationin 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.
-
-