consumer = (name, classFile) -> { try (InputStream in = classFile.openStream()) { ClassInfo classInfo = indexer.index(in); allKnownClasses.add(name); if (classInfo != null && hasBeanDefiningAnnotation(classInfo, beanDefiningAnnotations)) {
private void addToIndex(InputStream inputStream) { try { indexer.index(inputStream); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(inputStream, ex); } }
private void addToIndex(InputStream inputStream) { try { indexer.index(inputStream); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(inputStream, ex); } }
private void addToIndex(InputStream inputStream) { try { indexer.index(inputStream); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(inputStream, ex); } }
private void addToIndex(URL url) { InputStream fs = null; try { fs = url.openStream(); indexer.index(fs); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(url, ex); } finally { try { if (fs != null) { fs.close(); } } catch (IOException ex) { CommonLogger.LOG.couldNotCloseStreamForURL(url, ex); } } }
private void addToIndex(URL url) { InputStream fs = null; try { fs = url.openStream(); indexer.index(fs); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(url, ex); } finally { try { if (fs != null) { fs.close(); } } catch (IOException ex) { CommonLogger.LOG.couldNotCloseStreamForURL(url, ex); } } }
/** * 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 void addToIndex(URL url) { InputStream fs = null; try { fs = url.openStream(); indexer.index(fs); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(url, ex); } finally { try { if (fs != null) { fs.close(); } } catch (IOException ex) { CommonLogger.LOG.couldNotCloseStreamForURL(url, ex); } } }
private void addToIndex(URL url) { InputStream fs = null; try { fs = url.openStream(); indexer.index(fs); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(url, ex); } finally { try { if (fs != null) { fs.close(); } } catch (IOException ex) { CommonLogger.LOG.couldNotCloseStreamForURL(url, ex); } } }
private void addToIndex(URL url) { InputStream fs = null; try { fs = url.openStream(); indexer.index(fs); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(url, ex); } finally { try { if (fs != null) { fs.close(); } } catch (IOException ex) { CommonLogger.LOG.couldNotCloseStreamForURL(url, ex); } } }
private void addToIndex(URL url) { InputStream fs = null; try { fs = url.openStream(); indexer.index(fs); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(url, ex); } finally { try { if (fs != null) { fs.close(); } } catch (IOException ex) { CommonLogger.LOG.couldNotCloseStreamForURL(url, ex); } } }
/** * 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 void addToIndex(URL url) { InputStream fs = null; try { fs = url.openStream(); indexer.index(fs); } catch (IOException ex) { CommonLogger.LOG.couldNotOpenStreamForURL(url, ex); } finally { try { if (fs != null) { fs.close(); } } catch (IOException ex) { CommonLogger.LOG.couldNotCloseStreamForURL(url, ex); } } }
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(); }
/** * * @param source * @throws IOException */ public void index ( DataSource source ) throws IOException { ClassInfo ci = this.indexer.index(source.getInputStream()); if ( log.isTraceEnabled() ) { log.trace("Adding " + ci.name()); //$NON-NLS-1$ } if ( this.classData.put(ci.name().toString(), new ByteDataSource(source)) != null ) { log.warn("Duplicate class " + ci.name()); //$NON-NLS-1$ } }
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 void indexClass(Indexer indexer, String className) { InputStream stream = metadata.getServiceRegistry().getService( ClassLoaderService.class ).locateResourceStream( className ); try { indexer.index( stream ); } catch ( IOException e ) { throw new HibernateException( "Unable to open input stream for class " + className, e ); } } }
private void indexClass(Indexer indexer, String className) { InputStream stream = metadata.getServiceRegistry().getService( ClassLoaderService.class ).locateResourceStream( className ); try { indexer.index( stream ); } catch ( IOException e ) { throw new HibernateException( "Unable to open input stream for class " + className, e ); } } }
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(); }