public class ServiceDiscoveryManager extends Manager
Modifier and Type | Method and Description |
---|---|
void |
addDiscoverInfoTo(DiscoverInfo response)
Add discover info response data.
|
void |
addFeature(String feature)
Registers that a new feature is supported by this XMPP entity.
|
void |
addIdentity(DiscoverInfo.Identity identity)
Add an further identity to the client.
|
static boolean |
canPublishItems(DiscoverInfo info)
Returns true if the server supports publishing of items.
|
boolean |
canPublishItems(String entityID)
Returns true if the server supports publishing of items.
|
DiscoverInfo |
discoverInfo(String entityID)
Returns the discovered information of a given XMPP entity addressed by its JID.
|
DiscoverInfo |
discoverInfo(String entityID,
String node)
Returns the discovered information of a given XMPP entity addressed by its JID and
note attribute.
|
DiscoverItems |
discoverItems(String entityID)
Returns the discovered items of a given XMPP entity addressed by its JID.
|
DiscoverItems |
discoverItems(String entityID,
String node)
Returns the discovered items of a given XMPP entity addressed by its JID and
note attribute.
|
DataForm |
getExtendedInfo()
Returns the data form that is set as extended information for this Service Discovery instance (XEP-0128)
|
List<PacketExtension> |
getExtendedInfoAsList()
Returns the data form as List of PacketExtensions, or null if no data form is set.
|
List<String> |
getFeatures()
Returns the supported features by this XMPP entity.
|
List<String> |
getFeaturesList()
Returns the supported features by this XMPP entity.
|
Set<DiscoverInfo.Identity> |
getIdentities()
Returns all identities of this client as unmodifiable Collection
|
DiscoverInfo.Identity |
getIdentity()
Return the default identity of the client.
|
String |
getIdentityName()
Returns the name of the client that will be returned when asked for the client identity
in a disco request.
|
String |
getIdentityType()
Returns the type of client that will be returned when asked for the client identity in a
disco request.
|
static ServiceDiscoveryManager |
getInstanceFor(XMPPConnection connection)
Returns the ServiceDiscoveryManager instance associated with a given XMPPConnection.
|
boolean |
includesFeature(String feature)
Returns true if the specified feature is registered in the ServiceDiscoveryManager.
|
void |
publishItems(String entityID,
DiscoverItems discoverItems)
Publishes new items to a parent entity.
|
void |
publishItems(String entityID,
String node,
DiscoverItems discoverItems)
Publishes new items to a parent entity and node.
|
void |
removeExtendedInfo()
Removes the data form containing extended service discovery information
from the information returned by this XMPP entity.
|
void |
removeFeature(String feature)
Removes the specified feature from the supported features by this XMPP entity.
|
boolean |
removeIdentity(DiscoverInfo.Identity identity)
Remove an identity from the client.
|
void |
removeNodeInformationProvider(String node)
Removes the NodeInformationProvider responsible for providing information
(ie items) related to a given node.
|
static void |
setDefaultIdentity(DiscoverInfo.Identity identity)
Set the default identity all new connections will have.
|
void |
setEntityCapsManager(EntityCapsManager manager)
Loads the ServiceDiscoveryManager with an EntityCapsManger that speeds up certain lookups.
|
void |
setExtendedInfo(DataForm info)
Registers extended discovery information of this XMPP entity.
|
void |
setIdentity(DiscoverInfo.Identity identity)
Sets the default identity the client will report.
|
void |
setIdentityName(String name)
Sets the name of the client that will be returned when asked for the client identity
in a disco request.
|
void |
setNodeInformationProvider(String node,
NodeInformationProvider listener)
Sets the NodeInformationProvider responsible for providing information
(ie items) related to a given node.
|
boolean |
supportsFeature(String jid,
String feature)
Queries the remote entity for it's features and returns true if the given feature is found.
|
connection, schedule
public static void setDefaultIdentity(DiscoverInfo.Identity identity)
identity
- public String getIdentityName()
public void setIdentityName(String name)
name
- the name of the client that will be returned when asked for the client identity
in a disco request.public void setIdentity(DiscoverInfo.Identity identity)
identity
- public DiscoverInfo.Identity getIdentity()
public String getIdentityType()
public void addIdentity(DiscoverInfo.Identity identity)
identity
- public boolean removeIdentity(DiscoverInfo.Identity identity)
identity
- public Set<DiscoverInfo.Identity> getIdentities()
public static ServiceDiscoveryManager getInstanceFor(XMPPConnection connection)
connection
- the connection used to look for the proper ServiceDiscoveryManager.public void addDiscoverInfoTo(DiscoverInfo response)
response
- the discover info response packetpublic void setNodeInformationProvider(String node, NodeInformationProvider listener)
In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined.
node
- the node whose items will be provided by the NodeInformationProvider.listener
- the NodeInformationProvider responsible for providing items related
to the node.public void removeNodeInformationProvider(String node)
node
- the node to remove the associated NodeInformationProvider.public List<String> getFeatures()
public List<String> getFeaturesList()
public void addFeature(String feature)
Since no packet is actually sent to the server it is safe to perform this operation before logging to the server. In fact, you may want to configure the supported features before logging to the server so that the information is already available if it is required upon login.
feature
- the feature to register as supported.public void removeFeature(String feature)
Since no packet is actually sent to the server it is safe to perform this operation before logging to the server.
feature
- the feature to remove from the supported features.public boolean includesFeature(String feature)
feature
- the feature to look for.public void setExtendedInfo(DataForm info)
Since no packet is actually sent to the server it is safe to perform this operation before logging to the server. In fact, you may want to configure the extended info before logging to the server so that the information is already available if it is required upon login.
info
- the data form that contains the extend service discovery
information.public DataForm getExtendedInfo()
public List<PacketExtension> getExtendedInfoAsList()
public void removeExtendedInfo()
Since no packet is actually sent to the server it is safe to perform this operation before logging to the server.
public DiscoverInfo discoverInfo(String entityID) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
entityID
- the address of the XMPP entity or null.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public DiscoverInfo discoverInfo(String entityID, String node) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
entityID
- the address of the XMPP entity.node
- the optional attribute that supplements the 'jid' attribute.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public DiscoverItems discoverItems(String entityID) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
entityID
- the address of the XMPP entity.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public DiscoverItems discoverItems(String entityID, String node) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
entityID
- the address of the XMPP entity.node
- the optional attribute that supplements the 'jid' attribute.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public boolean canPublishItems(String entityID) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
entityID
- the address of the XMPP entity.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public static boolean canPublishItems(DiscoverInfo info)
info
- the discover info packet to check.public void publishItems(String entityID, DiscoverItems discoverItems) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
entityID
- the address of the XMPP entity.discoverItems
- the DiscoveryItems to publish.XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void publishItems(String entityID, String node, DiscoverItems discoverItems) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
entityID
- the address of the XMPP entity.node
- the attribute that supplements the 'jid' attribute.discoverItems
- the DiscoveryItems to publish.XMPPException.XMPPErrorException
- if the operation failed for some reason.SmackException.NoResponseException
- if there was no response from the server.SmackException.NotConnectedException
public boolean supportsFeature(String jid, String feature) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
jid
- the JID of the remote entityfeature
- XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void setEntityCapsManager(EntityCapsManager manager)
manager
-