/** * Creates a DBUtil object based on servlet context configurations. * * @return DBUtil object. * @throws Exception * If an error occurred while reading configurations or while creating database object. */ public static DBUtil getCredentialStoreDBUtil() throws ApplicationSettingsException, IllegalAccessException, ClassNotFoundException, InstantiationException { String jdbcUrl = ServerSettings.getCredentialStoreDBURL(); String userName = ServerSettings.getCredentialStoreDBUser(); String password = ServerSettings.getCredentialStoreDBPassword(); String driverName = ServerSettings.getCredentialStoreDBDriver(); StringBuilder stringBuilder = new StringBuilder("Starting credential store, connecting to database - "); stringBuilder.append(jdbcUrl).append(" DB user - ").append(userName).append(" driver name - ") .append(driverName); log.debug(stringBuilder.toString()); DBUtil dbUtil = new DBUtil(jdbcUrl, userName, password, driverName); dbUtil.init(); return dbUtil; }
databaseURL = ServerSettings.getCredentialStoreDBURL(); databaseUserName = ServerSettings.getCredentialStoreDBUser(); databasePassword = ServerSettings.getCredentialStoreDBPassword();
jdbcURl = ServerSettings.getCredentialStoreDBURL(); jdbcUser = ServerSettings.getCredentialStoreDBUser(); jdbcPassword = ServerSettings.getCredentialStoreDBPassword(); jdbcURl = jdbcURl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword; } catch (ApplicationSettingsException e) {
public CredentialStoreServerHandler() throws ApplicationSettingsException, IllegalAccessException, ClassNotFoundException, InstantiationException { String jdbcUrl = ServerSettings.getCredentialStoreDBURL(); String userName = ServerSettings.getCredentialStoreDBUser(); String password = ServerSettings.getCredentialStoreDBPassword(); String driverName = ServerSettings.getCredentialStoreDBDriver(); log.debug("Starting credential store, connecting to database - " + jdbcUrl + " DB user - " + userName + " driver name - " + driverName); dbUtil = new DBUtil(jdbcUrl, userName, password, driverName); sshCredentialWriter = new SSHCredentialWriter(dbUtil); certificateCredentialWriter = new CertificateCredentialWriter(dbUtil); credentialReader = new CredentialReaderImpl(dbUtil); }
public static CredentialReader getCredentialReader() throws ApplicationSettingsException, IllegalAccessException, InstantiationException { try { String jdbcUrl = ServerSettings.getCredentialStoreDBURL(); String jdbcUsr = ServerSettings.getCredentialStoreDBUser(); String jdbcPass = ServerSettings.getCredentialStoreDBPassword(); String driver = ServerSettings.getCredentialStoreDBDriver(); return new CredentialReaderImpl(new DBUtil(jdbcUrl, jdbcUsr, jdbcPass, driver)); } catch (ClassNotFoundException e) { log.error("Not able to find driver: " + e.getLocalizedMessage()); return null; } }