| <?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. |
| --> |
| <!-- ====================================================================== --> |
| <!-- --> |
| <!-- Ant script for running OpenBooks --> |
| <!-- --> |
| <!-- ====================================================================== --> |
| <project name="OpenBooks" default="run"> |
| <property file="run.properties"/> |
| <property name="jpa.provider" value="openjpa" /> |
| <property name="load.properties" value="load.properties" /> |
| <property name="demo.properties" value="demo.properties" /> |
| |
| <path id="run.classpath" |
| description="Runs on OpenBooks packaged library and database driver"> |
| <pathelement location="${basedir}" /> |
| <fileset dir="${basedir}"> |
| <include name="*.jar" /> |
| </fileset> |
| <fileset dir="${openjpa.lib}"> |
| <include name="*.jar" /> |
| </fileset> |
| <pathelement location="${jdbc.driver}" /> |
| </path> |
| |
| <target name="check-env" description="Checks if OpenJPA and JDBC driver exists"> |
| <available file="${openjpa.lib}" property="openjpa.exists"/> |
| <available file="${jdbc.driver}" property="jdbc.driver.exists"/> |
| <fail unless="openjpa.exists" message="The directory for OpenJPA libraries can not be located at ${openjpa.lib}. Make sure openjpa.lib property value is correectly specified in run.properties file"/> |
| <fail unless="jdbc.driver.exists" message="The JDBC Driver can not be located at ${jdbc.driver}. Make sure jdbc.driver property value is correctly specified in run.properties file"/> |
| </target> |
| |
| <target name="load" depends="check-env" |
| description="Popluates a OpenBooks database with initial data"> |
| <echo message="Popluating a OpenBooks database with ${jpa.provider} as configured in ${load.properties}" /> |
| <java classname="openbook.server.DataLoader" fork="true"> |
| <arg value="OpenBooks" /> |
| <arg value="${load.properties}" /> |
| <classpath refid="run.classpath" /> |
| </java> |
| </target> |
| |
| <target name="run" depends="check-env" |
| description="Runs OpenBooks Demo"> |
| <java classname="openbook.client.Demo" fork="true"> |
| <classpath refid="run.classpath" /> |
| </java> |
| </target> |
| </project> |
| |