private static Config getOrDefault( Config config ) { return config != null ? config : Config.defaultConfig(); } }
protected Config neo4jConfig() { return Config.defaultConfig(); }
protected Config neo4jConfig() { return Config.defaultConfig(); }
/** * Return a driver for a Neo4j instance with the default configuration settings * * @param uri the URL to a Neo4j instance * @param authToken authentication to use, see {@link AuthTokens} * @return a new driver to the database instance specified by the URL */ public static Driver driver( URI uri, AuthToken authToken ) { return driver( uri, authToken, Config.defaultConfig() ); }
/** * Return a driver for a Neo4j instance with the default configuration settings * * @param uri the URL to a Neo4j instance * @return a new driver to the database instance specified by the URL */ public static Driver driver( URI uri ) { return driver( uri, Config.defaultConfig() ); }
/** * Return a driver for a Neo4j instance with the default configuration settings * * @param uri the URL to a Neo4j instance * @return a new driver to the database instance specified by the URL */ public static Driver driver( String uri ) { return driver( uri, Config.defaultConfig() ); }
/** * Return a driver for a Neo4j instance with the default configuration settings * * @param uri the URL to a Neo4j instance * @param authToken authentication to use, see {@link AuthTokens} * @return a new driver to the database instance specified by the URL */ public static Driver driver( String uri, AuthToken authToken ) { return driver( uri, authToken, Config.defaultConfig() ); }
private static synchronized void cleanupNeo4jKnownHosts(Neo4jServerLoader neo4jServerLoader) { File hostsFile = Config.defaultConfig().trustStrategy().certFile(); try { if (hostsFile != null && hostsFile.isFile()) { List<String> lines = FileUtil.loadLines(hostsFile); List<String> updatedLines = lines.stream() .filter((line) -> !line.startsWith(neo4jServerLoader.getBoltHost() + ":" + neo4jServerLoader.getBoltPort())) .filter((line) -> !line.isEmpty()) .collect(Collectors.toList()); FileUtil.writeToFile(hostsFile, String.join(System.lineSeparator(), updatedLines) + System.lineSeparator()); } } catch (Exception e) { Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } } }