You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/09/11 22:49:09 UTC

svn commit: r694469 - in /cxf/branches/2.1.x-fixes: ./ api/src/main/java/org/apache/cxf/service/model/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/ tools/common/src/main/java/org/apache...

Author: dkulp
Date: Thu Sep 11 13:49:07 2008
New Revision: 694469

URL: http://svn.apache.org/viewvc?rev=694469&view=rev
Log:
Merged revisions 694263 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r694263 | seanoc | 2008-09-11 10:11:22 -0400 (Thu, 11 Sep 2008) | 1 line
  
  removed expensive setAttributeNS() calls
........

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
    cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
    cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
    cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
    cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java
    cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
    cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
    cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 11 13:49:07 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Thu Sep 11 13:49:07 2008
@@ -21,6 +21,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -93,9 +94,11 @@
             if (e.getPrefix() == null
                 && !WSDLConstants.NS_SCHEMA_XSD.equals(e.getAttributeNS(WSDLConstants.NS_XMLNS,
                                                                         WSDLConstants.NP_XMLNS))) {
-                e.setAttributeNS(WSDLConstants.NS_XMLNS, 
-                                 WSDLConstants.NP_XMLNS, 
-                                 WSDLConstants.NS_SCHEMA_XSD);
+                
+                Attr attr = e.getOwnerDocument().createAttributeNS(WSDLConstants.NS_XMLNS, 
+                                                                   WSDLConstants.NP_XMLNS);
+                attr.setValue(WSDLConstants.NS_SCHEMA_XSD);
+                e.setAttributeNodeNS(attr);
             }
             setElement(e);
         }

Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java (original)
+++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java Thu Sep 11 13:49:07 2008
@@ -33,6 +33,7 @@
 import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.extensions.schema.SchemaImport;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 
 import org.apache.cxf.Bus;
@@ -106,8 +107,12 @@
                         for (Object prefix : def.getNamespaces().keySet()) {
                             String ns = (String)def.getNamespaces().get(prefix);
                             if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:" + prefix)) {
-                                schemaElem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
-                                                          "xmlns:" + prefix, ns);
+                                String namespace = javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+                                Attr attr = 
+                                    schemaElem.getOwnerDocument().createAttributeNS(namespace, 
+                                                                                    "xmlns:" + prefix);
+                                attr.setValue(ns);
+                                schemaElem.setAttributeNodeNS(attr);
                             }
                         }
                         String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;

Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java (original)
+++ cxf/branches/2.1.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java Thu Sep 11 13:49:07 2008
@@ -48,6 +48,7 @@
 import javax.xml.ws.handler.soap.SOAPHandler;
 import javax.xml.ws.handler.soap.SOAPMessageContext;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -198,9 +199,12 @@
                         SOAPHeader soapHeader = message.getSOAPHeader();
                         Element headerElementNew = (Element)soapHeader.getChildNodes().item(0);
 
-                        SoapVersion soapVersion = Soap11.getInstance();
-                        headerElementNew.setAttributeNS(soapVersion.getNamespace(),
-                                                        "SOAP-ENV:mustUnderstand", "false");
+                        SoapVersion soapVersion = Soap11.getInstance();                        
+                        Attr attr = 
+                            headerElementNew.getOwnerDocument().createAttributeNS(soapVersion.getNamespace(), 
+                                                                                  "SOAP-ENV:mustUnderstand"); 
+                        attr.setValue("false");
+                        headerElementNew.setAttributeNodeNS(attr);          
                     }
                 } catch (Exception e) {
                     throw new Fault(e);
@@ -295,8 +299,11 @@
                         SOAPHeaderElement headerElementNew = (SOAPHeaderElement)it.next();
 
                         SoapVersion soapVersion = Soap11.getInstance();
-                        headerElementNew.setAttributeNS(soapVersion.getNamespace(),
-                                                        "SOAP-ENV:mustUnderstand", "false");
+                        Attr attr = 
+                            headerElementNew.getOwnerDocument().createAttributeNS(soapVersion.getNamespace(), 
+                                                                                  "SOAP-ENV:mustUnderstand"); 
+                        attr.setValue("false");
+                        headerElementNew.setAttributeNodeNS(attr);
                     }
                 } catch (Exception e) {
                     throw new Fault(e);
@@ -514,8 +521,12 @@
         
         Element childElement = doc.createElementNS("http://apache.org/hello_world_rpclit/types",
                                                    "ns2:header1");
+        Attr attr = 
+            childElement.getOwnerDocument().createAttributeNS(soapVersion.getNamespace(), 
+                                                                  "SOAP-ENV:mustUnderstand"); 
+        attr.setValue("true");
+        childElement.setAttributeNodeNS(attr);  
         
-        childElement.setAttributeNS(soapVersion.getNamespace(), "SOAP-ENV:mustUnderstand", "true");
         headerElement.appendChild(childElement);
         envElement.appendChild(headerElement);
         envElement.appendChild(bodyElement);

Modified: cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java (original)
+++ cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/parser/CommandLineParser.java Thu Sep 11 13:49:07 2008
@@ -35,6 +35,7 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -98,11 +99,12 @@
             LOG.log(Level.SEVERE, "FAIL_CREATE_DOM_MSG");
         }
         Element commandEl = resultDoc.createElementNS("http://cxf.apache.org/Xutil/Command", "command");
