Add db creation from sql script for samples

application-manager-new
charithag 9 years ago
parent e444d60d1c
commit 786cb19eb3

@ -0,0 +1,36 @@
<project name="Arduino" basedir="." default="deploy">
<import file="../common.xml"/>
<property name="sample_type" value="android_sense"/>
<property name="data_source" value="AndroidSenseDM_DB"/>
<target name="create-db" depends="clean">
<mkdir dir="${db.dir}"/>
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/${data_source};DB_CLOSE_ON_EXIT=FALSE"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${db.username}" password="${db.password}" autocommit="true" onerror="continue">
<classpath>
<pathelement location="${lib.dir}/h2-database-engine_1.2.140.wso2v3.jar"/>
</classpath>
<fileset file="dbscripts/${db.type}_${sample_type}.sql"/>
</sql>
</target>
<target name="deploy" depends="create-db">
<copy file="database/${data_source}.h2.db" toDir="${target.db.dir}" overwrite="yes"/>
<copy toDir="${target.sketch.dir}/${sample_type}">
<fileset dir="sketch"/>
</copy>
<copy toDir="${target.unit.dir}/${sample_type}">
<fileset dir="units"/>
</copy>
</target>
<target name="clean">
<delete file="${target.db.dir}/${data_source}.h2.db"/>
<delete dir="${target.sketch.dir}/${sample_type}"/>
<delete dir="${target.unit.dir}/${sample_type}"/>
</target>
</project>

@ -0,0 +1,2 @@
templates=android_sense.apk
zipfilename=android_sense.zip

@ -3,22 +3,34 @@
<import file="../common.xml"/> <import file="../common.xml"/>
<property name="sample_type" value="arduino"/> <property name="sample_type" value="arduino"/>
<property name="data_source" value="ArduinoDM_DB.h2.db"/> <property name="data_source" value="ArduinoDM_DB"/>
<target name="deploy" depends="clean"> <target name="create-db" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/> <mkdir dir="${db.dir}"/>
<copy toDir="${sketches_dir}/${sample_type}"> <property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/${data_source};DB_CLOSE_ON_EXIT=FALSE"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${db.username}" password="${db.password}" autocommit="true" onerror="continue">
<classpath>
<pathelement location="${lib.dir}/h2-database-engine_1.2.140.wso2v3.jar"/>
</classpath>
<fileset file="dbscripts/${db.type}_${sample_type}.sql"/>
</sql>
</target>
<target name="deploy" depends="create-db">
<copy file="database/${data_source}.h2.db" toDir="${target.db.dir}" overwrite="yes"/>
<copy toDir="${target.sketch.dir}/${sample_type}">
<fileset dir="sketch"/> <fileset dir="sketch"/>
</copy> </copy>
<copy toDir="${units_dir}/${sample_type}"> <copy toDir="${target.unit.dir}/${sample_type}">
<fileset dir="units"/> <fileset dir="units"/>
</copy> </copy>
</target> </target>
<target name="clean"> <target name="clean">
<delete file="${database_dir}/${data_source}"/> <delete file="${target.db.dir}/${data_source}.h2.db"/>
<delete dir="${sketches_dir}/${sample_type}"/> <delete dir="${target.sketch.dir}/${sample_type}"/>
<delete dir="${units_dir}/${sample_type}"/> <delete dir="${target.unit.dir}/${sample_type}"/>
</target> </target>
</project> </project>

@ -1,5 +1,10 @@
<project> <project>
<property name="database_dir" value="../../repository/database"/> <property name="lib.dir" value="../../repository/components/plugins"/>
<property name="sketches_dir" value="../../repository/resources/sketches"/> <property name="target.db.dir" value="../../repository/database"/>
<property name="units_dir" value="../../repository/deployment/server/jaggeryapps/iotserver/units"/> <property name="target.sketch.dir" value="../../repository/resources/sketches"/>
<property name="target.unit.dir" value="../../repository/deployment/server/jaggeryapps/iotserver/units"/>
<property name="db.username" value="wso2carbon"/>
<property name="db.password" value="wso2carbon"/>
<property name="db.dir" value="database"/>
<property name="db.type" value="h2"/>
</project> </project>

