站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

RequiredModelMBean (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


javax.management.modelmbean
Class RequiredModelMBean

java.lang.Object
  extended byjavax.management.modelmbean.RequiredModelMBean
All Implemented Interfaces:
DynamicMBean, MBeanRegistration, ModelMBean, ModelMBeanNotificationBroadcaster, NotificationBroadcaster, NotificationEmitter, PersistentMBean

public class RequiredModelMBean
extends Object
implements ModelMBean, MBeanRegistration, NotificationEmitter

Mandatory Model MBean implementation. The Model MBean implementation can be configured by setting a jbossmx.required.modelmbean.class system property.

Version:
$Revision: 1.12 $
Author:
Juha Lindfors., Thomas Diesler.
See Also:
ModelMBean

Constructor Summary
RequiredModelMBean()
           
RequiredModelMBean(ModelMBeanInfo info)
          Constructs a RequiredModelMBean object using ModelMBeanInfo passed in.
 
Method Summary
 void addAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName, Object inhandback)
           
 void addNotificationListener(NotificationListener inlistener, NotificationFilter infilter, Object inhandback)
          Add a listener to an MBean.
 Object getAttribute(String attrName)
          Returns the value of the attribute with the name matching the passed string.
 AttributeList getAttributes(String[] attrNames)
          Returns the values of the attributes with names matching the passed string array.
protected  ClassLoaderRepository getClassLoaderRepository()
           
 MBeanInfo getMBeanInfo()
          Returns the management interface that describes this dynamic resource.
 MBeanNotificationInfo[] getNotificationInfo()
          Returns the array of Notifications generated by the RequiredModelMBean.
 Object invoke(String opName, Object[] opArgs, String[] sig)
          Invokes a resource operation.
 void load()
          Retrieves the MBean's state from a persistence store.
 void postDeregister()
          This method is called by the MBeanServer after deregistration takes place.
 void postRegister(Boolean registrationDone)
          This method is called by the MBeanServer after registration takes place or when registration fails.
 void preDeregister()
          This method is called by the MBeanServer before deregistration takes place.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          This method is called by the MBeanServer before registration takes place.
 void removeAttributeChangeNotificationListener(NotificationListener inlistener, String inAttributeName)
           
 void removeNotificationListener(NotificationListener inlistener)
          Removes a listener from an MBean.
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
          Removes a listener from the Emitter.
 void sendAttributeChangeNotification(Attribute inOldVal, Attribute inNewVal)
           
 void sendAttributeChangeNotification(AttributeChangeNotification ntfyObj)
           
 void sendNotification(Notification ntfyObj)
           
 void sendNotification(String ntfyText)
           
 void setAttribute(Attribute attribute)
          Sets the value of an attribute.
 AttributeList setAttributes(AttributeList attributes)
          Sets the values of the attributes passed as an AttributeList of name and new value pairs.
 void setManagedResource(Object mr, String mr_type)
           
 void setModelMBeanInfo(ModelMBeanInfo info)
           
 void store()
          Stores the MBean's state to a persistence store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequiredModelMBean

public RequiredModelMBean()
                   throws MBeanException,
                          RuntimeOperationsException

RequiredModelMBean

public RequiredModelMBean(ModelMBeanInfo info)
                   throws MBeanException,
                          RuntimeOperationsException
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(javax.management.modelmbean.ModelMBeanInfo) method. After the RequiredModelMBean's MBeanInfo and Descriptors are customized, the RequiredModelMBean can be registered with the MBeanServer.

Method Detail

setModelMBeanInfo

public void setModelMBeanInfo(ModelMBeanInfo info)
                       throws MBeanException,
                              RuntimeOperationsException
Specified by:
setModelMBeanInfo in interface ModelMBean
Throws:
MBeanException
RuntimeOperationsException

setManagedResource

public void setManagedResource(Object mr,
                               String mr_type)
                        throws MBeanException,
                               RuntimeOperationsException,
                               InstanceNotFoundException,
                               InvalidTargetObjectTypeException
Specified by:
setManagedResource in interface ModelMBean
Throws:
MBeanException
RuntimeOperationsException
InstanceNotFoundException
InvalidTargetObjectTypeException

load

public void load()
          throws MBeanException,
                 RuntimeOperationsException,
                 InstanceNotFoundException
