[jboss-user] [Microcontainer] - Re: Deployment unit aware annotations

wolfc do-not-reply at jboss.com
Wed Feb 18 03:11:33 EST 2009


That doesn't work because the bean itself isn't there yet. So right now I examine the BeanMetaData.

(iterating over mainDeployer.getTopLevel())
   private DeploymentUnit findBean(DeploymentUnit deploymentUnit, String contextName)
  |    {
  |       if(deploymentUnit == null)
  |          return null;
  |       /*
  |       Set<Object> controllerContextNames = deploymentUnit.getControllerContextNames();
  |       if(controllerContextNames != null)
  |       {
  |          for(Object name : controllerContextNames)
  |          {
  |             if(name.equals(contextName))
  |                return deploymentUnit;
  |          }
  |       }
  |       */
  |       BeanMetaData bmd = deploymentUnit.getAttachment(BeanMetaData.class);
  |       if(bmd != null && bmd.getName().equals(contextName))
  |          return deploymentUnit;
  |       DeploymentUnit result;
  |       for(DeploymentUnit component : deploymentUnit.getComponents())
  |       {
  |          result = findBean(component, contextName);
  |          if(result != null)
  |             return deploymentUnit;
  |       }
  |       for(DeploymentUnit child : deploymentUnit.getChildren())
  |       {
  |          result = findBean(child, contextName);
  |          if(result != null)
  |             return result;
  |       }
  |       return null;
  |    }

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

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



More information about the jboss-user mailing list