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.

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?

  Gerolf

Reply via email to