• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xdoclet

 
Ranch Hand
Posts: 398
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can it be used to generate tld files? What goes behind when we do it?
Thanks,
Vasu
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
XDoclet works based on attributes assigned to classes and methods using the familiar javadoc tag syntax.
In the case of taglibs, you need to use the @jsp.tag, @jsp.variable and @jsp.attribute tags.
What happens when the source file is run through XDoclet is that the tag handler for @jsp.tag writes a .tld file on disk based on what attributes you have assigned to the taglib implementation class.
 
vasu maj
Ranch Hand
Posts: 398
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In other words, the build process will look for these comments and then create the tld file dynamically? What is the advantage of it over manually creating the tld file?

Vasu
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vasu maj:
What is the advantage of it over manually creating the tld file?

You get to keep the metadata in the same place as the source code, thus reliefing you from maintaining an extra file in your source control.
Of course, you may want to keep the metadata separate in which case generating it with XDoclet makes little sense.
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I want to use my EJB for different servers can I add the tags for those servers in the same file or it allows tags for one server at a time?
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
If I want to use my EJB for different servers can I add the tags for those servers in the same file or it allows tags for one server at a time?

Yes, you can.
 
Author
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are somewhat complicated situations, and it's kind of hard to address them in a paragraph. I'll defer mostly to the book here for the details of complex deployments, as we give some general strategies there.
Most of your differences in multiple deployments are in the vendor specific deployment descriptors. I can recall a single deployment I've seen where the ejb-jar.xml was different for the same web application. If you are working on multiple servers, XDoclet can handle this
with the vendor specific tags. Otherwise, you need to isolate those changes (usually a very small number) into ant properties and use XDoclet's "${variable.substituion}".
Other techniques that I've seen is to subclass your bean. Create "XFooBean" and "YFooBean" from your FooBean. Each of those can contain the deployment information related to it. With some custom attributes on the class, you can use havingClassTag on the task to select only the beans for the project you are building. Remember, J2EE is all about components and so replacing one bean with another just like it isn't a big deal.
Remember, XDoclet lets you simplify the complexities of J2EE when you don't need it. When you DO need the J2EE complexities, then you don't want to use all of XDoclet's features.
Maybe you want to let it generate your interfaces and value objects and ejb-jar.xml but not your vendor deployment descriptor. Maybe you don't want it to ejb-jar.xml but you are ok letting it do your web.xml and your vendor web deployment descriptor. XDoclet is pretty flexible there.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to define custom tag uisng Xdoclet and define action for the same.
Thanks
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
Is it possible to define custom tag uisng Xdoclet and define action for the same.
Thanks


Absolutely. The details are too involved to go into on this forum (there's a whole chapter on it in the book--chapter 12), but the gist of it is:
- Create a template using XDoclet's XDt template language.
- If XDt doesn't offer functionality you need, write a tags handler class (roughly equivalent to writing a custom JSP tag) to do what you need.
- You can either use the base documentdoclet to process your template (this is how the to-do list generation works) or for more advanced uses, you can write a new doclet task and/or subtasks.
 
norman richards
Author
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll add to this, just if anyone was wondering, that you CAN write custom tags and use them in your own merge files. (merge files are the customization points in the standard tasks that let you replace parts of the generated code or insert your own code into the generated) So, you can actually invoke Java as part of your customization with very little effort...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic