incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r541389 - in /incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba: interceptors/ runtime/ types/
Date Thu, 24 May 2007 19:02:18 GMT
Author: bravi
Date: Thu May 24 12:02:15 2007
New Revision: 541389

URL: http://svn.apache.org/viewvc?view=rev&rev=541389
Log:
[YOKO-366] - Adding support for array types.

Added:
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayEventProducer.java
  (with props)
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayListener.java
  (with props)
Modified:
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamInInterceptor.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamOutEndingInterceptor.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaObjectReader.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamWriter.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceListener.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructEventProducer.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructHandler.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructListener.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamInInterceptor.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamInInterceptor.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamInInterceptor.java
Thu May 24 12:02:15 2007
@@ -55,6 +55,7 @@
 import org.apache.yoko.bindings.corba.types.ParameterEventProducer;
 import org.apache.yoko.bindings.corba.types.WrappedParameterSequenceEventProducer;
 import org.apache.yoko.bindings.corba.utils.ContextUtils;
+import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 import org.omg.CORBA.Any;
 import org.omg.CORBA.NVList;
@@ -258,6 +259,7 @@
                         paramName = part.getElementQName();
                     }
                 }
+                paramName = CorbaUtils.processQName(paramName, service);
                 CorbaObjectHandler obj = 
                     CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType,
map, service);
                 streamables[i] = corbaMsg.createStreamableObject(obj, paramName);

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamOutEndingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamOutEndingInterceptor.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamOutEndingInterceptor.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaStreamOutEndingInterceptor.java
Thu May 24 12:02:15 2007
@@ -50,6 +50,7 @@
 import org.apache.yoko.bindings.corba.types.CorbaHandlerUtils;
 import org.apache.yoko.bindings.corba.types.CorbaObjectHandler;
 import org.apache.yoko.bindings.corba.utils.ContextUtils;
+import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 import org.apache.yoko.wsdl.CorbaConstants;
 
 public class CorbaStreamOutEndingInterceptor extends AbstractPhaseInterceptor<Message>
{
@@ -106,12 +107,14 @@
                         paramName = part.getElementQName();
                     }
                 }
+                paramName = CorbaUtils.processQName(paramName, service);
                 obj = CorbaHandlerUtils.initializeObjectHandler(orb,
                                                                 paramName,
                                                                 idlType,
                                                                 typeMap,
                                                                 service);
             } else {
+                paramName = CorbaUtils.processQName(paramName, service);
                 obj = objs[count++];
             }
             CorbaStreamable streamable = message.createStreamableObject(obj, paramName);
@@ -126,7 +129,8 @@
 
         ArgType returnParam = opType.getReturn();
         if (returnParam != null) {
-            QName retName = outMsgInfo.getMessagePartQName(returnParam.getName());
+            QName retName =
+                CorbaUtils.processQName(outMsgInfo.getMessagePartQName(returnParam.getName()),
service);
             QName retIdlType = returnParam.getIdltype();
             CorbaObjectHandler obj = CorbaHandlerUtils
                 .initializeObjectHandler(orb, retName, retIdlType, typeMap, service);
@@ -149,7 +153,8 @@
         ArgType returnParam = opType.getReturn();
         if (returnParam != null) {
             MessageInfo msgOutInfo = opInfo.getOutput();
-            QName retName = msgOutInfo.getMessagePartQName(returnParam.getName());
+            QName retName =
+                CorbaUtils.processQName(msgOutInfo.getMessagePartQName(returnParam.getName()),
service);
             CorbaObjectHandler obj = objs[count++];
             CorbaStreamable streamable = message.createStreamableObject(obj, retName);
             message.setStreamableReturn(streamable);
@@ -167,12 +172,14 @@
                         paramName = part.getElementQName();
                     }              
                 }
+                paramName = CorbaUtils.processQName(paramName, service);
                 obj = CorbaHandlerUtils.initializeObjectHandler(orb,
                                                                 paramName,
                                                                 idlType,
                                                                 typeMap,
                                                                 service);
             } else {
+                paramName = CorbaUtils.processQName(paramName, service);
                 obj = objs[count++];
             }
             CorbaStreamable streamable = message.createStreamableObject(obj, paramName);

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaObjectReader.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaObjectReader.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaObjectReader.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaObjectReader.java
Thu May 24 12:02:15 2007
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.Constructor;
 import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.logging.Level;
