cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r538927 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/
Date Thu, 17 May 2007 13:59:44 GMT
Author: gawor
Date: Thu May 17 06:59:42 2007
New Revision: 538927

URL: http://svn.apache.org/viewvc?view=rev&rev=538927
Log:
make getMessagePartIndex/getMessagePartByIndex use the actual index and improve HolderOutInterceptor
processing

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
    incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java?view=diff&rev=538927&r1=538926&r2=538927
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/AbstractMessageContainer.java
Thu May 17 06:59:42 2007
@@ -92,22 +92,19 @@
     }
 
     public int getMessagePartIndex(MessagePartInfo part) {
-        int idx = 0;
         for (MessagePartInfo p : messageParts.values()) {
             if (part == p) {
-                return idx;
+                return p.getIndex();
             }
-            idx++;
         }
         return -1;
     }
+
     public MessagePartInfo getMessagePartByIndex(int i) {
-        int idx = 0;
         for (MessagePartInfo p : messageParts.values()) {
-            if (idx == i) {
+            if (p.getIndex() == i) {
                 return p;
             }
-            ++idx;
         }
         return null;
     }

Modified: incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java?view=diff&rev=538927&r1=538926&r2=538927
==============================================================================
--- incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java
(original)
+++ incubator/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java
Thu May 17 06:59:42 2007
@@ -133,7 +133,7 @@
             }
             int idx = 0;
             for (MessagePartInfo mpi1 : mpil1) {
-                MessagePartInfo mpi2 = mi2.getMessagePartByIndex(idx);
+                MessagePartInfo mpi2 = mpil2.get(idx);
                 if (!mpi1.getTypeClass().equals(mpi2.getTypeClass())) {
                     return false;
                 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java?view=diff&rev=538927&r1=538926&r2=538927
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
Thu May 17 06:59:42 2007
@@ -78,24 +78,18 @@
             for (int i = 0; i < size; i++) {
                 newObjects.add(null);
             }
-            int[] argsOffset = removeOutHolderFromParaList(outObjects, parts, holders, size,
newObjects);
+
+            Object deleteMarker = markOutHolderInParaList(outObjects, parts, holders, newObjects);
             
             if (holders.size() == 0) {
-                
                 return;
             }
             
             int i = 0;
             for (MessagePartInfo part : op.getInput().getMessageParts()) {
-                // if this is an in/out param, we already took care of it above since it
has a holder.
-                if (part.getProperty(ReflectionServiceFactoryBean.MODE_INOUT) != null) {
-                    i++;
-                    continue;
-                }
                 List<String> ordering = part.getMessageInfo().getOperation().getParameterOrdering();
                 if (ordering != null && ordering.size() > 0) {
                     int orderIdx = -1;
-                    int argsIndex = 0;
                     for (int j = 0; j < ordering.size(); j++) {
                         if (ordering.get(j).equals(part.getName().getLocalPart())) {
                             orderIdx = j;
@@ -103,17 +97,28 @@
                         }
                     }
                     if (orderIdx != -1) {                        
-                        newObjects.set(part.getIndex() + argsOffset[argsIndex++], outObjects.get(orderIdx));
+                        newObjects.set(part.getIndex(), getValue(part, outObjects, orderIdx));
                         
                     } else {
-                        newObjects.set(part.getIndex() + argsOffset[argsIndex++], outObjects.get(i));
+                        newObjects.set(part.getIndex(), getValue(part, outObjects, i));
                     }                    
                 } else {
-                    newObjects.set(part.getIndex(), outObjects.get(i));
+                    newObjects.set(part.getIndex(), getValue(part, outObjects, i));
                 }
                 i++;
             }
-            
+
+            if (deleteMarker != null) {
+                // regenerate the param list by removing all params marked with the deleteMarker.
+                Object[] newObjectsArray = newObjects.toArray();
+                newObjects.clear();
+                for (Object param : newObjectsArray) {
+                    if (param != deleteMarker) {
+                        newObjects.add(param);
+                    }
+                }
+            }
+
             message.setContent(List.class, newObjects);
             message.getExchange().put(HolderInInterceptor.CLIENT_HOLDERS, holders);
         } else {
@@ -152,37 +157,40 @@
         }
     }
 
-    private int[] removeOutHolderFromParaList(List<Object> outObjects, 
-                                            List<MessagePartInfo> parts, 
-                                            List<Holder> holders, 
-                                            int size, 
-                                            List<Object> newObjects) {
-        int rmCount = 0;
-        int[] argsOffset = new int[size];
-        int argsIndex = 0;
+    private Object getValue(MessagePartInfo part, List<Object> outObjects, int idx)
{
+        if (part.getProperty(ReflectionServiceFactoryBean.MODE_INOUT) != null) {
+            Holder holder = (Holder) outObjects.get(idx);
+            if (holder == null) {
+                return null;
+            } else {
+                return holder.value;
+            }
+        } else {
+            return outObjects.get(idx);
+        }
+    }
+
+    private Object markOutHolderInParaList(List<Object> outObjects, 
+                                           List<MessagePartInfo> parts, 
+                                           List<Holder> holders, 
+                                           List<Object> newObjects) {
+        Object deleteObject = null;
         for (MessagePartInfo part : parts) {
             int idx = part.getIndex();
-            LOG.fine("part name: " + part.getName() + ", index: " + idx);
-            
             if (idx >= 0) {
                 Holder holder = (Holder) outObjects.get(idx);
-                if (part.getProperty(ReflectionServiceFactoryBean.MODE_INOUT) != null) {
-                    newObjects.set(idx, holder.value);
-                    argsOffset[argsIndex++] = rmCount;
-                    
-                }
+
                 if (part.getProperty(ReflectionServiceFactoryBean.MODE_OUT) != null) {
-                    newObjects.remove(idx + rmCount);
-                    rmCount--;
-                    argsOffset[argsIndex] = rmCount;
+                    if (deleteObject == null) {
+                        deleteObject = new Object();
+                    }
+                    newObjects.set(idx, deleteObject);
                 }
                 
                 holders.add(holder);
             }
         }
-        return argsOffset;
+        return deleteObject;
     }
-    
-    
     
 }



Mime
View raw message