Description copied from interface: PersistentMBean
Retrieves the MBean's state from a persistence store.

Specified by:
load in interface PersistentMBean
Throws:
MBeanException - wraps application exceptions from persistence store
InstanceNotFoundException - if the MBean's state could not be found
RuntimeOperationsException

store

public void store()
           throws MBeanException,
                  RuntimeOperationsException,
                  InstanceNotFoundException
Description copied from interface: PersistentMBean
Stores the MBean's state to a persistence store.

Specified by:
store in interface PersistentMBean
Throws:
InstanceNotFoundException - if the MBean's state could not be stored
MBeanException - wraps application exceptions from persistence store
RuntimeOperationsException

getMBeanInfo

public MBeanInfo getMBeanInfo()
Description copied from interface: DynamicMBean
Returns the management interface that describes this dynamic resource. It is the responsibility of the implementation to make sure the description is accurate.

Specified by:
getMBeanInfo in interface DynamicMBean
Returns:
the management interface.

invoke

public Object invoke(String opName,
                     Object[] opArgs,
                     String[] sig)
              throws MBeanException,
                     ReflectionException
Description copied from interface: DynamicMBean
Invokes a resource operation.

Specified by:
invoke in interface DynamicMBean
Parameters:
opName - the name of the operation to perform.
opArgs - the parameters to pass to the operation.
sig - the signartures of the parameters.
Returns:
the result of the operation.
Throws:
ReflectionException - wraps any error invoking the resource.
MBeanException - wraps any error thrown by the resource when performing the operation.

getAttribute

public Object getAttribute(String attrName)
                    throws AttributeNotFoundException,
                           MBeanException,
                           ReflectionException
Description copied from interface: DynamicMBean
Returns the value of the attribute with the name matching the passed string.

Specified by:
getAttribute in interface DynamicMBean
Parameters:
attrName - the name of the attribute.
Returns:
the value of the attribute.
Throws:
ReflectionException - wraps any error invoking the resource.
MBeanException - wraps any error thrown by the resource when getting the attribute.
AttributeNotFoundException - when there is no such attribute.

getAttributes

public AttributeList getAttributes(String[] attrNames)
Description copied from interface: DynamicMBean
Returns the values of the attributes with names matching the passed string array.

Specified by:
getAttributes in interface DynamicMBean
Parameters:
attrNames - the names of the attribute.
Returns:
an AttributeList of name and value pairs.

setAttribute

public void setAttribute(Attribute attribute)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Description copied from interface: DynamicMBean
Sets the value of an attribute. The attribute and new value are passed in the name value pair Attribute.

Specified by:
setAttribute in interface DynamicMBean
Parameters:
attribute - the name and new value of the attribute.
Throws:
MBeanException - wraps any error thrown by the resource when setting the new value.
ReflectionException - wraps any error invoking the resource.
InvalidAttributeValueException - when the new value cannot be converted to the type of the attribute.
AttributeNotFoundException - when there is no such attribute.
See Also:
Attribute

setAttributes

public AttributeList setAttributes(AttributeList attributes)
Description copied from interface: DynamicMBean
Sets the values of the attributes passed as an AttributeList of name and new value pairs.

Specified by:
setAttributes in interface DynamicMBean
Parameters:
attributes - the name an new value pairs.
Returns:
an AttributeList of name and value pairs that were actually set.

addNotificationListener

public void addNotificationListener(NotificationListener inlistener,
                                    NotificationFilter infilter,
                                    Object inhandback)
                             throws IllegalArgumentException
Description copied from interface: NotificationBroadcaster
Add a listener to an MBean.

Specified by:
addNotificationListener in interface NotificationBroadcaster
Parameters:
inlistener - implementation of the listener object
infilter - implementation of the filter object or null if no filtering is required
inhandback - A handback object associated with each notification sent by this notification broadcaster.
Throws:
IllegalArgumentException - if listener is null

removeNotificationListener

public void removeNotificationListener(NotificationListener inlistener)
                                throws ListenerNotFoundException
Description copied from interface: NotificationBroadcaster
Removes a listener from an MBean.

Specified by:
removeNotificationListener in interface NotificationBroadcaster
Parameters:
inlistener - the listener object to remove
Throws:
ListenerNotFoundException - if the listener was not found

