![JAR search and dependency download from the Maven repository](/logo.png)
no.tsl2.nano.h5.2.5.3.source-code.mda.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <!-- 1. creates and starts a (hsqldb or h2) database through a given user/password and sql-ddl file 2. calls reverse-eng.xml to generate java entity beans, compiling and packing them into a jar file --> <project name="model driven generator" default="do.all" basedir="."> <!-- properties are load in target "do.all" --> <target name="help" description="help overview"> <echo message="please use one of these targets: do.all"/> </target> <path id="stdpath"> <fileset dir="${basedir}"> <include name="**"/> </fileset> </path> <path id="classpath"> <fileset dir="${basedir}"> <include name="**/*.jar"/> <include name="generated-bin/**/*.class"/> </fileset> </path> <!-- creates a user/schema, drops and creates tables --> <target name="create.database"> <echo> ********************************************************** creating database: ${jdbc.url} script-set : ${jdbc.database} user : ${jdbc.username} ********************************************************** </echo> <echo file="createuser.sql"> CREATE USER ${jdbc.username} PASSWORD '${jdbc.password}' ADMIN; GRANT DBA to ${jdbc.username}; commit; CREATE SCHEMA ${jdbc.scheme} AUTHORIZATION DBA; SET SCHEMA ${jdbc.scheme}; commit; GRANT ALL ON ALL TABLES IN SCHEMA PUBLIC TO ${jdbc.username}; commit; SET DATABASE DEFAULT INITIAL SCHEMA ${jdbc.scheme}; commit; -- following lines are hsqldb compatibility modes: SET DATABASE SQL SYNTAX DB2 TRUE; SET DATABASE SQL SYNTAX MYS TRUE; SET DATABASE SQL SYNTAX MSS TRUE; SET DATABASE SQL SYNTAX ORA TRUE; SET DATABASE SQL SYNTAX PGS TRUE; commit; -- following lines are h2 compatibility modes: SET NON_KEYWORDS; SET MODE LEGACY; -- REGULAR; -- STRICT; -- DB2; -- DERBY; -- HSQLDB; -- MSSQLSERVER; -- MYSQL; -- ORACLE; -- POSTGRESQL; commit; </echo> <echo message="preparing database..." /> <!-- do some database-specific WORKAROUNDs --> <!-- <replaceregexp flags="i"> <fileset dir="${src.dir}"><include name="*${jdbc.database}*.sql"/></fileset> <regexp pattern="("|[\s\(\'\´]+)(BEGIN|END|DATE|DAY|ALL|CHECK|CONSTRAINT|CROSS|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|DISTINCT|EXCEPT|EXISTS|FALSE|FETCH|FOR|FOREIGN|FROM|FULL|GROUP|HAVING|INNER|INTERSECT|IS|JOIN|LIKE|LIMIT|MINUS|NATURAL|NOT|NULL|OFFSET|ON|ORDER|PRIMARY|ROWNUM|SELECT|SYSDATE|SYSTIME|SYSTIMESTAMP|TODAY|TRUE|UNION|UNIQUE|WHERE|WITH)("|[\s\'\`\)]+)"/> <substitution expression="\1\2_w\3"/> </replaceregexp> --> <!-- WORKAROUND END --> <echo message="creating user..." /> <ant antfile="shell.xml" target="sh.sql"> <property name="sh.sql.include" value="createuser.sql"/> <property name="sh.sql.onerror" value="continue"/> </ant> <echo message="" file="drop-dummy-${jdbc.database}.sql" /> <parallel failonany="false"> <!-- parallel as workaround: if no script exists, we don't want to stop! --> <echo message="cleaning database..." /> <ant antfile="shell.xml" target="sh.sql"> <property name="sh.sql.include" value="*drop*${jdbc.database}*.sql" /> <property name="sh.sql.onerror" value="continue" /> </ant> </parallel> <echo message="creating database..." /> <ant antfile="shell.xml" target="sh.sql"> <property name="sh.sql.include" value="*${jdbc.database}*.sql"/> <property name="sh.sql.exclude" value="*drop*.sql"/> <property name="sh.sql.exclude2" value="*init*.sql"/> <property name="sh.sql.exclude3" value="createuser.sql"/> <property name="sh.sql.onerror" value="continue" /> </ant> <echo message="" file="init-dummy-${jdbc.database}.sql" /> <parallel failonany="false"> <!-- parallel as workaround: if no script exists, we don't want to stop! --> <echo message="filling data..." /> <ant antfile="shell.xml" target="sh.sql"> <property name="sh.sql.include" value="*init*${jdbc.database}*.sql" /> <property name="sh.sql.onerror" value="continue" /> </ant> </parallel> </target> <target name="init.jdbc.connection"> <property file="${basedir}/mda.properties" /> <property file="${basedir}/jdbc-connection.properties"/> </target> <target name="create.db.server.run.file" depends="init.jdbc.connection"> <!-- on windows we start the hsqldb/h2 in a new shell - as background process --> <condition property="start" value="start" else=""> <!-- <equals casesensitive="false" arg1="${env.os.name}" arg2="windows" /> --> <contains string="${os.name}" substring="windows" casesensitive="false"/> </condition> <!-- on linux we need to start hsqldb/h2 in a background process --> <condition property="background" value="" else="&"> <contains string="${os.name}" substring="windows" casesensitive="false"/> </condition> <condition property="cmdargs" value="%* ${background}" else="$* ${background}"> <contains string="${os.name}" substring="windows" casesensitive="false"/> </condition> <condition property="cmdpref" value="" else=""> <contains string="${os.name}" substring="windows" casesensitive="false"/> </condition> <!-- on windows we can't constrain with a real filter --> <condition property="dbprovider" value="hsqldb" else="h2"> <contains string="${jdbc.driver}" substring="hsqldb" casesensitive="true"/> </condition> <condition property="cp" value=""*"" else=""*""> <!--else="${dbprovider}*.jar" --> <contains string="${os.name}" substring="windows" casesensitive="false"/> </condition> <condition property="cmdline" value="${cmdpref}java -cp ${cp} org.hsqldb.Server -database.0 file:${jdbc.database} -port ${jdbc.port} -silent false -trace true ${cmdargs}" else="${cmdpref}java -cp ${cp} org.h2.tools.Server -baseDir ${basedir} -tcp -tcpPort ${jdbc.port} -trace -ifNotExists ${cmdargs}"> <contains string="${jdbc.driver}" substring="hsqldb" casesensitive="true"/> </condition> <condition property="dotslash" value="" else="./"> <contains string="${os.name}" substring="windows" casesensitive="false"/> </condition> <echo file="runServer.cmd">${cmdline}</echo> <chmod perm="+x" file="runServer.cmd" /> </target> <target name="run.db.server" depends="create.db.server.run.file"> <!-- start the database with name ${basedir} --> <!-- optional but unsecure: -web -webDaemon -tcpAllowOthers --> <ant antfile="shell.xml" target="sh.exec.cmd"> <property name="sh.exec.cmd.dir" value="${basedir}"/> <property name="sh.exec.cmd.arg1" value="${start}"/> <property name="sh.exec.cmd.arg2" value="${dotslash}runServer.cmd"/> <property name="sh.exec.cmd.arg3" value="${background}"/> </ant> </target> <target name="do.all" depends="init.jdbc.connection" description="creates database from ddl and entity beans from jdbc-connection"> <parallel failonany="true"> <!-- first, start the database server and wait... --> <antcall target="run.db.server" /> <sequential> <property name="sh.sleep.milliseconds" value="3000" /> <ant antfile="shell.xml" target="sh.sleep"/> <!-- create the database --> <antcall target="create.database"/> <!-- create the beans jar file --> <ant antfile="reverse-eng.xml" /> <!-- start the nano-h5 application if not started from there. --> <condition property="sh.disable.exec.cmd" value="true"> <istrue value="${nano.h5.running}"/> </condition> <ant antfile="shell.xml" target="sh.exec.cmd"> <property name="sh.exec.cmd.dir" value="${basedir}/.."/> <property name="sh.exec.cmd.arg1" value="${start}"/> <property name="sh.exec.cmd.arg2" value="run.bat"/> <property name="sh.exec.cmd.arg3" value="${basedir}"/> <property name="sh.exec.cmd.arg4" value="${background}"/> </ant> <fail message="mda generation task successful finished!"/> </sequential> </parallel> <echo message="mda generation finished!"/> </target> </project>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy