Class JBossVfsUtil

java.lang.Object
com.vaadin.flow.internal.JBossVfsUtil

public final class JBossVfsUtil extends Object
Reads what WildFly and JBoss serve from their virtual file system, through the vfs protocol.

The virtual file system is reached with reflection, as a dependency to WildFly or JBoss cannot be afforded, and a virtual file only exists on disk once its physical file has been asked for.

For internal use only. May be renamed or removed in a future release.

Since:
25.3
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    A file of the virtual file system, read without creating it on disk.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The protocol WildFly and JBoss serve a deployed archive through.
  • Method Summary

    Modifier and Type
    Method
    Description
    listFiles(URL folder)
    Gets the files directly inside the given folder, to be read as they are without creating anything on disk.
    static File
    Gets the given folder as a folder on disk, creating it and everything inside it, so that the caller can read the folder as a whole.
    static File
    Packs the given jar into a jar file on disk, as a jar of the virtual file system is not a file the caller can open on its own.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PROTOCOL

      public static final String PROTOCOL
      The protocol WildFly and JBoss serve a deployed archive through.
      See Also:
  • Method Details

    • listFiles

      public static List<JBossVfsUtil.VfsFile> listFiles(URL folder) throws IOException
      Gets the files directly inside the given folder, to be read as they are without creating anything on disk.

      The folders of the folder and what is inside them are not included.

      Parameters:
      folder - the vfs URL of the folder
      Returns:
      the files of the folder
      Throws:
      IOException - if the folder cannot be read
    • materializeFolder

      public static File materializeFolder(URL folder) throws IOException
      Gets the given folder as a folder on disk, creating it and everything inside it, so that the caller can read the folder as a whole.

      The caller only gets what the virtual file system created inside the folder. A mount that creates something of its own elsewhere, such as a jar inside the folder, is not part of the folder that is returned, which is not expected to happen and is warned about.

      Parameters:
      folder - the vfs URL of the folder
      Returns:
      the folder on disk
      Throws:
      IOException - if the folder cannot be read
    • materializeJar

      public static File materializeJar(URL jar) throws IOException
      Packs the given jar into a jar file on disk, as a jar of the virtual file system is not a file the caller can open on its own.

      The jar is written into a temporary folder of its own, rather than into the temporary folder shared by everything on the machine, and both are deleted when the JVM exits.

      Parameters:
      jar - the vfs URL of the jar
      Returns:
      the jar file on disk
      Throws:
      IOException - if the jar cannot be read or written