use of com.hazelcast.config.QueryCacheConfig in project hazelcast by hazelcast.
the class ClientQueryCacheTest method addConfig.
private ClientConfig addConfig(QueryCacheConfig queryCacheConfig, String mapName) {
ClientConfig clientConfig = new ClientConfig();
Map<String, Map<String, QueryCacheConfig>> queryCacheConfigs = clientConfig.getQueryCacheConfigs();
Map<String, QueryCacheConfig> queryCacheConfigMap = queryCacheConfigs.get(mapName);
if (queryCacheConfigMap == null) {
queryCacheConfigMap = new HashMap<String, QueryCacheConfig>();
queryCacheConfigs.put(mapName, queryCacheConfigMap);
}
queryCacheConfigMap.put(queryCacheConfig.getName(), queryCacheConfig);
return clientConfig;
}
use of com.hazelcast.config.QueryCacheConfig in project hazelcast by hazelcast.
the class ClientQueryCacheUpdateTest method setUp.
@Before
public void setUp() {
factory.newHazelcastInstance(getConfig());
QueryCacheConfig queryCacheConfig = new QueryCacheConfig(queryCacheName);
queryCacheConfig.getPredicateConfig().setImplementation(Predicates.sql("id=1"));
ClientConfig config = new ClientConfig();
config.addQueryCacheConfig(mapName, queryCacheConfig);
client = factory.newHazelcastClient(config);
}
use of com.hazelcast.config.QueryCacheConfig in project hazelcast by hazelcast.
the class MemberDomConfigProcessor method mapQueryCacheHandler.
protected void mapQueryCacheHandler(Node n, MapConfig mapConfig) {
for (Node queryCacheNode : childElements(n)) {
if (matches("query-cache", cleanNodeName(queryCacheNode))) {
String cacheName = getTextContent(getNamedItemNode(queryCacheNode, "name"));
QueryCacheConfig queryCacheConfig = new QueryCacheConfig(cacheName);
handleMapQueryCacheNode(mapConfig, queryCacheNode, queryCacheConfig);
}
}
}
use of com.hazelcast.config.QueryCacheConfig in project hazelcast by hazelcast.
the class DynamicConfigXmlGenerator method mapQueryCachesConfigXmlGenerator.
private static void mapQueryCachesConfigXmlGenerator(ConfigXmlGenerator.XmlGenerator gen, MapConfig mapConfig) {
List<QueryCacheConfig> queryCacheConfigs = mapConfig.getQueryCacheConfigs();
if (queryCacheConfigs != null && !queryCacheConfigs.isEmpty()) {
gen.open("query-caches");
for (QueryCacheConfig queryCacheConfig : queryCacheConfigs) {
gen.open("query-cache", "name", queryCacheConfig.getName());
gen.node("include-value", queryCacheConfig.isIncludeValue());
gen.node("in-memory-format", queryCacheConfig.getInMemoryFormat());
gen.node("populate", queryCacheConfig.isPopulate());
gen.node("coalesce", queryCacheConfig.isCoalesce());
gen.node("delay-seconds", queryCacheConfig.getDelaySeconds());
gen.node("batch-size", queryCacheConfig.getBatchSize());
gen.node("buffer-size", queryCacheConfig.getBufferSize());
gen.node("serialize-keys", queryCacheConfig.isSerializeKeys());
evictionConfigXmlGenerator(gen, queryCacheConfig.getEvictionConfig());
IndexUtils.generateXml(gen, queryCacheConfig.getIndexConfigs());
mapQueryCachePredicateConfigXmlGenerator(gen, queryCacheConfig);
entryListenerConfigXmlGenerator(gen, queryCacheConfig.getEntryListenerConfigs());
gen.close();
}
gen.close();
}
}
use of com.hazelcast.config.QueryCacheConfig in project hazelcast by hazelcast.
the class DynamicConfigYamlGenerator method getQueryCacheConfigsAsMap.
private static Map<String, Object> getQueryCacheConfigsAsMap(List<QueryCacheConfig> queryCacheConfigs) {
if (queryCacheConfigs == null || queryCacheConfigs.isEmpty()) {
return null;
}
Map<String, Object> queryCacheConfigsAsMap = new LinkedHashMap<>();
for (QueryCacheConfig queryCacheConfig : queryCacheConfigs) {
Map<String, Object> queryCacheConfigAsMap = new LinkedHashMap<>();
addNonNullToMap(queryCacheConfigAsMap, "include-value", queryCacheConfig.isIncludeValue());
addNonNullToMap(queryCacheConfigAsMap, "in-memory-format", queryCacheConfig.getInMemoryFormat().name());
addNonNullToMap(queryCacheConfigAsMap, "populate", queryCacheConfig.isPopulate());
addNonNullToMap(queryCacheConfigAsMap, "coalesce", queryCacheConfig.isCoalesce());
addNonNullToMap(queryCacheConfigAsMap, "delay-seconds", queryCacheConfig.getDelaySeconds());
addNonNullToMap(queryCacheConfigAsMap, "batch-size", queryCacheConfig.getBatchSize());
addNonNullToMap(queryCacheConfigAsMap, "buffer-size", queryCacheConfig.getBufferSize());
addNonNullToMap(queryCacheConfigAsMap, "eviction", getEvictionConfigAsMap(queryCacheConfig.getEvictionConfig()));
addNonNullToMap(queryCacheConfigAsMap, "indexes", getIndexConfigsAsList(queryCacheConfig.getIndexConfigs()));
addNonNullToMap(queryCacheConfigAsMap, "predicate", getPredicateConfigAsMap(queryCacheConfig.getPredicateConfig()));
addNonNullToMap(queryCacheConfigAsMap, "entry-listeners", getEntryListenerConfigsAsList(queryCacheConfig.getEntryListenerConfigs()));
addNonNullToMap(queryCacheConfigAsMap, "serialize-keys", queryCacheConfig.isSerializeKeys());
queryCacheConfigsAsMap.put(queryCacheConfig.getName(), queryCacheConfigAsMap);
}
return queryCacheConfigsAsMap;
}
Aggregations