<?xml version="1.0"?> <!-- $Id: build.xml,v 1.24 2007/01/09 03:54:35 winebarrel Exp $ --> <project name="hsqldb" default="run.server" basedir="."> <property name="sample.dir" value="${basedir}/.." /> <property name="sample.src" value="${sample.dir}/src" /> <property name="project.dir" value="${sample.dir}/.." /> <property name="hsqldb.data" value="${basedir}/data" /> <property name="hsqldb.lib" value="${basedir}/lib" /> <property name="hsqldb.sql" value="${basedir}/sql" /> <property name="jdbc.driver" value="org.hsqldb.jdbcDriver" /> <!-- Database settings --> <property name="rubbish-db.url" value="jdbc:hsqldb:hsql://localhost" /> <property name="rubbish-db.userid" value="sa" /> <property name="rubbish-db.password" value="" /> <property name="rubbish-db.schema" value="PUBLIC" /> <property name="rubbish-db.classpath" value="${hsqldb.lib}/hsqldb.jar" /> <!-- ======================================================== --> <taskdef name="vogen" classname="rubbish.db.gen.ant.VOGenTask"> <classpath> <fileset dir="${project.dir}" includes="target/rubbish-db-*.jar" /> </classpath> </taskdef> <target name="create.vo"> <!-- create JavaBean --> <vogen destdir="${sample.src}" package="sample.hsqldb.bean"> <!-- <type sql="INTEGER" java="java.lang.Long" /> <include table="BOOK" /> <include table="PUBLISHER" /> --> </vogen> <!-- create JavaBean(Interface) --> <vogen type="interface" destdir="${sample.src}" package="sample.hsqldb.i_f.bean"> <!-- <type sql="INTEGER" java="java.lang.Long" /> <include table="BOOK" /> <include table="PUBLISHER" /> --> </vogen> <!-- create ActiveRecord --> <vogen type="activerecord" destdir="${sample.src}" package="sample.activerecord.bean"> <!-- <type sql="INTEGER" java="java.lang.Long" /> <include table="BOOK" /> <include table="PUBLISHER" /> --> <!-- Template Extension --> <extension> <![CDATA[ public void additionFunc() { /* class name */ // ${classname} // ${classname.lowercase} // ${classname.uppercase} // ${classname.capitalize} /* ant property */ // basedir: ${basedir} // sample.src: ${sample.src} Database dbh = DatabaseManager.getDatabase(); // processing... } ]]> </extension> <!-- Template Extension by property --> <propextension> <![CDATA[ public void additionFunc${propname.capitalize}() { /* class name */ // classname: ${classname} // classname.lowercase: ${classname.lowercase} // classname.upsercase: ${classname.uppercase} // classname.capitalize: ${classname.capitalize} /* property name */ // propname: ${propname} // propname.lowercase: ${propname.lowercase} // propname.uppercase: ${propname.uppercase} // propname.capitalize: ${propname.capitalize} /* property type */ // proptype: ${proptype} /* ant property */ // basedir: ${basedir} // sample.src: ${sample.src} // processing... } ]]> </propextension> </vogen> </target> <!-- ======================================================== --> <target name="run.server"> <java dir="${hsqldb.data}" classname="org.hsqldb.Server" fork="true"> <classpath path="${rubbish-db.classpath}" /> </java> </target> <!-- ======================================================== --> <target name="stop.server"> <java dir="${hsqldb.data}" classname="org.hsqldb.util.ShutdownServer" fork="true"> <classpath path="${rubbish-db.classpath}" /> </java> </target> <!-- ======================================================== --> <target name="create.data"> <sql driver="${jdbc.driver}" url="${rubbish-db.url}" userid="${rubbish-db.userid}" password="${rubbish-db.password}" encoding="MS932"> <classpath path="${rubbish-db.classpath}" /> <transaction src="${hsqldb.sql}/CREATE_TABLES.sql" /> <transaction src="${hsqldb.sql}/INSERT_SAMPLE.sql" /> </sql> </target> </project>