View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.hardware.platform.unix.aix;
6   
7   import java.util.List;
8   import java.util.function.Supplier;
9   
10  import oshi.annotation.concurrent.Immutable;
11  import oshi.driver.unix.aix.Lscfg;
12  import oshi.hardware.common.AbstractBaseboard;
13  import oshi.util.Constants;
14  import oshi.util.Util;
15  import oshi.util.tuples.Triplet;
16  
17  /**
18   * Baseboard data obtained by lscfg
19   */
20  @Immutable
21  final class AixBaseboard extends AbstractBaseboard {
22  
23      private static final String IBM = "IBM";
24      private final String model;
25      private final String serialNumber;
26      private final String version;
27  
28      AixBaseboard(Supplier<List<String>> lscfg) {
29          Triplet<String, String, String> msv = Lscfg.queryBackplaneModelSerialVersion(lscfg.get());
30          this.model = Util.isBlank(msv.getA()) ? Constants.UNKNOWN : msv.getA();
31          this.serialNumber = Util.isBlank(msv.getB()) ? Constants.UNKNOWN : msv.getB();
32          this.version = Util.isBlank(msv.getC()) ? Constants.UNKNOWN : msv.getC();
33      }
34  
35      @Override
36      public String getManufacturer() {
37          return IBM;
38      }
39  
40      @Override
41      public String getModel() {
42          return this.model;
43      }
44  
45      @Override
46      public String getSerialNumber() {
47          return this.serialNumber;
48      }
49  
50      @Override
51      public String getVersion() {
52          return this.version;
53      }
54  }