| public class javax.management.modelmbean RequiredModelMBean
|
Java SE 6 |
Java resources wishing to be manageable instantiate the RequiredModelMBean using the MBeanServer's createMBean method. The resource then sets the MBeanInfo and Descriptors for the RequiredModelMBean instance. The attributes and operations exposed via the ModelMBeanInfo for the ModelMBean are accessible from MBeans, connectors/adaptors like other MBeans. Through the Descriptors, values and methods in the managed application can be defined and mapped to attributes and operations of the ModelMBean. This mapping can be defined in an XML formatted file or dynamically and programmatically at runtime.
Every RequiredModelMBean which is instantiated in the MBeanServer
becomes manageable:
its attributes and operations become remotely accessible through the
connectors/adaptors connected to that MBeanServer.
A Java object cannot be registered in the MBeanServer unless it is a JMX compliant MBean. By instantiating a RequiredModelMBean, resources are guaranteed that the MBean is valid. MBeanException and RuntimeOperationsException must be thrown on every public method. This allows for wrapping exceptions from distributed communications (RMI, EJB, etc.)
| since | 1.5 |
| Constructors | |||||||
|---|---|---|---|---|---|---|---|
| public | RequiredModelMBean() throws MBeanException, RuntimeOperationsException Details
Constructs an RequiredModelMBean with an empty
ModelMBeanInfo.
The RequiredModelMBean's MBeanInfo and Descriptors
can be customized using the
| ||||||
| public | RequiredModelMBean(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException Details
Constructs a RequiredModelMBean object using ModelMBeanInfo passed in.
As long as the RequiredModelMBean is not registered
with the MBeanServer yet, the RequiredModelMBean's MBeanInfo and
Descriptors can be customized using the #setModelMBeanInfo
method.
After the RequiredModelMBean's MBeanInfo and Descriptors are
customized, the RequiredModelMBean can be registered with the
MBeanServer.
| ||||||
| Methods | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public void | addAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName, Object inhandback) throws MBeanException, RuntimeOperationsException, IllegalArgumentException | ||||||||||||||
| public void | addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException Details
Registers an object which implements the NotificationListener
interface as a listener. This
object's 'handleNotification()' method will be invoked when any
notification is issued through or by the ModelMBean. This does
not include attributeChangeNotifications. They must be registered
for independently.
| ||||||||||||||
| public Object | invoke(String opName, Object[] opArgs, String[] sig) throws MBeanException, ReflectionException Details
Invokes a method on or through a RequiredModelMBean and returns
the result of the method execution.
If the given method to be invoked, together with the provided signature, matches one of RequiredModelMbean accessible methods, this one will be call. Otherwise the call to the given method will be tried on the managed resource. The last value returned by an operation may be cached in the operation's descriptor which is in the ModelMBeanOperationInfo's descriptor. The valid value will be in the 'value' field if there is one. If the 'currencyTimeLimit' field in the descriptor is:
Note: because of inconsistencies in previous versions of
this specification, it is recommended not to use negative or zero
values for
| ||||||||||||||
| public void | load() throws MBeanException, RuntimeOperationsException, InstanceNotFoundException Details
Instantiates this MBean instance with the data found for the MBean in the persistent store. The data loaded could include attribute and operation values. This method should be called during construction or initialization of this instance, and before the MBean is registered with the MBeanServer. If the implementation of this class does not support
persistence, an
| ||||||||||||||
| public void | postDeregister() Allows the MBean to perform any operations needed after having been unregistered in the MBean server.
In order to ensure proper run-time semantics of RequireModelMBean,
Any subclass of RequiredModelMBean overloading or overriding this
method should call | ||||||||||||||
| public void | postRegister(Boolean registrationDone) Details
Allows the MBean to perform any operations needed after having been
registered in the MBean server or after the registration has failed.
In order to ensure proper run-time semantics of RequireModelMBean,
Any subclass of RequiredModelMBean overloading or overriding this
method should call
| ||||||||||||||
| public void | preDeregister() throws Exception Details
Allows the MBean to perform any operations it needs before
being unregistered by the MBean server.
In order to ensure proper run-time semantics of RequireModelMBean,
Any subclass of RequiredModelMBean overloading or overriding this
method should call
| ||||||||||||||
| public ObjectName | preRegister(MBeanServer server, ObjectName name) throws Exception Details
Allows the MBean to perform any operations it needs before
being registered in the MBean server. If the name of the MBean
is not specified, the MBean can provide a name for its
registration. If any exception is raised, the MBean will not be
registered in the MBean server.
In order to ensure proper run-time semantics of RequireModelMBean,
Any subclass of RequiredModelMBean overloading or overriding this
method should call
| ||||||||||||||
| public void | removeAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName) throws MBeanException, RuntimeOperationsException, ListenerNotFoundException | ||||||||||||||
| public void | removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException Details
Removes a listener for Notifications from the RequiredModelMBean.
| ||||||||||||||
| public void | removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException | ||||||||||||||
| public void | sendAttributeChangeNotification(AttributeChangeNotification ntfyObj) throws MBeanException, RuntimeOperationsException | ||||||||||||||
| public void | sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal) throws MBeanException, RuntimeOperationsException | ||||||||||||||
| public void | sendNotification(Notification ntfyObj) throws MBeanException, RuntimeOperationsException | ||||||||||||||
| public void | sendNotification(String ntfyText) throws MBeanException, RuntimeOperationsException | ||||||||||||||
| public void | store() throws MBeanException, RuntimeOperationsException, InstanceNotFoundException Details
Captures the current state of this MBean instance and writes it out to the persistent store. The state stored could include attribute and operation values. If the implementation of this class does not support
persistence, an Persistence policy from the MBean and attribute descriptor is used to guide execution of this method. The MBean should be stored if 'persistPolicy' field is: != "never" = "always" = "onTimer" and now > 'lastPersistTime' + 'persistPeriod' = "NoMoreOftenThan" and now > 'lastPersistTime' + 'persistPeriod' = "onUnregister" Do not store the MBean if 'persistPolicy' field is:
= "never"
= "onUpdate"
= "onTimer" && now < 'lastPersistTime' + 'persistPeriod'
| ||||||||||||||
| Properties | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public void | setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException Details
Sets the value of a specific attribute of a named ModelMBean.
If the 'setMethod' field of the attribute's descriptor
contains the name of a valid operation descriptor, then the
method described by the operation descriptor is executed.
In this implementation, the operation descriptor must be specified
correctly and assigned to the modelMBeanInfo so that the 'setMethod'
works correctly.
The response from the method is set as the value of the attribute
in the descriptor.
If currencyTimeLimit is > 0, then the new value for the attribute is cached in the attribute descriptor's 'value' field and the 'lastUpdatedTimeStamp' field is set to the current time stamp. If the persist field of the attribute's descriptor is not null
then Persistence policy from the attribute descriptor is used to
guide storing the attribute in a persistent store.
The ModelMBeanInfo of the Model MBean is stored in a file.
| ||||||||||||||
| public Object | getAttribute(String attrName) throws AttributeNotFoundException, MBeanException, ReflectionException Details
Returns the value of a specific attribute defined for this
ModelMBean.
The last value returned by an attribute may be cached in the
attribute's descriptor.
The valid value will be in the 'value' field if there is one.
If the 'currencyTimeLimit' field in the descriptor is:
Note: because of inconsistencies in previous versions of
this specification, it is recommended not to use negative or zero
values for If the 'getMethod' field contains the name of a valid operation descriptor, then the method described by the operation descriptor is executed. The response from the method is returned as the value of the attribute. If the operation fails or the returned value is not compatible with the declared type of the attribute, an exception will be thrown. If no 'getMethod' field is defined then the default value of the attribute is returned. If the returned value is not compatible with the declared type of the attribute, an exception will be thrown. The declared type of the attribute is the String returned by
In this implementation, in every case where the getMethod needs to be called, because the method is invoked through the standard "invoke" method and thus needs operationInfo, an operation must be specified for that getMethod so that the invocation works correctly.
| ||||||||||||||
| public AttributeList | setAttributes(AttributeList attributes) Details
Sets the values of an array of attributes of this ModelMBean.
Executes the setAttribute() method for each attribute in the list.
| ||||||||||||||
| public AttributeList | getAttributes(String[] attrNames) Details
Returns the values of several attributes in the ModelMBean.
Executes a getAttribute for each attribute name in the
attrNames array passed in.
| ||||||||||||||
| protected ClassLoaderRepository | getClassLoaderRepository() Details
Return the Class Loader Repository used to perform class loading.
Subclasses may wish to redefine this method in order to return
the appropriate javax.management.loading.ClassLoaderRepository
that should be used in this object.
| ||||||||||||||
| public void | setManagedResource(Object mr, String mr_type) throws MBeanException, RuntimeOperationsException, InstanceNotFoundException, InvalidTargetObjectTypeException Details
Sets the instance handle of the object against which to
execute all methods in this ModelMBean management interface
(MBeanInfo and Descriptors).
| ||||||||||||||
| public MBeanInfo | getMBeanInfo() Details
Returns the attributes, operations, constructors and notifications
that this RequiredModelMBean exposes for management.
| ||||||||||||||
| public void | setModelMBeanInfo(ModelMBeanInfo mbi) throws MBeanException, RuntimeOperationsException Details
Initializes a ModelMBean object using ModelMBeanInfo passed in.
This method makes it possible to set a customized ModelMBeanInfo on
the ModelMBean as long as it is not registered with the MBeanServer.
Once the ModelMBean's ModelMBeanInfo (with Descriptors) are customized and set on the ModelMBean, the ModelMBean be registered with the MBeanServer.
If the ModelMBean is currently registered, this method throws
a
If the given inModelMBeanInfo does not contain any
| ||||||||||||||
| public MBeanNotificationInfo[] | getNotificationInfo() Details
Returns the array of Notifications always generated by the
RequiredModelMBean.
RequiredModelMBean may always send also two additional notifications:
| ||||||||||||||
| About DocWeb · Bundles · Export · Export All | Top 10 · Statistics · Login |
| About Sun · Contact · Privacy · Terms of Use · Trademarks | Java SE 6 · Copyright © 1994-2013 Sun Microsystems, Inc.All rights reserved. Use is subject to license terms |
![]() |
![]() |
|