[jboss-user] [JBoss Microcontainer] - How to avoid canonical conversion of AbstractInjectionValueMetaData's value?

jaikiran pai do-not-reply at jboss.com
Thu Apr 8 13:19:55 EDT 2010


jaikiran pai [http://community.jboss.org/people/jaikiran] created the discussion

"How to avoid canonical conversion of AbstractInjectionValueMetaData's value?"

To view the discussion, visit: http://community.jboss.org/message/536376#536376

--------------------------------------------------------------
I have got a piece of code which deploys a MC bean into the kernel:
String beanName = "abc";BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(beanName, MyClass.class.getName());String constructorParamMCBeanName = "jboss.domain:m=xyz,c=pqr"  builder.addConstructorParameter(SomeClass.class.getName(), new AbstractInjectionValueMetaData(constructorParamMCBeanName));

So effectively, it's creating a MC bean for MyClass which accepts an instance of SomeClass as its constructor param:
public class MyClass{    public MyClass(SomeClass param)    {        ...    }}

The SomeClass instance which itself is a MC bean with MC bean name "jboss.domain:m=xyz,c=pqr" gets deployed by some other piece of code.This is simple enough and should have worked. But it doesn't. When the "abc" MC bean is installed, it runs into:
DEPLOYMENTS MISSING DEPENDENCIES:  Deployment "abc" is missing the following dependencies:    Dependency "jboss.domain:c=pqr,m=xyz" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'jboss.domain:c=pqr,m=xyz' **")

  Notice that the (injection) dependency MC bean name has been converted to a canonical name. Shouldn't have happened.But looking at the constructor of AbstractInjectionValueMetaData, a call to new AbstractInjectionValueMetaData(constructorParamMCBeanName), leads to:
public AbstractValueMetaData(Object value)   {      setValue(value);   }   public void setValue(Object value)   {      Object jmxHack = null;      if (isUseJMXObjectNameFix())         jmxHack = JMXObjectNameFix.needsAnAlias(value);      if (jmxHack != null)         this.value = jmxHack;      else         this.value = value;            flushJBossObjectCache();   }      /**    * Do we use jmx object name fix.    *    * @return do we use jmx object name fix    */   protected boolean isUseJMXObjectNameFix()   {      return true;   }   

   The isUseJMXObjectNameFix always returns true and then JMXObjectNameFix.needsAnAlias(value) converts the MC bean name to its canonical form. I see no way to prevent this from happening (other than create a subclass - which is a bit too much to do for this simple usecase). Am I missing something? Or is there some other way to get around this?


--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/536376#536376]

Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100408/1b49652f/attachment.html 


More information about the jboss-user mailing list