removeNotificationListener

public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws ListenerNotFoundException
Description copied from interface: NotificationEmitter
Removes a listener from the Emitter.

Only the listener, filter, handback triplet is removed

Specified by:
removeNotificationListener in interface NotificationEmitter
Parameters:
listener - the listener object to remove
filter - the filter registered with the listener
handback - the handback object associated with the registered listener
Throws:
ListenerNotFoundException - if the listener was not found

sendNotification

public void sendNotification(Notification ntfyObj)
                      throws MBeanException,
                             RuntimeOperationsException
Specified by:
sendNotification in interface ModelMBeanNotificationBroadcaster
Throws:
MBeanException
RuntimeOperationsException

sendNotification

public void sendNotification(String ntfyText)
                      throws MBeanException,
                             RuntimeOperationsException
Specified by:
sendNotification in interface ModelMBeanNotificationBroadcaster
Throws:
MBeanException
RuntimeOperationsException

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Returns the array of Notifications generated by the RequiredModelMBean. RequiredModelMBean may always send also two additional notifications: One with descriptor "name=GENERIC,descriptorType=notification,log=T,severity=5,displayName=jmx.modelmbean.generic" Second is a standard attribute change notification with descriptor "name=ATTRIBUTE_CHANGE,descriptorType=notification,log=T,severity=5,displayName=jmx.attribute.change" Thus these two notifications are always added to those specified by the application.

Specified by:
getNotificationInfo in interface NotificationBroadcaster
Returns:
See Also:
MBeanNotificationInfo

addAttributeChangeNotificationListener

public void addAttributeChangeNotificationListener(NotificationListener inlistener,
                                                   String inAttributeName,
                                                   Object inhandback)
                                            throws MBeanException,
                                                   RuntimeOperationsException,
                                                   IllegalArgumentException
Specified by:
addAttributeChangeNotificationListener in interface ModelMBeanNotificationBroadcaster
Throws:
MBeanException
RuntimeOperationsException
IllegalArgumentException

removeAttributeChangeNotificationListener

public void removeAttributeChangeNotificationListener(NotificationListener inlistener,
                                                      String inAttributeName)
                                               throws MBeanException,
                                                      RuntimeOperationsException,
                                                      ListenerNotFoundException
Specified by:
removeAttributeChangeNotificationListener in interface ModelMBeanNotificationBroadcaster
Throws:
MBeanException
RuntimeOperationsException
ListenerNotFoundException

sendAttributeChangeNotification

public void sendAttributeChangeNotification(AttributeChangeNotification ntfyObj)
                                     throws MBeanException,
                                            RuntimeOperationsException
Specified by:
sendAttributeChangeNotification in interface ModelMBeanNotificationBroadcaster
Throws:
MBeanException
RuntimeOperationsException

sendAttributeChangeNotification

public void sendAttributeChangeNotification(Attribute inOldVal,
                                            Attribute inNewVal)
                                     throws MBeanException,
                                            RuntimeOperationsException
Specified by:
sendAttributeChangeNotification in interface ModelMBeanNotificationBroadcaster
Throws:
MBeanException
RuntimeOperationsException

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Description copied from interface: MBeanRegistration
This method is called by the MBeanServer before registration takes place. The MBean is passed a reference of the MBeanServer it is about to be registered with. The MBean must return the ObjectName it will be registered with. The MBeanServer can pass a suggested object depending upon how the MBean is registered.

The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preRegister in interface MBeanRegistration
Returns:
the actual ObjectName to register this MBean with.
Throws:
Exception - for any error, the MBean is not registered.

postRegister

public void postRegister(Boolean registrationDone)
Description copied from interface: MBeanRegistration
This method is called by the MBeanServer after registration takes place or when registration fails.

Specified by:
postRegister in interface MBeanRegistration
Parameters:
registrationDone - the MBeanServer passes true when the MBean was registered, false otherwise.

preDeregister

public void preDeregister()
                   throws Exception
Description copied from interface: MBeanRegistration
This method is called by the MBeanServer before deregistration takes place.

The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration
This method is called by the MBeanServer after deregistration takes place.

Specified by:
postDeregister in interface MBeanRegistration

getClassLoaderRepository

protected ClassLoaderRepository getClassLoaderRepository()


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.