Search in sources :

Example 1 with IFileSystem

use of com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.IFileSystem in project ats-framework by Axway.

the class OshiSystemInformation method listFileSystems.

@Override
public IFileSystem[] listFileSystems() {
    FileSystem fs = this.systemInfo.getOperatingSystem().getFileSystem();
    // enumerate only local drives. (Network ones are excluded)
    List<OSFileStore> fileStores = fs.getFileStores(true);
    List<IFileSystem> fileSystems = new ArrayList<IFileSystem>();
    for (OSFileStore fileStore : fileStores) {
        fileSystems.add(new OshiFileSystem(fileStore, fileStore.getMount()));
    }
    return fileSystems.toArray(new IFileSystem[fileSystems.size()]);
}
Also used : OSFileStore(oshi.software.os.OSFileStore) FileSystem(oshi.software.os.FileSystem) IFileSystem(com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.IFileSystem) IFileSystem(com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.IFileSystem) ArrayList(java.util.ArrayList)

Example 2 with IFileSystem

use of com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.IFileSystem in project ats-framework by Axway.

the class OshiSystemInformation method getFileSystem.

@Override
public IFileSystem getFileSystem(String devName) {
    try {
        FileSystem fs = this.os.getFileSystem();
        List<OSFileStore> fileStores = fs.getFileStores();
        for (OSFileStore fileStore : fileStores) {
            if (fileStore.getName().equals(devName)) {
                return new OshiFileSystem(fileStore, fileStore.getName());
            }
        }
        throw new SystemInformationException("No such file system drive device '" + devName + "'");
    } catch (Exception e) {
        throw new SystemInformationException("Could not obtain file system for/from device '" + devName + "'", e);
    }
}
Also used : OSFileStore(oshi.software.os.OSFileStore) FileSystem(oshi.software.os.FileSystem) IFileSystem(com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.IFileSystem) SystemInformationException(com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.exceptions.SystemInformationException) SystemInformationException(com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.exceptions.SystemInformationException)

Aggregations

IFileSystem (com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.IFileSystem)2 FileSystem (oshi.software.os.FileSystem)2 OSFileStore (oshi.software.os.OSFileStore)2 SystemInformationException (com.axway.ats.agent.core.monitoring.systemmonitor.systeminformation.exceptions.SystemInformationException)1 ArrayList (java.util.ArrayList)1