[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Scoped Kernels

alesj do-not-reply at jboss.com
Sat Feb 24 09:59:26 EST 2007


"alesj" wrote : 
  | From previous problem (duplicate 'context') temp fix, I currently have Context's hashCode under WORK level to diff the contexts. What's the appropriate fix?
  | 


  |    public ScopeKey getFullScope(KernelControllerContext context)
  |    {
  |       ScopeKey scope = ScopeKey.DEFAULT_SCOPE.clone();
  |       scope.addScope(CommonLevels.INSTANCE, context.getName().toString());
  |       BeanMetaData beanMetaData = context.getBeanMetaData();
  |       if (beanMetaData != null)
  |       {
  |          String bean = beanMetaData.getBean();
  |          if (bean != null)
  |             scope.addScope(CommonLevels.CLASS, bean);
  |       }
  |       // todo - some other level
  |       scope.addScope(CommonLevels.WORK, String.valueOf(context.hashCode()));
  |       return scope;
  |    }
  | 

Otherwise I cannot differentiate between these two beans:

  |    <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
  |       <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
  |       <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
  |       <constructor>
  |          <parameter>deployment1</parameter>
  |       </constructor>
  |    </bean>
  | 
  |    <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
  |       <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
  |       <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
  |       <constructor>
  |          <parameter>deployment2</parameter>
  |       </constructor>
  |    </bean>
  | 

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

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



More information about the jboss-dev-forums mailing list