@ -3,22 +3,34 @@
<import file="../common.xml"/> <import file="../common.xml"/>
<property name="sample_type" value="digital_display"/> <property name="sample_type" value="digital_display"/>
<property name="data_source" value="DigitalDisplayDM_DB.h2.db"/> <property name="data_source" value="DigitalDisplayDM_DB"/>
<target name="deploy" depends="clean"> <target name="create-db" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/> <mkdir dir="${db.dir}"/>
<copy toDir="${sketches_dir}/${sample_type}"> <property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/${data_source};DB_CLOSE_ON_EXIT=FALSE"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${db.username}" password="${db.password}" autocommit="true" onerror="continue">
<classpath>
<pathelement location="${lib.dir}/h2-database-engine_1.2.140.wso2v3.jar"/>
</classpath>
<fileset file="dbscripts/${db.type}_${sample_type}.sql"/>
</sql>
</target>
<target name="deploy" depends="create-db">
<copy file="database/${data_source}.h2.db" toDir="${target.db.dir}" overwrite="yes"/>
<copy toDir="${target.sketch.dir}/${sample_type}">
<fileset dir="sketch"/> <fileset dir="sketch"/>
</copy> </copy>
<copy toDir="${units_dir}/${sample_type}"> <copy toDir="${target.unit.dir}/${sample_type}">
<fileset dir="units"/> <fileset dir="units"/>
</copy> </copy>
</target> </target>
<target name="clean"> <target name="clean">
<delete file="${database_dir}/${data_source}"/> <delete file="${target.db.dir}/${data_source}.h2.db"/>
<delete dir="${sketches_dir}/${sample_type}"/> <delete dir="${target.sketch.dir}/${sample_type}"/>
<delete dir="${units_dir}/${sample_type}"/> <delete dir="${target.unit.dir}/${sample_type}"/>
</target> </target>
</project> </project>

@ -3,22 +3,34 @@
<import file="../common.xml"/> <import file="../common.xml"/>
<property name="sample_type" value="firealarm"/> <property name="sample_type" value="firealarm"/>
<property name="data_source" value="FireAlarmDM_DB.h2.db"/> <property name="data_source" value="FireAlarmDM_DB"/>
<target name="deploy" depends="clean"> <target name="create-db" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/> <mkdir dir="${db.dir}"/>
<copy toDir="${sketches_dir}/${sample_type}"> <property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/${data_source};DB_CLOSE_ON_EXIT=FALSE"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${db.username}" password="${db.password}" autocommit="true" onerror="continue">
<classpath>
<pathelement location="${lib.dir}/h2-database-engine_1.2.140.wso2v3.jar"/>
</classpath>
<fileset file="dbscripts/${db.type}_${sample_type}.sql"/>
</sql>
</target>
<target name="deploy" depends="create-db">
<copy file="database/${data_source}.h2.db" toDir="${target.db.dir}" overwrite="yes"/>
<copy toDir="${target.sketch.dir}/${sample_type}">
<fileset dir="sketch"/> <fileset dir="sketch"/>
</copy> </copy>
<copy toDir="${units_dir}/${sample_type}"> <copy toDir="${target.unit.dir}/${sample_type}">
<fileset dir="units"/> <fileset dir="units"/>
</copy> </copy>
</target> </target>
<target name="clean"> <target name="clean">
<delete file="${database_dir}/${data_source}"/> <delete file="${target.db.dir}/${data_source}.h2.db"/>
<delete dir="${sketches_dir}/${sample_type}"/> <delete dir="${target.sketch.dir}/${sample_type}"/>
<delete dir="${units_dir}/${sample_type}"/> <delete dir="${target.unit.dir}/${sample_type}"/>
</target> </target>
</project> </project>

