private void loadConnectionsSpecs() { try{ String propertyFileName = properties == null ? "database.properties" : properties.getProperty(PropertyName.EnvConnectionsFile.name, "database.properties"); Properties connectionProps = readPropertyFile(propertyFileName); for (String env : getEnvironments(connectionProps)) { String jndiName = env + "." + "jndi"; if (connectionProps.containsKey(jndiName)) { connectionSpecMap.put(env, new ConnectionJndiSpec(connectionProps.getProperty(jndiName))); } else { String driver = connectionProps.getProperty(env + ".driver"); String userName = connectionProps.getProperty(env + ".username"); String password = connectionProps.getProperty(env + ".password"); String url = connectionProps.getProperty(env + ".url"); if (driver == null || userName == null || password == null || url == null) { throw new InitException("Four JDBC properties are expected: driver, username, password, url for environment: " + env); } connectionSpecMap.put(env, new ConnectionJdbcSpec(driver, url, userName, password)); } } }catch(Exception e){ // in case property file not found, do nothing } overrideFromEnvironmentVariables(); overrideFromSystemProperties(); }
private void loadConnectionsSpecs() { try{ String propertyFileName = properties == null ? "database.properties" : properties.getProperty(PropertyName.EnvConnectionsFile.name, "database.properties"); Properties connectionProps = readPropertyFile(propertyFileName); for (String env : getEnvironments(connectionProps)) { String jndiName = env + "." + "jndi"; if (connectionProps.containsKey(jndiName)) { connectionSpecMap.put(env, new ConnectionJndiSpec(connectionProps.getProperty(jndiName))); } else { String driver = connectionProps.getProperty(env + ".driver"); String userName = connectionProps.getProperty(env + ".username"); String password = connectionProps.getProperty(env + ".password"); String url = connectionProps.getProperty(env + ".url"); if (driver == null || userName == null || password == null || url == null) { throw new InitException("Four JDBC properties are expected: driver, username, password, url for environment: " + env); } connectionSpecMap.put(env, new ConnectionJdbcSpec(driver, url, userName, password)); } } }catch(Exception e){ // in case property file not found, do nothing } overrideFromEnvironmentVariables(); overrideFromSystemProperties(); }