KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > mbeanserver > MetaData


1 /*
2  * @(#)MetaData.java 1.54 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.jmx.mbeanserver;
9
10 import javax.management.* ;
11  
12
13 /**
14  * The MetaData interface provides local to the metadata service in
15  * an agent.
16  *
17  * @since 1.5
18  * @since.unbundled JMX RI 1.2
19  */

20 public interface MetaData {
21     
22     /**
23      * This methods tests if the MBean is JMX compliant
24      */

25     public void testCompliance(Class JavaDoc c) throws NotCompliantMBeanException;
26
27     /**
28      * Invokes the preRegister method of an MBean that implements
29      * MBeanRegistration
30      */

31     public ObjectName preRegisterInvoker(Object JavaDoc moi, ObjectName name,
32                      MBeanServer mbs)
33     throws InstanceAlreadyExistsException, MBeanRegistrationException;
34
35     /**
36      * Invokes the postRegister method of an MBean that implements
37      * MBeanRegistration
38      */

39     public void postRegisterInvoker(Object JavaDoc moi, boolean registrationDone);
40
41     
42     /**
43      * Invokes the preDeregister method of an MBean that implements
44      * MBeanRegistration
45      */

46     public void preDeregisterInvoker(Object JavaDoc moi)
47     throws MBeanRegistrationException;
48
49     /**
50      * Invokes the postDeregister method of an MBean that implements
51      * MBeanRegistration
52      */

53     public void postDeregisterInvoker(Object JavaDoc moi);
54
55
56     /**
57      * This method discovers the attributes and operations that an MBean
58      * exposes for management.
59      *
60      * @param instance The MBean whose class is to be analyzed.
61      *
62      * @return An instance of MBeanInfo allowing to retrieve all methods
63      * and operations of this MBean.
64      *
65      * @exception IntrospectionException if an exception occurs during
66      * introspection.
67      *
68      */

69     public MBeanInfo getMBeanInfo(Object JavaDoc instance)
70     throws IntrospectionException ;
71        
72     
73     /**
74      * This method returns the class name of an MBean.
75      *
76      * @param instance The MBean whose class is to be analyzed.
77      *
78      * @return The class name of the MBean, as registered in its MBeanInfo.
79      *
80      * @exception IntrospectionException if an exception occurs during
81      * introspection.
82      *
83      */

84     public String JavaDoc getMBeanClassName(Object JavaDoc instance)
85     throws IntrospectionException, NotCompliantMBeanException ;
86        
87     
88     /**
89      * Gets the value of a specific attribute of an MBean.
90      *
91      * @param instance The MBean from which the attribute is to be retrieved.
92      * @param attribute An String specifying the name of the attribute to be
93      * retrieved.
94      *
95      * @return The value of the retrieved attribute.
96      *
97      * @exception AttributeNotFoundException The specified attribute is
98      * not accessible in the MBean.
99      * @exception MBeanException Wraps an exception thrown by the MBean's
100      * getter.
101      * @exception ReflectionException Wraps a java.lang.Exception thrown
102      * while trying to invoke the getter.
103      */

104     public Object JavaDoc getAttribute(Object JavaDoc instance, String JavaDoc attribute)
105     throws MBeanException, AttributeNotFoundException, ReflectionException;
106
107
108     /**
109      * Enables the values of several attributes of an MBean.
110      *
111      * @param instance The MBean from which the attributes are to be retrieved.
112      * @param attributes A list of the attributes to be retrieved.
113      *
114      * @return The list of the retrieved attributes.
115      *
116      * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.
117      *
118      */

119       public AttributeList getAttributes(Object JavaDoc instance, String JavaDoc[] attributes)
120         throws ReflectionException ;
121
122
123     /**
124      * Sets the value of a specific attribute of an MBean.
125      *
126      * @param instance The MBean within which the attribute is to be set.
127      * @param attribute The identification of the attribute to be set and
128      * the value it is to be set to.
129      *
130      * @return The value of the attribute that has been set.
131      *
132      * @exception AttributeNotFoundException The specified attribute is
133      * not accessible in the MBean.
134      * @exception InvalidAttributeValueException The specified value for
135      * the attribute is not valid.
136      * @exception MBeanException Wraps an exception thrown by the MBean's
137      * setter.
138      * @exception ReflectionException Wraps a java.lang.Exception thrown
139      * while trying to invoke the setter.
140      */

141     public Object JavaDoc setAttribute(Object JavaDoc instance, Attribute attribute)
142     throws AttributeNotFoundException, InvalidAttributeValueException,
143            MBeanException, ReflectionException;
144   
145
146     /**
147      * Sets the values of several attributes of an MBean.
148      *
149      * @param instance The MBean within which the attributes are to be set.
150      * @param attributes A list of attributes: The identification of the
151      * attributes to be set and the values they are to be set to.
152      *
153      * @return The list of attributes that were set, with their new values.
154      *
155      * @exception ReflectionException An exception occurred when trying to
156      * invoke the getAttributes method of a Dynamic MBean.
157      *
158      */

159     public AttributeList setAttributes(Object JavaDoc instance,
160                        AttributeList attributes)
161         throws ReflectionException;
162
163
164     /**
165      * Invokes an operation on an MBean.
166      *
167      * @param instance The MBean on which the method is to be invoked.
168      * @param operationName The name of the operation to be invoked.
169      * @param params An array containing the parameters to be set when the operation is
170      * invoked
171      * @param signature An array containing the signature of the operation. The class objects will
172      * be loaded using the same class loader as the one used for loading the
173      * MBean on which the operation was invoked.
174      *
175      * @return The object returned by the operation, which represents the result of
176      * invoking the operation on the MBean specified.
177      *
178      * @exception MBeanException Wraps an exception thrown by the MBean's invoked method.
179      * @exception ReflectionException Wraps a java.lang.Exception thrown while trying to invoke the method.
180      */

181     public Object JavaDoc invoke(Object JavaDoc instance, String JavaDoc operationName,
182              Object JavaDoc params[],String JavaDoc signature[])
183     throws MBeanException, ReflectionException;
184  
185     /**
186      * Determine whether the given MBean is an instance of a given
187      * class/interface.
188      *
189      * @param instance The MBean concerned.
190      * @param className The name of the class or interface.
191      * @return <code>true</code> if the MBean is an instance of the
192      * given <code>class</code>, <code>false</code> otherwise.
193      * @exception ReflectionException if
194      **/

195     public boolean isInstanceOf(Object JavaDoc instance, String JavaDoc className)
196     throws ReflectionException;
197
198 }
199
Popular Tags