geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r957655 [2/15] - in /geronimo/server/trunk: ./ framework/configs/geronimo-gbean-deployer-bootstrap/src/main/history/ framework/configs/geronimo-gbean-deployer/src/main/history/ framework/configs/jsr88-cli/src/main/history/ framework/configs...
Date Thu, 24 Jun 2010 18:06:33 GMT
Modified: geronimo/server/trunk/plugins/client/geronimo-client-builder/src/test/java/org/apache/geronimo/client/builder/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/client/geronimo-client-builder/src/test/java/org/apache/geronimo/client/builder/SchemaConversionTest.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/client/geronimo-client-builder/src/test/java/org/apache/geronimo/client/builder/SchemaConversionTest.java (original)
+++ geronimo/server/trunk/plugins/client/geronimo-client-builder/src/test/java/org/apache/geronimo/client/builder/SchemaConversionTest.java Thu Jun 24 18:06:24 2010
@@ -35,84 +35,90 @@ import org.apache.xmlbeans.XmlObject;
 public class SchemaConversionTest extends XmlBeansTestSupport {
     private ClassLoader classLoader = this.getClass().getClassLoader();
 
-    public void testApplicationClient13ToApplicationClient6Transform() throws Exception {
-        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-client-13.xml");
-        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-client-6.xml");
-        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
-        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
-        XmlBeansUtil.validateDD(expected);
-        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
-        List problems = new ArrayList();
-        boolean ok = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences: " + problems, ok);
-        //make sure trying to convert twice has no bad effects
-        XmlCursor cursor2 = xmlObject.newCursor();
-        try {
-            String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/application_6.xsd";
-            String version = "6";
-            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version));
-        } finally {
-            cursor2.dispose();
-        }
-        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to schema: " + problems, ok2);
-        //do the whole transform twice...
-        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
-        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to application client schema: " + problems, ok3);
-    }
 
-    public void testApplicationClient14ToApplicationClient6Transform() throws Exception {
-        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-client-14.xml");
-        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-client-6.xml");
-        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
-        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
-        XmlBeansUtil.validateDD(expected);
-        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
-        List problems = new ArrayList();
-        boolean ok = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences: " + problems, ok);
-        //make sure trying to convert twice has no bad effects
-        XmlCursor cursor2 = xmlObject.newCursor();
-        try {
-            String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/application_6.xsd";
-            String version = "6";
-            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version));
-        } finally {
-            cursor2.dispose();
-        }
-        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to schema: " + problems, ok2);
-        //do the whole transform twice...
-        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
-        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to application client schema: " + problems, ok3);
-    }
+    public void testDummy() {
 
-    public void testApplicationClient15ToApplicationClient6Transform() throws Exception {
-        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-client-5.xml");
-        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-client-6.xml");
-        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
-        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
-        XmlBeansUtil.validateDD(expected);
-        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
-        List problems = new ArrayList();
-        boolean ok = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences: " + problems, ok);
-        //make sure trying to convert twice has no bad effects
-        XmlCursor cursor2 = xmlObject.newCursor();
-        try {
-            String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/application_6.xsd";
-            String version = "6";
-            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version));
-        } finally {
-            cursor2.dispose();
-        }
-        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to schema: " + problems, ok2);
-        //do the whole transform twice...
-        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
-        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
-        assertTrue("Differences after reconverting to application client schema: " + problems, ok3);
     }
+
+    //TODO move tests to openejb-jee
+//    public void testApplicationClient13ToApplicationClient6Transform() throws Exception {
+//        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-client-13.xml");
+//        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-client-6.xml");
+//        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+//        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+//        XmlBeansUtil.validateDD(expected);
+//        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
+//        List problems = new ArrayList();
+//        boolean ok = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences: " + problems, ok);
+//        //make sure trying to convert twice has no bad effects
+//        XmlCursor cursor2 = xmlObject.newCursor();
+//        try {
+//            String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/application_6.xsd";
+//            String version = "6";
+//            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version));
+//        } finally {
+//            cursor2.dispose();
+//        }
+//        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences after reconverting to schema: " + problems, ok2);
+//        //do the whole transform twice...
+//        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
+//        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences after reconverting to application client schema: " + problems, ok3);
+//    }
+
+//    public void testApplicationClient14ToApplicationClient6Transform() throws Exception {
+//        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-client-14.xml");
+//        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-client-6.xml");
+//        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+//        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+//        XmlBeansUtil.validateDD(expected);
+//        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
+//        List problems = new ArrayList();
+//        boolean ok = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences: " + problems, ok);
+//        //make sure trying to convert twice has no bad effects
+//        XmlCursor cursor2 = xmlObject.newCursor();
+//        try {
+//            String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/application_6.xsd";
+//            String version = "6";
+//            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version));
+//        } finally {
+//            cursor2.dispose();
+//        }
+//        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences after reconverting to schema: " + problems, ok2);
+//        //do the whole transform twice...
+//        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
+//        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences after reconverting to application client schema: " + problems, ok3);
+//    }
+
+//    public void testApplicationClient15ToApplicationClient6Transform() throws Exception {
+//        URL srcXml = classLoader.getResource("j2ee_1_3dtd/application-client-5.xml");
+//        URL expectedOutputXml = classLoader.getResource("j2ee_1_3dtd/application-client-6.xml");
+//        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
+//        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
+//        XmlBeansUtil.validateDD(expected);
+//        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
+//        List problems = new ArrayList();
+//        boolean ok = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences: " + problems, ok);
+//        //make sure trying to convert twice has no bad effects
+//        XmlCursor cursor2 = xmlObject.newCursor();
+//        try {
+//            String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/application_6.xsd";
+//            String version = "6";
+//            assertFalse(SchemaConversionUtils.convertToSchema(cursor2, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version));
+//        } finally {
+//            cursor2.dispose();
+//        }
+//        boolean ok2 = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences after reconverting to schema: " + problems, ok2);
+//        //do the whole transform twice...
+//        xmlObject = AppClientModuleBuilder.convertToApplicationClientSchema(xmlObject);
+//        boolean ok3 = compareXmlObjects(xmlObject, expected, problems);
+//        assertTrue("Differences after reconverting to application client schema: " + problems, ok3);
+//    }
 }

