@Override public String getContainerFileStoreName(final String containerName) { final Path path = containers.get(containerName); try { return Files.getFileStore(path).name(); } catch (IOException e) { return null; } }
@Override public String getFileStoreName() { final Path path = flowFileRepositoryPaths.iterator().next().toPath(); try { return Files.getFileStore(path).name(); } catch (IOException e) { return null; } }
@Override public String getContainerFileStoreName(final String containerName) { final Map<String, File> map = config.getStorageDirectories(); final File container = map.get(containerName); if (container == null) { return null; } try { return Files.getFileStore(container.toPath()).name(); } catch (IOException e) { return null; } }
private boolean addDirectoryInfo(String path, long quota, Map<String, MountedStorage> storageMap) throws IOException { File file = new File(path); if (!file.exists()) { System.err.format("Path %s does not exist.%n", path); return false; } if (!file.isDirectory()) { System.err.format("Path %s is not a valid directory.%n", path); return false; } long directorySize = FileUtils.sizeOfDirectory(file); // gets mounted FileStore that backs the directory of the given path FileStore store = Files.getFileStore(Paths.get(path)); MountedStorage storage = storageMap.get(store.name()); if (storage == null) { storage = new MountedStorage(store); storageMap.put(store.name(), storage); } storage.addDirectoryInfo(path, quota, directorySize); return true; }
@Override public String getContainerFileStoreName(final String containerName) { final Map<String, File> map = configuration.getStorageDirectories(); final File container = map.get(containerName); if (container == null) { return null; } try { return Files.getFileStore(container.toPath()).name(); } catch (IOException e) { return null; } }
String devName = store.name();
String name = fileStore.name(); if ( name.equals( "tmpfs" ) || name.equals( "hugetlbfs" ) )
@Override public String name() { return in.name(); }
@Override public String name() { return fileStore.name(); }
@Override public String name() { return fileStore.name(); }
@Override public String name() { return fileStore.name(); }
@Override public String name() { return in.name(); }
@Override public String name() { return in.name(); }
@Override public String name() { return origFileStore.name(); }
import java.nio.*; .... for (FileStore store: FileSystems.getDefault().getFileStores()) { System.out.printf("%s: %s%n", store.name(), store.type()); }
@Override public String getContainerFileStoreName(final String containerName) { final Map<String, File> map = configuration.getStorageDirectories(); final File container = map.get(containerName); if (container == null) { return null; } try { return Files.getFileStore(container.toPath()).name(); } catch (IOException e) { return null; } }
import java.io.IOException; import java.nio.file.FileStore; import java.nio.file.FileSystems; public class TestFileStore { public static void main(String[] args) throws IOException { for (FileStore fileStore : FileSystems.getDefault().getFileStores()) { System.out.println(fileStore.name()); System.out.println("Unallocated space: " + fileStore.getUnallocatedSpace()); System.out.println("Unused space: " + fileStore.getUsableSpace()); System.out.println("************************************"); } } }
@Test @Category( FileStores.class ) public void testFileStoresHaveAName() { for( FileStore store : FS.getFileStores() ) { assertThat( store.name()).isNotNull(); } }
@Override public StorageUnits value() { StorageUnits storageUnits = new StorageUnits(); for (FileStore fileStore : FileSystems.getDefault().getFileStores()) { try { StorageInformation storageInformation = new StorageInformation(fileStore.getUsableSpace(), fileStore.getTotalSpace()); storageUnits.put(fileStore.name(), storageInformation); } catch (IOException e) { logger.error("Failed to load file store", e); } } return storageUnits; }
@Test public void name() { Assert.assertEquals("Name of the file store should be equal to the name of the underlying archive", this.archive.getName(), this.fileStore.name()); }