| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <project default="usagewarning"> |
| |
| <property name="parent" value="${basedir}/.."/> |
| <property name="root" value="${parent}/.."/> |
| |
| <!-- database connection properties --> |
| <property name="dbdriver" value="org.apache.derby.jdbc.EmbeddedDriver"/> |
| <property name="dburl" |
| value="jdbc:derby:${basedir}/${example}-database;create=true"/> |
| <property name="dbuser" value=""/> |
| <property name="dbpass" value=""/> |
| |
| |
| <target name="usagewarning"> |
| <fail> |
| Please traverse to a sub-directory and run "ant" from there. |
| </fail> |
| </target> |
| |
| <path id="classpath" |
| description="The classpath to use for compiling and running"> |
| <pathelement path="${parent}"/> |
| <fileset dir="${root}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| |
| <path id="javaagent"> |
| <fileset dir="${root}"> |
| <include name="openjpa-*.jar"/> |
| </fileset> |
| </path> |
| <pathconvert property="javaagent" refid="javaagent"/> |
| |
| <target name="clean" depends="pre-clean" |
| description="Clean up compiled files and generated database files"> |
| <delete includeemptydirs="yes"> |
| <fileset dir="${basedir}"> |
| <include name="*.class"/> |
| <include name="*.log"/> |
| <include name="${example}-database/**/*"/> |
| <include name="${example}-database"/> |
| </fileset> |
| </delete> |
| </target> |
| |
| <!-- this target can be overridden by the sub-build --> |
| <target name="pre-clean" description="Pre-clean phase"> |
| </target> |
| |
| <target name="compile" depends="pre-compile" |
| description="Compile the example java files"> |
| <javac srcdir="${parent}" classpathref="classpath" |
| debug="yes" includes="${example}/**.java"/> |
| </target> |
| |
| <!-- this target can be overridden by the sub-build --> |
| <target name="pre-compile" description="Pre-compilation phase"> |
| </target> |
| |
| <target name="run" depends="compile" |
| description="Run the example Main program"> |
| |
| <java classname="${example}.Main" classpathref="classpath" fork="yes" |
| failonerror="yes"> |
| <!-- |
| Specifying the openjpa jar as the javaagent argument is |
| necessary in order for automatic class-enhancement to work. |
| --> |
| <jvmarg value="-javaagent:${javaagent}"/> |
| |
| <!-- |
| Specify the system properties to use when configuring |
| OpenJPA. Note that these will only be used becuase in the |
| examples, the call to "Persistence.createEntityManagerFactory" |
| is passed "System.getProperties()". |
| --> |
| |
| <!-- |
| By default, use the stand-alone Derby database (provided). |
| This can easily be changes to use your own database's driver, |
| provided you ensure it is accessible in the classpath. |
| --> |
| <sysproperty key="openjpa.ConnectionDriverName" |
| value="${dbdriver}"/> |
| <sysproperty key="openjpa.ConnectionURL" value="${dburl}"/> |
| <sysproperty key="openjpa.ConnectionUserName" value="${dbuser}"/> |
| <sysproperty key="openjpa.ConnectionPassword" value="${dbpass}"/> |
| |
| <!-- |
| Tell OpenJPA to automatically create tables in the database |
| for entities. Note that this should be disabled when |
| running against a production database, since you probably |
| don't want to be altering the schema at runtime. |
| --> |
| <sysproperty key="openjpa.jdbc.SynchronizeMappings" |
| value="buildSchema"/> |
| |
| <!-- |
| Output all the SQL for educational purposes, but set the |
| general logging level to only show warnings. |
| --> |
| <sysproperty key="openjpa.Log" |
| value="DefaultLevel=WARN,SQL=TRACE"/> |
| </java> |
| </target> |
| </project> |
| |