mx4j/src/core/javax/management/modelmbean RequiredModelMBean.java,1.21,1.22

Jeremy Boynes <[email protected]> Mon, 14 Feb 2005 07:06:46 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/core/javax/management/modelmbean
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30269/src/core/javax/management/modelmbean

Modified Files:
	RequiredModelMBean.java 
Log Message:
MBeanInfo for RequiredModelMBean does not contain default notitifications

Index: RequiredModelMBean.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/javax/management/modelmbean/RequiredModelMBean.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** RequiredModelMBean.java	13 Feb 2005 16:36:15 -0000	1.21
--- RequiredModelMBean.java	14 Feb 2005 07:06:43 -0000	1.22
***************
*** 57,62 ****
  {
     private static final String OBJECT_RESOURCE_TYPE = "ObjectReference";
-    private static final ModelMBeanNotificationInfo[] DEFAULT_NOTIFICATIONS;
     private static final ModelMBeanInfoSupport DEFAULT_INFO;
     static
     {
--- 57,63 ----
  {
     private static final String OBJECT_RESOURCE_TYPE = "ObjectReference";
     private static final ModelMBeanInfoSupport DEFAULT_INFO;
+    private static final ModelMBeanNotificationInfo GENERIC_INFO;
+    private static final ModelMBeanNotificationInfo ATTR_CHANGE_INFO;
     static
     {
***************
*** 67,71 ****
           "severity=6",
           "displayName=jmx.modelmbean.generic"};
!       ModelMBeanNotificationInfo genericInfo = new ModelMBeanNotificationInfo(new String[]{"jmx.modelmbean.generic"}, "GENERIC", "", new DescriptorSupport(fields));
        fields = new String[]{
           "name=ATTRIBUTE_CHANGE",
--- 68,72 ----
           "severity=6",
           "displayName=jmx.modelmbean.generic"};
!       GENERIC_INFO = new ModelMBeanNotificationInfo(new String[]{"jmx.modelmbean.generic"}, "GENERIC", "", new DescriptorSupport(fields));
        fields = new String[]{
           "name=ATTRIBUTE_CHANGE",
***************
*** 74,80 ****
           "severity=6",
           "displayName=jmx.attribute.change"};
!       ModelMBeanNotificationInfo attributeChangeInfo = new ModelMBeanNotificationInfo(new String[]{"jmx.attribute.change"}, "ATTRIBUTE_CHANGE", "", new DescriptorSupport(fields));
!       DEFAULT_NOTIFICATIONS = new ModelMBeanNotificationInfo[]{genericInfo, attributeChangeInfo};
!       DEFAULT_INFO = new ModelMBeanInfoSupport(RequiredModelMBean.class.getName(), null, null, null, null, DEFAULT_NOTIFICATIONS);
     }
  
--- 75,80 ----
           "severity=6",
           "displayName=jmx.attribute.change"};
!       ATTR_CHANGE_INFO = new ModelMBeanNotificationInfo(new String[]{"jmx.attribute.change"}, "ATTRIBUTE_CHANGE", "", new DescriptorSupport(fields));
!       DEFAULT_INFO = new ModelMBeanInfoSupport(RequiredModelMBean.class.getName(), null, null, null, null, null);
     }
  
***************
*** 145,149 ****
        if (!isModelMBeanInfoValid(modelMBeanInfo)) throw new RuntimeOperationsException(new IllegalArgumentException("ModelMBeanInfo is invalid"));
  
-       // todo add in default notifications
        m_modelMBeanInfo = new ModelMBeanInfoSupport(modelMBeanInfo);
  
--- 145,148 ----
***************
*** 218,222 ****
     {
        MBeanNotificationInfo[] notifications = m_modelMBeanInfo.getNotifications();
-       // todo we should add these in setModelInfo()
        boolean hasGeneric = false;
        boolean hasAttribute = false;
--- 217,220 ----
***************
*** 241,246 ****
        MBeanNotificationInfo[] newNotifications = new MBeanNotificationInfo[notifications.length + toAdd];
        System.arraycopy(notifications, 0, newNotifications, toAdd, notifications.length);
!       if (!hasAttribute) newNotifications[--toAdd] = DEFAULT_NOTIFICATIONS[1];
!       if (!hasGeneric) newNotifications[--toAdd] = DEFAULT_NOTIFICATIONS[0];
        return newNotifications;
     }
--- 239,244 ----
        MBeanNotificationInfo[] newNotifications = new MBeanNotificationInfo[notifications.length + toAdd];
        System.arraycopy(notifications, 0, newNotifications, toAdd, notifications.length);
!       if (!hasAttribute) newNotifications[--toAdd] = ATTR_CHANGE_INFO;
!       if (!hasGeneric) newNotifications[--toAdd] = GENERIC_INFO;
        return newNotifications;
     }



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click