-
-        // resultDoc.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance","schemaLocation");
-        commandEl.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation",
-                                 "http://cxf.apache.org/Xutil/Command http://cxf.apache.org/schema/xutil/c"
-                                     + "ommand.xsd");
+        
+        Attr attr = 
+            commandEl.getOwnerDocument().createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", 
+                                                                   "xsi:schemaLocation");
+        attr.setValue("http://cxf.apache.org/Xutil/Command http://cxf.apache.org/schema/xutil/commnad.xsd");
+        commandEl.setAttributeNodeNS(attr);     
         commandEl.setAttribute("xmlns", "http://cxf.apache.org/Xutil/Command");
         commandEl.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
         resultDoc.appendChild(commandEl);
@@ -114,8 +116,7 @@
 
         NodeList usageForms = toolspec.getUsageForms();
         if (LOG.isLoggable(Level.FINE)) {
-            LOG
-                .fine("Found " + usageForms.getLength()
+            LOG.fine("Found " + usageForms.getLength()
                       + " alternative forms of usage, will use default form");
         }
         if (usageForms.getLength() > 0) {

Modified: cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java (original)
+++ cxf/branches/2.1.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/util/JAXBUtils.java Thu Sep 11 13:49:07 2008
@@ -22,6 +22,7 @@
 import java.io.File;
 import java.io.FileOutputStream;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -31,6 +32,7 @@
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.tools.common.ToolConstants;
+//import org.apache.cxf.wsdl.WSDLConstants;
 
 public final class JAXBUtils {
     private JAXBUtils() {
@@ -72,7 +74,10 @@
         Document doc = schema.getOwnerDocument();
 
         if (!XMLUtils.hasAttribute(schema, ToolConstants.NS_JAXB_BINDINGS)) {
-            schema.setAttributeNS(ToolConstants.NS_JAXB_BINDINGS, "version", "2.0");
+            Attr attr = 
+                schema.getOwnerDocument().createAttributeNS(ToolConstants.NS_JAXB_BINDINGS, "version");
+            attr.setValue("2.0");
+            schema.setAttributeNodeNS(attr);
         }
 
         Node schemaBindings = innerJaxbBinding(schema);

Modified: cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java (original)
+++ cxf/branches/2.1.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/Stax2DOM.java Thu Sep 11 13:49:07 2008
@@ -36,6 +36,7 @@
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -154,7 +155,9 @@
             Namespace ns = (Namespace) ite.next();
             String name = ns.getPrefix();
             if (!StringUtils.isEmpty(name)) {
-                element.setAttributeNS(xmlns, name, ns.getNamespaceURI());
+                Attr attr = element.getOwnerDocument().createAttributeNS(xmlns, name);
+                attr.setValue(ns.getNamespaceURI());
+                element.setAttributeNodeNS(attr);
             } else {
                 xmlns = ns.getNamespaceURI();
             }

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java (original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java Thu Sep 11 13:49:07 2008
@@ -284,10 +284,12 @@
             NamedNodeMap atts = el.getAttributes();
             for (int x = 0; x < atts.getLength(); x++) {
                 Attr attr = (Attr)atts.item(x);
-                if (ToolConstants.NS_JAXB_BINDINGS.equals(attr.getNamespaceURI())) {
-                    schemaNode.setAttributeNS(attr.getNamespaceURI(),
-                                              attr.getName(),
-                                              attr.getValue());
+                if (ToolConstants.NS_JAXB_BINDINGS.equals(attr.getNamespaceURI())) { 
+                    Attr attrnew = schemaNode.getOwnerDocument().createAttributeNS(attr.getNamespaceURI(), 
+                                                                                attr.getName());
+                    attrnew.setValue(attr.getValue());
+                    schemaNode.setAttributeNodeNS(attrnew);
+                    
                     if ("extensionBindingPrefixes".equals(attr.getLocalName())) {
                         String pfxs = attr.getValue();
                         while (pfxs.length() > 0) {

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java?rev=694469&r1=694468&r2=694469&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java (original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java Thu Sep 11 13:49:07 2008
@@ -338,10 +338,12 @@
             clone = document.createElementNS(node.getNamespaceURI(), node.getNodeName());
             NamedNodeMap attributes = node.getAttributes();
             for (int i = 0; i < attributes.getLength(); i++) {
-                Attr attr = (Attr)attributes.item(i);
-                ((Element)clone).setAttributeNS(attr.getNamespaceURI(),
-                                                attr.getNodeName(),
-                                                attr.getNodeValue());
+                Attr attr = (Attr)attributes.item(i);                
+                Attr attrnew = 
+                    ((Element)clone).getOwnerDocument().createAttributeNS(attr.getNamespaceURI(), 
+                                                                      attr.getNodeName());
+                attrnew.setValue(attr.getNodeValue());
+                ((Element)clone).setAttributeNodeNS(attrnew);    
             }
             break;