org.jboss.mx.modelmbean
Class ModelMBeanInvoker

java.lang.Object
  extended byorg.jboss.mx.server.AbstractMBeanInvoker (src) 
      extended byorg.jboss.mx.modelmbean.ModelMBeanInvoker
All Implemented Interfaces:
DynamicMBean (src) , MBeanInvoker (src) , MBeanRegistration (src) , ModelMBean (src) , ModelMBeanConstants (src) , ModelMBeanNotificationBroadcaster (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , PersistentMBean (src) , Suspendable (src)
Direct Known Subclasses:
XMBean (src)

public abstract class ModelMBeanInvoker
extends AbstractMBeanInvoker (src)
implements ModelMBean (src) , ModelMBeanConstants (src)

An extension of the MBeanInvoker (src) that implements the base Model MBean functionality, essentially making the Model MBean just another invoker of managed resources.

See Also:
ModelMBean (src) , MBeanInvoker (src)

Nested Class Summary
 
Nested classes inherited from class org.jboss.mx.server.AbstractMBeanInvoker (src)
AbstractMBeanInvoker.OperationKey (src)
 
Field Summary
protected  long attrNotifierSequence
          Notification sequence number for attribute change notifications.
protected  JBossNotificationBroadcasterSupport (src) notifier
          Notification broadcaster for this Model MBean.
protected  long notifierSequence
          Notification sequence number for generic Model MBean notifications.
protected  PersistenceManager (src) persistence
          Persistence manager.
protected  java.lang.String resourceType
          The resource type string of the managed resource, such as ModelMBeanConstants.OBJECT_REF or XMBeanConstants.STANDARD_INTERFACE.
 
Fields inherited from class org.jboss.mx.server.AbstractMBeanInvoker (src)
attributeContextMap, constructorContextMap, dynamicResource, getMBeanInfoCtx, info, operationContextMap, postDeregisterCtx, postRegisterCtx, preDeregisterCtx, preRegisterCtx, resourceEntry
 
Fields inherited from interface org.jboss.mx.modelmbean.ModelMBeanConstants (src)
ACTION, ACTION_INFO, ALL_DESCRIPTORS, ATTRIBUTE_DESCRIPTOR, ATTRIBUTE_VALUE, CACHE_ALWAYS, CACHE_ALWAYS_LIMIT, CACHE_NEVER, CACHE_NEVER_LIMIT, CACHED_VALUE, CLASS, CONSTRUCTOR_DESCRIPTOR, CURRENCY_TIME_LIMIT, DEFAULT, DELEGATING_PM_OPERATION_DEFAULT_VALUE, DELEGATING_PM_OPERATION_DESCRIPTOR, DELEGATING_PM_SERVICE_DEFAULT_VALUE, DELEGATING_PM_SERVICE_DESCRIPTOR, DESCRIPTOR_TYPE, DISPLAY_NAME, EXPORT, GENERIC_MODELMBEAN_NOTIFICATION, GET_METHOD, HIGH_VISIBILITY, INFO, INTERCEPTORS, IS_IS, IS_READABLE, IS_WRITABLE, LAST_RETURNED_TIME_STAMP, LAST_UPDATED_TIME_STAMP, LAST_UPDATED_TIME_STAMP2, LOG, LOG_FILE, LOW_VISIBILITY, MBEAN_DESCRIPTOR, MBEAN_INFO_INJECTION_TYPE, MBEAN_SERVER_INJECTION_TYPE, MESSAGE_ID, MINIMAL_VISIBILITY, NAME, NORMAL_VISIBILITY, NOTIFICATION_DESCRIPTOR, OBJECT_NAME, OBJECT_NAME_INJECTION_TYPE, OBJECT_REF, OPERATION_DESCRIPTOR, PERSIST_INFO, PERSIST_LOCATION, PERSIST_NAME, PERSIST_PERIOD, PERSIST_POLICIES, PERSIST_POLICY, PERSISTENCE_MANAGER, PP_ALWAYS, PP_NEVER, PP_NO_MORE_OFTEN_THAN, PP_ON_TIMER, PP_ON_UPDATE, PRESENTATION_STRING, PROTOCOL_MAP, RESOURCE_CLASS, ROLE, ROLE_CONSTRUCTOR, ROLE_GETTER, ROLE_OPERATION, ROLE_SETTER, SET_METHOD, SEVERITY, SEVERITY_CRITICAL, SEVERITY_MAJOR, SEVERITY_MINOR, SEVERITY_NON_RECOVERABLE, SEVERITY_NORMAL, SEVERITY_UNKNOWN, SEVERITY_WARNING, TARGET_OBJECT, TARGET_TYPE, VISIBILITY
 
Constructor Summary
ModelMBeanInvoker()
          Default constructor.
ModelMBeanInvoker(ModelMBeanInfo (src)  info)
          Creates a Model MBean instance and initializes it with the given Model MBean metadata.
 
Method Summary
 void addAttributeChangeNotificationListener(NotificationListener (src)  listener, java.lang.String attributeName, java.lang.Object handback)
           
 void addNotificationListener(NotificationListener (src)  listener, NotificationFilter (src)  filter, java.lang.Object handback)
          Add a listener to an MBean.
protected  void configureInterceptorStack(ModelMBeanInfo (src)  info, MBeanServer (src)  server, ObjectName (src)  name)
          Build the getMBeanInfo, operation, and attribute interceptor stacks and associated these with the corresponding InvocationContexts.
protected  java.util.List getInterceptors(Descriptor (src)  d)
           
 MBeanNotificationInfo (src) [] getNotificationInfo()
          Returns the notification metadata associated with the MBean.
protected  void init(MBeanServer (src)  server, ObjectName (src)  name)
           
protected  void initAttributeContexts(MBeanAttributeInfo (src) [] attributes)
           
protected  void initOperationContexts(MBeanOperationInfo (src) [] operations)
           
protected  void initPersistence(MBeanServer (src)  server, ObjectName (src)  name)
          initializes the persistence manager based on the info for this bean.
 ObjectName (src) invokePreRegister(MBeanServer (src)  server, ObjectName (src)  name)
          The default implementation of preRegister invokes the configureInterceptorStack(javax.management.modelmbean.ModelMBeanInfo, javax.management.MBeanServer, javax.management.ObjectName) method which sets up the interceptors for this Model MBean instance.
protected  boolean isSupportedResourceType(java.lang.Object resource, java.lang.String resourceType)
           
 void load()
          Retrieves the MBean's state from a persistence store.
protected  void override(Invocation (src)  invocation)
          Placeholder to allow subclasses to override the invocation
 void removeAttributeChangeNotificationListener(NotificationListener (src)  listener, java.lang.String attributeName)
           
 void removeNotificationListener(NotificationListener (src)  listener)
          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)  oldValue, Attribute (src)  newValue)
          Sends an attribute change notification.
 void sendAttributeChangeNotification(AttributeChangeNotification (src)  notification)
          Sends an attribute change notification.
 void sendNotification(Notification (src)  ntfyObj)
          Sends a notification.
 void sendNotification(java.lang.String ntfyText)
          Sends a notification with a given string message.
 void setManagedResource(java.lang.Object ref, java.lang.String resourceType)
          Sets the managed resource for this Model MBean instance.
 void setModelMBeanInfo(ModelMBeanInfo (src)  info)
          Sets the MBean metadata for this Model MBean instance.
