geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r513564 [1/3] - in /geronimo/server/trunk/modules: geronimo-axis-builder/src/test/java/org/apache/geronimo/axis/builder/ geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/ geronimo-connector-builder/src/main/java/org/...
Date Fri, 02 Mar 2007 00:49:52 GMT
Author: djencks
Date: Thu Mar  1 16:49:50 2007
New Revision: 513564

URL: http://svn.apache.org/viewvc?view=rev&rev=513564
Log:
GERONIMO-2893 Progress towards better annotation support

Added:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java   (with props)
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java   (with props)
Modified:
    geronimo/server/trunk/modules/geronimo-axis-builder/src/test/java/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
    geronimo/server/trunk/modules/geronimo-client-builder/src/main/java/org/apache/geronimo/client/builder/AppClientModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/EJBAnnotationHelper.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/ResourceAnnotationHelper.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13NakedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder13Test.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14AltDDTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14AltDDUnpackedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14NakedUnpackedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14Test.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder14UnpackedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5AltDDTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5AltDDUnpackedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5NakedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5NakedUnpackedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5Test.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder5UnpackedTest.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockConnectorConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockEJBConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/MockWARConfigBuilder.java
    geronimo/server/trunk/modules/geronimo-jetty6-builder/src/main/java/org/apache/geronimo/jetty6/deployment/JettyModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModule.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
    geronimo/server/trunk/modules/geronimo-tomcat6-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/server/trunk/modules/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java

Modified: geronimo/server/trunk/modules/geronimo-axis-builder/src/test/java/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis-builder/src/test/java/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis-builder/src/test/java/org/apache/geronimo/axis/builder/ServiceReferenceTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis-builder/src/test/java/org/apache/geronimo/axis/builder/ServiceReferenceTest.java Thu Mar  1 16:49:50 2007
@@ -119,7 +119,7 @@
 
         File moduleLocation = new File(tmpbasedir, "ejb");
         moduleLocation.mkdirs();
-        module = new EJBModule(true, moduleName, environment, new UnpackedJarFile(moduleLocation), "ejb", null, null, null, null);
+        module = new EJBModule(true, moduleName, environment, new UnpackedJarFile(moduleLocation), "ejb", null, null, null, null, null);
 
         runExternalWSTest = System.getProperty("geronimo.run.external.webservicetest", "false").equals("true");
     }

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=513564&r1=513563&r2=513564
==============================================================================
--- 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 Mar  1 16:49:50 2007
@@ -24,12 +24,12 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.HashMap;
-import java.util.List;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
@@ -56,24 +56,25 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.SingleElementCollection;
+import org.apache.geronimo.j2ee.annotation.Injection;
 import org.apache.geronimo.j2ee.deployment.AppClientModule;
+import org.apache.geronimo.j2ee.deployment.ConnectorModule;
+import org.apache.geronimo.j2ee.deployment.CorbaGBeanNameSource;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.deployment.ModuleBuilder;
-import org.apache.geronimo.j2ee.deployment.SecurityBuilder;
-import org.apache.geronimo.j2ee.deployment.CorbaGBeanNameSource;
 import org.apache.geronimo.j2ee.deployment.NamingBuilder;
 import org.apache.geronimo.j2ee.deployment.NamingBuilderCollection;
-import org.apache.geronimo.j2ee.deployment.ConnectorModule;
+import org.apache.geronimo.j2ee.deployment.SecurityBuilder;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApplicationClient;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.j2ee.management.impl.J2EEAppClientModuleImpl;
-import org.apache.geronimo.j2ee.annotation.Injection;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.repository.Repository;
@@ -85,9 +86,9 @@
 import org.apache.geronimo.xbeans.geronimo.naming.GerAbstractNamingEntryDocument;
 import org.apache.geronimo.xbeans.javaee.ApplicationClientDocument;
 import org.apache.geronimo.xbeans.javaee.ApplicationClientType;
