[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Case sensitivity in injecting a bean's property

adrian@jboss.org do-not-reply at jboss.com
Tue Jan 23 05:12:57 EST 2007


Ok, so first of all, we need a test for this in system-jmx.

The only test for cross injection just uses the object, it does not test
accessing a "property" of an MBean.

org.jboss.test.system.controller.integration.test.ConfigureMCFromJMXTestCase-mc.xml


  | <deployment xmlns="urn:jboss:bean-deployer:2.0">
  |    <bean name="Test" class="org.jboss.test.system.controller.integration.support.SimpleBean">
  |       <property name="simple"><inject bean="jboss.test:type=test"/></property>
  |    </bean>
  | </deployment>
  | 

Previously, this just treated the MBean like a javabean
(i.e. the property name was port)
looking directly at the MBean object.

But now it has been changed to go through the JMX api
(so it needs to use the JMX attribute name Port).

Alternatively, we could do as Scott says and try both in ServiceControllerContext

  |    public Object get(String name) throws Throwable
  |    {
  |       try
  |       {
  |           return getMBeanServer().getAttribute(objectName, name);
  |       }
  |       catch (AttributeNotFoundException orignal)
  |       {
  |          try
  |          {
  |              name = switchToUpperOrLowerCase(name);
  |              return getMBeanServer().getAttribute(objectName, name);
  |          }
  |          catch (AttributeNotFoundException e)
  |          {
  |             throw original;
  |          }
  |       }
  |    }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005232#4005232

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005232



More information about the jboss-dev-forums mailing list