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 boolean
addSupportedHeader(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.DiscoverableInfo
getInfo(Jid to, Jid from, String node, Locale locale)
Gets the info appropriate to the given parameters.String
getNamespace()
The protocol's main namespace.Set<String>
getSupportedHeaders()
Gets the supported headers as unmodifiable set.boolean
isEnabled()
Indicates whether this protocol is enabled.boolean
removeSupportedHeader(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:HeaderManager
Gets 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:
getSupportedHeaders
in interfaceHeaderManager
- Returns:
- The supported headers.
-
addSupportedHeader
public boolean addSupportedHeader(String header)
Description copied from interface:HeaderManager
Adds a supported header. Adding a header automatically includes this protocol in service discovery responses.- Specified by:
addSupportedHeader
in 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:HeaderManager
Removes a supported header. If there are no headers left, this protocol is no longer included in service discovery responses.- Specified by:
removeSupportedHeader
in 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:HeaderManager
Discovers the supported headers of another entity.- Specified by:
discoverSupportedHeaders
in 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:
getNamespace
in interfaceExtensionProtocol
- Returns:
- "http://jabber.org/protocol/shim"
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocol
Indicates whether this protocol is enabled.- Specified by:
isEnabled
in interfaceExtensionProtocol
- Returns:
- true, if enabled; false if disabled.
-
getFeatures
public final Set<String> getFeatures()
Description copied from interface:DiscoverableInfo
Gets the features.- Specified by:
getFeatures
in interfaceDiscoverableInfo
- Returns:
- The features.
-
getInfo
public final DiscoverableInfo getInfo(Jid to, Jid from, String node, Locale locale)
Description copied from interface:InfoProvider
Gets the info appropriate to the given parameters.- Specified by:
getInfo
in 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.
-
-