<?xml version="1.0" ?>
<project default="package" name="bp">
<description>
Build script for Reva Care Coordination Manager Server Component
</description>
<property file="build.properties" />
<property name="schema.dir" value="misc"></property>
<property file="deployer.properties" />
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="build.hibernate" value="${build.dir}/generate-hibernate"/>
<property name="build.axis" value="${build.dir}/generate-axis"/>
<property name="webinf" value="web/WEB-INF"/>
<path id="compilepath">
<fileset dir="${webinf}/lib">
<include name="*.jar"/>
<include name="**/*.jar"/>
</fileset>
<pathelement location="${src.dir}"/>
</path>
<path id="deploypath">
<fileset dir="./deploy_lib" includes="*.jar" />
</path>
<path id="testpath">
<pathelement location="${webinf}/classes"/>
<fileset dir="${webinf}/lib">
<include name="*.jar"/>
<include name="**/*.jar"/>
</fileset>
</path>
<taskdef resource="org/apache/catalina/ant/catalina.tasks" classpathref="deploypath"/>
<!-- Genarate the java beans from hbm.xml files -->
<!--
<target name = "hbm2java" description="Generate code using hibernate tool."
depends="generate-hibernate-check"
unless="generateHibernateNotRequired"> -->
<target name = "hbm2java" description="Generate code using hibernate tool." >
<taskdef name = "hbm2java" classname = "org.hibernate.tool.ant.HibernateToolTask" classpathref = "compilepath" />
<hbm2java destdir = "${build.hibernate}">
<configuration configurationfile = "${src.dir}/hibernate.cfg.xml" />
<hbm2java jdk5 = "true" />
</hbm2java>
</target>
<!-- Genarate the db schemas from hbm.xml files -->
<target name = "hbm2ddl">
<taskdef name = "hbm2ddl"
classname = "org.hibernate.tool.ant.HibernateToolTask"
classpathref = "compilepath" />
<hbm2ddl destdir = "${schema.dir}">
<configuration configurationfile = "${src.dir}/hibernate.cfg.xml" />
<hbm2ddl export="false" console="true" create="false" update="false" drop="false"
format="true"
outputfilename="dbschema.sql" />
</hbm2ddl>
</target>
<!-- be careful, this task will drop all tables in db, then create the table without any initialized data. -->
<target name = "clean-and-create-tables">
<taskdef name = "hbm2ddl"
classname = "org.hibernate.tool.ant.HibernateToolTask"
classpathref = "compilepath" />
<hbm2ddl destdir = "${schema.dir}">
<configuration configurationfile = "${src.dir}/hibernate.cfg.xml" />
<hbm2ddl export="true" console="true" create="true" update="false" drop="true"
format="true"
outputfilename="dbschema-clean-and-create.sql" />
</hbm2ddl>
</target>
<!-- Update the database, create missing tables and columns -->
<target name = "update-db-tables">
<taskdef name = "hbm2ddl"
classname = "org.hibernate.tool.ant.HibernateToolTask"
classpathref = "compilepath" />
<hbm2ddl destdir = "${schema.dir}">
<configuration configurationfile = "${src.dir}/hibernate.cfg.xml" />
<hbm2ddl export="true" console="true" create="true" update="true" drop="false"
format="true"
outputfilename="dbschema-update.sql" />
</hbm2ddl>
</target>
<taskdef resource="axis-tasks.properties" classpathref="compilepath" />
<target name="wsdl2java" description="Generate code using axis." depends="generate-axis-check"
unless="generateAxisNotRequired">
<mkdir dir="${build.axis}" />
<axis-wsdl2java output="${build.axis}" url="bpservice.wsdl"
verbose="true" serverside="true"
>
<mapping namespace="http://sa.com/bp/wsdl/1" package="com.sa.bp.soap" />
</axis-wsdl2java>
<delete file="${build.axis}/com/sa/bp/soap/BPServiceSoapBindingImpl.java"></delete>
<echo>****************finished generating java from wsdl*********************</echo>
</target>
<!--
生成Axis 服务配置文件, Axis根据该文件中的服务配置对外提供Web Service,
一般我们会手动修改该文件,如添加 handler 或者 配置 request flow等。
-->
<target name="generate-server-config.wsdd" depends="build" >
<java classname="org.apache.axis.utils.Admin" dir="${webinf}"
classpathref="compilepath" fork="yes" failοnerrοr="true">
<classpath path="${webinf}/classes"/>
<arg value="server"/>
<arg value="${basedir}/${build.axis}/com/sa/bp/soap/deploy.wsdd"/>
</java>
</target>
<target name="remote-deploy" description="Deploy web application" depends="package">
<deploy url="${url}" username="${username}" password="${password}" path="${path}" war="build/${build.file.war}" />
</target>
<target name="remote-undeploy" description="Deploy web application">
<undeploy url="${url}" username="${username}" password="${password}" path="${path}" />
</target>
<target name="remote-start" description="Start web application">
<start url="${url}" username="${username}" password="${password}" path="${path}" />
</target>
<target name="remote-reload" description="Reload web application">
<reload url="${url}" username="${username}" password="${password}" path="${path}" />
</target>
<target name="remote-stop" description="Stop web application">
<stop url="${url}" username="${username}" password="${password}" path="${path}" />
</target>
<target name="usage" description="Describe this build script.">
<!-- <echo>Usage: ant target [target ...]
For more information on the targets run "ant -projecthelp"
</echo> -->
<exec executable="ant">
<arg value="-projecthelp"/>
</exec>
</target>
<target name="clean" description="Remove all build artifacts.">
<delete dir="${build.dir}" />
<delete dir="${webinf}/classes"></delete>
<delete file="${schema.dir}/dbschema.sql"></delete>
<delete file="${schema.dir}/initdata_test.sql"></delete>
</target>
<target name="build" depends="hbm2java, wsdl2java" description="Compile, etc.">
<mkdir dir="${webinf}/classes"/>
<mkdir dir="${webinf}/lib"/>
<javac destdir="${webinf}/classes" debug="on" optimize="off" deprecation="on" classpathref="compilepath" source="1.5">
<src path="${build.axis}" />
<src path="${build.hibernate}" />
<src path="${src.dir}" />
</javac>
<copy toDir="${webinf}/classes">
<fileset dir="${src.dir}">
<include name="log4j.properties" />
<include name="log4j-junit.properties" />
<include name="*.xml"/>
<include name="**/*.hbm.xml"/>
</fileset>
</copy>
</target>
<target name="test" depends="build, hbm2ddl" description="Run the build-time unit tests.">
<junit fork="yes" haltonfailure="yes">
<jvmarg value="-Dlog4j.configuration=log4j-junit.properties"/>
<test name="com.sa.bp.test.BuildUnitTest"/>
<formatter type="plain" usefile="false"/>
<classpath refid="testpath"/>
</junit>
</target>
<import file="workflow.xml"/>
<target name="package" depends="build" description="Package into a war archive.">
<tstamp>
<format property="build.time" pattern="MM/dd/yyyy HH:mm:ss" />
</tstamp>
<war destfile="${build.dir}/${build.file.war}">
<fileset dir="web" />
<manifest>
<attribute name="Built-By" value="SA Engeering" />
<attribute name="Implementation-Version" value="1.0.0" />
<attribute name="Build-Time" value="${build.time}" />
</manifest>
</war>
<copy file="${build.dir}/${build.file.war}" tofile="${build.dir}/sa-bp.war"/>
</target>
<target name="generate-axis-check">
<uptodate property="generateAxisNotRequired" value="true" targetfile="build/generate-axis/com/sa/bp/soap/BPServiceSoap.java">
<srcfiles dir="./" includes="*.wsdl" />
</uptodate>
<echo>generateAxisNotRequired=${generateAxisNotRequired}</echo>
</target>
<target name="initdata">
<sql driver='${db_driver}' userid="${db_user}" password="${db_password}" url="${db_url}">
<classpath>
<fileset dir="${webinf}/lib">
<include name="*sql*.jar" />
</fileset>
</classpath>
<fileset dir="${schema.dir}">
<include name="initdata_test.sql"/>
</fileset>
</sql>
</target>
<!--
<target name="generate-hibernate-check">
<uptodate property="generateHibernateNotRequired" value="true" targetfile="build/generate-hibernate/reva/cis/db/hibernate/bean/User.java">
<srcfiles dir="${src.dir}" includes="*.cfg.xml" />
<srcfiles dir="${src.dir}" includes="**/*.hbm.xml" />
</uptodate>
<echo>generateHibernateNotRequired = ${generateHibernateNotRequired}</echo>
</target>
-->
</project>