0N/A/*
2362N/A * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.management;
0N/A
0N/A
0N/A/**
406N/A * <p>Can be implemented by an MBean in order to
0N/A * carry out operations before and after being registered or unregistered from
406N/A * the MBean Server. An MBean can also implement this interface in order
406N/A * to get a reference to the MBean Server and/or its name within that
406N/A * MBean Server.</p>
406N/A *
0N/A * @since 1.5
0N/A */
0N/Apublic interface MBeanRegistration {
0N/A
0N/A
0N/A /**
0N/A * Allows the MBean to perform any operations it needs before
406N/A * being registered in the MBean Server. If the name of the MBean
0N/A * is not specified, the MBean can provide a name for its
0N/A * registration. If any exception is raised, the MBean will not be
406N/A * registered in the MBean Server.
0N/A *
406N/A * @param server The MBean Server in which the MBean will be registered.
0N/A *
0N/A * @param name The object name of the MBean. This name is null if
0N/A * the name parameter to one of the <code>createMBean</code> or
0N/A * <code>registerMBean</code> methods in the {@link MBeanServer}
0N/A * interface is null. In that case, this method must return a
0N/A * non-null ObjectName for the new MBean.
0N/A *
0N/A * @return The name under which the MBean is to be registered.
0N/A * This value must not be null. If the <code>name</code>
0N/A * parameter is not null, it will usually but not necessarily be
0N/A * the returned value.
0N/A *
0N/A * @exception java.lang.Exception This exception will be caught by
406N/A * the MBean Server and re-thrown as an {@link
0N/A * MBeanRegistrationException}.
0N/A */
0N/A public ObjectName preRegister(MBeanServer server,
0N/A ObjectName name) throws java.lang.Exception;
0N/A
0N/A /**
0N/A * Allows the MBean to perform any operations needed after having been
0N/A * registered in the MBean server or after the registration has failed.
467N/A * <p>If the implementation of this method throws a {@link RuntimeException}
467N/A * or an {@link Error}, the MBean Server will rethrow those inside
467N/A * a {@link RuntimeMBeanException} or {@link RuntimeErrorException},
467N/A * respectively. However, throwing an exception in {@code postRegister}
467N/A * will not change the state of the MBean:
467N/A * if the MBean was already registered ({@code registrationDone} is
467N/A * {@code true}), the MBean will remain registered. </p>
467N/A * <p>This might be confusing for the code calling {@code createMBean()}
467N/A * or {@code registerMBean()}, as such code might assume that MBean
467N/A * registration has failed when such an exception is raised.
467N/A * Therefore it is recommended that implementations of
467N/A * {@code postRegister} do not throw Runtime Exceptions or Errors if it
467N/A * can be avoided.</p>
0N/A * @param registrationDone Indicates whether or not the MBean has
0N/A * been successfully registered in the MBean server. The value
0N/A * false means that the registration phase has failed.
0N/A */
0N/A public void postRegister(Boolean registrationDone);
0N/A
0N/A /**
0N/A * Allows the MBean to perform any operations it needs before
0N/A * being unregistered by the MBean server.
0N/A *
0N/A * @exception java.lang.Exception This exception will be caught by
0N/A * the MBean server and re-thrown as an {@link
0N/A * MBeanRegistrationException}.
0N/A */
0N/A public void preDeregister() throws java.lang.Exception ;
0N/A
0N/A /**
0N/A * Allows the MBean to perform any operations needed after having been
0N/A * unregistered in the MBean server.
467N/A * <p>If the implementation of this method throws a {@link RuntimeException}
467N/A * or an {@link Error}, the MBean Server will rethrow those inside
467N/A * a {@link RuntimeMBeanException} or {@link RuntimeErrorException},
1790N/A * respectively. However, throwing an exception in {@code postDeregister}
467N/A * will not change the state of the MBean:
467N/A * the MBean was already successfully deregistered and will remain so. </p>
467N/A * <p>This might be confusing for the code calling
467N/A * {@code unregisterMBean()}, as it might assume that MBean deregistration
467N/A * has failed. Therefore it is recommended that implementations of
467N/A * {@code postDeregister} do not throw Runtime Exceptions or Errors if it
467N/A * can be avoided.</p>
0N/A */
0N/A public void postDeregister();
0N/A
0N/A }