001/* 002 * Copyright 2002-2009 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.jmx.export; 018 019import javax.management.ObjectName; 020 021/** 022 * Interface that defines the set of MBean export operations that are intended to be 023 * accessed by application developers during application runtime. 024 * 025 * <p>This interface should be used to export application resources to JMX using Spring's 026 * management interface generation capabilties and, optionally, it's {@link ObjectName} 027 * generation capabilities. 028 * 029 * @author Rob Harrop 030 * @since 2.0 031 * @see MBeanExporter 032 */ 033public interface MBeanExportOperations { 034 035 /** 036 * Register the supplied resource with JMX. If the resource is not a valid MBean already, 037 * Spring will generate a management interface for it. The exact interface generated will 038 * depend on the implementation and its configuration. This call also generates an 039 * {@link ObjectName} for the managed resource and returns this to the caller. 040 * @param managedResource the resource to expose via JMX 041 * @return the {@link ObjectName} under which the resource was exposed 042 * @throws MBeanExportException if Spring is unable to generate an {@link ObjectName} 043 * or register the MBean 044 */ 045 ObjectName registerManagedResource(Object managedResource) throws MBeanExportException; 046 047 /** 048 * Register the supplied resource with JMX. If the resource is not a valid MBean already, 049 * Spring will generate a management interface for it. The exact interface generated will 050 * depend on the implementation and its configuration. 051 * @param managedResource the resource to expose via JMX 052 * @param objectName the {@link ObjectName} under which to expose the resource 053 * @throws MBeanExportException if Spring is unable to register the MBean 054 */ 055 void registerManagedResource(Object managedResource, ObjectName objectName) throws MBeanExportException; 056 057 /** 058 * Remove the specified MBean from the underlying MBeanServer registry. 059 * @param objectName the {@link ObjectName} of the resource to remove 060 */ 061 void unregisterManagedResource(ObjectName objectName); 062 063}