Title: XDoclet
1(No Transcript)
2XDoclet
- Attribute-Oriented Programming
- add more significance to your code by adding meta
data (attributes) to your java sources - JavaDoc tags
- Generates
- XML descriptors
- source code
3Benefits
- You don't have to worry about out dating
deployment meta-data whenever you touch the code.
The deployment meta-data is continuously
integrated. - Working with only one file per component gives
you a better overview of what you're doing. - You dramatically reduce development time, and can
concentrate on business logic, while XDoclet
generates 85 of the code for you.
4Using XDoclet
- Javadoc comments
- tags _at_tagname
5Sample Javadoc Comment
/ This is the Account entity bean. It
is an example of how to use the EJBDoclet
tags. _at_see Customer _at_ejb.bean
name"bank/Account" type"CMP"
jndi-name"ejb/bank/Account"
local-jndi-name"ejb/bank/LocalAccount"
primkey-field"id" _at_ejb.finder
signature"java.util.Collection findAll()"
unchecked"true" _at_ejb.transaction
type"Required" _at_ejb.interface
remote-class"test.interfaces.Account"
_at_ejb.value-object match"" _at_version
1.5 /
6XDoclet Tags
- Format
- _at_namespace.tag-name attribute-name"attribute
value" - Can also use ant properties as defined in the
build.xml file - _at_jboss.create-table
create"jboss.create.table" - Tags are for the class or method level, and
sometimes fields or constructors
7Ant build.xml file
ltpath id"xdoclet.class.path"gt ltfileset
dir"xdoclet.dir"gt ltinclude
name".jar"/gt lt/filesetgt lt/pathgt lttarget
name"xdoclet-init"gt ltecho message"xdoclet.ro
ot.dir"/gt lttaskdef name"ejbdoclet" class
name"xdoclet.modules.ejb.EjbDocletTask" classp
athref"xdoclet.class.path" /gt lttaskdef nam
e"webdoclet" classname"xdoclet.modules.web.We
bDocletTask" classpathref"xdoclet.class.path"
/gt lttstampgt ltformat property"TODAY"
pattern"d-MM-yy" /gt lt/tstampgt lt/targetgt
XDoclet Classes
Task setup
8Ant build.xml file
lttarget name"ejbdoclet" depends"xdoclet-prepare
"gt ltechogt-------------------lt/echogt ltechogt
Runing ejbdoclet lt/echogt ltechogt--------------
-----lt/echogt ltejbdoclet destdir"gen.dir
" excludedtags"_at_version,_at_author" addedtags
"_at_xdoclet-generated at TODAY" ejbspec"2.0"
gt ltfileset dir"src.dir"gt ltinclude
name"/.java"/gt lt/filesetgt
setup
find the files
9Ant build.xml file
ltremoteinterface pattern"0Remote"/gt lthome
interface pattern"0Home"/gt ltlocalinterface
pattern"0Local"/gt ltlocalhomeinterface
pattern"0LocalHome"/gt ltentitycmp/gt ltdep
loymentdescriptor destdir"build.dir/META-INF"/
gt ltjboss version"3.0" preferredRelationMap
ping"foreign-key" datasource"java/DefaultDS
" datasourcemapping"Hypersonic
SQL" destdir"build.dir/META-INF" /gt
lt/ejbdocletgt lt/targetgt
generate interfaces
generate cmp java code
generate jboss specific descriptors
10Java Implementation File