geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r541492 - in /geronimo/server/trunk/modules: geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/ geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/ geronimo-naming-builder/src/main/java...
Date Fri, 25 May 2007 00:09:33 GMT
Author: djencks
Date: Thu May 24 17:09:32 2007
New Revision: 541492

URL: http://svn.apache.org/viewvc?view=rev&rev=541492
Log:
GERONIMO-3185 Add the class into xml lifecycle method specification when its missing for app
client and ejb

Modified:
    geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/SecurityAnnotationHelper.java
    geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java

Modified: geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java?view=diff&rev=541492&r1=541491&r2=541492
==============================================================================
--- geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
Thu May 24 17:09:32 2007
@@ -338,7 +338,7 @@
         }
 
         // Create the AnnotatedApp interface for the AppClientModule
-        AnnotatedApplicationClient annotatedApplicationClient = new AnnotatedApplicationClient(appClient);
+        AnnotatedApplicationClient annotatedApplicationClient = new AnnotatedApplicationClient(appClient,
mainClass);
 
         AppClientModule module = new AppClientModule(standAlone, moduleName, clientBaseName,
serverEnvironment, clientEnvironment, moduleFile, targetPath, appClient, mainClass, gerAppClient,
specDD, resourceModules, annotatedApplicationClient);
         for (ModuleBuilderExtension mbe : moduleBuilderExtensions) {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java?view=diff&rev=541492&r1=541491&r2=541492
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java
Thu May 24 17:09:32 2007
@@ -59,9 +59,6 @@
  */
 public interface AnnotatedApp {
 
-    // Instance variables
-    List<EjbRefType> ambiguousEjbRefs = null;
-
     /**
      * XmlBeans methods used for the @EJB, @EJBs annotations
      */
@@ -130,4 +127,6 @@
 
     PersistenceUnitRefType[] getPersistenceUnitRefArray();
     PersistenceUnitRefType addNewPersistenceUnitRef();
+
+    String getComponentType();
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java?view=diff&rev=541492&r1=541491&r2=541492
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java
Thu May 24 17:09:32 2007
@@ -51,16 +51,19 @@
 
     // Private instance variables
     private static final Log log = LogFactory.getLog(AnnotatedApplicationClient.class);
-    private ApplicationClientType applicationClient;
+    private final ApplicationClientType applicationClient;
     private List<EjbRefType> ambiguousEjbRefs;
+    private final String componentType;
 
     /**
      * ApplicationClientType-qualified constructor
      *
      * @param applicationClient ApplicationClientType
+     * @param applicationClientClassName
      */
-    public AnnotatedApplicationClient(ApplicationClientType applicationClient) {
+    public AnnotatedApplicationClient(ApplicationClientType applicationClient, String applicationClientClassName)
{
         this.applicationClient = applicationClient;
+        this.componentType = applicationClientClassName;
     }
 
 
@@ -195,6 +198,10 @@
 
     public PersistenceUnitRefType addNewPersistenceUnitRef() {
         return applicationClient.addNewPersistenceUnitRef();
+    }
+
+    public String getComponentType() {
+        return componentType;
     }
 
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java?view=diff&rev=541492&r1=541491&r2=541492
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java
Thu May 24 17:09:32 2007
@@ -167,6 +167,10 @@
         return delegate.addNewPersistenceUnitRef();
     }
 
+    public String getComponentType() {
+        return null;
+    }
+
     /**
      * ejbJar getter
      *
@@ -323,6 +327,10 @@
         public PersistenceUnitRefType addNewPersistenceUnitRef() {
             return bean.addNewPersistenceUnitRef();
         }
+
+        public String getComponentType() {
+            return bean.getEjbClass().getStringValue().trim();
+        }
     }
 
     public static class MessageDriveBean implements AnnotatedApp {
@@ -451,6 +459,10 @@
         public PersistenceUnitRefType addNewPersistenceUnitRef() {
             return bean.addNewPersistenceUnitRef();
         }
+
+        public String getComponentType() {
+            return bean.getEjbClass().getStringValue().trim();
+        }
     }
 
     public static class SessionBean implements AnnotatedApp {
@@ -578,6 +590,10 @@
 
         public PersistenceUnitRefType addNewPersistenceUnitRef() {
             return bean.addNewPersistenceUnitRef();
+        }
+
+        public String getComponentType() {
+            return bean.getEjbClass().getStringValue().trim();
         }
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java?view=diff&rev=541492&r1=541491&r2=541492
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java
Thu May 24 17:09:32 2007
@@ -197,4 +197,8 @@
     public PersistenceUnitRefType addNewPersistenceUnitRef() {
         return webApp.addNewPersistenceUnitRef();
     }
+
+    public String getComponentType() {
+        return null;
+    }
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/SecurityAnnotationHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/SecurityAnnotationHelper.java?view=diff&rev=541492&r1=541491&r2=541492
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/SecurityAnnotationHelper.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/SecurityAnnotationHelper.java
Thu May 24 17:09:32 2007
@@ -75,7 +75,7 @@
      * @throws DeploymentException if parsing or validation error
      */
     public static void processAnnotations(WebAppType webApp, ClassFinder classFinder) throws
DeploymentException {
-        if (webApp != null) {
+        if (webApp != null && classFinder != null) {
             if (classFinder.isAnnotationPresent(DeclareRoles.class)) {
                 processDeclareRoles(webApp, classFinder);
             }

Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java?view=diff&rev=541492&r1=541491&r2=541492
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/LifecycleMethodBuilder.java
Thu May 24 17:09:32 2007
@@ -20,30 +20,30 @@
 
 package org.apache.geronimo.naming.deployment;
 
-import java.util.Map;
-import java.util.List;
-import java.util.HashMap;
 import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.QNameSet;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.annotation.Holder;
+import org.apache.geronimo.j2ee.annotation.LifecycleMethod;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
-import org.apache.geronimo.j2ee.annotation.LifecycleMethod;
-import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.xbeans.javaee.LifecycleCallbackType;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType;
 import org.apache.geronimo.xbeans.javaee.JavaIdentifierType;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.xbeans.javaee.LifecycleCallbackType;
 import org.apache.xbean.finder.ClassFinder;
+import org.apache.xmlbeans.QNameSet;
+import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$
@@ -60,15 +60,15 @@
         if (annotatedApp == null) {
             throw new NullPointerException("No AnnotatedApp supplied");
         }
-        Map<String, LifecycleCallbackType> postConstructMap = mapLifecycleCallbacks(annotatedApp.getPostConstructArray());
-        Map<String, LifecycleCallbackType> preDestroyMap = mapLifecycleCallbacks(annotatedApp.getPreDestroyArray());
+        Map<String, LifecycleCallbackType> postConstructMap = mapLifecycleCallbacks(annotatedApp.getPostConstructArray(),
annotatedApp.getComponentType());
+        Map<String, LifecycleCallbackType> preDestroyMap = mapLifecycleCallbacks(annotatedApp.getPreDestroyArray(),
annotatedApp.getComponentType());
         if (module.getClassFinder() != null) {
             List<Method> postConstructs = classFinder.findAnnotatedMethods(PostConstruct.class);
-            for (Method m: postConstructs) {
+            for (Method m : postConstructs) {
                 String methodName = m.getName();
                 String className = m.getDeclaringClass().getName();
                 if (!postConstructMap.containsKey(className)) {
-                    LifecycleCallbackType  callback = annotatedApp.addPostConstruct();
+                    LifecycleCallbackType callback = annotatedApp.addPostConstruct();
                     FullyQualifiedClassType classType = callback.addNewLifecycleCallbackClass();
                     classType.setStringValue(className);
                     JavaIdentifierType method = callback.addNewLifecycleCallbackMethod();
@@ -77,11 +77,11 @@
                 }
             }
             List<Method> preDestroys = classFinder.findAnnotatedMethods(PreDestroy.class);
-            for (Method m: preDestroys) {
+            for (Method m : preDestroys) {
                 String methodName = m.getName();
                 String className = m.getDeclaringClass().getName();
                 if (!preDestroyMap.containsKey(className)) {
-                    LifecycleCallbackType  callback = annotatedApp.addPreDestroy();
+                    LifecycleCallbackType callback = annotatedApp.addPreDestroy();
                     FullyQualifiedClassType classType = callback.addNewLifecycleCallbackClass();
                     classType.setStringValue(className);
                     JavaIdentifierType method = callback.addNewLifecycleCallbackMethod();
@@ -102,7 +102,7 @@
             return null;
         }
         Map<String, LifecycleMethod> map = new HashMap<String, LifecycleMethod>();
-        for (Map.Entry<String, LifecycleCallbackType> entry: lifecycleCallbackTypes.entrySet())
{
+        for (Map.Entry<String, LifecycleCallbackType> entry : lifecycleCallbackTypes.entrySet())
{
             String className = entry.getKey();
             LifecycleCallbackType callback = entry.getValue();
             LifecycleMethod method = new LifecycleMethod(className, callback.getLifecycleCallbackMethod().getStringValue().trim());
@@ -111,10 +111,18 @@
         return map;
     }
 
-    private Map<String, LifecycleCallbackType> mapLifecycleCallbacks(LifecycleCallbackType[]
callbackArray) {
+    private Map<String, LifecycleCallbackType> mapLifecycleCallbacks(LifecycleCallbackType[]
callbackArray, String componentType) throws DeploymentException {
         Map<String, LifecycleCallbackType> map = new HashMap<String, LifecycleCallbackType>();
-        for (LifecycleCallbackType callback: callbackArray) {
-            String className = callback.getLifecycleCallbackClass().getStringValue().trim();
+        for (LifecycleCallbackType callback : callbackArray) {
+            String className;
+            if (callback.isSetLifecycleCallbackClass()) {
+                className = callback.getLifecycleCallbackClass().getStringValue().trim();
+            } else {
+                if (componentType == null) {
+                    throw new DeploymentException("No component type available and none in
 lifecycle callback");
+                }
+                className = componentType;
+            }
             map.put(className, callback);
         }
         return map;



Mime
View raw message