Nearing Ad-hoc Completion
Posted by Trejkaz Wed, 19 Jan 2005 02:00:00 GMT
I’ve completed the reworking of my JEP-0050-compliant XMPP bot into JSO. Ad-hoc commands were relatively easy to implement, and I’ve done a bit of a better job of separating out the responsibilities in the new code.
ServiceDiscoveryManager maintains a mapping from node IDs to Discoverable objects, and it is the Discoverable’s job to populate the disco#items and disco#info responses as appropriate.
CommandManager maintains a mapping from command node to CommandHandler, and CommandHandlers are Discoverable, so you can discover commands. The CommandManager itself is also discoverable, in order for clients to discover the list of valid commands. I made the bot itself discoverable as well, and hooked the service discovery up so that discovery on the bot not only listed “commands” as a feature, but listed the child item for easier navigation. :-)
Read more...