geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r988780 - /geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
Date Wed, 25 Aug 2010 02:32:14 GMT
Author: xuhaihong
Date: Wed Aug 25 02:32:14 2010
New Revision: 988780

URL: http://svn.apache.org/viewvc?rev=988780&view=rev
Log:
Configure the class name for lifecycle methods, need to check some duplicate annotation scanning

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java?rev=988780&r1=988779&r2=988780&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
Wed Aug 25 02:32:14 2010
@@ -28,6 +28,7 @@ import java.util.Map;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.gbean.annotation.GBean;
 import org.apache.geronimo.j2ee.annotation.Holder;
@@ -36,6 +37,9 @@ import org.apache.geronimo.j2ee.deployme
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.openejb.jee.ApplicationClient;
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.Interceptor;
 import org.apache.openejb.jee.JndiConsumer;
 import org.apache.openejb.jee.Lifecycle;
 import org.apache.openejb.jee.LifecycleCallback;
@@ -61,9 +65,17 @@ public class LifecycleMethodBuilder exte
         }
         Lifecycle lifecycle = (Lifecycle) specDD;
         AbstractFinder classFinder = module.getClassFinder();
-        //TODO what is the component type???
-        Map<String, LifecycleCallback> postConstructMap = mapLifecycleCallbacks(lifecycle.getPostConstruct(),
null/*annotatedApp.getComponentType()*/);
-        Map<String, LifecycleCallback> preDestroyMap = mapLifecycleCallbacks(lifecycle.getPreDestroy(),
null/*annotatedApp.getComponentType()*/);
+        //TODO Need to double check the LifecycleMethod Scanning, seems we also do it in
the OpenEJB
+        String componentType = null;
+        if (specDD instanceof EnterpriseBean) {
+            componentType = ((EnterpriseBean) specDD).getEjbClass();
+        } else if (specDD instanceof Interceptor) {
+            componentType = ((Interceptor) specDD).getInterceptorClass();
+        } else if (specDD instanceof ApplicationClient) {
+            componentType = ((ApplicationClient) specDD).getMainClass();
+        }
+        Map<String, LifecycleCallback> postConstructMap = mapLifecycleCallbacks(lifecycle.getPostConstruct(),
componentType);
+        Map<String, LifecycleCallback> preDestroyMap = mapLifecycleCallbacks(lifecycle.getPreDestroy(),
componentType);
         if (module.getClassFinder() != null) {
             List<Method> postConstructs = classFinder.findAnnotatedMethods(PostConstruct.class);
             for (Method m : postConstructs) {



Mime
View raw message