javax.management.modelmbean
Class RequiredModelMBean

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--javax.management.modelmbean.RequiredModelMBean
All Implemented Interfaces:
DynamicMBean, MBeanRegistration, ModelMBean, ModelMBeanNotificationBroadcaster, NotificationBroadcaster, PersistentMBean

public class RequiredModelMBean
extends NotificationBroadcasterSupport
implements ModelMBean, MBeanRegistration

Version:
$Revision: 1.7 $
Author:
Simone Bordet

Constructor Summary
RequiredModelMBean()
           
RequiredModelMBean(ModelMBeanInfo info)
           
 
Method Summary
 void addAttributeChangeNotificationListener(NotificationListener listener, java.lang.String attributeName, java.lang.Object handback)
           
 java.lang.Object getAttribute(java.lang.String attribute)
          Returns the value of the given attribute.
 AttributeList getAttributes(java.lang.String[] attributes)
          Returns an AttributeList given an array of attributes.
 MBeanInfo getMBeanInfo()
          Provides the exposed attributes/actions of this DynamicMBean
 java.lang.Object invoke(java.lang.String method, java.lang.Object[] arguments, java.lang.String[] params)
          Invoke the given method.
 void load()
          Instantiates for the data found in the persistance store.
 void postDeregister()
          Called upon after the MBean has been de-registered.
 void postRegister(java.lang.Boolean registrationDone)
          Called upon after a registration ( successful or not ).
 void preDeregister()
          Called upon before an MBean will be de-registered by the MBeanServer.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Allows the MBean to perform any operations before being registered to the MBeanServer.
 void removeAttributeChangeNotificationListener(NotificationListener listener, java.lang.String attributeName)
           
 void sendAttributeChangeNotification(Attribute oldAttribute, Attribute newAttribute)
           
 void sendAttributeChangeNotification(AttributeChangeNotification notification)
           
 void sendNotification(java.lang.String message)
           
 void setAttribute(Attribute attribute)
          Set the value of the specific attribute
 AttributeList setAttributes(AttributeList attributes)
          Set the attribute using the given attribute as an AttributeList
 void setManagedResource(java.lang.Object resource, java.lang.String resourceType)
           
 void setModelMBeanInfo(ModelMBeanInfo modelMBeanInfo)
           
 void store()
          Captures the current state of the MBean.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.management.modelmbean.ModelMBeanNotificationBroadcaster
sendNotification
 
Methods inherited from interface javax.management.NotificationBroadcaster
addNotificationListener, getNotificationInfo, removeNotificationListener
 

Constructor Detail

RequiredModelMBean

public RequiredModelMBean()
                   throws MBeanException,
                          RuntimeOperationsException

RequiredModelMBean

public RequiredModelMBean(ModelMBeanInfo info)
                   throws MBeanException,
                          RuntimeOperationsException
Method Detail

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
Description copied from interface: MBeanRegistration
Allows the MBean to perform any operations before being registered to the MBeanServer.

Any exception will cause the MBean not being registered.

Specified by:
preRegister in interface MBeanRegistration
Following copied from interface: javax.management.MBeanRegistration
Parameters:
server - The MBeanServer on which the MBean will be registered.
name - The ObjectName of the MBean.
Returns:
ObjectName The name of the registered MBean
Throws:
java.lang.Exception - Exception of the operation. Note that this is caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Description copied from interface: MBeanRegistration
Called upon after a registration ( successful or not ).
Specified by:
postRegister in interface MBeanRegistration
Following copied from interface: javax.management.MBeanRegistration
Parameters:
registrationDone - Evaluates to true of the registrations is successful, false otherwise.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Description copied from interface: MBeanRegistration
Called upon before an MBean will be de-registered by the MBeanServer.
Specified by:
preDeregister in interface MBeanRegistration
Following copied from interface: javax.management.MBeanRegistration
Throws:
java.lang.Exception - Would be caught by the MBeanServer and rethrown as an MBeanRegistrationException.

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration
Called upon after the MBean has been de-registered.
Specified by:
postDeregister in interface MBeanRegistration

setModelMBeanInfo

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

setManagedResource

public void setManagedResource(java.lang.Object resource,
                               java.lang.String resourceType)
                        throws MBeanException,
                               RuntimeOperationsException,
                               InstanceNotFoundException,
                               InvalidTargetObjectTypeException
Specified by:
setManagedResource in interface ModelMBean

getMBeanInfo

public MBeanInfo getMBeanInfo()
Description copied from interface: DynamicMBean
Provides the exposed attributes/actions of this DynamicMBean
Specified by:
getMBeanInfo in interface DynamicMBean
Following copied from interface: javax.management.DynamicMBean
Returns:
MBeanInfo an instance of MBeanInfo

