org.infinispan.persistence.jdbc.configuration.JdbcMixedStoreConfigurationBuilder Maven / Gradle / Ivy
package org.infinispan.persistence.jdbc.configuration;
import static org.infinispan.configuration.cache.AbstractStoreConfiguration.PROPERTIES;
import static org.infinispan.persistence.jdbc.configuration.JdbcMixedStoreConfiguration.BATCH_SIZE;
import static org.infinispan.persistence.jdbc.configuration.JdbcMixedStoreConfiguration.CONCURRENCY_LEVEL;
import static org.infinispan.persistence.jdbc.configuration.JdbcMixedStoreConfiguration.FETCH_SIZE;
import static org.infinispan.persistence.jdbc.configuration.JdbcMixedStoreConfiguration.KEY2STRING_MAPPER;
import static org.infinispan.persistence.jdbc.configuration.JdbcMixedStoreConfiguration.LOCK_ACQUISITION_TIMEOUT;
import java.util.Map;
import java.util.Properties;
import org.infinispan.commons.CacheConfigurationException;
import org.infinispan.commons.util.TypedProperties;
import org.infinispan.configuration.cache.PersistenceConfigurationBuilder;
import org.infinispan.configuration.parsing.XmlConfigHelper;
import org.infinispan.persistence.keymappers.Key2StringMapper;
/**
*
* JdbcMixedCacheStoreConfigurationBuilder.
*
* @author Tristan Tarrant
* @since 5.2
*/
public class JdbcMixedStoreConfigurationBuilder extends AbstractJdbcStoreConfigurationBuilder
implements JdbcMixedStoreConfigurationChildBuilder {
private final MixedTableManipulationConfigurationBuilder binaryTable;
private final MixedTableManipulationConfigurationBuilder stringTable;
public JdbcMixedStoreConfigurationBuilder(PersistenceConfigurationBuilder builder) {
super(builder, JdbcMixedStoreConfiguration.attributeDefinitionSet());
this.binaryTable = new MixedTableManipulationConfigurationBuilder(this);
this.stringTable = new MixedTableManipulationConfigurationBuilder(this);
}
@Override
public JdbcMixedStoreConfigurationBuilder self() {
return this;
}
/**
* When doing repetitive DB inserts this will be batched
* according to this parameter. This is an optional parameter, and if it is not specified it will
* be defaulted to {@link org.infinispan.persistence.jdbc.TableManager#DEFAULT_BATCH_SIZE}.
*/
public JdbcMixedStoreConfigurationBuilder batchSize(int batchSize) {
attributes.attribute(BATCH_SIZE).set(batchSize);
return this;
}
/**
* For DB queries the fetch size will be set on {@link java.sql.ResultSet#setFetchSize(int)}. This is optional
* parameter, if not specified will be defaulted to {@link org.infinispan.persistence.jdbc.TableManager#DEFAULT_FETCH_SIZE}.
*/
public JdbcMixedStoreConfigurationBuilder fetchSize(int fetchSize) {
attributes.attribute(FETCH_SIZE).set(fetchSize);
return this;
}
/**
* Allows configuration of table-specific parameters such as column names and types for the table
* used to store entries with binary keys
*/
@Override
public MixedTableManipulationConfigurationBuilder binaryTable() {
return binaryTable;
}
/**
* Allows configuration of table-specific parameters such as column names and types for the table
* used to store entries with string keys
*/
@Override
public MixedTableManipulationConfigurationBuilder stringTable() {
return stringTable;
}
@Override
public JdbcMixedStoreConfigurationBuilder withProperties(Properties props) {
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy