private void initLazyRemoteAnalyzer( Map<String, AnalyzerReference> initializedAnalyzers, RemoteAnalyzerReference lazyRemoteAnalyzerReference, IndexManagerHolder indexesFactory) { LazyRemoteAnalyzer lazyAnalyzer = (LazyRemoteAnalyzer) lazyRemoteAnalyzerReference.getAnalyzer(); if (initializedAnalyzers.containsKey(lazyAnalyzer.getName())) { AnalyzerReference analyzerReference = initializedAnalyzers.get(lazyAnalyzer.getName()); if (!(analyzerReference instanceof RemoteAnalyzerReference)) { throw log.remoteAnalyzerAlreadyDefinedAsLuceneAnalyzer(lazyAnalyzer.getName()); } lazyAnalyzer.setDelegate(((RemoteAnalyzerReference) analyzerReference).getAnalyzer()); return; } Collection<IndexManagerType> indexManagerTypes = indexesFactory.getIndexManagerTypes(); for (IndexManagerType indexManagerType : indexManagerTypes) { if (indexManagerType instanceof RemoteAnalyzerProvider) { final RemoteAnalyzer remoteAnalyzer = ((RemoteAnalyzerProvider) indexManagerType).getRemoteAnalyzer(lazyAnalyzer.getName()); lazyAnalyzer.setDelegate(remoteAnalyzer); initializedAnalyzers.put( lazyAnalyzer.getName(), new RemoteAnalyzerReference(remoteAnalyzer)); break; } } }
private void checkIndexManagerType( IndexManagerHolder allIndexesManager, String name, Class expectedType) { IndexManager indexManager = allIndexesManager.getIndexManager(name); Assert.assertEquals(expectedType, indexManager.getClass()); }