KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > modelmbean > ModelMBean


1 /*
2  * @(#)file ModelMBean.java
3  * @(#)author IBM Corp.
4  * @(#)version 1.21
5  * @(#)lastedit 04/02/10
6  */

7 /*
8  * Copyright IBM Corp. 1999-2000. All rights reserved.
9  *
10  * The program is provided "as is" without any warranty express or implied,
11  * including the warranty of non-infringement and the implied warranties of
12  * merchantibility and fitness for a particular purpose. IBM will not be
13  * liable for any damages suffered by you or any third party claim against
14  * you regarding the Program.
15  *
16  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
17  * This software is the proprietary information of Sun Microsystems, Inc.
18  * Use is subject to license terms.
19  *
20  * Copyright 2004 Sun Microsystems, Inc. Tous droits reserves.
21  * Ce logiciel est propriete de Sun Microsystems, Inc.
22  * Distribue par des licences qui en restreignent l'utilisation.
23  *
24  */

25
26
27
28 package javax.management.modelmbean;
29
30 import javax.management.*;
31
32 import javax.management.InstanceNotFoundException JavaDoc;
33
34 /**
35  * This interface must be implemented by the ModelMBeans. An implementation of this interface
36  * must be shipped with every JMX Agent.
37  * <P>
38  * Java resources wishing to be manageable instantiate the ModelMBean using the MBeanServer's
39  * createMBean method. The resource then sets the ModelMBeanInfo (with Descriptors) for the ModelMBean
40  * instance. The attributes and operations exposed via the ModelMBeanInfo for the ModelMBean are accessible
41  * from MBeans, connectors/adaptors like other MBeans. Through the ModelMBeanInfo Descriptors, values and methods in
42  * the managed application can be defined and mapped to attributes and operations of the ModelMBean.
43  * This mapping can be defined during development in an XML formatted file or dynamically and
44  * programmatically at runtime.
45  * <P>
46  * Every ModelMBean which is instantiated in the MBeanServer becomes manageable:
47  * its attributes and operations
48  * become remotely accessible through the connectors/adaptors connected to that MBeanServer.
49  * A Java object cannot be registered in the MBeanServer unless it is a JMX compliant MBean.
50  * By instantiating a ModelMBean, resources are guaranteed that the MBean is valid.
51  * <P>
52  * MBeanException and RuntimeOperationsException must be thrown on every public method. This allows
53  * for wrapping exceptions from distributed communications (RMI, EJB, etc.). These exceptions do
54  * not have to be thrown by the implementation except in the scenarios described in the specification
55  * and javadoc.
56  *
57  * @since 1.5
58  */

59
60 public interface ModelMBean extends
61      DynamicMBean,
62      PersistentMBean,
63      ModelMBeanNotificationBroadcaster JavaDoc
64 {
65
66     /**
67      * Initializes a ModelMBean object using ModelMBeanInfo passed in.
68      * This method makes it possible to set a customized ModelMBeanInfo on
69      * the ModelMBean as long as it is not registered with the MBeanServer.
70      * <br>
71      * Once the ModelMBean's ModelMBeanInfo (with Descriptors) are
72      * customized and set on the ModelMBean, the ModelMBean can be
73      * registered with the MBeanServer.
74      * <P>
75      * If the ModelMBean is currently registered, this method throws
76      * a {@link javax.management.RuntimeOperationsException} wrapping an
77      * {@link IllegalStateException}
78      *
79      * @param inModelMBeanInfo The ModelMBeanInfo object to be used
80      * by the ModelMBean.
81      *
82      * @exception MBeanException Wraps a distributed communication
83      * Exception.
84      * @exception RuntimeOperationsException
85      * <ul><li>Wraps an {@link IllegalArgumentException} if
86      * the MBeanInfo passed in parameter is null.</li>
87      * <li>Wraps an {@link IllegalStateException} if the ModelMBean
88      * is currently registered in the MBeanServer.</li>
89      * </ul>
90      *
91      **/

92     public void setModelMBeanInfo(ModelMBeanInfo JavaDoc inModelMBeanInfo)
93         throws MBeanException, RuntimeOperationsException;
94
95     /**
96      * Sets the instance handle of the object against which to
97      * execute all methods in this ModelMBean management interface
98      * (MBeanInfo and Descriptors).
99      *
100      * @param mr Object that is the managed resource
101      * @param mr_type The type of reference for the managed resource. Can be: ObjectReference,
102      * Handle, IOR, EJBHandle, RMIReference.
103      * If the MBeanServer cannot process the mr_type passed in, an InvalidTargetTypeException
104      * will be thrown.
105      *
106      *
107      * @exception MBeanException The initializer of the object has thrown an exception.
108      * @exception RuntimeOperationsException Wraps an IllegalArgumentException:
109      * The managed resource type passed in parameter is null.
110      * @exception InstanceNotFoundException The managed resource object could not be found
111      * @exception InvalidTargetObjectTypeException The managed resource type cannot be processed by the
112      * ModelMBean or JMX Agent.
113      */

114     public void setManagedResource(Object JavaDoc mr, String JavaDoc mr_type)
115     throws MBeanException, RuntimeOperationsException,
116          InstanceNotFoundException JavaDoc, InvalidTargetObjectTypeException JavaDoc ;
117
118 }
119
Popular Tags