Refactored using
find . -type f -name "*.java" |\
xargs sed -i -E |\
's/\.createStanzaCollectorAndSend\((\w+)\)\.nextResultOrThrow\(\);/.sendIqRequestAndWaitForResponse(\1);/'
and some manual refactoring.
This also resulted in a refactoring of the Providers and parsing
Exceptions. NumberFormatException and ParseException can now be thrown
directly, the wrapping in a SmackParsingException is down at a higher
layer, i.e. in AbstractProvider.
This also moves the logic to send error IQ replies from "when there is
no IQ provider registerd" to "when there is no IQ request handler
registered". Which has for example the advantage that IQ parsing no
longer asks for a connection instance.
Differentiate between asynchronous and synchronous ones. Asynchronous
are the ones where the invocation order may not be the same as the order
in which the stanzas arrived.
Since it's no longer guaranteed that when a unit test calls
processPacket(stanza)
the stanza will be completely processed when the call returns, it was
necessary to extend the unit tests (mostly Roster and ChatManager) with
a packet listener that waits for his invocation. Since we now also use
LinkedHashMaps as Map for the packet listeners (SMACK-531, SMACK-424),
adding a packet listeners as last also means that it will be called as
last. We exploit this behavior change now in the unit tests.
Rename 'recvListeners' to 'syncRecvListeners' in AbstractXMPPConnection.
Rename 'rosterInitialized' to 'loaded' in Roster.
Add Roster.isLoaded().
Reset 'loaded' to false in
Roster.setOfflinePresencesAndResetLoaded() (was setOfflinePresences()).
Fixes SMACK-583, SMACK-532, SMACK-424
This simplifies code as there is no longer a distinction between
"normal" providers and introspection providers in ProviderManager
necessary.
It's also easier to get an idea where introspection is used for parsing.
This is actually only part one, i.e. with this commit if the user adds a
PacketExtension to an IQ it will be included in IQ.toXml(). Which was
previously only the case if the IQ subclass explicitly included packet
extensions.
The second part of the change is to change the IQ provider, so that
packet extensions are automatically parsed.
Cases where PacketExtensions are used for Message and IQ are slightly
changed. The IQ sublcass now only has a field with this
PacketExtension (see for example
bytestreams.ibb.packet.DataPacketExtension).
Also changed hoxt API: Removed unnecessary indirection and made the
API more Smack idiomatic.
Adopt to common design patterns in Smack:
- getFrom(Packet) in Packetextensions
- INSTANCES.put() in getInstanceFor()
- ELEMENT instead of ELEMENT_NAME
- Use XmlStringBuilder
instead of using the old baseName=smack appendix=project.name approach,
we are now going convention over configuration and renaming the
subprojects directories to the proper name.
Having a prefix is actually very helpful, because the resulting
libraries will be named like the subproject. And a core-4.0.0-rc1.jar is
not as explicit about what it actually *is* as a
smack-core-4.0.0-rc1.jar.
SMACK-265