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

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


org.jboss.mx.modelmbean
Class ModelMBeanInvoker

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

public abstract class ModelMBeanInvoker
extends AbstractMBeanInvoker
implements ModelMBean, ModelMBeanConstants

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

Version:
$Revision: 1.34.2.3 $
Author:
Juha Lindfors., Dimitris Andreadis., Matt Munz
See Also:
ModelMBean, MBeanInvoker

Nested Class Summary
 
Nested classes inherited from class org.jboss.mx.server.AbstractMBeanInvoker
AbstractMBeanInvoker.OperationKey
 
Field Summary
protected  long attrNotifierSequence
          Notification sequence number for attribute change notifications.
protected  JBossNotificationBroadcasterSupport notifier
          Notification broadcaster for this Model MBean.
protected  long notifierSequence
          Notification sequence number for generic Model MBean notifications.
protected  PersistenceManager persistence
          Persistence manager.
protected  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
attributeContextMap, constructorContextMap, dynamicResource, getMBeanInfoCtx, info, operationContextMap, postDeregisterCtx, postRegisterCtx, preDeregisterCtx, preRegisterCtx, resourceEntry
 
Fields inherited from interface org.jboss.mx.modelmbean.ModelMBeanConstants
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 info)
          Creates a Model MBean instance and initializes it with the given Model MBean metadata.
 
Method Summary
 void addAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback)
           
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
          Add a listener to an MBean.
protected  void configureInterceptorStack(ModelMBeanInfo info, MBeanServer server, ObjectName name)
          Build the getMBeanInfo, operation, and attribute interceptor stacks and associated these with the corresponding InvocationContexts.
protected  List getInterceptors(Descriptor d)
           
 MBeanNotificationInfo[] getNotificationInfo()
          Returns the notification metadata associated with the MBean.
protected  void init(MBeanServer server, ObjectName name)
           
protected  void initAttributeContexts(MBeanAttributeInfo[] attributes)
           
protected  void initOperationContexts(MBeanOperationInfo[] operations)
           
protected  void initPersistence(MBeanServer server, ObjectName name)
          initializes the persistence manager based on the info for this bean.
 ObjectName invokePreRegister(MBeanServer server, ObjectName 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(Object resource, String resourceType)
           
 void load()
          Retrieves the MBean's state from a persistence store.
protected  void override(Invocation invocation)
          Placeholder to allow subclasses to override the invocation
 void removeAttributeChangeNotificationListener(NotificationListener listener, String attributeName)
           
 void removeNotificationListener(NotificationListener listener)
          Removes a listener from an MBean.
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
          Removes a listener from the Emitter.
 void sendAttributeChangeNotification(Attribute oldValue, Attribute newValue)
          Sends an attribute change notification.
 void sendAttributeChangeNotification(AttributeChangeNotification notification)
          Sends an attribute change notification.
 void sendNotification(Notification ntfyObj)
          Sends a notification.
 void sendNotification(String ntfyText)
          Sends a notification with a given string message.
 void setManagedResource(Object ref, String resourceType)
          Sets the managed resource for this Model MBean instance.
 void setModelMBeanInfo(ModelMBeanInfo 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
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
getAttribute, getAttributes, getMBeanInfo, invoke, setAttribute, setAttributes
 

Field Detail

resourceType

protected 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 persistence
Persistence manager.


notifier

protected JBossNotificationBroadcasterSupport 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 info)
                  throws MBeanException
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 info)
                       throws MBeanException,
                              RuntimeOperationsException
Sets the MBean metadata for this Model MBean instance.

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

setManagedResource

public void setManagedResource(Object ref,
                               String resourceType)
                        throws MBeanException,
                               InstanceNotFoundException,
                               InvalidTargetObjectTypeException
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
Parameters:
ref - reference to the managed resource
resourceType - resource type identification string
Throws:
MBeanException
InstanceNotFoundException
InvalidTargetObjectTypeException

addNotificationListener

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

Specified by:
addNotificationListener in interface NotificationBroadcaster
Overrides:
addNotificationListener in class AbstractMBeanInvoker

removeNotificationListener

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

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

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

sendNotification

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

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

sendNotification

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

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

sendAttributeChangeNotification

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

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

sendAttributeChangeNotification

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

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

getNotificationInfo

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

Specified by:
getNotificationInfo in interface NotificationBroadcaster
Overrides:
getNotificationInfo in class AbstractMBeanInvoker

addAttributeChangeNotificationListener

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

removeAttributeChangeNotificationListener

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

load

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

store

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

invokePreRegister

public ObjectName invokePreRegister(MBeanServer server,
                                    ObjectName name)
                             throws 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
Throws:
Exception

init

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

initPersistence

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

Throws:
MBeanException
InstanceNotFoundException

initOperationContexts

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

initAttributeContexts

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

configureInterceptorStack

protected void configureInterceptorStack(ModelMBeanInfo info,
                                         MBeanServer server,
                                         ObjectName name)
                                  throws 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:
Exception

getInterceptors

protected List getInterceptors(Descriptor d)
                        throws Exception
Parameters:
d -
Returns:
Throws:
Exception

setValuesFromMBeanInfo

protected void setValuesFromMBeanInfo()
                               throws JMException
Throws:
JMException

isSupportedResourceType

protected boolean isSupportedResourceType(Object resource,
                                          String resourceType)

override

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

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


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