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.DynamicMBean;
029: import javax.management.PersistentMBean;
030: import javax.management.MBeanException;
031: import javax.management.InstanceNotFoundException;
032: import javax.management.RuntimeOperationsException;
033:
034: /**
035: * ModelMBean interface is used to expose its management data,
036: * operations and notifications for use by the management system.
037: * This interface provides a management template for managed resources.
038: * The adaptors will interact with the ModelMBean through the JMX agent(server).
039: * It will find the managed resource provided attributes and operations through
040: * the MBeanInfo object. It find the behavior details about the supported
041: * attribute, operations and notifications through this ModelMBean interface.
042: * <p>
043: * This interface must be implemented by the ModelMBeans.
044: * An implementation of this interface must be shipped with every JMX Agent.
045: * <p>
046: * Java resources wishing to be manageable instatiate the ModelMBean using
047: * the MBeanServer's createMBean method. The resource then sets the
048: * ModelMBeanInfo (with Descriptors) for the ModelMBean instance. The
049: * attributes and operations exposed via the ModelMBeanInfo for the ModelMBean
050: * are accessible from Mbeans, connectors/adapters like other MBeans. Through
051: * the ModelMBeanInfo Descriptors, values and methods in the managed
052: * application can be defined and mapped to attributes and operations of the
053: * ModelMBean. This mapping can be defined during development in an XML
054: * formatted file or dynamically and programmatically at runtime.
055: * <p>
056: * Every ModelMBean which is instantiated in the MBeanServer becomes manageable:
057: * its attributes and operations become remotely accessible through the
058: * connectors/adaptors connected to that MBeanServer. A Java object cannot be
059: * registered in the MBeanServer unless it is a JMX compliant MBean. By
060: * instantiating a ModelMBean, resources are guaranteed that the MBean is valid.
061: * <p>
062: * MBeanException and RuntimeOperatiosException must be thrown on every public
063: * method. This allows for wrappering exceptions from distributed communications
064: * (RMI, EJB, etc.). These exceptions do not have to be thrown by the implementation
065: */
066: public interface ModelMBean extends DynamicMBean, PersistentMBean,
067: ModelMBeanNotificationBroadcaster {
068: /**
069: * Initializes a ModelMBean object using ModelMBeanInfo passed in. The
070: * ModelMBean must be instantiated, but not registered with the MBeanServer.
071: * After the ModelMBean's ModelMBeanInfo (with Descriptors) are customized,
072: * the ModelMBean should be registered with the MBeanServer.
073: *
074: * @param inModelMBeanInfo The ModelMBeanInfo object to be used by the ModelMBean.
075: *
076: * @exception MBeanException The constructor of the MBeanInfo has
077: * return null or thrown an exception.
078: *
079: * @exception RuntimeOperationsException Wraps an IllegalArgumentException:
080: * The MBeanInfo passed in parameter is null or invalid.
081: */
082: public void setModelMBeanInfo(ModelMBeanInfo inModelMBeanInfo)
083: throws MBeanException, RuntimeOperationsException;
084:
085: /**
086: * Sets the instance handle of the object against which to execute all
087: * methods in this ModelMBean management interface (MBeanInfo and
088: * Descriptors).
089: *
090: * @param mr Object that is the managed resource
091: *
092: * @param mr_type The type of reference for the managed resource.
093: * Can be: ObjectReference, Handle, IOR, EJBHandle, RMIReference.
094: * If the MBeanServer cannot process the mr_type passed in, an
095: * InvalidTargetTypeException will be thrown.
096: *
097: * @exception MBeanException The initializer of the object has thrown an exception.
098: *
099: * @exception RuntimeOperationsException Wraps an IllegalArgumentException:
100: * The managed resource or managed resoure type passed in
101: * parameter is null or invalid.
102: *
103: * @exception InstanceNotFoundException The managed resource object could
104: * not be found
105: *
106: * @exception InvalidTargetObjectTypeException The managed resource type
107: * cannot be processed by the ModelMBean or JMX Agent.
108: */
109: public void setManagedResource(Object mr, String mr_type)
110: throws MBeanException, RuntimeOperationsException,
111: InstanceNotFoundException, InvalidTargetObjectTypeException;
112: }
|