HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2017-09-19 a696ddfc3104fd18654689847e30d32de3dcd89e
load config on queue-server
3 files modified
52 ■■■■■ changed files
hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java 35 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/db/MySqlDatabaseProcessorFactory.java 11 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/db/PgSqlDatabaseProcessorFactory.java 6 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java
@@ -18,25 +18,24 @@
    final private String driver;
    final private String url;
    final private String user;
    final private String password;
    final private List<String> sql;
    
    private String errorMsg;
    public JDBCProcessor(final String driver, final String url, final String user, final String password) {
        this.driver = driver;
        this.url = url;
        this.user = user;
        this.password = password;
        this.errorMsg = "";
        this.sql = new ArrayList<String>();
        LOG.info("Constructor 1 - DB-User: " + user + "  Password: " + password);
    }
    public JDBCProcessor(final String driver, final String url) throws ProcessorException {
        this.driver = driver;
        this.url = url;
        this.errorMsg = "";
        this.sql = new ArrayList<String>();
    }
    public void addSQL(String sqlStatement) {
        sql.add(sqlStatement);
    }
    public Object process() throws ProcessorException {
        Connection c = null;
        String user, password;
        final Config config = Config.getInstance();
        if ("com.mysql.jdbc.Driver".equals(driver)) {
            user = config.getProperty("mysqladmin.user", "root");
@@ -49,17 +48,7 @@
                throw new ProcessorException("database admin-user configuration failed");
            }
        }
        LOG.info("Constructor 2 - DB-User: " + user + "  Password: " + password);
        this.errorMsg = "";
        this.sql = new ArrayList<String>();
    }
    public void addSQL(String sqlStatement) {
        sql.add(sqlStatement);
    }
    public Object process() throws ProcessorException {
        Connection c = null;
        LOG.info("process() - DB-User: " + user + "  Password: " + password);
        try {
            Class.forName(driver);
            c = DriverManager.getConnection(url, user, password);
hsarback/src/de/hsadmin/mods/db/MySqlDatabaseProcessorFactory.java
@@ -15,11 +15,12 @@
 * @author mi
 */
public class MySqlDatabaseProcessorFactory implements EntityProcessorFactory {
    public static JDBCProcessor createMySqlProcessor(String database,
            String user, String password) {
        return new JDBCProcessor("com.mysql.jdbc.Driver",
                "jdbc:mysql://localhost/" + database, user, password);
    }
//    public static JDBCProcessor createMySqlProcessor(String database,
//            String user, String password) {
//        return new JDBCProcessor("com.mysql.jdbc.Driver",
//                "jdbc:mysql://localhost/" + database, user, password);
//    }
    public static JDBCProcessor createMySqlAdminProcessor() throws ProcessorException {
        return new JDBCProcessor("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/");
hsarback/src/de/hsadmin/mods/db/PgSqlDatabaseProcessorFactory.java
@@ -10,9 +10,9 @@
public class PgSqlDatabaseProcessorFactory implements EntityProcessorFactory {
    
    public static JDBCProcessor createPostgreSqlProcessor(String user, String password) {
        return new JDBCProcessor("org.postgresql.Driver", "jdbc:postgresql://localhost/template1", user, password);
    }
//    public static JDBCProcessor createPostgreSqlProcessor(String user, String password) {
//        return new JDBCProcessor("org.postgresql.Driver", "jdbc:postgresql://localhost/template1", user, password);
//    }
    public static JDBCProcessor createPostgreSqlAdminProcessor() throws ProcessorException {
        return new JDBCProcessor("org.postgresql.Driver", "jdbc:postgresql://localhost/template1");