OPENJPA-302: Update user manual for PCEnhancer usage. Patch contributed by Jacob Nowosatka.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1207658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2011-11-28 22:24:32 +00:00
parent c3d9750f74
commit 76cd9dfe91
2 changed files with 35 additions and 11 deletions

View File

@ -236,7 +236,9 @@ files that should be processed. You can specify <filename>.java</filename> or
<filename>.class</filename> files. If you do not specify any files, the task <filename>.class</filename> files. If you do not specify any files, the task
will run on the classes listed in your <filename>persistence.xml</filename> or will run on the classes listed in your <filename>persistence.xml</filename> or
<link linkend="openjpa.MetaDataFactory"><literal> <link linkend="openjpa.MetaDataFactory"><literal>
openjpa.MetaDataFactory</literal></link> property. openjpa.MetaDataFactory</literal></link> property. You must, however, supply the
classpath you wish the enhancer to run with. This classpath must include, at
minimum, the openjpa jar(s), persistence.xml and the target classes.
</para> </para>
<para> <para>
Following is an example of using the enhancer task in a <filename>build.xml Following is an example of using the enhancer task in a <filename>build.xml
@ -247,17 +249,36 @@ Following is an example of using the enhancer task in a <filename>build.xml
Invoking the Enhancer from Ant Invoking the Enhancer from Ant
</title> </title>
<programlisting> <programlisting>
&lt;target name="enhance"&gt;
&lt;!-- define the openjpac task; this can be done at the top of the --&gt;
&lt;!-- build.xml file, so it will be available for all targets --&gt;
&lt;taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask"/&gt;
&lt;!-- invoke enhancer on all .java files below the model directory --&gt; &lt;target name="enhance"&gt;
&lt;openjpac&gt; &lt;!-- Define the classpath to include the necessary files. --&gt;
&lt;fileset dir="."&gt; &lt;!-- ex. openjpa jars, persistence.xml, orm.xml, and target classes --&gt;
&lt;include name="**/model/*.java" /&gt; &lt;path id="jpa.enhancement.classpath"&gt;
&lt;/fileset&gt; &lt;!-- Assuming persistence.xml/orm.xml are in resources/META-INF --&gt;
&lt;/openjpac&gt; &lt;pathelement location="resources/" /&gt;
&lt;!-- Location of the .class files --&gt;
&lt;pathelement location="bin/" /&gt;
&lt;!-- Add the openjpa jars --&gt;
&lt;fileset dir="."&gt;
&lt;include name="**/lib/*.jar" /&gt;
&lt;/fileset&gt;
&lt;/path&gt;
&lt;!-- define the openjpac task; this can be done at the top of the --&gt;
&lt;!-- build.xml file, so it will be available for all targets --&gt;
&lt;taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="jpa.enhancement.classpath" /&gt;
&lt;!-- invoke enhancer on all .class files below the model directory --&gt;
&lt;openjpac&gt;
&lt;classpath refid="jpa.enhancement.classpath" /&gt;
&lt;fileset dir="."&gt;
&lt;include name="**/model/*.class" /&gt;
&lt;/fileset&gt;
&lt;/openjpac&gt;
&lt;echo message="Enhancement complete" /&gt;
&lt;/target&gt; &lt;/target&gt;
</programlisting> </programlisting>
</example> </example>

View File

@ -242,6 +242,9 @@ The <filename>.class</filename> file of a class.
<para> <para>
If you do not supply any arguments to the enhancer, it will run on the classes If you do not supply any arguments to the enhancer, it will run on the classes
in your persistent class list (see <xref linkend="ref_guide_pc_pcclasses"/>). in your persistent class list (see <xref linkend="ref_guide_pc_pcclasses"/>).
You must, however, supply the classpath you wish the enhancer to run with. This
classpath must include, at minimum, the openjpa jar(s), persistence.xml and
the target classes.
</para> </para>
<para> <para>
You can run the enhancer over classes that have already been enhanced, in which You can run the enhancer over classes that have already been enhanced, in which