/** * Iterates on all factories and append all index engines. * * @return Set of all index engines. */ public static Set<String> getIndexEngines() { final Set<String> engines = new HashSet<>(); final Iterator<OIndexFactory> ite = getAllFactories(); while (ite.hasNext()) { engines.addAll(ite.next().getAlgorithms()); } return engines; }
public static OIndexFactory getFactory(String indexType, String algorithm) { if (algorithm == null) { algorithm = chooseDefaultIndexAlgorithm(indexType); } algorithm = algorithm.toUpperCase(Locale.ENGLISH); final Iterator<OIndexFactory> ite = getAllFactories(); while (ite.hasNext()) { final OIndexFactory factory = ite.next(); if (factory.getTypes().contains(indexType) && factory.getAlgorithms().contains(algorithm)) { return factory; } } throw new OIndexException("Index with type " + indexType + " and algorithm " + algorithm + " does not exist."); }
private static OIndexFactory findFactoryByAlgorithmAndType(String algorithm, String indexType) { for (OIndexFactory factory : getFactories()) { if (indexType == null || indexType.isEmpty() || (factory.getTypes().contains(indexType)) && factory.getAlgorithms() .contains(algorithm)) { return factory; } } throw new OIndexException( "Index type " + indexType + " with engine " + algorithm + " is not supported. Types are " + OCollections .toString(getIndexTypes())); }