incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r541045 - /incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/
Date Wed, 23 May 2007 19:42:36 GMT
Author: bravi
Date: Wed May 23 12:42:35 2007
New Revision: 541045

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

Added:
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
  (with props)
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnonStructEventProducer.java
  (with props)
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
  (with props)
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedListener.java
  (with props)
Modified:
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractCorbaTypeListener.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumListener.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionListener.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/CorbaObjectReferenceListener.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveListener.java
    incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveSequenceEventProducer.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/CorbaStructListener.java

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractCorbaTypeListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractCorbaTypeListener.java?view=diff&rev=541045&r1=541044&r2=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractCorbaTypeListener.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractCorbaTypeListener.java
Wed May 23 12:42:35 2007
@@ -24,6 +24,12 @@
 public abstract class AbstractCorbaTypeListener implements CorbaTypeListener {
 
     protected QName currentElement;
+    protected CorbaObjectHandler value;
+
+    public AbstractCorbaTypeListener(CorbaObjectHandler handler) {
+        value = handler;
+    }
+
 
     public void processStartElement(QName name) {
         currentElement = name;
@@ -35,5 +41,8 @@
 
     public abstract void processCharacters(String text);
 
-    public abstract CorbaObjectHandler getCorbaObject();
+    public CorbaObjectHandler getCorbaObject() {
+        return value;
+    }
+
 }

Added: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java?view=auto&rev=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
(added)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/AbstractNoStartEndEventProducer.java
Wed May 23 12:42:35 2007
@@ -0,0 +1,51 @@
+package org.apache.yoko.bindings.corba.types;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.yoko.bindings.corba.CorbaTypeMap;
+
+import org.omg.CORBA.ORB;
+
+public abstract class AbstractNoStartEndEventProducer implements CorbaTypeEventProducer {
+    
+    protected CorbaTypeEventProducer currentEventProducer;
+    protected Iterator<CorbaObjectHandler> iterator;
+    protected CorbaTypeMap typeMap;
+    protected ServiceInfo serviceInfo;
+    protected ORB orb;
+
+    public String getLocalName() {
+        return currentEventProducer != null ? currentEventProducer.getLocalName() : null;
+    }
+
+    public QName getName() {
+        return currentEventProducer != null ? currentEventProducer.getName() : null;
+    }
+
+    public String getText() {
+        return currentEventProducer != null ? currentEventProducer.getText() : null;
+    }
+
+    public boolean hasNext() {
+        return (currentEventProducer != null
+                ? currentEventProducer.hasNext() : false)
+            || (iterator != null ? iterator.hasNext() : false); 
+    }
+
+    public int next() {
+        int event = -1;
+        if (currentEventProducer != null && currentEventProducer.hasNext()) {
+            event = currentEventProducer.next();
+        } else if (iterator != null && iterator.hasNext()) {
+            CorbaObjectHandler obj = iterator.next();
+            currentEventProducer = CorbaHandlerUtils.getTypeEventProducer(obj, typeMap, serviceInfo,
orb);
+            event =  currentEventProducer.next();
+        } else {
+            throw new RuntimeException("hasNext reported in error as there is no next event");
+        }
+        return event;
+    }
+}

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

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

Added: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnonStructEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnonStructEventProducer.java?view=auto&rev=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnonStructEventProducer.java
(added)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaAnonStructEventProducer.java
Wed May 23 12:42:35 2007
@@ -0,0 +1,21 @@
+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 CorbaAnonStructEventProducer extends AbstractNoStartEndEventProducer {
+    
+    // No start and end elements for the sequence
+    public CorbaAnonStructEventProducer(CorbaObjectHandler h,
+                                        CorbaTypeMap tm,
+                                        ServiceInfo service,
+                                        ORB orbRef) {
+        CorbaStructHandler handler = (CorbaStructHandler)h;
+        iterator = handler.members.iterator();
+        typeMap = tm;
+        orb = orbRef;
+        serviceInfo = service;
+    }
+}

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

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

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumListener.java?view=diff&rev=541045&r1=541044&r2=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumListener.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaEnumListener.java
Wed May 23 12:42:35 2007
@@ -18,23 +18,13 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
-import javax.xml.namespace.QName;
-
-import org.omg.CORBA.TypeCode;
-
 public class CorbaEnumListener extends AbstractCorbaTypeListener {
 
-    private CorbaEnumHandler value;
-    
-    public CorbaEnumListener(QName enumName, QName enumIdlType, TypeCode enumTC, Object enumType)
{
-        value = new CorbaEnumHandler(enumName, enumIdlType, enumTC, enumType);
-    }
-
-    public CorbaObjectHandler getCorbaObject() {
-        return value;
+    public CorbaEnumListener(CorbaObjectHandler handler) {
+        super(handler);
     }
 
     public void processCharacters(String text) {
-        value.setValue(text);
+        ((CorbaEnumHandler) value).setValue(text);
     }    
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionListener.java?view=diff&rev=541045&r1=541044&r2=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionListener.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaExceptionListener.java
Wed May 23 12:42:35 2007
@@ -23,12 +23,12 @@
 
 import org.apache.schemas.yoko.bindings.corba.Exception;
 import org.apache.schemas.yoko.bindings.corba.MemberType;
+
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
 
 import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
 
-public class CorbaExceptionListener implements CorbaTypeListener {
+public class CorbaExceptionListener extends AbstractCorbaTypeListener {
 
     private CorbaExceptionHandler value;
     private int memberCount;
@@ -38,16 +38,14 @@
     private CorbaTypeMap typeMap;
     private ORB orb;
 
-    public CorbaExceptionListener(QName exName,
-                                  QName exIdlType,
-                                  TypeCode exTC,
-                                  Object exType,
+    public CorbaExceptionListener(CorbaObjectHandler handler,
                                   CorbaTypeMap map,
                                   ORB orbRef) {
-        value = new CorbaExceptionHandler(exName, exIdlType, exTC, exType);
+        super(handler);
+        value = (CorbaExceptionHandler) handler;
         orb = orbRef;
         typeMap = map;
-        exMembers = ((Exception) exType).getMember();
+        exMembers = ((Exception) handler.getType()).getMember();
     }
 
     public void processStartElement(QName name) {
@@ -78,9 +76,4 @@
     public void processCharacters(String text) {
         currentTypeListener.processCharacters(text);
     }
-
-    public CorbaObjectHandler getCorbaObject() {
-        return value;
-    }
-
 }

Added: 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=auto&rev=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
(added)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedEventProducer.java
Wed May 23 12:42:35 2007
@@ -0,0 +1,59 @@
+/**
+ * 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 javax.xml.stream.XMLStreamReader;
+
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.yoko.bindings.corba.utils.CorbaUtils;
+
+public class CorbaFixedEventProducer implements CorbaTypeEventProducer {
+
+    int state;
+    int[] states = {XMLStreamReader.START_ELEMENT, XMLStreamReader.CHARACTERS, XMLStreamReader.END_ELEMENT};
+    final CorbaFixedHandler handler;
+    final QName name;
+
+    public CorbaFixedEventProducer(CorbaObjectHandler h, ServiceInfo service) {
+        handler = (CorbaFixedHandler) h;
+        name = CorbaUtils.processQName(handler.getName(), service);
+    }
+
+    public String getLocalName() {        
+        return handler.getSimpleName();
+    }
+
+    public String getText() {
+        return handler.getValueData();
+    }
+
+    public int next() {
+        return states[state++];
+    }
+
+    public QName getName() {
+        return name;
+    }
+
+    public boolean hasNext() {
+        return state < states.length;
+    }
+
+}

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

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

Added: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedListener.java?view=auto&rev=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedListener.java
(added)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaFixedListener.java
Wed May 23 12:42:35 2007
@@ -0,0 +1,30 @@
+/**
+ * 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;
+
+public class CorbaFixedListener extends AbstractCorbaTypeListener {
+
+    public CorbaFixedListener(CorbaObjectHandler handler) {
+        super(handler);
+    }
+
+    public void processCharacters(String text) {
+        ((CorbaFixedHandler) value).setValueFromData(text);
+    }    
+}

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

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

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=541045&r1=541044&r2=541045
==============================================================================
--- 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
Wed May 23 12:42:35 2007
@@ -180,6 +180,7 @@
                 initializeSequenceHandler(orb, obj, name, schemaType, typeMap, serviceInfo);
                 break;
             case TCKind._tk_struct:
+                //obj.setXmlSchemaObject(schemaType);
                 initializeStructHandler(orb, obj, name, schemaType, typeMap, serviceInfo);
                 break;
             case TCKind._tk_union:
@@ -350,6 +351,9 @@
                                                                    schemaObj,
                                                                    typeMap,
                                                                    serviceInfo);
+            if (isAnonType(schemaObj)) {
+                memberObj.setAnonymousType(true);
+            }
             ((CorbaStructHandler)obj).addMember(memberObj);
         }
     }
@@ -443,6 +447,7 @@
                                                     CorbaTypeMap typeMap,
                                                     ORB orb)
         throws CorbaBindingException {
+        CorbaObjectHandler handler = null;
         TypeCode tc = CorbaUtils.getTypeCode(orb, idlType, typeMap);
         try {
             while (tc.kind().value() == TCKind._tk_alias) {
@@ -459,7 +464,8 @@
         CorbaTypeListener result = null;
         if (CorbaUtils.isPrimitiveIdlType(idlType)) {
             LOG.log(Level.INFO, "Reading primitive type from XML reader");
-            result = new CorbaPrimitiveListener(name, idlType, tc, null);
+            handler = new CorbaPrimitiveHandler(name, idlType, tc, null);
+            result = new CorbaPrimitiveListener(handler);
         } else {
             CorbaTypeImpl type = CorbaUtils.getCorbaType(idlType, typeMap);
             switch (tc.kind().value()) {
@@ -471,18 +477,23 @@
                 break;
             case TCKind._tk_enum:
                 LOG.log(Level.INFO, "Reading enumeration type from XML reader");
-                result = new CorbaEnumListener(name, idlType, tc, type);
+                handler = new CorbaEnumHandler(name, idlType, tc, type);
+                result = new CorbaEnumListener(handler);
                 break;
             case TCKind._tk_except:
                 LOG.log(Level.INFO, "Reading exception type from XML reader");
-                result = new CorbaExceptionListener(name, idlType, tc, type, typeMap, orb);
+                handler = new CorbaExceptionHandler(name, idlType, tc, type);
+                result = new CorbaExceptionListener(handler, typeMap, orb);
                 break;
             case TCKind._tk_fixed:
                 LOG.log(Level.INFO, "Reading fixed type from XML reader");
+                handler = new CorbaFixedHandler(name, idlType, tc, type);
+                result = new CorbaFixedListener(handler);
                 break;
             case TCKind._tk_sequence:
                 LOG.log(Level.INFO, "Reading sequence type from XML reader");
-                result = new CorbaSequenceListener(name, idlType, tc, type, typeMap, orb);
+                handler = new CorbaSequenceHandler(name, idlType, tc, type);
+                result = new CorbaSequenceListener(handler, typeMap, orb);
                 break;
             case TCKind._tk_string:
             case TCKind._tk_wstring:
@@ -491,14 +502,17 @@
                 break;
             case TCKind._tk_struct:
                 LOG.log(Level.INFO, "Reading struct type from XML reader");
-                result = new CorbaStructListener(name, idlType, tc, type, typeMap, orb);
+                handler = new CorbaStructHandler(name, idlType, tc, type);
+                result = new CorbaStructListener(handler, typeMap, orb);
                 break;
             case TCKind._tk_union:
                 LOG.log(Level.INFO, "Reading union type from XML reader");
                 break;
             case TCKind._tk_objref:
                 LOG.log(Level.INFO, "Reading object reference from XML reader");
-                result = new CorbaObjectReferenceListener(name, idlType, tc, type, orb);
+                handler =
+                    new CorbaObjectReferenceHandler(name, idlType, tc, type);
+                result = new CorbaObjectReferenceListener(handler, orb);
                 break;
             default:
                 throw new CorbaBindingException("Unsupported complex type " + idlType);
@@ -518,7 +532,6 @@
         if (CorbaUtils.isPrimitiveIdlType(idlType)) {
             result = new CorbaPrimitiveTypeEventProducer(handler, serviceInfo);
         } else {
-            //CorbaTypeImpl type = CorbaUtils.getCorbaType(idlType, typeMap);
             switch (tc.kind().value()) {
             case TCKind._tk_any:
                 LOG.log(Level.INFO, "Reading any type from XML reader");
@@ -536,6 +549,7 @@
                 break;
             case TCKind._tk_fixed:
                 LOG.log(Level.INFO, "Reading fixed type from XML reader");
+                result = new CorbaFixedEventProducer(handler, serviceInfo);
                 break;
             case TCKind._tk_sequence:
                 LOG.log(Level.INFO, "Reading sequence type from XML reader");
@@ -552,7 +566,11 @@
                 break;
             case TCKind._tk_struct:
                 LOG.log(Level.INFO, "Reading struct type from XML reader");
-                result = new CorbaStructEventProducer(handler, typeMap, serviceInfo, orb);
+                if (handler.isAnonymousType()) {
+                    result = new CorbaAnonStructEventProducer(handler, typeMap, serviceInfo,
orb);
+                } else {
+                    result = new CorbaStructEventProducer(handler, typeMap, serviceInfo,
orb);
+                }
                 break;
             case TCKind._tk_union:
                 LOG.log(Level.INFO, "Reading union type from XML reader");
@@ -580,5 +598,14 @@
             seqElementType = type.getElemtype();
         }
         return CorbaUtils.isPrimitiveIdlType(seqElementType);
+    }
+
+    public static boolean isAnonType(XmlSchemaObject schemaObj) {
+        boolean result = false;        
+        if ((schemaObj != null) && !(schemaObj instanceof XmlSchemaElement)
+             && !(schemaObj instanceof XmlSchemaComplexType)) {
+            result = true;
+        }
+        return result;
     }
 }

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=541045&r1=541044&r2=541045
==============================================================================
--- 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
Wed May 23 12:42:35 2007
@@ -33,6 +33,7 @@
     protected QName idlType;
     protected TypeCode typeCode;
     protected CorbaTypeImpl type;
+    protected boolean isAnon;
 
     public CorbaObjectHandler() {
     }
@@ -66,5 +67,13 @@
     
     public CorbaTypeImpl getType() {
         return type;
+    }
+
+    public void setAnonymousType(boolean anon) {
+        isAnon = anon;
+    }
+
+    public boolean isAnonymousType() {
+        return isAnon;
     }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceListener.java?view=diff&rev=541045&r1=541044&r2=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceListener.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectReferenceListener.java
Wed May 23 12:42:35 2007
@@ -19,12 +19,9 @@
 
 package org.apache.yoko.bindings.corba.types;
 
-import javax.xml.namespace.QName;
-
 import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
 
 
 public class CorbaObjectReferenceListener extends AbstractCorbaTypeListener {
@@ -32,18 +29,12 @@
     private CorbaObjectReferenceHandler value;
     private ORB orb;
 
-    public CorbaObjectReferenceListener(QName objName,
-                                        QName objIdlType,
-                                        TypeCode objTC,
-                                        Object objType,
+    public CorbaObjectReferenceListener(CorbaObjectHandler handler,
                                         ORB orbRef) {
+        super(handler);
         orb = orbRef;
-        value = new CorbaObjectReferenceHandler(objName, objIdlType, objTC, objType);
+        value = (CorbaObjectReferenceHandler) handler;
         value.setReference(null);
-    }
-
-    public CorbaObjectHandler getCorbaObject() {
-        return value;
     }
 
     public void processCharacters(String text) {

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveListener.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveListener.java?view=diff&rev=541045&r1=541044&r2=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveListener.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveListener.java
Wed May 23 12:42:35 2007
@@ -18,23 +18,13 @@
  */
 package org.apache.yoko.bindings.corba.types;
 
-import javax.xml.namespace.QName;
-
-import org.omg.CORBA.TypeCode;
-
 public class CorbaPrimitiveListener extends AbstractCorbaTypeListener {
 
-    private CorbaPrimitiveHandler value;
-    
-    public CorbaPrimitiveListener(QName primName, QName primIdlType, TypeCode primTC, Object
primType) {
-        value = new CorbaPrimitiveHandler(primName, primIdlType, primTC, primType);
-    }
-    
-    public CorbaObjectHandler getCorbaObject() {
-        return value;
-    }
+    public CorbaPrimitiveListener(CorbaObjectHandler handler) {
+        super(handler);
+    }   
     
     public void processCharacters(String text) {
-        value.setValueFromData(text);
+        ((CorbaPrimitiveHandler) value).setValueFromData(text);
     }
 }

Modified: incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveSequenceEventProducer.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveSequenceEventProducer.java?view=diff&rev=541045&r1=541044&r2=541045
==============================================================================
--- incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveSequenceEventProducer.java
(original)
+++ incubator/yoko/branches/perf/src/main/java/org/apache/yoko/bindings/corba/types/CorbaPrimitiveSequenceEventProducer.java
Wed May 23 12:42:35 2007
@@ -1,22 +1,12 @@
 package org.apache.yoko.bindings.corba.types;
 
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
 
 import org.omg.CORBA.ORB;
 
-public class CorbaPrimitiveSequenceEventProducer implements CorbaTypeEventProducer {
+public class CorbaPrimitiveSequenceEventProducer extends AbstractNoStartEndEventProducer
{
     
-    protected CorbaTypeEventProducer currentEventProducer;
-    protected Iterator<CorbaObjectHandler> iterator;
-    private CorbaTypeMap typeMap;
-    private ServiceInfo serviceInfo;
-    private ORB orb;
-
     // No start and end elements for the sequence
     public CorbaPrimitiveSequenceEventProducer(CorbaObjectHandler h,
                                                CorbaTypeMap tm,
@@ -27,37 +17,5 @@
         typeMap = tm;
         orb = orbRef;
         serviceInfo = service;
-    }
-
-    public String getLocalName() {
-        return currentEventProducer != null ? currentEventProducer.getLocalName() : null;
-    }
-
-    public QName getName() {
-        return currentEventProducer != null ? currentEventProducer.getName() : null;
-    }
-
-    public String getText() {
-        return currentEventProducer != null ? currentEventProducer.getText() : null;
-    }
-
-    public boolean hasNext() {
-        return (currentEventProducer != null
-                ? currentEventProducer.hasNext() : false)
-            || (iterator != null ? iterator.hasNext() : false); 
-    }
-
-    public int next() {
-        int event = -1;
-        if (currentEventProducer != null && currentEventProducer.hasNext()) {
-            event = currentEventProducer.next();
-        } else if (iterator != null && iterator.hasNext()) {
-            CorbaObjectHandler obj = iterator.next();
-            currentEventProducer = CorbaHandlerUtils.getTypeEventProducer(obj, typeMap, serviceInfo,
orb);
-            event =  currentEventProducer.next();
-        } else {
-            throw new RuntimeException("hasNext reported in error as there is no next event");
-        }
-        return event;
     }
 }

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=541045&r1=541044&r2=541045
==============================================================================
--- 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
Wed May 23 12:42:35 2007
@@ -26,9 +26,8 @@
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
 
 import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
 
-public class CorbaSequenceListener implements CorbaTypeListener {
+public class CorbaSequenceListener extends AbstractCorbaTypeListener {
 
     private CorbaSequenceHandler value;
     private QName seqElementType;
@@ -37,15 +36,14 @@
     private ORB orb;
     private CorbaTypeMap typeMap;
     
-    public CorbaSequenceListener(QName seqName,
-                                 QName seqIdlType,
-                                 TypeCode seqTC,
-                                 Object seqType,
+    public CorbaSequenceListener(CorbaObjectHandler handler,
                                  CorbaTypeMap map,
                                  ORB orbRef) {
-        value = new CorbaSequenceHandler(seqName, seqIdlType, seqTC, seqType);
+        super(handler);
+        value = (CorbaSequenceHandler) handler;
         orb = orbRef;
         typeMap = map;
+        Object seqType = handler.getType();
         if (seqType instanceof Anonsequence) {
             Anonsequence anonSeqType = (Anonsequence) seqType;
             seqElementType = anonSeqType.getElemtype();
@@ -53,10 +51,6 @@
             Sequence type = (Sequence) seqType;
             seqElementType = type.getElemtype();
         }
-    }
-    
-    public CorbaObjectHandler getCorbaObject() {
-        return value;
     }
 
     public void processStartElement(QName name) {

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=541045&r1=541044&r2=541045
==============================================================================
--- 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
Wed May 23 12:42:35 2007
@@ -25,11 +25,11 @@
 import org.apache.schemas.yoko.bindings.corba.Struct;
 
 import org.apache.yoko.bindings.corba.CorbaTypeMap;
+import org.apache.yoko.bindings.corba.utils.CorbaUtils;
 
 import org.omg.CORBA.ORB;
-import org.omg.CORBA.TypeCode;
 
-public class CorbaStructListener implements CorbaTypeListener {
+public class CorbaStructListener extends AbstractCorbaTypeListener {
 
     private CorbaStructHandler value;
     private int memberCount;
@@ -39,29 +39,37 @@
     private CorbaTypeMap typeMap;
     private ORB orb;
 
-    public CorbaStructListener(QName structName,
-                               QName structIdlType,
-                               TypeCode structTC,
-                               Object structType,
+    public CorbaStructListener(CorbaObjectHandler handler,
                                CorbaTypeMap map,
                                ORB orbRef) {
-        value = new CorbaStructHandler(structName, structIdlType, structTC, structType);
+        super(handler);
         orb = orbRef;
         typeMap = map;
-        structMembers = ((Struct) structType).getMember();
+        structMembers = ((Struct) handler.getType()).getMember();
+        value = (CorbaStructHandler) handler;
     }
 
     public void processStartElement(QName name) {
-        //REVISIT, assume only elements not attrs
         if (currentTypeListener == null) {
-            memberElement = name;
+            QName elName = name;
+            MemberType member = structMembers.get(memberCount);
+            boolean anonType = !name.getLocalPart().equals(member.getName());
+            if (anonType) {
+                elName = CorbaUtils.getEmptyQName();
+            } else {
+                memberElement = name;
+            }
             currentTypeListener =
-                CorbaHandlerUtils.getTypeListener(name,
+                CorbaHandlerUtils.getTypeListener(elName,
                                                   structMembers.get(memberCount).getIdltype(),
                                                   typeMap,
                                                   orb);
             value.addMember(currentTypeListener.getCorbaObject());
             memberCount++;
+            if (anonType) {
+                currentTypeListener.getCorbaObject().setAnonymousType(true);
+                currentTypeListener.processStartElement(name);
+            }
         } else {
             currentTypeListener.processStartElement(name);
         }
@@ -71,17 +79,13 @@
         if (currentTypeListener != null) {
             currentTypeListener.processEndElement(name);
         }
-        if (memberElement.equals(name)) {
+        if ((memberElement != null) && (memberElement.equals(name))) {
             currentTypeListener = null;
         }
     }
 
     public void processCharacters(String text) {
         currentTypeListener.processCharacters(text);
-    }
-
-    public CorbaObjectHandler getCorbaObject() {
-        return value;
     }
 
 }



Mime
View raw message