Package rocks.xmpp.extensions.sm.client
Class ClientStreamManager
- java.lang.Object
-
- rocks.xmpp.extensions.sm.AbstractStreamManager
-
- rocks.xmpp.extensions.sm.client.ClientStreamManager
-
- All Implemented Interfaces:
ExtensionProtocol
,WriterInterceptor
,StreamFeatureNegotiator<StreamManagement>
,DiscoverableInfo
public final class ClientStreamManager extends AbstractStreamManager implements WriterInterceptor
Manages the stream as described in XEP-0198: Stream Management.This class enables stream management during stream negotiation, if the stream management feature has been enabled before login:
xmppSession.enableFeature(StreamManagement.NAMESPACE);
- See Also:
- XEP-0198: Stream Management
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getStreamManagementId()
Gets the "SM-ID".boolean
isActive()
Returns true, as soon as the server has enabled stream management, i.e. if both client and server are using stream management.boolean
isResumable()
If the server will allow the stream to be resumed.void
process(StreamElement streamElement, Writer writer, WriterInterceptorChain chain)
The stream element which will be written.StreamNegotiationResult
processNegotiation(Object element)
Processes a feature protocol element or the feature element itself.AsyncResult<Boolean>
resume()
Resumes the stream.-
Methods inherited from class rocks.xmpp.extensions.sm.AbstractStreamManager
getFeatures, getNamespace, getRequestStrategy, incrementInboundStanzaCount, isEnabled, markUnacknowledged, setEnabled, setRequestStrategy
-
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
-
processNegotiation
public final 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>
- Overrides:
processNegotiation
in classAbstractStreamManager
- 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.
-
isActive
public final boolean isActive()
Returns true, as soon as the server has enabled stream management, i.e. if both client and server are using stream management.- Returns:
- True, as soon as the server has enabled stream management.
-
isResumable
public final boolean isResumable()
If the server will allow the stream to be resumed.- Returns:
- If the server will allow the stream to be resumed.
-
getStreamManagementId
public final String getStreamManagementId()
Gets the "SM-ID".The 'id' attribute defines a unique identifier for purposes of stream management (an "SM-ID"). The SM-ID MUST be generated by the server. The client MUST consider the SM-ID to be opaque and therefore MUST NOT assign any semantic meaning to the SM-ID.
- Returns:
- The "SM-ID".
-
resume
public AsyncResult<Boolean> resume()
Resumes the stream.- Returns:
- The async result, which is done, if either the stream is not resumable, or the server resumed the stream.
- See Also:
- 5. Resumption
-
process
public void process(StreamElement streamElement, Writer writer, WriterInterceptorChain chain) throws Exception
Description copied from interface:WriterInterceptor
The stream element which will be written.- Specified by:
process
in interfaceWriterInterceptor
- Parameters:
streamElement
- The stream element which will be written.writer
- The writer to which the stream element is written.chain
- The writer chain, which allows to proceed to the next interceptor.- Throws:
Exception
- Any exception happening during interception.
-
-