/** * Returns the name-payload pairs of any sd files under path/searchdefinitions/ in the given jar bundle * @param bundle The jar file, which will be closed afterwards by this method. * @param path For example 'complex/' * @return map of the SD payloads * @throws IOException if it is reading sd files fails */ static Map<String, String> getBundleSdFiles(String path, JarFile bundle) throws IOException { Map<String,String> ret = new LinkedHashMap<>(); for (Enumeration<JarEntry> e = bundle.entries(); e.hasMoreElements();) { JarEntry je=e.nextElement(); if (je.getName().startsWith(path+SEARCH_DEFINITIONS_DIR+"/") && je.getName().endsWith(SD_NAME_SUFFIX)) { String contents = IOUtils.readAll(new InputStreamReader(bundle.getInputStream(je))); ret.put(getFileName(je), contents); } } bundle.close(); return ret; }