[med-svn] r7820 - in trunk/packages/biomaj/tags: . 1.2.0-1 1.2.0-1/debian 1.2.0-1/debian/patches
olivier sallou
osallou-guest at alioth.debian.org
Fri Sep 16 08:44:01 UTC 2011
Author: osallou-guest
Date: 2011-09-16 08:44:00 +0000 (Fri, 16 Sep 2011)
New Revision: 7820
Added:
trunk/packages/biomaj/tags/1.2.0-1/
trunk/packages/biomaj/tags/1.2.0-1/debian/
trunk/packages/biomaj/tags/1.2.0-1/debian/patches/removeSqlToolDependency
trunk/packages/biomaj/tags/1.2.0-1/debian/postinst
Removed:
trunk/packages/biomaj/tags/1.2.0-1/debian/
trunk/packages/biomaj/tags/1.2.0-1/debian/patches/removeSqlToolDependency
trunk/packages/biomaj/tags/1.2.0-1/debian/postinst
Log:
[svn-buildpackage] Tagging biomaj 1.2.0-1
Deleted: trunk/packages/biomaj/tags/1.2.0-1/debian/patches/removeSqlToolDependency
===================================================================
--- trunk/packages/biomaj/trunk/debian/patches/removeSqlToolDependency 2011-09-14 09:35:54 UTC (rev 7786)
+++ trunk/packages/biomaj/tags/1.2.0-1/debian/patches/removeSqlToolDependency 2011-09-16 08:44:00 UTC (rev 7820)
@@ -1,351 +0,0 @@
-Author: Olivier Sallou <olivier.sallou at irisa.fr>
-Subject: remove usage of hsqld2
-Description: remote sqltool references, not used in debian packaging as hsqldb2 is not packaged.
-Last-Update: 2011-08
---- a/usr/share/biomaj/src/org/inria/biomaj/exe/migration/CoreMigrationFrom1_1To1_2.java
-+++ b/usr/share/biomaj/src/org/inria/biomaj/exe/migration/CoreMigrationFrom1_1To1_2.java
-@@ -14,8 +14,8 @@
- import java.util.List;
- import java.util.UUID;
-
--import org.hsqldb.cmdline.SqlFile;
--import org.hsqldb.cmdline.SqlToolError;
-+//import org.hsqldb.cmdline.SqlFile;
-+//import org.hsqldb.cmdline.SqlToolError;
- import org.inria.biomaj.singleton.BiomajInformation;
- import org.inria.biomaj.sql.SQLConnection;
- import org.inria.biomaj.sql.SQLConnectionFactory;
-@@ -210,19 +210,6 @@
- }
-
- private static void createNewHSQLTables(Statement stat) {
-- File file = new File(biomajRoot + "/sql/hsql-to_1.2.sql");
-- try {
-- SqlFile sqlFile = new SqlFile(file);
-- sqlFile.setConnection(stat.getConnection());
--
-- sqlFile.execute();
-- } catch (IOException e) {
-- e.printStackTrace();
-- } catch (SQLException e) {
-- e.printStackTrace();
-- } catch (SqlToolError e) {
-- e.printStackTrace();
-- }
- }
-
- private static boolean createNewMySQLTables(SQLConnection connection, Statement stat) {
---- a/usr/share/biomaj/src/org/inria/biomaj/sql/HSQLDBConnection.java
-+++ b/usr/share/biomaj/src/org/inria/biomaj/sql/HSQLDBConnection.java
-@@ -21,8 +21,6 @@
- import java.util.UUID;
-
- import org.apache.commons.dbcp.BasicDataSource;
--import org.hsqldb.cmdline.SqlFile;
--import org.hsqldb.cmdline.SqlToolError;
- import org.inria.biomaj.singleton.BiomajLogger;
- import org.inria.biomaj.utils.BiomajConst;
- import org.inria.biomaj.utils.BiomajUtils;
-@@ -131,156 +129,7 @@
- @Override
- public boolean createDB(String adminLogin, String adminPasswd, String adminMail) {
-
-- Statement statement = getStatement();
-- try {
--
-- TreeSet<String> versions = new TreeSet<String>();
-- File[] filz = new File(dbPath).listFiles(new FilenameFilter() {
--
-- @Override
-- public boolean accept(File dir, String name) {
-- return name.startsWith("hsql-to");
-- }
-- });
--
-- for (File fl : filz) {
-- versions.add(fl.getName()); // sort versions
-- }
--
-- List<String> runFiles = new ArrayList<String>();
-- Collections.addAll(runFiles, new File(dbPath + "/migration").list());
--
-- if (!runFiles.contains("hsql.sql")) { // Run all
-- System.out.println("Run all sql scripts...");
-- /*
-- * Base file
-- */
-- File file = new File(dbPath + "/hsql.sql");
-- SqlFile sqlFile = new SqlFile(file);
-- sqlFile.setConnection(statement.getConnection());
--
-- sqlFile.execute();
--
-- System.out.println("hsql.sql run.");
-- writeFileVersion("hsql.sql");
--
-- /*
-- * New versions
-- */
-- for (String name : versions) {
-- File nf = new File(dbPath + "/" + name);
-- sqlFile = new SqlFile(nf);
-- sqlFile.setConnection(statement.getConnection());
-- sqlFile.execute();
--
-- System.out.println(name + " run.");
-- writeFileVersion(name);
-- }
--
-- } else {
-- System.out.println("Run new sql scripts...");
-- /*
-- * New versions only
-- */
-- for (String name : versions) {
-- if (!runFiles.contains(name)) {
-- File file = new File(dbPath + "/" + name);
-- SqlFile sqlFile = new SqlFile(file);
-- sqlFile.setConnection(statement.getConnection());
--
-- sqlFile.execute();
--
-- System.out.println(name + " run.");
-- writeFileVersion(name);
-- }
-- }
-- }
--
-- /*
-- * Insert admin records
-- */
--
-- // Generates admin auth_key
-- String key = UUID.randomUUID().toString();
-- String hash = "";
--
-- // Generates password hash
-- MessageDigest digest;
-- try {
-- digest = MessageDigest.getInstance("SHA1");
-- digest.update(passwd.getBytes());
-- byte[] hashedPasswd = digest.digest();
-- hash = BiomajUtils.getHexString(hashedPasswd);
-- } catch (NoSuchAlgorithmException e) {
-- e.printStackTrace();
-- }
--
-- String testUser = "SELECT * FROM bw_user WHERE login='" + adminLogin + "'";
-- ResultSet rs = executeQuery(testUser, statement);
-- if (!rs.next()) {
--
-- String insertUser = "INSERT INTO bw_user(login, password, auth_type, auth_key, mail_address) " +
-- "VALUES('" + adminLogin + "','" + hash + "','local','" + key + "','" + adminMail + "')";
-- int userId = executeUpdateAndGetGeneratedKey(insertUser, statement);
--
-- String testGroup = "SELECT idgroup FROM bw_group WHERE name='admin'";
-- rs = executeQuery(testGroup, statement);
-- int groupId;
-- if (rs.next()) {
-- System.out.println("Adding " + adminLogin + " to current admin group");
-- groupId = rs.getInt(1);
-- } else {
-- String createGroup = "INSERT INTO bw_group(name) VALUES('admin')";
-- groupId = executeUpdateAndGetGeneratedKey(createGroup, statement);
-- }
--
-- String userToGroup = "INSERT INTO bw_user_has_group(ref_iduser, ref_idgroup) VALUES(" + userId + "," + groupId + ")";
-- executeUpdate(userToGroup, statement);
--
--
-- boolean updated = false;
-- try {
-- String testTable = "SELECT visibility FROM bank";
-- statement.executeQuery(testTable);
-- updated = true; // No error, column already added
-- } catch (SQLException e) {
-- updated = false;
-- }
--
-- if (!updated) { // Not yet updated
--
-- String hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN ref_iduser INT DEFAULT " + userId;
-- executeUpdate(hsql_addColumnToBank, statement);
--
-- hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN visibility BOOLEAN DEFAULT false";
-- executeUpdate(hsql_addColumnToBank, statement);
--
-- String hsql_addConstraint = "ALTER TABLE bank ADD CONSTRAINT fk_bank_to_user FOREIGN KEY (ref_iduser) REFERENCES bw_user(iduser)";
-- executeUpdate(hsql_addConstraint, statement);
-- }
--
-- } else {
-- System.err.println("User " + adminLogin + " already exists");
-- }
--
--
--
-- SQLConnectionFactory.closeConnection(statement);
--// statement.executeBatch();
-- } catch (SQLException e) {
-- SQLConnectionFactory.closeConnection(statement);
-- e.printStackTrace();
-- return false;
-- } catch (IOException e) {
-- SQLConnectionFactory.closeConnection(statement);
-- e.printStackTrace();
-- return false;
-- } catch (SqlToolError e) {
-- SQLConnectionFactory.closeConnection(statement);
-- e.printStackTrace();
-- return false;
-- }
-- return true;
-+ return false;
- }
-
- private void writeFileVersion(String name) throws IOException {
---- a/usr/share/biomaj/src/org/inria/biomaj/sql/TestConnection.java
-+++ b/usr/share/biomaj/src/org/inria/biomaj/sql/TestConnection.java
-@@ -16,8 +16,6 @@
- import java.util.UUID;
-
- import org.apache.commons.dbcp.BasicDataSource;
--import org.hsqldb.cmdline.SqlFile;
--import org.hsqldb.cmdline.SqlToolError;
- import org.inria.biomaj.singleton.BiomajLogger;
- import org.inria.biomaj.utils.BiomajUtils;
-
-@@ -61,132 +59,7 @@
- @Override
- public boolean createDB(String adminLogin, String adminPasswd, String adminMail) {
-
-- Statement statement = getStatement();
-- try {
--
-- TreeSet<String> versions = new TreeSet<String>();
-- File[] filz = new File(dbPath).listFiles(new FilenameFilter() {
--
-- @Override
-- public boolean accept(File dir, String name) {
-- return name.startsWith("hsql-to");
-- }
-- });
--
-- for (File fl : filz) {
-- versions.add(fl.getName()); // sort versions
-- }
--
--
-- /*
-- * Base file
-- */
-- File file = new File(dbPath + "/hsql.sql");
-- SqlFile sqlFile = new SqlFile(file);
-- sqlFile.setConnection(statement.getConnection());
--
-- sqlFile.execute();
--
-- System.out.println("hsql.sql run.");
--
-- /*
-- * New versions
-- */
-- for (String name : versions) {
-- File nf = new File(dbPath + "/" + name);
-- sqlFile = new SqlFile(nf);
-- sqlFile.setConnection(statement.getConnection());
-- sqlFile.execute();
--
-- System.out.println(name + " run.");
-- }
--
--
--
-- /*
-- * Insert admin records
-- */
--
-- // Generates admin auth_key
-- String key = UUID.randomUUID().toString();
-- String hash = "";
--
-- // Generates password hash
-- MessageDigest digest;
-- try {
-- digest = MessageDigest.getInstance("SHA1");
-- digest.update(passwd.getBytes());
-- byte[] hashedPasswd = digest.digest();
-- hash = BiomajUtils.getHexString(hashedPasswd);
-- } catch (NoSuchAlgorithmException e) {
-- e.printStackTrace();
-- }
--
-- String testUser = "SELECT * FROM bw_user WHERE login='" + adminLogin + "'";
-- ResultSet rs = executeQuery(testUser, statement);
-- if (!rs.next()) {
--
-- String insertUser = "INSERT INTO bw_user(login, password, auth_type, auth_key, mail_address) " +
-- "VALUES('" + adminLogin + "','" + hash + "','local','" + key + "','" + adminMail + "')";
-- int userId = executeUpdateAndGetGeneratedKey(insertUser, statement);
--
-- String testGroup = "SELECT idgroup FROM bw_group WHERE name='admin'";
-- rs = executeQuery(testGroup, statement);
-- int groupId;
-- if (rs.next()) {
-- System.out.println("Adding " + adminLogin + " to current admin group");
-- groupId = rs.getInt(1);
-- } else {
-- String createGroup = "INSERT INTO bw_group(name) VALUES('admin')";
-- groupId = executeUpdateAndGetGeneratedKey(createGroup, statement);
-- }
--
-- String userToGroup = "INSERT INTO bw_user_has_group(ref_iduser, ref_idgroup) VALUES(" + userId + "," + groupId + ")";
-- executeUpdate(userToGroup, statement);
--
-- boolean updated = false;
-- try {
-- String testTable = "SELECT visibility FROM bank";
-- statement.executeQuery(testTable);
-- updated = true; // No error, column already added
-- } catch (SQLException e) {
-- updated = false;
-- }
--
-- if (!updated) { // Not yet updated
--
-- String hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN ref_iduser INT DEFAULT " + userId;
-- executeUpdate(hsql_addColumnToBank, statement);
--
-- hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN visibility BOOLEAN DEFAULT false";
-- executeUpdate(hsql_addColumnToBank, statement);
--
-- String hsql_addConstraint = "ALTER TABLE bank ADD CONSTRAINT fk_bank_to_user FOREIGN KEY (ref_iduser) REFERENCES bw_user(iduser)";
-- executeUpdate(hsql_addConstraint, statement);
-- }
--
-- } else {
-- System.err.println("User " + adminLogin + " already exists");
-- }
--
--
--
-- SQLConnectionFactory.closeConnection(statement);
--// statement.executeBatch();
-- } catch (SQLException e) {
-- SQLConnectionFactory.closeConnection(statement);
-- e.printStackTrace();
-- return false;
-- } catch (IOException e) {
-- SQLConnectionFactory.closeConnection(statement);
-- e.printStackTrace();
-- return false;
-- } catch (SqlToolError e) {
-- SQLConnectionFactory.closeConnection(statement);
-- e.printStackTrace();
-- return false;
-- }
-- return true;
-+ return false;
- }
-
- private Connection getConnection() {
Copied: trunk/packages/biomaj/tags/1.2.0-1/debian/patches/removeSqlToolDependency (from rev 7790, trunk/packages/biomaj/trunk/debian/patches/removeSqlToolDependency)
===================================================================
--- trunk/packages/biomaj/tags/1.2.0-1/debian/patches/removeSqlToolDependency (rev 0)
+++ trunk/packages/biomaj/tags/1.2.0-1/debian/patches/removeSqlToolDependency 2011-09-16 08:44:00 UTC (rev 7820)
@@ -0,0 +1,349 @@
+Author: Olivier Sallou <olivier.sallou at irisa.fr>
+Subject: remove usage of hsqld2
+Description: remote sqltool references, not used in debian packaging as hsqldb2 is not packaged.
+Last-Update: 2011-08
+--- a/usr/share/biomaj/src/org/inria/biomaj/exe/migration/CoreMigrationFrom1_1To1_2.java
++++ b/usr/share/biomaj/src/org/inria/biomaj/exe/migration/CoreMigrationFrom1_1To1_2.java
+@@ -14,8 +14,8 @@
+ import java.util.List;
+ import java.util.UUID;
+
+-import org.hsqldb.cmdline.SqlFile;
+-import org.hsqldb.cmdline.SqlToolError;
++//import org.hsqldb.cmdline.SqlFile;
++//import org.hsqldb.cmdline.SqlToolError;
+ import org.inria.biomaj.singleton.BiomajInformation;
+ import org.inria.biomaj.sql.SQLConnection;
+ import org.inria.biomaj.sql.SQLConnectionFactory;
+@@ -210,19 +210,6 @@
+ }
+
+ private static void createNewHSQLTables(Statement stat) {
+- File file = new File(biomajRoot + "/sql/hsql-to_1.2.sql");
+- try {
+- SqlFile sqlFile = new SqlFile(file);
+- sqlFile.setConnection(stat.getConnection());
+-
+- sqlFile.execute();
+- } catch (IOException e) {
+- e.printStackTrace();
+- } catch (SQLException e) {
+- e.printStackTrace();
+- } catch (SqlToolError e) {
+- e.printStackTrace();
+- }
+ }
+
+ private static boolean createNewMySQLTables(SQLConnection connection, Statement stat) {
+--- a/usr/share/biomaj/src/org/inria/biomaj/sql/HSQLDBConnection.java
++++ b/usr/share/biomaj/src/org/inria/biomaj/sql/HSQLDBConnection.java
+@@ -21,8 +21,6 @@
+ import java.util.UUID;
+
+ import org.apache.commons.dbcp.BasicDataSource;
+-import org.hsqldb.cmdline.SqlFile;
+-import org.hsqldb.cmdline.SqlToolError;
+ import org.inria.biomaj.singleton.BiomajLogger;
+ import org.inria.biomaj.utils.BiomajConst;
+ import org.inria.biomaj.utils.BiomajUtils;
+@@ -130,156 +128,6 @@
+ */
+ @Override
+ public boolean createDB(String adminLogin, String adminPasswd, String adminMail) {
+-
+- Statement statement = getStatement();
+- try {
+-
+- TreeSet<String> versions = new TreeSet<String>();
+- File[] filz = new File(dbPath).listFiles(new FilenameFilter() {
+-
+- @Override
+- public boolean accept(File dir, String name) {
+- return name.startsWith("hsql-to");
+- }
+- });
+-
+- for (File fl : filz) {
+- versions.add(fl.getName()); // sort versions
+- }
+-
+- List<String> runFiles = new ArrayList<String>();
+- Collections.addAll(runFiles, new File(dbPath + "/migration").list());
+-
+- if (!runFiles.contains("hsql.sql")) { // Run all
+- System.out.println("Run all sql scripts...");
+- /*
+- * Base file
+- */
+- File file = new File(dbPath + "/hsql.sql");
+- SqlFile sqlFile = new SqlFile(file);
+- sqlFile.setConnection(statement.getConnection());
+-
+- sqlFile.execute();
+-
+- System.out.println("hsql.sql run.");
+- writeFileVersion("hsql.sql");
+-
+- /*
+- * New versions
+- */
+- for (String name : versions) {
+- File nf = new File(dbPath + "/" + name);
+- sqlFile = new SqlFile(nf);
+- sqlFile.setConnection(statement.getConnection());
+- sqlFile.execute();
+-
+- System.out.println(name + " run.");
+- writeFileVersion(name);
+- }
+-
+- } else {
+- System.out.println("Run new sql scripts...");
+- /*
+- * New versions only
+- */
+- for (String name : versions) {
+- if (!runFiles.contains(name)) {
+- File file = new File(dbPath + "/" + name);
+- SqlFile sqlFile = new SqlFile(file);
+- sqlFile.setConnection(statement.getConnection());
+-
+- sqlFile.execute();
+-
+- System.out.println(name + " run.");
+- writeFileVersion(name);
+- }
+- }
+- }
+-
+- /*
+- * Insert admin records
+- */
+-
+- // Generates admin auth_key
+- String key = UUID.randomUUID().toString();
+- String hash = "";
+-
+- // Generates password hash
+- MessageDigest digest;
+- try {
+- digest = MessageDigest.getInstance("SHA1");
+- digest.update(adminPasswd.getBytes());
+- byte[] hashedPasswd = digest.digest();
+- hash = BiomajUtils.getHexString(hashedPasswd);
+- } catch (NoSuchAlgorithmException e) {
+- e.printStackTrace();
+- }
+-
+- String testUser = "SELECT * FROM bw_user WHERE login='" + adminLogin + "'";
+- ResultSet rs = executeQuery(testUser, statement);
+- if (!rs.next()) {
+-
+- String insertUser = "INSERT INTO bw_user(login, password, auth_type, auth_key, mail_address) " +
+- "VALUES('" + adminLogin + "','" + hash + "','local','" + key + "','" + adminMail + "')";
+- int userId = executeUpdateAndGetGeneratedKey(insertUser, statement);
+-
+- String testGroup = "SELECT idgroup FROM bw_group WHERE name='admin'";
+- rs = executeQuery(testGroup, statement);
+- int groupId;
+- if (rs.next()) {
+- System.out.println("Adding " + adminLogin + " to current admin group");
+- groupId = rs.getInt(1);
+- } else {
+- String createGroup = "INSERT INTO bw_group(name) VALUES('admin')";
+- groupId = executeUpdateAndGetGeneratedKey(createGroup, statement);
+- }
+-
+- String userToGroup = "INSERT INTO bw_user_has_group(ref_iduser, ref_idgroup) VALUES(" + userId + "," + groupId + ")";
+- executeUpdate(userToGroup, statement);
+-
+-
+- boolean updated = false;
+- try {
+- String testTable = "SELECT visibility FROM bank";
+- statement.executeQuery(testTable);
+- updated = true; // No error, column already added
+- } catch (SQLException e) {
+- updated = false;
+- }
+-
+- if (!updated) { // Not yet updated
+-
+- String hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN ref_iduser INT DEFAULT " + userId;
+- executeUpdate(hsql_addColumnToBank, statement);
+-
+- hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN visibility BOOLEAN DEFAULT false";
+- executeUpdate(hsql_addColumnToBank, statement);
+-
+- String hsql_addConstraint = "ALTER TABLE bank ADD CONSTRAINT fk_bank_to_user FOREIGN KEY (ref_iduser) REFERENCES bw_user(iduser)";
+- executeUpdate(hsql_addConstraint, statement);
+- }
+-
+- } else {
+- System.err.println("User " + adminLogin + " already exists");
+- }
+-
+-
+-
+- SQLConnectionFactory.closeConnection(statement);
+-// statement.executeBatch();
+- } catch (SQLException e) {
+- SQLConnectionFactory.closeConnection(statement);
+- e.printStackTrace();
+- return false;
+- } catch (IOException e) {
+- SQLConnectionFactory.closeConnection(statement);
+- e.printStackTrace();
+- return false;
+- } catch (SqlToolError e) {
+- SQLConnectionFactory.closeConnection(statement);
+- e.printStackTrace();
+- return false;
+- }
+ return true;
+ }
+
+--- a/usr/share/biomaj/src/org/inria/biomaj/sql/TestConnection.java
++++ b/usr/share/biomaj/src/org/inria/biomaj/sql/TestConnection.java
+@@ -16,8 +16,6 @@
+ import java.util.UUID;
+
+ import org.apache.commons.dbcp.BasicDataSource;
+-import org.hsqldb.cmdline.SqlFile;
+-import org.hsqldb.cmdline.SqlToolError;
+ import org.inria.biomaj.singleton.BiomajLogger;
+ import org.inria.biomaj.utils.BiomajUtils;
+
+@@ -60,132 +58,6 @@
+ */
+ @Override
+ public boolean createDB(String adminLogin, String adminPasswd, String adminMail) {
+-
+- Statement statement = getStatement();
+- try {
+-
+- TreeSet<String> versions = new TreeSet<String>();
+- File[] filz = new File(dbPath).listFiles(new FilenameFilter() {
+-
+- @Override
+- public boolean accept(File dir, String name) {
+- return name.startsWith("hsql-to");
+- }
+- });
+-
+- for (File fl : filz) {
+- versions.add(fl.getName()); // sort versions
+- }
+-
+-
+- /*
+- * Base file
+- */
+- File file = new File(dbPath + "/hsql.sql");
+- SqlFile sqlFile = new SqlFile(file);
+- sqlFile.setConnection(statement.getConnection());
+-
+- sqlFile.execute();
+-
+- System.out.println("hsql.sql run.");
+-
+- /*
+- * New versions
+- */
+- for (String name : versions) {
+- File nf = new File(dbPath + "/" + name);
+- sqlFile = new SqlFile(nf);
+- sqlFile.setConnection(statement.getConnection());
+- sqlFile.execute();
+-
+- System.out.println(name + " run.");
+- }
+-
+-
+-
+- /*
+- * Insert admin records
+- */
+-
+- // Generates admin auth_key
+- String key = UUID.randomUUID().toString();
+- String hash = "";
+-
+- // Generates password hash
+- MessageDigest digest;
+- try {
+- digest = MessageDigest.getInstance("SHA1");
+- digest.update(adminPasswd.getBytes());
+- byte[] hashedPasswd = digest.digest();
+- hash = BiomajUtils.getHexString(hashedPasswd);
+- } catch (NoSuchAlgorithmException e) {
+- e.printStackTrace();
+- }
+-
+- String testUser = "SELECT * FROM bw_user WHERE login='" + adminLogin + "'";
+- ResultSet rs = executeQuery(testUser, statement);
+- if (!rs.next()) {
+-
+- String insertUser = "INSERT INTO bw_user(login, password, auth_type, auth_key, mail_address) " +
+- "VALUES('" + adminLogin + "','" + hash + "','local','" + key + "','" + adminMail + "')";
+- int userId = executeUpdateAndGetGeneratedKey(insertUser, statement);
+-
+- String testGroup = "SELECT idgroup FROM bw_group WHERE name='admin'";
+- rs = executeQuery(testGroup, statement);
+- int groupId;
+- if (rs.next()) {
+- System.out.println("Adding " + adminLogin + " to current admin group");
+- groupId = rs.getInt(1);
+- } else {
+- String createGroup = "INSERT INTO bw_group(name) VALUES('admin')";
+- groupId = executeUpdateAndGetGeneratedKey(createGroup, statement);
+- }
+-
+- String userToGroup = "INSERT INTO bw_user_has_group(ref_iduser, ref_idgroup) VALUES(" + userId + "," + groupId + ")";
+- executeUpdate(userToGroup, statement);
+-
+- boolean updated = false;
+- try {
+- String testTable = "SELECT visibility FROM bank";
+- statement.executeQuery(testTable);
+- updated = true; // No error, column already added
+- } catch (SQLException e) {
+- updated = false;
+- }
+-
+- if (!updated) { // Not yet updated
+-
+- String hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN ref_iduser INT DEFAULT " + userId;
+- executeUpdate(hsql_addColumnToBank, statement);
+-
+- hsql_addColumnToBank = "ALTER TABLE bank ADD COLUMN visibility BOOLEAN DEFAULT false";
+- executeUpdate(hsql_addColumnToBank, statement);
+-
+- String hsql_addConstraint = "ALTER TABLE bank ADD CONSTRAINT fk_bank_to_user FOREIGN KEY (ref_iduser) REFERENCES bw_user(iduser)";
+- executeUpdate(hsql_addConstraint, statement);
+- }
+-
+- } else {
+- System.err.println("User " + adminLogin + " already exists");
+- }
+-
+-
+-
+- SQLConnectionFactory.closeConnection(statement);
+-// statement.executeBatch();
+- } catch (SQLException e) {
+- SQLConnectionFactory.closeConnection(statement);
+- e.printStackTrace();
+- return false;
+- } catch (IOException e) {
+- SQLConnectionFactory.closeConnection(statement);
+- e.printStackTrace();
+- return false;
+- } catch (SqlToolError e) {
+- SQLConnectionFactory.closeConnection(statement);
+- e.printStackTrace();
+- return false;
+- }
+ return true;
+ }
+
Deleted: trunk/packages/biomaj/tags/1.2.0-1/debian/postinst
===================================================================
--- trunk/packages/biomaj/trunk/debian/postinst 2011-09-14 09:35:54 UTC (rev 7786)
+++ trunk/packages/biomaj/tags/1.2.0-1/debian/postinst 2011-09-16 08:44:00 UTC (rev 7820)
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-set -e
-
-# Source debconf library.
-. /usr/share/debconf/confmodule
-
-case "$1" in
- configure)
- ant_home="/usr/share/ant"
- biomaj_root="/usr/share/biomaj"
- jdk_home=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
- db_type="MySQL"
- db_get biomaj/mysql_host
- db_url="jdbc:mysql://$RET/biomaj_log"
- db_get biomaj/mysql_login
- db_login="$RET"
- db_get biomaj/mysql_passwd
- db_passwd="$RET"
-
- tomcat_port="0"
-
- cd $biomaj_root
-
- java -cp $biomaj_root/bin Configurator java_home:=$jdk_home ant_home:=$ant_home biomaj_root:=$biomaj_root use_ldap:=$use_ldap ldap_host:=$ldap_host ldap_dn:=$ldap_dn opt_filter:=$opt_filter db_type:=$db_type db_url:=$db_url db_login:=$db_login db_passwd:=$db_passwd app_login:=$app_login app_passwd:=$app_passwd tomcat_port:=$tomcat_port
-
- if [ ! -e /usr/share/biomaj/sql/migration ]; then
- ln -s /var/lib/biomaj/migration /usr/share/biomaj/sql/migration
- fi
- # Database and scripts install and upgrades
- perl /var/lib/biomaj/migration/update.pl -dbuser $db_login -dbpwd $db_passwd -db mysql
-
- ;;
-
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
-
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-
-
-#DEBHELPER#
Copied: trunk/packages/biomaj/tags/1.2.0-1/debian/postinst (from rev 7790, trunk/packages/biomaj/trunk/debian/postinst)
===================================================================
--- trunk/packages/biomaj/tags/1.2.0-1/debian/postinst (rev 0)
+++ trunk/packages/biomaj/tags/1.2.0-1/debian/postinst 2011-09-16 08:44:00 UTC (rev 7820)
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+case "$1" in
+ configure)
+ ant_home="/usr/share/ant"
+ biomaj_root="/usr/share/biomaj"
+ jdk_home=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
+ db_type="MySQL"
+ db_get biomaj/mysql_host
+ db_url="jdbc:mysql://$RET/biomaj_log"
+ db_get biomaj/mysql_login
+ db_login="$RET"
+ db_get biomaj/mysql_passwd
+ db_passwd="$RET"
+
+ tomcat_port="0"
+
+ cd $biomaj_root
+
+ java -cp $biomaj_root/bin Configurator java_home:=$jdk_home ant_home:=$ant_home biomaj_root:=$biomaj_root db_type:=$db_type db_url:=$db_url db_login:=$db_login db_passwd:=$db_passwd
+
+ if [ ! -e /usr/share/biomaj/sql/migration ]; then
+ ln -s /var/lib/biomaj/migration /usr/share/biomaj/sql/migration
+ fi
+ # Database and scripts install and upgrades
+ perl /var/lib/biomaj/migration/update.pl -dbuser $db_login -dbpwd $db_passwd -db mysql
+
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+
+
+#DEBHELPER#
More information about the debian-med-commit
mailing list