• 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 programming benefits?

 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch forum, Craig and Norman!!!
My company is a partner of the Interwoven/iManage Corporation, which is the developer of the iManage content management system. Their newest release is a multiplatformed system based on J2EE technologies. From the programmer's manual, I figured the developers API are exposed through doclets, so we're to write our connectors and extensions in this environment. I'd appreciate if you could briefly overview the benefits and shortcomings of using doclets as opposed to writing conventional classes. Also, it'd be great if you could quickly explain the most basic structure of XDoclet programming environment. I'm new to this technology, but would like to familiarize myself with it.
Thanks.
 
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
Benefits are mentioned here
http://xdoclet.sourceforge.net/
 
Author
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a tad bit confused what you are asking, but I'll answer what I think you might be asking.
I believe the original ejbdoclet application, on which the current XDoclet is based, was based on javadoc doclets. For those that don't know, doclets are plugins to javadoc that let you do things other than standard html generation from javadoc. However, XDoclet is not based on doclets now. The javadoc framework was too limited, so xjavadoc was created as a more suitable front end for extracting the javadoc-like attributes from source files.
However, even as a module developer you won't see much much of xjavadoc. Modules are written by developing XDoclet tasks and subtasks which are invoked from ant to perform the code generation. Code generation happens by means of templates. Think of templates a JSP files with lots of tag libraries that let you inspect classe and their tags and do your code generation.
Templates are generated in a context. They can be used in the context of a single class, which we call transform generation. This is when you take one class and it's metadata and generate one other class. (like generting a home interface from an EJB) Or, the template can be run in the context of a set of Java classes. (like generating a web.xml from all the servlets, filters, taglibs, etc... in your project)
 
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 would also note that you don't need to know ANY of that to use XDoclet. To use XDoclet you need only need to add the metadata/attributes to your class files and invoke XDoclet. (I don't want to scare anyone away by the compexities of custom code generation)
 
Vad Fogel
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your responses! I figure, to get a good feel of XDoclets, one has to get hands dirty with EJB. Well, I don't mind a learning process.
 
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
EJB is the place where XDoclet provides the most value, but it does much much more. Servlets, tag libraries, portlets, web services, JMX, mock objects, JDO , hibernate, etc... There's a lot for non-EJB guys too.
 
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 norman richards:
EJB is the place where XDoclet provides the most value, but it does much much more. Servlets, tag libraries, portlets, web services, JMX, mock objects, JDO , hibernate, etc... There's a lot for non-EJB guys too.


The one place where I believe that XDoclet provides the most bang for the buck is with the generation of mock objects. To summarize chapter 10:

  • Tag your interfaces with @mock.generate
  • Put the mockdoclet/mockbjects task/subtask in your build
  • Voila! Mock objects are generated. Endo-test to your heart's content!


  • For such a small investment, XDoclet will generate hundreds (or even thousands) of lines of code.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this would be a snap to test, but could you describe what kind of mock objects does the standard mock module generate? (i.e. what kind of call verifications does it produce, if any)
 
Craig Walls
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 Lasse Koskela:
I know this would be a snap to test, but could you describe what kind of mock objects does the standard mock module generate? (i.e. what kind of call verifications does it produce, if any)


Basically it generates a mockobject that lets you set the preconditions and expectations for all methods in an interface (important: mock objects mock interfaces, not classes). There's also a validate method to do final validation of a test.


When you write your unit-test, you create an instance of the mock object, set the preconditions, set the expectations, then pass the mock object to the method you are testing. In the course of processing, if any of the expectations are blown, the unit-test fails immediately. If the method returns successfully, a final call to validate() ensure that the expectations were met.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic