Java Code Examples for org.jboss.jandex.Indexer#index()
The following examples show how to use
org.jboss.jandex.Indexer#index() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompositeIndexProcessor.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
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(); }
Example 2
Source File: ArcTestContainer.java From quarkus with Apache License 2.0 | 5 votes |
private Index index(Iterable<Class<?>> classes) throws IOException { Indexer indexer = new Indexer(); for (Class<?> clazz : classes) { try (InputStream stream = ArcTestContainer.class.getClassLoader() .getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) { indexer.index(stream); } } return indexer.complete(); }
Example 3
Source File: AddIndexPlugin.java From hibernate-demos with Apache License 2.0 | 5 votes |
private void addToIndex(Indexer indexer, ResourcePoolEntry entry) { try { indexer.index( entry.content() ); } catch(Exception ex) { throw new RuntimeException( ex ); } }
Example 4
Source File: AdvertisingMetadataProcessorTest.java From thorntail with Apache License 2.0 | 5 votes |
Index createIndex(Archive<?> archive) throws IOException { Indexer indexer = new Indexer(); Map<ArchivePath, Node> c = archive.getContent(); for (Map.Entry<ArchivePath, Node> each : c.entrySet()) { if (each.getKey().get().endsWith(".class")) { indexer.index(each.getValue().getAsset().openStream()); } } return indexer.complete(); }
Example 5
Source File: MicroOuterDeployer.java From piranha with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void addToIndex(String className, ShrinkWrapResource resource, Indexer indexer) { try (InputStream classAsStream = resource.getResourceAsStream(className)) { indexer.index(classAsStream); } catch (IOException ioe) { if (LOGGER.isLoggable(WARNING)) { LOGGER.log(WARNING, "Unable to add to index", ioe); } } }
Example 6
Source File: JandexUtilTest.java From quarkus with Apache License 2.0 | 5 votes |
private static Index index(Class<?>... classes) { Indexer indexer = new Indexer(); for (Class<?> clazz : classes) { try { try (InputStream stream = JandexUtilTest.class.getClassLoader() .getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) { indexer.index(stream); } } catch (IOException e) { throw new RuntimeException(e); } } return indexer.complete(); }
Example 7
Source File: ApplicationArchiveBuildStep.java From quarkus with Apache License 2.0 | 5 votes |
private static Index indexJar(JarFile file) throws IOException { Indexer indexer = new Indexer(); Enumeration<JarEntry> e = file.entries(); while (e.hasMoreElements()) { JarEntry entry = e.nextElement(); if (entry.getName().endsWith(".class")) { try (InputStream inputStream = file.getInputStream(entry)) { indexer.index(inputStream); } } } return indexer.complete(); }
Example 8
Source File: SpringScheduledProcessorTest.java From quarkus with Apache License 2.0 | 5 votes |
private IndexView getIndex(final Class<?>... classes) { final Indexer indexer = new Indexer(); for (final Class<?> clazz : classes) { final String className = clazz.getName(); try (InputStream stream = IoUtil.readClass(getClass().getClassLoader(), className)) { final ClassInfo beanInfo = indexer.index(stream); } catch (IOException e) { throw new IllegalStateException("Failed to index: " + className, e); } } return BeanArchives.buildBeanArchiveIndex(getClass().getClassLoader(), new BeanArchives.PersistentClassIndex(), indexer.complete()); }
Example 9
Source File: SpringDIProcessorTest.java From quarkus with Apache License 2.0 | 5 votes |
private IndexView getIndex(final Class<?>... classes) { final Indexer indexer = new Indexer(); for (final Class<?> clazz : classes) { final String className = clazz.getName(); try (InputStream stream = IoUtil.readClass(getClass().getClassLoader(), className)) { final ClassInfo beanInfo = indexer.index(stream); } catch (IOException e) { throw new IllegalStateException("Failed to index: " + className, e); } } return BeanArchives.buildBeanArchiveIndex(getClass().getClassLoader(), new BeanArchives.PersistentClassIndex(), indexer.complete()); }
Example 10
Source File: SimpleGeneratorTest.java From quarkus with Apache License 2.0 | 5 votes |
private static Index index(Class<?>... classes) throws IOException { Indexer indexer = new Indexer(); for (Class<?> clazz : classes) { try (InputStream stream = SimpleGeneratorTest.class.getClassLoader() .getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) { indexer.index(stream); } } return indexer.complete(); }
Example 11
Source File: IndexInitializer.java From smallrye-graphql with Apache License 2.0 | 5 votes |
private void processFile(String fileName, InputStream is, Indexer indexer) throws IOException { if (fileName.endsWith(DOT_CLASS)) { SmallRyeGraphQLServletLogging.log.processingFile(fileName); indexer.index(is); } else if (fileName.endsWith(DOT_WAR)) { // necessary because of the thorntail arquillian adapter processJar(is, indexer); } }
Example 12
Source File: Basics.java From quarkus with Apache License 2.0 | 5 votes |
public static Index index(Class<?>... classes) throws IOException { Indexer indexer = new Indexer(); for (Class<?> clazz : classes) { try (InputStream stream = Basics.class.getClassLoader() .getResourceAsStream(clazz.getName().replace('.', '/') + ".class")) { indexer.index(stream); } } return indexer.complete(); }
Example 13
Source File: BeanArchives.java From quarkus with Apache License 2.0 | 5 votes |
static boolean index(Indexer indexer, String className, ClassLoader classLoader) { boolean result = false; try (InputStream stream = classLoader .getResourceAsStream(className.replace('.', '/') + ".class")) { if (stream != null) { indexer.index(stream); result = true; } else { LOGGER.warnf("Failed to index %s: Class does not exist in ClassLoader %s", className, classLoader); } } catch (IOException e) { LOGGER.warnf(e, "Failed to index %s: %s", className, e.getMessage()); } return result; }
Example 14
Source File: IndexScannerTestBase.java From smallrye-open-api with Apache License 2.0 | 5 votes |
protected static void index(Indexer indexer, String resName) { try { InputStream stream = tcclGetResourceAsStream(resName); indexer.index(stream); } catch (IOException ioe) { throw new UncheckedIOException(ioe); } }
Example 15
Source File: OpenApiDataObjectScanner.java From smallrye-open-api with Apache License 2.0 | 5 votes |
private static void index(Indexer indexer, String resourceName) { try (InputStream stream = OpenApiDataObjectScanner.class.getResourceAsStream(resourceName)) { indexer.index(stream); } catch (IOException ioe) { throw new UncheckedIOException(ioe); } }
Example 16
Source File: TypeUtil.java From smallrye-open-api with Apache License 2.0 | 5 votes |
private static void index(Indexer indexer, Class<?> klazz) { try (InputStream stream = klazz.getResourceAsStream(klazz.getSimpleName() + ".class")) { indexer.index(stream); } catch (IOException ioe) { throw new UncheckedIOException(ioe); } }
Example 17
Source File: ArchiveUtil.java From smallrye-open-api with Apache License 2.0 | 5 votes |
/** * Indexes the given archive. * * @param config * @param indexer * @param archive */ private static void indexArchive(OpenApiConfig config, Indexer indexer, Archive<?> archive) { FilteredIndexView filter = new FilteredIndexView(null, config); Map<ArchivePath, Node> c = archive.getContent(); try { for (Map.Entry<ArchivePath, Node> each : c.entrySet()) { ArchivePath archivePath = each.getKey(); if (archivePath.get().endsWith(OpenApiConstants.CLASS_SUFFIX) && acceptClassForScanning(filter, archivePath.get())) { try (InputStream contentStream = each.getValue().getAsset().openStream()) { TckLogging.log.indexing(archivePath.get(), archive.getName()); indexer.index(contentStream); } continue; } if (archivePath.get().endsWith(OpenApiConstants.JAR_SUFFIX) && acceptJarForScanning(config, archivePath.get())) { try (InputStream contentStream = each.getValue().getAsset().openStream()) { JavaArchive jarArchive = ShrinkWrap.create(JavaArchive.class, archivePath.get()) .as(ZipImporter.class).importFrom(contentStream).as(JavaArchive.class); indexArchive(config, indexer, jarArchive); } continue; } } } catch (IOException e) { throw new RuntimeException(e); } }
Example 18
Source File: ArchiveUtil.java From smallrye-open-api with Apache License 2.0 | 5 votes |
private static void index(Indexer indexer, String resName) { ClassLoader cl = OpenApiAnnotationScanner.class.getClassLoader(); try (InputStream klazzStream = cl.getResourceAsStream(resName)) { indexer.index(klazzStream); } catch (IOException ioe) { throw new UncheckedIOException(ioe); } }
Example 19
Source File: IndexCreator.java From smallrye-graphql with Apache License 2.0 | 5 votes |
public static Index index(Class<?> clazz) throws IOException { final Indexer indexer = new Indexer(); InputStream stream = IndexCreator.class.getClassLoader() .getResourceAsStream(clazz.getName().replace('.', '/') + ".class"); indexer.index(stream); return indexer.complete(); }
Example 20
Source File: SchemaBuilderTest.java From smallrye-graphql with Apache License 2.0 | 5 votes |
static void index(Indexer indexer, String resName) { try { InputStream stream = getResourceAsStream(resName); indexer.index(stream); } catch (IOException ioe) { throw new RuntimeException(ioe); } }