Class DiskDriveService
java.lang.Object
io.github.eggy03.ferrumx.windows.service.storage.DiskDriveService
- All Implemented Interfaces:
CommonServiceInterface<DiskDrive>
Service class for fetching information about disk drives.
This class executes the CimQuery.DISK_QUERY
PowerShell command
and maps the resulting JSON into a list of DiskDrive
objects.
Thread safety
Methods of class are not thread safe.Usage examples
// Convenience API (creates its own short-lived session)
DiskDriveService diskService = new DiskDriveService();
List<DiskDrive> drives = diskService.get();
// API with re-usable session (caller manages session lifecycle)
try (PowerShell session = PowerShell.openSession()) {
DiskDriveService diskService = new DiskDriveService();
List<DiskDrive> drives = diskService.get(session);
}
- Since:
- 2.0.0
- Author:
- Egg-03
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DiskDriveService
public DiskDriveService()
-
-
Method Details
-
get
Retrieves a non-null list of disk drives present in the system.Each invocation creates and uses a short-lived PowerShell session internally.
- Specified by:
get
in interfaceCommonServiceInterface<DiskDrive>
- Returns:
- a list of
DiskDrive
objects representing the disk drives. Returns an empty list if no disk drives are detected.
-
get
Retrieves a non-null list of disk drives using the caller'sPowerShell
session.- Specified by:
get
in interfaceCommonServiceInterface<DiskDrive>
- Parameters:
powerShell
- an existing PowerShell session managed by the caller- Returns:
- a list of
DiskDrive
objects representing the disk drives. Returns an empty list if no disk drives are detected.
-