You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/11/17 23:17:41 UTC

svn commit: r345345 - in /webservices/axis2/trunk/java/modules: saaj/src/org/apache/axis2/soap/impl/dom/ xml/src/org/apache/axis2/om/util/ xml/src/org/apache/axis2/soap/impl/llom/ xml/src/org/apache/axis2/soap/impl/llom/util/

Author: dims
Date: Thu Nov 17 14:17:33 2005
New Revision: 345345

URL: http://svn.apache.org/viewcvs?rev=345345&view=rev
Log:
Move 2 tiny methods from UtilProvider to ElementHelper and got rid of a package 


Removed:
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/util/
Modified:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/util/ElementHelper.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultCodeImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultReasonImpl.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultSubCodeImpl.java

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java?rev=345345&r1=345344&r2=345345&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java Thu Nov 17 14:17:33 2005
@@ -17,6 +17,7 @@
 package org.apache.axis2.soap.impl.dom;
 
 import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.util.ElementHelper;
 import org.apache.axis2.om.impl.OMOutputImpl;
 import org.apache.axis2.om.impl.llom.OMSerializerUtil;
 import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
@@ -27,7 +28,6 @@
 import org.apache.axis2.soap.SOAPFaultValue;
 import org.apache.axis2.soap.SOAPProcessingException;
 import org.apache.axis2.soap.impl.dom.SOAPElement;
-import org.apache.axis2.soap.impl.llom.util.UtilProvider;
 
 import javax.xml.stream.XMLStreamException;
 
@@ -60,20 +60,20 @@
      * Eran Chinthaka (chinthaka@apache.org)
      */
     public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, value, value);
