Hi Magnus
I thinkt that a similar problem was solved in the jboss module using the classTagValueMatch/ifClassTagMatches approach i described.
See modules/jboss/src/xdoclet/modules/jboss/jmx/resources/jbossmx-xml-descriptor.xdt
IMHO, i use exactly the same pattern as they do. Therefore, i think that the behaviour of the ClassTagsHandler in the core module is wrong (see XDT-1206).
Regards, Matthias
Magnus Larsson schrieb:
Hello again!
Thanks for your explanation, now I understand the problem!
I don't think I have seen that problem before in the websphere module but it must be possible to find solutions to it in one of all the other modules. I will look into the problem after X-mas.
See you in JIRA about this later on!
Regards, Magnus.
On Wednesday 22 December 2004 16:45, Matthias Germann wrote:
Hello Magnus
Thanks for your answer. I've already analysed the code for generating the "binding-DD-file".
My problem is that, when writing the dd for the websphere.resource-ref tag, i have to know the id of the resource-ref element from another tag (ejb.resource-ref with the same res-ref-name, see my sample). When generating the "bindings-DD-file", you can take the jndi name directly from the ejb.resource-ref tag and you don't have to search for another tag.
I tried to solve this problem by looping through all ejb.resource-ref elements (as for the the "binding-DD-file"). Then i tried to find the websphere.resource-ref element with the same res-ref-name. I tried to solve this by using the match variable (see my code in the attached file).
My problem is that this does not work because the forAllClassTags Tag resets the value of the match variable (see method forAllClassTags in class xdoclet.tagshandler.ClassTagsHandler).
Is the behaviour of the xdoclet.tagshandler.ClassTagsHandler correct?
My code works if i modify the xdoclet.tagshandler.ClassTagsHandler so that it does not reset the match variable.
I will create a case in JIRA for this tomorrow.
Regards, Matthias
Magnus Larsson schrieb:
Hello Matthias!
My name is Magnus Larsson and I am responsible for the WebSphere module. I will be happy to help you on this!
I took a quick look in IBM RSA to see how IBM generate the code you are talking about. Here is an extract from the "extension-DD-file":
<ejbExtensions xmi:type="ejbext:SessionExtension" xmi:id="SessionExtension_1103726745000"> <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#SampleSession"/> <resourceRefExtensions xmi:id="ResourceRefExtension_1103726745000" isolationLevel="TRANSACTION_READ_COMMITTED"> <resourceRef href="META-INF/ejb-jar.xml#ResourceRef_1103726744970"/> </resourceRefExtensions> </ejbExtensions>
Its structure is to me very similar to the corresponding code fragment you can find in the "binding-DD-file":
<ejbBindings xmi:id="EnterpriseBeanBinding_1103726744970" jndiName="ejb/se/callista/ebj/SampleSessionHome"> <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#SampleSession"/> <resRefBindings xmi:id="ResourceRefBinding_1103726744970" jndiName="jdbc/MyDb"> <bindingResourceRef href="META-INF/ejb-jar.xml#ResourceRef_1103726744970"/> </resRefBindings> </ejbBindings>
Since we already generate code for the bindingfile I guess you simply can copy that structure from the binding-template-file into the extension-template-file and then just change the details...
If you preffer I can make an initial effort to add the code in the extension-template-file and you can test it and then suggest adjustments that you find appropriate.
Anyhow please create a case in JIRA for this so that we can follow up all extensions and bug fixes in a formalized way.
Best Regards, Magnus.
On Tuesday 21 December 2004 21:03, Matthias Germann wrote:
Dear XDoclet developers,
I'm trying to create a patch for an additional feature in the IBM WebSphere module.
IBM Websphere offers the possibility to specify additional properties for a Resource-Reference in a proprietary deployment descriptor (i.e. the transaction isolation level).
I thought that i could add a "websphere.resource-ref" Tag for the additional WebSphere proprietary parameters. As a bean may declare multiple Resource-References, the tags could look like this:
/* * @ejb.resource-ref * res-ref-name="DS1" * @websphere.resource-ref * res-ref-name="DS1" * transaction-isolation="TRANSACTION_READ_COMMITTED" * * @ejb.resource-ref * res-ref-name="DS2" * @websphere.resource-ref * res-ref-name="DS2" * transaction-isolation="TRANSACTION_READ_UNCOMMITTED" */
The generated deployment descriptors for this example should look similar to the snippets below. It's important to notice that the Elements in the WebSphere proprietary descriptors are links to the Elements in the ejb-jar.xml with the ID attribute and not with the res-ref-name.
ejb-jar.xml: <resource-ref id="ResRef_12> <res-ref-name>DS1<res-ref-name> ... </resource-ref> <resource-ref id="ResRef_13> <res-ref-name>DS2<res-ref-name> ... </resource-ref>
WebSphere proprietary descriptor (names may be wrong) : <resource-ref-ext> <resource-ref href="ejb-jar.xml#ResRef_12"/>
<transactionIsolation>TRANSACTION_READ_COMMITTED</transactionIsolation> </resource-ref-ext>
<resource-ref-ext> <resource-ref href="ejb-jar.xml#ResRef_12"/>
<transactionIsolation>TRANSACTION_READ_COMMITTED</transactionIsolation> </resource-ref-ext>
I thought, that i could loop through the "ejb.resource-ref" tags and create a <resource-ref-ext> element in the WebSphere DD for each ejb.resource-ref tag. If i use the same prefix for generating the id as the ejb Module, i should be able to get the correct ID for the href Attribute. If there is a "websphere.resource-ref" tag with the same "res-ref-name" parameter value as the "res-ref-name" of the current "ejb.resource-ref" tag, the values from this tag are inserted into the WebSphere DD element.
The essential part of my WebSphere DD Template looks like below. I try to use the match variable for storing the "res-ref-name".
<XDtClass:forAllClassTags tagName="ejb.resource-ref" > <resource-ref-ext> <resource-ref href="ejb-jar.xml#<XDtId:prefixedId prefix='ResRef' wrapInIdEquals='false'/>"/> <XDtClass:classTagValueMatch tagName="ejb.resource-ref" paramName="res-ref-name"/> <XDtClass:forAllClassTags tagName="websphere.resource-ref" > <XDtClass:ifClassTagValueMatches tagName="websphere.resource-ref" paramName="res-ref-name"> <XDtClass:ifHasClassTag tagName="websphere.resource-ref" paramName="transaction-isolation"> ...
This does not work because the forAllClassTags resets the value of the match variable (see method forAllClassTags in class xdoclet.tagshandler.ClassTagsHandler). Therefore, a "transaction-isolation" element is never created.
Is there a better approach than mine?
Is it the right approach to use the match variable for saving the value of the "res-ref-name"?
Why does the ClassTagsHandler reset the value of the match variable in the forAllClassTags method?
I found similar code in the jboss module (modules/jboss/src/xdoclet/modules/jboss/jmx/resources/jbossmx-xml-descri pt or.xdt)
I have not tested the code, but i think that it does not work because it uses the same pattern as i try to use.
Thanks for your help.
Regards, Matthias
-- Matthias Germann <[EMAIL PROTECTED]>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
xdoclet-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel