org.jboss.mx.modelmbean
Class XMBean

java.lang.Object
  extended by org.jboss.mx.server.AbstractMBeanInvoker
      extended by org.jboss.mx.modelmbean.ModelMBeanInvoker
          extended by org.jboss.mx.modelmbean.XMBean
All Implemented Interfaces:
EventListener, DynamicMBean, MBeanRegistration, ModelMBean, ModelMBeanNotificationBroadcaster, NotificationBroadcaster, NotificationEmitter, NotificationListener, PersistentMBean, ModelMBeanConstants, XMBeanConstants, Interceptable, MBeanInvoker, Suspendable

public class XMBean
extends ModelMBeanInvoker
implements XMBeanConstants, NotificationListener

XMBean implementation.

Version:
$Revision: 81026 $
Author:
Juha Lindfors., Matt Munz, Dimitris Andreadis

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.mx.server.AbstractMBeanInvoker
AbstractMBeanInvoker.OperationKey
 
Field Summary
 
Fields inherited from class org.jboss.mx.modelmbean.ModelMBeanInvoker
attrNotifierSequence, notifier, notifierSequence, persistence, resourceType
 
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.XMBeanConstants
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
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 descriptor)
           
XMBean(ModelMBeanInfo info)
          Creates an XMBean Model MBean implementation with a predefined JMX metadata.
XMBean(Object resource, Element element, String version)
           
XMBean(Object resource, org.dom4j.Element element, String version)
           
XMBean(Object resource, String resourceType)
          Creates a XMBean instance with a given resource object and resource type.
XMBean(Object resource, URL interfaceURL)
           
 
Method Summary
 void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
protected  void configureInterceptorStack(ModelMBeanInfo info, MBeanServer server, ObjectName name)
          Build the getMBeanInfo, operation, and attribute interceptor stacks and associated these with the corresponding InvocationContexts.
 MBeanNotificationInfo[] getNotificationInfo()
           
 void handleNotification(Notification notification, Object handback)
          Implements NotificationListener interface by simply forwarding any received Notification to the wrapped resource, if it implements the NotificationListener interface, too.
 boolean isSupportedResourceType(Object resource, String resourceType)
           
 void removeNotificationListener(NotificationListener listener)
           
 void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
           
 
Methods inherited from class org.jboss.mx.modelmbean.ModelMBeanInvoker
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
addNotificationListenerToResource, addOperationInterceptor, getAttribute, getAttributes, getInvocationTimeout, getMBeanEntry, getMBeanInfo, getMetaData, getNotificationInfoFromResource, getObjectName, getResource, getServer, getSignatureString, initDispatchers, inject, invoke, invokePostDeregister, invokePostRegister, invokePreDeregister, isSuspended, postDeregister, postRegister, preDeregister, preRegister, removeNotificationListenerFromResource, removeNotificationListenerFromResource, removeOperationInterceptor, 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
 

Constructor Detail

XMBean

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

Throws:
MBeanException

XMBean

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

Parameters:
info - Model MBean metadata describing this MBean template
Throws:
MBeanException

XMBean

public XMBean(Object resource,
              String resourceType)
       throws MBeanException,
              NotCompliantMBeanException
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 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
Throws:
MBeanException
NotCompliantMBeanException

XMBean

public XMBean(Object resource,
              URL interfaceURL)
       throws MBeanException,
              NotCompliantMBeanException
Throws:
MBeanException
NotCompliantMBeanException

XMBean

public XMBean(Descriptor descriptor)
       throws MBeanException,
              NotCompliantMBeanException
Throws:
MBeanException
NotCompliantMBeanException

XMBean

public XMBean(Object resource,
              Element element,
              String version)
       throws MBeanException,
              NotCompliantMBeanException
Throws:
MBeanException
NotCompliantMBeanException

XMBean

public XMBean(Object resource,
              org.dom4j.Element element,
              String version)
       throws MBeanException,
              NotCompliantMBeanException
Throws:
MBeanException
NotCompliantMBeanException
Method Detail

isSupportedResourceType

public boolean isSupportedResourceType(Object resource,
                                       String resourceType)
Overrides:
isSupportedResourceType in class ModelMBeanInvoker

configureInterceptorStack

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

Overrides:
configureInterceptorStack in class ModelMBeanInvoker
Parameters:
info - - the ModelMBean metadata
server - - the MBeanServer the ModelMBean is registering with
name - - the ModelMBean name
Throws:
Exception

addNotificationListener

public void addNotificationListener(NotificationListener listener,
                                    NotificationFilter filter,
                                    Object handback)
Specified by:
addNotificationListener in interface NotificationBroadcaster
Overrides:
addNotificationListener in class ModelMBeanInvoker

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
                                throws ListenerNotFoundException
Specified by:
removeNotificationListener in interface NotificationBroadcaster
Overrides:
removeNotificationListener in class ModelMBeanInvoker
Throws:
ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(NotificationListener listener,
                                       NotificationFilter filter,
                                       Object handback)
                                throws ListenerNotFoundException
Specified by:
removeNotificationListener in interface NotificationEmitter
Overrides:
removeNotificationListener in class ModelMBeanInvoker
Throws:
ListenerNotFoundException

getNotificationInfo

public MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface NotificationBroadcaster
Overrides:
getNotificationInfo in class ModelMBeanInvoker

handleNotification

public void handleNotification(Notification notification,
                               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


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.