001// Copyright 2010, 2011 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007// http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry5.jmx;
016
017import javax.management.ObjectName;
018
019/**
020 * Creates an MBean server and registers MBeans with the created server. The registered MBeans are unregistered when
021 * Registry is shut down.
022 * 
023 * @since 5.2.0
024 */
025public interface MBeanSupport
026{
027
028    /**
029     * Registers the specified MBean with the server.
030     * 
031     * @param bean
032     *            the MBean instance
033     * @param objectName
034     *            the name for the MBean
035     */
036    void register(Object bean, ObjectName objectName);
037
038    /**
039     * Registers the specific MBean with the server.
040     * 
041     * @param bean
042     *            the MBean instance
043     * @param name
044     *            string name used to create an {@link ObjectName}
045     * @since 5.3
046     */
047    void register(Object bean, String name);
048
049    /**
050     * Unregisters the specified MBean from the server.
051     * 
052     * @param objectName
053     *            the name for the MBean
054     */
055    void unregister(ObjectName objectName);
056}