protected  void setValuesFromMBeanInfo()
           
 void store()
          Stores the MBean's state to a persistence store.
 
Methods inherited from class org.jboss.mx.server.AbstractMBeanInvoker (src)
addNotificationListenerToResource, getAttribute, getAttributes, getInvocationTimeout, getMBeanEntry, getMBeanInfo, getMetaData, getNotificationInfoFromResource, getObjectName, getResource, getServer, getSignatureString, initDispatchers, inject, invoke, invokePostDeregister, invokePostRegister, invokePreDeregister, isSuspended, postDeregister, postRegister, preDeregister, preRegister, removeNotificationListenerFromResource, removeNotificationListenerFromResource, resume, setAttribute, setAttributes, setInvocationTimeout, setMBeanEntry, setResource, suspend, suspend, suspend, updateAttributeInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.management.DynamicMBean (src)
getAttribute, getAttributes, getMBeanInfo, invoke, setAttribute, setAttributes
 

Field Detail

resourceType

protected java.lang.String resourceType
The resource type string of the managed resource, such as ModelMBeanConstants.OBJECT_REF or XMBeanConstants.STANDARD_INTERFACE. This type string can be used by the invoker to determine the behavior implemented by the invocation chain and how the managed resource is exposed to the client programs.


persistence

protected PersistenceManager (src)  persistence
Persistence manager.


