javax.management.modelmbean
Class RequiredModelMBean

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

public class RequiredModelMBean
extends java.lang.Object
implements ModelMBean (src) , MBeanRegistration (src) , NotificationEmitter (src)

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

See Also:
ModelMBean (src)

Constructor Summary
RequiredModelMBean()
           
RequiredModelMBean(ModelMBeanInfo (src)  info)
          Constructs a RequiredModelMBean object using ModelMBeanInfo passed in.
 
Method Summary
 void addAttributeChangeNotificationListener(NotificationListener (src)  inlistener, java.lang.String inAttributeName, java.lang.Object inhandback)
           
 void addNotificationListener(NotificationListener (src)  inlistener, NotificationFilter (src)  infilter, java.lang.Object inhandback)
          Add a listener to an MBean.
 java.lang.Object getAttribute(java.lang.String attrName)
          Returns the value of the attribute with the name matching the passed string.
 AttributeList (src) getAttributes(java.lang.String[] attrNames)
          Returns the values of the attributes with names matching the passed string array.
protected  ClassLoaderRepository (src) getClassLoaderRepository()
           
 MBeanInfo (src) getMBeanInfo()
          Returns the management interface that describes this dynamic resource.
 MBeanNotificationInfo (src) [] getNotificationInfo()
          Returns the array of Notifications generated by the RequiredModelMBean.
 java.lang.Object invoke(java.lang.String opName, java.lang.Object[] opArgs, java.lang.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(java.lang.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 (src) preRegister(MBeanServer (src)  server, ObjectName (src)  name)
          This method is called by the MBeanServer before registration takes place.
 void removeAttributeChangeNotificationListener(NotificationListener (src)  inlistener, java.lang.String inAttributeName)
           
 void removeNotificationListener(NotificationListener (src)  inlistener)
          Removes a listener from an MBean.
 void removeNotificationListener(NotificationListener (src)  listener, NotificationFilter (src)  filter, java.lang.Object handback)
          Removes a listener from the Emitter.
 void sendAttributeChangeNotification(Attribute (src)  inOldVal, Attribute (src)  inNewVal)
           
 void sendAttributeChangeNotification(AttributeChangeNotification (src)  ntfyObj)
           
 void sendNotification(Notification (src)  ntfyObj)
           
 void sendNotification(java.lang.String ntfyText)
           
 void setAttribute(Attribute (src)  attribute)
          Sets the value of an attribute.
 AttributeList (src) setAttributes(AttributeList (src)  attributes)
          Sets the values of the attributes passed as an AttributeList (src) of name and new value pairs.
 void setManagedResource(java.lang.Object mr, java.lang.String mr_type)
           
 void setModelMBeanInfo(ModelMBeanInfo (src)  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 (src) ,
                          RuntimeOperationsException (src) 

RequiredModelMBean

public RequiredModelMBean(ModelMBeanInfo (src)  info)
                   throws MBeanException (src) ,
                          RuntimeOperationsException (src) 
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 (src)  info)
                       throws MBeanException (src) ,
                              RuntimeOperationsException (src) 
Specified by:
setModelMBeanInfo in interface ModelMBean (src)
Throws:
MBeanException (src)
RuntimeOperationsException (src)

setManagedResource

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

load

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

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

store

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

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

getMBeanInfo

public MBeanInfo (src)  getMBeanInfo()
Description copied from interface: DynamicMBean (src)
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 (src)
Returns:
the management interface.

invoke

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

Specified by:
invoke in interface DynamicMBean (src)
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:
MBeanException (src) - wraps any error thrown by the resource when performing the operation.
ReflectionException (src) - wraps any error invoking the resource.

getAttribute

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

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

getAttributes

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

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

setAttribute

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

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

setAttributes

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

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

addNotificationListener

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

Specified by:
addNotificationListener in interface NotificationBroadcaster (src)
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:
java.lang.IllegalArgumentException - if listener is null

removeNotificationListener

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

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

removeNotificationListener

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

Only the listener, filter, handback triplet is removed

Specified by:
removeNotificationListener in interface NotificationEmitter (src)
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 (src) - if the listener was not found

sendNotification

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

sendNotification

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

getNotificationInfo

public MBeanNotificationInfo (src) [] 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 (src)
Returns:
See Also:
MBeanNotificationInfo (src)

addAttributeChangeNotificationListener

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

removeAttributeChangeNotificationListener

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

sendAttributeChangeNotification

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

sendAttributeChangeNotification

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

preRegister

public ObjectName (src)  preRegister(MBeanServer (src)  server,
                              ObjectName (src)  name)
                       throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
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 (src)
Returns:
the actual ObjectName to register this MBean with.
Throws:
java.lang.Exception - for any error, the MBean is not registered.

postRegister

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

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

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
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 (src)
Throws:
java.lang.Exception

postDeregister

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

Specified by:
postDeregister in interface MBeanRegistration (src)

getClassLoaderRepository

protected ClassLoaderRepository (src)  getClassLoaderRepository()