@@ -392,7 +393,6 @@
     public void readSequence(CorbaObjectHandler obj) throws CorbaBindingException {
         CorbaSequenceHandler sequenceObj = (CorbaSequenceHandler)obj;
         List<CorbaObjectHandler> seqElements = sequenceObj.getElements();
-
         int length = stream.read_ulong();
         long bound = 0;
         if (obj.getType() instanceof Anonsequence) {
@@ -402,17 +402,23 @@
             Sequence seqType = (Sequence) obj.getType();
             bound = seqType.getBound();
         }
-        if (bound == 0) { 
-            seqElements.clear();
+        List<CorbaObjectHandler> elements = new ArrayList<CorbaObjectHandler>(length);
+        if (bound == 0) {
+            sequenceObj.clear();
             // No predefined elements means an unbounded sequence.  Use the template element
             // to construct each object that is in the input stream.
             CorbaObjectHandler template = sequenceObj.getTemplateElement();
-           
             for (int i = 0; i < length; ++i) {
-                CorbaObjectHandler seqElement = initializeCorbaObjectHandler(template);
+                CorbaObjectHandler seqElement;
+                if (template != null) {
+                    seqElement = initializeCorbaObjectHandler(template);
+                } else {
+                    seqElement = seqElements.get(i);
+                }
                 read(seqElement);
-                seqElements.add(seqElement);
+                elements.add(seqElement);
             }
+            sequenceObj.setElements(elements);
         } else {
             // We have a bounded sequence and the object should already be pre-built
             for (int i = 0; i < length; ++i) {

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamWriter.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamWriter.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamWriter.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStreamWriter.java
Thu May 24 12:02:15 2007
@@ -260,7 +260,7 @@
                                 int start,
                                 int len)
         throws XMLStreamException {
-        throw new XMLStreamException("Not yet implemented");
+        currentTypeListener.processCharacters(new String(text));
     }
 
     public java.lang.String getPrefix(java.lang.String uri)

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnyHandler.java
Thu May 24 12:02:15 2007
@@ -50,6 +50,10 @@
     public Any getValue() {
         return value;
     }
+
+    public void clear() {
+        value = null;
+    }
     
     public void setValue(Any v) throws CorbaBindingException {
         value = v;

Added: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayEventProducer.java?view=auto&rev=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayEventProducer.java
(added)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayEventProducer.java
Thu May 24 12:02:15 2007
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba.types;
+
+import org.apache.cxf.service.model.ServiceInfo;
+
+import org.apache.yoko.bindings.corba.CorbaTypeMap;
+
+import org.omg.CORBA.ORB;
+
+public class CorbaArrayEventProducer extends AbstractStartEndEventProducer {
+
+    public CorbaArrayEventProducer(CorbaObjectHandler h,
+                                   CorbaTypeMap tm,
+                                   ServiceInfo service,
+                                   ORB orbRef) {
+        CorbaArrayHandler handler = (CorbaArrayHandler) h;
+        name = handler.getName();
+        iterator = handler.getElements().iterator();
+        typeMap = tm;
+        serviceInfo = service;
+        orb = orbRef;
+    }
+
+}

Propchange: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayEventProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayEventProducer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayHandler.java
Thu May 24 12:02:15 2007
@@ -47,5 +47,11 @@
     
     public CorbaObjectHandler getElement(int index) {
         return elements.get(index);
-    }    
+    }
+
+    public void clear() {
+        for (int i = 0; i < elements.size(); i++) {
+            elements.get(i).clear();
+        }
+    }  
 }

Added: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayListener.java?view=auto&rev=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayListener.java
(added)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayListener.java
Thu May 24 12:02:15 2007
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.yoko.bindings.corba.types;
+
+import javax.xml.namespace.QName;
+
+import org.apache.schemas.yoko.bindings.corba.Anonarray;
+import org.apache.schemas.yoko.bindings.corba.Array;
+
+import org.apache.yoko.bindings.corba.CorbaTypeMap;
+
+import org.omg.CORBA.ORB;
+
+public class CorbaArrayListener extends AbstractCorbaTypeListener {
+
+    private CorbaArrayHandler value;
+    private QName arrayElementType;
+    private QName currentElName;
+    private CorbaTypeListener currentTypeListener;
+    private ORB orb;
+    private CorbaTypeMap typeMap;
+    
+    public CorbaArrayListener(CorbaObjectHandler handler,
+                              CorbaTypeMap map,
+                              ORB orbRef) {
+        super(handler);
+        value = (CorbaArrayHandler) handler;
+        orb = orbRef;
+        typeMap = map;
+        Object arrayType = handler.getType();
+        if (arrayType instanceof Anonarray) {
+            Anonarray anonType = (Anonarray) arrayType;
+            arrayElementType = anonType.getElemtype();
+        } else {
+            Array type = (Array) arrayType;
+            arrayElementType = type.getElemtype();
+        }
+    }
+
+    public void processStartElement(QName name) {
+        if (currentTypeListener == null) {
+            currentElName = name;
+            currentTypeListener =
+                CorbaHandlerUtils.getTypeListener(name,
+                                                  arrayElementType,
+                                                  typeMap,
+                                                  orb);
+            value.addElement(currentTypeListener.getCorbaObject());
+        } else {
+            currentTypeListener.processStartElement(name);
+        }
+    }
+
+    public void processEndElement(QName name) {
+        if (currentTypeListener != null) {
+            currentTypeListener.processEndElement(name);
+            if (currentElName.equals(name)) {
+                currentTypeListener = null;
+            }
+        }
+    }
+
+    public void processCharacters(String text) {
+        currentTypeListener.processCharacters(text);
+    }
+}

Propchange: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaArrayListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumEventProducer.java
Thu May 24 12:02:15 2007
@@ -22,7 +22,6 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 public class CorbaEnumEventProducer implements CorbaTypeEventProducer {
 
@@ -33,7 +32,7 @@
 
     public CorbaEnumEventProducer(CorbaObjectHandler h, ServiceInfo service) {
         handler = (CorbaEnumHandler) h;
-        name = CorbaUtils.processQName(handler.getName(), service);
+        name = handler.getName();
     }
 
     public String getLocalName() {        

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumHandler.java
Thu May 24 12:02:15 2007
@@ -57,4 +57,8 @@
     public long getIndex() {
         return index;
     }
+
+    public void clear() {
+        value = null;
+    }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionHandler.java
Thu May 24 12:02:15 2007
@@ -72,6 +72,12 @@
     public void setId(String eid) {
         id = eid;
     }
+
+    public void clear() {
+        for (int i = 0; i < members.size(); i++) {
+            members.get(i).clear();
+        }
+    }  
     
     // TODO: Can we add the features that exist in the main package here?
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
Thu May 24 12:02:15 2007
@@ -22,7 +22,6 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 public class CorbaFixedEventProducer implements CorbaTypeEventProducer {
 
@@ -33,7 +32,7 @@
 
     public CorbaFixedEventProducer(CorbaObjectHandler h, ServiceInfo service) {
         handler = (CorbaFixedHandler) h;
-        name = CorbaUtils.processQName(handler.getName(), service);
+        name = handler.getName();
     }
 
     public String getLocalName() {        

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedHandler.java
Thu May 24 12:02:15 2007
@@ -72,4 +72,8 @@
     public void setValueFromData(String data) {
         value = new BigDecimal(data);
     }
+
+    public void clear() {
+        value = null;
+    }  
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
Thu May 24 12:02:15 2007
@@ -49,7 +49,6 @@
 import org.apache.ws.commons.schema.XmlSchemaType;
 
 import org.apache.yoko.bindings.corba.CorbaBindingException;
-//import org.apache.yoko.bindings.corba.CorbaStreamable;
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
 import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
@@ -474,6 +473,8 @@
                 break;
             case TCKind._tk_array:
                 LOG.log(Level.INFO, "Reading array type from XML reader");
+                handler = new CorbaArrayHandler(name, idlType, tc, type);
+                result = new CorbaArrayListener(handler, typeMap, orb);
                 break;
             case TCKind._tk_enum:
                 LOG.log(Level.INFO, "Reading enumeration type from XML reader");
@@ -498,7 +499,7 @@
             case TCKind._tk_string:
             case TCKind._tk_wstring:
                 // These will be the case if we have anonymous strings
-                LOG.log(Level.INFO, "Reading anonymous string from XML reader");
+                LOG.log(Level.INFO, "Reading anonymous string from XML reader");        
   
                 break;
             case TCKind._tk_struct:
                 LOG.log(Level.INFO, "Reading struct type from XML reader");
@@ -538,6 +539,7 @@
                 break;
             case TCKind._tk_array:
                 LOG.log(Level.INFO, "Reading array type from XML reader");
+                result = new CorbaArrayEventProducer(handler, typeMap, serviceInfo, orb);
                 break;
             case TCKind._tk_enum:
                 LOG.log(Level.INFO, "Reading enumeration type from XML reader");
@@ -553,11 +555,7 @@
                 break;
             case TCKind._tk_sequence:
                 LOG.log(Level.INFO, "Reading sequence type from XML reader");
-                if (isPrimitiveIDLTypeSequence(handler)) {
-                    result = new CorbaPrimitiveSequenceEventProducer(handler, typeMap, serviceInfo,
orb);
-                } else {
-                    result = new CorbaSequenceEventProducer(handler, typeMap, serviceInfo,
orb);
-                }
+                result = new CorbaSequenceEventProducer(handler, typeMap, serviceInfo, orb);
                 break;
             case TCKind._tk_string:
             case TCKind._tk_wstring:
@@ -587,7 +585,7 @@
         return result;
     }
 
-    private static boolean isPrimitiveIDLTypeSequence(CorbaObjectHandler handler) {
+    public static boolean isPrimitiveIDLTypeSequence(CorbaObjectHandler handler) {
         CorbaTypeImpl seqType = handler.getType();
         QName seqElementType;
         if (seqType instanceof Anonsequence) {

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java
Thu May 24 12:02:15 2007
@@ -76,4 +76,7 @@
     public boolean isAnonymousType() {
         return isAnon;
     }
+
+    public void clear() {        
+    }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceHandler.java
Thu May 24 12:02:15 2007
@@ -39,4 +39,8 @@
     public void setReference(org.omg.CORBA.Object ref) {
         value = ref;
     }
-}
\ No newline at end of file
+
+    public void clear() {
+        value = null;
+    }  
+}

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveHandler.java
Thu May 24 12:02:15 2007
@@ -143,4 +143,8 @@
             value = data;
         }
     }
+    
+    public void clear() {
+        value = null;
+    }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveTypeEventProducer.java
Thu May 24 12:02:15 2007
@@ -22,7 +22,6 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 public class CorbaPrimitiveTypeEventProducer implements CorbaTypeEventProducer {
 
@@ -33,7 +32,7 @@
 
     public CorbaPrimitiveTypeEventProducer(CorbaObjectHandler h, ServiceInfo service) {
         handler = (CorbaPrimitiveHandler) h;
-        name = CorbaUtils.processQName(handler.getName(), service);
+        name = handler.getName();
     }
 
     public String getLocalName() {        

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceEventProducer.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceEventProducer.java
Thu May 24 12:02:15 2007
@@ -21,20 +21,17 @@
 import org.apache.cxf.service.model.ServiceInfo;
 
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
-import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 import org.omg.CORBA.ORB;
 
 public class CorbaSequenceEventProducer extends AbstractStartEndEventProducer {
 
-    boolean isPrimitiveIdlType;
-
     public CorbaSequenceEventProducer(CorbaObjectHandler h,
                                       CorbaTypeMap tm,
                                       ServiceInfo service,
                                       ORB orbRef) {
         CorbaSequenceHandler handler = (CorbaSequenceHandler) h;
-        name = CorbaUtils.processQName(handler.getName(), service);
+        name = handler.getName();
         iterator = handler.getElements().iterator();
         typeMap = tm;
         serviceInfo = service;

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceHandler.java
Thu May 24 12:02:15 2007
@@ -59,4 +59,14 @@
     public void setTemplateElement(CorbaObjectHandler el) {
         templateElement = el;
     }
+
+    public void setElements(List<CorbaObjectHandler> els) {
+        elements = els;
+    }
+
+    public void clear() {
+        for (int i = 0; i < elements.size(); i++) {
+            elements.get(i).clear();
+        }
+    }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceListener.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceListener.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaSequenceListener.java
Thu May 24 12:02:15 2007
@@ -24,8 +24,12 @@
 import org.apache.schemas.yoko.bindings.corba.Sequence;
 
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+import org.apache.yoko.wsdl.W3CConstants;
 
 import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
 
 public class CorbaSequenceListener extends AbstractCorbaTypeListener {
 
@@ -35,6 +39,7 @@
     private CorbaTypeListener currentTypeListener;
     private ORB orb;
     private CorbaTypeMap typeMap;
+    private CorbaTypeImpl seqType;
     
     public CorbaSequenceListener(CorbaObjectHandler handler,
                                  CorbaTypeMap map,
@@ -43,7 +48,7 @@
         value = (CorbaSequenceHandler) handler;
         orb = orbRef;
         typeMap = map;
-        Object seqType = handler.getType();
+        seqType = handler.getType();
         if (seqType instanceof Anonsequence) {
             Anonsequence anonSeqType = (Anonsequence) seqType;
             seqElementType = anonSeqType.getElemtype();
@@ -79,13 +84,29 @@
     public void processCharacters(String text) {
         if (currentTypeListener == null) {
             // primitive sequence
-            CorbaTypeListener primitiveListener = 
-                CorbaHandlerUtils.getTypeListener(value.getName(),
-                                                  seqElementType,
-                                                  typeMap,
-                                                  orb);
-            value.addElement(primitiveListener.getCorbaObject());
-            primitiveListener.processCharacters(text);      
+            boolean readOctets = seqType.getType().equals(W3CConstants.NT_SCHEMA_BASE64)
+                || seqType.getType().equals(W3CConstants.NT_SCHEMA_HBIN);
+            if (readOctets) {
+                QName valueQName = new QName("value");
+                TypeCode valueTC = orb.get_primitive_tc(TCKind.from_int(TCKind._tk_octet));
+                byte[] bytes = text.getBytes();
+                for (int i = 0; i < bytes.length; i++) {
+                    CorbaPrimitiveHandler handler = new CorbaPrimitiveHandler(valueQName,
+                                                                              seqElementType,
+                                                                              valueTC,
+                                                                              null);
+                    handler.setValue(new Byte(bytes[i]));
+                    value.addElement(handler);
+                }
+            } else {
+                CorbaTypeListener primitiveListener = 
+                    CorbaHandlerUtils.getTypeListener(value.getName(),
+                                                      seqElementType,
+                                                      typeMap,
+                                                      orb);
+                value.addElement(primitiveListener.getCorbaObject());
+                primitiveListener.processCharacters(text);
+            }      
         } else {
             currentTypeListener.processCharacters(text);
         }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructEventProducer.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructEventProducer.java
Thu May 24 12:02:15 2007
@@ -20,7 +20,6 @@
 
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
-import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 import org.omg.CORBA.ORB;
 
@@ -31,10 +30,37 @@
                                     ServiceInfo service,
                                     ORB orbRef) {
         CorbaStructHandler handler = (CorbaStructHandler) h;
-        name = CorbaUtils.processQName(handler.getName(), service);
+        name = handler.getName();
         iterator = handler.members.iterator();
         typeMap = tm;
         serviceInfo = service;
         orb = orbRef;
+    }
+
+    public int next() { 
+        int event = states[state];
+        if (event != 0) {      
+            state++;
+        } else if (currentEventProducer != null && currentEventProducer.hasNext())
{
+            event = currentEventProducer.next();
+        } else if (iterator.hasNext()) {
+            CorbaObjectHandler obj = iterator.next();
+            //Special case for primitive sequence inside struct
+            if ((obj instanceof CorbaSequenceHandler)
+                && (CorbaHandlerUtils.isPrimitiveIDLTypeSequence(obj))) {
+                currentEventProducer =
+                    new CorbaPrimitiveSequenceEventProducer(obj, typeMap, serviceInfo, orb);
+            } else {
+                currentEventProducer =
+                    CorbaHandlerUtils.getTypeEventProducer(obj, typeMap, serviceInfo, orb);
+            }
+            event = currentEventProducer.next();
+        } else {
+            // all done with content, move past state 0
+            event = states[++state];
+            state++;
+            currentEventProducer = null;
+        }
+        return event;
     }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructHandler.java
Thu May 24 12:02:15 2007
@@ -59,4 +59,10 @@
         
         return member;
     }
+
+    public void clear() {
+        for (int i = 0; i < members.size(); i++) {
+            members.get(i).clear();
+        }
+    }  
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructListener.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructListener.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaStructListener.java
Thu May 24 12:02:15 2007
@@ -61,7 +61,7 @@
             }
             currentTypeListener =
                 CorbaHandlerUtils.getTypeListener(elName,
-                                                  structMembers.get(memberCount).getIdltype(),
+                                                  member.getIdltype(),
                                                   typeMap,
                                                   orb);
             value.addMember(currentTypeListener.getCorbaObject());

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java?view=diff&rev=541389&r1=541388&r2=541389
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java
Thu May 24 12:02:15 2007
@@ -204,4 +204,13 @@
         }
         return label;
     }
+
+    public void clear() {
+        if (discriminator != null) {
+            discriminator.clear();          
+        }
+        if (value != null) {
+            value.clear();
+        }
+    }  
 }



Mime
View raw message