public Map<String, ? extends DriveMetrics> apply(Map<String, String> from) { Builder<String, DriveMetrics> builder = ImmutableMap.builder(); addIDEDevices(from, builder); addSCSIDevices(from, builder); addBlockDevices(from, builder); return builder.build(); }
protected void addSCSIDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { SCSI: for (int unit : new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }) { String key = String.format("scsi:0:%d", unit); if (!from.containsKey(key)) break SCSI; devices.put(key, buildMetrics(key, from)); } }
protected void addBlockDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { BLOCK: for (int index : new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }) { String key = String.format("block:0:%d", index); if (!from.containsKey(key)) break BLOCK; devices.put(key, buildMetrics(key, from)); } }
public Map<String, ? extends DriveMetrics> apply(Map<String, String> from) { Builder<String, DriveMetrics> builder = ImmutableMap.builder(); addIDEDevices(from, builder); addSCSIDevices(from, builder); addBlockDevices(from, builder); return builder.build(); }
protected void addSCSIDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { SCSI: for (int unit : new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }) { String key = String.format("scsi:0:%d", unit); if (!from.containsKey(key)) break SCSI; devices.put(key, buildMetrics(key, from)); } }
public Map<String, ? extends DriveMetrics> apply(Map<String, String> from) { Builder<String, DriveMetrics> builder = ImmutableMap.builder(); addIDEDevices(from, builder); addSCSIDevices(from, builder); addBlockDevices(from, builder); return builder.build(); }
protected void addIDEDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { IDE: for (int bus : new int[] { 0, 1 }) for (int unit : new int[] { 0, 1 }) { String key = String.format("ide:%d:%d", bus, unit); if (!from.containsKey(key)) break IDE; devices.put(key, buildMetrics(key, from)); } }
protected void addBlockDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { BLOCK: for (int index : new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }) { String key = String.format("block:0:%d", index); if (!from.containsKey(key)) break BLOCK; devices.put(key, buildMetrics(key, from)); } }
protected void addIDEDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { IDE: for (int bus : new int[] { 0, 1 }) for (int unit : new int[] { 0, 1 }) { String key = String.format("ide:%d:%d", bus, unit); if (!from.containsKey(key)) break IDE; devices.put(key, buildMetrics(key, from)); } }
protected void addIDEDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { IDE: for (int bus : new int[] { 0, 1 }) for (int unit : new int[] { 0, 1 }) { String key = String.format("ide:%d:%d", bus, unit); if (!from.containsKey(key)) break IDE; devices.put(key, buildMetrics(key, from)); } }
protected void addBlockDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { BLOCK: for (int index : new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }) { String key = String.format("block:0:%d", index); if (!from.containsKey(key)) break BLOCK; devices.put(key, buildMetrics(key, from)); } }
protected void addSCSIDevices(Map<String, String> from, Builder<String, DriveMetrics> devices) { SCSI: for (int unit : new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }) { String key = String.format("scsi:0:%d", unit); if (!from.containsKey(key)) break SCSI; devices.put(key, buildMetrics(key, from)); } }