cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r732710 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/helpers/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/ tools/wsdlto/frontend/...
Date Thu, 08 Jan 2009 14:51:41 GMT
Author: seanoc
Date: Thu Jan  8 06:51:41 2009
New Revision: 732710

URL: http://svn.apache.org/viewvc?rev=732710&view=rev
Log:
More NodeList changes

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSConduitBeanDefinitionParser.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSDestinationBeanDefinitionParser.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=732710&r1=732709&r2=732710&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java Thu Jan  8
06:51:41 2009
@@ -575,7 +575,7 @@
         return ret;
     }
     
-    public static void findAllElementsByTagNameNS(Element el, 
+    private static void findAllElementsByTagNameNS(Element el, 
                                                   String nameSpaceURI, 
                                                   String localName, 
                                                   List<Element> elementList) {
@@ -600,7 +600,7 @@
         return ret;
     }
     
-    public static void findAllElementsByTagName(Element el, String tagName, List<Element>
elementList) {
+    private static void findAllElementsByTagName(Element el, String tagName, List<Element>
elementList) {
         
         if (tagName.equals(el.getTagName())) {
             elementList.add(el);

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?rev=732710&r1=732709&r2=732710&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
Thu Jan  8 06:51:41 2009
@@ -20,6 +20,7 @@
 package org.apache.cxf.binding.soap.interceptor;
 
 import java.io.InputStream;
+import java.util.List;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
@@ -32,7 +33,7 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+//import org.w3c.dom.NodeList;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.Soap11;
@@ -107,17 +108,18 @@
                 // TODO - we could stream read the "known" headers and just DOM read the

                 // unknown ones
                 Element element = doc.getDocumentElement();
-                QName header = soapVersion.getHeader();
-                NodeList headerEls = element.getElementsByTagNameNS(header.getNamespaceURI(),
header
-                    .getLocalPart());
-                for (int i = 0; i < headerEls.getLength(); i++) {
-                    Node currentHead  = headerEls.item(i);
-                    Element hel = DOMUtils.getFirstElement(currentHead);
+                QName header = soapVersion.getHeader();                
+                List<Element> elemList = 
+                    DOMUtils.findAllElementsByTagNameNS(element, 
+                                                        header.getNamespaceURI(), 
+                                                        header.getLocalPart());
+                for (Element elem : elemList) {
+                    Element hel = DOMUtils.getFirstElement(elem);
                     while (hel != null) {
                         // Need to add any attributes that are present on the parent element
                         // which otherwise would be lost.
-                        if (currentHead.hasAttributes()) {
-                            NamedNodeMap nnp = currentHead.getAttributes();
+                        if (elem.hasAttributes()) {
+                            NamedNodeMap nnp = elem.getAttributes();
                             for (int ct = 0; ct < nnp.getLength(); ct++) {
                                 Node attr = nnp.item(ct);
                                 Node headerAttrNode = hel.hasAttributes() 
@@ -135,8 +137,6 @@
                             }
                         }
                         
-//                            System.out.println("READHEADERSINTERCEPTOR : node name : "

-//                            + node.getLocalName() +  " namespace URI" + node.getNamespaceURI());
                         HeaderProcessor p = bus.getExtension(HeaderManager.class)
                             .getHeaderProcessor(hel.getNamespaceURI());
 

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSConduitBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSConduitBeanDefinitionParser.java?rev=732710&r1=732709&r2=732710&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSConduitBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSConduitBeanDefinitionParser.java
Thu Jan  8 06:51:41 2009
@@ -18,14 +18,16 @@
  */
 package org.apache.cxf.transport.jms.spring;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.transport.jms.AddressType;
 import org.apache.cxf.transport.jms.ClientBehaviorPolicyType;
 import org.apache.cxf.transport.jms.ClientConfig;
@@ -48,10 +50,13 @@
         mapElementToJaxbProperty(element, bean, new QName(JMS_NS, "address"), "address",
AddressType.class);
         mapElementToJaxbProperty(element, bean, new QName(JMS_NS, "sessionPool"), "sessionPool",
                                  SessionPoolType.class);
-        NodeList el = element.getElementsByTagNameNS(JMS_NS, "jmsConfig-ref");
+        
+        
+        List<Element> elemList = 
+            DOMUtils.findAllElementsByTagNameNS(element, JMS_NS, "jmsConfig-ref");
 
-        if (el.getLength() == 1) {
-            Node el1 = el.item(0);
+        if (elemList.size() == 1) {
+            Node el1 = elemList.get(0);
             bean.addPropertyReference("jmsConfig", el1.getTextContent());
         }
     }

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSDestinationBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSDestinationBeanDefinitionParser.java?rev=732710&r1=732709&r2=732710&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSDestinationBeanDefinitionParser.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/spring/JMSDestinationBeanDefinitionParser.java
Thu Jan  8 06:51:41 2009
@@ -18,13 +18,15 @@
  */
 package org.apache.cxf.transport.jms.spring;
 
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.transport.jms.AddressType;
 import org.apache.cxf.transport.jms.JMSDestination;
 import org.apache.cxf.transport.jms.ServerBehaviorPolicyType;
@@ -47,11 +49,12 @@
         mapElementToJaxbProperty(element, bean, new QName(JMS_NS, "address"), "address",
                                  AddressType.class);
         mapElementToJaxbProperty(element, bean, new QName(JMS_NS, "sessionPool"), "sessionPool",
-                                 SessionPoolType.class);
-        NodeList el = element.getElementsByTagNameNS(JMS_NS, "jmsConfig-ref");
+                                 SessionPoolType.class);        
+        List<Element> elemList = 
+            DOMUtils.findAllElementsByTagNameNS(element, JMS_NS, "jmsConfig-ref");
 
-        if (el.getLength() == 1) {
-            Node el1 = el.item(0);
+        if (elemList.size() == 1) {
+            Node el1 = elemList.get(0);
             bean.addPropertyReference("jmsConfig", el1.getTextContent());
         }
     }

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=732710&r1=732709&r2=732710&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Thu Jan  8 06:51:41 2009
@@ -489,23 +489,21 @@
         } else if (isValidJaxbBindingFile(reader)) {
             String schemaLocation = root.getAttribute("schemaLocation");
             boolean hasJaxbBindingChild = false;
-            NodeList nlist = root.getElementsByTagNameNS(ToolConstants.JAXB_BINDINGS.getNamespaceURI(),
-                                                             ToolConstants.JAXB_BINDINGS.getLocalPart());
-            for (int i = 0; i < nlist.getLength(); i++) {
-                Node node = nlist.item(i);
-                if (node instanceof Element) {
-                    hasJaxbBindingChild = true;
-                    break;
-                }
-            }
-            nlist = root.getElementsByTagNameNS(ToolConstants.JAXB_BINDINGS.getNamespaceURI(),
-                                                "globalBindings");
-            for (int i = 0; i < nlist.getLength(); i++) {
-                Node node = nlist.item(i);
-                if (node instanceof Element) {
-                    hasJaxbBindingChild = true;
-                    break;
-                }
+            
+            List<Element> elemList = 
+                DOMUtils.findAllElementsByTagNameNS(root, 
+                                                    ToolConstants.JAXB_BINDINGS.getNamespaceURI(),

+                                                    ToolConstants.JAXB_BINDINGS.getLocalPart());

+            if (elemList.size() > 1) {
+                hasJaxbBindingChild = true;
+            }
+            
+            elemList = 
+                DOMUtils.findAllElementsByTagNameNS(root, 
+                                                    ToolConstants.JAXB_BINDINGS.getNamespaceURI(),

+                                                    "globalBindings");
+            if (elemList.size() > 1) {
+                hasJaxbBindingChild = true;
             }
                            
             if (StringUtils.isEmpty(schemaLocation) && !hasJaxbBindingChild) {



Mime
View raw message