Skip to content
Permalink
Browse files
Merge branch 'develop' of https://github.com/mifosio/provisioner into…
… develop
  • Loading branch information
mifosio-04-04-2018 committed May 2, 2017
2 parents 395224e + d4ee760 commit 2d3ee9d45965b70a98ddcaeac9c361ce29afa0d0
Showing 3 changed files with 25 additions and 3 deletions.
@@ -34,6 +34,8 @@
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.math.BigInteger;

@@ -52,7 +54,7 @@
@EnableCassandra
@EnableServiceException
@EnableApplicationName
public class ProvisionerServiceConfig {
public class ProvisionerServiceConfig extends WebMvcConfigurerAdapter {

public ProvisionerServiceConfig() {
super();
@@ -79,4 +81,9 @@ public TokenProvider tokenProvider(final Environment environment,
public ApiFactory apiFactory(@Qualifier(ProvisionerConstants.LOGGER_NAME) final Logger logger) {
return new ApiFactory(logger);
}

@Override
public void configurePathMatch(final PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(Boolean.FALSE);
}
}
@@ -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.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 @@
*/
@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 @@ private Cluster getCluster(final @Nonnull TenantEntity tenantEntity) {
.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();
@@ -19,7 +19,7 @@
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/provisioner.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>provisioner.%d{yyyy-MM-dd}.log</fileNamePattern>
<fileNamePattern>logs/archive/provisioner.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>7</maxHistory>
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>

0 comments on commit 2d3ee9d

Please sign in to comment.