Hi Tom,

your idea to parameterize Handlers sound reasoable to me. Can you please search if there isn't an already existing issue for that. If there is none please create one and propose the changes to mapping there. This way we have a common place to discuss about the syntax and how the parameters can be passed to the handler.

I'll respond to the gen.mapping problem at CASTOR-2041.

Regards
Ralf

Tom van den Berge schrieb:
Hi Ralf,

I will file a jira issue -- no problem.

In the meantime I figured out that I can get it working by adding the castor-1.1.2.1-codegen.jar to the classpath (e.g. by adding it to the lib dir). However, for some reason this only works once. When I run gen.mapping a second time, it fails with the message "java.lang.NoSuchFieldError: SORTEDMAP".

This seems to have something to do with the fact that generated source for FieldMappingCollection type currently has a SORTEDMAP constant, but this is not the case when the sources are re-generated.

I'll add this info to the jira issue, too.


The functionality I'm thinking about is a configurable xml type handler. I need to marshall and unmarshall xml element values that have various formats, like fixed width, padding with zeroes or spaces, left of right aligned, different date formats, etc. The only solution I can find is to implement a FieldHandler for each format, which would be silly. I was thinking about adding a new element to the field element, that can be configured; something like

<field name="myfield" type="string">
   <handler class="com.fu.FixedWidth" arg="10"/>
</field>

or

<field name="myfield" type="string">
   <handler class="com.fu.FixedWidth" arg="10, left-aligned"/>
</field>

The arg value can simply be passed to the handler's constructor, or maybe some initialize method.

I think this is pretty similar to the sql parameterized type converters (?)


What do you think of it?

Cheers,
Tom


On 7/5/07, *Ralf Joachim* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Hi Tom,

    at the moment we only recreate mapping source files on demand. As far as
    I recall we have not done that for a while now and it seams that we
    broke that ant task with one of our refactorings since then. I guess
    the
    problem is related to moving of codegen into a separate modul but I will
    check that myself. Could you please fill a new jira issue that
    gen.mapping is broken as a reminder for me.

    Would you mind to let us know what kind of feature you intend to add to
    mapping?

    Regards
    Ralf

    Tom van den Berge schrieb:
     > Hi,
     >
     >
     > I'm trying to generate the Castor mapping sources (the sources in the
     > org.exolab.castor.mapping.xml package). The reason for that is
    that I
     > would like to implement a new feature that requires changes in the
     > mapping.xml.
     >
     > Before making any changes myself, I want to be able to build Castor,
     > including generation of the mapping source files.
     >
     > I've checked out the sources from svn, and the regular build
    process (
     > build.sh all) works fine. However when I run build.sh
    gen.mapping, I get
     > the following error:
     >
     > ...
     > gen.mapping:
     >     [mkdir] Created dir: [...]/build/gen-src/mapping
     >
     > BUILD FAILED
     > [...]/src/build.xml:874: Invalid types "arraylist": Could not
    obtain the
     > default configuration file castorbuilder.properties from the
    Castor JAR
     >
     >
     > How can I successfully generate the mapping source files?
     >
     >
     > Thanks,
     > Tom

    --

    Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
    Ralf Joachim
    Raiffeisenstraße 11
    72127 Kusterdingen
    Germany

    Tel.   +49 7071 3690 52
    Mobil: +49 173 9630135
    Fax    +49 7071 3690 98

    Internet: www.syscon.eu
    E-Mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

    Sitz der Gesellschaft: D-72127 Kusterdingen
    Registereintrag: Amtsgericht Stuttgart, HRB 382295
    Geschäftsleitung: Jens Joachim, Ralf Joachim

    ---------------------------------------------------------------------
    To unsubscribe from this list please visit:

        http://xircles.codehaus.org/manage_email



--

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to