📄 ch10s29.html
字号:
<property name="datasource" value="java:/DefaultDS"/>
<property name="src.dir" value="${basedir}/src/main"/>
<property name="src.resources" value="${basedir}/src/resources"/>
<property name="etc.dir" value="${basedir}/src/etc"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.lib.dir" value="${basedir}/build/lib"/>
<property name="build.deploy.dir" value="${basedir}/build/deploy"/>
<property name="build.classes.dir" value="${basedir}/build/classes"/>
<property name="build.client.dir" value="${basedir}/build/client"/>
<property name="dist.dir" value="dist"/>
<property name="classpath" value="${lib.dir}/jboss-j2ee.jar;${lib.dir}/jta-spec1_0_1.jar" />
<property name="packages" value="test"/>
<taskdef name="ejbdoclet" classname="ejbdoclet.EJBDocletTask"
classpath="${basedir}/lib/ejbdoclet.jar" />
<!-- <property name="build.compiler" value="jikes"/>-->
</target>
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Creates the Bean Classes with EJBDoclet -->
<!-- =================================================================== -->
<target name="buildbeans" depends="prepare">
<mkdir dir="${src.resources}/test"/>
<mkdir dir="${src.resources}/test/META-INF"/>
<!-- Call EJBDoclet -->
<ejbdoclet sourcepath="${src.dir}"
destdir="${src.dir}"
packagenames="test"
classpath="${classpath};${basedir}/lib/ejbdoclet.jar"
ejbspec="1.1"
excludedtags="@version,@author">
<dataobject/>
<remoteinterface/>
<homeinterface/>
<entitypk/>
<entitycmp/>
<deploymentdescriptor xmlencoding="${encoding}"/>
<jboss xmlencoding="${encoding}"
typemapping="${typemapping}"
datasource="${datasource}"/>
</ejbdoclet>
<!-- copy the generated descriptor files in the resources directory -->
<copy file="${src.dir}/ejb-jar.xml" todir="${src.resources}/test/META-INF" />
<copy file="${src.dir}/jboss.xml" todir="${src.resources}/test/META-INF" />
<copy file="${src.dir}/jaws.xml" todir="${src.resources}/test/META-INF" />
<delete>
<fileset dir="${src.dir}" includes="*.xml"/>
</delete>
</target>
<!-- =================================================================== -->
<!-- Compiles the source code -->
<!-- =================================================================== -->
<target name="compile" depends="prepare">
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
classpath="${classpath}"
debug="off"
deprecation="off"
optimize="on"
includes="**/*.java"
excludes="**/*.jbx"
/>
</target>
<!-- =================================================================== -->
<!-- Creates the jar archives -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<mkdir dir="${build.client.dir}"/>
<mkdir dir="${build.lib.dir}"/>
<mkdir dir="${build.deploy.dir}"/>
<!-- Create Bean jar -->
<copy todir="${build.classes.dir}">
<fileset dir="${src.resources}/test" includes="**/*.xml"/>
</copy>
<jar jarfile="${build.deploy.dir}/test.jar"
basedir="${build.classes.dir}"
includes="test/**/*.class,
META-INF/**"
/>
<delete>
<fileset dir="${build.classes.dir}/META-INF" />
</delete>
</target>
<!-- =================================================================== -->
<!-- Verify Beans -->
<!-- =================================================================== -->
<target name="verify" depends="jar">
<java classname="org.jboss.verifier.Main" fork="true" failonerror="true">
<classpath path="${classpath}"/>
<arg value="${build.deploy.dir}/test.jar"/>
</java>
</target>
<!-- =================================================================== -->
<!-- Creates the binary structure -->
<!-- =================================================================== -->
<target name="main" depends="verify">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/deploy"/>
<mkdir dir="${dist.dir}/client"/>
<mkdir dir="${dist.dir}/conf"/>
<mkdir dir="${dist.dir}/images"/>
<copy todir="${dist.dir}/client">
<fileset dir="${build.client.dir}"/>
</copy>
<copy todir="${dist.dir}/lib">
<fileset dir="${build.lib.dir}"/>
</copy>
<copy todir="${dist.dir}/deploy">
<fileset dir="${build.deploy.dir}"/>
</copy>
<copy todir="${dist.dir}/lib">
<fileset dir="${src.resources}/test" includes="*.properties"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${etc.dir}/conf"/>
</copy>
<copy file="${src.lib}/connector.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/deploy.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jboss-j2ee.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jboss-client.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jbosssx-client.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jbossmq-client.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jndi.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jnp-client.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jta-spec1_0_1.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/stop.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/jaas.jar" todir="${dist.dir}/client" />
<copy file="${src.lib}/auth.conf" todir="${dist.dir}/client" />
<copy file="${src.lib}/jlfgr-1_0.jar" todir="${dist.dir}/client" />
<copy file="${etc.dir}/conf/jndi.properties" todir="${dist.dir}/client" />
</target>
<!-- =================================================================== -->
<!-- Cleans up generated stuff -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
</project>
</pre>
</p><p>
I have split the generation of the beans and the creation of the application in separate
tasks. To generate the beans, call <tt>build buildbeans</tt> and to create the
application, call <tt>build</tt>.
</p><p>
EJBDoclet throws some Exceptions the first time it is called, but they can be ignored.
</p><p>
The <tt>build.xml</tt> file generates first the PrimaryKey and DataObject classes, Home and
Remote interfaces and the <tt>ejb-jar.xml</tt>,
<tt>jboss.xml</tt> and <tt>jaws.xml</tt> descriptors. The
Java files are then compiled into the <tt>build/classes</tt> directory. After that, the
files will be archived in <tt>test.jar</tt> in directory
<tt>dist/deploy</tt>. Now the JAR file
can be deployed in JBoss.
</p><p>
If you are either specifying <tt>ejbspec="2.0"</tt> or nothing
(the default is <tt>2.0</tt>), it is possible that JBoss will
not find the DTDs defined in the deployment descriptors; in that case,
just remove those lines or comment them out. For my own use, I have changed the
EJBDoclet templates to avoid generating those lines.
</p></div><div class="section"><a name="ejbdoclet-concluding"></a><div class="titlepage"><div><h3 class="title"><a name="ejbdoclet-concluding"></a>Conclusion</h3></div></div><p>
In the EJBDoclet archive that can downloaded from
<a href="javascript:if(confirm('http://sourceforge.net/projects/ejbdoclet \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://sourceforge.net/projects/ejbdoclet'" tppabs="http://sourceforge.net/projects/ejbdoclet" target="_top">
http://sourceforge.net/projects/ejbdoclet</a> there is a brief
explanation of all possible parameters and a complete example.
</p></div></div><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="432" height="79"></td><td rowspan="2" background="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="100%" align="right" valign="top"><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="doc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/doc.gif" border="0"></a><a href="ch10.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch10.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch10s25.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch10s25.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch11.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch11.html"><img src="next.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/next.gif" border="0"></a></td></tr><tr></tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -