Gerolf Seitz wrote:
hi,
i played a bit with "LABS-119: Implementing Roster retrieval and
management",
and while StanzaBuilder seems convenient, it still feels a little bit low
level to
manually build the xml structure.
+1. Agreed. With rosters and presence, things become a little bit more
complex.
what i'd rather like to do is something like this:
RosterQuery query = new RosterQuery();
List<RosterItem> items = retrieveRosterItems(jid); // do some magic roster
retrieval
query.addItems(items);
RosterItem could be something like this:
@XStreamAlias("item")
class RosterItem {
enum Ask {
subscribe
};
enum Subscription {
both, from, none, remove, to
};
@XStreamImplicit(itemFieldName = "group")
List<String> groups;
@XStreamAsAttribute
Ask ask;
@XStreamAsAttribute
String jid;
@XStreamAsAttribute
String name;
@XStreamAsAttribute
Subscription subscription;
}
serializing a RosterItem with XStream results in something like this:
<item jid="[EMAIL PROTECTED]" name="Gerolf Seitz" subscription="both">
<group>friends</group>
<group>family</group>
</item>
i think going the OO route would also help in implementing the numerous
XEPs.
i wouldn't like to use the low level API all the time.
notice: XStream serves just as an example. same goes for jpa and stuff
(although eventually it will have to be serialized to xml before it goes to
the client)
wdyt?
I agree we should make this as simple as possible.
We simply cannot take the short cut to XML on the business objects (like
Roster) because this layer and the layer beneath (stanza layer) is
unaware of XML. Only the next lower level (transport layer) is serializing.
but let's continue disussing this. I just have to think about it some
more...
Bernd
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]