ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1144843 - in /webservices/commons/trunk/modules/axiom/modules: axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/so...
Date Sun, 10 Jul 2011 12:08:20 GMT
Author: veithen
Date: Sun Jul 10 12:08:19 2011
New Revision: 1144843

URL: http://svn.apache.org/viewvc?rev=1144843&view=rev
Log:
Eliminated some duplicate code.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java
    webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java?rev=1144843&r1=1144842&r2=1144843&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
Sun Jul 10 12:08:19 2011
@@ -24,6 +24,7 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.dom.ElementImpl;
 import org.apache.axiom.soap.SOAPConstants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -58,10 +59,31 @@ public abstract class SOAPHeaderImpl ext
         super(envelope, SOAPConstants.HEADER_LOCAL_NAME, builder, factory);
     }
 
-    public abstract SOAPHeaderBlock addHeaderBlock(String localName,
-                                                   OMNamespace ns)
-            throws OMException;
+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
+            throws OMException {
+        
+        if (ns == null || ns.getNamespaceURI().length() == 0) {
+            throw new OMException(
+                    "All the SOAP Header blocks should be namespace qualified");
+        }
+        
+        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
+        if (namespace != null) {
+            ns = namespace;
+        }
+        
+        SOAPHeaderBlock soapHeaderBlock;
+        try {
+            soapHeaderBlock = createHeaderBlock(localName, ns);
+        } catch (SOAPProcessingException e) {
+            throw new OMException(e);
+        }
+        ((OMNodeEx) soapHeaderBlock).setComplete(true);
+        return soapHeaderBlock;
+    }
 
+    protected abstract SOAPHeaderBlock createHeaderBlock(String localname, OMNamespace ns);
+    
     public Iterator getHeadersToProcess(RolePlayer rolePlayer) {
         return null; // TODO: Implement this!
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java?rev=1144843&r1=1144842&r2=1144843&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11HeaderImpl.java
Sun Jul 10 12:08:19 2011
@@ -19,10 +19,8 @@
 
 package org.apache.axiom.soap.impl.dom.soap11;
 
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -54,27 +52,8 @@ public class SOAP11HeaderImpl extends SO
         super(envelope, builder, factory);
     }
 
-    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
-            throws OMException {
-        if (ns == null || ns.getNamespaceURI().length() == 0) {
-            throw new OMException(
-                    "All the SOAP Header blocks should be namespace qualified");
-        }
-
-        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
-        if (namespace != null) {
-            ns = namespace;
-        }
-
-        SOAPHeaderBlock soapHeaderBlock = null;
-        try {
-            soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this,
-                                                        (SOAPFactory) this.factory);
-        } catch (SOAPProcessingException e) {
-            throw new OMException(e);
-        }
-        ((OMNodeEx) soapHeaderBlock).setComplete(true);
-        return soapHeaderBlock;
+    protected SOAPHeaderBlock createHeaderBlock(String localName, OMNamespace ns) {
+        return new SOAP11HeaderBlockImpl(localName, ns, this, (SOAPFactory)factory);
     }
 
     public Iterator extractHeaderBlocks(String role) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java?rev=1144843&r1=1144842&r2=1144843&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
Sun Jul 10 12:08:19 2011
@@ -19,10 +19,8 @@
 
 package org.apache.axiom.soap.impl.dom.soap12;
 
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -52,26 +50,8 @@ public class SOAP12HeaderImpl extends SO
         super(envelope, builder, factory);
     }
 
-    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException
{
-        if (ns == null || ns.getNamespaceURI().length() == 0) {
-            throw new OMException(
-                    "All the SOAP Header blocks should be namespace qualified");
-        }
-
-        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
-        if (namespace != null) {
-            ns = namespace;
-        }
-
-        SOAPHeaderBlock soapHeaderBlock = null;
-        try {
-            soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this,
-                                                        (SOAPFactory) this.factory);
-        } catch (SOAPProcessingException e) {
-            throw new OMException(e);
-        }
-        ((OMNodeEx) soapHeaderBlock).setComplete(true);
-        return soapHeaderBlock;
+    protected SOAPHeaderBlock createHeaderBlock(String localName, OMNamespace ns) {
+        return new SOAP12HeaderBlockImpl(localName, ns, this, (SOAPFactory)factory);
     }
 
 

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java?rev=1144843&r1=1144842&r2=1144843&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
Sun Jul 10 12:08:19 2011
@@ -24,6 +24,7 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAP12Version;
@@ -250,10 +251,31 @@ public abstract class SOAPHeaderImpl ext
         super(envelope, SOAPConstants.HEADER_LOCAL_NAME, builder, factory);
     }
 
