001    /**
002     * $Id: MBeanRegistry.java,v 1.4 2014/04/28 17:36:37 oboehm Exp $
003     *
004     * Copyright (c) 2008 by Oliver Boehm
005     *
006     * Licensed under the Apache License, Version 2.0 (the "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *   http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     *
018     * (c)reated 19.02.2009 by oliver (ob@oasd.de)
019     */
020    package patterntesting.runtime.jmx;
021    
022    import javax.management.*;
023    
024    /**
025     * To avoid confusion with the existing MBeanRegistration interface from
026     * javax.management this interface is now called MBeanRegistry
027     * (although there are too many negative associations with the word "registry").
028     *
029     * @author <a href="boehm@javatux.de">oliver</a>
030     * @since 19.02.2009
031     * @version $Revision: 1.4 $
032     */
033    public interface MBeanRegistry {
034    
035        /**
036         * Registers the MBean as "a.b.c:type=Xxx" (where "a.b.c" is the
037         * package name and "Xxx" the classname).
038         *
039         * @throws JMException the JMX exception
040         */
041        public void registerAsMBean() throws JMException;
042    
043        /**
044         * Register the MBean with the given name.
045         *
046         * @param name e.g. "a.b.c:type=Xxx"
047         * @throws JMException the JMX exception
048         */
049        public void registerAsMBean(String name) throws JMException;
050    
051        /**
052         * Register the MBean with the given object name.
053         *
054         * @param name e.g. new ObjectName("a.b.c:type=Xxx");
055         * @throws JMException the JMX exception
056         */
057        public void registerAsMBean(ObjectName name) throws JMException;
058    
059        /**
060         * Unregisters the MBean from the MBean server.
061         */
062        public void unregisterAsMBean();
063    
064        /**
065         * Was the object registered as MBean?
066         *
067         * @return true if object was registered.
068         */
069        public boolean isRegisteredAsMBean();
070    
071        /**
072         * Returns the MBean name under which this class was registered.
073         *
074         * @return e.g. "a.b.c:type=Xxx"
075         */
076        public String getMBeanName();
077    
078        /**
079         * Returns the MBean name under which this class was registered.
080         *
081         * @return e.g. "a.b.c:type=Xxx" as ObjectName
082         */
083        public ObjectName getObjectName() throws MalformedObjectNameException;
084    
085    }