notifier

protected JBossNotificationBroadcasterSupport (src)  notifier
Notification broadcaster for this Model MBean.


notifierSequence

protected long notifierSequence
Notification sequence number for generic Model MBean notifications.


attrNotifierSequence

protected long attrNotifierSequence
Notification sequence number for attribute change notifications.

Constructor Detail

ModelMBeanInvoker

public ModelMBeanInvoker()
Default constructor.


ModelMBeanInvoker

public ModelMBeanInvoker(ModelMBeanInfo (src)  info)
                  throws MBeanException (src) 
Creates a Model MBean instance and initializes it with the given Model MBean metadata.

Parameters:
info - Model MBean metadata
Method Detail

setModelMBeanInfo

public void setModelMBeanInfo(ModelMBeanInfo (src)  info)
                       throws MBeanException (src) ,
                              RuntimeOperationsException (src) 
Sets the MBean metadata for this Model MBean instance.

Specified by:
setModelMBeanInfo in interface ModelMBean (src)
Parameters:
info - Model MBean metadata
Throws:
MBeanException (src)
RuntimeOperationsException (src)

setManagedResource

public void setManagedResource(java.lang.Object ref,
                               java.lang.String resourceType)
                        throws MBeanException (src) ,
                               InstanceNotFoundException (src) ,
                               InvalidTargetObjectTypeException (src) 
Sets the managed resource for this Model MBean instance. The resource type must be known to the Model MBean implementation (see isSupportedResourceType(java.lang.Object, java.lang.String) for more information).

Specified by:
setManagedResource in interface ModelMBean (src)
Parameters:
ref - reference to the managed resource
resourceType - resource type identification string
Throws:
MBeanException (src)
InstanceNotFoundException (src)
InvalidTargetObjectTypeException (src)

addNotificationListener

public void addNotificationListener(NotificationListener (src)  listener,
                                    NotificationFilter (src)  filter,
                                    java.lang.Object handback)
Description copied from interface: NotificationBroadcaster (src)
Add a listener to an MBean.

Specified by:
addNotificationListener in interface NotificationBroadcaster (src)
Overrides:
addNotificationListener in class AbstractMBeanInvoker (src)

removeNotificationListener

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

Specified by:
removeNotificationListener in interface NotificationBroadcaster (src)
Overrides:
removeNotificationListener in class AbstractMBeanInvoker (src)
Throws:
ListenerNotFoundException (src)

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)
Overrides:
removeNotificationListener in class AbstractMBeanInvoker (src)
Throws:
ListenerNotFoundException (src)

sendNotification

public void sendNotification(java.lang.String ntfyText)
                      throws MBeanException (src) ,
                             RuntimeOperationsException (src) 
Sends a notification with a given string message. The notification type will be set as GENERIC_MODELMBEAN_NOTIFICATION.

Specified by:
sendNotification in interface ModelMBeanNotificationBroadcaster (src)
Parameters:
ntfyText - notification message
Throws:
MBeanException (src)
RuntimeOperationsException (src)

sendNotification

public void sendNotification(Notification (src)  ntfyObj)
                      throws MBeanException (src) ,
                             RuntimeOperationsException (src) 
Sends a notification.

Specified by:
sendNotification in interface ModelMBeanNotificationBroadcaster (src)
Parameters:
ntfyObj - notification to send
Throws:
MBeanException (src)
RuntimeOperationsException (src)

sendAttributeChangeNotification

public void sendAttributeChangeNotification(AttributeChangeNotification (src)  notification)
                                     throws MBeanException (src) 
Sends an attribute change notification.

Specified by:
sendAttributeChangeNotification in interface ModelMBeanNotificationBroadcaster (src)
Parameters:
notification - attribute change notification to send
Throws:
MBeanException (src)