Modified: geronimo/server/trunk/plugins/client/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/client/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/client/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java (original)
+++ geronimo/server/trunk/plugins/client/geronimo-client/src/main/java/org/apache/geronimo/client/AppClientContainer.java Thu Jun 24 18:06:24 2010
@@ -44,11 +44,14 @@ import org.apache.geronimo.security.depl
 import org.apache.xbean.recipe.ObjectRecipe;
 import org.apache.xbean.recipe.Option;
 import org.apache.xbean.recipe.StaticRecipe;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
  */
 public final class AppClientContainer implements GBeanLifecycle {
+    private static final Logger log = LoggerFactory.getLogger(AppClientContainer.class);
     private static final Class[] MAIN_ARGS = {String[].class};
     
     private LoginContext loginContext;
@@ -150,20 +153,14 @@ public final class AppClientContainer im
             if (injections != null) {
                 List<NamingException> problems = new ArrayList<NamingException>();
                 for (Injection injection : injections) {
+                    String jndiName = injection.getJndiName();
                     try {
-                        String jndiName = injection.getJndiName();
                         //TODO this may not be correct due to module, app, and global jndi names.
                         //our componentContext is attached to jndi at "java:" so we remove that when looking stuff up in it
                         Object object = componentContext.lookup("comp/env/" + jndiName);
-                        if (object instanceof String) {
-                            String string = (String) object;
-                            // Pass it in raw so it could be potentially converted to
-                            // another data type by an xbean-reflect property editor
-                            objectRecipe.setProperty(injection.getTargetName(), string);
-                        } else {
-                            objectRecipe.setProperty(injection.getTargetName(), new StaticRecipe(object));
-                        }
+                        objectRecipe.setProperty(injection.getTargetName(), object);
                     } catch (NamingException e) {
+                        log.info("Injection problem for jndiName: " + jndiName, e);
                         problems.add(e);
                     }
                 }

Modified: geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/history/dependencies.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/clustering/plugin-farm-member/src/main/history/dependencies.xml Thu Jun 24 18:06:24 2010
@@ -32,21 +32,6 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-j2ee_1.4</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-javaee_6</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.schema</groupId>
-        <artifactId>geronimo-schema-jee_5</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.xmlbeans</artifactId>
         <type>jar</type>

Modified: geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/connector-deployer-1_6/src/main/history/dependencies.xml Thu Jun 24 18:06:24 2010
@@ -92,11 +92,6 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.openejb</groupId>
-        <artifactId>openejb-jee</artifactId>
-        <type>jar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.servicemix.bundles</groupId>
         <artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId>
         <type>jar</type>

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml Thu Jun 24 18:06:24 2010
@@ -164,14 +164,6 @@
                         <!--packages containing "impl" or "internal" are excluded by default -->
                         <Import-Package>
                               org.apache.xmlbeans.impl.schema;version="2.4",
-                              org.apache.geronimo.xbeans.javaee.impl,
-                              org.apache.geronimo.xbeans.javaee,
-                              org.apache.geronimo.xbeans.persistence.impl,
-                              org.apache.geronimo.xbeans.persistence,
-                              org.apache.geronimo.xbeans.j2ee.impl,
-                              org.apache.geronimo.xbeans.j2ee,
-                              org.w3.xml.x1998.namespace.impl,
-                              org.w3.xml.x1998.namespace,
                               org.apache.geronimo.deployment.xbeans.impl,
                               org.apache.geronimo.deployment.javabean.xbeans.impl,
                               org.apache.geronimo.deployment.xbeans,

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java Thu Jun 24 18:06:24 2010
@@ -20,6 +20,7 @@ package org.apache.geronimo.connector.de
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -29,19 +30,13 @@ import javax.naming.RefAddr;
 import javax.naming.Reference;
 import javax.naming.StringRefAddr;
 import javax.xml.namespace.QName;
-
-import org.apache.geronimo.gbean.annotation.GBean;
-import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.UnresolvedReferenceException;
 import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationHelper;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -56,18 +51,17 @@ import org.apache.geronimo.xbeans.geroni
 import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefDocument;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceEnvRefType;
-import org.apache.geronimo.xbeans.javaee6.DescriptionType;
-import org.apache.geronimo.xbeans.javaee6.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee6.InjectionTargetType;
-import org.apache.geronimo.xbeans.javaee6.JndiNameType;
-import org.apache.geronimo.xbeans.javaee6.MessageDestinationRefType;
-import org.apache.geronimo.xbeans.javaee6.MessageDestinationType;
-import org.apache.geronimo.xbeans.javaee6.MessageDestinationTypeType;
-import org.apache.geronimo.xbeans.javaee6.ResourceEnvRefType;
-import org.apache.geronimo.xbeans.javaee6.XsdStringType;
+import org.apache.openejb.jee.InjectionTarget;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.MessageDestination;
+import org.apache.openejb.jee.MessageDestinationRef;
+import org.apache.openejb.jee.ResourceEnvRef;
+import org.apache.openejb.jee.Text;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -93,12 +87,18 @@ public class AdminObjectRefBuilder exten
         messageDestinationRefQNameSet = buildQNameSet(eeNamespaces, "message-destination-ref");
     }
 
-    protected boolean willMergeEnvironment(XmlObject specDD, XmlObject plan) {
-        return specDD.selectChildren(adminOjbectRefQNameSet).length > 0 || specDD.selectChildren(messageDestinationRefQNameSet).length > 0;
+    protected boolean willMergeEnvironment(JndiConsumer specDD, XmlObject plan) {
+        return !specDD.getResourceEnvRef().isEmpty() || !specDD.getMessageDestinationRef().isEmpty();
     }
 
-    public void initContext(XmlObject specDD, XmlObject plan, Module module) throws DeploymentException {
-        List<MessageDestinationType> specDestinations = convert(specDD.selectChildren(messageDestinationQNameSet), JEE_CONVERTER, MessageDestinationType.class, MessageDestinationType.type);
+    public void initContext(JndiConsumer specDD, XmlObject plan, Module module) throws DeploymentException {
+        List<MessageDestination> specDestinations;
+        try {
+            Method m = specDD.getClass().getMethod("getMessageDestination", new Class[0]);
+            specDestinations = (List<MessageDestination>) m.invoke(specDD, new Object[0]);
+        } catch (Exception e) {
+            specDestinations = new ArrayList<MessageDestination>();
+        }
         XmlObject[] gerDestinations = plan.selectChildren(GER_MESSAGE_DESTINATION_QNAME_SET);
         Map<String, GerMessageDestinationType> nameMap = new HashMap<String, GerMessageDestinationType>();
         for (XmlObject gerDestination : gerDestinations) {
@@ -106,8 +106,8 @@ public class AdminObjectRefBuilder exten
             String name = destination.getMessageDestinationName().trim();
             nameMap.put(name, destination);
             boolean found = false;
-            for (MessageDestinationType specDestination : specDestinations) {
-                if (specDestination.getMessageDestinationName().getStringValue().trim().equals(name)) {
+            for (MessageDestination specDestination : specDestinations) {
+                if (specDestination.getMessageDestinationName().trim().equals(name)) {
                     found = true;
                     break;
                 }
@@ -120,7 +120,7 @@ public class AdminObjectRefBuilder exten
     }
 
 
-    public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map componentContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map componentContext) throws DeploymentException {
         XmlObject[] gerResourceEnvRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_ADMIN_OBJECT_REF_QNAME_SET);
         Map<String, GerResourceEnvRefType> refMap = mapResourceEnvRefs(gerResourceEnvRefsUntyped);
         Map<String, Map<String, GerMessageDestinationType>> messageDestinations = module.getRootEarContext().getMessageDestinations();
@@ -130,25 +130,25 @@ public class AdminObjectRefBuilder exten
 
             // Process all the annotations for this naming builder type
             try {
-                ResourceAnnotationHelper.processAnnotations(module.getAnnotatedApp(), module.getClassFinder(), new AdminObjectRefProcessor(refMap, messageDestinations, module.getEarContext()));
+                ResourceAnnotationHelper.processAnnotations(specDD, module.getClassFinder(), new AdminObjectRefProcessor(refMap, messageDestinations, module.getEarContext()));
             }
             catch (Exception e) {
                 log.warn("Unable to process @Resource annotations for module" + module.getName(), e);
             }
         }
 
-        List<ResourceEnvRefType> resourceEnvRefsUntyped = convert(specDD.selectChildren(adminOjbectRefQNameSet), JEE_CONVERTER, ResourceEnvRefType.class, ResourceEnvRefType.type);
+        Collection<ResourceEnvRef> resourceEnvRefsUntyped = specDD.getResourceEnvRef();
         List<String> unresolvedRefs = new ArrayList<String>();
         Bundle bundle = module.getEarContext().getDeploymentBundle();
-        for (ResourceEnvRefType resourceEnvRef : resourceEnvRefsUntyped) {
+        for (ResourceEnvRef resourceEnvRef : resourceEnvRefsUntyped) {
             String name = getStringValue(resourceEnvRef.getResourceEnvRefName());
             if (lookupJndiContextMap(module, name) != null) {
                 // some other builder handled this entry already
                 continue;
             }
-            addInjections(name, resourceEnvRef.getInjectionTargetArray(), componentContext);
+            addInjections(name, resourceEnvRef.getInjectionTarget(), componentContext);
             String type = getStringValue(resourceEnvRef.getResourceEnvRefType());
-            type = inferAndCheckType(module, bundle, resourceEnvRef.getInjectionTargetArray(), name, type);
+            type = inferAndCheckType(module, bundle, resourceEnvRef.getInjectionTarget(), name, type);
             GerResourceEnvRefType gerResourceEnvRef = refMap.remove(name);
 
             Object value = null;
@@ -178,22 +178,22 @@ public class AdminObjectRefBuilder exten
         }
 
         //message-destination-refs
-        List<MessageDestinationRefType> messageDestinationRefsUntyped = convert(specDD.selectChildren(messageDestinationRefQNameSet), JEE_CONVERTER, MessageDestinationRefType.class, MessageDestinationRefType.type);
+        Collection<MessageDestinationRef> messageDestinationRefsUntyped = specDD.getMessageDestinationRef();
 
-        for (MessageDestinationRefType messageDestinationRef : messageDestinationRefsUntyped) {
+        for (MessageDestinationRef messageDestinationRef : messageDestinationRefsUntyped) {
             String name = getStringValue(messageDestinationRef.getMessageDestinationRefName());
             if (lookupJndiContextMap(module, name) != null) {
                 // some other builder handled this entry already
                 continue;
             }
-            addInjections(name, messageDestinationRef.getInjectionTargetArray(), componentContext);
+            addInjections(name, messageDestinationRef.getInjectionTarget(), componentContext);
             String linkName = getStringValue(messageDestinationRef.getMessageDestinationLink());
             //TODO figure out something better to do here!
             if (linkName == null) {
                 linkName = name;
             }
             String type = getStringValue(messageDestinationRef.getMessageDestinationType());
-            type = inferAndCheckType(module, bundle, messageDestinationRef.getInjectionTargetArray(), name, type);
+            type = inferAndCheckType(module, bundle, messageDestinationRef.getInjectionTarget(), name, type);
 
             GerMessageDestinationType destination = getMessageDestination(linkName, messageDestinations);
 
@@ -275,10 +275,6 @@ public class AdminObjectRefBuilder exten
         }
     }
 
-    private String getStringValue(String string) {
-        return string == null? null: string.trim();
-    }
-
     private Object buildMessageReference(Module module, String linkName, String type, GerMessageDestinationType destination)
             throws DeploymentException {
         Bundle bundle = module.getEarContext().getDeploymentBundle();
@@ -410,30 +406,30 @@ public class AdminObjectRefBuilder exten
             this.earContext = earContext;
         }
 
-        public boolean processResource(AnnotatedApp annotatedApp, Resource annotation, Class cls, Method method, Field field) throws DeploymentException {
+        public boolean processResource(JndiConsumer annotatedApp, Resource annotation, Class cls, Method method, Field field) throws DeploymentException {
             String resourceName = getResourceName(annotation, method, field);
             String resourceType = getResourceType(annotation, method, field);
 
             //If it already exists in xml as a message-destination-ref or resource-env-ref, we are done.
-            MessageDestinationRefType[] messageDestinationRefs = annotatedApp.getMessageDestinationRefArray();
-            for (MessageDestinationRefType messageDestinationRef : messageDestinationRefs) {
-                if (messageDestinationRef.getMessageDestinationRefName().getStringValue().trim().equals(resourceName)) {
+            Collection<MessageDestinationRef> messageDestinationRefs = annotatedApp.getMessageDestinationRef();
+            for (MessageDestinationRef messageDestinationRef : messageDestinationRefs) {
+                if (messageDestinationRef.getMessageDestinationRefName().trim().equals(resourceName)) {
                     if (method != null || field != null) {
-                        InjectionTargetType[] targets = messageDestinationRef.getInjectionTargetArray();
+                        List<InjectionTarget> targets = messageDestinationRef.getInjectionTarget();
                         if (!hasTarget(method, field, targets)) {
-                            configureInjectionTarget(messageDestinationRef.addNewInjectionTarget(), method, field);
+                            messageDestinationRef.getInjectionTarget().add(configureInjectionTarget(method, field));
                         }
                     }
                     return true;
                 }
             }
-            ResourceEnvRefType[] ResourceEnvRefs = annotatedApp.getResourceEnvRefArray();
-            for (ResourceEnvRefType resourceEnvRefType : ResourceEnvRefs) {
-                if (resourceEnvRefType.getResourceEnvRefName().getStringValue().trim().equals(resourceName)) {
+            Collection<ResourceEnvRef> ResourceEnvRefs = annotatedApp.getResourceEnvRef();
+            for (ResourceEnvRef resourceEnvRefType : ResourceEnvRefs) {
+                if (resourceEnvRefType.getResourceEnvRefName().trim().equals(resourceName)) {
                     if (method != null || field != null) {
-                        InjectionTargetType[] targets = resourceEnvRefType.getInjectionTargetArray();
+                        List<InjectionTarget> targets = resourceEnvRefType.getInjectionTarget();
                         if (!hasTarget(method, field, targets)) {
-                            configureInjectionTarget(resourceEnvRefType.addNewInjectionTarget(), method, field);
+                            resourceEnvRefType.getInjectionTarget().add(configureInjectionTarget(method, field));
                         }
                     }
                     return true;
@@ -491,28 +487,23 @@ public class AdminObjectRefBuilder exten
             }
         }
 
-        private void addResourceEnvRef(AnnotatedApp annotatedApp, String resourceName, String resourceType, Method method, Field field, Resource annotation) {
-            ResourceEnvRefType resourceEnvRef = annotatedApp.addNewResourceEnvRef();
+        private void addResourceEnvRef(JndiConsumer annotatedApp, String resourceName, String resourceType, Method method, Field field, Resource annotation) {
+            ResourceEnvRef resourceEnvRef = new ResourceEnvRef();
 
             //------------------------------------------------------------------------------
             // <resource-env-ref> required elements:
             //------------------------------------------------------------------------------
 
             // resource-env-ref-name
-            JndiNameType resourceEnvRefName = resourceEnvRef.addNewResourceEnvRefName();
-            resourceEnvRefName.setStringValue(resourceName);
-            resourceEnvRef.setResourceEnvRefName(resourceEnvRefName);
+            resourceEnvRef.setResourceEnvRefName(resourceName);
 
-            if (!resourceType.equals("")) {
+            if (!resourceType.isEmpty()) {
                 // resource-env-ref-type
-                FullyQualifiedClassType qualifiedClass = resourceEnvRef.addNewResourceEnvRefType();
-                qualifiedClass.setStringValue(resourceType);
-                resourceEnvRef.setResourceEnvRefType(qualifiedClass);
+                resourceEnvRef.setResourceEnvRefType(resourceType);
             }
             if (method != null || field != null) {
                 // injectionTarget
-                InjectionTargetType injectionTarget = resourceEnvRef.addNewInjectionTarget();
-                configureInjectionTarget(injectionTarget, method, field);
+                resourceEnvRef.getInjectionTarget().add(configureInjectionTarget(method, field));
             }
 
             //------------------------------------------------------------------------------
@@ -521,47 +512,41 @@ public class AdminObjectRefBuilder exten
 
             // description
             String descriptionAnnotation = annotation.description();
-            if (!descriptionAnnotation.equals("")) {
-                DescriptionType description = resourceEnvRef.addNewDescription();
-                description.setStringValue(descriptionAnnotation);
+            if (!descriptionAnnotation.isEmpty()) {
+                resourceEnvRef.setDescriptions(new Text[] {new Text(null, descriptionAnnotation) }  );
             }
 
             // mappedName
             String mappdedNameAnnotation = annotation.mappedName();
-            if (!mappdedNameAnnotation.equals("")) {
-                XsdStringType mappedName = resourceEnvRef.addNewMappedName();
-                mappedName.setStringValue(mappdedNameAnnotation);
+            if (!mappdedNameAnnotation.isEmpty()) {
+                resourceEnvRef.setMappedName(mappdedNameAnnotation);
             }
 
             // lookup
             String lookup = annotation.lookup();
             if (!lookup.equals("")) {
-                XsdStringType lookupName = resourceEnvRef.addNewLookupName();
-                lookupName.setStringValue(lookup);
+                resourceEnvRef.setLookupName(lookup);
             }
+            annotatedApp.getResourceEnvRef().add(resourceEnvRef);
         }
 
-        private void addMethodDestinationRef(AnnotatedApp annotatedApp, String resourceName, String resourceType, Method method, Field field, Resource annotation) {
-            MessageDestinationRefType messageDestinationRef = annotatedApp.addNewMessageDestinationRef();
+        private void addMethodDestinationRef(JndiConsumer annotatedApp, String resourceName, String resourceType, Method method, Field field, Resource annotation) {
+            MessageDestinationRef messageDestinationRef = new MessageDestinationRef();
 
             //------------------------------------------------------------------------------
             // <message-destination-ref> required elements:
             //------------------------------------------------------------------------------
 
             // message-destination-ref-name
-            JndiNameType messageDestinationRefName = messageDestinationRef.addNewMessageDestinationRefName();
-            messageDestinationRefName.setStringValue(resourceName);
-            messageDestinationRef.setMessageDestinationRefName(messageDestinationRefName);
+            messageDestinationRef.setMessageDestinationRefName(resourceName);
 
-            if (!resourceType.equals("")) {
+            if (!resourceType.isEmpty()) {
                 // message-destination-ref-type
-                MessageDestinationTypeType msgDestType = messageDestinationRef.addNewMessageDestinationType();
-                msgDestType.setStringValue(resourceType);
+                messageDestinationRef.setMessageDestinationType(resourceType);
             }
             if (method != null || field != null) {
                 // injectionTarget
-                InjectionTargetType injectionTarget = messageDestinationRef.addNewInjectionTarget();
-                configureInjectionTarget(injectionTarget, method, field);
+                messageDestinationRef.getInjectionTarget().add(configureInjectionTarget(method, field));
             }
 
             //------------------------------------------------------------------------------
@@ -570,24 +555,22 @@ public class AdminObjectRefBuilder exten
 
             // description
             String descriptionAnnotation = annotation.description();
-            if (!descriptionAnnotation.equals("")) {
-                DescriptionType description = messageDestinationRef.addNewDescription();
-                description.setStringValue(descriptionAnnotation);
+            if (!descriptionAnnotation.isEmpty()) {
+                messageDestinationRef.setDescriptions(new Text[]{new Text(null, descriptionAnnotation)});
             }
 
             // mappedName
             String mappdedNameAnnotation = annotation.mappedName();
-            if (!mappdedNameAnnotation.equals("")) {
-                XsdStringType mappedName = messageDestinationRef.addNewMappedName();
-                mappedName.setStringValue(mappdedNameAnnotation);
+            if (!mappdedNameAnnotation.isEmpty()) {
+                messageDestinationRef.setMappedName(mappdedNameAnnotation);
             }
 
             // lookup
             String lookup = annotation.lookup();
-            if (!lookup.equals("")) {
-                XsdStringType lookupName = messageDestinationRef.addNewLookupName();
-                lookupName.setStringValue(lookup);
+            if (!lookup.isEmpty()) {
+                messageDestinationRef.setLookupName(lookup);
             }
+            annotatedApp.getMessageDestinationRef().add(messageDestinationRef);
         }
     }
 

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java Thu Jun 24 18:06:24 2010
@@ -98,7 +98,6 @@ import org.apache.geronimo.j2ee.deployme
 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.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -160,7 +159,6 @@ import org.xml.sax.SAXException;
 public class ConnectorModuleBuilder implements ModuleBuilder, ActivationSpecInfoLocator, GBeanLifecycle {
     private static final Logger log = LoggerFactory.getLogger(ConnectorModuleBuilder.class);
 
-    private static final QName RESOURCE_ADAPTER_VERSION = new QName(SchemaConversionUtils.JAVAEE_NAMESPACE, "resourceadapter-version");
     private static QName CONNECTOR_QNAME = GerConnectorDocument.type.getDocumentElementName();
     static final String GERCONNECTOR_NAMESPACE = CONNECTOR_QNAME.getNamespaceURI();
     private static final Map<String, String> NAMESPACE_UPDATES = new HashMap<String, String>();
@@ -380,8 +378,7 @@ public class ConnectorModuleBuilder impl
         }
 
         boolean standAlone = earEnvironment == null;
-        AnnotatedApp annotatedApp = null;
-        
+
         String name = null;
         if (connector != null && connector.getModuleName() != null) {
             name = connector.getModuleName();
@@ -390,81 +387,9 @@ public class ConnectorModuleBuilder impl
         } else {
             name = FileUtils.removeExtension(targetPath, ".rar");
         }
-        return new ConnectorModule<ConnectorBase, XmlObject>(standAlone, moduleName, name, environment, moduleFile, targetPath, connector, gerConnector, specDD, annotatedApp, parentModule == null? null: parentModule.getJndiContext(), parentModule);
+        return new ConnectorModule<ConnectorBase, XmlObject>(standAlone, moduleName, name, environment, moduleFile, targetPath, connector, gerConnector, specDD, parentModule == null? null: parentModule.getJndiContext(), parentModule);
     }
 
-//    static XmlObject convertToConnectorSchema(XmlObject xmlObject) throws XmlException {
-//        XmlCursor cursor = xmlObject.newCursor();
-//        cursor.toStartDoc();
-//        cursor.toFirstChild();
-//        try {
-//            String schemaLocationURL = "http://java.sun.com/xml/ns/javaee/connector_1_6.xsd";
-//            String version = "1.6";
-//            if ("http://java.sun.com/xml/ns/j2ee".equals(cursor.getName().getNamespaceURI())) {
-//                SchemaConversionUtils.convertSchemaVersion(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
-////                XmlObject result = xmlObject.changeType(ConnectorDocument.type);
-////                XmlBeansUtil.validateDD(result);
-//                return xmlObject;
-//            } else if ("-//Sun Microsystems, Inc.//DTD Connector 1.0//EN".equals(cursor.documentProperties().getDoctypePublicId())) {
-//                XmlCursor moveable = xmlObject.newCursor();
-//                try {
-//                    SchemaConversionUtils.convertToSchema(cursor, SchemaConversionUtils.JAVAEE_NAMESPACE, schemaLocationURL, version);
-//                    cursor.toStartDoc();
-//                    cursor.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "connector");
-//                    cursor.toFirstChild();
-//                    SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-//                    cursor.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "spec-version");
-//                    cursor.removeXml();
-//                    cursor.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "version");
-//                    cursor.setName(RESOURCE_ADAPTER_VERSION);
-//                    cursor.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "resourceadapter");
-//                    moveable.toCursor(cursor);
-//                    cursor.toFirstChild();
-//                    cursor.beginElement("outbound-resourceadapter", SchemaConversionUtils.JAVAEE_NAMESPACE);
-//                    cursor.beginElement("connection-definition", SchemaConversionUtils.JAVAEE_NAMESPACE);
-//                    moveable.toChild(SchemaConversionUtils.JAVAEE_NAMESPACE, "managedconnectionfactory-class");
-//                    moveable.push();
-//                    //from moveable to cursor
-//                    moveable.moveXml(cursor);
-//                    while (moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "config-property")) {
-//                        moveable.moveXml(cursor);
-//                    }
-//                    moveable.pop();
-//                    moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "connectionfactory-interface");
-//                    moveable.moveXml(cursor);
-//                    moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "connectionfactory-impl-class");
-//                    moveable.moveXml(cursor);
-//                    moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "connection-interface");
-//                    moveable.moveXml(cursor);
-//                    moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "connection-impl-class");
-//                    moveable.moveXml(cursor);
-//                    //get out of connection-definition element
-//                    cursor.toNextToken();
-//                    moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "transaction-support");
-//                    moveable.moveXml(cursor);
-//                    while (moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "authentication-mechanism")) {
-//                        moveable.moveXml(cursor);
-//                    }
-//                    moveable.toNextSibling(SchemaConversionUtils.JAVAEE_NAMESPACE, "reauthentication-support");
-//                    moveable.moveXml(cursor);
-//                } finally {
-//                    moveable.dispose();
-//                }
-//
-//            }
-//        } finally {
-//            cursor.dispose();
-//        }
-////        XmlObject result = xmlObject.changeType(ConnectorDocument.type);
-////        if (result != null) {
-////            XmlBeansUtil.validateDD(result);
-////            return (ConnectorDocument) result;
-////        }
-////        XmlBeansUtil.validateDD(xmlObject);
-////        return (ConnectorDocument) xmlObject;
-//        return xmlObject;
-//    }
-
     public void installModule(JarFile earFile, EARContext earContext, Module module, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException {
         module.setEarContext(earContext);
         try {

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ResourceRefBuilder.java Thu Jun 24 18:06:24 2010
@@ -33,22 +33,17 @@ import java.util.Set;
 import javax.annotation.Resource;
 import javax.resource.ResourceException;
 import javax.xml.namespace.QName;
-
-import org.apache.geronimo.gbean.annotation.GBean;
-import org.apache.geronimo.gbean.annotation.ParamAttribute;
-import org.apache.geronimo.gbean.annotation.ParamReference;
-import org.apache.geronimo.j2ee.deployment.EARContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.service.EnvironmentBuilder;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.SingleElementCollection;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 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.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.deployment.annotation.ResourceAnnotationHelper;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
@@ -65,19 +60,18 @@ import org.apache.geronimo.naming.refere
 import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefDocument;
 import org.apache.geronimo.xbeans.geronimo.naming.GerResourceRefType;
-import org.apache.geronimo.xbeans.javaee6.DescriptionType;
-import org.apache.geronimo.xbeans.javaee6.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee6.InjectionTargetType;
-import org.apache.geronimo.xbeans.javaee6.JndiNameType;
-import org.apache.geronimo.xbeans.javaee6.ResAuthType;
-import org.apache.geronimo.xbeans.javaee6.ResSharingScopeType;
-import org.apache.geronimo.xbeans.javaee6.ResourceRefType;
-import org.apache.geronimo.xbeans.javaee6.XsdStringType;
-import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.openejb.jee.InjectionTarget;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.ResAuth;
+import org.apache.openejb.jee.ResSharingScope;
+import org.apache.openejb.jee.ResourceRef;
+import org.apache.openejb.jee.Text;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 import org.omg.CORBA.ORB;
 import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -97,9 +91,9 @@ public class ResourceRefBuilder extends 
     private final SingleElementCollection<CorbaGBeanNameSource> corbaGBeanNameSourceCollection;
 
     public ResourceRefBuilder(
-            @ParamAttribute(name = "defaultEnvironment")Environment defaultEnvironment,
-            @ParamAttribute(name = "corbaEnvironment")Environment corbaEnvironment,
-            @ParamAttribute(name = "eeNamespaces")String[] eeNamespaces,
+            @ParamAttribute(name = "defaultEnvironment") Environment defaultEnvironment,
+            @ParamAttribute(name = "corbaEnvironment") Environment corbaEnvironment,
+            @ParamAttribute(name = "eeNamespaces") String[] eeNamespaces,
             @ParamReference(name = "CorbaGBeanNameSource", namingType = "") Collection<CorbaGBeanNameSource> corbaGBeanNameSourceCollection) {
         super(defaultEnvironment);
 
@@ -108,38 +102,38 @@ public class ResourceRefBuilder extends 
         this.corbaGBeanNameSourceCollection = new SingleElementCollection<CorbaGBeanNameSource>(corbaGBeanNameSourceCollection);
     }
 
-    protected boolean willMergeEnvironment(XmlObject specDD, XmlObject plan) {
-        return specDD.selectChildren(resourceRefQNameSet).length > 0;
+    protected boolean willMergeEnvironment(JndiConsumer specDD, XmlObject plan) {
+        return !specDD.getResourceRef().isEmpty();
     }
 
-    public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> componentContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map<EARContext.Key, Object> componentContext) throws DeploymentException {
 
         // Discover and process any @Resource annotations (if !metadata-complete)
         if ((module != null) && (module.getClassFinder() != null)) {
 
             // Process all the annotations for this naming builder type
             try {
-                ResourceAnnotationHelper.processAnnotations(module.getAnnotatedApp(), module.getClassFinder(), ResourceRefProcessor.INSTANCE);
+                ResourceAnnotationHelper.processAnnotations(specDD, module.getClassFinder(), ResourceRefProcessor.INSTANCE);
             }
             catch (Exception e) {
                 log.warn("Unable to process @Resource annotations for module" + module.getName(), e);
             }
         }
 
-        List<ResourceRefType> resourceRefsUntyped = convert(specDD.selectChildren(resourceRefQNameSet), J2EE_CONVERTER, ResourceRefType.class, ResourceRefType.type);
+        Collection<ResourceRef> resourceRefsUntyped = specDD.getResourceRef();
         XmlObject[] gerResourceRefsUntyped = plan == null ? NO_REFS : plan.selectChildren(GER_RESOURCE_REF_QNAME_SET);
         Map<String, GerResourceRefType> refMap = mapResourceRefs(gerResourceRefsUntyped);
         List<String> unresolvedRefs = new ArrayList<String>();
         Bundle bundle = module.getEarContext().getDeploymentBundle();
-        for (ResourceRefType resourceRef : resourceRefsUntyped) {
+        for (ResourceRef resourceRef : resourceRefsUntyped) {
             String name = getStringValue(resourceRef.getResRefName());
             if (lookupJndiContextMap(module, name) != null) {
                 // some other builder handled this entry already
                 continue;
             }
-            addInjections(name, resourceRef.getInjectionTargetArray(), componentContext);
+            addInjections(name, resourceRef.getInjectionTarget(), componentContext);
             String type = getStringValue(resourceRef.getResType());
-            type = inferAndCheckType(module, bundle, resourceRef.getInjectionTargetArray(), name, type);
+            type = inferAndCheckType(module, bundle, resourceRef.getInjectionTarget(), name, type);
             GerResourceRefType gerResourceRef = refMap.get(name);
             log.debug("trying to resolve " + name + ", type " + type + ", resourceRef " + gerResourceRef);
 
@@ -254,26 +248,26 @@ public class ResourceRefBuilder extends 
         return null;
     }
 
-    public void setResourceEnvironment(ResourceEnvironmentBuilder builder, XmlObject[] resourceRefs, GerResourceRefType[] gerResourceRefs) throws DeploymentException {
-        List<ResourceRefType> resourceRefList = convert(resourceRefs, J2EE_CONVERTER, ResourceRefType.class, ResourceRefType.type);
+    @Override
+    public void setResourceEnvironment(ResourceEnvironmentBuilder builder, Collection<ResourceRef> resourceRefList, GerResourceRefType[] gerResourceRefs) throws DeploymentException {
         Map refMap = mapResourceRefs(gerResourceRefs);
         Set<AbstractNameQuery> unshareableResources = new HashSet<AbstractNameQuery>();
         Set<AbstractNameQuery> applicationManagedSecurityResources = new HashSet<AbstractNameQuery>();
-        for (ResourceRefType resourceRefType : resourceRefList) {
+        for (ResourceRef resourceRef : resourceRefList) {
 
-            String type = resourceRefType.getResType().getStringValue().trim();
+            String type = resourceRef.getResType().trim();
 
             if (!URL.class.getName().equals(type)
                     && !"javax.mail.Session".equals(type)
                     && !JAXR_CONNECTION_FACTORY_CLASS.equals(type)) {
 
-                GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRefType.getResRefName().getStringValue());
-                AbstractNameQuery containerId = getResourceContainerId(getStringValue(resourceRefType.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, null, gerResourceRef);
+                GerResourceRefType gerResourceRef = (GerResourceRefType) refMap.get(resourceRef.getResRefName());
+                AbstractNameQuery containerId = getResourceContainerId(getStringValue(resourceRef.getResRefName()), NameFactory.JCA_MANAGED_CONNECTION_FACTORY, null, gerResourceRef);
 
-                if ("Unshareable".equals(getStringValue(resourceRefType.getResSharingScope()))) {
+                if (ResSharingScope.UNSHAREABLE.equals(resourceRef.getResSharingScope())) {
                     unshareableResources.add(containerId);
                 }
-                if ("Application".equals(getStringValue(resourceRefType.getResAuth()))) {
+                if (ResAuth.APPLICATION.equals(resourceRef.getResAuth())) {
                     applicationManagedSecurityResources.add(containerId);
                 }
             }
@@ -327,7 +321,7 @@ public class ResourceRefBuilder extends 
         private ResourceRefProcessor() {
         }
 
-        public boolean processResource(AnnotatedApp annotatedApp, Resource annotation, Class cls, Method method, Field field) {
+        public boolean processResource(JndiConsumer annotatedApp, Resource annotation, Class cls, Method method, Field field) {
             log.debug("processResource( [annotatedApp] " + annotatedApp.toString() + "," + '\n' +
                     "[annotation] " + annotation.toString() + "," + '\n' +
                     "[cls] " + (cls != null ? cls.getName() : null) + "," + '\n' +
@@ -348,13 +342,13 @@ public class ResourceRefBuilder extends 
                 log.debug("processResource(): <resource-ref> found");
 
                 boolean exists = false;
-                ResourceRefType[] resourceRefs = annotatedApp.getResourceRefArray();
-                for (ResourceRefType resourceRef : resourceRefs) {
-                    if (resourceRef.getResRefName().getStringValue().trim().equals(resourceName)) {
+                Collection<ResourceRef> resourceRefs = annotatedApp.getResourceRef();
+                for (ResourceRef resourceRef : resourceRefs) {
+                    if (resourceRef.getResRefName().trim().equals(resourceName)) {
                         if (method != null || field != null) {
-                            InjectionTargetType[] targets = resourceRef.getInjectionTargetArray();
+                            List<InjectionTarget> targets = resourceRef.getInjectionTarget();
                             if (!hasTarget(method, field, targets)) {
-                                configureInjectionTarget(resourceRef.addNewInjectionTarget(), method, field);
+                                resourceRef.getInjectionTarget().add(configureInjectionTarget(method, field));
                             }
                         }
                         exists = true;
@@ -367,25 +361,22 @@ public class ResourceRefBuilder extends 
                         log.debug("processResource(): Does not exist in DD: " + resourceName);
 
                         // Doesn't exist in deployment descriptor -- add new
-                        ResourceRefType resourceRef = annotatedApp.addNewResourceRef();
+                        ResourceRef resourceRef = new ResourceRef();
 
                         //------------------------------------------------------------------------------
                         // <resource-ref> required elements:
                         //------------------------------------------------------------------------------
 
                         // resource-ref-name
-                        JndiNameType resourceRefName = resourceRef.addNewResRefName();
-                        resourceRefName.setStringValue(resourceName);
+                        resourceRef.setResRefName(resourceName);
 
-                        if (!resourceType.equals("")) {
+                        if (!resourceType.isEmpty()) {
                             // resource-ref-type
-                            FullyQualifiedClassType qualifiedClass = resourceRef.addNewResType();
-                            qualifiedClass.setStringValue(resourceType);
+                            resourceRef.setResType(resourceType);
                         }
                         if (method != null || field != null) {
                             // injectionTarget
-                            InjectionTargetType injectionTarget = resourceRef.addNewInjectionTarget();
-                            configureInjectionTarget(injectionTarget, method, field);
+                            resourceRef.getInjectionTarget().add(configureInjectionTarget(method, field));
                         }
 
                         //------------------------------------------------------------------------------
@@ -395,36 +386,31 @@ public class ResourceRefBuilder extends 
                         // description
                         String descriptionAnnotation = annotation.description();
                         if (!descriptionAnnotation.equals("")) {
-                            DescriptionType description = resourceRef.addNewDescription();
-                            description.setStringValue(descriptionAnnotation);
+                            resourceRef.setDescriptions(new Text[]{new Text(null, descriptionAnnotation)});
                         }
 
                         // authentication
                         if (annotation.authenticationType() == Resource.AuthenticationType.CONTAINER) {
-                            ResAuthType resAuth = resourceRef.addNewResAuth();
-                            resAuth.setStringValue("Container");
+                            resourceRef.setResAuth(ResAuth.CONTAINER);
                         } else if (annotation.authenticationType() == Resource.AuthenticationType.APPLICATION) {
-                            ResAuthType resAuth = resourceRef.addNewResAuth();
-                            resAuth.setStringValue("Application");
+                            resourceRef.setResAuth(ResAuth.APPLICATION);
                         }
 
                         // sharing scope
-                        ResSharingScopeType resScope = resourceRef.addNewResSharingScope();
-                        resScope.setStringValue(annotation.shareable() ? "Shareable" : "Unshareable");
+                        resourceRef.setResSharingScope(annotation.shareable() ? ResSharingScope.SHAREABLE : ResSharingScope.UNSHAREABLE);
 
                         // mappedName
                         String mappdedNameAnnotation = annotation.mappedName();
                         if (!mappdedNameAnnotation.equals("")) {
-                            XsdStringType mappedName = resourceRef.addNewMappedName();
-                            mappedName.setStringValue(mappdedNameAnnotation);
+                            resourceRef.setMappedName(mappdedNameAnnotation);
                         }
 
                         // lookup
                         String lookup = annotation.lookup();
                         if (!lookup.equals("")) {
-                            XsdStringType lookupName = resourceRef.addNewLookupName();
-                            lookupName.setStringValue(lookup);
+                            resourceRef.setLookupName(lookup);
                         }
+                        annotatedApp.getResourceRef().add(resourceRef);
                     }
                     catch (Exception anyException) {
                         log.debug("ResourceRefBuilder: Exception caught while processing <resource-ref>");

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java Thu Jun 24 18:06:24 2010
@@ -41,7 +41,7 @@ import org.apache.xmlbeans.XmlObject;
  * */
 public class ResourceAdapterDConfigRoot extends DConfigBeanRootSupport {
     static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[] {
-        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.javaee6.String.class.getClassLoader()),
+//        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.javaee6.String.class.getClassLoader()),
         XmlBeans.typeLoaderForClassLoader(GerConnectorDocument.class.getClassLoader())
     });
 
@@ -78,7 +78,7 @@ public class ResourceAdapterDConfigRoot 
     private void replaceResourceAdapterDConfigBean(GerResourceadapterType resourceAdapter) {
         DDBean ddBean = getDDBean();
         String path = getXpaths()[0];
-        System.out.println("********** Searching XPath "+path+" -- "+ddBean.getChildBean(path));
+//        System.out.println("********** Searching XPath "+path+" -- "+ddBean.getChildBean(path));
         DDBean childDDBean = ddBean.getChildBean(path)[0];
         resourceAdapterDConfigBean = new ResourceAdapterDConfigBean(childDDBean, resourceAdapter);
     }

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java Thu Jun 24 18:06:24 2010
@@ -52,7 +52,7 @@ public class Connector15DCBRoot extends 
     // This may be overcomplicated -- if we don't refer to J2EE types in our schemas
     // then we should only need to use the GerConnectorDocument loader
     static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[] {
-        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.javaee6.String.class.getClassLoader()),
+//        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.javaee6.String.class.getClassLoader()),
         XmlBeans.typeLoaderForClassLoader(GerConnectorDocument.class.getClassLoader())
     });
 

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java?rev=957655&r1=957654&r2=957655&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/datasource/deployment/DataSourceBuilder.java Thu Jun 24 18:06:24 2010
@@ -18,6 +18,7 @@
 package org.apache.geronimo.datasource.deployment;
 
 import java.sql.Connection;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -25,7 +26,6 @@ import java.util.Map;
 import javax.annotation.sql.DataSourceDefinition;
 import javax.annotation.sql.DataSourceDefinitions;
 import javax.resource.ResourceException;
-import javax.sql.DataSource;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.connector.deployment.ConnectorModuleBuilder;
 import org.apache.geronimo.datasource.DataSourceDescription;
@@ -39,14 +39,15 @@ import org.apache.geronimo.gbean.annotat
 import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.j2ee.deployment.EARContext;
 import org.apache.geronimo.j2ee.deployment.Module;
-import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApp;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
 import org.apache.geronimo.naming.reference.ResourceReferenceFactory;
-import org.apache.geronimo.xbeans.javaee6.DataSourceType;
-import org.apache.geronimo.xbeans.javaee6.IsolationLevelType;
-import org.apache.geronimo.xbeans.javaee6.PropertyType;
+import org.apache.openejb.jee.DataSource;
+import org.apache.openejb.jee.IsolationLevel;
+import org.apache.openejb.jee.JndiConsumer;
+import org.apache.openejb.jee.Property;
+import org.apache.openejb.jee.Text;
 import org.apache.xbean.finder.BundleAnnotationFinder;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
@@ -95,7 +96,7 @@ public class DataSourceBuilder extends A
         this.dataSourceQNameSet = buildQNameSet(eeNamespaces, "data-source");
     }
     
-    public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map componentContext) throws DeploymentException {
+    public void buildNaming(JndiConsumer specDD, XmlObject plan, Module module, Map componentContext) throws DeploymentException {
                         
         Bundle bundle = module.getEarContext().getDeploymentBundle();
         
@@ -106,8 +107,7 @@ public class DataSourceBuilder extends A
             throw new DeploymentException("could not create class finder " + bundle, e);
         }
         
-        AnnotatedApp app = module.getAnnotatedApp();
-        
+
         // step 1: process annotations and update deployment descriptor
         List<Class> classes;        
         classes = classFinder.findAnnotatedClasses(DataSourceDefinitions.class);
@@ -115,7 +115,7 @@ public class DataSourceBuilder extends A
             for (Class clazz : classes) {
                 DataSourceDefinitions dsDefinitions = (DataSourceDefinitions) clazz.getAnnotation(DataSourceDefinitions.class);
                 for (DataSourceDefinition dsDefinition : dsDefinitions.value()) {
-                    processDefinition(dsDefinition, app);
+                    processDefinition(dsDefinition, specDD);
                 }
                 
             }
@@ -124,16 +124,17 @@ public class DataSourceBuilder extends A
         if (classes != null) {
             for (Class clazz : classes) {
                 DataSourceDefinition dsDefinition = (DataSourceDefinition) clazz.getAnnotation(DataSourceDefinition.class);
-                processDefinition(dsDefinition, app);
+                processDefinition(dsDefinition, specDD);
             }
         }
         
         // step 2: bind all defined data sources into jndi
-        DataSourceType[] dataSources = app.getDataSourceArray();
+        Collection<DataSource> dataSources = specDD.getDataSource();
         if (dataSources != null) {
-            for (int i = 0; i < dataSources.length; i++) {
+            int i = 0;
+            for (DataSource dataSource: dataSources) {
                 try {
-                    addDataSourceGBean(module, componentContext, dataSources[i], "DataSource-" + i);
+                    addDataSourceGBean(module, componentContext, dataSource, "DataSource-" + i++);
                 } catch (GBeanAlreadyExistsException e) {
                     throw new DeploymentException("Error creating DataSource gbean", e);
                 }
@@ -141,10 +142,10 @@ public class DataSourceBuilder extends A
         }        
     }
 
-    private void addDataSourceGBean(Module module, Map componentContext, DataSourceType ds, String name)
+    private void addDataSourceGBean(Module module, Map componentContext, DataSource ds, String name)
         throws GBeanAlreadyExistsException {
                         
-        String jndiName = ds.getName().getStringValue();
+        String jndiName = ds.getName();
         
         if (lookupJndiContextMap(module, jndiName) != null) {
             return;
@@ -189,101 +190,106 @@ public class DataSourceBuilder extends A
         put(jndiName, ref, module.getJndiContext());
     }
     
-    private DataSourceType processDefinition(DataSourceDefinition dsDefinition, AnnotatedApp annotatedApp) {
-        DataSourceType dataSource = findDataSource(dsDefinition, annotatedApp);
-        if (dataSource == null) {
-            dataSource = annotatedApp.addNewDataSource();
-            dataSource.addNewName().setStringValue(dsDefinition.name());
+    private DataSource processDefinition(DataSourceDefinition dsDefinition, JndiConsumer annotatedApp) {
+        DataSource dataSource = findDataSource(dsDefinition, annotatedApp);
+        boolean existing = dataSource != null;
+        if (!existing) {
+            dataSource = new DataSource();
+            dataSource.setName(dsDefinition.name());
         }
         
-        if (!dataSource.isSetClassName()) {
-            dataSource.addNewClassName().setStringValue(dsDefinition.className());
+        if (dataSource.getClassName() == null) {
+            dataSource.setClassName(dsDefinition.className());
         }
         
-        if (!dataSource.isSetDescription() && dsDefinition.description().trim().length() > 0) {
-            dataSource.addNewDescription().setStringValue(dsDefinition.description().trim());            
+        if (dataSource.getDescription() == null && dsDefinition.description().trim().length() > 0) {
+            dataSource.setDescriptions(new Text[]{new Text(null, dsDefinition.description().trim())});
+
         }
         
-        if (!dataSource.isSetUrl() && dsDefinition.url().trim().length() > 0) {
-            dataSource.addNewUrl().setStringValue(dsDefinition.description().trim());
+        if (dataSource.getUrl() == null && dsDefinition.url().trim().length() > 0) {
+            dataSource.setUrl(dsDefinition.description().trim());
         }
         
-        if (!dataSource.isSetUser() && dsDefinition.user().trim().length() > 0) {
-            dataSource.addNewUser().setStringValue(dsDefinition.user().trim());
+        if (dataSource.getUser() == null && dsDefinition.user().trim().length() > 0) {
+            dataSource.setUser(dsDefinition.user().trim());
         }
         
-        if (!dataSource.isSetPassword() && dsDefinition.password().trim().length() > 0) {
-            dataSource.addNewPassword().setStringValue(dsDefinition.password().trim());
+        if (dataSource.getPassword() == null && dsDefinition.password().trim().length() > 0) {
+            dataSource.setPassword(dsDefinition.password().trim());
         }
         
-        if (!dataSource.isSetDatabaseName() && dsDefinition.databaseName().trim().length() > 0) {
-            dataSource.addNewDatabaseName().setStringValue(dsDefinition.databaseName().trim());
+        if (dataSource.getDatabaseName() == null && dsDefinition.databaseName().trim().length() > 0) {
+            dataSource.setDatabaseName(dsDefinition.databaseName().trim());
         }
         
-        if (!dataSource.isSetPortNumber() && dsDefinition.portNumber() != -1) {
-            dataSource.addNewPortNumber().setStringValue(String.valueOf(dsDefinition.portNumber()));
+        if (dataSource.getPortNumber() == null && dsDefinition.portNumber() != -1) {
+            dataSource.setPortNumber(dsDefinition.portNumber());
         }
         
-        if (!dataSource.isSetServerName() && dsDefinition.serverName().trim().length() > 0) {
-            dataSource.addNewServerName().setStringValue(dsDefinition.serverName().trim());
+        if (dataSource.getServerName() == null && dsDefinition.serverName().trim().length() > 0) {
+            dataSource.setServerName(dsDefinition.serverName().trim());
         }
         
-        if (!dataSource.isSetUrl() && dsDefinition.url().trim().length() > 0) {
-            dataSource.addNewUrl().setStringValue(dsDefinition.url().trim());
+        if (dataSource.getUrl() == null && dsDefinition.url().trim().length() > 0) {
+            dataSource.setUrl(dsDefinition.url().trim());
         }
         
-        if (!dataSource.isSetInitialPoolSize() && dsDefinition.initialPoolSize() != -1) {
-            dataSource.addNewInitialPoolSize().setStringValue(String.valueOf(dsDefinition.initialPoolSize()));            
+        if (dataSource.getInitialPoolSize() == null && dsDefinition.initialPoolSize() != -1) {
+            dataSource.setInitialPoolSize(dsDefinition.initialPoolSize());
         }
         
-        if (!dataSource.isSetMaxPoolSize() && dsDefinition.maxPoolSize() != -1) {
-            dataSource.addNewMaxPoolSize().setStringValue(String.valueOf(dsDefinition.maxPoolSize()));            
+        if (dataSource.getMaxPoolSize() == null && dsDefinition.maxPoolSize() != -1) {
+            dataSource.setMaxPoolSize(dsDefinition.maxPoolSize());
         }
         
-        if (!dataSource.isSetMinPoolSize() && dsDefinition.minPoolSize() != -1) {
-            dataSource.addNewMinPoolSize().setStringValue(String.valueOf(dsDefinition.minPoolSize()));            
+        if (dataSource.getMinPoolSize() == null && dsDefinition.minPoolSize() != -1) {
+            dataSource.setMinPoolSize(dsDefinition.minPoolSize());
         }
         
-        if (!dataSource.isSetMaxIdleTime() && dsDefinition.maxIdleTime() != -1) {
-            dataSource.addNewMaxIdleTime().setStringValue(String.valueOf(dsDefinition.maxIdleTime()));            
+        if (dataSource.getMaxIdleTime() == null && dsDefinition.maxIdleTime() != -1) {
+            dataSource.setMaxIdleTime(dsDefinition.maxIdleTime());
         }
         
-        if (!dataSource.isSetMaxStatements() && dsDefinition.maxStatements() != -1) {
-            dataSource.addNewMaxStatements().setStringValue(String.valueOf(dsDefinition.maxStatements()));            
+        if (dataSource.getMaxStatements() == null && dsDefinition.maxStatements() != -1) {
+            dataSource.setMaxStatements(dsDefinition.maxStatements());
         }
         
-        if (!dataSource.isSetLoginTimeout() && dsDefinition.loginTimeout() != 0) {
-            dataSource.addNewLoginTimeout().setStringValue(String.valueOf(dsDefinition.loginTimeout()));            
+        if (dataSource.getLoginTimeout() == null && dsDefinition.loginTimeout() != 0) {
+            dataSource.setLoginTimeout(dsDefinition.loginTimeout());
         }
         
-        if (!dataSource.isSetIsolationLevel() && dsDefinition.isolationLevel() != -1) {
-            dataSource.setIsolationLevel(IsolationLevelType.Enum.forInt(dsDefinition.isolationLevel()));
+        if (dataSource.getIsolationLevel() == null && dsDefinition.isolationLevel() != -1) {
+            dataSource.setIsolationLevel(IsolationLevel.values()[dsDefinition.isolationLevel()]); 
         }
         
-        if (!dataSource.isSetTransactional()) {
-            dataSource.addNewTransactional().setBooleanValue(dsDefinition.transactional());
+        if (dataSource.getTransactional() == null) {
+            dataSource.setTransactional(dsDefinition.transactional());
         }
         
-        if (dataSource.getPropertyArray() == null || dataSource.getPropertyArray().length == 0) {
+        if (dataSource.getProperty().size() == 0) {
             String[] properties = dsDefinition.properties();
             if (properties != null) {
                 for (String property : properties) {
                     String[] tokens = property.split("=");
-                    PropertyType propertyType = dataSource.addNewProperty();
-                    propertyType.addNewName().setStringValue(tokens[0]);
-                    propertyType.addNewValue().setStringValue(tokens[1]);                    
+                    Property prop = new Property();
+                    prop.setName(tokens[0]);
+                    prop.setValue(tokens[1]);
+                    dataSource.getProperty().add(prop);
                 }               
             }
         }
-        
+        if (!existing) {
+            annotatedApp.getDataSource().add(dataSource);
+        }
         return dataSource;
     }
 
-    private DataSourceType findDataSource(DataSourceDefinition dsDefinition, AnnotatedApp annotatedApp) {
+    private DataSource findDataSource(DataSourceDefinition dsDefinition, JndiConsumer annotatedApp) {
         String dsDefinitionName = getJndiName(dsDefinition.name().trim());
-        DataSourceType[] dataSources = annotatedApp.getDataSourceArray();
-        for (DataSourceType ds : dataSources) {
-            String dsName = getJndiName(ds.getName().getStringValue().trim());
+        Collection<DataSource> dataSources = annotatedApp.getDataSource();
+        for (DataSource ds : dataSources) {
+            String dsName = getJndiName(ds.getName().trim());
             if (dsDefinitionName.equals(dsName)) {
                 return ds;
             }
@@ -291,72 +297,72 @@ public class DataSourceBuilder extends A
         return null;        
     }
     
-    private DataSourceDescription createDataSourceDescription(DataSourceType ds) {
+    private DataSourceDescription createDataSourceDescription(DataSource ds) {
         DataSourceDescription dsDescription = new DataSourceDescription();
         
-        dsDescription.setName(ds.getName().getStringValue());
-        dsDescription.setClassName(ds.getClassName().getStringValue());
+        dsDescription.setName(ds.getName());
+        dsDescription.setClassName(ds.getClassName());
         
-        if (ds.isSetDescription()) {
-            dsDescription.setDescription(ds.getDescription().getStringValue().trim());
+        if (ds.getDescription() != null) {
+            dsDescription.setDescription(ds.getDescription().trim());
         }
         
-        if (ds.isSetUrl()) {
-            dsDescription.setUrl(ds.getUrl().getStringValue().trim());
+        if (ds.getUrl() != null) {
+            dsDescription.setUrl(ds.getUrl().trim());
         }
         
-        if (ds.isSetUser()) {
-            dsDescription.setUser(ds.getUser().getStringValue().trim());
+        if (ds.getUser() != null) {
+            dsDescription.setUser(ds.getUser().trim());
         }
         
-        if (ds.isSetPassword()) {
-            dsDescription.setPassword(ds.getPassword().getStringValue().trim());
+        if (ds.getPassword() != null) {
+            dsDescription.setPassword(ds.getPassword().trim());
         }
         
-        if (ds.isSetDatabaseName()) {
-            dsDescription.setDatabaseName(ds.getDatabaseName().getStringValue().trim());
+        if (ds.getDatabaseName() != null) {
+            dsDescription.setDatabaseName(ds.getDatabaseName().trim());
         }
         
-        if (ds.isSetServerName()) {
-            dsDescription.setServerName(ds.getServerName().getStringValue().trim());
+        if (ds.getServerName() != null) {
+            dsDescription.setServerName(ds.getServerName().trim());
         }
         
-        if (ds.isSetPortNumber()) {
-            dsDescription.setPortNumber(ds.getPortNumber().getBigIntegerValue().intValue());
+        if (ds.getPortNumber() != null) {
+            dsDescription.setPortNumber(ds.getPortNumber());
         }
                 
-        if (ds.isSetLoginTimeout()) {
-            dsDescription.setLoginTimeout(ds.getLoginTimeout().getBigIntegerValue().intValue());      
+        if (ds.getLoginTimeout() != null) {
+            dsDescription.setLoginTimeout(ds.getLoginTimeout());
         }
         
-        PropertyType[] props = ds.getPropertyArray();
+        List<Property> props = ds.getProperty();
         if (props != null) {
             Map<String, String> properties = new HashMap<String, String>();
-            for (PropertyType prop : props) {
-                properties.put(prop.getName().getStringValue().trim(), 
-                               prop.getValue().getStringValue().trim());
+            for (Property prop : props) {
+                properties.put(prop.getName().trim(),
+                               prop.getValue().trim());
             }
             dsDescription.setProperties(properties);
         }
         
         // transaction properties
         
-        if (ds.isSetTransactional()) {
-            dsDescription.setTransactional(ds.getTransactional().getBooleanValue());
+        if (ds.getTransactional()) {
+            dsDescription.setTransactional(ds.getTransactional());
         }
         
-        if (ds.isSetIsolationLevel()) {
-            switch (ds.getIsolationLevel().intValue()) {
-            case IsolationLevelType.INT_TRANSACTION_READ_COMMITTED:
+        if (ds.getIsolationLevel() != null) {
+            switch (ds.getIsolationLevel()) {
+            case TRANSACTION_READ_COMMITTED:
                 dsDescription.setIsolationLevel(Connection.TRANSACTION_READ_COMMITTED);
                 break;
-            case IsolationLevelType.INT_TRANSACTION_READ_UNCOMMITTED:
+            case TRANSACTION_READ_UNCOMMITTED:
                 dsDescription.setIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED);
                 break;
-            case IsolationLevelType.INT_TRANSACTION_REPEATABLE_READ:
+            case TRANSACTION_REPEATABLE_READ:
                 dsDescription.setIsolationLevel(Connection.TRANSACTION_REPEATABLE_READ);
                 break;
-            case IsolationLevelType.INT_TRANSACTION_SERIALIZABLE:
+            case TRANSACTION_SERIALIZABLE:
                 dsDescription.setIsolationLevel(Connection.TRANSACTION_SERIALIZABLE);
                 break;
             }
@@ -364,24 +370,24 @@ public class DataSourceBuilder extends A
         
         // pool properties
         
-        if (ds.isSetInitialPoolSize()) {
-            dsDescription.setInitialPoolSize(ds.getInitialPoolSize().getBigIntegerValue().intValue());
+        if (ds.getInitialPoolSize() != null) {
+            dsDescription.setInitialPoolSize(ds.getInitialPoolSize());
         }
         
-        if (ds.isSetMaxPoolSize()) {
-            dsDescription.setMaxPoolSize(ds.getMaxPoolSize().getBigIntegerValue().intValue());
+        if (ds.getMaxPoolSize() != null) {
+            dsDescription.setMaxPoolSize(ds.getMaxPoolSize());
         }
         
-        if (ds.isSetMinPoolSize()) {
-            dsDescription.setMinPoolSize(ds.getMinPoolSize().getBigIntegerValue().intValue());
+        if (ds.getMinPoolSize() != null) {
+            dsDescription.setMinPoolSize(ds.getMinPoolSize());
         }
         
-        if (ds.isSetMaxStatements()) {
-            dsDescription.setMaxStatements(ds.getMaxStatements().getBigIntegerValue().intValue());
+        if (ds.getMaxStatements() != null) {
+            dsDescription.setMaxStatements(ds.getMaxStatements());
         }
         
-        if (ds.isSetMaxIdleTime()) {
-            dsDescription.setMaxIdleTime(ds.getMaxIdleTime().getBigIntegerValue().intValue());
+        if (ds.getMaxIdleTime() != null) {
+            dsDescription.setMaxIdleTime(ds.getMaxIdleTime());
         }
         
         return dsDescription;



Mime
View raw message