/[volute]/trunk/projects/theory/snapdm/build_db.xml
ViewVC logotype

Contents of /trunk/projects/theory/snapdm/build_db.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 646 - (show annotations)
Mon Jun 30 10:45:22 2008 UTC (12 years, 4 months ago) by bourges.laurent
File MIME type: text/xml
File size: 2984 byte(s)
- updated uptodate conditions
- removed regexp on DDL scripts
- added windows fix for classpath.flat
1 <!--
2 build_db.xml file : specific targets for database management
3 -->
4
5
6 <!-- presets -->
7
8 <!-- Performs an SQL query with the database defined in jpa-config properties. -->
9 <presetdef name="doSql">
10
11 <sql classpathref="jdbc-drivers.class.path"
12 driver="${eclipselink.jdbc.driver}"
13 url="${eclipselink.jdbc.url}"
14 userid="${eclipselink.jdbc.user}"
15 password="${eclipselink.jdbc.password}" />
16
17 </presetdef>
18
19
20
21
22 <!-- targets -->
23
24 <!-- sets DB properties -->
25 <target name="initForDB">
26 <!-- Get jpa-config properties -->
27 <property file="${properties}/jpa-config.properties" />
28
29 <fail unless="eclipselink.target-database" message="missing eclipselink.target-database in jpa-config.properties !" />
30
31 <fail unless="eclipselink.jdbc.driver" message="missing eclipselink.jdbc.driver in jpa-config.properties !" />
32 <fail unless="eclipselink.jdbc.url" message="missing eclipselink.target-database in jpa-config.properties !" />
33
34 <fail unless="eclipselink.jdbc.user" message="missing eclipselink.jdbc.user in jpa-config.properties !" />
35 <fail unless="eclipselink.jdbc.password" message="missing eclipselink.jdbc.password in jpa-config.properties !" />
36
37 <!-- sets SQL script directory -->
38 <condition property="ddl.directory" value="${output}/ddl/postgres/">
39 <equals arg1="${eclipselink.target-database}" arg2="PostgreSQL" trim="true"/>
40 </condition>
41
42 <condition property="ddl.directory" value="${output}/ddl/mssqlserver/">
43 <equals arg1="${eclipselink.target-database}" arg2="SQLServer" trim="true"/>
44 </condition>
45
46 <condition property="ddl.directory.set">
47 <isset property="ddl.directory"/>
48 </condition>
49
50 <fail unless="ddl.directory.set" message="unable to define ddl.directory property for the given vendor : ${eclipselink.target-database} !" />
51
52 <echo>JDBC URL : ${eclipselink.jdbc.url}</echo>
53 <echo>JDBC USER : ${eclipselink.jdbc.user}</echo>
54 <echo>DDL HOME : ${ddl.directory}</echo>
55
56 </target>
57
58
59
60
61 <!-- target checkDB : is database server alive ? -->
62 <target name="checkDB" depends="initForDB">
63 <echo>checkDB : ${eclipselink.jdbc.url} ...</echo>
64
65 <doSql onerror="abort" print="true">select 1;</doSql>
66
67 <echo>checkDB : done.</echo>
68 </target>
69
70
71
72
73 <!-- target cleanDB : drops views then tables -->
74 <target name="cleanDB" depends="initForDB">
75 <echo>cleanDB : drop views then tables ...</echo>
76
77 <doSql autocommit="true" onerror="continue" src="${ddl.directory}/SimDB_dropViews.sql" />
78 <doSql autocommit="true" onerror="continue" src="${ddl.directory}/SimDB_dropTables.sql" />
79
80 <echo>cleanDB : done.</echo>
81 </target>
82
83
84
85
86 <!-- target createDB : creates tables then views -->
87 <target name="createDB" depends="cleanDB">
88 <echo>createDB : create tables then views ...</echo>
89
90 <doSql onerror="abort" src="${ddl.directory}/SimDB_createTables.sql" />
91 <doSql onerror="abort" src="${ddl.directory}/SimDB_createViews.sql" />
92
93 <echo>createDB : done.</echo>
94 </target>
95
96
97 <!-- end of build_db.xml -->

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26