1 // Copyright 2005 The Apache Software Foundation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package org.apache.hivemind.management; 16 17 import javax.management.InstanceAlreadyExistsException; 18 import javax.management.InstanceNotFoundException; 19 import javax.management.JMException; 20 import javax.management.MBeanRegistrationException; 21 import javax.management.NotCompliantMBeanException; 22 import javax.management.ObjectInstance; 23 import javax.management.ObjectName; 24 25 /** 26 * Service that registers MBeans in the an MBeanServer. 27 * 28 * @author Achim Huegen 29 * @since 1.1 30 */ 31 public interface MBeanRegistry 32 { 33 /** 34 * Registers a MBean in the MBeanServer 35 * 36 * @param obj 37 * the MBean 38 * @param managementInterface 39 * The ManagementInterface if obj is a Standard MBean Can be null, if obj implements 40 * DynamicMBean 41 * @param objectname 42 * ObjectName of the MBean 43 * @throws JMException 44 * If JMX calls fail 45 */ 46 public abstract ObjectInstance registerMBean(Object obj, Class managementInterface, 47 ObjectName objectname) throws InstanceAlreadyExistsException, 48 MBeanRegistrationException, NotCompliantMBeanException; 49 50 /** 51 * Unregisters a MBean from the MBeanServer 52 * 53 * @param objectname 54 * ObjectName of the MBean 55 * @throws InstanceNotFoundException 56 * @throws MBeanRegistrationException 57 */ 58 public abstract void unregisterMBean(ObjectName objectname) throws InstanceNotFoundException, 59 MBeanRegistrationException; 60 }