This is an automated email from the ASF dual-hosted git repository. myrle pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/fineract-cn-provisioner.git
commit 78cddad331c2df93698434dda6609c5e17fa184a Author: mgeiss <mge...@mifos.org> AuthorDate: Thu Apr 20 19:17:04 2017 +0200 freaking cluster builder with user and pwd --- .../internal/repository/TenantCassandraRepository.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/io/mifos/provisioner/internal/repository/TenantCassandraRepository.java b/service/src/main/java/io/mifos/provisioner/internal/repository/TenantCassandraRepository.java index 4af47cd..bbc1b84 100644 --- a/service/src/main/java/io/mifos/provisioner/internal/repository/TenantCassandraRepository.java +++ b/service/src/main/java/io/mifos/provisioner/internal/repository/TenantCassandraRepository.java @@ -15,8 +15,10 @@ */ package io.mifos.provisioner.internal.repository; +import com.datastax.driver.core.AuthProvider; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.DataType; +import com.datastax.driver.core.PlainTextAuthProvider; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Session; import com.datastax.driver.core.schemabuilder.SchemaBuilder; @@ -25,9 +27,11 @@ import com.datastax.driver.mapping.MappingManager; import com.datastax.driver.mapping.Result; import io.mifos.core.cassandra.core.CassandraSessionProvider; import io.mifos.core.cassandra.core.ReplicationStrategyResolver; +import io.mifos.core.cassandra.util.CassandraConnectorConstants; import io.mifos.core.lang.ServiceException; import io.mifos.provisioner.internal.util.ContactPointUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import javax.annotation.Nonnull; @@ -40,12 +44,16 @@ import java.util.function.Consumer; */ @Component public class TenantCassandraRepository { + private final Environment environment; private final CassandraSessionProvider cassandraSessionProvider; private MappingManager mappingManager; @Autowired public TenantCassandraRepository( - final @Nonnull CassandraSessionProvider cassandraSessionProvider) { + final Environment environment, + final @Nonnull CassandraSessionProvider cassandraSessionProvider) { + super(); + this.environment = environment; this.cassandraSessionProvider = cassandraSessionProvider; } @@ -120,6 +128,13 @@ public class TenantCassandraRepository { .builder() .withClusterName(tenantEntity.getClusterName()); + if (this.environment.containsProperty(CassandraConnectorConstants.CLUSTER_USER_PROP)) { + final String user = this.environment.getProperty(CassandraConnectorConstants.CLUSTER_USER_PROP); + final String pwd = this.environment.getProperty(CassandraConnectorConstants.CLUSTER_PASSWORD_PROP); + + final AuthProvider authProvider = new PlainTextAuthProvider(user, pwd); + clusterBuilder.withAuthProvider(authProvider); + } ContactPointUtils.process(clusterBuilder, tenantEntity.getContactPoints()); return clusterBuilder.build(); -- To stop receiving notification emails like this one, please contact my...@apache.org.