-    public abstract SOAPHeaderBlock addHeaderBlock(String localName,
-                                                   OMNamespace ns)
-            throws OMException;
+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
+            throws OMException {
+        
+        if (ns == null || ns.getNamespaceURI().length() == 0) {
+            throw new OMException(
+                    "All the SOAP Header blocks should be namespace qualified");
+        }
+        
+        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
+        if (namespace != null) {
+            ns = namespace;
+        }
+        
+        SOAPHeaderBlock soapHeaderBlock;
+        try {
+            soapHeaderBlock = createHeaderBlock(localName, ns);
+        } catch (SOAPProcessingException e) {
+            throw new OMException(e);
+        }
+        ((OMNodeEx) soapHeaderBlock).setComplete(true);
+        return soapHeaderBlock;
+    }
 
+    protected abstract SOAPHeaderBlock createHeaderBlock(String localname, OMNamespace ns);
+    
     public Iterator getHeadersToProcess(RolePlayer rolePlayer) {
         return new HeaderIterator(new RolePlayerChecker(rolePlayer));
     }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java?rev=1144843&r1=1144842&r2=1144843&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap11/SOAP11HeaderImpl.java
Sun Jul 10 12:08:19 2011
@@ -19,10 +19,8 @@
 
 package org.apache.axiom.soap.impl.llom.soap11;
 
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -58,28 +56,8 @@ public class SOAP11HeaderImpl extends SO
         super(envelope, builder, factory);
     }
 
-    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
-            throws OMException {
-
-        if (ns == null || ns.getNamespaceURI().length() == 0) {
-            throw new OMException(
-                    "All the SOAP Header blocks should be namespace qualified");
-        }
-
-        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
-        if (namespace != null) {
-            ns = namespace;
-        }
-
-        SOAPHeaderBlock soapHeaderBlock = null;
-        try {
-            soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this,
-                                                        (SOAPFactory) this.factory);
-        } catch (SOAPProcessingException e) {
-            throw new OMException(e);
-        }
-        ((OMNodeEx) soapHeaderBlock).setComplete(true);
-        return soapHeaderBlock;
+    protected SOAPHeaderBlock createHeaderBlock(String localName, OMNamespace ns) {
+        return new SOAP11HeaderBlockImpl(localName, ns, this, (SOAPFactory)factory);
     }
 
     public Iterator extractHeaderBlocks(String role) {

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java?rev=1144843&r1=1144842&r2=1144843&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/soap12/SOAP12HeaderImpl.java
Sun Jul 10 12:08:19 2011
@@ -19,10 +19,8 @@
 
 package org.apache.axiom.soap.impl.llom.soap12;
 
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
@@ -58,26 +56,8 @@ public class SOAP12HeaderImpl extends SO
         super(envelope, builder, factory);
     }
 
-    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException
{
-        if (ns == null || ns.getNamespaceURI().length() == 0) {
-            throw new OMException(
-                    "All the SOAP Header blocks should be namespace qualified");
-        }
-
-        OMNamespace namespace = findNamespace(ns.getNamespaceURI(), ns.getPrefix());
-        if (namespace != null) {
-            ns = namespace;
-        }
-
-        SOAPHeaderBlock soapHeaderBlock = null;
-        try {
-            soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this,
-                                                        (SOAPFactory) this.factory);
-        } catch (SOAPProcessingException e) {
-            throw new OMException(e);
-        }
-        ((OMNodeEx) soapHeaderBlock).setComplete(true);
-        return soapHeaderBlock;
+    protected SOAPHeaderBlock createHeaderBlock(String localName, OMNamespace ns) {
+        return new SOAP12HeaderBlockImpl(localName, ns, this, (SOAPFactory)factory);
     }
 
 



Mime
View raw message