Re: XML Encoder/Decoder Beta

From: Kevin J. Menard, Jr. (nirvdru..egativetwenty.net)
Date: Fri Dec 10 2004 - 11:26:20 EST

  • Next message: jir..bjectstyle.org: "[OS-JIRA] Created: (CAY-246) Importing a complex EO Model."

    On 12/10/04 11:08 AM, "Andrus Adamchik" <andru..bjectstyle.org> wrote:

    > Not quiet sure what changes you are planning here, but if you need to
    > change existing Cayenne API, propose your suggestions as a patch (and
    make
    > sure you deprecate and leave around the old methods if method
    signiture
    > changes).

    Mostly in the way output is being done. I'm using a JDOM document for
    my stuff, which I append to as needed. Cayenne uses a PrintWriter,
    which it writes to when needed. I guess it's a matter of taste, but I
    like JDOM taking care of things for me. Likewise, JDOM has rich
    support for formatting the output, which goes above and beyond the
    "indent" string :-)

    Additionally, Cayenne outputs <property> tags, which is good and all,
    but is not really compatible with output from stuff I'm doing. Maybe
    this isn't really necessary though.

    >
    >
    >> One thing came up when encoding one of my data objects using
    >> java.beans.XMLEncoder, however.
    >
    > I wonder if java.beans.XMLEncoder is appropriate to use in Cayenne...
    > DataObjects are JavaBeans in most respects, but DataContext, ObjectId,
    > etc. are not.

    Hmm . . . would it be best then to modify the auto-generated code to a)
    implement XMLSerializable, and b) provide a default implementation of
    encodeAsXML()? I just think it'd be great to be able to encode a
    dataobject "out of the box".

    >
    > I assume the trace below coming from Decoder (as encoder shouldn't
    call
    > set* methods)?

    No, that's the confusing part. That's just using
    java.beans.XMLEncoder. I'll trace through the code again just to be
    sure, but it's fairly simple.

    > Actually some time back we discussed with Eric Schneider whether
    > "context-less" relationships and properties support would make sense
    (and
    > also related feature of persistence by reachability - adding transient
    > objects to a DataContext of persisten object when a relationship is
    > established)... Maybe this is a good time to implement it? We could
    start
    > with a JIRA issue I guess, as introduction of such feature affects
    general
    > design...

    Do you know whenabouts this took place so I can look at the mailing
    list archive?

    Thanks again,
    Kevin



    This archive was generated by hypermail 2.0.0 : Fri Dec 10 2004 - 11:27:46 EST