@ -0,0 +1,36 @@
<project name="Arduino" basedir="." default="deploy">
<import file="../common.xml"/>
<property name="sample_type" value="raspberrypi"/>
<property name="data_source" value="RaspberrypiDM_DB"/>
<target name="create-db" depends="clean">
<mkdir dir="${db.dir}"/>
<property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/${data_source};DB_CLOSE_ON_EXIT=FALSE"/>
<sql driver="org.h2.Driver" url="${dbURL}" userid="${db.username}" password="${db.password}" autocommit="true" onerror="continue">
<classpath>
<pathelement location="${lib.dir}/h2-database-engine_1.2.140.wso2v3.jar"/>
</classpath>
<fileset file="dbscripts/${db.type}_${sample_type}.sql"/>
</sql>
</target>
<target name="deploy" depends="create-db">
<copy file="database/${data_source}.h2.db" toDir="${target.db.dir}" overwrite="yes"/>
<copy toDir="${target.sketch.dir}/${sample_type}">
<fileset dir="sketch"/>
</copy>
<copy toDir="${target.unit.dir}/${sample_type}">
<fileset dir="units"/>
</copy>
</target>
<target name="clean">
<delete file="${target.db.dir}/${data_source}.h2.db"/>
<delete dir="${target.sketch.dir}/${sample_type}"/>
<delete dir="${target.unit.dir}/${sample_type}"/>
</target>
</project>

@ -0,0 +1,2 @@
templates=raspberrypi.deb
zipfilename=raspberrypi.zip

@ -5,24 +5,35 @@
<property name="sample_type" value="sensebot"/> <property name="sample_type" value="sensebot"/>
<property name="data_source" value="SensebotDM_DB.h2.db"/> <property name="data_source" value="SensebotDM_DB.h2.db"/>
<target name="deploy" depends="clean"> <target name="create-db" depends="clean">
<copy file="database/${data_source}" toDir="${database_dir}" overwrite="yes"/> <property name="dbURL" value="jdbc:h2:file:${basedir}/${db.dir}/${data_source};DB_CLOSE_ON_EXIT=FALSE"/>
<copy toDir="${sketches_dir}/${sample_type}">
<sql driver="org.h2.Driver" url="${dbURL}" userid="${db.username}" password="${db.password}" autocommit="true" onerror="continue">
<classpath>
<pathelement location="${lib.dir}/h2-database-engine_1.2.140.wso2v3.jar"/>
</classpath>
<fileset file="dbscripts/${db.type}_${sample_type}.sql"/>
</sql>
</target>
<target name="deploy" depends="create-db">
<copy file="${db.dir}/${data_source}.h2.db" toDir="${target.db.dir}" overwrite="yes"/>
<copy toDir="${target.sketch.dir}/${sample_type}">
<fileset dir="sketch"/> <fileset dir="sketch"/>
</copy> </copy>
<copy toDir="${sketches_dir}/${sample_type}_wifi"> <copy toDir="${target.sketch.dir}/${sample_type}_wifi">
<fileset dir="sketch_wifi"/> <fileset dir="sketch_wifi"/>
</copy> </copy>
<copy toDir="${units_dir}/${sample_type}"> <copy toDir="${target.unit.dir}/${sample_type}">
<fileset dir="units"/> <fileset dir="units"/>
</copy> </copy>
</target> </target>
<target name="clean"> <target name="clean">
<delete file="${database_dir}/${data_source}"/> <delete file="${target.db.dir}/${data_source}.h2.db"/>
<delete dir="${sketches_dir}/${sample_type}"/> <delete dir="${target.sketch.dir}/${sample_type}"/>
<delete dir="${sketches_dir}/${sample_type}_wifi"/> <delete dir="${target.sketch.dir}/${sample_type}_wifi"/>
<delete dir="${units_dir}/${sample_type}"/> <delete dir="${target.unit.dir}/${sample_type}"/>
</target> </target>
</project> </project>
Loading…
Cancel
Save