As I point out below, there are still bugs in relations.j, asm-
descriptor.j and ejb-body.j. -All with respect to violation of the ejb-
jar.xml DTD at the relationship part. 

Wouldn't it be nice if the XDoclet core could validate all generated 
XML files against a DTD (or XMLSchema for that matter) once it's 
generated? This would be great for testing, and we can use xerces (or 
any other validating parser) to do the job. We could write JUnit test 
cases (accompanied with test data which would be @tagged sources) that 
would ensure that XDoclet is always sound! It would result in *way* 
better quality of XDoclet. In my opinion this is more important than 
anything else. I can contribute with this if there is agreement on it.

Right now, i'm thinking of adding a method to SubTask.java like this:

validateXml( InputStream xml, InputStream dtd ); 

This method could be called by SubTask subclasses after generating an 
xml file, with the possibility to turn validation on/off through ant 
parameters.

Comments?

Aslak

----- Original Message -----
From: [EMAIL PROTECTED]
Date: Monday, September 17, 2001 10:24 pm
Subject: [Xdoclet-devel] a few bugs in ejb-jar.xml generation

> When I tried to deploy an ejb jar with ejb-jar.xml generated by 
> xdoclet, I
> discovered a few bugs:
> 
> 1)
> Error message from weblogic:
> 
> ERROR: Error processing 'ejb-jar.xml':
> .ejb-jar.enterprise-beans.entity.query.result-type-mapping. must 
> be one of
> the values: Remote,Local
> 
> the optional result-type-mapping element in generated ejb-jar.xml 
> filesgets its value from the first token in the
> @ejb:finder signature tag. The code in ejb-body.j is:
> 
>            <result-type-mapping><XDoclet:classTagValue tagName
> ="ejb:finder" paramName="signature" tokenNumber="0"  delimiter="
> "/></result-type-mapping>
> 
> Just like the weblogic error message, the dtd
> http://java.sun.com/dtd/ejb-jar_2_0.dtd states at line 1359:
> 
> The result-type-mapping element must have one of the following:
> 
>        <result-type-mapping>Local</result-type-mapping>
>        <result-type-mapping>Remote</result-type-mapping>
> 
> Therefore, I assume that the author of @ejb:finder has 
> misinterpreted the
> purpose of the <result-type-mapping> tag, believing it should
> contain the return type of the finder method. I think there is a 
> need for a
> new parameter to the @ejb:finder tag, which we could call
> result-type-mapping or something. The correct line in ejb-body.j 
> would be
> something like:
> 
>            <XDoclet:ifHasClassTag tagName="ejb:finder" paramName
> ="result-type-mapping">
>            <result-type-mapping><XDoclet:classTagValue tagName
> ="ejb:finder" paramName="result-type-mapping" values
> ="Local,Remote"/></result-type-mapping>
>            </XDoclet:ifHasClassTag>
> 
> Here is the suggested patch:
> 
> diff -r1.20 ejb-body.j
> 272c272,274
> <             <result-type-mapping><XDoclet:classTagValue tagName
> ="ejb:finder" paramName="signature" tokenNumber="0"  delimiter="
> "/></result-type-mapping>
> ---
> >             <XDoclet:ifHasClassTag tagName="ejb:finder" paramName
> ="result-type-mapping">
> >             <result-type-mapping><XDoclet:classTagValue tagName
> ="ejb:finder" paramName="result-type-mapping" values
> ="Local,Remote"/></result-type-mapping>
> >             </XDoclet:ifHasClassTag>
> 
> 
> 
> 2)
> relationships.j is broken.
> 
> Error message from weblogic:
> 
> ERROR: Error parsing 'ejb-jar.xml' line 130: The content of 
> element type
> "ejb-relationship-role" must match
> "(description?,ejb-relationship-role-name?,multiplicity,cascade-
> delete?,relationship-role-source,cmr-field?)".
> 
> The generated segment in my ejb-jar.xml looks like this:
> 
>      <ejb-relationship-role>
> 
> <ejb-relation-name>many-projects-have-one-customer</ejb-relation-name>
>         <multiplicity>One</multiplicity>
>         <relationship-role-source>
>            <ejb-name>ProjectEJB</ejb-name>
>         </relationship-role-source>
>         <cascade-delete/>
>      </ejb-relationship-role>
> 
> But it should be like this (check 2nd line):
> 
>      <ejb-relationship-role>
> 
> <ejb-relationship-role-name>many-projects-have-one-customer</ejb-
> relationship-role-name>
>         <multiplicity>One</multiplicity>
>         <relationship-role-source>
>            <ejb-name>ProjectEJB</ejb-name>
>         </relationship-role-source>
>         <cascade-delete/>
>      </ejb-relationship-role>
> 
> Here is a patch:
> 
> diff -r1.3 relationships.j
> 10c10
> <          <ejb-relation-name><XDoclet:methodTagValue tagName
> ="ejb:relation" paramName="role-name"/></ejb-relation-name>
> ---
> >          <ejb-relationship-role-name><XDoclet:methodTagValue tagName
> ="ejb:relation" paramName="role-name"/></ejb-relationship-role-name>
> 34c34
> <          <ejb-relation-name><XDoclet:methodTagValue tagName
> ="ejb:relation" paramName="target-role-name"/></ejb-relation-name>
> ---
> >          <ejb-relationship-role-name><XDoclet:methodTagValue tagName
> ="ejb:relation" paramName="target-role-name"/></ejb-relationship-
> role-name>
> 53c53
> <          <ejb-relation-name><XDoclet:methodTagValue tagName
> ="ejb:relation" paramName="role-name"/></ejb-relation-name>
> ---
> >          <ejb-relationship-role-name><XDoclet:methodTagValue tagName
> ="ejb:relation" paramName="role-name"/></ejb-relationship-role-name>
> 
> 
> 
> 3)
> asm-descriptor.j has incorrectly put <method-intf> after <method-
> name> all
> over the place.
> According to the ejb2.0 DTD, <method-intf> should come before 
> <method-name>
> 
> Patch:
> 
> diff -r1.14 asm-descriptor.j
> 96d95
> <        <method-name><XDoclet:classTagValue tagName="ejb:finder" 
> paramName="signature" tokenNumber="1"  delimiter=" ("/></method-name>
> 97a97
> >        <method-name><XDoclet:classTagValue tagName="ejb:finder" 
> paramName="signature" tokenNumber="1"  delimiter=" ("/></method-name>
> 116d115
> <        <method-name><XDoclet:classTagValue tagName="ejb:finder" 
> paramName="signature" tokenNumber="1"  delimiter=" ("/></method-name>
> 117a117
> >        <method-name><XDoclet:classTagValue tagName="ejb:finder" 
> paramName="signature" tokenNumber="1"  delimiter=" ("/></method-name>
> 144d143
> <          <method-name>findByPrimaryKey</method-name>
> 145a145
> >          <method-name>findByPrimaryKey</method-name>
> 161d160
> <          <method-name>findByPrimaryKey</method-name>
> 162a162
> >          <method-name>findByPrimaryKey</method-name>
> 180d179
> <          <method-name>findByPrimaryKey</method-name>
> 181a181
> >          <method-name>findByPrimaryKey</method-name>
> 235d234
> <          <method-name><XDoclet:classTagValue tagName="ejb:finder"
> paramName="signature" tokenNumber="1"  delimiter=" ("/></method-name>
> 236a236
> >          <method-name><XDoclet:classTagValue tagName="ejb:finder"
> paramName="signature" tokenNumber="1"  delimiter=" ("/></method-name>
> 
> 
> Cheers,
> Aslak.
> 
> 
> _______________________________________________
> Xdoclet-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
> 


_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to