KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > CustomMBeanRegistration


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.server.core;
25 import com.sun.enterprise.config.serverbeans.Mbean;
26 import java.util.List JavaDoc;
27 import javax.management.ObjectName JavaDoc;
28
29 /** Defines the behavior to register MBeans in an MBeanServer.
30  */

31 public interface CustomMBeanRegistration {
32
33     /** Registers all the Mbeans in the given List of @link{Mbean} instances. Following is
34      * the contract of this method:
35      * <ul>
36      * <li> The given List must be non-null, an InvalidArgumentException is thrown otherwise </li>
37      * <li> Only the MBeans that are enabled are registered in MBeanServer </li>
38      * <li> Continues to load rest of the Mbeans if registration for one of them fails </li>
39      * <li> Never throws an Exception if the given List is non-null
40      * </ul>
41      * @param mbeans a list of MBeans to register, the list will be traversed serially
42      * @throws IllegalArgumentException if the param is null
43      *
44      */

45     public void registerMBeans(List JavaDoc<Mbean> mbeans) throws RuntimeException JavaDoc;
46
47     /** Registers all the Mbeans in the given List of @link{Mbean} instances. Following is
48      * the contract of this method:
49      * <ul>
50      * <li> Degenerates to registerMBeans(mbeans) if param continueReg is true</li>
51      * <li> If continueReg is false and there is any problem with registering an MBean in the given List, a
52      * RuntimeException is thrown </li>
53      * @param mbeans a List of MBeans to register
54      * @param continueReg a boolean to control the behavior of registration
55      * </ul>
56      */

57     public void registerMBeans(List JavaDoc<Mbean> mbeans, boolean continueReg) throws RuntimeException JavaDoc;
58
59     /** Registers an MBean per the given MBean definition in an MBeanServer of
60      * implementation choice. Registration process involves loading of MBean Class
61      * by a class-loader of implementation choice, instantiating it, registering it in the
62      * MBeanServer and initializing it if the configuration (MBeanDefinition) has it.
63      * If the initialization of the MBean fails, a RuntimeException is thrown and the
64      * MBean is deregistered if it was registered. Appropriate exceptions are available in
65      * the stack of the exceptions at every stage during registration, as follows: <ul>
66      * <li> ClassNotFoundException, NoClassDefFoundError if the class could not be loaded </li>
67      * <li> ExceptionInInitializerError, IllegalAccessException, InstantiationException if the MBean instance
68      * could not be created </li>
69      * <li> Standard attribute setting exceptions from MBeanServer's setAttribute(Attribute, Object) contract </li>
70      * </ul>
71      * The initialization is done using several calls to setAttribute(Attribute, Object) on the MBeanServer so as
72      * to know setting what attribute causes a problem, if any.
73      * @return ObjectName with which the MBean is going to be actually registered. If the Mbean definition given is not enabled,
74      * a null is returned
75      */

76     public ObjectName JavaDoc registerMBean(Mbean mbd) throws RuntimeException JavaDoc;
77     
78     /** Sets the ClassLoader instance that would be used in loading of MBean Class from this
79      * point onwards. This will affect the behavior of the implementing class once invoked because
80      * all the subsequent registration calls will use the given instance of ClassLoader. When set, this
81      * class-loader is used as the <i> initiating class loader </i> of the MBean Classes.
82      * @param cl ClassLoader instance to use, must be non-null
83      * @throws IllegalArgumentException if the given class-loader is null
84      */

85     public void setClassLoader(ClassLoader JavaDoc cl) throws IllegalArgumentException JavaDoc;
86 }
Popular Tags