addAttributeChangeNotificationListener

public void addAttributeChangeNotificationListener(NotificationListener listener,
                                                   java.lang.String attributeName,
                                                   java.lang.Object handback)
                                            throws MBeanException,
                                                   RuntimeOperationsException,
                                                   java.lang.IllegalArgumentException
Specified by:
addAttributeChangeNotificationListener in interface ModelMBeanNotificationBroadcaster

removeAttributeChangeNotificationListener

public void removeAttributeChangeNotificationListener(NotificationListener listener,
                                                      java.lang.String attributeName)
                                               throws MBeanException,
                                                      RuntimeOperationsException,
                                                      ListenerNotFoundException
Specified by:
removeAttributeChangeNotificationListener in interface ModelMBeanNotificationBroadcaster

sendAttributeChangeNotification

public void sendAttributeChangeNotification(Attribute oldAttribute,
                                            Attribute newAttribute)
                                     throws MBeanException,
                                            RuntimeOperationsException
Specified by:
sendAttributeChangeNotification in interface ModelMBeanNotificationBroadcaster

sendAttributeChangeNotification

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

sendNotification

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

getAttributes

public AttributeList getAttributes(java.lang.String[] attributes)
Description copied from interface: DynamicMBean
Returns an AttributeList given an array of attributes.
Specified by:
getAttributes in interface DynamicMBean
Following copied from interface: javax.management.DynamicMBean
Parameters:
attributes - The array of attributes being retrieved
Returns:
AttributeList The list of Attribute

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
                              throws AttributeNotFoundException,
                                     MBeanException,
                                     ReflectionException
Description copied from interface: DynamicMBean
Returns the value of the given attribute.
Specified by:
getAttribute in interface DynamicMBean
Following copied from interface: javax.management.DynamicMBean
Parameters:
attribute - The attribute name for the value being retrieved.
Returns:
Object The value of the attribute.
Throws:
AttributeNotFoundException - If the given attribute isn't found.
MBeanException - Wraps a java.lang.Exception
ReflectionException - Wraps a java.lang.Exception while trying to invoke the getter.

setAttributes

public AttributeList setAttributes(AttributeList attributes)
Description copied from interface: DynamicMBean
Set the attribute using the given attribute as an AttributeList
Specified by:
setAttributes in interface DynamicMBean
Following copied from interface: javax.management.DynamicMBean
Parameters:
attributes - The attribute being set.
Returns:
AttributeList the list of Attribute successfully set.

setAttribute

public void setAttribute(Attribute attribute)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Description copied from interface: DynamicMBean
Set the value of the specific attribute
Specified by:
setAttribute in interface DynamicMBean
Following copied from interface: javax.management.DynamicMBean
Parameters:
attribute - The Attribute being set.
Throws:
AttributeNotFoundException -  
InvalidAttributeValueException -  
MBeanException - Wraps a java.lang.Exception which is thrown by the setter.

invoke

public java.lang.Object invoke(java.lang.String method,
                               java.lang.Object[] arguments,
                               java.lang.String[] params)
                        throws MBeanException,
                               ReflectionException
Description copied from interface: DynamicMBean
Invoke the given method.
Specified by:
invoke in interface DynamicMBean
Following copied from interface: javax.management.DynamicMBean
Parameters:
method - The name of the method to be invoked.
arguments - The array of arguments to be set.
params - Contains the signature of the method to be invoked.
Returns:
Object The object returned by the invocaton.
Throws:
MBeanException - Wraps a java.lang.Exception
ReflectionException -  

load

public void load()
          throws MBeanException,
                 RuntimeOperationsException,
                 InstanceNotFoundException
Description copied from interface: PersistentMBean
Instantiates for the data found in the persistance store.
Specified by:
load in interface PersistentMBean
Following copied from interface: javax.management.PersistentMBean
Throws:
MBeanException - Wraps another exception or thrown when persistance is not supported.
RuntimeOperationsException - Wraps exception from persistance operation
InstanceNotFoundException - Cant find the MBean from the persistance store.

store

public void store()
           throws MBeanException,
                  RuntimeOperationsException,
                  InstanceNotFoundException
Description copied from interface: PersistentMBean
Captures the current state of the MBean.
Specified by:
store in interface PersistentMBean
Following copied from interface: javax.management.PersistentMBean
Throws:
MBeanException -  
RuntimeOperationsException -  
InstanceNotFoundException -  


Copyright © 2001-2002 MX4J Team. All Rights Reserved.