Search in sources :

Example 1 with NamedInputStream

use of org.hibernate.ejb.packaging.NamedInputStream in project wildfly by wildfly.

the class HibernateAnnotationScanner method findFiles.

private void findFiles(URL jarToScan, Set<String> filePatterns, Map<String, Set<NamedInputStream>> map, Set<NamedInputStream> result) {
    if (filePatterns.isEmpty()) {
        for (Set<NamedInputStream> nims : map.values()) result.addAll(nims);
    } else {
        VirtualFile root = null;
        for (String pattern : filePatterns) {
            Set<NamedInputStream> niss = map.get(pattern);
            if (niss == null) {
                if (root == null)
                    root = getFile(jarToScan);
                try {
                    List<VirtualFile> children = root.getChildrenRecursively(new HibernatePatternFilter(pattern));
                    niss = toNIS(children);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            if (niss != null)
                result.addAll(niss);
        }
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) NamedInputStream(org.hibernate.ejb.packaging.NamedInputStream) IOException(java.io.IOException)

Example 2 with NamedInputStream

use of org.hibernate.ejb.packaging.NamedInputStream in project wildfly by wildfly.

the class HibernateAnnotationScanner method toNIS.

private Set<NamedInputStream> toNIS(Iterable<VirtualFile> files) {
    Set<NamedInputStream> result = new HashSet<NamedInputStream>();
    for (VirtualFile file : files) {
        NamedInputStream nis = new HibernateVirtualFileNamedInputStream(file);
        result.add(nis);
    }
    return result;
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) NamedInputStream(org.hibernate.ejb.packaging.NamedInputStream) HashSet(java.util.HashSet)

Aggregations

NamedInputStream (org.hibernate.ejb.packaging.NamedInputStream)2 VirtualFile (org.jboss.vfs.VirtualFile)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1