Thanks a lot for your answer Andrew.
I did a little bit differently from what you said but you put me on the
right track.
Actually I created a new class tag using the remote-custom merge point.
For those who are interested please find the code and an example below.

remote-custom.xdt

<XDtClass:ifHasClassTag tagName="ejb:const">
  <XDtClass:forAllClassTags tagName="ejb:const">
   public static final <XDtClass:classTagValue tagName="ejb:const"
paramName="type"/> <XDtClass:classTagValue tagName="ejb:const"
paramName="name"/> = new <XDtClass:classTagValue tagName="ejb:const"
paramName="type"/>(<XDtClass:classTagValue tagName="ejb:const"
paramName="value"/>);
  </XDtClass:forAllClassTags>
</XDtClass:ifHasClassTag>
<XDtClass:ifDoesntHaveClassTag tagName="ejb:const">
   // if you want to add public static fields please use the tag ejb.const
(remote-custom.xdt)
</XDtClass:ifDoesntHaveClassTag>

 * @ejb.const
 *          type="Integer"
 *          name="VARIABLE_NAME"
 *          value="1"


This tag would create such a public static variable in the bean's remote
interface.

   public static final Integer VARIABLE_NAME = new Integer(1);


with best regards,
Sebastien



|---------+---------------------------------------->
|         |           Andrew Stevens               |
|         |           <[EMAIL PROTECTED]|
|         |           et>                          |
|         |           Sent by:                     |
|         |           [EMAIL PROTECTED]|
|         |           ceforge.net                  |
|         |                                        |
|         |                                        |
|         |           29/05/2004 01:41             |
|         |           Please respond to            |
|         |           xdoclet-user                 |
|         |                                        |
|---------+---------------------------------------->
  
>-----------------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                         |
  |       To:       [EMAIL PROTECTED]                                                  
                        |
  |       cc:                                                                          
                                         |
  |       Subject:  Re: [Xdoclet-user] generating static variables in remote 
interfaces                                         |
  |                                                                                    
                                         |
  |       Category:       |-------------------------|                                  
                                         |
  |                       | ( ) Action needed       |                                  
                                         |
  |                       | ( ) Decision needed     |                                  
                                         |
  |                       | ( ) General Information |                                  
                                         |
  |                       |-------------------------|                                  
                                         |
  |                                                                                    
                                         |
  
>-----------------------------------------------------------------------------------------------------------------------------|




On Thu, 2004-05-27 at 15:50, [EMAIL PROTECTED]
wrote:
> I started to learn about xdoclet today and decided to integrate
> xdoclet incrementally in my project.
> My first exercise is to replace all my session beans with xdoclet
> generated ones.
>
> I was able to do it exept for one little thing. I frequently have
> static variables in my remote interfaces.
> I can't find a tag that would generate such variables in the remote
> interface.
>
> Does anybody if that is possible ?

When there's no tag for something, the next thing to check for is a
suitable merge point.  That's how custom code etc. is usually added.

If you look in the docs for the remoteinterface subtask
(
http://xdoclet.sourceforge.net/xdoclet/ant/xdoclet/modules/ejb/intf/RemoteInterfaceSubTask.html
), you'll see that currently there's only a "remote-custom.xdt" merge file,
"A text file containing custom template and/or java code to include in the
remote interface."

This would get included in all the generated remote interfaces, however,
so assuming that you don't want the same constants in every interface,
it probably isn't quite what you need.  So you've got a couple of
options:  1) raise an enhancement request to add a per-bean merge point
in the template, 2) download the source archive, add a per-bean merge
point to the template yourself and rebuild, or 3) use the custom merge
file to add one.  2 & 3 get you going again sooner, and 3 is easier as
you don't have to rebuild XDoclet, so lets go with that.

Create a file <mergedirectory>/remote-custom.xdt containing the line

<XDtMerge:merge file="remote-custom-{0}.xdt"></XDtMerge:merge>

Then create a file
<mergedirectory>/com/test/remote-custom-RequestService.xdt containing
the constant declarations.  Hopefully that should do the trick.  I think
that's the right name & path, it might need to be RequestServiceBean or
RequestServiceEJB or whatever your bean class is called, and under a
different path if your bean class is in a different package.  The
important thing to note is that it's not just in the merge directory
itself; it follows the same hierarchy as the original bean, to avoid
possible conflicts.


Andrew.



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user







-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to