Java tutorial
/* * Copyright: (c) 2004-2010 Mayo Foundation for Medical Education and * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the * triple-shield Mayo logo are trademarks and service marks of MFMER. * * Except as contained in the copyright notice above, or as used to identify * MFMER as the author of this software, the trade names, trademarks, service * marks, or product names of the copyright holder shall not be used in * advertising, promotion or otherwise in connection with this software without * prior written authorization of the copyright holder. * * Licensed under the Eclipse Public License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.eclipse.org/legal/epl-v10.html * */ package org.lexevs.dao.index.lucenesupport; import java.util.ArrayList; import java.util.List; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.MultiReader; import org.lexevs.dao.indexer.utility.CodingSchemeMetaData; import org.lexevs.dao.indexer.utility.ConcurrentMetaData; import org.springframework.beans.factory.FactoryBean; /** * @author <A HREF="mailto:bauer.scott@mayo.edu">Scott Bauer </A> * */ public class MultiReaderFactory implements FactoryBean<MultiReader> { ConcurrentMetaData concurrentMetaData; public MultiReaderFactory() { // TODO Auto-generated constructor stub } @Override public MultiReader getObject() throws Exception { List<IndexReader> readers = new ArrayList<IndexReader>(); for (CodingSchemeMetaData md : concurrentMetaData.getCodingSchemeList()) { readers.add(md.getDirectory().getIndexReader()); } return new MultiReader(readers.toArray(new IndexReader[readers.size()]), false); } @Override public Class<?> getObjectType() { // TODO Auto-generated method stub return null; } @Override public boolean isSingleton() { // TODO Auto-generated method stub return false; } public ConcurrentMetaData getConcurrentMetaData() { return concurrentMetaData; } public void setConcurrentMetaData(ConcurrentMetaData concurrentMetaData) { this.concurrentMetaData = concurrentMetaData; } }