/** * @return the index */ public Index getIndex () { if ( this.index == null ) { this.index = this.indexer.complete(); } return this.index; }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
private Index buildIndex() { return indexer.complete(); } }
/** * Creates an annotation index for the given entity type */ public synchronized static Index createIndex(Class<?> type) { Index index = indices.get(type); if (index == null) { try { Indexer indexer = new Indexer(); Class<?> currentType = type; while ( currentType != null ) { String className = currentType.getName().replace(".", "/") + ".class"; InputStream stream = type.getClassLoader() .getResourceAsStream(className); indexer.index(stream); currentType = currentType.getSuperclass(); } index = indexer.complete(); indices.put(type, index); } catch (IOException e) { throw new RuntimeException("Failed to initialize Indexer", e); } } return index; }
/** * Creates an annotation index for the given entity type */ public synchronized static Index createIndex(Class<?> type) { Index index = indices.get(type); if (index == null) { try { Indexer indexer = new Indexer(); Class<?> currentType = type; while ( currentType != null ) { String className = currentType.getName().replace(".", "/") + ".class"; InputStream stream = type.getClassLoader() .getResourceAsStream(className); indexer.index(stream); currentType = currentType.getSuperclass(); } index = indexer.complete(); indices.put(type, index); } catch (IOException e) { throw new RuntimeException("Failed to initialize Indexer", e); } } return index; }
private Result indexDirectory(File source, Indexer indexer) throws FileNotFoundException, IOException { File outputFile = this.outputFile; scanFile(source, indexer); if (modify) { new File(source, "META-INF").mkdirs(); outputFile = new File(source, "META-INF/jandex.idx"); } if (outputFile == null) { outputFile = new File(source.getName().replace('.', '-') + ".idx"); } FileOutputStream out = new FileOutputStream(outputFile); IndexWriter writer = new IndexWriter(out); try { Index index = indexer.complete(); int bytes = writer.write(index); return new Result(index, outputFile.getPath(), bytes, outputFile); } finally { out.flush(); out.close(); } }
private static IndexView indexFolder(File folder) { Indexer indexer = new Indexer(); for (Iterator<File> itr = com.google.common.io.Files.fileTreeTraverser().breadthFirstTraversal(folder) .iterator(); itr.hasNext();) { File file = itr.next(); if (file.isFile() && file.getName().endsWith(".class")) { try { final InputStream stream = new FileInputStream(file); try { indexer.index(stream); } finally { try { stream.close(); } catch (Exception ignore) { } } } catch (Exception e) { log.error("Failed to index file " + file, e); } } } return indexer.complete(); }
private void resolveRuntimeIndex(Module module, List<Index> indexes) throws ModuleLoadException { Indexer indexer = new Indexer(); Iterator<Resource> resources = module.iterateResources(PathFilters.acceptAll()); while (resources.hasNext()) { Resource each = resources.next(); if (each.getName().endsWith(".class")) { try { ClassInfo clsInfo = indexer.index(each.openStream()); } catch (IOException e) { //System.err.println("error: " + each.getName() + ": " + e.getMessage()); } } } indexes.add(indexer.complete()); }
private Index calculateModuleIndex(final Module module) throws ModuleLoadException, IOException { final Indexer indexer = new Indexer(); final PathFilter filter = PathFilters.getDefaultImportFilter(); final Iterator<Resource> iterator = module.iterateResources(filter); while (iterator.hasNext()) { Resource resource = iterator.next(); if(resource.getName().endsWith(".class")) { try (InputStream in = resource.openStream()) { indexer.index(in); } catch (Exception e) { ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(resource.getName(), resource.getURL().toExternalForm(), e); } } } return indexer.complete(); }
private Index calculateModuleIndex(final Module module) throws ModuleLoadException, IOException { final Indexer indexer = new Indexer(); final PathFilter filter = PathFilters.getDefaultImportFilter(); final Iterator<Resource> iterator = module.iterateResources(filter); while (iterator.hasNext()) { Resource resource = iterator.next(); if(resource.getName().endsWith(".class")) { try (InputStream in = resource.openStream()) { indexer.index(in); } catch (Exception e) { ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(resource.getName(), resource.getURL().toExternalForm(), e); } } } return indexer.complete(); }
private void initializeConfigFiltersFatJar() throws ModuleLoadException, IOException, ClassNotFoundException { Indexer indexer = new Indexer(); Module appModule = Module.getBootModuleLoader().loadModule(APPLICATION_MODULE_NAME); Iterator<Resource> iter = appModule.iterateResources(PathFilters.acceptAll()); while (iter.hasNext()) { Resource each = iter.next(); if (each.getName().endsWith(".class")) { if (!each.getName().equals("module-info.class")) { try (InputStream is = each.openStream()) { indexer.index(is); } catch (IOException e) { // ignore } } } } Index index = indexer.complete(); Set<ClassInfo> impls = index.getAllKnownImplementors(DotName.createSimple(ConfigurationFilter.class.getName())); for (ClassInfo each : impls) { String name = each.name().toString(); Class<? extends ConfigurationFilter> cls = (Class<? extends ConfigurationFilter>) appModule.getClassLoader().loadClass(name); try { ConfigurationFilter filter = cls.newInstance(); this.configView.withFilter(filter); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } } }
private void initializeConfigFiltersFatJar() throws ModuleLoadException, IOException, ClassNotFoundException { Indexer indexer = new Indexer(); Module appModule = Module.getBootModuleLoader().loadModule(APPLICATION_MODULE_NAME); Iterator<Resource> iter = appModule.iterateResources(PathFilters.acceptAll()); while (iter.hasNext()) { Resource each = iter.next(); if (each.getName().endsWith(".class")) { if (!each.getName().equals("module-info.class")) { try (InputStream is = each.openStream()) { indexer.index(is); } catch (IOException e) { // ignore } } } } Index index = indexer.complete(); Set<ClassInfo> impls = index.getAllKnownImplementors(DotName.createSimple(ConfigurationFilter.class.getName())); for (ClassInfo each : impls) { String name = each.name().toString(); Class<? extends ConfigurationFilter> cls = (Class<? extends ConfigurationFilter>) appModule.getClassLoader().loadClass(name); try { ConfigurationFilter filter = cls.newInstance(); this.configView.withFilter(filter); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } } }