001: /**
002: * The XMOJO Project 5
003: * Copyright © 2003 XMOJO.org. All rights reserved.
004:
005: * NO WARRANTY
006:
007: * BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
008: * THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
009: * OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
010: * PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
011: * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
012: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
013: * TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE
014: * LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
015: * REPAIR OR CORRECTION.
016:
017: * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
018: * ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
019: * THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
020: * GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
021: * USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
022: * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
023: * PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
024: * EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
025: * SUCH DAMAGES.
026: **/package javax.management.modelmbean;
027:
028: import javax.management.Descriptor;
029: import javax.management.MBeanAttributeInfo;
030: import javax.management.MBeanConstructorInfo;
031: import javax.management.MBeanOperationInfo;
032: import javax.management.MBeanParameterInfo;
033: import javax.management.MBeanNotificationInfo;
034: import javax.management.MBeanException;
035: import javax.management.RuntimeOperationsException;
036:
037: /**
038: * ModelMBeanInfo interface is used to expose its metadat of management attributes,
039: * operations and notifications for use by the management system.
040: * <p>
041: * This interface is the implemented by the ModelMBeanInfo for every ModelMBean.
042: * An implementation of this interface must be shipped with every JMX Agent.
043: * <p>
044: * Java resources wishing to be manageable instatiate the ModelMBean using the
045: * MBeanServer's createMBean method. The resource then sets the ModelMBeanInfo
046: * and Descriptors for the ModelMBean instance. The attributes, operations, and
047: * notifications exposed via the ModelMBeanInfo for the ModelMBean comprise the
048: * management interface and are accessible from Mbeans, connectors/adapters like
049: * other MBeans. Through the Descriptors, values and methods in the managed
050: * application can be defined and mapped to attributes and operations of the
051: * ModelMBean. This mapping can be defined during development in a file or
052: * dynamically and programmatically at runtime.
053: * <p>
054: * Every ModelMBean which is instantiated in the MBeanServer becomes manageable:
055: * its attributes, operations, and notifications become remotely accessible through
056: * the connectors/adaptors connected to that MBeanServer. A Java object cannot be
057: * registered in the MBeanServer unless it is a JMX compliant MBean. By instantiating
058: * a ModelMBean, resources are guaranteed that the MBean is valid. MBeanException and
059: * RuntimeOperatiosException must be thrown on every public method. This allows for
060: * wrappering exceptions from distributed communications (RMI, EJB, etc.)
061: */
062: public interface ModelMBeanInfo {
063: /**
064: * To clone this ModelMBeanInfo implementation object as
065: * ModelMBeanInfoSupport object.
066: *
067: * @return The duplicate copy of the object
068: */
069: public Object clone();
070:
071: /**
072: * Gets the className of the ModelMBean
073: *
074: * @return The class name in string format
075: */
076: public String getClassName();
077:
078: /**
079: * Gets the description of this ModelMBean
080: *
081: * @return The description of the ModelMBean in string format
082: */
083: public String getDescription();
084:
085: /**
086: * Gets the attributes info of the ModelMBean targetted object. The return
087: * object will be a array of MBeanAttributeInfo objects
088: *
089: * @return The array of MBeanAttributeInfo objects are returned after getting
090: * the attributes info of the ModelMBean targetted object
091: */
092: public MBeanAttributeInfo[] getAttributes();
093:
094: /**
095: * Gets the constructors info of the ModelMBean targetted object.
096: * The return object will be a array of ModelMBeanConstructorInfo objects.
097: *
098: * @return The array of MBeanConstructorInfo objects are returned after
099: * getting the constructors info of the ModelMBean targetted object.
100: */
101: public MBeanConstructorInfo[] getConstructors();
102:
103: /**
104: * Gets the notifications info emitted by the ModelMBean targetted object.
105: * The return object will be a array of ModelMBeanNotificationInfo objects.
106: *
107: * @return The array of MBeanNotificationInfo objects are returned after
108: * getting the notifications info of the ModelMBean targetted object.
109: */
110: public MBeanNotificationInfo[] getNotifications();
111:
112: /**
113: * Gets the operations info of the ModelMBean targetted object. The return
114: * object will be a array of ModelMBeanOperationInfo objects.
115: *
116: * @return The array of MBeanOperationInfo objects are returned after
117: * getting the operations info of the ModelMBean targetted object.
118: */
119: public MBeanOperationInfo[] getOperations();
120:
121: /**
122: * Returns a Descriptor array consisting of all Descriptors for the
123: * ModelMBeanInfo including the MBean Descriptor, attribute Descriptors,
124: * operation Descriptors, constructor Descriptors, and notification Descriptors.
125: *
126: * @param inDescriptorType value of descriptorType field that must be set
127: * for the descriptor to be returned. Must be "mbean",
128: * "attribute", "operation", "constructor", or "notification".
129: * If it is null then all types will be returned.
130: *
131: * @return Descriptor array containing all descriptors for the ModelMBean
132: *
133: * @exception MBeanException Wraps another exception
134: *
135: * @exception RuntimeOperationsException Wraps another exception
136: */
137: public Descriptor[] getDescriptors(String inDescriptorType)
138: throws MBeanException, RuntimeOperationsException;
139:
140: /**
141: * Adds or replaces descriptors in the ModelMBeanInfo.
142: *
143: * @param inDescriptors The descriptors to be set in the ModelMBeanInfo.
144: * Null elements of the list will be ignored. All descriptors
145: * must have name and descriptorType fields.
146: *
147: * @exception MBeanException Wraps another exception
148: *
149: * @exception RuntimeOperationsException Wraps exceptions for illegal
150: * or null arguments
151: */
152: public void setDescriptors(Descriptor[] inDescriptors)
153: throws MBeanException, RuntimeOperationsException;
154:
155: /**
156: * Returns a Descriptor requested by name and descriptorType.
157: *
158: * @param inDescriptorName The name of the descriptor.
159: *
160: * @param inDescriptorType The type of the descriptor being requested.
161: * If this is null then all types are searched. Valid types
162: * are 'attribute', 'constructor', 'operation', and
163: * 'notification'. This value must be equal to the
164: * 'descriptorType' field in the descriptor that is returned.
165: *
166: * @return Descriptor containing the descriptor for the ModelMBean with the
167: * same name and descriptorType. If a descriptor is not found,
168: * null is returned.
169: *
170: * @exception MBeanException Wraps another exception
171: *
172: * @exception RuntimeOperationsException Wraps exceptions for invalid
173: * input name or type.
174: */
175: public Descriptor getDescriptor(String inDescriptorName,
176: String inDescriptorType) throws MBeanException,
177: RuntimeOperationsException;
178:
179: /**
180: * Adds or replaces descriptors in all the info arrays for the ModelMBean.
181: *
182: * @param inDescriptor The descriptor to be set in the ModelMBean.
183: * It must NOT be null. All descriptors must have name and
184: * descriptorType fields.
185: *
186: * @param inDescriptorType The type of the descriptor being set. If this
187: * is null then the descriptorType field in the descriptor
188: * is used. If specified this value must be set in the
189: * descriptorType field for the descriptor to be returned.
190: * Must be "mbean","attribute", "operation", "constructor",
191: * or "notification".
192: *
193: * @exception RuntimeOperationsException Wraps exceptions for illegal
194: * or null arguments.
195: */
196: public void setDescriptor(Descriptor inDescriptor,
197: String inDescriptorType) throws MBeanException,
198: RuntimeOperationsException;
199:
200: /**
201: * Returns a MBean's descriptor. This descriptor contains metadata about
202: * the MBean and default policies for persistence and caching for the
203: * entire MBean. Policies may be overridden by descriptors associated with
204: * attribute, constructors, or operations with the same fieldNames.
205: *
206: * @return The MBeanDescriptor
207: *
208: * @exception MBeanException Wraps another exception
209: *
210: * @exception RuntimeOperationsException Wraps another exception
211: */
212: public Descriptor getMBeanDescriptor() throws MBeanException,
213: RuntimeOperationsException;
214:
215: /**
216: * Sets the ModelMBean's descriptor (fully replace). This descriptor
217: * contains metadata about the MBean and default policies for persistence
218: * and caching for the entire MBean. Policies may be overridden by
219: * descriptors associated with attribute, constructors, or operations with
220: * the same fieldNames. This operation does a complete replacement of the
221: * descriptor, no merging is done.
222: *
223: * @param inDescriptor This descriptor contains metadata about the MBean
224: * and default policies for persistence and caching for
225: * the entire MBean.
226: *
227: * @exception MBeanException Wraps another exception
228: *
229: * @exception RuntimeOperationsException Wraps another exception
230: */
231: public void setMBeanDescriptor(Descriptor inDescriptor)
232: throws MBeanException, RuntimeOperationsException;
233:
234: /**
235: * Returns a ModelMBeanAttributeInfo requested by name.
236: *
237: * @param inName The name of the ModelMBeanAttributeInfo to get.
238: *
239: * @return ModelMBeanAttributeInfo requested by name
240: *
241: * @exception MBeanException Wraps another exception
242: *
243: * @exception RuntimeOperationsException Wraps another exception for
244: * invalid attribute name or ModelMBeanAttributeInfo to be returned.
245: */
246: public ModelMBeanAttributeInfo getAttribute(String inName)
247: throws MBeanException, RuntimeOperationsException;
248:
249: /**
250: * Returns a ModelMBeanOperationInfo requested by name.
251: *
252: * @param inName The name of the ModelMBeanOperationInfo to get.
253: *
254: * @return ModelMBeanOperationInfo requested by name
255: *
256: * @exception MBeanException Wraps another exception
257: *
258: * @exception RuntimeOperationsException Wraps another exception for
259: * invalid attribute name or ModelMBeanAttributeInfo to be returned.
260: */
261: public ModelMBeanOperationInfo getOperation(String inName)
262: throws MBeanException, RuntimeOperationsException;
263:
264: /**
265: * Returns a ModelMBeanNotificationInfo requested by name.
266: *
267: * @param inName The name of the ModelMBeanNotificationInfo to get.
268: *
269: * @return ModelMBeanNotificationInfo requested by name
270: *
271: * @exception MBeanException Wraps another exception
272: *
273: * @exception RuntimeOperationsException Wraps another exception
274: */
275: public ModelMBeanNotificationInfo getNotification(String inName)
276: throws MBeanException, RuntimeOperationsException;
277: }
|