/** * Loads the mapper with the specified name if it is not already loaded. * * @param name * @return The requested mapper. * @throws ConfigurationException * @throws IOException */ public synchronized ConceptMapper loadMapper(String name) throws ConfigurationException, IOException { if (env.hasMapper(name)) { return env.getMapper(name); } info("loading mapper " + name); JSONObject params = configuration.getMapper(name); String type = requireString(params, "type"); ConceptMapper mapper; if (type.equals("dictionary")) { mapper = getDictionaryMapper(name); } else if (type.equals("lucene")) { mapper = getLuceneMapper(name); } else if (type.equals("ensemble")) { mapper = getEnsembleMapper(name); } else if (type.equals("title")) { mapper = getTitleMapper(name); } else { throw new ConfigurationException("unknown type for mapper " + name + ": " + type); } env.addMapper(name, mapper); return mapper; }