[jboss-cvs] JBossAS SVN: r70711 - in trunk: testsuite/src/main/org/jboss/test/profileservice/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Mar 10 19:29:55 EDT 2008
Author: scott.stark at jboss.org
Date: 2008-03-10 19:29:55 -0400 (Mon, 10 Mar 2008)
New Revision: 70711
Modified:
trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
Log:
JBAS-5223, look to the mbean for attribute values without a ServiceAttributeMetaData.
Modified: trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java 2008-03-10 22:29:37 UTC (rev 70710)
+++ trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java 2008-03-10 23:29:55 UTC (rev 70711)
@@ -24,9 +24,12 @@
import java.io.Serializable;
import java.util.List;
+import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import javax.management.ReflectionException;
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.info.spi.PropertyInfo;
@@ -115,7 +118,7 @@
if (name == null)
property.getName();
- // Get the attribute value
+ // Get the attribute value from the metadata
Object value = null;
for (ServiceAttributeMetaData amd : md.getAttributes())
{
@@ -126,6 +129,37 @@
break;
}
}
+ // If the value is null, look to mbean for the value
+ if (value == null)
+ {
+ ObjectName mbean = md.getObjectName();
+ try
+ {
+ value = getMbeanServer().getAttribute(mbean, name);
+ }
+ catch (AttributeNotFoundException e)
+ {
+ // Try the alternate name
+ String attribute = name;
+ if(Character.isUpperCase(name.charAt(0)))
+ attribute = Character.toLowerCase(name.charAt(0)) + name.substring(1);
+ else
+ attribute = Character.toUpperCase(name.charAt(0)) + name.substring(1);
+ try
+ {
+ value = getMbeanServer().getAttribute(mbean, attribute);
+ }
+ catch(Exception e2)
+ {
+ log.debug("Failed to get value from mbean for: "+attribute, e2);
+ }
+ }
+ catch(Exception e)
+ {
+ log.debug("Failed to get value from mbean for: "+name, e);
+ }
+ }
+
// Unwrap the ServiceValueMetaData types
if (value instanceof ServiceTextValueMetaData)
{
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2008-03-10 22:29:37 UTC (rev 70710)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2008-03-10 23:29:55 UTC (rev 70711)
@@ -64,9 +64,9 @@
{
ManagementView mgtView = getManagementView();
ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
- ManagedComponent queue = mgtView.getComponent("DLQ", type);
+ ManagedComponent queue = mgtView.getComponent("/queue/DLQ", type);
assertNotNull(queue);
- assertEquals("DLQ", queue.getName());
+ assertEquals("/queue/DLQ", queue.getName());
}
More information about the jboss-cvs-commits
mailing list