public static FileSystem getBaseFileSystem() { try { return getFileSystemManager().getBaseFile().getFileSystem(); } catch (final FileSystemException e) { throw new IllegalStateException(e); } }
/** * Gets the file system manager to use in typical scenarios. * * @return */ public static FileSystemManager getFileSystemManager() { try { final FileSystemManager manager = VFS.getManager(); if (manager.getBaseFile() == null) { // if no base file exists, set the working directory to base // dir. ((DefaultFileSystemManager) manager).setBaseFile(new File(".")); } return manager; } catch (final FileSystemException e) { throw new IllegalStateException(e); } }
/** * Gets the file system manager to use in typical scenarios. * * @return */ public static FileSystemManager getFileSystemManager() { try { final FileSystemManager manager = VFS.getManager(); if (manager.getBaseFile() == null) { // if no base file exists, set the working directory to base // dir. ((DefaultFileSystemManager) manager).setBaseFile(new File(".")); } return manager; } catch (FileSystemException e) { throw new IllegalStateException(e); } }
/** * Get the content of a test flux */ public String getTestFluxContent(String id) throws ContentNotFetchedException { try { return readFile(VFS.getManager().getBaseFile().getChild("testFlux").resolveFile(id)); } catch (Exception e) { throw new ContentNotFetchedException("Exception raised", e); } }
/** * Set the content of a test flux */ public void setTestFluxContent(String content, String id) throws ContentNotSavedException { try { FileObject file = VFS.getManager().getBaseFile().resolveFile("testFlux").resolveFile(id); file.getParent().createFolder(); writeFile(file, content); } catch (Exception e) { throw new ContentNotSavedException("Couldn't write into file", e); } }
public URL getScript(URL script) { try { FileSystemManager manager = VFS.getManager(); FileObject fileDestination = manager.getBaseFile().resolveFile("archive"); if (!fileDestination.exists() || !initialized) { initScript(script, fileDestination); } return fileDestination.getURL(); } catch (Exception e) { logService.error(() -> "Error copying script", e); throw new BatchArchiveException(e); } }