public abstract class StreamFeatureNegotiator extends Manager
Classes which extend from this class are responsible to negotiate a single feature.
Feature negotiators are registered with theStreamFeaturesManager.addFeatureNegotiator(StreamFeatureNegotiator) method.| Modifier and Type | Class and Description |
|---|---|
static class |
StreamFeatureNegotiator.Status
Represents the status of the feature negotiation.
|
| Constructor and Description |
|---|
StreamFeatureNegotiator(XmppSession xmppSession,
Class<? extends StreamFeature> featureClass)
Constructs a feature negotiator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFeatureListener(StreamFeatureListener streamFeatureListener)
Adds a feature listener, which will get notified about feature negotiation status changes.
|
abstract boolean |
canProcess(Object element)
Checks, whether the element can be processed by the feature negotiator.
|
Class<? extends StreamFeature> |
getFeatureClass()
Gets the feature class, this negotiator is responsible for.
|
boolean |
needsRestart()
Checks, if the feature needs a stream restart after it has been successfully negotiated.
|
abstract StreamFeatureNegotiator.Status |
processNegotiation(Object element)
Processes a feature protocol element or the feature element itself.
|
isEnabled, setEnabledpublic StreamFeatureNegotiator(XmppSession xmppSession, Class<? extends StreamFeature> featureClass)
xmppSession - The XMPP session.featureClass - The feature class, which represents the feature, which will be negotiated.public final void addFeatureListener(StreamFeatureListener streamFeatureListener)
streamFeatureListener - The feature listener.public abstract StreamFeatureNegotiator.Status processNegotiation(Object element) throws StreamNegotiationException
element - The XML element, which belongs to the feature negotiation, e.g. <challenge/> for SASL negotiation or the feature element itself, e.g. <mechanisms/>.StreamNegotiationException - Any exception which might be thrown during a feature negotiation. Note that any exception thrown during the feature negotiation process is thrown by the XmppSession.connect() method and therefore will abort the connection process.public boolean needsRestart()
By default this method returns false.
public abstract boolean canProcess(Object element)
element - The feature protocol element, e.g. <challenge/>. The element is never the feature element itself, e.g. <mechanisms/>, which is advertised in the <stream:features/> element.public final Class<? extends StreamFeature> getFeatureClass()
Copyright © 2014–2015 XMPP.rocks. All rights reserved.