[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Scoped Kernels
adrian@jboss.org
do-not-reply at jboss.com
Mon Feb 26 08:16:58 EST 2007
"alesj" wrote : "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>
| |
That looks like a very dirty hack to me.
I'm beginning to think that if we are going to add one hack
(pretending mutating the name to avoid clashes) because
of another hack (moving the controller) then we are on the wrong
track.
In fact, what is really required to fix this problem is something we discussed a while ago
where the bean is given a UID (unique identifier) to store its internal state.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4022406#4022406
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4022406
More information about the jboss-dev-forums
mailing list