+        ElementHelper.setNewElement(this, value, value);
     }
 
     public SOAPFaultValue getValue() {
-        return (SOAPFaultValue) UtilProvider.getChildWithName(this,
+        return (SOAPFaultValue) ElementHelper.getChildWithName(this,
                 SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
     }
 
     public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, getSubCode(), value);
+        ElementHelper.setNewElement(this, getSubCode(), value);
     }
 
     public SOAPFaultSubCode getSubCode() {
-        return (SOAPFaultSubCode) UtilProvider.getChildWithName(this,
+        return (SOAPFaultSubCode) ElementHelper.getChildWithName(this,
                 SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
     }
 

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java?rev=345345&r1=345344&r2=345345&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java Thu Nov 17 14:17:33 2005
@@ -18,6 +18,7 @@
 
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.util.ElementHelper;
 import org.apache.axis2.om.impl.llom.OMSerializerUtil;
 import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
 import org.apache.axis2.soap.SOAP12Constants;
@@ -25,7 +26,6 @@
 import org.apache.axis2.soap.SOAPFaultReason;
 import org.apache.axis2.soap.SOAPFaultText;
 import org.apache.axis2.soap.SOAPProcessingException;
-import org.apache.axis2.soap.impl.llom.util.UtilProvider;
 
 import javax.xml.stream.XMLStreamException;
 
@@ -56,11 +56,11 @@
      * Eran Chinthaka (chinthaka@apache.org)
      */
     public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, text, soapFaultText);
+        ElementHelper.setNewElement(this, text, soapFaultText);
     }
 
     public SOAPFaultText getSOAPText() {
-        return (SOAPFaultText) UtilProvider.getChildWithName(this,
+        return (SOAPFaultText) ElementHelper.getChildWithName(this,
                 SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
     }
 

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java?rev=345345&r1=345344&r2=345345&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java Thu Nov 17 14:17:33 2005
@@ -18,11 +18,11 @@
 
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.util.ElementHelper;
 import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPFaultSubCode;
 import org.apache.axis2.soap.SOAPFaultValue;
 import org.apache.axis2.soap.SOAPProcessingException;
-import org.apache.axis2.soap.impl.llom.util.UtilProvider;
 
 public abstract class SOAPFaultSubCodeImpl extends SOAPElement implements SOAPFaultSubCode {
 
@@ -41,27 +41,27 @@
     }
 
     public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, value, soapFaultSubCodeValue);
+        ElementHelper.setNewElement(this, value, soapFaultSubCodeValue);
     }
 
     public SOAPFaultValue getValue() {
         if (value == null) {
             value =
-                    (SOAPFaultValue) UtilProvider.getChildWithName(this,
+                    (SOAPFaultValue) ElementHelper.getChildWithName(this,
                             SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
         }
         return value;
     }
 
     public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, this.subCode, subCode);
+        ElementHelper.setNewElement(this, this.subCode, subCode);
 
     }
 
     public SOAPFaultSubCode getSubCode() {
         if (subCode == null) {
             subCode =
-                    (SOAPFaultSubCode) UtilProvider.getChildWithName(this,
+                    (SOAPFaultSubCode) ElementHelper.getChildWithName(this,
                             SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
         }
         return subCode;

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/util/ElementHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/util/ElementHelper.java?rev=345345&r1=345344&r2=345345&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/util/ElementHelper.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/util/ElementHelper.java Thu Nov 17 14:17:33 2005
@@ -17,8 +17,10 @@
 
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
 
 import javax.xml.namespace.QName;
+import java.util.Iterator;
 
 /**
  * helper class to provide extra utility stuff against elements.
@@ -81,4 +83,26 @@
         return resolveQName(qname, true);
     }
 
+    public static void setNewElement(OMElement parent,
+                                     OMElement myElement,
+                                     OMElement newElement) {
+        if (myElement != null) {
+            myElement.discard();
+        }
+        parent.addChild(newElement);
+        myElement = newElement;
+    }
+
+    public static OMElement getChildWithName(OMElement parent,
+                                             String childName) {
+        Iterator childrenIter = parent.getChildren();
+        while (childrenIter.hasNext()) {
+            OMNode node = (OMNode) childrenIter.next();
+            if (node.getType() == OMNode.ELEMENT_NODE &&
+                    childName.equals(((OMElement) node).getLocalName())) {
+                return (OMElement) node;
+            }
+        }
+        return null;
+    }
 }

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultCodeImpl.java?rev=345345&r1=345344&r2=345345&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultCodeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultCodeImpl.java Thu Nov 17 14:17:33 2005
@@ -17,6 +17,7 @@
 package org.apache.axis2.soap.impl.llom;
 
 import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.util.ElementHelper;
 import org.apache.axis2.om.impl.OMOutputImpl;
 import org.apache.axis2.om.impl.llom.OMSerializerUtil;
 import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
@@ -26,7 +27,6 @@
 import org.apache.axis2.soap.SOAPFaultSubCode;
 import org.apache.axis2.soap.SOAPFaultValue;
 import org.apache.axis2.soap.SOAPProcessingException;
-import org.apache.axis2.soap.impl.llom.util.UtilProvider;
 
 import javax.xml.stream.XMLStreamException;
 
@@ -60,20 +60,20 @@
      * Eran Chinthaka (chinthaka@apache.org)
      */
     public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, value, value);
+        ElementHelper.setNewElement(this, value, value);
     }
 
     public SOAPFaultValue getValue() {
-        return (SOAPFaultValue) UtilProvider.getChildWithName(this,
+        return (SOAPFaultValue) ElementHelper.getChildWithName(this,
                 SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
     }
 
     public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, getSubCode(), value);
+        ElementHelper.setNewElement(this, getSubCode(), value);
     }
 
     public SOAPFaultSubCode getSubCode() {
-        return (SOAPFaultSubCode) UtilProvider.getChildWithName(this,
+        return (SOAPFaultSubCode) ElementHelper.getChildWithName(this,
                 SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
     }
 

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultReasonImpl.java?rev=345345&r1=345344&r2=345345&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultReasonImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultReasonImpl.java Thu Nov 17 14:17:33 2005
@@ -18,6 +18,7 @@
 
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.util.ElementHelper;
 import org.apache.axis2.om.impl.llom.OMSerializerUtil;
 import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
 import org.apache.axis2.soap.SOAP12Constants;
@@ -25,7 +26,6 @@
 import org.apache.axis2.soap.SOAPFaultReason;
 import org.apache.axis2.soap.SOAPFaultText;
 import org.apache.axis2.soap.SOAPProcessingException;
-import org.apache.axis2.soap.impl.llom.util.UtilProvider;
 
 import javax.xml.stream.XMLStreamException;
 
@@ -56,11 +56,11 @@
      * Eran Chinthaka (chinthaka@apache.org)
      */
     public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, text, soapFaultText);
+        ElementHelper.setNewElement(this, text, soapFaultText);
     }
 
     public SOAPFaultText getSOAPText() {
-        return (SOAPFaultText) UtilProvider.getChildWithName(this,
+        return (SOAPFaultText) ElementHelper.getChildWithName(this,
                 SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
     }
 

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultSubCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultSubCodeImpl.java?rev=345345&r1=345344&r2=345345&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultSubCodeImpl.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultSubCodeImpl.java Thu Nov 17 14:17:33 2005
@@ -18,11 +18,11 @@
 
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.util.ElementHelper;
 import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPFaultSubCode;
 import org.apache.axis2.soap.SOAPFaultValue;
 import org.apache.axis2.soap.SOAPProcessingException;
-import org.apache.axis2.soap.impl.llom.util.UtilProvider;
 
 public abstract class SOAPFaultSubCodeImpl extends SOAPElement implements SOAPFaultSubCode {
 
@@ -41,27 +41,27 @@
     }
 
     public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, value, soapFaultSubCodeValue);
+        ElementHelper.setNewElement(this, value, soapFaultSubCodeValue);
     }
 
     public SOAPFaultValue getValue() {
         if (value == null) {
             value =
-                    (SOAPFaultValue) UtilProvider.getChildWithName(this,
+                    (SOAPFaultValue) ElementHelper.getChildWithName(this,
                             SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
         }
         return value;
     }
 
     public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, this.subCode, subCode);
+        ElementHelper.setNewElement(this, this.subCode, subCode);
 
     }
 
     public SOAPFaultSubCode getSubCode() {
         if (subCode == null) {
             subCode =
-                    (SOAPFaultSubCode) UtilProvider.getChildWithName(this,
+                    (SOAPFaultSubCode) ElementHelper.getChildWithName(this,
                             SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
         }
         return subCode;