From 5e612ae222721dddefcf8f7194adfe6a41dd0e73 Mon Sep 17 00:00:00 2001
From: Gaston Dombiak
-Note: This version only allows you to configure supported features by the client. In future -version we will add the ability to configure associated items within the Smack client.
- Usage
In order to configure the supported features by your client you should first obtain the
@@ -42,9 +39,9 @@ send getInstanceFor(connection) to the class ServiceDiscoveryManage
connection is your XMPPConnection.
Once you have your ServiceDiscoveryManager you will be able to manage the supported features. To -register a new feature send addFeature(feature) to your ServiceDiscoveryManager +register a new feature send addFeature(feature) to your ServiceDiscoveryManager where feature is a String that represents the supported feature. To remove a supported feature send -removeFeature(feature) to your ServiceDiscoveryManager where feature is a +removeFeature(feature) to your ServiceDiscoveryManager where feature is a String that represents the feature to remove.
Examples
@@ -64,6 +61,52 @@ In this example we can see how to add and remove supported features:
+ +Description
+ +Your XMPP entity may receive a discovery request for items non-addressable as a JID such as +the MUC rooms where you are joined. In order to answer the correct information it is necessary +to configure the information providers associated to the items/nodes within the Smack client.
+ +Usage
+
+In order to configure the associated nodes within the Smack client you will need to create a
+NodeInformationProvider and register it with the ServiceDiscoveryManager. To get
+your ServiceDiscoveryManager send getInstanceFor(connection) to the class ServiceDiscoveryManager
+where connection is your XMPPConnection.
Once you have your ServiceDiscoveryManager you will be able to register information providers +for the XMPP entity's nodes. To register a new node information provider send setNodeInformationProvider(String node, NodeInformationProvider listener) +to your ServiceDiscoveryManager where node is the item non-addressable as a JID and +listener is the NodeInformationProvider to register. To unregister a NodeInformationProvider +send removeNodeInformationProvider(String node) to your ServiceDiscoveryManager where +node is the item non-addressable as a JID whose information provider we want to unregister.
+ +Examples
+
+In this example we can see how to register a NodeInformationProvider with a ServiceDiscoveryManager that will provide
+information concerning a node named "http://jabber.org/protocol/muc#rooms":
+
++ +// Set the NodeInformationProvider that will provide information about the + // joined rooms whenever a disco request is received + ServiceDiscoveryManager.getInstanceFor(connection).setNodeInformationProvider( + "http://jabber.org/protocol/muc#rooms", + new NodeInformationProvider() { + public Iterator getNodeItems() { + ArrayList answer = new ArrayList(); + Iterator rooms = MultiUserChat.getJoinedRooms(connection); + while (rooms.hasNext()) { + answer.add(new DiscoverItems.Item((String)rooms.next())); + } + return answer.iterator(); + } + }); ++
Description
@@ -75,8 +118,8 @@ in an XMPP entity.
Once you have your ServiceDiscoveryManager you will be able to discover items associated with an XMPP entity. To discover the items of a given XMPP entity send discoverItems(entityID) -to your ServiceDiscoveryManager where entityID is the ID of the entity. The message -discoverItems(entityID) will answer an instance of DiscoverItems that contains +to your ServiceDiscoveryManager where entityID is the ID of the entity. The message +discoverItems(entityID) will answer an instance of DiscoverItems that contains the discovered items.
Examples@@ -120,8 +163,8 @@ any (e.g., for the purpose of feature negotiation).
Once you have your ServiceDiscoveryManager you will be able to discover information associated with an XMPP entity. To discover the information of a given XMPP entity send discoverInfo(entityID) -to your ServiceDiscoveryManager where entityID is the ID of the entity. The message -discoverInfo(entityID) will answer an instance of DiscoverInfo that contains +to your ServiceDiscoveryManager where entityID is the ID of the entity. The message +discoverInfo(entityID) will answer an instance of DiscoverInfo that contains the discovered information.
Examples@@ -164,8 +207,8 @@ is not online (or available).
Once you have your ServiceDiscoveryManager you will be able to publish items to some kind of persistent storage. To publish the items of a given XMPP entity you have to first create an instance -of DiscoverItems and configure it with the items to publish. Then you will have to -send publishItems(String entityID, DiscoverItems discoverItems) to your ServiceDiscoveryManager +of DiscoverItems and configure it with the items to publish. Then you will have to +send publishItems(String entityID, DiscoverItems discoverItems) to your ServiceDiscoveryManager where entityID is the address of the XMPP entity that will persist the items and discoverItems contains the items to publish.