[Design of JBoss/Tomcat Integration] - JBAS-5673 - Metadata processing
by emuckenhuber
Looking into https://jira.jboss.org/jira/browse/JBAS-5673, i noticed that something is missing in the web annotation processing with injection targets.
e.g. having 2 classes with the same EJB or Resource reference ends up in only one injection target for this reference:
| public class FooServlet
| {
| @EJB(beanName="StatefulTestBean", beanInterface=StatefulIF.class)
| private StatefulIF statefulTestBean;
| }
| public class Foo2Servlet
| {
| @EJB(beanName="StatefulTestBean", beanInterface=StatefulIF.class)
| private StatefulIF statefulTestBean;
| }
|
would result in a AnnotatedReferenceMetaData with one InjectionTarget, instead of two - which basically affects also @Resource, @PersistenceContext, @WebServiceRef processors.
As it's currently done like (pseudocode):
| AnnotatedEJBReferenceMetaData ref = createAnnotatedEJBRef(...);
| ref.setInjectionTargets(injectionTargets);
| refs.add(ref);
|
So i guess it should rather be something like:
| AnnotatedEJBReferenceMetaData newRef = createAnnotatedEJBRef(...);
| AnnotatedEJBReferenceMetaData existingRef = refs.get(newRef.getName());
| if(existingRef == null)
| refs.add(ref);
| else
| mergeInjectionTargets(existingRef, newRef)
|
Or should this be done in a different way ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168828#4168828
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168828
17 years, 4 months
[Design of POJO Server] - Re: Pushing correct aspect manager for a deployment
by kabir.khan@jboss.com
"adrian(a)jboss.org" wrote :
| To make this work, you'd need something like the following (untested):
|
| | Index: src/main/org/jboss/deployers/vfs/deployer/kernel/BeanMetaDataDeployer.java
| | ===================================================================
| | --- src/main/org/jboss/deployers/vfs/deployer/kernel/BeanMetaDataDeployer.java (revision 76634)
| | +++ src/main/org/jboss/deployers/vfs/deployer/kernel/BeanMetaDataDeployer.java (working copy)
| | @@ -27,12 +27,14 @@
| | import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
| | import org.jboss.beans.metadata.spi.ValueMetaData;
| | import org.jboss.dependency.spi.Controller;
| | +import org.jboss.dependency.spi.ScopeInfo;
| | import org.jboss.deployers.spi.DeploymentException;
| | import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
| | import org.jboss.deployers.structure.spi.DeploymentUnit;
| | import org.jboss.kernel.Kernel;
| | import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
| | import org.jboss.kernel.spi.dependency.KernelControllerContext;
| | +import org.jboss.metadata.spi.scope.ScopeKey;
| |
| | /**
| | * BeanMetaDataDeployer.<p>
| | @@ -108,6 +110,9 @@
| | }
| | }
| | KernelControllerContext context = new AbstractKernelControllerContext(null, deployment, null);
| | + ScopeInfo scopeInfo = context.getScopeInfo();
| | + scopeInfo.setScope(unit.getScope());
| | + scopeInfo.setMutableScope(unit.getMutableScope());
| | try
| | {
| | controller.install(context);
| |
I tried modifying this to
| 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());
| scopeInfo.addMetaData(controller.getKernel().getMetaDataRepository().getMetaDataRepository(), context);
|
but still do not see the required metadata from the deploymentunit
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4168827#4168827
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4168827
17 years, 4 months