org.jboss.mx.modelmbean
Class XMBean

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

public class XMBean
extends ModelMBeanInvoker (src)
implements XMBeanConstants (src) , NotificationListener (src)

XMBean implementation.


Nested Class Summary
 
Nested classes inherited from class org.jboss.mx.server.AbstractMBeanInvoker (src)
AbstractMBeanInvoker.OperationKey (src)
 
Field Summary
 
Fields inherited from class org.jboss.mx.modelmbean.ModelMBeanInvoker (src)
attrNotifierSequence, notifier, notifierSequence, persistence, resourceType
 
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.XMBeanConstants (src)
DESCRIPTOR, GET_METHOD_ATTRIBUTE, METADATA_DESCRIPTOR_PREFIX, RESOURCE_DESCRIPTOR_PREFIX, RESOURCE_REFERENCE, RESOURCE_TYPE, SAX_PARSER, SET_METHOD_ATTRIBUTE, STANDARD_INTERFACE, STANDARD_MBEAN, XMBEAN_DESCRIPTOR_PREFIX, XML_VALIDATION
 
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
XMBean()
          Default constructor for the XMBean Model MBean implementation.
XMBean(Descriptor (src)  descriptor)
           
XMBean(ModelMBeanInfo (src)  info)
          Creates an XMBean Model MBean implementation with a predefined JMX metadata.
XMBean(java.lang.Object resource, org.w3c.dom.Element element, java.lang.String version)
           
XMBean(java.lang.Object resource, java.lang.String resourceType)
          Creates a XMBean instance with a given resource object and resource type.
XMBean(java.lang.Object resource, java.net.URL interfaceURL)
           
 
Method Summary
 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.
 MBeanNotificationInfo (src) [] getNotificationInfo()
          Returns the notification metadata associated with the MBean.
 void handleNotification(Notification (src)  notification, java.lang.Object handback)
          Implements NotificationListener interface by simply forwarding any received Notification to the wrapped resource, if it implements the NotificationListener interface, too.
 boolean isSupportedResourceType(java.lang.Object resource, java.lang.String resourceType)
           
 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.
 
Methods inherited from class org.jboss.mx.modelmbean.ModelMBeanInvoker (src)
addAttributeChangeNotificationListener, getInterceptors, init, initAttributeContexts, initOperationContexts, initPersistence, invokePreRegister, load, override, removeAttributeChangeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setManagedResource, setModelMBeanInfo, setValuesFromMBeanInfo, 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
 

Constructor Detail

XMBean

public XMBean()
       throws MBeanException (src) 
Default constructor for the XMBean Model MBean implementation. This creates an uninitialized Model MBean template.


XMBean

public XMBean(ModelMBeanInfo (src)  info)
       throws MBeanException (src) 
Creates an XMBean Model MBean implementation with a predefined JMX metadata.

Parameters:
info - Model MBean metadata describing this MBean template

XMBean

public XMBean(java.lang.Object resource,
              java.lang.String resourceType)
       throws MBeanException (src) ,
              NotCompliantMBeanException (src) 
Creates a XMBean instance with a given resource object and resource type.

This Model MBean implementation supports the following resource types:


   - OBJECT_REF
   - STANDARD_INTERFACE
   - DESCRIPTOR
   - Any valid URL string to a *.xml file.

 
OBJECT_REF: resource object can be any Java object. The management interface must be set separately via setModelMBeanInfo method.

STANDARD_INTERFACE: the resource object is assumed to follow the Standard MBean naming conventions to expose its management interface, including implementing a xxxMBean interface. A corresponding Model MBean metadata is generated for the Model MBean representing this resource type.

DESCRIPTOR: the resource object is wrapped as a part of the Descriptor (src) object passed to this Model MBean instance. The descriptor object must contain the mandatory fields RESOURCE_REFERENCE and RESOURCE_TYPE that identify the correct resource reference and type used for this Model MBean instance. The descriptor object may also contain additional fields, such as SAX_PARSER and XML_VALIDATION that are passed as configuration properties for the metadata builder instances. Any additional descriptor fields that match the METADATA_DESCRIPTOR_PREFIX naming pattern will be passed to the builder implementation via its setProperty method.

URL String: if a resource type string contains an URL that ends with a *.xml file name the resource object is exposed via the XML management interface definition read from this URL. The XML parser implementation is picked based on the schema definition in the XML document.

Parameters:
resource - resource object or descriptor
resourceType - resource type string or URL to *.xml file

XMBean

public XMBean(java.lang.Object resource,
              java.net.URL interfaceURL)
       throws MBeanException (src) ,
              NotCompliantMBeanException (src) 

XMBean

public XMBean(Descriptor (src)  descriptor)
       throws MBeanException (src) ,
              NotCompliantMBeanException (src) 

XMBean

public XMBean(java.lang.Object resource,
              org.w3c.dom.Element element,
              java.lang.String version)
       throws MBeanException (src) ,
              NotCompliantMBeanException (src) 
Method Detail

isSupportedResourceType

public boolean isSupportedResourceType(java.lang.Object resource,
                                       java.lang.String resourceType)
Overrides:
isSupportedResourceType in class ModelMBeanInvoker (src)

configureInterceptorStack

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

Overrides:
configureInterceptorStack in class ModelMBeanInvoker (src)
Parameters:
info - - the ModelMBean metadata
server - - the MBeanServer the ModelMBean is registering with
name - - the ModelMBean name
Throws:
java.lang.Exception

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 ModelMBeanInvoker (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 ModelMBeanInvoker (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 ModelMBeanInvoker (src)
Throws:
ListenerNotFoundException (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 ModelMBeanInvoker (src)

handleNotification

public void handleNotification(Notification (src)  notification,
                               java.lang.Object handback)
Implements NotificationListener interface by simply forwarding any received Notification to the wrapped resource, if it implements the NotificationListener interface, too. This is needed to allow the wrapped resource to register for Notifications using the XMBean ObjectName, rather than its own "this" reference - dimitris

Specified by:
handleNotification in interface NotificationListener (src)
Parameters:
notification - the notification object
handback - the handback object given to the broadcaster upon listener registration