public abstract class FeatureNegotiator extends Object
Classes which extend from this class are responsible to negotiate a single feature.
Feature negotiators are registered with theFeaturesManager.addFeatureNegotiator(FeatureNegotiator) method.| Modifier and Type | Class and Description |
|---|---|
static class |
FeatureNegotiator.Status
Represents the status of the feature negotiation.
|
| Constructor and Description |
|---|
FeatureNegotiator(Class<? extends StreamFeature> featureClass)
Constructs a feature negotiator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFeatureListener(FeatureListener featureListener)
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.
|
protected void |
notifyFeatureNegotiated(FeatureNegotiator.Status status,
Object element)
Notifies the listener, if a feature negotiation has completed.
|
abstract FeatureNegotiator.Status |
processNegotiation(Object element)
Processes a feature protocol element or the feature element itself.
|
void |
removeFeatureListener(FeatureListener featureListener)
Removes a previously added feature listener.
|
public FeatureNegotiator(Class<? extends StreamFeature> featureClass)
featureClass - The feature class, which represents the feature, which will be negotiated.public final void addFeatureListener(FeatureListener featureListener)
featureListener - The feature listener.removeFeatureListener(FeatureListener)public final void removeFeatureListener(FeatureListener featureListener)
featureListener - The feature listener.addFeatureListener(FeatureListener)protected void notifyFeatureNegotiated(FeatureNegotiator.Status status, Object element) throws Exception
status - The status of the feature negotiation process.element - The element, which triggered the feature status change.Exception - If an exception occurred during feature negotiation.public abstract FeatureNegotiator.Status processNegotiation(Object element) throws Exception
element - The XML element, which belongs to the feature negotiation, e.g. <challenge/> for SASL negotiation or the feature element itself, e.g. <mechanisms/>.Exception - 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 XMPP.rocks. All rights reserved.