[jboss-dev-forums] [Design of JBoss/Tomcat Integration] - Re: JBAS-5673 - Metadata processing
emuckenhuber
do-not-reply at jboss.com
Wed Aug 6 09:51:39 EDT 2008
So now to the actual topic of https://jira.jboss.org/jira/browse/JBAS-5673 :)
anonymous wrote :
| remove the duplicate processing of annotations happening in the web container TomcatInjectionContainer.
So we should be able to definitely drop those things in the TomcatInjectionContainer:
| private void processServlets(JBossServletsMetaData servlets, ClassLoader webLoader)
| private void processListeners(List<ListenerMetaData> listeners, ClassLoader webLoader)
| private void processFilters(FiltersMetaData filters, ClassLoader webLoader)
| private void processClass(String className, ClassLoader webLoader)
|
as those information have already been populated.
Ignoring dynamic jsp beans, etc. for now it would lead to a processAnnotations like:
| public void processAnnotations(Object object)
| {
| // Get injectors for class
| Map<AccessibleObject, Injector> injectors = encInjections.get(object.getClass().getName());
|
| // TODO dynamic beans, etc.
|
| if (injectors == null || injectors.size() == 0) return;
| for (Injector injector : injectors.values())
| {
| injector.inject(object);
| }
| }
|
Beside the fact that we could split the processAnnotations in doTheKnownInjection(Object) and processAnnotations(Object dynamicBean),
there are still some things not really clear:
| Map<AccessibleObject, Injector> injectors = encInjections.get(className);
|
| // instead of
|
| Map<AccessibleObject, Injector> injectors = resolvedClassInjections.get(object.getClass().getName());
|
which would makes sense, as we don't use the resolvedClassInjections anymore (see processClass) and encInjections is actually already populated by the InjectionHandlers.
But e.g. the UserTransaction is handled differently in WebResourceHandler:
| public class WebResourceHandler implements InjectionHandler
| {
| // ...
| loadXmlResourceEnvRefs(InjectionContainer container, Collection refs)
| {
|
| else if (resType.equals(UserTransaction.class))
| {
|
| if(envRef.getInjectionTargets() != null)
| {
| createInjectors(container.getInjectors(), getClassloader(), factory, getInjectionTargets());
| continue;
| }
| // ....
| }
|
| // Where the container.getInjectors() is:
|
| // EncInjectors/Handlers may need to add extra instance injectors
| public List<Injector> getInjectors()
| {
| return new ArrayList<Injector>(); // no equivalent in WAR
| }
|
Assuming that the processAnnotations should be like that, we would need to add those injectors also to the EncInjections and so smth like:
| createInjectors(container.getEncInjections(), getClassloader(), factory, getInjectionTargets());
|
I think adding it to a List would not make sense in this case (same for the WebServiceHandler).
That should be it, so that we just process annotations once (still ignoring dynamic beans). Does that makes sense ? :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169049#4169049
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169049
More information about the jboss-dev-forums
mailing list