Search in sources :

Example 1 with MetadataConfigBuilder

use of org.uberfire.ext.metadata.io.MetadataConfigBuilder in project kie-wb-common by kiegroup.

the class IndexingTest method ioService.

protected IOService ioService() {
    if (ioService == null) {
        final Map<String, Analyzer> analyzers = getAnalyzers();
        MetadataConfigBuilder configBuilder = new MetadataConfigBuilder().withInMemoryMetaModelStore().usingAnalyzers(analyzers).usingAnalyzerWrapperFactory(getAnalyzerWrapperFactory()).useInMemoryDirectory().useDirectoryBasedIndex();
        if (config == null) {
            config = configBuilder.build();
        }
        ExecutorService executorService = Executors.newCachedThreadPool(new DescriptiveThreadFactory());
        ioService = new IOServiceIndexedImpl(config.getIndexEngine(), executorService);
        final TestIndexer indexer = getIndexer();
        IndexersFactory.clear();
        IndexersFactory.addIndexer(indexer);
        // Mock CDI injection and setup
        indexer.setIOService(ioService);
        indexer.setModuleService(getModuleService());
        indexer.setResourceTypeDefinition(getResourceTypeDefinition());
    }
    return ioService;
}
Also used : MetadataConfigBuilder(org.uberfire.ext.metadata.io.MetadataConfigBuilder) ExecutorService(java.util.concurrent.ExecutorService) DescriptiveThreadFactory(org.uberfire.commons.async.DescriptiveThreadFactory) Analyzer(org.apache.lucene.analysis.Analyzer) IOServiceIndexedImpl(org.uberfire.ext.metadata.io.IOServiceIndexedImpl)

Example 2 with MetadataConfigBuilder

use of org.uberfire.ext.metadata.io.MetadataConfigBuilder in project kie-wb-common by kiegroup.

the class BaseLibraryIndexingTest method ioService.

@SuppressWarnings("unchecked")
protected IOService ioService() {
    if (ioService == null) {
        final Map<String, Analyzer> analyzers = getAnalyzers();
        MetadataConfigBuilder configBuilder = new MetadataConfigBuilder().withInMemoryMetaModelStore().usingAnalyzers(analyzers).usingAnalyzerWrapperFactory(ImpactAnalysisAnalyzerWrapperFactory.getInstance()).useInMemoryDirectory().useDirectoryBasedIndex();
        if (config == null) {
            config = configBuilder.build();
        }
        ExecutorService executorService = Executors.newCachedThreadPool(new DescriptiveThreadFactory());
        ioService = new IOServiceIndexedImpl(config.getIndexEngine(), executorService);
        final LibraryIndexer indexer = new LibraryIndexer(new LibraryAssetTypeDefinition());
        IndexersFactory.clear();
        IndexersFactory.addIndexer(indexer);
        // Mock CDI injection and setup
        indexer.setIOService(ioService);
        indexer.setModuleService(getModuleService());
    }
    return ioService;
}
Also used : MetadataConfigBuilder(org.uberfire.ext.metadata.io.MetadataConfigBuilder) ExecutorService(java.util.concurrent.ExecutorService) DescriptiveThreadFactory(org.uberfire.commons.async.DescriptiveThreadFactory) FilenameAnalyzer(org.uberfire.ext.metadata.backend.lucene.analyzer.FilenameAnalyzer) LowerCaseOnlyAnalyzer(org.kie.workbench.common.services.refactoring.backend.server.indexing.LowerCaseOnlyAnalyzer) Analyzer(org.apache.lucene.analysis.Analyzer) IOServiceIndexedImpl(org.uberfire.ext.metadata.io.IOServiceIndexedImpl)

Aggregations

ExecutorService (java.util.concurrent.ExecutorService)2 Analyzer (org.apache.lucene.analysis.Analyzer)2 DescriptiveThreadFactory (org.uberfire.commons.async.DescriptiveThreadFactory)2 IOServiceIndexedImpl (org.uberfire.ext.metadata.io.IOServiceIndexedImpl)2 MetadataConfigBuilder (org.uberfire.ext.metadata.io.MetadataConfigBuilder)2 LowerCaseOnlyAnalyzer (org.kie.workbench.common.services.refactoring.backend.server.indexing.LowerCaseOnlyAnalyzer)1 FilenameAnalyzer (org.uberfire.ext.metadata.backend.lucene.analyzer.FilenameAnalyzer)1