1
2
3
4
5 package oshi.demo.jmx.strategiesplatform;
6
7 import oshi.SystemInfo;
8 import oshi.demo.jmx.api.StrategyRegistrationPlatformMBeans;
9
10 import javax.management.MBeanServer;
11 import javax.management.NotCompliantMBeanException;
12 import javax.management.InstanceAlreadyExistsException;
13 import javax.management.MBeanRegistrationException;
14 import javax.management.MalformedObjectNameException;
15 import javax.management.ObjectName;
16
17 import java.beans.IntrospectionException;
18
19 public class WindowsStrategyRegistrattionPlatform implements StrategyRegistrationPlatformMBeans {
20 @Override
21 public void registerMBeans(SystemInfo systemInfo, MBeanServer mBeanServer)
22 throws NotCompliantMBeanException, InstanceAlreadyExistsException, MBeanRegistrationException,
23 MalformedObjectNameException, IntrospectionException, javax.management.IntrospectionException {
24
25
26
27 ObjectName objectName = new ObjectName("oshi:component=BaseBoard");
28 oshi.demo.jmx.mbeans.Baseboard baseBoardMBean = new oshi.demo.jmx.mbeans.Baseboard(
29 systemInfo.getHardware().getComputerSystem().getBaseboard());
30
31 mBeanServer.registerMBean(baseBoardMBean, objectName);
32 }
33 }