public static JdbcConfiguration load(String filePath) { try { String realPath = PathUtil.getAbstractPath(filePath); logger.debug("Load file:{}", realPath); Properties properties = new Properties(); properties.load(new FileInputStream(realPath)); String url = properties.getProperty(URL_KEY); String username = properties.getProperty(USERNAME_KEY); String password = properties.getProperty(PASSWORD_KEY); return new JdbcConfiguration(url, username, password); } catch (IOException e) { logger.error(e.getMessage(), e); } return null; }
public static JdbcConfiguration load(String filePath) { try { String realPath = PathUtil.getAbstractPath(filePath); logger.debug("Load file:{}", realPath); Properties properties = new Properties(); properties.load(new FileInputStream(realPath)); String url = properties.getProperty(URL_KEY); String username = properties.getProperty(USERNAME_KEY); String password = properties.getProperty(PASSWORD_KEY); return new JdbcConfiguration(url, username, password); } catch (IOException e) { logger.error(e.getMessage(), e); } return null; }
public static MongoDBConfiguration load(String filePath) { try { String realPath = PathUtil.getAbstractPath(filePath); logger.debug("Load file:{}", realPath); Properties properties = new Properties(); properties.load(new FileInputStream(realPath)); String host = properties.getProperty(HOST_KEY, DEFAULT_HOST); int port = Integer.parseInt(properties.getProperty(PORT_KEY, DEFAULT_PORT + "")); String database = properties.getProperty(DATABASE_KEY, DEFAULT_DATABASE); String username = properties.getProperty(USERNAME_KEY); String password = properties.getProperty(PASSWORD_KEY); return new MongoDBConfiguration(host, port, database, username, password); } catch (IOException e) { logger.error(e.getMessage(), e); } return null; }
public static MongoDBConfiguration load(String filePath) { try { String realPath = PathUtil.getAbstractPath(filePath); logger.debug("Load file:{}", realPath); Properties properties = new Properties(); properties.load(new FileInputStream(realPath)); String host = properties.getProperty(HOST_KEY, DEFAULT_HOST); int port = Integer.parseInt(properties.getProperty(PORT_KEY, DEFAULT_PORT + "")); String database = properties.getProperty(DATABASE_KEY, DEFAULT_DATABASE); String username = properties.getProperty(USERNAME_KEY); String password = properties.getProperty(PASSWORD_KEY); return new MongoDBConfiguration(host, port, database, username, password); } catch (IOException e) { logger.error(e.getMessage(), e); } return null; }
public static SSLConfiguration load(String filePath) throws FileNotFoundException, IOException { checkNotNull(filePath, "Argument [filePath] may not be null"); logger.debug("load SSL configuration file:{}", filePath); KeyStoreInfo keyStoreInfo = null; KeyStoreInfo trustKeyStoreInfo = null; Properties properties = new Properties(); properties.load(new FileInputStream(filePath)); String keystorePath = PathUtil.getAbstractPath(properties.getProperty("ssl.keystore.location")); String password = properties.getProperty("ssl.keystore.password"); String type = properties.getProperty("ssl.keystore.type", "JSK"); String trustKeystorePath = PathUtil.getAbstractPath(properties.getProperty("ssl.trustStore.location")); String trustPassword = properties.getProperty("ssl.trustStore.password"); String trustType = properties.getProperty("ssl.trustStore.type", "JSK"); if (!Strings.isNullOrEmpty(keystorePath)) { keyStoreInfo = new KeyStoreInfo(keystorePath, password, type); } if (!Strings.isNullOrEmpty(trustKeystorePath)) { trustKeyStoreInfo = new KeyStoreInfo(trustKeystorePath, trustPassword, trustType); } String clientAuthValue = properties.getProperty("ssl.client.auth", "false"); boolean clientAuth = false; if (clientAuthValue.equalsIgnoreCase("true")) { clientAuth = true; } return new SSLConfiguration(keyStoreInfo, trustKeyStoreInfo, clientAuth); }
public static SSLConfiguration load(String filePath) throws FileNotFoundException, IOException { checkNotNull(filePath, "Argument [filePath] may not be null"); logger.debug("load SSL configuration file:{}", filePath); KeyStoreInfo keyStoreInfo = null; KeyStoreInfo trustKeyStoreInfo = null; Properties properties = new Properties(); properties.load(new FileInputStream(filePath)); String keystorePath = PathUtil.getAbstractPath(properties.getProperty("ssl.keystore.location")); String password = properties.getProperty("ssl.keystore.password"); String type = properties.getProperty("ssl.keystore.type", "JSK"); String trustKeystorePath = PathUtil.getAbstractPath(properties.getProperty("ssl.trustStore.location")); String trustPassword = properties.getProperty("ssl.trustStore.password"); String trustType = properties.getProperty("ssl.trustStore.type", "JSK"); if (!Strings.isNullOrEmpty(keystorePath)) { keyStoreInfo = new KeyStoreInfo(keystorePath, password, type); } if (!Strings.isNullOrEmpty(trustKeystorePath)) { trustKeyStoreInfo = new KeyStoreInfo(trustKeystorePath, trustPassword, trustType); } String clientAuthValue = properties.getProperty("ssl.client.auth", "false"); boolean clientAuth = false; if (clientAuthValue.equalsIgnoreCase("true")) { clientAuth = true; } return new SSLConfiguration(keyStoreInfo, trustKeyStoreInfo, clientAuth); }
public FileBasedUserManager(String storeFile, boolean autoReload, long reloadAfter) throws IOException { storeFile = PathUtil.getAbstractPath(storeFile); this.storeFile = new File(storeFile); this.autoReload = autoReload; this.reloadAfter = reloadAfter; loadFromFile(); if (this.autoReload) { autoReloadService = new AutoReloadService(this.reloadAfter); autoReloadService.start(); } }
public FileBasedUserManager(String storeFile, boolean autoReload, long reloadAfter) throws IOException { storeFile = PathUtil.getAbstractPath(storeFile); this.storeFile = new File(storeFile); this.autoReload = autoReload; this.reloadAfter = reloadAfter; loadFromFile(); if (this.autoReload) { autoReloadService = new AutoReloadService(this.reloadAfter); autoReloadService.start(); } }
username = values[2]; password = values[3]; trustKeyStoreInfo = new KeyStoreInfo(PathUtil.getAbstractPath(values[4]), values[5]); configuration = new SSLConfiguration(null, trustKeyStoreInfo); socks = new SSLSocks5(new InetSocketAddress(host, port), configuration); username = values[2]; password = values[3]; trustKeyStoreInfo = new KeyStoreInfo(PathUtil.getAbstractPath(values[4]), values[5]); keyStoreInfo = new KeyStoreInfo(PathUtil.getAbstractPath(values[6]), values[7]); configuration = new SSLConfiguration(keyStoreInfo, trustKeyStoreInfo); socks = new SSLSocks5(new InetSocketAddress(host, port), configuration);
username = values[2]; password = values[3]; trustKeyStoreInfo = new KeyStoreInfo(PathUtil.getAbstractPath(values[4]), values[5]); configuration = new SSLConfiguration(null, trustKeyStoreInfo); socks = new SSLSocks5(new InetSocketAddress(host, port), configuration); username = values[2]; password = values[3]; trustKeyStoreInfo = new KeyStoreInfo(PathUtil.getAbstractPath(values[4]), values[5]); keyStoreInfo = new KeyStoreInfo(PathUtil.getAbstractPath(values[6]), values[7]); configuration = new SSLConfiguration(keyStoreInfo, trustKeyStoreInfo); socks = new SSLSocks5(new InetSocketAddress(host, port), configuration);