sendAttributeChangeNotification

public void sendAttributeChangeNotification(Attribute (src)  oldValue,
                                            Attribute (src)  newValue)
                                     throws MBeanException (src) ,
                                            RuntimeOperationsException (src) 
Sends an attribute change notification.

Specified by:
sendAttributeChangeNotification in interface ModelMBeanNotificationBroadcaster (src)
Parameters:
oldValue - attribute with the old value
newValue - attribute with the new value
Throws:
java.lang.IllegalArgumentException - - An Attribute object passed in parameter is null or the names of the two Attribute objects in parameter are not the same.
MBeanException (src)
RuntimeOperationsException (src)

getNotificationInfo

public MBeanNotificationInfo (src) [] getNotificationInfo()
Description copied from interface: NotificationBroadcaster (src)
Returns the notification metadata associated with the MBean.

Specified by:
getNotificationInfo in interface NotificationBroadcaster (src)
Overrides:
getNotificationInfo in class AbstractMBeanInvoker (src)

addAttributeChangeNotificationListener

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

removeAttributeChangeNotificationListener

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

load

public void load()
          throws MBeanException (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

store

public void store()
           throws MBeanException (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

invokePreRegister

public ObjectName (src)  invokePreRegister(MBeanServer (src)  server,
                                    ObjectName (src)  name)
                             throws java.lang.Exception
The default implementation of preRegister invokes the configureInterceptorStack(javax.management.modelmbean.ModelMBeanInfo, javax.management.MBeanServer, javax.management.ObjectName) method which sets up the interceptors for this Model MBean instance. Subclasses may override the configureInterceptorStack() method to implement their own interceptor stack configurations. See the JavaDoc for configureInterceptorStack() for more information.

After the interceptor configuration, this implementation invokes the load() method on this Model MBean instance. This will attempt to load a pre-existing management attribute state for this Model MBean instance. See the Javadoc for load() for more information.

Overrides:
invokePreRegister in class AbstractMBeanInvoker (src)
Throws:
java.lang.Exception

init

protected void init(MBeanServer (src)  server,
                    ObjectName (src)  name)
             throws java.lang.Exception
Parameters:
server -
name -
Throws:
java.lang.Exception

initPersistence

protected void initPersistence(MBeanServer (src)  server,
                               ObjectName (src)  name)
                        throws MBeanException (src) ,
                               InstanceNotFoundException (src) 
initializes the persistence manager based on the info for this bean. If this is successful, loads the bean from the persistence store.

Throws:
MBeanException (src)
InstanceNotFoundException (src)

initOperationContexts

protected void initOperationContexts(MBeanOperationInfo (src) [] operations)
Overrides:
initOperationContexts in class AbstractMBeanInvoker (src)

initAttributeContexts

protected void initAttributeContexts(MBeanAttributeInfo (src) [] attributes)
Overrides:
initAttributeContexts in class AbstractMBeanInvoker (src)

configureInterceptorStack

protected void configureInterceptorStack(ModelMBeanInfo (src)  info,
                                         MBeanServer (src)  server,
                                         ObjectName (src)  name)
                                  throws java.lang.Exception
Build the getMBeanInfo, operation, and attribute interceptor stacks and associated these with the corresponding InvocationContexts.

Parameters:
info - - the ModelMBean metadata
server - - the MBeanServer the ModelMBean is registering with
name - - the ModelMBean name
Throws:
java.lang.Exception

getInterceptors

protected java.util.List getInterceptors(Descriptor (src)  d)
                                  throws java.lang.Exception
Parameters:
d -
Returns:
Throws:
java.lang.Exception

setValuesFromMBeanInfo

protected void setValuesFromMBeanInfo()
                               throws JMException (src) 
Throws:
JMException (src)

isSupportedResourceType

protected boolean isSupportedResourceType(java.lang.Object resource,
                                          java.lang.String resourceType)

override

protected void override(Invocation (src)  invocation)
                 throws MBeanException (src) 
Description copied from class: AbstractMBeanInvoker (src)
Placeholder to allow subclasses to override the invocation

Overrides:
override in class AbstractMBeanInvoker (src)
Parameters:
invocation - the invocation
Throws:
MBeanException (src) - for any error