I’'ll take this to an extreme, hoping I can pay it off by posterity benefitting from my lack of understanding.
Here is a more specific phrasing of my current challenge.
- I understand that the smack.providers file functions as a list of hooks. Or a list of handlers, if you will.
I have not read the low level XMPPConnection code, but I can imagine that when that low level code receives a subpacket for which there is no native handler, a call is made into the list of hooks in the providers file, looking for an IQProvider match. Fair enough.
Having an idea of how the IQProviders are hooked in, what I still don’'t understand is this: I have not seen where in the code the calls are made to take advantage of an extensionProvider in the providers file.
This lack of understanding is all in the context of parsing an input stream just taken off the network, and not in taking a Java class instance and converting it to the associated XML representation for outbound network transport. I assume the various toXML() and getChildElementXML() themes address that.
- My first attempt to understand how the providers file facilitates the hooks to help parse extensions came with a review of
which I discovered and which became interesting soley on the basis of looking for and finding it as a reasonable subject of study in the providers file.
- So I commenced reading the source for DiscoverItemsProvider, expecting to see some call which belies how the providers file hooks are called upon in parsing the stream represented by “parser”. In other words, I expected to find some sort of indirection layer in DiscoverItemsProvider, but instead I found none.
If I read it right, DiscoverItemsProvider parses the entire custom packet in full local view, explicitly creating new DiscoverItems.Item as it encounters them. DiscoverItemsProvider doesn’'t use the information in the providers file to my eye - it manages the “new DiscoverItems.Item(…)” itself.
So I am left still wondering what layer of code uses the extensionProvider information in the providers file and how does that code call the handler code? The DiscoverItems.Item handler information is certainly available to DiscoverItemsProvider, but the latter almost certainly has been coded not to avail itself of it. This cannot be accident, but it would be helpful to see sample code that uses the extensionProvider info in the providers file, and therefore hint at when such calls to the handler code are appropriate.