public List<File> getFiles(Language lang, FileMatcher fm) { return getFiles(lang, fm, configuration); }
public List<File> getFiles(Language language, FileMatcher ... matchers) { return getFiles(new LanguageSet(language), matchers); }
public List<File> getFiles(FileMatcher ... matchers) { return getFiles(getLanguages(), matchers); }
public List<File> getFiles(LanguageSet langs, FileMatcher ... matchers) { List<File> matches = new ArrayList<File>(); for (Language l : langs) { for (FileMatcher fm : matchers) { List<File> f = getFiles(l, fm); if (f.isEmpty()) { LOG.warn("no files matching language " + l + ", matcher " + fm.getName()); } matches.addAll(f); } } return matches; } public List<File> getFiles(Language language, FileMatcher ... matchers) {
@Override public LanguageSet get(String name, Config config, Map<String, String> runtimeParams) throws ConfigurationException { try { String type = config.getString("type"); if (type.equals("loaded")) { MetaInfoDao miDao = getConfigurator().get(MetaInfoDao.class); return miDao.getLoadedLanguages(LocalPage.class); } else if (type.equals("downloaded")) { List<Language> languages = new ArrayList<Language>(); // TODO: set the default language reasonably for (Language lang : Language.LANGUAGES) { if (Env.getFiles(lang, FileMatcher.ARTICLES, getConfig()).size() > 0) { languages.add(lang); } } return new LanguageSet(languages); } else if (type.equals("custom")) { return new LanguageSet(config.getStringList("langCodes")); } else { throw new ConfigurationException("Unknown LanguageSet type: " + type); } } catch (DaoException e) { throw new ConfigurationException(e); } } }
List<File> paths; if (cmd.getArgList().isEmpty()) { paths = env.getFiles(FileMatcher.ARTICLES); } else { paths = new ArrayList<File>();
List<File> paths; if (cmd.getArgList().isEmpty()) { paths = env.getFiles(FileMatcher.ARTICLES); } else { paths = new ArrayList<File>();
List<File> paths = env.getFiles(lang, FileMatcher.LINK_SQL); if (paths.size() > 1) { throw new IllegalStateException();
List<File> paths = env.getFiles(lang, FileMatcher.LINK_SQL); if (paths.size() > 1) { throw new IllegalStateException();