/** Initializes the keystore/truststore if the paths have been provided. */ private void initKeystoreAndTruststore() { try { DbClientContext ctx = _dbClient.getLocalContext(); if (isGeoDbsvc()) { ctx = _dbClient.getGeoContext(); } String keystorePath = ctx.getKeyStoreFile(); String truststorePath = ctx.getTrustStoreFile(); if (keystorePath == null && truststorePath == null) { _log.info("Skipping keystore/truststore initialization, no paths provided"); return; } String password = ctx.getTrustStorePassword(); CassandraKeystoreHandler keystoreHandler = new CassandraKeystoreHandler(_coordinator, keystorePath, truststorePath, password); if (keystorePath != null) { _log.info("Initializing keystore for current node: {}", keystorePath); keystoreHandler.saveKeyStore(); } else { _log.info("Skipping keystore initialization, no path provided"); } if (truststorePath != null) { _log.info("Initializing truststore for current node: {}", truststorePath); keystoreHandler.saveTrustStore(); } else { _log.info("Skipping truststore initialization, no path provided"); } } catch (Exception e) { _log.error("Unexpected exception during initializing cassandra keystore", e); throw new IllegalStateException(e); } }