ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1733133 - in /webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom: om/impl/mixin/ soap/impl/intf/ soap/impl/mixin/
Date Tue, 01 Mar 2016 20:22:35 GMT
Author: veithen
Date: Tue Mar  1 20:22:35 2016
New Revision: 1733133

URL: http://svn.apache.org/viewvc?rev=1733133&view=rev
Log:
Improve the sequence API.

Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/intf/AxiomSOAPFault.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultClassifierSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPFaultSupport.aj

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj?rev=1733133&r1=1733132&r2=1733133&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
Tue Mar  1 20:22:35 2016
@@ -63,6 +63,7 @@ import org.apache.axiom.om.impl.intf.Axi
 import org.apache.axiom.om.impl.intf.AxiomContainer;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomNamespaceDeclaration;
+import org.apache.axiom.om.impl.intf.Sequence;
 import org.apache.axiom.util.namespace.MapBasedNamespaceContext;
 import org.apache.axiom.util.stax.XMLStreamIOException;
 import org.apache.axiom.util.stax.XMLStreamReaderUtils;
@@ -255,15 +256,8 @@ public aspect AxiomElementSupport {
         coreSetNextSibling(null);
     }
     
-    public <T extends OMElement> void AxiomElement.insertChild(Class[] sequence, Class<T>
type, T newChild) {
-        int pos = -1;
-        for (int i=0; i<sequence.length; i++) {
-            if (sequence[i] == type) {
-                pos = i;
-                break;
-            }
-        }
-        if (pos == -1) {
+    public <T extends OMElement> void AxiomElement.insertChild(Sequence sequence, int
pos, T newChild) {
+        if (!sequence.item(pos).isInstance(newChild)) {
             throw new IllegalArgumentException();
         }
         OMNode child = getFirstOMChild();
@@ -274,7 +268,7 @@ public aspect AxiomElementSupport {
                     // the right position
                     return;
                 }
-                if (type.isInstance(child)) {
+                if (sequence.item(pos).isInstance(child)) {
                     // Replace the existing child
                     child.insertSiblingAfter(newChild);
                     child.detach();
@@ -283,7 +277,7 @@ public aspect AxiomElementSupport {
                 // isAfter indicates if the new child should be inserted after the current
child
                 boolean isAfter = false;
                 for (int i=0; i<pos; i++) {
-                    if (sequence[i].isInstance(child)) {
+                    if (sequence.item(i).isInstance(child)) {
                         isAfter = true;
                         break;
                     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/intf/AxiomSOAPFault.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/intf/AxiomSOAPFault.java?rev=1733133&r1=1733132&r2=1733133&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/intf/AxiomSOAPFault.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/intf/AxiomSOAPFault.java
Tue Mar  1 20:22:35 2016
@@ -18,8 +18,9 @@
  */
 package org.apache.axiom.soap.impl.intf;
 
+import org.apache.axiom.om.impl.intf.Sequence;
 import org.apache.axiom.soap.SOAPFault;
 
 public interface AxiomSOAPFault extends AxiomSOAPElement, SOAPFault {
-    Class[] getSequence();
+    Sequence getSequence();
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj?rev=1733133&r1=1733132&r2=1733133&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP11FaultSupport.aj
Tue Mar  1 20:22:35 2016
@@ -19,6 +19,7 @@
 package org.apache.axiom.soap.impl.mixin;
 
 import org.apache.axiom.core.CoreNode;
+import org.apache.axiom.om.impl.intf.Sequence;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAPFaultCode;
 import org.apache.axiom.soap.SOAPFaultDetail;
@@ -28,14 +29,14 @@ import org.apache.axiom.soap.SOAPFaultRo
 import org.apache.axiom.soap.impl.intf.AxiomSOAP11Fault;
 
 public aspect AxiomSOAP11FaultSupport {
-    private static final Class<?>[] sequence = { SOAPFaultCode.class, SOAPFaultReason.class,
-            SOAPFaultRole.class, SOAPFaultDetail.class };
+    private static final Sequence sequence = new Sequence(SOAPFaultCode.class, SOAPFaultReason.class,
+            SOAPFaultRole.class, SOAPFaultDetail.class);
 
     public final Class<? extends CoreNode> AxiomSOAP11Fault.coreGetNodeClass() {
         return AxiomSOAP11Fault.class;
     }
     
-    public final Class[] AxiomSOAP11Fault.getSequence() {
+    public final Sequence AxiomSOAP11Fault.getSequence() {
         return sequence;
     }
     

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultClassifierSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultClassifierSupport.aj?rev=1733133&r1=1733132&r2=1733133&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultClassifierSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultClassifierSupport.aj
Tue Mar  1 20:22:35 2016
@@ -21,6 +21,7 @@ package org.apache.axiom.soap.impl.mixin
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.intf.Sequence;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPFaultSubCode;
 import org.apache.axiom.soap.SOAPFaultValue;
@@ -28,7 +29,7 @@ import org.apache.axiom.soap.impl.factor
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12FaultClassifier;
 
 public aspect AxiomSOAP12FaultClassifierSupport {
-    private static final Class<?>[] sequence = { SOAPFaultValue.class, SOAPFaultSubCode.class
};
+    private static final Sequence sequence = new Sequence(SOAPFaultValue.class, SOAPFaultSubCode.class);
     
     public final boolean AxiomSOAP12FaultClassifier.isChildElementAllowed(OMElement child)
{
         return child instanceof SOAPFaultValue || child instanceof SOAPFaultSubCode;
@@ -39,7 +40,7 @@ public aspect AxiomSOAP12FaultClassifier
     }
 
     public final void AxiomSOAP12FaultClassifier.setValue(SOAPFaultValue value) {
-        insertChild(sequence, SOAPFaultValue.class, value);
+        insertChild(sequence, 0, value);
     }
     
     public final SOAPFaultSubCode AxiomSOAP12FaultClassifier.getSubCode() {
@@ -47,7 +48,7 @@ public aspect AxiomSOAP12FaultClassifier
     }
     
     public final void AxiomSOAP12FaultClassifier.setSubCode(SOAPFaultSubCode subCode) {
-        insertChild(sequence, SOAPFaultSubCode.class, subCode);
+        insertChild(sequence, 1, subCode);
     }
 
     public final QName AxiomSOAP12FaultClassifier.getValueAsQName() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj?rev=1733133&r1=1733132&r2=1733133&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAP12FaultSupport.aj
Tue Mar  1 20:22:35 2016
@@ -19,6 +19,7 @@
 package org.apache.axiom.soap.impl.mixin;
 
 import org.apache.axiom.core.CoreNode;
+import org.apache.axiom.om.impl.intf.Sequence;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPFaultCode;
 import org.apache.axiom.soap.SOAPFaultDetail;
@@ -28,19 +29,19 @@ import org.apache.axiom.soap.SOAPFaultRo
 import org.apache.axiom.soap.impl.intf.AxiomSOAP12Fault;
 
 public aspect AxiomSOAP12FaultSupport {
-    private static final Class<?>[] sequence = { SOAPFaultCode.class, SOAPFaultReason.class,
-            SOAPFaultNode.class, SOAPFaultRole.class, SOAPFaultDetail.class };
+    private static final Sequence sequence = new Sequence(SOAPFaultCode.class, SOAPFaultReason.class,
+            SOAPFaultNode.class, SOAPFaultRole.class, SOAPFaultDetail.class);
 
     public final Class<? extends CoreNode> AxiomSOAP12Fault.coreGetNodeClass() {
         return AxiomSOAP12Fault.class;
     }
     
-    public final Class[] AxiomSOAP12Fault.getSequence() {
+    public final Sequence AxiomSOAP12Fault.getSequence() {
         return sequence;
     }
     
     public final void AxiomSOAP12Fault.setNode(SOAPFaultNode node) {
-        insertChild(sequence, SOAPFaultNode.class, node);
+        insertChild(sequence, 2, node);
     }
 
     public final SOAPFaultCode AxiomSOAP12Fault.getCode() {

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPFaultSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPFaultSupport.aj?rev=1733133&r1=1733132&r2=1733133&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPFaultSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/mixin/AxiomSOAPFaultSupport.aj
Tue Mar  1 20:22:35 2016
@@ -24,6 +24,7 @@ import java.io.StringWriter;
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.intf.Sequence;
 import org.apache.axiom.soap.SOAPConstants;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPFaultCode;
@@ -40,19 +41,21 @@ public aspect AxiomSOAPFaultSupport {
     }
 
     public final void AxiomSOAPFault.setCode(SOAPFaultCode soapFaultCode) {
-        insertChild(getSequence(), SOAPFaultCode.class, soapFaultCode);
+        insertChild(getSequence(), 0, soapFaultCode);
     }
 
     public final void AxiomSOAPFault.setReason(SOAPFaultReason reason) {
-        insertChild(getSequence(), SOAPFaultReason.class, reason);
+        insertChild(getSequence(), 1, reason);
     }
 
     public final void AxiomSOAPFault.setRole(SOAPFaultRole role) {
-        insertChild(getSequence(), SOAPFaultRole.class, role);
+        Sequence sequence = getSequence();
+        insertChild(sequence, sequence.index(SOAPFaultRole.class), role);
     }
 
     public final void AxiomSOAPFault.setDetail(SOAPFaultDetail detail) {
-        insertChild(getSequence(), SOAPFaultDetail.class, detail);
+        Sequence sequence = getSequence();
+        insertChild(sequence, sequence.index(SOAPFaultDetail.class), detail);
     }
 
     public final void AxiomSOAPFault.setException(Exception e) {



Mime
View raw message