Hi David,

Sorry, I must not have explained myself well enough. The problem is
in the generation of the xmlbeans:

<preGoal name="java:compile">
  <xmlbeans:schema2java
    maven.xmlbeans2.sourcedir="${basedir}/src"
    maven.xmlbeans2.sourceschema="j2ee_1_4schema/connector_1_5.xsd,\
                                  j2ee_1_4schema/j2ee_jaxrpc_mapping_1_1.xsd,\
                                  javaee_5schema/application_5.xsd,\
                                  javaee_5schema/javaee_5.xsd,\
                                  javaee_5schema/ejb-jar_3_0.xsd,\
                                  javaee_5schema/web-app_2_5.xsd,\
                                  javaee_5schema/application-client_5.xsd,\
                                  javaee_5schema/javaee_web_services_1_2.xsd"
     maven.xmlbeans2.xmlconfigs="${basedir}/src/conf/xmlconfig.xml"
     maven.xmlbeans2.targetdir="${basedir}/target/xmlbeans"
     
maven.xmlbeans2.cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>

The first thing to note is that the namespace has changed in javaee5. It was:
   http://java.sun.com/xml/ns/j2ee
but is now:
   http://java.sun.com/xml/ns/javaee

If you generate the beans from the xsds by simply specifying the existing relevant j2ee_1_4schemas along with the new schemas as above,
then you get two class instances generated for each element common to both
schemas: one instance from each of the root schemas (j2ee_1_4.xsd and javaee_5.xsd) eg: StringImpl.java and StringImpl2.java. The order of generation being dependent I suppose on the order of specification in the "sourceschema" attribute.

To avoid duplication, one solution would be to change the src/conf/xmlconfig.xml
file to ensure that the package names are different for each namespace:

   <xb:namespace uri="http://java.sun.com/xml/ns/javaee";>
       <xb:package>org.apache.geronimo.xbeans.javaee</xb:package>
   </xb:namespace>

and
   <xb:namespace uri="http://java.sun.com/xml/ns/j2ee";>
       <xb:package>org.apache.geronimo.xbeans.j2ee</xb:package>
   </xb:namespace>

This would of course entail import changes to all classes that depend on
any bean that is not part of the connector_1_5.xsd or 
j2ee_jaxrpc_mapping_1_1.xsd
(because their package won't change).

cheers
Jan


David Jencks wrote:
I don't understand what you are trying to do wrt copying the existing j2ee 1.4 schemas still used in jee 5. If you intend the j2ee-schema directory to be a replacement for the one in trunk, then keeping all the schemas there is reasonable, and expecting class duplication between the two nearly identical branches is to be expected. If the new copy is intended to be an addition to the existing one in trunk, then you can re-use the already generated classes from j2ee-1.4 in your jee 5 work by including the trunk schema module in your project.xml dependencies with a <xmlbeans>true</xmlbeans> property. This will put the dependency on the xmlbeans compiler/code generator classpath and it won't regenerate the classes.

Have I missed the point?

thanks
david jencks


*/Jan Bartel <[EMAIL PROTECTED]>/* wrote:

    FYI for anyone who is interested:

    I've made a branch in the sandbox for servlet 2.5 integration work.
    The svn url is:

    https://svn.apache.org/repos/asf/geronimo/sandbox/servlet-2.5

    So far I have checked in the 2.5 servlet spec schema (and all of the
    other JavaEE 5 schemas too) and upped the version of Jetty to 6 and
    begun making changes in jetty & jetty-builder to support the new
    Jetty API, and in a couple of other modules to support the changes
    for the servlet 2.5 spec.

    Caveat: It's early days yet so don't expect the branch to compile
    just yet.

    One issue that I've come across is that the javaee5 spec re-uses
    the connector_1_5.xsd and j2ee_jaxrpc_mapping_1_1.xsd from j2ee 1.4.
    As both of these xsds include j2ee_1_4.xsd, if all xmlbeans are
    generated into the same package (ie org.apache.geronimo.xbeans.j2ee)
    th en most of the beans are generated twice. One solution would
    be to generate the javaee5 beans into a different package eg
    org.apache.geronimo.xbeans.javaee. If anybody has any thoughts
    on this, then I'm all ears.


    cheers
    Jan



Reply via email to