tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r393457 - in /tomcat/tc6.0.x/trunk/java/org/apache/catalina: startup/WebAnnotationSet.java util/AnnotationProcessor.java
Date Wed, 12 Apr 2006 13:32:04 GMT
Author: remm
Date: Wed Apr 12 06:32:02 2006
New Revision: 393457

URL: http://svn.apache.org/viewcvs?rev=393457&view=rev
Log:
- Add resource injection for all annotations that are supposed to be supported by the web
tier.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/AnnotationProcessor.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebAnnotationSet.java
URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebAnnotationSet.java?rev=393457&r1=393456&r2=393457&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebAnnotationSet.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebAnnotationSet.java Wed Apr 12
06:32:02 2006
@@ -33,9 +33,6 @@
 import org.apache.catalina.deploy.FilterDef;
 import org.apache.catalina.deploy.MessageDestinationRef;
 
-//import javax.ejb.EJB;
-//import javax.xml.ws.WebServiceRef;
-
 /**
  * <p><strong>AnnotationSet</strong> for processing the annotations of
the web application
  * classes (<code>/WEB-INF/classes</code> and <code>/WEB-INF/lib</code>).</p>

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/AnnotationProcessor.java
URL: http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/AnnotationProcessor.java?rev=393457&r1=393456&r2=393457&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/AnnotationProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/AnnotationProcessor.java Wed Apr 12
06:32:02 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,9 +21,13 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
+import javax.annotation.EJB;
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import javax.naming.NamingException;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+import javax.xml.ws.WebServiceRef;
 
 import org.apache.tomcat.util.IntrospectionUtils;
 
@@ -116,18 +120,25 @@
                 Resource annotation = (Resource) fields[i].getAnnotation(Resource.class);
                 lookupFieldResource(context, instance, fields[i], annotation.name());
             }
-            /*
             if (fields[i].isAnnotationPresent(EJB.class)) {
                 EJB annotation = (EJB) fields[i].getAnnotation(EJB.class);
-                lookupOnFieldResource(context, instance, fields[i], annotation.name());
+                lookupFieldResource(context, instance, fields[i], annotation.name());
             }
-            
             if (fields[i].isAnnotationPresent(WebServiceRef.class)) {
                 WebServiceRef annotation = 
                     (WebServiceRef) fields[i].getAnnotation(WebServiceRef.class);
-                lookupOnFieldResource(context, instance, fields[i], annotation.name());
+                lookupFieldResource(context, instance, fields[i], annotation.name());
+            }
+            if (fields[i].isAnnotationPresent(PersistenceContext.class)) {
+                PersistenceContext annotation = 
+                    (PersistenceContext) fields[i].getAnnotation(PersistenceContext.class);
+                lookupFieldResource(context, instance, fields[i], annotation.name());
+            }
+            if (fields[i].isAnnotationPresent(PersistenceUnit.class)) {
+                PersistenceUnit annotation = 
+                    (PersistenceUnit) fields[i].getAnnotation(PersistenceUnit.class);
+                lookupFieldResource(context, instance, fields[i], annotation.name());
             }
-            */
         }
         
         // Initialize methods annotations
@@ -137,18 +148,26 @@
                 Resource annotation = (Resource) methods[i].getAnnotation(Resource.class);
                 lookupMethodResource(context, instance, methods[i], annotation.name());
             }
-            /*
             if (methods[i].isAnnotationPresent(EJB.class)) {
                 EJB annotation = (EJB) methods[i].getAnnotation(EJB.class);
-                lookupOnMethodResource(context, instance, methods[i], annotation.name());
+                lookupMethodResource(context, instance, methods[i], annotation.name());
             }
             if (methods[i].isAnnotationPresent(WebServiceRef.class)) {
                 WebServiceRef annotation = 
                     (WebServiceRef) methods[i].getAnnotation(WebServiceRef.class);
-                lookupOnMethodResource(context, instance, methods[i], annotation.name());
+                lookupMethodResource(context, instance, methods[i], annotation.name());
+            }
+            if (methods[i].isAnnotationPresent(PersistenceContext.class)) {
+                PersistenceContext annotation = 
+                    (PersistenceContext) methods[i].getAnnotation(PersistenceContext.class);
+                lookupMethodResource(context, instance, methods[i], annotation.name());
             }
-            */
-        }            
+            if (methods[i].isAnnotationPresent(PersistenceUnit.class)) {
+                PersistenceUnit annotation = 
+                    (PersistenceUnit) methods[i].getAnnotation(PersistenceUnit.class);
+                lookupMethodResource(context, instance, methods[i], annotation.name());
+            }
+        }
 
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message