Search in sources :

Example 1 with ArchiveEntry

use of org.hibernate.jpa.boot.archive.spi.ArchiveEntry in project wildfly by wildfly.

the class VirtualFileSystemArchiveDescriptor method processVirtualFile.

private void processVirtualFile(VirtualFile virtualFile, String path, ArchiveContext archiveContext) {
    if (path == null) {
        path = "";
    } else {
        if (!path.endsWith("/'")) {
            path = path + "/";
        }
    }
    for (VirtualFile child : virtualFile.getChildren()) {
        if (!child.exists()) {
            // should never happen conceptually, but...
            continue;
        }
        if (child.isDirectory()) {
            processVirtualFile(child, path + child.getName(), archiveContext);
            continue;
        }
        final String name = child.getPathName();
        final String relativeName = path + child.getName();
        final InputStreamAccess inputStreamAccess = new VirtualFileInputStreamAccess(name, child);
        final ArchiveEntry entry = new ArchiveEntry() {

            @Override
            public String getName() {
                return name;
            }

            @Override
            public String getNameWithinArchive() {
                return relativeName;
            }

            @Override
            public InputStreamAccess getStreamAccess() {
                return inputStreamAccess;
            }
        };
        archiveContext.obtainArchiveEntryHandler(entry).handleEntry(entry, archiveContext);
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) InputStreamAccess(org.hibernate.jpa.boot.spi.InputStreamAccess) ArchiveEntry(org.hibernate.jpa.boot.archive.spi.ArchiveEntry)

Aggregations

ArchiveEntry (org.hibernate.jpa.boot.archive.spi.ArchiveEntry)1 InputStreamAccess (org.hibernate.jpa.boot.spi.InputStreamAccess)1 VirtualFile (org.jboss.vfs.VirtualFile)1