geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r474486 - in /geronimo/server/trunk/modules: geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/ geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/ geronimo-naming-builder/src/main/java/org/apache/geronimo/nami...
Date Mon, 13 Nov 2006 20:15:03 GMT
Author: djencks
Date: Mon Nov 13 12:15:03 2006
New Revision: 474486

URL: http://svn.apache.org/viewvc?view=rev&rev=474486
Log:
GERONIMO-2427 fix some problems with namingBuilders: in particular EnvironmentEntryBuilder
wasn't converting elements correctly

Modified:
    geronimo/server/trunk/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java
    geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/NamespaceElementConverter.java
    geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
    geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java

Modified: geronimo/server/trunk/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java?view=diff&rev=474486&r1=474485&r2=474486
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-axis-builder/src/main/java/org/apache/geronimo/axis/builder/AxisServiceRefBuilder.java
Mon Nov 13 12:15:03 2006
@@ -66,11 +66,11 @@
     }
 
     protected boolean willMergeEnvironment(XmlObject specDD, XmlObject plan) {
-         return getServiceRefs(specDD).length > 0;
+        return specDD.selectChildren(serviceRefQNameSet).length > 0;
     }
     
     public void buildNaming(XmlObject specDD, XmlObject plan, Configuration localConfiguration,
Configuration remoteConfiguration, Module module, Map componentContext) throws DeploymentException
{
-        XmlObject[] serviceRefsUntyped = getServiceRefs(specDD);
+        XmlObject[] serviceRefsUntyped = convert(specDD.selectChildren(serviceRefQNameSet),
J2EE_CONVERTER, ServiceRefType.type);
         XmlObject[] gerServiceRefsUntyped = plan == null? NO_REFS: plan.selectChildren(GER_SERVICE_REF_QNAME_SET);
         Map serviceRefMap = mapServiceRefs(gerServiceRefsUntyped);
         ClassLoader cl = module.getEarContext().getClassLoader();
@@ -133,10 +133,6 @@
             getJndiContextMap(componentContext).put(ENV + name, ref);
         }
 
-    }
-
-    private XmlObject[] getServiceRefs(XmlObject specDD) {
-        return convert(specDD.selectChildren(serviceRefQNameSet), J2EE_CONVERTER, ServiceRefType.type);
     }
 
     public QNameSet getSpecQNameSet() {

Modified: geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/NamespaceElementConverter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/NamespaceElementConverter.java?view=diff&rev=474486&r1=474485&r2=474486
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/NamespaceElementConverter.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/NamespaceElementConverter.java
Mon Nov 13 12:15:03 2006
@@ -19,6 +19,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
 
 /**
  * @version $Rev$ $Date$
@@ -29,6 +30,21 @@
 
     public NamespaceElementConverter(String namespace) {
         this.namespace = namespace;
+    }
+
+    public XmlObject convertElement(XmlObject element) {
+        XmlCursor cursor = element.newCursor();
+        try {
+            XmlCursor end = cursor.newCursor();
+            try {
+                convertElement(cursor, end);
+            } finally {
+                end.dispose();
+            }
+        } finally {
+            cursor.dispose();
+        }
+        return element;
     }
 
     public void convertElement(XmlCursor cursor, XmlCursor end) {

Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java?view=diff&rev=474486&r1=474485&r2=474486
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/AbstractNamingBuilder.java
Mon Nov 13 12:15:03 2006
@@ -40,7 +40,6 @@
 import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.SchemaType;
-import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 
 /**
@@ -75,11 +74,11 @@
     }
 
     protected Map getJndiContextMap(Map sharedContext) {
-        return (Map)sharedContext.get(JNDI_KEY);
+        return (Map) sharedContext.get(JNDI_KEY);
     }
 
     protected AbstractName getGBeanName(Map sharedContext) {
-        return (AbstractName)sharedContext.get(GBEAN_NAME_KEY);
+        return (AbstractName) sharedContext.get(GBEAN_NAME_KEY);
     }
 
     protected static QNameSet buildQNameSet(String[] eeNamespaces, String localPart) {
@@ -100,15 +99,7 @@
             XmlObject xmlObject = xmlObjects[i];
             if (xmlObject.schemaType() != type) {
                 xmlObject = xmlObject.copy();
-                XmlCursor start =xmlObject.newCursor();
-                XmlCursor end = xmlObject.newCursor();
-
-                try {
-                    converter.convertElement(start, end);
-                } finally {
-                    start.dispose();
-                    end.dispose();
-                }
+                converter.convertElement(xmlObject);
                 converted[i] = xmlObject.changeType(type);
             } else {
                 converted[i] = xmlObject;
@@ -116,6 +107,7 @@
         }
         return converted;
     }
+
     protected static String getStringValue(org.apache.geronimo.xbeans.j2ee.String string)
{
         if (string == null) {
             return null;
@@ -140,7 +132,7 @@
         if (module != null && moduleType != null) {
             nameMap.put(moduleType, module);
         }
-        if(interfaceTypes != null) {
+        if (interfaceTypes != null) {
             Set trimmed = new HashSet();
             for (Iterator it = interfaceTypes.iterator(); it.hasNext();) {
                 String intf = (String) it.next();

Modified: geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java?view=diff&rev=474486&r1=474485&r2=474486
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/EnvironmentEntryBuilder.java
Mon Nov 13 12:15:03 2006
@@ -32,6 +32,7 @@
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.naming.reference.KernelReference;
 import org.apache.geronimo.xbeans.j2ee.EnvEntryType;
+import org.apache.geronimo.schema.NamespaceElementConverter;
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlObject;
 
@@ -52,9 +53,9 @@
     }
 
     public void buildNaming(XmlObject specDD, XmlObject plan, Configuration localConfiguration,
Configuration remoteConfiguration, Module module, Map componentContext) throws DeploymentException
{
-        XmlObject[] envEntriesUntyped = specDD.selectChildren(envEntryQNameSet);
+        XmlObject[] envEntriesUntyped = convert(specDD.selectChildren(envEntryQNameSet),
J2EE_CONVERTER, EnvEntryType.type);
         for (int i = 0; i < envEntriesUntyped.length; i++) {
-            EnvEntryType envEntry = (EnvEntryType) envEntriesUntyped[i].copy().changeType(EnvEntryType.type);
+            EnvEntryType envEntry = (EnvEntryType) envEntriesUntyped[i];
             String name = envEntry.getEnvEntryName().getStringValue().trim();
             String type = envEntry.getEnvEntryType().getStringValue().trim();
             String text = envEntry.getEnvEntryValue().getStringValue().trim();



Mime
View raw message