[jboss-dev-forums] [Design of POJO Server] - Re: Integrating aop-mc-int bean metadata with AS5
kabir.khan@jboss.com
do-not-reply at jboss.com
Thu Aug 7 11:59:19 EDT 2008
After a few false starts, I now see that the MDR used by DescribeAction is the same as the one that I push the correct AspectManager to use to. However, the wrong metadata is got at the DescribeAction stage. I've traced through, and will describe what is happening. Hopefully someone more familiar with the MDR can shed some light, since I am not 100% sure how this should work.
My code for pushing the AspectManager is
| private String registerScopedManagerBean(int sequence, VFSDeploymentUnit unit, AspectManager scopedManager, AopMetaDataDeployerOutput output) throws DeploymentException
| {
| unit.getMutableMetaData().addMetaData(scopedManager, AspectManager.class);
| }
|
The mutable scope key used underneath is
| [APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
|
When deploying the beans, I use the suggested
| private void deploy(DeploymentUnit unit, BeanMetaData deployment) throws DeploymentException
| {
| ...
| KernelControllerContext context = new AbstractKernelControllerContext(null, deployment, null);
| //Make sure that the metadata from the deployment gets put into the context
| ScopeInfo scopeInfo = context.getScopeInfo();
| scopeInfo.setScope(unit.getScope());
| scopeInfo.setMutableScope(unit.getMutableScope());
| ...
| }
|
as mentioned here http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168986#4168986 the call to
| scopedInfo.setScopeInfo(unit.getScope())
|
in BeanMetaDataDeployer changes the scopeInfo.scopeKey from
| [JVM=THIS, CLASS=org.jboss.beans.metadata.plugins.factory.GenericBeanFactory, INSTANCE=ScopedAlias_13_Factory$ScopedInterceptor, WORK=5644960]
|
to
| [JVM=THIS, APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar, DEPLOYMENT=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
|
Should they not be merged to something like the following?
| [JVM=THIS, APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar, DEPLOYMENT=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar, CLASS=org.jboss.beans.metadata.plugins.factory.GenericBeanFactory, INSTANCE=ScopedAlias_13_Factory$ScopedInterceptor, WORK=5644960]
|
Also, the call to scopeInfo.setMutableScope changes the scopeInfo.mutableScopeKey from
| [INSTANCE=ScopedAlias_13_Factory$ScopedInterceptor]
|
to
| [APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
|
As part of PreInstallAction, AbstractScopeInfo.addMetaData() adds a new MemoryMetaDataLoader under:
| [APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
|
with this code
| public void addMetaData(MutableMetaDataRepository repository, ControllerContext context)
| {
| this.repository = repository;
| ScopeKey scope = getMutableScope();
| MemoryMetaDataLoader mutable = new MemoryMetaDataLoader(scope);
| repository.addMetaDataRetrieval(mutable);
| addMetaData(repository, context, mutable);
| }
|
This happens for every bean, and it overwrites the existing MetaDataContext that contained the aspect manager to use, so this no longer exists in the repository. Should this check if a retrieval exists already, and add to that instead?
I also noticed, that in DescribeAction it obtains the metadata using the context's scope
| [JVM=THIS, APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar, DEPLOYMENT=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
|
This returns a MetaDataRetrieval containing retrievals with the following scope keys
| [DEPLOYMENT=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
| [APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
| [JVM=THIS]
|
Are CLASS and INSTANCE missing due to the change when calling scopedInfo.setScopeInfo(unit.getScope())? Inspecting this a bit further, the MetaDataRetrieval at APPLICATION level is not the same as the one stored under
| [APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
|
What is/should the link be between the two?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169341#4169341
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169341
More information about the jboss-dev-forums
mailing list