I made a mod to the ejb:transaction tag that I thought others 
might be interested in, so I'm describing it here for discussion.

I've always been really bothered by the EJB terminology for 
transaction types.  Quick, what's the difference between 
"Required" and "Mandatory"?  "NotSupported" and "Never"?  OK, I 
know the answers, and so do you, probably -- but being used to 
it doesn't make the terminology any less horrid.  And bad 
terminology can really thwart the high-level discussion and 
analysis the EJBs are supposed to make easier.

So, I added support for a clearer alternative.  With the patch, 
instead of this:

   @ejb:transaction
������type="Supports"

...you can specify the rules in a much more comprehensible way, 
specifying the action to take depending on whether a transaction 
is present or absent in the current context:

��@ejb:transaction
������present="use"
������absent="ignore"

It's backward-compatible -- either way works -- you can specify 
either "type" or the "present" / "absent" pair (but not both) in 
your ejb:transaction tag. The allowable values for the "present" 
attribute are: ignore, use, create, and error; "absent" is the 
same, except it doesn't allow "use" because it wouldn't have any 
meaning.

The modified tag handler will translate the present/absent pair 
into the appropriate EJB transaction type, or give an error if 
you choose a combination not allowed by the spec.  The full 
translation table is as follows:

     absent / present  =>  type
     ----------------------------------
     ignore / ignore   =>  NotSupported
     ignore / use      =>  Supports
     create / use      =>  Required
     create / create   =>  RequiresNew
     error  / use      =>  Mandatory
     ignore / error    =>  Never

Now I think this is cool, and am pleased with its effect on my 
code's readability.  Questions:  Is this a patch others would 
like?  Do people have suggestions for improvement?  Might we 
consider adding this as a standard feature of ejbdoclet?

If there is interest on this list, I'll send my code out.

Cheers,

Paul


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

Reply via email to