import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.SSLOptions;
import com.datastax.driver.core.Session;
-
import org.openecomp.core.nosqldb.util.CassandraUtils;
import java.io.FileInputStream;
for (String address : addresses) {
builder.addContactPoint(address);
}
+
+ //Check if ssl
Boolean isSsl = CassandraUtils.isSsl();
if (isSsl) {
builder.withSSL(getSslOptions().get());
if (isAuthenticate) {
builder.withCredentials(CassandraUtils.getUser(), CassandraUtils.getPassword());
}
-
Cluster cluster = builder.build();
String keyStore = CassandraUtils.getKeySpace();
return cluster.connect(keyStore);
try {
context = getSslContext(truststorePath.get(), truststorePassword.get());
} catch (UnrecoverableKeyException | KeyManagementException
- | NoSuchAlgorithmException | KeyStoreException | CertificateException | IOException e0) {
- throw new RuntimeException(e0);
+ | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException exception) {
+ throw new RuntimeException(exception);
}
String[] css = new String[]{"TLS_RSA_WITH_AES_128_CBC_SHA"};
return Optional.of(new SSLOptions(context, css));
tmf.init(ts);
ctx.init(null, tmf.getTrustManagers(), new SecureRandom());
- } catch (Exception e0) {
- e0.printStackTrace();
+ } catch (Exception exception) {
+ exception.printStackTrace();
} finally {
tsf.close();
private static class ReferenceHolder {
private static final Session CASSANDRA = newCassandraSession();
}
+
+
}