XDoclet in Action Craig Walls Instant Download
XDoclet in Action Craig Walls Instant Download
https://ebookname.com/product/xdoclet-in-action-craig-walls/
https://ebookname.com/product/estrogen-action-selective-estrogen-
receptor-modulators-and-women-s-health-progress-and-promise-1st-
edition-v-craig-jordan/
https://ebookname.com/product/craig-s-soil-mechanics-7th-edition-
r-f-craig/
https://ebookname.com/product/rails-4-in-action-revised-edition-
of-rails-3-in-action-ryan-bigg/
https://ebookname.com/product/voices-postgraduate-perspectives-
on-inter-disciplinarity-1st-edition-kathryn-vincent/
Psychoanalytic Reflections on a Gender free Case Into
the Void 1st Edition Ellen Toronto Et Al. (Eds.)
https://ebookname.com/product/psychoanalytic-reflections-on-a-
gender-free-case-into-the-void-1st-edition-ellen-toronto-et-al-
eds/
https://ebookname.com/product/the-seven-challenges-workbook-a-
guide-to-co-operative-communication-skills-for-success-at-home-
and-at-work-third-edition-revised-edition-dennis-rivers/
https://ebookname.com/product/rethinking-freire-globalization-
and-the-environmental-crisis-1st-edition-frederique-apffel-
marglin/
https://ebookname.com/product/master-your-ibs-an-8-week-plan-
proven-to-control-the-symptoms-of-irritable-bowel-syndrome-1st-
edition-pamela-barney/
https://ebookname.com/product/lab-manual-to-accompany-modern-
control-technology-components-and-systems-2nd-edition-gerald-e-
williams/
Microfibres 1st Edition S. Mukhopadhyay (Editor)
https://ebookname.com/product/microfibres-1st-edition-s-
mukhopadhyay-editor/
Craig Walls
Norman Richards
XDoclet
IN ACTION
MANNING
XDoclet in Action
XDoclet in Action
CRAIG WALLS
NORMAN RICHARDS
MANNING
Greenwich
(74° w. long.)
For online information and ordering of this and other Manning books, go to
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact:
Special Sales Department
Manning Publications Co.
209 Bruce Park Avenue Fax: (203) 661-9018
Greenwich, CT 06830 email: orders@manning.com
Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial
caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to
have the books they publish printed on acid-free paper, and we exert our best efforts to that
end.
ISBN 1-932394-05-2
For Vincent
N.R.
brief contents
PART 1 THE BASICS .......................................................................... 1
1 ■ A gentle introduction to code generation 3
2 ■ Getting started with XDoclet 21
vii
viii BRIEF CONTENTS
APPENDIXES
A ■ Installing XDoclet 350
B ■ XDoclet task/subtask quick reference 354
C ■ XDoclet tag quick reference 382
D ■ XDt template language tags 491
E ■ The future of XDoclet 566
contents
foreword xvii
preface xxi
acknowledgments xxiii
about this book xxvi
about the title xxx
about the cover illustration xxxi
ix
x CONTENTS
1.7 Summary 20
WebLogic 155
6.5 Working with multiple application servers 156
6.6 Working with multiple deployments 158
6.7 Summary 159
CONTENTS xiii
xvii
xviii FOREWORD
XML instead of HTML. Now all information about a component was centralized
in a single file: the EJB bean code, from which I could generate everything else.
Neat! I called the tool EJBDoclet and published it on my homepage using an
open-source license. I knew other lazy programmers would be interested.
It is now a couple of years later, and XDoclet has evolved from its initial spe-
cialized EJBDoclet incarnation to a highly customizable generic tool that can
help generate almost anything from your source code. It’s also used for, among
others, servlets, tag libraries, as well as WebWork and Struts actions, and it sup-
ports a number of server-specific XML descriptors for EJB. It has better docu-
mentation, a fairly large user base, and a thriving community built around it.
There are even tools whose purpose is to create source code that contains
XDoclet tags. In short, XDoclet has become a standard tool that can help most
programmers become more productive.
If we take a step back and look at the bigger picture, we see that XDoclet
combines two main points: code generation and code metadata. The last couple
of years have seen an explosion of new standards, each of which mandates that a
particular API be exposed by the components which implement it. Design pat-
terns have also become more popular. These two factors provide good reasons
for code generation because it is easy to create templates for both. If all you
have to do to expose a standard API or use a particular design pattern is create
source code that contains all the base information, and then use a code genera-
tion tool like XDoclet, which creates the artifacts required by those standards
and design patterns, then it becomes significantly easier to perform those tasks.
One of the main problems in software engineering is knowledge—actually, lack
of knowledge. Both design patterns and standard APIs require that program-
mers know them well in order to create code that implements them. By using
code generation based on templates, such as with XDoclet, it becomes easier to
capture and reuse such knowledge, making it available to programmers who
lack these skills.
XDoclet is great out of the box, but what’s even more interesting is the sup-
port for custom modules that you can add to it. This lets you capture your own
framework and design pattern standards, which is very helpful in a large com-
pany or team.
XDoclet is an open-source project with an active and responsive community of
users and developers. You should feel free to contribute your ideas and code to
it. As long as new standards, products, and best practices emerge, XDoclet will
need to keep evolving in order to help developers where it matters the most. Our
opportunity to be lazy depends on other developers’ willingness to be creative.
FOREWORD xix
The book you are now reading has been written by two developers who clearly
understand all of the above ideas and principles. Through their concise writing
they will show you how to apply XDoclet as efficiently as possible in your own
projects, and will help you understand everything from the basics of XDoclet to
how to expand it with your own plugins. No matter whether you choose to use
XDoclet as a lazy developer or as a creative plugin writer, this book is your essen-
tial guide.
—Rickard Öberg
Creator of XDoclet
preface
When I first heard of XDoclet (then it was called EJBDoclet), I thought the whole
idea was nonsense. The comment blocks in my Java code were for documenta-
tion, not for programming. Why would I ever put anything in a comment block
that impacted the functionality of my program? How absurd! Besides, at the
time I wasn’t doing much with EJBs, so what use did I have for XDoclet?
But XDoclet wouldn’t leave me alone. It kept crossing my path, with its
name mentioned in web-logs, presentations, and mailing lists. I was being
haunted by XDoclet.
Finally I gave in to those ghosts and gave XDoclet another look. And I’m
glad I did. I found out that XDoclet was for more than just EJBs and that it
addressed many of the code maintenance headaches I dealt with every day. It
freed me from Deployment Descriptor Hell.
I eventually got past my hang-up with putting code in comment blocks.
After all, javadoc comments aren’t the real documentation—they’re merely
metadata used to generate the real documentation. In that light, metadata
used to generate deployment descriptors and interfaces is just as appropriate
in comment blocks as javadoc documentation.
Newly enlightened, I dove in head first to learn as much as possible about
XDoclet. I sought out every book and every article I could find. But in my
quest for XDoclet knowledge, I came up short. Unfortunately, very little had
been written about XDoclet. Even XDoclet’s own documentation was sparse
(and, in some cases, inaccurate).
xxi
xxii PREFACE
—Craig Walls
1 Due to various reasons, including a huge book-writing project, neither of our articles were ever published.
acknowledgments
This book is more than a collection of words penned by two authors. In addi-
tion to those whose names are on the cover, there are many others who played
very important roles and deserve credit for this book’s existence.
First and foremost, we’d like to acknowledge the fine group of people we’ve
worked with at Manning Publications. The professionalism of each and every
one of you has made this project a true pleasure. Many thanks to Marjan Bace
for believing in this project and giving us this awesome opportunity. And to
everyone else we’ve worked with at Manning: Susan Capparelle, Denis Dalin-
nik, Lee Fitzpatrick, Leslie Haimes, Ted Kennedy (in memoriam), Mary Pier-
gies, David Roberson, Iain Shigeoka, Marilyn Smith, Tiffany Taylor, and
Helen Trimes.
We’d also like to acknowledge the reviewers who gave us the criticism we
needed to shape the book: Dan Bereczki, Ryan Breidenbach, Daniel Brooksh-
ier, Kevin Curley, Ryan Daigle, Jeff Duska, Nathan Egge, Erik Hatcher, Jack
Herrington, Ernest Hill, David Loeffler, Rickard Öberg, David Paine, Ben Sul-
lins, and Michael Yuan.
A huge high-five to everyone in the XDoclet community for continuing to
make XDoclet such a great tool. So many people have contributed in one way
or another that it would be difficult to list them all here. But, to everyone who
has written a module, addressed an issue in JIRA, or just answered a question
on the mailing lists, our appreciation for everything you do.
xxiii
xxiv ACKNOWLEDGMENTS
Finally, we’d like to give special thanks to Rickard Öberg for his vision, for
creating XDoclet in the first place, and for contributing to our book with his
feedback and foreword.
CRAIG WALLS I wish to especially thank my beautiful and loving wife, Raymie,
for her encouragement and patience during this very long project. I can’t believe
how fortunate I am to have you in my life. I love you more than you can possibly
know or than I can possibly express. Can you believe that I’m finally finished with
this thing?
I extend my gratitude to Norm for being such a great co-author. There’s no
way I could’ve written all of this myself.
Much appreciation to Erik Hatcher for convincing me early on that I could
do this and for answering tons of e-mails and questions along the way.
Many thanks to my team at Michaels: Ryan Breidenbach, Marianna Krupin,
Van Panyanouvong, and Tonji Zimmerman. I couldn’t imagine working with a
more talented bunch of developers. You continue to challenge me every day.
Head scratches and belly rubs are owed to the furry and feathered friends who
surrounded me during many of my writing sessions: Buster, Max, Frasier, Dodger,
Caesar, Hamlet, Echo, Squit, Scuttle, Faith, Cricket, Othello, and especially Juli-
ette, who watched over my shoulder while I banged away at the keyboard.
I wish to express my gratitude to my parents, who instilled in me a desire to
learn and who got me started tinkering with computers way back when they
bought me that Commodore VIC-20. (Fortunately, my programming activities
have advanced beyond BASIC!)
Finally, I’d like to acknowledge a mixed group of people who have inspired
me in one way or another throughout my life. Most of you probably don’t even
know it, but you’ve had a profound impact on my life: James Bell, Frank Caval-
lito, Bob Drummond, Jamie Duke, Robert Gleaton, Carolyn Gunn, Gary and Pat
Henderson, Brad Lartigue, Hue McCoy, and Hubert Smith.
Nannie looked past her sister towards the tall old painter
standing behind her.
"Your lessons," she faltered, with quivering lips.
"My little heroine," said the old painter tenderly, "your sister is
my favourite among all my pupils. I would rather," he went on,
laying his hand on Rosalind's shoulder--"I would rather teach one
real worker such as she is for love, than fifty of the usual kind who
come to me. She is just the real worker one might expect with such
a sister."
"You will go on teaching Rosalind," Nannie cried in a bewildered
way, "for nothing?"
"I will, gladly," the maestro answered; "and, in return, you shall
come one day, and bring the pug, and let me paint a picture of you
both."
And then the old man went away, leaving the sisters, in the
fulness of their joy, together.
For him this had been somewhat of a new experience--a
pleasant one. They were young, and he was old; but he went back
to his pictures with a heart fresh and young as it had not been for
years, asking of himself a question out of the pages of a favourite
poet: "Shall I thank God for the green summer, and the mild air, and
the flowers, and the stars, and all that makes the world so beautiful,
and not for the good and beautiful beings I have known in it?"
CHAPTER I
CHAPTER II
The time had come round for the great annual examination of the
National Schools where the young Dicki'sons received their
education, and on the great day itself the children came in at tea-
time full to overflowing with the results of their efforts. And Ada
Elizabeth was full of it too, but not to overflowing; on the contrary,
she crept into the kitchen, where her father and mother and little
two-year-old Miriam--commonly called "Mirry"--were already seated
at the table, and put her school-bag away in its place with a
shamefaced air, as if she, being an ignominious failure, could have
no news to bring.
"Well," exclaimed Mrs. Dicki'son to Gerty, who threw her hat and
bag down and wriggled into her seat with her mouth already open to
tell her tale, "did you get a prize?"
"No, I didn't, Mother," returned Gerty glibly. "A nasty old
crosspatch Miss Simmonds is; she always did hate me, and I think
she hates me worse than ever now. Anyway, she didn't give me a
prize--just to show her spite, nasty thing!"
Mrs. Dicki'son always declared that her husband was a slow
man; and he looked up slowly then and fixed his dull eyes upon
Gerty's flushed face.
"H'm!" he remarked, in a dry tone, and then closed his lips tight
and helped himself to another slice of bread and butter.
Gerty's flushed face grew a fine scarlet. She knew only too well
what the "h'm" and the dry tone and the tightly-closed lips meant,
and made haste to change the subject, or, at least, to turn the
interest of the conversation from herself to her sister.
"But our Ada Elizabeth's got the first prize of all," she informed
them; and in her eagerness to divert her father's slow attention from
herself, she spoke with such an air of pride in the unlooked-for result
of the examination that Ada Elizabeth cast a glance of passionate
gratitude towards her, and then visibly shrank into herself, as if, in
having won so prominent a place, she had done something to make
her mother's trials harder to bear than ever. "And there's going to be
a grander treat than we've ever had this year," Gerty went on, in her
glibest tones. "And the dean's lady, Lady Margaret, is going to give
the prizes away, and all the company is going to be at the treat,
and--and----"
"Oh! what a pity!" exclaimed Mrs. Dicki'son, turning a hopeless
gaze upon poor Ada Elizabeth. "Our Ada Elizabeth 'll never show up
properly, as you would, Gerty."
"Our Ada Elizabeth's lesson-books 'll show up better than
Gerty's, may be," put in Mr. Dicki'son, in his quietest tone and with
his driest manner.
"Oh! Ada Elizabeth's not clever like Gerty," returned Mrs.
Dicki'son, utterly ignorant as she was indifferent to the fact that she
was rapidly taking all the savour out of the child's hour of triumph.
"And you were so sure of it too, Gerty."
"So was the hare of winning the race; but the tortoise won,
after all," remarked Mr. Dicki'son sententiously.
"What are you talking about, Father?" his wife demanded. "I'm
sure if tidy 'air has anything to do with it, Gerty ought to be at the
top of the tree, for, try as I will, I can't make Ada Elizabeth's 'air ever
look aught like, wash it and brush it and curl it as ever I will; and as
for 'air-oil----"
Mr. Dicki'son interrupted his wife by a short laugh. "I didn't
mean that at all"--he knew by long experience that it was useless to
try to make her understand what he did mean--"but, now you speak
of it, perhaps Ada Elizabeth's 'air don't make so much show as some
of the others; it's like mine, and mine never was up to much--not
but what there's scarcely enough left to tell what sort it is."
It was quite a long speech for the unsociable and quiet Mr.
Dicki'son to come out with, and his wife passed it by without
comment, only making a fretful reiteration of Ada Elizabeth's
plainness and a complaint of the sorry figure she would cut among
the great doings on the day of the school treat and distribution of
prizes.
"Is our Ada Elizabeth a plain one?" said Mr. Dicki'son, with an air
of astonishment which conveyed a genuine desire for information,
then turned and scanned the child's burning face, after which he
looked closely at the faces of the other children, so little like hers,
and so nearly like that of his pretty, mindless, complaining wife.
"Well, yes, little 'un, I suppose you're not exactly pretty," he
admitted unwillingly; "you're like me, and I never was a beauty to
look at. But, there, 'handsome is as handsome does,' and you've
brought home first prize to-day, which you wouldn't have done, may
be, if you'd always been on the grin, like Gerty there. Seems to me,"
he went on reflectively, "that that there first prize 'll stand by you
when folks has got tired of Gerty's grin, that's what seems to me. I
don't know," he went on, "that I set so much store by looks. I never
was aught but a plain man, but I've made you a good husband,
Em'ly, and you can't deny it. You'll mind that good-looking chap, Joe
Webster, that you kept company with before you took up with me?
He chucked you up for Eliza Moriarty. Well, I met her this morning,
poor soul! with two black eyes and her lips strapped up with plaster.
H'm!" with a sniff of self-approval, "seems to me I'd not care to
change my plain looks for his handsome ones. 'Handsome is as
handsome does' is my motto; and if I want aught doing for me, it's
our Ada Elizabeth I asks to do it, that's all I know."
The great day of the school treat came and went. The dean's
wife, Lady Margaret Adair, gave away the prizes, as she had
promised, and was so struck with "our Ada Elizabeth's" timid and
shrinking air that she kept her for a few minutes, while she told her
that she had heard a very good account of her, and that she hoped
she would go on and work harder than ever. "For I see," said Lady
Margaret, looking at a paper in her hand, "that you are the first in
your class for these subjects, and that you have carried off the
regular attendance and good-conduct prize as well. I am sure you
must be a very good little woman, and be a great favourite with your
schoolmistress."
Mrs. Dicki'son--who, as the mother of the show pupil of the day,
and as a person of much respectability in the neighbourhood, which
was not famous for that old-fashioned virtue, had been given a seat
as near as possible to the daïs on which Lady Margaret and the table
of prizes were accommodated--heard the pleasant words of praise,
which would have made most mothers' hearts throb with exultant
pride, with but little of such a feeling; on the contrary, her whole
mind was filled with regret that it was not Gerty standing on the
edge of the daïs, instead of the unfortunate Ada Elizabeth, who did
not show off well. If only it had been Gerty! Gerty would have
answered my lady with a pretty blush and smile, and would have
dropped her courtesy at the right moment, and would have been a
credit to her mother generally.
But, alas! Gerty's glib tongue and ready smiles had not won her
the prizes which had fallen to poor little plain Ada Elizabeth's share,
and Gerty was out in the cold, so to speak, among the other
scholars, while Ada Elizabeth, in an agony of shyness and confusion,
stood on the edge of the daïs, first on one foot and then on the
other, conscious that her mother's eyes were upon her and that their
expression was not an approving one, feeling, though she would
hardly have been able to put it into words, that in cutting so sorry a
figure she was making her poor mother's trials more hard to bear
than ever. Poor little plain child, she kept courtesying up and down
like a mechanical doll, and saying, "Yes, 'm," and "No, 'm," at the
wrong moments, and she altogether forgot that the fresh-coloured,
buxom lady in the neat black gown and with only a bit of blue
feather to relieve her black bonnet was not a "ma'am" at all, but a
"my lady," who ought to have been addressed as such. At last,
however, the ceremony, and the games and sports, and the big tea
were all over, and Ada Elizabeth went home with her prizes to be a
heroine no longer, for she soon, very soon, in the presence of
Gerty's prettiness and Gerty's glib tongue and ready smiles, sank
into the insignificance which had been her portion aforetime. She
had not much encouragement to go on trying to be a credit to the
family which she had so hardly tried by taking after her father, for
nobody seemed to remember that she had been at the top of the
tree at the great examination, or, if they did recall it, it was generally
as an example of the schoolmistress's "awkwardness" of disposition
in having passed over the hare for the tortoise. Yet sometimes, when
Gerty was extra hard upon Ada Elizabeth's dulness, or Mrs. Dicki'son
found the trial of her life more heavy to bear than usual, her father
would look up from his dinner or his tea, as it might happen to be,
and fix his slow gaze upon his eldest daughter's vivacious
countenance.
"H'm! Our Ada Elizabeth's too stupid to live, is she? Well, you're
like to know, Gerty; it was you won three first prizes last half, wasn't
it? A great credit to you, to say nought about the 'good conduct and
regular attendance.' Yes, you're like to know all about it, you are."
"Dear me, Gerty," Mrs. Dicki'son would as often as not chime in
fretfully, having just wit enough to keep on the blind side of "Father,"
"eat your tea, and let our Ada Elizabeth alone, do; it isn't pretty of
you to be always calling her for something. Our Ada Elizabeth's
plain-looking, there's no saying aught again' it, but stupid she isn't,
and never was; and, as Father says, ''andsome is as 'andsome does';
so don't let me hear any more of it."
And all the time the poor little subject of discussion would sit
writhing upon her chair, feeling that, after all, Gerty was quite right,
and that she was not only unfortunately plain to look at, but that, in
spite of the handsome prizes laid out in state on the top of the chest
of drawers, there was little doubt that she was just too stupid to live.
CHAPTER III
It was a very mild and damp autumn that year, and the autumn was
succeeded by an equally mild winter; therefore it is not surprising
that the truth of the old saying, "A green Christmas makes a fat
kirkyard," became sadly realized in the neighbourhood of Gardener's
Lane.
For about the middle of December a dangerous low fever, with
some leaning towards typhoid, broke out in the parish, and the men
being mostly hard-drinkers, and the majority of the women idle
drabs who did not use half-a-pound of soap in a month, it flew from
house to house until half the population was down with it; ay, and,
as nearly always happens, not only the hard-drinkers and the idle
drabs were those to suffer, but the steady, respectable workmen and
the good housewives came in for more than their just share of the
tribulation also. And, among others, the Dicki'son family paid dearly
for the sins and shortcomings of their fellow-creatures, for the first
to fall sick was the pretty, complaining mother, of whom not even
her detractors could say other than that she was cleanliness itself in
all her ways. And it was a very bad case. The good parson came
down with offers of help, and sent in a couple of nurses, whom he
paid out of his own pocket--though, if he had but known it, he would
have done much more wisely to have spent the same amount of
money on one with more knowledge of her business and less power
of speech--and the doctor and his partner came and went with grave
and anxious faces, which did not say too much for the sick woman's
chance of recovery.
Mr. Dicki'son stayed at home from his work for a whole week,
and spent his time about equally between anxiously watching his
wife's fever-flushed face and sitting with his children, trying to keep
them quiet--no easy task, let me tell you, in a house where every
movement could be heard in every corner; and, as the schools were
promptly closed, for fear of spreading the epidemic, the children
were on hand during the whole day, and, poor little things, were as
sorely tried by the silence they were compelled to keep as they tried
the quiet, dull man whose heart was full almost to bursting.
But he was very patient and good with them, and Ada Elizabeth
was his right hand in everything. For the first time in her life she
forgot her plain looks and her mother's trials, and felt that she had
been born to some purpose, and that purpose a good one. And then
there came an awful day, when the mother's illness was at the
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com