geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r516815 - in /geronimo/server/trunk/modules: geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/ geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/
Date Sun, 11 Mar 2007 00:20:58 GMT
Author: djencks
Date: Sat Mar 10 16:20:58 2007
New Revision: 516815

URL: http://svn.apache.org/viewvc?view=rev&rev=516815
Log:
GERONIMO-2893 implement AnnotatedEjbJar methods.  Undo NPE guard, no longer needed.

Modified:
    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/WebServiceRefAnnotationHelper.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java

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=516815&r1=516814&r2=516815
==============================================================================
--- 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
Sat Mar 10 16:20:58 2007
@@ -20,17 +20,20 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.xbeans.javaee.EjbJarType;
 import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
 import org.apache.geronimo.xbeans.javaee.EjbRefType;
+import org.apache.geronimo.xbeans.javaee.EntityBeanType;
 import org.apache.geronimo.xbeans.javaee.EnvEntryType;
+import org.apache.geronimo.xbeans.javaee.LifecycleCallbackType;
 import org.apache.geronimo.xbeans.javaee.MessageDestinationRefType;
+import org.apache.geronimo.xbeans.javaee.MessageDrivenBeanType;
 import org.apache.geronimo.xbeans.javaee.ResourceEnvRefType;
 import org.apache.geronimo.xbeans.javaee.ResourceRefType;
 import org.apache.geronimo.xbeans.javaee.ServiceRefType;
