Skip to content

Commit

Permalink
Resynced CasquatchDaoBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
tdl-jturner committed Aug 20, 2019
1 parent 5e4606e commit 6b03b67
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/* Copyright 2018 T-Mobile US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2018 T-Mobile US, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tmobile.opensource.casquatch;

import com.datastax.oss.driver.api.core.CqlSession;
Expand All @@ -30,13 +31,14 @@ import java.util.*;
/**
* Builder for {@link CasquatchDao}
*/
@SuppressWarnings({"WeakerAccess", "SpellCheckingInspection"})
@Slf4j
public class ${naming.classToSimpleClass(class)} {

private final Map<String,Object> configMap = new HashMap<>();
private String prefix=null;
private String path=null;
private Config config;
protected final Map<String,Object> configMap = new HashMap<>();
protected String prefix=null;
protected String path=null;
protected Config config;

/**
* Clear cached configuration
Expand Down Expand Up @@ -183,6 +185,7 @@ public class ${naming.classToSimpleClass(class)} {
List<String> list;
if(this.configMap.containsKey(key)) {
if(this.configMap.get(key) instanceof List) {
//noinspection unchecked
list = (List<String>) this.configMap.get(key);
list.addAll(valueList);
}
Expand Down Expand Up @@ -215,10 +218,10 @@ public class ${naming.classToSimpleClass(class)} {
<#case "LIST">
public CasquatchDaoBuilder ${naming.configToFunction(key)}(String value) {
if(value.contains(",")) {
return this.with("${key}", Arrays.asList(value.split(",")));
return this.with("${key}", Collections.singletonList(value.split(",")));
}
else {
return this.with("${key}", Arrays.asList(value));
return this.with("${key}", Collections.singletonList(value));
}
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public Config getConfig() {
if (!this.configMap.isEmpty()) {
for (Map.Entry<String, Object> entry : this.configMap.entrySet()) {
if (entry.getValue() != null && !(entry.getValue() instanceof String && ((String) entry.getValue()).isEmpty())) {
log.debug("Runtime Property: {} -> {}", entry.getKey(), entry.getValue());
if (log.isTraceEnabled())
log.trace("Runtime Property: {} -> {}", entry.getKey(), entry.getValue());
this.config = this.config.withValue(entry.getKey(), ConfigValueFactory.fromAnyRef(entry.getValue()));
}
}
Expand Down Expand Up @@ -300,6 +301,18 @@ public CasquatchDaoBuilder withAdvancedAddressTranslatorClass(String value) {
return this.with("advanced.address-translator.class",value);
}

/**
* Add value to property list mapped to solr-query-options.null-saving-strategy
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withSolrQueryOptionsNullSavingStrategy(String value) {
return this.with("solr-query-options.null-saving-strategy",value);
}

/**
* Add value to property list mapped to advanced.control-connection.schema-agreement.timeout
*
Expand Down Expand Up @@ -456,6 +469,18 @@ public CasquatchDaoBuilder withAdvancedAuthProviderPassword(String value) {
return this.with("advanced.auth-provider.password",value);
}

/**
* Add value to property list mapped to query-options.profile
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withQueryOptionsProfile(String value) {
return this.with("query-options.profile",value);
}

/**
* Add value to property list mapped to advanced.netty.admin-group.shutdown.timeout
*
Expand Down Expand Up @@ -492,6 +517,18 @@ public CasquatchDaoBuilder withAdvancedMetricsNodeCqlMessagesHighestLatency(Stri
return this.with("advanced.metrics.node.cql-messages.highest-latency",value);
}

/**
* Add value to property list mapped to solr-query-options.limit
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withSolrQueryOptionsLimit(Integer value) {
return this.with("solr-query-options.limit",value);
}

/**
* Add value to property list mapped to advanced.netty.admin-group.size
*
Expand Down Expand Up @@ -598,7 +635,7 @@ public CasquatchDaoBuilder withAdvancedControlConnectionSchemaAgreementWarnOnFai
*/
public CasquatchDaoBuilder withAdvancedMetricsNodeEnabled(String value) {
if(value.contains(",")) {
return this.with("advanced.metrics.node.enabled", Arrays.asList(value.split(",")));
return this.with("advanced.metrics.node.enabled", Collections.singletonList(value.split(",")));
}
else {
return this.with("advanced.metrics.node.enabled", Collections.singletonList(value));
Expand Down Expand Up @@ -688,6 +725,18 @@ public CasquatchDaoBuilder withAdvancedSslEngineFactoryTruststorePassword(String
return this.with("advanced.ssl-engine-factory.truststore-password",value);
}

/**
* Add value to property list mapped to query-options.ignore-non-primary-keys
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withQueryOptionsIgnoreNonPrimaryKeys(Boolean value) {
return this.with("query-options.ignore-non-primary-keys",value);
}

/**
* Add value to property list mapped to advanced.metrics.session.throttling.delay.significant-digits
*
Expand All @@ -712,6 +761,18 @@ public CasquatchDaoBuilder withBasicRequestConsistency(String value) {
return this.with("basic.request.consistency",value);
}

/**
* Add value to property list mapped to query-options.persist-nulls
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withQueryOptionsPersistNulls(Boolean value) {
return this.with("query-options.persist-nulls",value);
}

/**
* Add value to property list mapped to advanced.coalescer.reschedule-interval
*
Expand Down Expand Up @@ -758,7 +819,7 @@ public CasquatchDaoBuilder withAdvancedMetricsSessionThrottlingDelayRefreshInter
*/
public CasquatchDaoBuilder withAdvancedMetricsSessionEnabled(String value) {
if(value.contains(",")) {
return this.with("advanced.metrics.session.enabled", Arrays.asList(value.split(",")));
return this.with("advanced.metrics.session.enabled", Collections.singletonList(value.split(",")));
}
else {
return this.with("advanced.metrics.session.enabled", Collections.singletonList(value));
Expand Down Expand Up @@ -824,6 +885,18 @@ public CasquatchDaoBuilder withAdvancedMetricsSessionCqlRequestsRefreshInterval(
return this.with("advanced.metrics.session.cql-requests.refresh-interval",value);
}

/**
* Add value to property list mapped to solr-query-options.consistency
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withSolrQueryOptionsConsistency(String value) {
return this.with("solr-query-options.consistency",value);
}

/**
* Add value to property list mapped to advanced.request-tracker.class
*
Expand Down Expand Up @@ -966,7 +1039,7 @@ public CasquatchDaoBuilder withAdvancedSchemaChangeListenerClass(String value) {
*/
public CasquatchDaoBuilder withBasicContactPoints(String value) {
if(value.contains(",")) {
return this.with("basic.contact-points", Arrays.asList(value.split(",")));
return this.with("basic.contact-points", Collections.singletonList(value.split(",")));
}
else {
return this.with("basic.contact-points", Collections.singletonList(value));
Expand Down Expand Up @@ -1032,6 +1105,18 @@ public CasquatchDaoBuilder withAdvancedSpeculativeExecutionPolicyMaxExecutions(I
return this.with("advanced.speculative-execution-policy.max-executions",value);
}

/**
* Add value to property list mapped to solr-query-options.allow-non-primary-keys
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withSolrQueryOptionsAllowNonPrimaryKeys(Boolean value) {
return this.with("solr-query-options.allow-non-primary-keys",value);
}

/**
* Add value to property list mapped to advanced.timestamp-generator.drift-warning.interval
*
Expand Down Expand Up @@ -1116,6 +1201,18 @@ public CasquatchDaoBuilder withAdvancedConnectionPoolLocalSize(Integer value) {
return this.with("advanced.connection.pool.local.size",value);
}

/**
* Add value to property list mapped to solr-query-options.ignore-non-primary-keys
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withSolrQueryOptionsIgnoreNonPrimaryKeys(Boolean value) {
return this.with("solr-query-options.ignore-non-primary-keys",value);
}

/**
* Add value to property list mapped to advanced.socket.tcp-no-delay
*
Expand Down Expand Up @@ -1380,6 +1477,18 @@ public CasquatchDaoBuilder withAdvancedPreparedStatementsPrepareOnAllNodes(Boole
return this.with("advanced.prepared-statements.prepare-on-all-nodes",value);
}

/**
* Add value to property list mapped to solr-query-options.profile
*
* NOTE: Generated from reference.conf files on release
*
* @param value value for property
* @return builder with property set
*/
public CasquatchDaoBuilder withSolrQueryOptionsProfile(String value) {
return this.with("solr-query-options.profile",value);
}

/**
* Add value to property list mapped to advanced.ssl-engine-factory.hostname-validation
*
Expand Down Expand Up @@ -1450,7 +1559,7 @@ public CasquatchDaoBuilder withProfilesDdlBasicRequestTimeout(String value) {
*/
public CasquatchDaoBuilder withAdvancedSslEngineFactoryCipherSuites(String value) {
if(value.contains(",")) {
return this.with("advanced.ssl-engine-factory.cipher-suites", Arrays.asList(value.split(",")));
return this.with("advanced.ssl-engine-factory.cipher-suites", Collections.singletonList(value.split(",")));
}
else {
return this.with("advanced.ssl-engine-factory.cipher-suites", Collections.singletonList(value));
Expand Down

0 comments on commit 6b03b67

Please sign in to comment.