use of org.infinispan.configuration.cache.IndexingConfiguration in project infinispan by infinispan.
the class EngineConfigTest method resolveIndexingProperties.
private Map<String, Object> resolveIndexingProperties(GlobalConfigurationBuilder gcb, ConfigurationBuilder builder) {
cacheManager = TestCacheManagerFactory.createCacheManager(gcb, builder);
GlobalConfiguration globalConfiguration = cacheManager.getCacheManagerConfiguration();
IndexingConfiguration indexingConfiguration = cacheManager.getCache().getCacheConfiguration().indexing();
return extractProperties(globalConfiguration, indexingConfiguration, this.getClass().getClassLoader());
}
use of org.infinispan.configuration.cache.IndexingConfiguration in project infinispan by infinispan.
the class ProgrammaticAutoConfigTest method testOverride.
@Test
public void testOverride() {
String override = "hibernate.search.default.exclusive_index_use";
IndexingConfiguration cfg = new ConfigurationBuilder().indexing().enable().autoConfig(true).addProperty(override, "false").create();
assertEquals(cfg.properties().get(override), "false");
}
use of org.infinispan.configuration.cache.IndexingConfiguration in project infinispan by infinispan.
the class LifecycleManager method cacheStarted.
@Override
public void cacheStarted(ComponentRegistry cr, String cacheName) {
Configuration configuration = cr.getComponent(Configuration.class);
IndexingConfiguration indexingConfiguration = configuration.indexing();
if (!indexingConfiguration.enabled()) {
if (verifyChainContainsQueryInterceptor(cr)) {
throw new IllegalStateException("It was NOT expected to find the Query interceptor registered in the InterceptorChain as indexing was disabled, but it was found");
}
return;
}
if (!verifyChainContainsQueryInterceptor(cr)) {
throw new IllegalStateException("It was expected to find the Query interceptor registered in the InterceptorChain but it wasn't found");
}
SearchMapping searchMapping = cr.getComponent(SearchMapping.class);
if (searchMapping != null) {
checkIndexableClasses(searchMapping, indexingConfiguration.indexedEntities());
}
AdvancedCache<?, ?> cache = cr.getComponent(Cache.class).getAdvancedCache();
Indexer massIndexer = ComponentRegistryUtils.getIndexer(cache);
InfinispanQueryStatisticsInfo stats = new InfinispanQueryStatisticsInfo(Search.getSearchStatistics(cache), SecurityActions.getCacheComponentRegistry(cache).getComponent(Authorizer.class));
cr.registerComponent(stats, InfinispanQueryStatisticsInfo.class);
registerQueryMBeans(cr, massIndexer, stats);
registerMetrics(cr, stats);
}
use of org.infinispan.configuration.cache.IndexingConfiguration in project infinispan by infinispan.
the class LazySearchMapping method createMapping.
private SearchMapping createMapping() {
IndexingConfiguration indexingConfiguration = cache.getCacheConfiguration().indexing();
Set<String> indexedEntityTypes = indexingConfiguration.indexedEntityTypes();
DataConversion valueDataConversion = cache.getAdvancedCache().getValueDataConversion();
SearchMapping searchMapping = null;
if (commonBuilding != null) {
SearchMappingBuilder builder = SerializationContextSearchMapping.createBuilder(commonBuilding, entityLoader, indexedEntityTypes, serCtx);
searchMapping = builder != null ? builder.build() : null;
}
if (indexingConfiguration.enabled()) {
if (valueDataConversion.getStorageMediaType().match(APPLICATION_PROTOSTREAM)) {
// Try to resolve the indexed type names to protobuf type names.
Set<String> knownTypes = protobufMetadataManager.getSerializationContext().getGenericDescriptors().keySet();
for (String typeName : indexedEntityTypes) {
if (!knownTypes.contains(typeName)) {
if (searchMapping != null)
searchMapping.close();
throw log.unknownType(typeName);
}
if (searchMapping == null || searchMapping.indexedEntity(typeName) == null) {
if (searchMapping != null)
searchMapping.close();
throw log.typeNotIndexed(typeName);
}
}
}
}
return searchMapping;
}
use of org.infinispan.configuration.cache.IndexingConfiguration in project infinispan by infinispan.
the class CoreConfigurationSerializer method writeIndexing.
private void writeIndexing(ConfigurationWriter writer, Configuration configuration) {
IndexingConfiguration indexing = configuration.indexing();
AttributeSet attributes = indexing.attributes();
if (attributes.isModified()) {
writer.writeStartElement(Element.INDEXING);
attributes.write(writer, IndexingConfiguration.AUTO_CONFIG, Attribute.AUTO_CONFIG);
attributes.write(writer, IndexingConfiguration.ENABLED, Attribute.ENABLED);
attributes.write(writer, IndexingConfiguration.STORAGE, Attribute.STORAGE);
attributes.write(writer, IndexingConfiguration.PATH, Attribute.PATH);
long refreshInterval = indexing.reader().getRefreshInterval();
if (refreshInterval != 0) {
writer.writeStartElement(Element.INDEX_READER);
writer.writeAttribute(Attribute.REFRESH_INTERVAL, Long.toString(refreshInterval));
writer.writeEndElement();
}
IndexWriterConfiguration indexWriter = indexing.writer();
IndexMergeConfiguration indexMerge = indexWriter.merge();
AttributeSet writerAttributes = indexWriter.attributes();
AttributeSet mergeAttributes = indexMerge.attributes();
boolean indexWriterModified = writerAttributes.isModified();
boolean indexMergeModified = mergeAttributes.isModified();
if (indexWriterModified || indexMergeModified) {
writer.writeStartElement(Element.INDEX_WRITER);
writerAttributes.write(writer, IndexWriterConfiguration.INDEX_COMMIT_INTERVAL, Attribute.COMMIT_INTERVAL);
writerAttributes.write(writer, IndexWriterConfiguration.INDEX_LOW_LEVEL_TRACE, Attribute.LOW_LEVEL_TRACE);
writerAttributes.write(writer, IndexWriterConfiguration.INDEX_MAX_BUFFERED_ENTRIES, Attribute.MAX_BUFFERED_ENTRIES);
writerAttributes.write(writer, IndexWriterConfiguration.INDEX_QUEUE_COUNT, Attribute.QUEUE_COUNT);
writerAttributes.write(writer, IndexWriterConfiguration.INDEX_QUEUE_SIZE, Attribute.QUEUE_SIZE);
writerAttributes.write(writer, IndexWriterConfiguration.INDEX_THREAD_POOL_SIZE, Attribute.THREAD_POOL_SIZE);
writerAttributes.write(writer, IndexWriterConfiguration.INDEX_RAM_BUFFER_SIZE, Attribute.RAM_BUFFER_SIZE);
if (indexMergeModified) {
writer.writeStartElement(Element.INDEX_MERGE);
mergeAttributes.write(writer, IndexMergeConfiguration.CALIBRATE_BY_DELETES, Attribute.CALIBRATE_BY_DELETES);
mergeAttributes.write(writer, IndexMergeConfiguration.FACTOR, Attribute.FACTOR);
mergeAttributes.write(writer, IndexMergeConfiguration.MAX_ENTRIES, Attribute.MAX_ENTRIES);
mergeAttributes.write(writer, IndexMergeConfiguration.MIN_SIZE, Attribute.MIN_SIZE);
mergeAttributes.write(writer, IndexMergeConfiguration.MAX_SIZE, Attribute.MAX_SIZE);
mergeAttributes.write(writer, IndexMergeConfiguration.MAX_FORCED_SIZE, Attribute.MAX_FORCED_SIZE);
writer.writeEndElement();
}
writer.writeEndElement();
}
writer.writeArrayElement(Element.INDEXED_ENTITIES, Element.INDEXED_ENTITY, null, indexing.indexedEntityTypes());
if (!indexing.keyTransformers().isEmpty()) {
writer.writeStartListElement(Element.KEY_TRANSFORMERS, true);
for (Map.Entry<Class<?>, Class<?>> e : indexing.keyTransformers().entrySet()) {
writer.writeStartElement(Element.KEY_TRANSFORMER);
writer.writeAttribute(Attribute.KEY, e.getKey().getName());
writer.writeAttribute(Attribute.TRANSFORMER, e.getValue().getName());
writer.writeEndElement();
}
writer.writeEndListElement();
}
attributes.write(writer, GlobalJmxConfiguration.PROPERTIES);
writer.writeEndElement();
}
}
Aggregations