-import org.apache.geronimo.xbeans.javaee.LifecycleCallbackType;
+import org.apache.geronimo.xbeans.javaee.SessionBeanType;
+import org.apache.xmlbeans.XmlObject;
 
 /**
  * Wrapper class to encapsulate the EjbJarType class with an interface that the various
@@ -46,38 +49,44 @@
  */
 public class AnnotatedEjbJar implements AnnotatedApp {
 
-    // Private instance variables
-    private static final Log log = LogFactory.getLog(AnnotatedEjbJar.class);
-    private EjbJarType ejbJar;
+    private final EjbJarType ejbJar;
     private List<EjbRefType> ambiguousEjbRefs;
+    private AnnotatedApp delegate;
+
 
-    /**
-     * EjbJarType-qualified constructor
-     *
-     * @param ejbJar EjbJarType
-     */
     public AnnotatedEjbJar(EjbJarType ejbJar) {
         this.ejbJar = ejbJar;
     }
 
+    public void setBean(XmlObject bean) throws DeploymentException {
+        if (bean instanceof EntityBeanType) {
+            delegate = new EntityBean((EntityBeanType) bean);
+        } else if (bean instanceof MessageDrivenBeanType) {
+            delegate = new MessageDriveBean((MessageDrivenBeanType) bean);
+        } else if (bean instanceof SessionBeanType) {
+            delegate = new SessionBean((SessionBeanType) bean);
+        } else {
+            throw new DeploymentException("Unrecognized XmlBeans object: " + bean);
+        }
+    }
 
     /**
      * EjbJarType methods used for the @EJB, @EJBs annotations
      */
     public EjbLocalRefType[] getEjbLocalRefArray() {
-        return null;
+        return delegate.getEjbLocalRefArray();
     }
 
     public EjbLocalRefType addNewEjbLocalRef() {
-        return null;
+        return delegate.addNewEjbLocalRef();
     }
 
     public EjbRefType[] getEjbRefArray() {
-        return null;
+        return delegate.getEjbRefArray();
     }
 
     public EjbRefType addNewEjbRef() {
-        return null;
+        return delegate.addNewEjbRef();
     }
 
 
@@ -85,43 +94,59 @@
      * EjbJarType methods used for the @Resource, @Resources annotations
      */
     public EnvEntryType[] getEnvEntryArray() {
-        return null;
+        return delegate.getEnvEntryArray();
     }
 
     public EnvEntryType addNewEnvEntry() {
-        return null;
+        return delegate.addNewEnvEntry();
     }
 
     public ServiceRefType[] getServiceRefArray() {
-        return null;
+        return delegate.getServiceRefArray();
     }
 
     public ServiceRefType addNewServiceRef() {
-        return null;
+        return delegate.addNewServiceRef();
     }
 
     public ResourceRefType[] getResourceRefArray() {
-        return null;
+        return delegate.getResourceRefArray();
     }
 
     public ResourceRefType addNewResourceRef() {
-        return null;
+        return delegate.addNewResourceRef();
     }
 
     public MessageDestinationRefType[] getMessageDestinationRefArray() {
-        return null;
+        return delegate.getMessageDestinationRefArray();
     }
 
     public MessageDestinationRefType addNewMessageDestinationRef() {
-        return null;
+        return delegate.addNewMessageDestinationRef();
     }
 
     public ResourceEnvRefType[] getResourceEnvRefArray() {
-        return null;
+        return delegate.getResourceEnvRefArray();
     }
 
     public ResourceEnvRefType addNewResourceEnvRef() {
-        return null;
+        return delegate.addNewResourceEnvRef();
+    }
+
+    public LifecycleCallbackType[] getPostConstructArray() {
+        return delegate.getPostConstructArray();
+    }
+
+    public LifecycleCallbackType addPostConstruct() {
+        return delegate.addPostConstruct();
+    }
+
+    public LifecycleCallbackType[] getPreDestroyArray() {
+        return delegate.getPreDestroyArray();
+    }
+
+    public LifecycleCallbackType addPreDestroy() {
+        return delegate.addPreDestroy();
     }
 
 
@@ -131,20 +156,14 @@
      * @return String representation of ejbJar
      */
     public String toString() {
-        return ejbJar.toString();
+        return ejbJar.xmlText();
     }
 
 
-    /**
-     * ejbJar getter
-     *
-     * @return ejbJar EjbJarType
-     */
     public EjbJarType getEjbJar() {
         return ejbJar;
     }
 
-
     /**
      * ambiguousRefs getter
      * <p/>
@@ -162,19 +181,326 @@
         return this.ambiguousEjbRefs;
     }
 
-    public LifecycleCallbackType[] getPostConstructArray() {
-        return new LifecycleCallbackType[0];
-    }
+    public static class EntityBean implements AnnotatedApp {
+        private final EntityBeanType bean;
 
-    public LifecycleCallbackType addPostConstruct() {
-        return null;
+
+        public EntityBean(EntityBeanType bean) {
+            this.bean = bean;
+        }
+
+        public EjbLocalRefType[] getEjbLocalRefArray() {
+            return bean.getEjbLocalRefArray();
+        }
+
+
+        public EjbLocalRefType addNewEjbLocalRef() {
+            return bean.addNewEjbLocalRef();
+        }
+
+
+        public EjbRefType[] getEjbRefArray() {
+            return bean.getEjbRefArray();
+        }
+
+
+        public EjbRefType addNewEjbRef() {
+            return bean.addNewEjbRef();
+        }
+
+
+        public EnvEntryType[] getEnvEntryArray() {
+            return bean.getEnvEntryArray();
+        }
+
+
+        public EnvEntryType addNewEnvEntry() {
+            return bean.addNewEnvEntry();
+        }
+
+
+        public ServiceRefType[] getServiceRefArray() {
+            return bean.getServiceRefArray();
+        }
+
+
+        public ServiceRefType addNewServiceRef() {
+            return bean.addNewServiceRef();
+        }
+
+
+        public ResourceRefType[] getResourceRefArray() {
+            return bean.getResourceRefArray();
+        }
+
+
+        public ResourceRefType addNewResourceRef() {
+            return bean.addNewResourceRef();
+        }
+
+
+        public MessageDestinationRefType[] getMessageDestinationRefArray() {
+            return bean.getMessageDestinationRefArray();
+        }
+
+
+        public MessageDestinationRefType addNewMessageDestinationRef() {
+            return bean.addNewMessageDestinationRef();
+        }
+
+
+        public ResourceEnvRefType[] getResourceEnvRefArray() {
+            return bean.getResourceEnvRefArray();
+        }
+
+
+        public ResourceEnvRefType addNewResourceEnvRef() {
+            return bean.addNewResourceEnvRef();
+        }
+
+
+        public String toString() {
+            return bean.xmlText();
+        }
+
+        public List<EjbRefType> getAmbiguousEjbRefs() {
+            throw new AssertionError("don't call this");
+        }
+
+
+        public LifecycleCallbackType[] getPostConstructArray() {
+            return bean.getPostConstructArray();
+        }
+
+
+        public LifecycleCallbackType addPostConstruct() {
+            return bean.addNewPostConstruct();
+        }
+
+
+        public LifecycleCallbackType[] getPreDestroyArray() {
+            return bean.getPreDestroyArray();
+        }
+
+
+        public LifecycleCallbackType addPreDestroy() {
+            return bean.addNewPreDestroy();
+        }
     }
 
-    public LifecycleCallbackType[] getPreDestroyArray() {
-        return new LifecycleCallbackType[0];
+    public static class MessageDriveBean implements AnnotatedApp {
+        private final MessageDrivenBeanType bean;
+
+
+        public MessageDriveBean(MessageDrivenBeanType bean) {
+            this.bean = bean;
+        }
+
+
+        public EjbLocalRefType[] getEjbLocalRefArray() {
+            return bean.getEjbLocalRefArray();
+        }
+
+
+        public EjbLocalRefType addNewEjbLocalRef() {
+            return bean.addNewEjbLocalRef();
+        }
+
+
+        public EjbRefType[] getEjbRefArray() {
+            return bean.getEjbRefArray();
+        }
+
+
+        public EjbRefType addNewEjbRef() {
+            return bean.addNewEjbRef();
+        }
+
+
+        public EnvEntryType[] getEnvEntryArray() {
+            return bean.getEnvEntryArray();
+        }
+
+
+        public EnvEntryType addNewEnvEntry() {
+            return bean.addNewEnvEntry();
+        }
+
+
+        public ServiceRefType[] getServiceRefArray() {
+            return bean.getServiceRefArray();
+        }
+
+
+        public ServiceRefType addNewServiceRef() {
+            return bean.addNewServiceRef();
+        }
+
+
+        public ResourceRefType[] getResourceRefArray() {
+            return bean.getResourceRefArray();
+        }
+
+
+        public ResourceRefType addNewResourceRef() {
+            return bean.addNewResourceRef();
+        }
+
+
+        public MessageDestinationRefType[] getMessageDestinationRefArray() {
+            return bean.getMessageDestinationRefArray();
+        }
+
+
+        public MessageDestinationRefType addNewMessageDestinationRef() {
+            return bean.addNewMessageDestinationRef();
+        }
+
+
+        public ResourceEnvRefType[] getResourceEnvRefArray() {
+            return bean.getResourceEnvRefArray();
+        }
+
+
+        public ResourceEnvRefType addNewResourceEnvRef() {
+            return bean.addNewResourceEnvRef();
+        }
+
+
+        public String toString() {
+            return bean.xmlText();
+        }
+
+        public List<EjbRefType> getAmbiguousEjbRefs() {
+            throw new AssertionError("don't call this");
+        }
+
+
+        public LifecycleCallbackType[] getPostConstructArray() {
+            return bean.getPostConstructArray();
+        }
+
+
+        public LifecycleCallbackType addPostConstruct() {
+            return bean.addNewPostConstruct();
+        }
+
+
+        public LifecycleCallbackType[] getPreDestroyArray() {
+            return bean.getPreDestroyArray();
+        }
+
+
+        public LifecycleCallbackType addPreDestroy() {
+            return bean.addNewPreDestroy();
+        }
     }
 
-    public LifecycleCallbackType addPreDestroy() {
-        return null;
+    public static class SessionBean implements AnnotatedApp {
+        private final SessionBeanType bean;
+
+
+        public SessionBean(SessionBeanType bean) {
+            this.bean = bean;
+        }
+
+
+        public EjbLocalRefType[] getEjbLocalRefArray() {
+            return bean.getEjbLocalRefArray();
+        }
+
+
+        public EjbLocalRefType addNewEjbLocalRef() {
+            return bean.addNewEjbLocalRef();
+        }
+
+
+        public EjbRefType[] getEjbRefArray() {
+            return bean.getEjbRefArray();
+        }
+
+
+        public EjbRefType addNewEjbRef() {
+            return bean.addNewEjbRef();
+        }
+
+
+        public EnvEntryType[] getEnvEntryArray() {
+            return bean.getEnvEntryArray();
+        }
+
+
+        public EnvEntryType addNewEnvEntry() {
+            return bean.addNewEnvEntry();
+        }
+
+
+        public ServiceRefType[] getServiceRefArray() {
+            return bean.getServiceRefArray();
+        }
+
+
+        public ServiceRefType addNewServiceRef() {
+            return bean.addNewServiceRef();
+        }
+
+
+        public ResourceRefType[] getResourceRefArray() {
+            return bean.getResourceRefArray();
+        }
+
+
+        public ResourceRefType addNewResourceRef() {
+            return bean.addNewResourceRef();
+        }
+
+
+        public MessageDestinationRefType[] getMessageDestinationRefArray() {
+            return bean.getMessageDestinationRefArray();
+        }
+
+
+        public MessageDestinationRefType addNewMessageDestinationRef() {
+            return bean.addNewMessageDestinationRef();
+        }
+
+
+        public ResourceEnvRefType[] getResourceEnvRefArray() {
+            return bean.getResourceEnvRefArray();
+        }
+
+
+        public ResourceEnvRefType addNewResourceEnvRef() {
+            return bean.addNewResourceEnvRef();
+        }
+
+
+        public String toString() {
+            return bean.xmlText();
+        }
+
+        public List<EjbRefType> getAmbiguousEjbRefs() {
+            throw new AssertionError("don't call this");
+        }
+
+
+        public LifecycleCallbackType[] getPostConstructArray() {
+            return bean.getPostConstructArray();
+        }
+
+
+        public LifecycleCallbackType addPostConstruct() {
+            return bean.addNewPostConstruct();
+        }
+
+
+        public LifecycleCallbackType[] getPreDestroyArray() {
+            return bean.getPreDestroyArray();
+        }
+
+
+        public LifecycleCallbackType addPreDestroy() {
+            return bean.addNewPreDestroy();
+        }
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java?view=diff&rev=516815&r1=516814&r2=516815
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java
Sat Mar 10 16:20:58 2007
@@ -257,17 +257,15 @@
         //------------------------------------------------------------------------------------------
         boolean exists = false;
         ServiceRefType[] serviceRefs = annotatedApp.getServiceRefArray();
-        if (serviceRefs != null){
-            for ( ServiceRefType serviceRef : serviceRefs ) {
-                if ( serviceRef.getServiceRefName().getStringValue().trim().equals(webServiceRefName)
) {
-                    if (method != null || field != null) {
-                        InjectionTargetType[] targets = serviceRef.getInjectionTargetArray();
-                        if (!hasTarget(method, field, targets)) {
-                            configureInjectionTarget(serviceRef.addNewInjectionTarget(),
method, field);
-                        }
+        for ( ServiceRefType serviceRef : serviceRefs ) {
+            if ( serviceRef.getServiceRefName().getStringValue().trim().equals(webServiceRefName)
) {
+                if (method != null || field != null) {
+                    InjectionTargetType[] targets = serviceRef.getInjectionTargetArray();
+                    if (!hasTarget(method, field, targets)) {
+                        configureInjectionTarget(serviceRef.addNewInjectionTarget(), method,
field);
                     }
-                    return;
                 }
+                return;
             }
         }
         if ( !exists ) {

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java?view=diff&rev=516815&r1=516814&r2=516815
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbDeploymentBuilder.java
Sat Mar 10 16:20:58 2007
@@ -32,6 +32,7 @@
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedEjbJar;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -262,7 +263,7 @@
     }
 
     private void addEnc(GBeanData gbean, XmlObject xmlbeansEjb, ResourceRefType[] resourceRefs)
throws DeploymentException {
-        OpenejbGeronimoEjbJarType geronimoOpenejb = (OpenejbGeronimoEjbJarType) ejbModule.getVendorDD();
+        OpenejbGeronimoEjbJarType geronimoOpenejb = ejbModule.getVendorDD();
 
         //
         // Build ENC
@@ -271,6 +272,7 @@
         // Geronimo uses a map to pass data to the naming build and for the results data
         Map<Object,Object> buildingContext = new HashMap<Object,Object>();
         buildingContext.put(NamingBuilder.GBEAN_NAME_KEY, gbean.getAbstractName());
+        ((AnnotatedEjbJar)ejbModule.getAnnotatedApp()).setBean(xmlbeansEjb);
 
         namingBuilder.buildNaming(xmlbeansEjb,
                 geronimoOpenejb,



Mime
View raw message