View Javadoc
1   /*
2    * Copyright 2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.demo.jmx;
6   
7   import oshi.SystemInfo;
8   import oshi.demo.jmx.api.StrategyRegistrationPlatformMBeans;
9   import javax.management.MBeanServer;
10  import javax.management.InstanceAlreadyExistsException;
11  import javax.management.MalformedObjectNameException;
12  import javax.management.NotCompliantMBeanException;
13  import javax.management.MBeanRegistrationException;
14  import java.beans.IntrospectionException;
15  
16  public class ContextRegistrationPlatform {
17      private StrategyRegistrationPlatformMBeans strategyRegistrationContext;
18  
19      public void setStrategyRegistrationContext(StrategyRegistrationPlatformMBeans platformMBeans) {
20          this.strategyRegistrationContext = platformMBeans;
21      }
22  
23      public void registerMBeans(SystemInfo sisInfo, MBeanServer mBeanServer)
24              throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException,
25              MBeanRegistrationException, IntrospectionException, javax.management.IntrospectionException {
26          this.strategyRegistrationContext.registerMBeans(sisInfo, mBeanServer);
27      }
28  }