Package rocks.xmpp.extensions.shim
Class StanzaHeadersAndInternetMetadataProtocol
- java.lang.Object
-
- rocks.xmpp.extensions.shim.StanzaHeadersAndInternetMetadataProtocol
-
- All Implemented Interfaces:
ExtensionProtocol,DiscoverableInfo,InfoProvider,HeaderManager
- Direct Known Subclasses:
ClientHeaderManager
public class StanzaHeadersAndInternetMetadataProtocol extends Object implements HeaderManager, DiscoverableInfo
Implementation of XEP-0131: Stanza Headers and Internet Metadata.
-
-
Constructor Summary
Constructors Constructor Description StanzaHeadersAndInternetMetadataProtocol(ServiceDiscoveryManager serviceDiscoveryManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddSupportedHeader(String header)Adds a supported header.AsyncResult<List<String>>discoverSupportedHeaders(Jid jid)Discovers the supported headers of another entity.Set<String>getFeatures()Gets the features.DiscoverableInfogetInfo(Jid to, Jid from, String node, Locale locale)Gets the info appropriate to the given parameters.StringgetNamespace()The protocol's main namespace.Set<String>getSupportedHeaders()Gets the supported headers as unmodifiable set.booleanisEnabled()Indicates whether this protocol is enabled.booleanremoveSupportedHeader(String header)Removes a supported header.-
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
-
-
-
-
Constructor Detail
-
StanzaHeadersAndInternetMetadataProtocol
public StanzaHeadersAndInternetMetadataProtocol(ServiceDiscoveryManager serviceDiscoveryManager)
-
-
Method Detail
-
getSupportedHeaders
public final Set<String> getSupportedHeaders()
Description copied from interface:HeaderManagerGets the supported headers as unmodifiable set.If you want to advertise support for a specific header, add it to this set. Service discovery requests to the 'header' node will then reveal supported headers.
- Specified by:
getSupportedHeadersin interfaceHeaderManager- Returns:
- The supported headers.
-
addSupportedHeader
public boolean addSupportedHeader(String header)
Description copied from interface:HeaderManagerAdds a supported header. Adding a header automatically includes this protocol in service discovery responses.- Specified by:
addSupportedHeaderin interfaceHeaderManager- Parameters:
header- The header.- Returns:
- True, if the header was added.
- See Also:
HeaderManager.removeSupportedHeader(String)
-
removeSupportedHeader
public boolean removeSupportedHeader(String header)
Description copied from interface:HeaderManagerRemoves a supported header. If there are no headers left, this protocol is no longer included in service discovery responses.- Specified by:
removeSupportedHeaderin interfaceHeaderManager- Parameters:
header- The header.- Returns:
- True, if the header was removed.
- See Also:
HeaderManager.addSupportedHeader(String)
-
discoverSupportedHeaders
public final AsyncResult<List<String>> discoverSupportedHeaders(Jid jid)
Description copied from interface:HeaderManagerDiscovers the supported headers of another entity.- Specified by:
discoverSupportedHeadersin interfaceHeaderManager- Parameters:
jid- The JID.- Returns:
- The async result with the list of supported headers.
-
getNamespace
public final String getNamespace()
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespacein interfaceExtensionProtocol- Returns:
- "http://jabber.org/protocol/shim"
-
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.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfoGets the features.- Specified by:
getFeaturesin interfaceDiscoverableInfo- Returns:
- The features.
-
getInfo
public final DiscoverableInfo getInfo(Jid to, Jid from, String node, Locale locale)
Description copied from interface:InfoProviderGets the info appropriate to the given parameters.- Specified by:
getInfoin interfaceInfoProvider- Parameters:
to- The receiving entity.from- The requesting entity.node- The requested node, if any. May be null.locale- The locale of the requesting entity's stream or stanza.- Returns:
- The info or null, if no information could be found.
-
-