Resolving, collecting or retrieving paths

Through PathHelper we can resolve or collect paths or retrieving resources even through supported archive files (zip, jar, jmod, ear and war). So we can create a path collection by adding an entry in file that starts with ‘paths.’ prefix (this is a fundamental requirement to allow PathHelper to load the paths), e.g.: folder;C:/some folder 2/ some folder 3; folder 4;C:/some folder 6;

These paths could be retrieved through PathHelper.getPaths method and we can find a resource in all configured paths plus the runtime class paths (that is automatically loaded under the entry named ‘paths.main-class-paths’) by using PathHelper.getResource method, e.g.:

ComponentSupplier componentSupplier = ComponentContainer.getInstance();
PathHelper pathHelper = componentSupplier.getPathHelper();
Collection<String> paths = pathHelper.getPaths("", ""));
//With the code below all configured paths plus runtime class paths will be iterated to search
//the resource called some.jar
FileSystemItem resource = pathHelper.getResource("/../some.jar");
InputStream inputStream = resource.toInputStream();

We can also use placeholder and relative paths, e.g.: folder 2/ some folder 3;${}/../some.jar;

It is also possibile to obtain references to resources of the runtime class paths by using the pre-loaded entry ‘paths.main-class-paths’ (runtime class paths are automatically iterated for searching the path that match the entry), e.g.:${paths.main-class-paths}/../some.jar;

We can also use a FileSystemItem listing (FSIL) expression and, for example, create a path collection of all absolute path of all classes of the runtime class paths:


A FSIL expression encloses in a couple of double slash an absolute path or a placeholdered path collection that will be scanned; after the second double slash we have the listing type that could refear to direct children of scanned paths (‘children‘) or to all nested children of scanned paths (‘allChildren‘); after that and colons we have the regular expression with we are going to filter the absolute paths iterated.