+import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlCursor;
 
 
 /**
@@ -326,7 +327,10 @@
             resourceModules.add(connectorModule);
         }
 
-        return new AppClientModule(standAlone, moduleName, clientBaseName, serverEnvironment, clientEnvironment, moduleFile, targetPath, appClient, mainClass, gerAppClient, specDD, resourceModules);
+        // Create the AnnotatedApp interface for the AppClientModule
+        AnnotatedApplicationClient annotatedApplicationClient = new AnnotatedApplicationClient(appClient);
+
+        return new AppClientModule(standAlone, moduleName, clientBaseName, serverEnvironment, clientEnvironment, moduleFile, targetPath, appClient, mainClass, gerAppClient, specDD, resourceModules, annotatedApplicationClient);
     }
 
     GerApplicationClientType getGeronimoAppClient(Object plan, JarFile moduleFile, boolean standAlone, String targetPath, ApplicationClientType appClient, Environment environment) throws DeploymentException {
@@ -420,7 +424,7 @@
                 XmlBeansUtil.validateDD(result);
                 return (ApplicationClientDocument) result;
             }
-            
+
             // otherwise assume DTD
             SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
             cursor.toStartDoc();

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Thu Mar  1 16:49:50 2007
@@ -79,6 +79,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.ActivationSpecInfoLocator;
 import org.apache.geronimo.j2ee.deployment.ConnectorModule;
 import org.apache.geronimo.j2ee.deployment.EARContext;
@@ -98,17 +99,7 @@
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.reference.ResourceReference;
 import org.apache.geronimo.schema.SchemaConversionUtils;
-import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType;
-import org.apache.geronimo.xbeans.geronimo.GerAdminobjectType;
-import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
-import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
-import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
-import org.apache.geronimo.xbeans.geronimo.GerConnectionmanagerType;
-import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
-import org.apache.geronimo.xbeans.geronimo.GerConnectorType;
-import org.apache.geronimo.xbeans.geronimo.GerPartitionedpoolType;
-import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
-import org.apache.geronimo.xbeans.geronimo.GerSinglepoolType;
+import org.apache.geronimo.xbeans.geronimo.*;
 import org.apache.geronimo.xbeans.j2ee.ActivationspecType;
 import org.apache.geronimo.xbeans.j2ee.AdminobjectType;
 import org.apache.geronimo.xbeans.j2ee.ConfigPropertyType;
@@ -263,7 +254,9 @@
         }
 
         boolean standAlone = earEnvironment == null;
-        return new ConnectorModule(standAlone, moduleName, environment, moduleFile, targetPath, connector, gerConnector, specDD);
+        AnnotatedApp annotatedApp = null;
+        return new ConnectorModule(standAlone, moduleName, environment, moduleFile, targetPath, connector, gerConnector, specDD, annotatedApp);
+
     }
 
     static ConnectorDocument convertToConnectorSchema(XmlObject xmlObject) throws XmlException {

Modified: geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java (original)
+++ geronimo/server/trunk/modules/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/MessageDestinationTest.java Thu Mar  1 16:49:50 2007
@@ -76,7 +76,7 @@
                 new ConfigurationData(id, naming),
                 new ConfigurationResolver(id, null),
                 null);
-        module  = new ConnectorModule(false, new AbstractName(id, Collections.singletonMap("name", "test")), null, null, "foo", null, null, null);
+        module  = new ConnectorModule(false, new AbstractName(id, Collections.singletonMap("name", "test")), null, null, "foo", null, null, null, null);
         EARContext earContext = new EARContext(new File("foo"), null, new Environment(new Artifact("foo", "bar", "1.0", "car")), ConfigurationModuleType.EAR, naming,
                 new ConfigurationManager() {
                     public boolean isInstalled(Artifact configurationId) {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/AppClientModule.java Thu Mar  1 16:49:50 2007
@@ -26,6 +26,7 @@
 
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApplicationClient;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xmlbeans.XmlObject;
@@ -41,8 +42,8 @@
     private final Collection resourceModules;
 
 
-    public AppClientModule(boolean standAlone, AbstractName moduleName, AbstractName appClientName, Environment serverEnvironment, Environment clientEnvironment, JarFile moduleFile, String targetPath, XmlObject specDD, String mainClassName, XmlObject vendorDD, String originalSpecDD, Collection resourceModules) {
-        super(standAlone, moduleName, serverEnvironment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null, new HashMap());
+    public AppClientModule(boolean standAlone, AbstractName moduleName, AbstractName appClientName, Environment serverEnvironment, Environment clientEnvironment, JarFile moduleFile, String targetPath, XmlObject specDD, String mainClassName, XmlObject vendorDD, String originalSpecDD, Collection resourceModules, AnnotatedApplicationClient annotatedAppClient ) {
+        super(standAlone, moduleName, serverEnvironment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null, new HashMap(), annotatedAppClient );
         this.clientEnvironment = clientEnvironment;
         this.appClientName = appClientName;
         this.mainClassName = mainClassName;

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/ConnectorModule.java Thu Mar  1 16:49:50 2007
@@ -24,6 +24,7 @@
 
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xmlbeans.XmlObject;
@@ -32,8 +33,8 @@
  * @version $Rev$ $Date$
  */
 public class ConnectorModule extends Module {
-    public ConnectorModule(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD) {
-        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null, new HashMap());
+    public ConnectorModule(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, AnnotatedApp annotatedApp ) {
+        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null, new HashMap(), annotatedApp );
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EJBModule.java Thu Mar  1 16:49:50 2007
@@ -24,6 +24,7 @@
 
 import org.apache.geronimo.deployment.DeploymentContext;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xmlbeans.XmlObject;
@@ -34,8 +35,8 @@
 public class EJBModule extends Module {
     private AbstractName moduleCmpEngineName;
 
-    public EJBModule(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, Map sharedContext) {
-        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null, sharedContext);
+    public EJBModule(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, Map sharedContext, AnnotatedApp annoatedApp) {
+        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null, sharedContext, annoatedApp);
     }
 
     public ConfigurationModuleType getType() {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java Thu Mar  1 16:49:50 2007
@@ -25,6 +25,7 @@
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 
 /**
  * @version $Rev$ $Date$
@@ -46,10 +47,11 @@
     private EARContext rootEarContext;
     private XmlObject specDD;
     private String originalSpecDD;
+    private AnnotatedApp annotatedApp;
 
     protected final Map sharedContext;
 
-    protected Module(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, String namespace, Map sharedContext) {
+    protected Module(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, String namespace, Map sharedContext, AnnotatedApp annotatedApp) {
         assert targetPath != null: "targetPath is null";
         assert moduleName != null: "moduleName is null";
 
@@ -73,6 +75,7 @@
 
         targetPathURI = URI.create(targetPath + "/");
         this.sharedContext = sharedContext;
+        this.annotatedApp = annotatedApp;
     }
 
     public abstract ConfigurationModuleType getType();
@@ -171,5 +174,13 @@
 
     public void setOriginalSpecDD(String originalSpecDD) {
         this.originalSpecDD = originalSpecDD;
+    }
+
+    public AnnotatedApp getAnnotatedApp() {
+        return annotatedApp;
+    }
+
+    public void setAnnotatedApp(AnnotatedApp annotatedApp) {
+        this.annotatedApp = annotatedApp;
     }
 }

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/WebModule.java Thu Mar  1 16:49:50 2007
@@ -20,6 +20,7 @@
 import java.util.jar.JarFile;
 
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedWebApp;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.xmlbeans.XmlObject;
@@ -30,8 +31,8 @@
 public class WebModule extends Module {
     private final String contextRoot;
 
-    public WebModule(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, String contextRoot, Map sharedContext, String namespace) {
-        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, namespace, sharedContext);
+    public WebModule(boolean standAlone, AbstractName moduleName, Environment environment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, String contextRoot, Map sharedContext, String namespace, AnnotatedWebApp annotatedWebApp) {
+        super(standAlone, moduleName, environment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, namespace, sharedContext, annotatedWebApp );
         this.contextRoot = contextRoot;
     }
 

Added: 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=auto&rev=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java Thu Mar  1 16:49:50 2007
@@ -0,0 +1,118 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment.annotation;
+
+import java.util.List;
+
+import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
+import org.apache.geronimo.xbeans.javaee.EjbRefType;
+import org.apache.geronimo.xbeans.javaee.EnvEntryType;
+import org.apache.geronimo.xbeans.javaee.MessageDestinationRefType;
+import org.apache.geronimo.xbeans.javaee.ResourceEnvRefType;
+import org.apache.geronimo.xbeans.javaee.ResourceRefType;
+import org.apache.geronimo.xbeans.javaee.ServiceRefType;
+
+/**
+ * Many of the classes generated from the JEE schemas have methods with identical signatures (see
+ * examples below). This interface can be used to encapsulate those methods so that the various
+ * AnnotationHelper classes can use the same code for multiple application types (e.g. WebAppType,
+ * ApplicationClientType, etc).
+ * <p/>
+ * <p><strong>Example(s):</strong>
+ * <pre>
+ *      public interface ApplicationClientType extends org.apache.xmlbeans.XmlObject {
+ *          org.apache.geronimo.xbeans.javaee.EnvEntryType[] getEnvEntryArray();
+ *          org.apache.geronimo.xbeans.javaee.ResourceRefType[] getResourceRefArray();
+ *      }
+ * <p/>
+ *      public interface WebAppType extends org.apache.xmlbeans.XmlObject {
+ *          org.apache.geronimo.xbeans.javaee.EnvEntryType[] getEnvEntryArray();
+ *          org.apache.geronimo.xbeans.javaee.ResourceRefType[] getResourceRefArray();
+ *      }
+ * </pre>
+ * <p/>
+ * <p><strong>Remaining ToDo(s):</strong>
+ * <ul>
+ * <li>None
+ * </ul>
+ *
+ * @version $Rev $Date
+ * @since Geronimo 2.0
+ */
+public interface AnnotatedApp {
+
+    // Instance variables
+    List<EjbRefType> ambiguousEjbRefs = null;
+
+    /**
+     * XmlBeans methods used for the @EJB, @EJBs annotations
+     */
+    EjbLocalRefType[] getEjbLocalRefArray();
+
+    EjbLocalRefType addNewEjbLocalRef();
+
+    EjbRefType[] getEjbRefArray();
+
+    EjbRefType addNewEjbRef();
+
+
+    /**
+     * XmlBeans methods used for the @Resource, @Resources annotations
+     */
+    EnvEntryType[] getEnvEntryArray();
+
+    EnvEntryType addNewEnvEntry();
+
+    ServiceRefType[] getServiceRefArray();
+
+    ServiceRefType addNewServiceRef();
+
+    ResourceRefType[] getResourceRefArray();
+
+    ResourceRefType addNewResourceRef();
+
+    MessageDestinationRefType[] getMessageDestinationRefArray();
+
+    MessageDestinationRefType addNewMessageDestinationRef();
+
+    ResourceEnvRefType[] getResourceEnvRefArray();
+
+    ResourceEnvRefType addNewResourceEnvRef();
+
+
+    /**
+     * ApplicationType getter in string format
+     *
+     * @return String representation of ApplicationType
+     */
+    String toString();
+
+
+    /**
+     * ambiguousRefs getter
+     * <p/>
+     * <p>There is no corresponding setter method. To add a new item to the list do this:
+     * <p/>
+     * <pre>
+     *    getAmbiguousEjbRefs().add(ejbRef);
+     * </pre>
+     *
+     * @return ambiguousRefs list
+     */
+    List<EjbRefType> getAmbiguousEjbRefs();
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApp.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=auto&rev=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java Thu Mar  1 16:49:50 2007
@@ -0,0 +1,164 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment.annotation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.xbeans.javaee.ApplicationClientType;
+import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
+import org.apache.geronimo.xbeans.javaee.EjbRefType;
+import org.apache.geronimo.xbeans.javaee.EnvEntryType;
+import org.apache.geronimo.xbeans.javaee.MessageDestinationRefType;
+import org.apache.geronimo.xbeans.javaee.ResourceEnvRefType;
+import org.apache.geronimo.xbeans.javaee.ResourceRefType;
+import org.apache.geronimo.xbeans.javaee.ServiceRefType;
+
+/**
+ * Wrapper class to encapsulate the ApplicationClientType class with an interface that the various
+ * AnnotationHelpers can use
+ * <p/>
+ * <p/>
+ * <p><strong>Remaining ToDo(s):</strong>
+ * <ul>
+ * <li>Can AppClients have unresolved EJB references ??
+ * </ul>
+ *
+ * @version $Rev $Date
+ * @since Geronimo 2.0
+ */
+public class AnnotatedApplicationClient implements AnnotatedApp {
+
+    // Private instance variables
+    private static final Log log = LogFactory.getLog(AnnotatedApplicationClient.class);
+    private ApplicationClientType applicationClient;
+    private List<EjbRefType> ambiguousEjbRefs;
+
+    /**
+     * ApplicationClientType-qualified constructor
+     *
+     * @param applicationClient ApplicationClientType
+     */
+    public AnnotatedApplicationClient(ApplicationClientType applicationClient) {
+        this.applicationClient = applicationClient;
+    }
+
+
+    /**
+     * ApplicationClientType methods used for the @EJB, @EJBs annotations
+     */
+    public EjbLocalRefType[] getEjbLocalRefArray() {
+        return null;                                            // Not supported by app clients
+    }
+
+    public EjbLocalRefType addNewEjbLocalRef() {
+        return null;                                            // Not supported by app clients
+    }
+
+    public EjbRefType[] getEjbRefArray() {
+        return applicationClient.getEjbRefArray();
+    }
+
+    public EjbRefType addNewEjbRef() {
+        return applicationClient.addNewEjbRef();
+    }
+
+
+    /**
+     * ApplicationClientType methods used for the @Resource, @Resources annotations
+     */
+    public EnvEntryType[] getEnvEntryArray() {
+        return applicationClient.getEnvEntryArray();
+    }
+
+    public EnvEntryType addNewEnvEntry() {
+        return applicationClient.addNewEnvEntry();
+    }
+
+    public ServiceRefType[] getServiceRefArray() {
+        return applicationClient.getServiceRefArray();
+    }
+
+    public ServiceRefType addNewServiceRef() {
+        return applicationClient.addNewServiceRef();
+    }
+
+    public ResourceRefType[] getResourceRefArray() {
+        return applicationClient.getResourceRefArray();
+    }
+
+    public ResourceRefType addNewResourceRef() {
+        return applicationClient.addNewResourceRef();
+    }
+
+    public MessageDestinationRefType[] getMessageDestinationRefArray() {
+        return applicationClient.getMessageDestinationRefArray();
+    }
+
+    public MessageDestinationRefType addNewMessageDestinationRef() {
+        return applicationClient.addNewMessageDestinationRef();
+    }
+
+    public ResourceEnvRefType[] getResourceEnvRefArray() {
+        return applicationClient.getResourceEnvRefArray();
+    }
+
+    public ResourceEnvRefType addNewResourceEnvRef() {
+        return applicationClient.addNewResourceEnvRef();
+    }
+
+
+    /**
+     * applicationClient getter
+     *
+     * @return String representation of applicationClient
+     */
+    public String toString() {
+        return applicationClient.toString();
+    }
+
+
+    /**
+     * applicationClient getter
+     *
+     * @return applicationClient ApplicationClientType
+     */
+    public ApplicationClientType getApplicationClient() {
+        return applicationClient;
+    }
+
+
+    /**
+     * ambiguousRefs getter
+     * <p/>
+     * <p>There is no corresponding setter method. To add a new item to the list do:
+     * <pre>
+     *    getAmbiguousEjbRefs().add(ejbRef);
+     * </pre>
+     *
+     * @return ambiguousRefs list
+     */
+    public List<EjbRefType> getAmbiguousEjbRefs() {
+        if (ambiguousEjbRefs == null) {
+            ambiguousEjbRefs = new ArrayList<EjbRefType>();
+        }
+        return this.ambiguousEjbRefs;
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedApplicationClient.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=auto&rev=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java Thu Mar  1 16:49:50 2007
@@ -0,0 +1,163 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment.annotation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.EnvEntryType;
+import org.apache.geronimo.xbeans.javaee.MessageDestinationRefType;
+import org.apache.geronimo.xbeans.javaee.ResourceEnvRefType;
+import org.apache.geronimo.xbeans.javaee.ResourceRefType;
+import org.apache.geronimo.xbeans.javaee.ServiceRefType;
+
+/**
+ * Wrapper class to encapsulate the EjbJarType class with an interface that the various
+ * AnnotationHelpers can use
+ * <p/>
+ * <p><strong>Remaining ToDo(s):</strong>
+ * <ul>
+ * <li>None
+ * </ul>
+ *
+ * @version $Rev $Date
+ * @since Geronimo 2.0
+ */
+public class AnnotatedEjbJar implements AnnotatedApp {
+
+    // Private instance variables
+    private static final Log log = LogFactory.getLog(AnnotatedEjbJar.class);
+    private EjbJarType ejbJar;
+    private List<EjbRefType> ambiguousEjbRefs;
+
+    /**
+     * EjbJarType-qualified constructor
+     *
+     * @param ejbJar EjbJarType
+     */
+    public AnnotatedEjbJar(EjbJarType ejbJar) {
+        this.ejbJar = ejbJar;
+    }
+
+
+    /**
+     * EjbJarType methods used for the @EJB, @EJBs annotations
+     */
+    public EjbLocalRefType[] getEjbLocalRefArray() {
+        return null;
+    }
+
+    public EjbLocalRefType addNewEjbLocalRef() {
+        return null;
+    }
+
+    public EjbRefType[] getEjbRefArray() {
+        return null;
+    }
+
+    public EjbRefType addNewEjbRef() {
+        return null;
+    }
+
+
+    /**
+     * EjbJarType methods used for the @Resource, @Resources annotations
+     */
+    public EnvEntryType[] getEnvEntryArray() {
+        return null;
+    }
+
+    public EnvEntryType addNewEnvEntry() {
+        return null;
+    }
+
+    public ServiceRefType[] getServiceRefArray() {
+        return null;
+    }
+
+    public ServiceRefType addNewServiceRef() {
+        return null;
+    }
+
+    public ResourceRefType[] getResourceRefArray() {
+        return null;
+    }
+
+    public ResourceRefType addNewResourceRef() {
+        return null;
+    }
+
+    public MessageDestinationRefType[] getMessageDestinationRefArray() {
+        return null;
+    }
+
+    public MessageDestinationRefType addNewMessageDestinationRef() {
+        return null;
+    }
+
+    public ResourceEnvRefType[] getResourceEnvRefArray() {
+        return null;
+    }
+
+    public ResourceEnvRefType addNewResourceEnvRef() {
+        return null;
+    }
+
+
+    /**
+     * ejbJar getter
+     *
+     * @return String representation of ejbJar
+     */
+    public String toString() {
+        return ejbJar.toString();
+    }
+
+
+    /**
+     * ejbJar getter
+     *
+     * @return ejbJar EjbJarType
+     */
+    public EjbJarType getEjbJar() {
+        return ejbJar;
+    }
+
+
+    /**
+     * ambiguousRefs getter
+     * <p/>
+     * <p>There is no corresponding setter method. To add a new item to the list do:
+     * <pre>
+     *    getAmbiguousEjbRefs().add(ejbRef);
+     * </pre>
+     *
+     * @return ambiguousRefs list
+     */
+    public List<EjbRefType> getAmbiguousEjbRefs() {
+        if (ambiguousEjbRefs == null) {
+            ambiguousEjbRefs = new ArrayList<EjbRefType>();
+        }
+        return this.ambiguousEjbRefs;
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedEjbJar.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=auto&rev=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java (added)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java Thu Mar  1 16:49:50 2007
@@ -0,0 +1,165 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.j2ee.deployment.annotation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
+import org.apache.geronimo.xbeans.javaee.EjbRefType;
+import org.apache.geronimo.xbeans.javaee.EnvEntryType;
+import org.apache.geronimo.xbeans.javaee.MessageDestinationRefType;
+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.WebAppType;
+
+/**
+ * Wrapper class to encapsulate the WebAppType class with an interface that the various
+ * AnnotationHelpers can use
+ * <p/>
+ * <p><strong>Remaining ToDo(s):</strong>
+ * <ul>
+ * <li>None
+ * </ul>
+ *
+ * @version $Rev $Date
+ * @since Geronimo 2.0
+ */
+public class AnnotatedWebApp implements AnnotatedApp {
+
+    // Private instance variables
+    private static final Log log = LogFactory.getLog(AnnotatedWebApp.class);
+    private WebAppType webApp;
+
+    // Protected instance variables
+    protected List<EjbRefType> ambiguousEjbRefs;
+
+    /**
+     * WebAppType-qualified constructor
+     *
+     * @param webApp WebAppType
+     */
+    public AnnotatedWebApp(WebAppType webApp) {
+        this.webApp = webApp;
+    }
+
+
+    /**
+     * WebAppType methods used for the @EJB, @EJBs annotations
+     */
+    public EjbLocalRefType[] getEjbLocalRefArray() {
+        return webApp.getEjbLocalRefArray();
+    }
+
+    public EjbLocalRefType addNewEjbLocalRef() {
+        return webApp.addNewEjbLocalRef();
+    }
+
+    public EjbRefType[] getEjbRefArray() {
+        return webApp.getEjbRefArray();
+    }
+
+    public EjbRefType addNewEjbRef() {
+        return webApp.addNewEjbRef();
+    }
+
+
+    /**
+     * WebAppType methods used for the @Resource, @Resources annotations
+     */
+    public EnvEntryType[] getEnvEntryArray() {
+        return webApp.getEnvEntryArray();
+    }
+
+    public EnvEntryType addNewEnvEntry() {
+        return webApp.addNewEnvEntry();
+    }
+
+    public ServiceRefType[] getServiceRefArray() {
+        return webApp.getServiceRefArray();
+    }
+
+    public ServiceRefType addNewServiceRef() {
+        return webApp.addNewServiceRef();
+    }
+
+    public ResourceRefType[] getResourceRefArray() {
+        return webApp.getResourceRefArray();
+    }
+
+    public ResourceRefType addNewResourceRef() {
+        return webApp.addNewResourceRef();
+    }
+
+    public MessageDestinationRefType[] getMessageDestinationRefArray() {
+        return webApp.getMessageDestinationRefArray();
+    }
+
+    public MessageDestinationRefType addNewMessageDestinationRef() {
+        return webApp.addNewMessageDestinationRef();
+    }
+
+    public ResourceEnvRefType[] getResourceEnvRefArray() {
+        return webApp.getResourceEnvRefArray();
+    }
+
+    public ResourceEnvRefType addNewResourceEnvRef() {
+        return webApp.addNewResourceEnvRef();
+    }
+
+
+    /**
+     * webApp getter
+     *
+     * @return String representation of webApp
+     */
+    public String toString() {
+        return webApp.toString();
+    }
+
+
+    /**
+     * webApp getter
+     *
+     * @return webApp WebAppType
+     */
+    public WebAppType getWebApp() {
+        return webApp;
+    }
+
+
+    /**
+     * ambiguousRefs getter
+     * <p/>
+     * <p>There is no corresponding setter method. To add a new item to the list do:
+     * <pre>
+     *    getAmbiguousEjbRefs().add(ejbRef);
+     * </pre>
+     *
+     * @return ambiguousRefs list
+     */
+    public List<EjbRefType> getAmbiguousEjbRefs() {
+        if (ambiguousEjbRefs == null) {
+            ambiguousEjbRefs = new ArrayList<EjbRefType>();
+        }
+        return this.ambiguousEjbRefs;
+    }
+}

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotatedWebApp.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/EJBAnnotationHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/EJBAnnotationHelper.java?view=diff&rev=513564&r1=513563&r2=513564
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/EJBAnnotationHelper.java (original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/EJBAnnotationHelper.java Thu Mar  1 16:49:50 2007
@@ -22,13 +22,11 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
 
 import javax.ejb.EJB;
-import javax.ejb.EJBs;
 import javax.ejb.EJBHome;
 import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBs;
 import javax.ejb.Local;
 import javax.ejb.Remote;
 
@@ -36,26 +34,23 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.xbeans.javaee.DescriptionType;
-import org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee.JavaIdentifierType;
 import org.apache.geronimo.xbeans.javaee.EjbLinkType;
 import org.apache.geronimo.xbeans.javaee.EjbLocalRefType;
 import org.apache.geronimo.xbeans.javaee.EjbRefNameType;
 import org.apache.geronimo.xbeans.javaee.EjbRefType;
+import org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType;
 import org.apache.geronimo.xbeans.javaee.InjectionTargetType;
+import org.apache.geronimo.xbeans.javaee.JavaIdentifierType;
 import org.apache.geronimo.xbeans.javaee.LocalType;
 import org.apache.geronimo.xbeans.javaee.RemoteType;
-import org.apache.geronimo.xbeans.javaee.WebAppType;
 import org.apache.geronimo.xbeans.javaee.XsdStringType;
 import org.apache.xbean.finder.ClassFinder;
 
 /**
  * Static helper class used to encapsulate all the functions related to the translation of
- *
- * @version $Rev$ $Date$
- * @EJB and @EBJs annotations to deployment descriptor tags. The EJBAnnotationHelper class can be
- * used as part of the deployment of a module into the Geronimo server. It performs the following
- * major functions:
+ * <strong>@EJB</strong> and <strong>@EJBs</strong> annotations to deployment descriptor tags. The
+ * EJBAnnotationHelper class can be used as part of the deployment of a module into the Geronimo
+ * server. It performs the following major functions:
  * <p/>
  * <ol>
  * <li>Translates annotations into corresponding deployment descriptor elements (so that the
@@ -71,10 +66,13 @@
  * <p/>
  * <p><strong>Remaining ToDo(s):</strong>
  * <ul>
- * <li>How to determine Session/Entity remote/local for @EJB
+ * <li>None
  * </ul>
+ *
+ * @version $Rev$ $Date$
  * @since 02-2007
  */
+
 public final class EJBAnnotationHelper {
 
     // Private instance variables
@@ -103,47 +101,22 @@
      * @return Updated deployment descriptor
      * @throws Exception if parsing or validation error
      */
-    public static WebAppType processAnnotations(WebAppType webApp, ClassFinder classFinder, ClassFinder ejbFinder) throws Exception {
-        Set<Class> remotes = extractRemotes(ejbFinder);
-        Set<Class> locals = extractLocals(ejbFinder);
-        processEJBs(webApp, classFinder, remotes, locals);
-        processEJB(webApp, classFinder, remotes, locals);
-        return webApp;
-    }
-
-    private static Set<Class> extractRemotes(ClassFinder classFinder) {
-        List<Class> classesWithRemote = classFinder.findAnnotatedClasses(Remote.class);
-        Set<Class> remotes = new HashSet<Class>();
-        for (Class clazz : classesWithRemote) {
-            Remote remoteAnnotation = (Remote) clazz.getAnnotation(Remote.class);
-            for (Class remote : remoteAnnotation.value()) {
-                remotes.add(remote);
-            }
-        }
-        return remotes;
-    }
-
-    private static Set<Class> extractLocals(ClassFinder classFinder) {
-        List<Class> classesWithLocal = classFinder.findAnnotatedClasses(Local.class);
-        Set<Class> locals = new HashSet<Class>();
-        for (Class clazz : classesWithLocal) {
-            Local localAnnotation = (Local) clazz.getAnnotation(Local.class);
-            for (Class local : localAnnotation.value()) {
-                locals.add(local);
-            }
+    public static void processAnnotations(AnnotatedApp annotatedApp, ClassFinder classFinder) throws Exception {
+        if (annotatedApp != null) {
+            processEJBs(annotatedApp, classFinder);
+            processEJB(annotatedApp, classFinder);
         }
-        return locals;
     }
 
 
     /**
      * Process @EJB annotations
      *
-     * @param webApp
+     * @param annotatedApp
      * @param classFinder
      * @throws Exception
      */
-    private static void processEJB(WebAppType webApp, ClassFinder classFinder, Set<Class> remotes, Set<Class> locals) throws Exception {
+    private static void processEJB(AnnotatedApp annotatedApp, ClassFinder classFinder) throws Exception {
         log.debug("processEJB(): Entry");
 
         // Save the EJB lists
@@ -155,7 +128,7 @@
         for (Class cls : classesWithEJB) {
             EJB ejb = (EJB) cls.getAnnotation(EJB.class);
             if (ejb != null) {
-                addEJB(webApp, ejb, cls, null, null, remotes, locals);
+                addEJB(annotatedApp, ejb, cls, null, null);
             }
         }
 
@@ -163,7 +136,7 @@
         for (Method method : methodsWithEJB) {
             EJB ejb = (EJB) method.getAnnotation(EJB.class);
             if (ejb != null) {
-                addEJB(webApp, ejb, null, method, null, remotes, locals);
+                addEJB(annotatedApp, ejb, null, method, null);
             }
         }
 
@@ -171,25 +144,25 @@
         for (Field field : fieldsWithEJB) {
             EJB ejb = (EJB) field.getAnnotation(EJB.class);
             if (ejb != null) {
-                addEJB(webApp, ejb, null, null, field, remotes, locals);
+                addEJB(annotatedApp, ejb, null, null, field);
             }
         }
 
         // Validate deployment descriptor to ensure it's still okay
-        validateDD(webApp);
+        validateDD(annotatedApp);
 
-        log.debug("processEJB(): Exit: webApp: " + webApp.toString());
+        log.debug("processEJB(): Exit: AnnotatedApp: " + annotatedApp.toString());
     }
 
 
     /**
      * Process @EJBs annotations
      *
-     * @param webApp
+     * @param annotatedApp
      * @param classFinder
      * @throws Exception
      */
-    private static void processEJBs(WebAppType webApp, ClassFinder classFinder, Set<Class> remotes, Set<Class> locals) throws Exception {
+    private static void processEJBs(AnnotatedApp annotatedApp, ClassFinder classFinder) throws Exception {
         log.debug("processEJBs(): Entry");
 
         // Save the EJBs list
@@ -203,7 +176,7 @@
                 ejbList.addAll(Arrays.asList(ejbs.value()));
             }
             for (EJB ejb : ejbList) {
-                addEJB(webApp, ejb, cls, null, null, remotes, locals);
+                addEJB(annotatedApp, ejb, cls, null, null);
             }
             ejbList.clear();
         }
@@ -215,7 +188,8 @@
     /**
      * Add @EJB and @EJBs annotations to the deployment descriptor. XMLBeans are used to read and
      * manipulate the deployment descriptor as necessary. The EJB annotation(s) will be converted to
-     * one of the following deployment descriptors:
+     * one of the following deployment descriptors if possible. Otherwise they will be listed as
+     * ambiguous and resolved in OpenEJB.
      * <p/>
      * <ol>
      * <li><ejb-ref>
@@ -228,21 +202,22 @@
      * existing elements in it are not overwritten by annoations
      * </ul>
      *
-     * @param webApp
-     * @param annotation @EJB annotation
-     * @param cls        Class name with the @EJB annoation
-     * @param method     Method name with the @EJB annoation
-     * @param field      Field name with the @EJB annoation
+     * @param annotatedApp
+     * @param annotation   @EJB annotation
+     * @param cls          Class name with the @EJB annoation
+     * @param method       Method name with the @EJB annoation
+     * @param field        Field name with the @EJB annoation
      */
-    private static void addEJB(WebAppType webApp, EJB annotation, Class cls, Method method, Field field, Set<Class> remotes, Set<Class> locals) {
-        log.debug("addEJB( " + webApp.toString() + "," + '\n' +
+    private static void addEJB(AnnotatedApp annotatedApp, EJB annotation, Class cls, Method method, Field field) {
+        log.debug("addEJB( " + annotatedApp.toString() + "," + '\n' +
                 annotation.name() + "," + '\n' +
                 (cls != null ? cls.getName() : null) + "," + '\n' +
                 (method != null ? method.getName() : null) + "," + '\n' +
                 (field != null ? field.getName() : null) + " ): Entry");
 
-        // First determine if the interface is "Local" or "Remote"
-        boolean localFlag = true;
+        // First determine if the interface is "Local" or "Remote" (if we can--we may not be able to)
+        boolean localFlag = false;
+        boolean remoteFlag = false;
         Class interfce = annotation.beanInterface();
         if (interfce.equals(Object.class)) {
             if (method != null) {
@@ -258,14 +233,14 @@
         // they are optional in EJB 3.0)
         if (interfce != null && !interfce.equals(Object.class)) {
             if (EJBHome.class.isAssignableFrom(interfce)) {
-                localFlag = false;
+                remoteFlag = true;
             } else if (EJBLocalHome.class.isAssignableFrom(interfce)) {
                 localFlag = true;
             } else {
-                if (locals.contains(interfce) || interfce.getAnnotation(Local.class) != null) {
+                if (interfce.getAnnotation(Local.class) != null) {
                     localFlag = true;
-                } else if (remotes.contains(interfce) || interfce.getAnnotation(Remote.class) != null) {
-                    localFlag = false;
+                } else if (interfce.getAnnotation(Remote.class) != null) {
+                    remoteFlag = true;
                 }
             }
         }
@@ -278,7 +253,7 @@
             log.debug("addEJB(): <ejb-local-ref> found");
 
             String localRefName = annotation.name();
-            if (localRefName.equals("")) {
+            if (localRefName.trim().equals("")) {
                 if (method != null) {
                     localRefName = method.getDeclaringClass().getName() + "/" + method.getName().substring(3);  // method should start with "set"
                 } else if (field != null) {
@@ -287,9 +262,9 @@
             }
 
             boolean exists = false;
-            EjbLocalRefType[] ejbLocalRefEntries = webApp.getEjbLocalRefArray();
+            EjbLocalRefType[] ejbLocalRefEntries = annotatedApp.getEjbLocalRefArray();
             for (EjbLocalRefType ejbLocalRefEntry : ejbLocalRefEntries) {
-                if (ejbLocalRefEntry.getEjbRefName().getStringValue().equals(localRefName)) {
+                if (ejbLocalRefEntry.getEjbRefName().getStringValue().trim().equals(localRefName)) {
                     exists = true;
                     break;
                 }
@@ -298,14 +273,14 @@
                 try {
 
                     // Doesn't exist in deployment descriptor -- add new
-                    EjbLocalRefType ejbLocalRef = webApp.addNewEjbLocalRef();
+                    EjbLocalRefType ejbLocalRef = annotatedApp.addNewEjbLocalRef();
 
                     //------------------------------------------------------------------------------
                     // <ejb-local-ref> required elements:
                     //------------------------------------------------------------------------------
 
                     // ejb-ref-name
-                    EjbRefNameType ejbRefName = EjbRefNameType.Factory.newInstance();
+                    EjbRefNameType ejbRefName = ejbLocalRef.addNewEjbRefName();
                     ejbRefName.setStringValue(localRefName);
                     ejbLocalRef.setEjbRefName(ejbRefName);
 
@@ -315,58 +290,49 @@
 
                     // local
                     String localAnnotation = interfce.getName();
-                    if (localAnnotation.length() > 0) {
-                        LocalType local = LocalType.Factory.newInstance();
+                    if (!localAnnotation.trim().equals("")) {
+                        LocalType local = ejbLocalRef.addNewLocal();
                         local.setStringValue(localAnnotation);
                         ejbLocalRef.setLocal(local);
                     }
 
                     // ejb-link
                     String beanName = annotation.beanName();
-                    if (beanName.length() > 0) {
-                        EjbLinkType ejbLink = EjbLinkType.Factory.newInstance();
+                    if (!beanName.trim().equals("")) {
+                        EjbLinkType ejbLink = ejbLocalRef.addNewEjbLink();
                         ejbLink.setStringValue(beanName);
                         ejbLocalRef.setEjbLink(ejbLink);
                     }
 
                     // mappedName
                     String mappdedNameAnnotation = annotation.mappedName();
-                    if (mappdedNameAnnotation.length() > 0) {
-                        XsdStringType mappedName = XsdStringType.Factory.newInstance();
+                    if (!mappdedNameAnnotation.trim().equals("")) {
+                        XsdStringType mappedName = ejbLocalRef.addNewMappedName();
                         mappedName.setStringValue(mappdedNameAnnotation);
                         ejbLocalRef.setMappedName(mappedName);
                     }
 
                     // description
                     String descriptionAnnotation = annotation.description();
-                    if (descriptionAnnotation.length() > 0) {
-                        DescriptionType description = DescriptionType.Factory.newInstance();
+                    if (!descriptionAnnotation.trim().equals("")) {
+                        DescriptionType description = ejbLocalRef.addNewDescription();
                         description.setStringValue(descriptionAnnotation);
-                        int arraySize = ejbLocalRef.sizeOfDescriptionArray();
-                        ejbLocalRef.insertNewDescription(arraySize);
-                        ejbLocalRef.setDescriptionArray(arraySize, description);
                     }
 
                     // injectionTarget
-                    InjectionTargetType injectionTarget = InjectionTargetType.Factory.newInstance();
-                    FullyQualifiedClassType qualifiedClass = FullyQualifiedClassType.Factory.newInstance();
-                    JavaIdentifierType javaType = JavaIdentifierType.Factory.newInstance();
+                    InjectionTargetType injectionTarget = ejbLocalRef.addNewInjectionTarget();
+                    FullyQualifiedClassType qualifiedClass = injectionTarget.addNewInjectionTargetClass();
+                    JavaIdentifierType javaType = injectionTarget.addNewInjectionTargetName();
                     if (method != null) {
                         qualifiedClass.setStringValue(method.getDeclaringClass().getName());
                         javaType.setStringValue(method.getName().substring(3));   // method should start with "set"
                         injectionTarget.setInjectionTargetClass(qualifiedClass);
                         injectionTarget.setInjectionTargetName(javaType);
-                        int arraySize = ejbLocalRef.sizeOfInjectionTargetArray();
-                        ejbLocalRef.insertNewInjectionTarget(arraySize);
-                        ejbLocalRef.setInjectionTargetArray(arraySize, injectionTarget);
                     } else if (field != null) {
                         qualifiedClass.setStringValue(field.getDeclaringClass().getName());
                         javaType.setStringValue(field.getName());
                         injectionTarget.setInjectionTargetClass(qualifiedClass);
                         injectionTarget.setInjectionTargetName(javaType);
-                        int arraySize = ejbLocalRef.sizeOfInjectionTargetArray();
-                        ejbLocalRef.insertNewInjectionTarget(arraySize);
-                        ejbLocalRef.setInjectionTargetArray(arraySize, injectionTarget);
                     }
 
                 }
@@ -376,7 +342,7 @@
                 }
             }
         }                                                                           // end if local
-        else {                                                                      // else remote
+        else if (remoteFlag) {                                                      // remote
 
             //--------------------------------------------------------------------------------------
             // 2. <ejb-ref>
@@ -385,7 +351,7 @@
             log.debug("addEJB(): <ejb-ref> found");
 
             String remoteRefName = annotation.name();
-            if (remoteRefName.equals("")) {
+            if (remoteRefName.trim().equals("")) {
                 if (method != null) {
                     remoteRefName = method.getDeclaringClass().getName() + "/" + method.getName().substring(3); // method should start with "set"
                 } else if (field != null) {
@@ -394,9 +360,9 @@
             }
 
             boolean exists = false;
-            EjbRefType[] ejbRefEntries = webApp.getEjbRefArray();
+            EjbRefType[] ejbRefEntries = annotatedApp.getEjbRefArray();
             for (EjbRefType ejbRefEntry : ejbRefEntries) {
-                if (ejbRefEntry.getEjbRefName().getStringValue().equals(remoteRefName)) {
+                if (ejbRefEntry.getEjbRefName().getStringValue().trim().equals(remoteRefName)) {
                     exists = true;
                     break;
                 }
@@ -405,14 +371,14 @@
                 try {
 
                     // Doesn't exist in deployment descriptor -- add new
-                    EjbRefType ejbRef = webApp.addNewEjbRef();
+                    EjbRefType ejbRef = annotatedApp.addNewEjbRef();
 
                     //------------------------------------------------------------------------------
                     // <ejb-ref> required elements:
                     //------------------------------------------------------------------------------
 
                     // ejb-ref-name
-                    EjbRefNameType ejbRefName = EjbRefNameType.Factory.newInstance();
+                    EjbRefNameType ejbRefName = ejbRef.addNewEjbRefName();
                     ejbRefName.setStringValue(remoteRefName);
                     ejbRef.setEjbRefName(ejbRefName);
 
@@ -422,66 +388,156 @@
 
                     // remote
                     String remoteAnnotation = interfce.getName();
-                    if (remoteAnnotation.length() > 0) {
-                        RemoteType remote = RemoteType.Factory.newInstance();
+                    if (!remoteAnnotation.trim().equals("")) {
+                        RemoteType remote = ejbRef.addNewRemote();
                         remote.setStringValue(remoteAnnotation);
                         ejbRef.setRemote(remote);
                     }
 
                     // ejb-link
                     String beanName = annotation.beanName();
-                    if (beanName.length() > 0) {
-                        EjbLinkType ejbLink = EjbLinkType.Factory.newInstance();
+                    if (!beanName.trim().equals("")) {
+                        EjbLinkType ejbLink = ejbRef.addNewEjbLink();
                         ejbLink.setStringValue(beanName);
                         ejbRef.setEjbLink(ejbLink);
                     }
 
                     // mappedName
                     String mappdedNameAnnotation = annotation.mappedName();
-                    if (mappdedNameAnnotation.length() > 0) {
-                        XsdStringType mappedName = XsdStringType.Factory.newInstance();
+                    if (!mappdedNameAnnotation.trim().equals("")) {
+                        XsdStringType mappedName = ejbRef.addNewMappedName();
                         mappedName.setStringValue(mappdedNameAnnotation);
                         ejbRef.setMappedName(mappedName);
                     }
 
                     // description
                     String descriptionAnnotation = annotation.description();
-                    if (descriptionAnnotation.length() > 0) {
-                        DescriptionType description = DescriptionType.Factory.newInstance();
+                    if (!descriptionAnnotation.trim().equals("")) {
+                        DescriptionType description = ejbRef.addNewDescription();
                         description.setStringValue(descriptionAnnotation);
-                        int arraySize = ejbRef.sizeOfDescriptionArray();
-                        ejbRef.insertNewDescription(arraySize);
-                        ejbRef.setDescriptionArray(arraySize, description);
                     }
 
                     // injectionTarget
-                    InjectionTargetType injectionTarget = InjectionTargetType.Factory.newInstance();
-                    FullyQualifiedClassType qualifiedClass = FullyQualifiedClassType.Factory.newInstance();
-                    JavaIdentifierType javaType = JavaIdentifierType.Factory.newInstance();
+                    InjectionTargetType injectionTarget = ejbRef.addNewInjectionTarget();
+                    FullyQualifiedClassType qualifiedClass = injectionTarget.addNewInjectionTargetClass();
+                    JavaIdentifierType javaType = injectionTarget.addNewInjectionTargetName();
                     if (method != null) {
                         qualifiedClass.setStringValue(method.getDeclaringClass().getName());
                         javaType.setStringValue(method.getName().substring(3));   // method should start with "set"
                         injectionTarget.setInjectionTargetClass(qualifiedClass);
                         injectionTarget.setInjectionTargetName(javaType);
-                        int arraySize = ejbRef.sizeOfInjectionTargetArray();
-                        ejbRef.insertNewInjectionTarget(arraySize);
-                        ejbRef.setInjectionTargetArray(arraySize, injectionTarget);
                     } else if (field != null) {
                         qualifiedClass.setStringValue(field.getDeclaringClass().getName());
                         javaType.setStringValue(field.getName());
                         injectionTarget.setInjectionTargetClass(qualifiedClass);
                         injectionTarget.setInjectionTargetName(javaType);
-                        int arraySize = ejbRef.sizeOfInjectionTargetArray();
-                        ejbRef.insertNewInjectionTarget(arraySize);
-                        ejbRef.setInjectionTargetArray(arraySize, injectionTarget);
                     }
 
                 }
                 catch (Exception anyException) {
-                    log.debug("EJBAnnotationHelper: Exception caught while <processing ejb-ref>");
+                    log.debug("EJBAnnotationHelper: Exception caught while processing <ejb-ref>");
                     anyException.printStackTrace();
                 }
             }
+        }                                                                           // end if remote
+        else {                                                                      // ambiguous
+
+            //--------------------------------------------------------------------------------------
+            // 3. <UNKNOWN>
+            //--------------------------------------------------------------------------------------
+            log.debug("addEJB(): <UNKNOWN> found");
+
+            String remoteRefName = annotation.name();
+            if (remoteRefName.trim().equals("")) {
+                if (method != null) {
+                    remoteRefName = method.getDeclaringClass().getName() + "/" + method.getName().substring(3); // method should start with "set"
+                } else if (field != null) {
+                    remoteRefName = field.getDeclaringClass().getName() + "/" + field.getName();
+                }
+            }
+
+            boolean exists = false;
+            EjbRefType[] ejbRefEntries = annotatedApp.getEjbRefArray();
+            for (EjbRefType ejbRefEntry : ejbRefEntries) {
+                if (ejbRefEntry.getEjbRefName().getStringValue().trim().equals(remoteRefName)) {
+                    exists = true;
+                    break;
+                }
+            }
+            if (!exists) {
+                try {
+                    // Doesn't exist in deployment descriptor -- add to as an <ejb-ref> to the
+                    // ambiguous list so that it can be resolved later
+                    EjbRefType ejbRef = EjbRefType.Factory.newInstance();
+                    annotatedApp.getAmbiguousEjbRefs().add(ejbRef);
+
+                    //------------------------------------------------------------------------------
+                    // <ejb-ref> required elements:
+                    //------------------------------------------------------------------------------
+
+                    // ejb-ref-name
+                    EjbRefNameType ejbRefName = ejbRef.addNewEjbRefName();
+                    ejbRefName.setStringValue(remoteRefName);
+                    ejbRef.setEjbRefName(ejbRefName);
+
+                    //------------------------------------------------------------------------------
+                    // <ejb-ref> optional elements:
+                    //------------------------------------------------------------------------------
+
+                    // remote
+                    String remoteAnnotation = interfce.getName();
+                    if (!remoteAnnotation.trim().equals("")) {
+                        RemoteType remote = ejbRef.addNewRemote();
+                        remote.setStringValue(remoteAnnotation);
+                        ejbRef.setRemote(remote);
+                    }
+
+                    // ejb-link
+                    String beanName = annotation.beanName();
+                    if (!beanName.trim().equals("")) {
+                        EjbLinkType ejbLink = ejbRef.addNewEjbLink();
+                        ejbLink.setStringValue(beanName);
+                        ejbRef.setEjbLink(ejbLink);
+                    }
+
+                    // mappedName
+                    String mappdedNameAnnotation = annotation.mappedName();
+                    if (!mappdedNameAnnotation.trim().equals("")) {
+                        XsdStringType mappedName = ejbRef.addNewMappedName();
+                        mappedName.setStringValue(mappdedNameAnnotation);
+                        ejbRef.setMappedName(mappedName);
+                    }
+
+                    // description
+                    String descriptionAnnotation = annotation.description();
+                    if (!descriptionAnnotation.trim().equals("")) {
+                        DescriptionType description = ejbRef.addNewDescription();
+                        description.setStringValue(descriptionAnnotation);
+                    }
+
+                    // injectionTarget
+                    InjectionTargetType injectionTarget = ejbRef.addNewInjectionTarget();
+                    FullyQualifiedClassType qualifiedClass = injectionTarget.addNewInjectionTargetClass();
+                    JavaIdentifierType javaType = injectionTarget.addNewInjectionTargetName();
+                    if (method != null) {
+                        qualifiedClass.setStringValue(method.getDeclaringClass().getName());
+                        javaType.setStringValue(method.getName().substring(3));   // method should start with "set"
+                        injectionTarget.setInjectionTargetClass(qualifiedClass);
+                        injectionTarget.setInjectionTargetName(javaType);
+                    } else if (field != null) {
+                        qualifiedClass.setStringValue(field.getDeclaringClass().getName());
+                        javaType.setStringValue(field.getName());
+                        injectionTarget.setInjectionTargetClass(qualifiedClass);
+                        injectionTarget.setInjectionTargetName(javaType);
+                    }
+
+                }
+                catch (Exception anyException) {
+                    log.debug("EJBAnnotationHelper: Exception caught while processing <UNKNOWN>");
+                    anyException.printStackTrace();
+                }
+            }
+
         }
         log.debug("addEJB(): Exit");
     }
@@ -490,13 +546,13 @@
     /**
      * Validate deployment descriptor
      *
-     * @param webApp
+     * @param annotatedApp
      * @throws Exception thrown if deployment descriptor cannot be parsed
      */
-    private static void validateDD(WebAppType webApp) throws Exception {
-        log.debug("validateDD( " + webApp.toString() + " ): Entry");
+    private static void validateDD(AnnotatedApp annotatedApp) throws Exception {
+        log.debug("validateDD( " + annotatedApp.toString() + " ): Entry");
 
-        XmlBeansUtil.parse(webApp.toString());
+        XmlBeansUtil.parse(annotatedApp.toString());
 
         log.debug("validateDD(): Exit");
     }



Mime
View raw message