public static CompositeIndex buildCompositeIndex(Module module) { try { final Enumeration<URL> resources = module.getClassLoader().getResources(INDEX_LOCATION); if (!resources.hasMoreElements()) { return null; } final Set<Index> indexes = new HashSet<Index>(); while (resources.hasMoreElements()) { final URL url = resources.nextElement(); InputStream stream = url.openStream(); try { IndexReader reader = new IndexReader(stream); indexes.add(reader.read()); } finally { stream.close(); } } return new CompositeIndex(indexes); } catch (IOException e) { throw new RuntimeException(e); } }
public static CompositeIndex buildCompositeIndex(Module module) { try { final Enumeration<URL> resources = module.getClassLoader().getResources(INDEX_LOCATION); if (!resources.hasMoreElements()) { return null; } final Set<Index> indexes = new HashSet<Index>(); while (resources.hasMoreElements()) { final URL url = resources.nextElement(); InputStream stream = url.openStream(); try { IndexReader reader = new IndexReader(stream); indexes.add(reader.read()); } finally { stream.close(); } } return new CompositeIndex(indexes); } catch (IOException e) { throw new RuntimeException(e); } }
public static CompositeIndex buildCompositeIndex(Module module) { try { final Enumeration<URL> resources = module.getClassLoader().getResources(INDEX_LOCATION); if (!resources.hasMoreElements()) { return null; } final Set<Index> indexes = new HashSet<Index>(); while (resources.hasMoreElements()) { final URL url = resources.nextElement(); InputStream stream = url.openStream(); try { IndexReader reader = new IndexReader(stream); indexes.add(reader.read()); } finally { stream.close(); } } return new CompositeIndex(indexes); } catch (IOException e) { throw new RuntimeException(e); } }
public static CompositeIndex buildCompositeIndex(Module module) { try { final Enumeration<URL> resources = module.getClassLoader().getResources(INDEX_LOCATION); if (!resources.hasMoreElements()) { return null; } final Set<Index> indexes = new HashSet<Index>(); while (resources.hasMoreElements()) { final URL url = resources.nextElement(); InputStream stream = url.openStream(); try { IndexReader reader = new IndexReader(stream); indexes.add(reader.read()); } finally { stream.close(); } } return new CompositeIndex(indexes); } catch (IOException e) { throw new RuntimeException(e); } }
deploymentUnit.putAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX, new CompositeIndex(indexes));
deploymentUnit.putAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX, new CompositeIndex(indexes));
deploymentUnit.putAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX, new CompositeIndex(indexes));
deploymentUnit.putAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX, new CompositeIndex(indexes));