You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by br...@apache.org on 2006/10/24 18:11:35 UTC

svn commit: r467425 [2/2] - in /incubator/yoko/branches/cxf_port: api/src/main/java/org/apache/yoko/wsdl/ bindings/src/main/java/org/apache/yoko/bindings/corba2/ bindings/src/main/java/org/apache/yoko/bindings/corba2/interceptors/ bindings/src/main/jav...

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaArrayHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaArrayHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaEnumHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaEnumHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaEnumHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaEnumHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,60 @@
+/**
+ * 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.corba2.types;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.schemas.yoko.bindings.corba.Enum;
+import org.apache.schemas.yoko.bindings.corba.Enumerator;
+import org.omg.CORBA.TypeCode;
+
+public class CorbaEnumHandler extends CorbaObjectHandler {
+
+    private String value;
+    private long index;
+    
+    public CorbaEnumHandler(QName enumName, QName enumIdlType, TypeCode enumTC, Object enumType) {
+        super(enumName, enumIdlType, enumTC, enumType);
+    }
+    
+    public String getValue() {
+        return value;
+    }
+    
+    public void setValue(String val) {
+        value = val;
+        
+        Enum enumType = (Enum)this.type;
+        List<Enumerator> enumerators = enumType.getEnumerator();
+        index = -1;
+        for (int i = 0; i < enumerators.size(); ++i) {
+            Enumerator e = enumerators.get(i);
+            if (e.getValue().equals(val)) {
+                index = i;
+                break;
+            }
+        }
+    }
+    
+    public long getIndex() {
+        return index;
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaEnumHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaEnumHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaExceptionHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaExceptionHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaExceptionHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaExceptionHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,77 @@
+/**
+ * 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.corba2.types;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.schemas.yoko.bindings.corba.NamedType;
+import org.omg.CORBA.TypeCode;
+
+public class CorbaExceptionHandler extends CorbaObjectHandler {
+
+    List<CorbaObjectHandler> members = new ArrayList<CorbaObjectHandler>();
+    String id;
+    
+    public CorbaExceptionHandler(QName exName, QName exIdlType, TypeCode exTC, Object exType) {
+        name = exName;
+        idlType = exIdlType;
+        typeCode = exTC;
+        type = (NamedType)exType;
+    }
+    
+    public void addMember(CorbaObjectHandler member) {
+        members.add(member);
+    }
+    
+    public List<CorbaObjectHandler> getMembers() {
+        return members;
+    }
+    
+    public CorbaObjectHandler getMember(int index) {
+        return members.get(index);
+    }
+    
+    public CorbaObjectHandler getMemberByName(String name) {
+        CorbaObjectHandler member = null;
+        
+        for (Iterator<CorbaObjectHandler> iterator = members.iterator(); iterator.hasNext();) {
+            CorbaObjectHandler current = iterator.next();
+            if (current.getName().getLocalPart().equals(name)) {
+                member = current;
+                break;
+            }
+        }
+        
+        return member;
+    }
+    
+    public String getId() {
+        return id;
+    }
+    
+    public void setId(String eid) {
+        id = eid;
+    }
+    
+    // TODO: Can we add the features that exist in the main package here?
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaExceptionHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaExceptionHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaFixedHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaFixedHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaFixedHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaFixedHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,75 @@
+/**
+ * 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.corba2.types;
+
+import java.math.BigDecimal;
+
+import javax.xml.namespace.QName;
+
+import org.apache.schemas.yoko.bindings.corba.Anonfixed;
+import org.apache.schemas.yoko.bindings.corba.Fixed;
+
+import org.omg.CORBA.TypeCode;
+
+public class CorbaFixedHandler extends CorbaObjectHandler {
+
+    private final long digits;
+    private final long scale;
+    private BigDecimal value;
+    
+    public CorbaFixedHandler(QName fixedName, QName fixedIdlType, TypeCode fixedTC, Object fixedType) {
+        super(fixedName, fixedIdlType, fixedTC, fixedType);
+        
+        if (fixedType instanceof Fixed) {
+            digits = ((Fixed)fixedType).getDigits();
+            scale = ((Fixed)fixedType).getScale();
+        } else if (fixedType instanceof Anonfixed) {
+            digits = ((Anonfixed)fixedType).getDigits();
+            scale = ((Anonfixed)fixedType).getScale();
+        } else {
+            // This should never happen
+            digits = 0;
+            scale = 0;
+        }
+    }
+    
+    public long getDigits() {
+        return digits;
+    }
+    
+    public long getScale() {
+        return scale;
+    }
+    
+    public BigDecimal getValue() {
+        return value;
+    }
+    
+    public String getValueData() {
+        return value.toString();
+    }
+    
+    public void setValue(BigDecimal val) {
+        value = val;
+    }
+    
+    public void setValueFromData(String data) {
+        value = new BigDecimal(data);
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaFixedHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaFixedHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaHandlerUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaHandlerUtils.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaHandlerUtils.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaHandlerUtils.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,228 @@
+/**
+ * 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.corba2.types;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.schemas.yoko.bindings.corba.Anonarray;
+import org.apache.schemas.yoko.bindings.corba.Anonsequence;
+import org.apache.schemas.yoko.bindings.corba.Array;
+import org.apache.schemas.yoko.bindings.corba.Exception;
+import org.apache.schemas.yoko.bindings.corba.MemberType;
+import org.apache.schemas.yoko.bindings.corba.Sequence;
+import org.apache.schemas.yoko.bindings.corba.Struct;
+import org.apache.schemas.yoko.bindings.corba.Union;
+import org.apache.schemas.yoko.bindings.corba.Unionbranch;
+//import org.apache.yoko.bindings.corba.CorbaConstants;
+import org.apache.yoko.bindings.corba2.CorbaTypeMap;
+import org.apache.yoko.bindings.corba2.CorbaUtils;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+public class CorbaHandlerUtils {
+
+    public static CorbaObjectHandler createTypeHandler(ORB orb, QName name, 
+                                                       QName idlType, List<CorbaTypeMap> typeMaps) {
+        CorbaObjectHandler handler = null;
+
+        TypeCode tc = CorbaUtils.getTypeCode(orb, idlType, typeMaps);
+        if (CorbaUtils.isPrimitiveIdlType(idlType)) {
+            // Any is a special primitive
+            if (tc.kind().value() == TCKind._tk_any) {
+                handler = new CorbaAnyHandler(name, idlType, tc, null);                
+            } else {
+                handler = new CorbaPrimitiveHandler(name, idlType, tc, null);
+            }
+        } else {
+            CorbaTypeImpl type = CorbaUtils.getCorbaType(idlType, typeMaps);
+
+            switch (tc.kind().value()) {
+            case TCKind._tk_array:
+                handler = new CorbaArrayHandler(name, idlType, tc, type);
+                break;
+            case TCKind._tk_enum:
+                handler = new CorbaEnumHandler(name, idlType, tc, type);
+                break;
+            case TCKind._tk_except:
+                handler = new CorbaExceptionHandler(name, idlType, tc, type);
+                break;
+            case TCKind._tk_fixed:
+                handler = new CorbaFixedHandler(name, idlType, tc, type);
+                break;
+            case TCKind._tk_sequence:
+                handler = new CorbaSequenceHandler(name, idlType, tc, type);
+                break;
+            case TCKind._tk_struct:
+                handler = new CorbaStructHandler(name, idlType, tc, type);
+                break;
+            case TCKind._tk_union:
+                handler = new CorbaUnionHandler(name, idlType, tc, type);
+                break;
+            case TCKind._tk_string:
+            case TCKind._tk_wstring:
+                // These need to be here to catch the anonymous string types.
+                handler = new CorbaPrimitiveHandler(name, idlType, tc, type);
+                break;
+            default:
+                handler = new CorbaObjectHandler(name, idlType, tc, type);                
+            }
+        }
+
+        return handler;
+    }
+    
+    public static CorbaObjectHandler initializeObjectHandler(ORB orb, QName name, 
+                                                             QName idlType, List<CorbaTypeMap> typeMaps) {
+        CorbaObjectHandler obj = createTypeHandler(orb, name, idlType, typeMaps);
+
+        if (!CorbaUtils.isPrimitiveIdlType(idlType)) {
+            switch (obj.getTypeCode().kind().value()) {
+            case TCKind._tk_array:
+                initializeArrayHandler(orb, obj, name, typeMaps);
+                break;
+            case TCKind._tk_except:
+                initializeExceptionHandler(orb, obj, name, typeMaps);
+                break;
+            case TCKind._tk_sequence:
+                initializeSequenceHandler(orb, obj, name, typeMaps);
+                break;
+            case TCKind._tk_struct:
+                initializeStructHandler(orb, obj, name, typeMaps);
+                break;
+            case TCKind._tk_union:
+                initializeUnionHandler(orb, obj, name, typeMaps);
+                break;
+
+            default:
+               // TODO: Should we raise an exception or log?
+            }
+        }
+        return obj;
+    }
+    
+    public static void initializeArrayHandler(ORB orb, CorbaObjectHandler obj, 
+                                              QName name, List<CorbaTypeMap> typeMaps) {
+        QName arrayElementType = null;
+        long arrayBound = 0;
+        CorbaTypeImpl baseType = obj.getType();
+        if (baseType instanceof Array) {
+            Array arrayType = (Array)baseType;
+            arrayElementType = arrayType.getElemtype();
+            arrayBound = arrayType.getBound();
+        } else {
+            Anonarray anonArrayType = (Anonarray)baseType;
+            arrayElementType = anonArrayType.getElemtype();
+            arrayBound = anonArrayType.getBound();
+        }
+        for (int i = 0; i < arrayBound; ++i) {
+            QName elementName = new QName(name.getNamespaceURI(), "item");
+            CorbaObjectHandler elementObj = 
+                initializeObjectHandler(orb, elementName, arrayElementType, typeMaps);
+            ((CorbaArrayHandler)obj).addElement(elementObj);
+        }
+    }
+    
+    public static void initializeExceptionHandler(ORB orb, CorbaObjectHandler obj, 
+                                                  QName name, List<CorbaTypeMap> typeMaps) {
+        Exception exceptType = (Exception)obj.getType();
+        List<MemberType> exceptMembers = exceptType.getMember();
+
+        for (int i = 0; i < exceptMembers.size(); ++i) {
+            MemberType member = exceptMembers.get(i);
+            QName memberName = new QName(name.getNamespaceURI(), member.getName());
+            QName memberType = member.getIdltype();
+            CorbaObjectHandler memberObj = 
+                initializeObjectHandler(orb, memberName, memberType, typeMaps);
+            ((CorbaExceptionHandler)obj).addMember(memberObj);
+        }
+    }
+    
+    public static void initializeSequenceHandler(ORB orb, CorbaObjectHandler obj, 
+                                                 QName name, List<CorbaTypeMap> typeMaps) {
+        QName seqElementType = null;
+        long seqBound = 0;
+        CorbaTypeImpl baseType = obj.getType();
+        if (baseType instanceof Sequence) {
+            Sequence seqType = (Sequence)baseType;
+            seqElementType = seqType.getElemtype();
+            seqBound = seqType.getBound();
+        } else {
+            Anonsequence seqType = (Anonsequence)baseType;
+            seqElementType = seqType.getElemtype();
+            seqBound = seqType.getBound();
+        }
+        if (seqBound == 0) {
+            // This is an unbounded sequence.  Store a 'template' object that we can use to create
+            // new objects as needed
+            QName elementName = new QName(name.getNamespaceURI(), "item");
+            CorbaObjectHandler elementObj = 
+                initializeObjectHandler(orb, elementName, seqElementType, typeMaps);
+            ((CorbaSequenceHandler)obj).setTemplateElement(elementObj);
+        }
+        for (int i = 0; i < seqBound; ++i) {
+            QName elementName = new QName(name.getNamespaceURI(), "item");
+            CorbaObjectHandler elementObj = 
+                initializeObjectHandler(orb, elementName, seqElementType, typeMaps);
+            ((CorbaSequenceHandler)obj).addElement(elementObj);
+        }
+    }
+    
+    public static void initializeStructHandler(ORB orb, CorbaObjectHandler obj, 
+                                               QName name, List<CorbaTypeMap> typeMaps) {
+        Struct structType = (Struct)obj.getType();
+        List<MemberType> structMembers = structType.getMember();
+
+        for (int i = 0; i < structMembers.size(); ++i) {
+            MemberType member = structMembers.get(i);
+            QName memberName = new QName(name.getNamespaceURI(), member.getName());
+            QName memberType = member.getIdltype();
+            CorbaObjectHandler memberObj = 
+                initializeObjectHandler(orb, memberName, memberType, typeMaps);
+            ((CorbaStructHandler)obj).addMember(memberObj);
+        }
+    }
+    
+    public static void initializeUnionHandler(ORB orb, CorbaObjectHandler obj, 
+                                              QName name, List<CorbaTypeMap> typeMaps) {
+        Union unionType = (Union)obj.getType();
+        // First handle the discriminator
+        CorbaObjectHandler discObj = initializeObjectHandler(orb, 
+                                                             new QName("discriminator"),
+                                                             unionType.getDiscriminator(),
+                                                             typeMaps);
+        ((CorbaUnionHandler)obj).setDiscriminator(discObj);
+        
+        // Now handle all of the branches
+        List<Unionbranch> unionBranches = unionType.getUnionbranch();
+        for (Iterator<Unionbranch> iter = unionBranches.iterator(); iter.hasNext();) {
+            Unionbranch branch = iter.next();
+            QName branchName = new QName(name.getNamespaceURI(), branch.getName());
+            QName branchIdlType = branch.getIdltype();
+            CorbaObjectHandler branchObj = 
+                initializeObjectHandler(orb, branchName, branchIdlType, typeMaps);
+            ((CorbaUnionHandler)obj).addCase(branchObj);
+        }
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaHandlerUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaHandlerUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaObjectHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaObjectHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaObjectHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaObjectHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,73 @@
+/**
+ * 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.corba2.types;
+
+import javax.xml.namespace.QName;
+
+//import org.apache.schemas.yoko.bindings.corba.NamedType;
+import org.apache.yoko.wsdl.CorbaTypeImpl;
+
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+// This class serves as a base for all other specific object type handlers and 
+// provides basic functionality that is common for all objects.
+public class CorbaObjectHandler {
+
+    protected QName name;
+    protected QName idlType;
+    protected TypeCode typeCode;
+    //protected NamedType type;
+    protected CorbaTypeImpl type;
+    public CorbaObjectHandler() {
+    }
+    
+    public CorbaObjectHandler(QName objName, QName objIdlType, TypeCode objTC, Object objType) {
+        name = objName;
+        idlType = objIdlType;
+        typeCode = objTC;
+//        type = (NamedType)objType;
+        type = (CorbaTypeImpl)objType;
+    }
+    
+    public QName getName() {
+        return name;
+    }
+    
+    public String getSimpleName() {
+        return name.getLocalPart();
+    }
+    
+    public QName getIdlType() {
+        return idlType;
+    }
+    
+    public TypeCode getTypeCode() {
+        return typeCode;
+    }
+    
+    public TCKind getTypeCodeKind() {
+        return typeCode.kind();
+    }
+    
+//    public NamedType getType() {
+    public CorbaTypeImpl getType() {
+        return type;
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaObjectHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaObjectHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaPrimitiveHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaPrimitiveHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaPrimitiveHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaPrimitiveHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,138 @@
+/**
+ * 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.corba2.types;
+
+import javax.xml.namespace.QName;
+
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+public class CorbaPrimitiveHandler extends CorbaObjectHandler {
+
+    private Object value;
+    
+    public CorbaPrimitiveHandler(QName primName, QName primIdlType, TypeCode primTC, Object primType) {
+        super(primName, primIdlType, primTC, primType);
+    }
+    
+    public Object getValue() {
+        return value;
+    }
+    
+    public String getValueData() {
+        String data = "";
+
+        switch (this.typeCode.kind().value()) {
+
+        case TCKind._tk_boolean:
+            data = ((Boolean)value).toString();
+            break;
+        case TCKind._tk_char:
+            char charValue = ((Character)value).charValue();
+            data = Byte.toString((byte) charValue);
+            break;
+        case TCKind._tk_wchar:
+            data = ((Character)value).toString();
+            break;
+        case TCKind._tk_octet:
+            data = ((Byte)value).toString();
+            break;
+        case TCKind._tk_short:
+        case TCKind._tk_ushort:
+            data = ((Short)value).toString();
+            break;
+        case TCKind._tk_long:
+            data = ((Long)value).toString();
+            break;
+        case TCKind._tk_ulong:
+        case TCKind._tk_longlong:
+        case TCKind._tk_ulonglong:
+            data = ((java.math.BigInteger)value).toString();
+            break;
+        case TCKind._tk_float:
+            data = ((Float)value).toString();
+            break;
+        case TCKind._tk_double:
+            data = ((Double)value).toString();
+            break;
+        case TCKind._tk_string:
+        case TCKind._tk_wstring:
+            data = (String)value;
+            break;
+        default:
+            // Default: assume that whatever stored the data will also know how to convert it into what 
+            // it needs.
+            data = value.toString();
+        }
+        
+        return data;
+    }
+    
+    public void setValue(Object obj) {
+        value = obj;
+    }
+    
+    public void setValueFromData(String data) {
+        switch (typeCode.kind().value()) {
+        case TCKind._tk_boolean:
+            value = new Boolean(data);
+            break;
+        case TCKind._tk_char:
+            // A char is mapped to a byte, we need it as a character
+            Byte byteValue = new Byte(data);
+            value = new Character((char) byteValue.byteValue());
+            break;
+        case TCKind._tk_wchar:
+            // A wide char is mapped to a string, we need it as a character
+            value = new Character(data.charAt(0));
+            break;
+        case TCKind._tk_octet:
+            // An octet is mapped to a short, we need it as a byte
+            Short shortValue = new Short(data);
+            value = new Byte(shortValue.byteValue());
+            break;
+        case TCKind._tk_short:
+        case TCKind._tk_ushort:
+            value = new Short(data);
+            break;
+        case TCKind._tk_long:
+            value = new Long(data);
+            break;
+        case TCKind._tk_ulong:
+        case TCKind._tk_longlong:
+        case TCKind._tk_ulonglong:
+            value = new java.math.BigInteger(data);
+            break;
+        case TCKind._tk_float:
+            value = new Float(data);
+            break;
+        case TCKind._tk_double:
+            value = new Double(data);
+            break;
+        case TCKind._tk_string:
+        case TCKind._tk_wstring:
+            value = data;
+            break;
+        default:
+            // Default: just store the data we were given.  We'll expect that whatever stored the data
+            // will also know how to convert it into what it needs.
+            value = data;
+        }
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaPrimitiveHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaPrimitiveHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaSequenceHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaSequenceHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaSequenceHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaSequenceHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,62 @@
+/**
+ * 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.corba2.types;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.omg.CORBA.TypeCode;
+
+public class CorbaSequenceHandler extends CorbaObjectHandler {
+
+    private List<CorbaObjectHandler> elements = new ArrayList<CorbaObjectHandler>();
+    private CorbaObjectHandler templateElement;
+    
+    public CorbaSequenceHandler(QName seqName, QName seqIdlType, TypeCode seqTC, Object seqType) {
+        super(seqName, seqIdlType, seqTC, seqType);
+    }
+    
+    public void addElement(CorbaObjectHandler el) {
+        elements.add(el);
+    }
+    
+    public int getNumberOfElements() {
+        return elements.size();
+    }
+    
+    public List<CorbaObjectHandler> getElements() {
+        return elements;
+    }
+    
+    public CorbaObjectHandler getElement(int index) {
+        return elements.get(index);
+    }
+    
+    // These handle the case where we have an unbounded sequence and we need to 
+    // construct Corba objects during the reading of an object.
+    public CorbaObjectHandler getTemplateElement() {
+        return templateElement;
+    }
+
+    public void setTemplateElement(CorbaObjectHandler el) {
+        templateElement = el;
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaSequenceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaSequenceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaStructHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaStructHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaStructHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaStructHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,62 @@
+/**
+ * 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.corba2.types;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.omg.CORBA.TypeCode;
+
+public class CorbaStructHandler extends CorbaObjectHandler {
+
+    List<CorbaObjectHandler> members = new ArrayList<CorbaObjectHandler>();
+    
+    public CorbaStructHandler(QName structName, QName structIdlType, TypeCode structTC, Object structType) {
+        super(structName, structIdlType, structTC, structType);
+    }
+    
+    public void addMember(CorbaObjectHandler member) {
+        members.add(member);
+    }
+    
+    public List<CorbaObjectHandler> getMembers() {
+        return members;
+    }
+    
+    public CorbaObjectHandler getMember(int index) {
+        return members.get(index);
+    }
+    
+    public CorbaObjectHandler getMemberByName(String name) {
+        CorbaObjectHandler member = null;
+        
+        for (Iterator<CorbaObjectHandler> iterator = members.iterator(); iterator.hasNext();) {
+            CorbaObjectHandler current = iterator.next();
+            if (current.getName().getLocalPart().equals(name)) {
+                member = current;
+                break;
+            }
+        }
+        
+        return member;
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaStructHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaStructHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaUnionHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaUnionHandler.java?view=auto&rev=467425
==============================================================================
--- incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaUnionHandler.java (added)
+++ incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaUnionHandler.java Tue Oct 24 11:11:34 2006
@@ -0,0 +1,201 @@
+/**
+ * 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.corba2.types;
+
+import java.util.ArrayList;
+//import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+//import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.schemas.yoko.bindings.corba.CaseType;
+import org.apache.schemas.yoko.bindings.corba.Enum;
+import org.apache.schemas.yoko.bindings.corba.Enumerator;
+import org.apache.schemas.yoko.bindings.corba.Union;
+import org.apache.schemas.yoko.bindings.corba.Unionbranch;
+
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+public class CorbaUnionHandler extends CorbaObjectHandler {
+
+    private CorbaObjectHandler discriminator;
+    private CorbaObjectHandler value;
+    private List<CorbaObjectHandler> cases = new ArrayList<CorbaObjectHandler>();
+    private int defaultIndex;
+    private List<String> labels = new ArrayList<String>();
+    //private Map<String, CorbaObject
+    
+
+    public CorbaUnionHandler(QName unionName, QName unionIdlType, TypeCode unionTC, Object unionType) {
+        super(unionName, unionIdlType, unionTC, unionType);
+        
+        // Build a list of labels.  This will be used to generate a discriminator value for the 
+        // default case (since we are not provided with one from the Stax stream of the Celtix object)
+        Union union = (Union)unionType;
+        List<Unionbranch> branches = union.getUnionbranch();
+        int index = 0;
+        for (Iterator<Unionbranch> branchesIter = branches.iterator(); branchesIter.hasNext();) {
+            Unionbranch branch = branchesIter.next();
+            List<CaseType> branchCases = branch.getCase();
+            if (branchCases.size() == 0) {
+                defaultIndex = index;
+            } else {
+                for (Iterator<CaseType> casesIter = branchCases.iterator(); casesIter.hasNext();) {
+                    CaseType ct = casesIter.next();
+                    labels.add(ct.getLabel());
+                }
+            }
+            
+            index++;
+        }
+    }
+    
+    public CorbaObjectHandler getDiscriminator() {
+        return discriminator;
+    }
+    
+    public String getDisciminatorValueData() {
+        String result = null;
+        // The discriminator is handled by either the enum handler or the primitive handler.
+        if (discriminator.getTypeCodeKind().value() == TCKind._tk_enum) {
+            CorbaEnumHandler enumHandler = (CorbaEnumHandler)discriminator;
+            result = enumHandler.getValue();
+        } else {
+            CorbaPrimitiveHandler primitiveHandler = (CorbaPrimitiveHandler)discriminator;
+            result = primitiveHandler.getValueData();
+        }
+        return result;        
+    }
+    
+    public void setDiscriminator(CorbaObjectHandler disc) {
+        discriminator = disc;
+    }
+    
+    public void setDiscriminatorValueFromData(String data) {
+        // The discriminator is handled by either the enum handler or the primitive handler.
+        if (discriminator.getTypeCodeKind().value() == TCKind._tk_enum) {
+            CorbaEnumHandler enumHandler = (CorbaEnumHandler)discriminator;
+            enumHandler.setValue(data);
+        } else {
+            CorbaPrimitiveHandler primitiveHandler = (CorbaPrimitiveHandler)discriminator;
+            primitiveHandler.setValueFromData(data);
+        }
+    }
+    
+    public List<CorbaObjectHandler> getCases() {
+        return cases;
+    }
+    
+    public CorbaObjectHandler getBranchByName(String caseName) {
+        for (Iterator<CorbaObjectHandler> caseIter = cases.iterator(); caseIter.hasNext();) {
+            CorbaObjectHandler obj = caseIter.next();
+            if (obj.getName().getLocalPart().equals(caseName)) {
+                return obj;
+            }
+        }
+        
+        return null;
+    }
+    
+    public void addCase(CorbaObjectHandler unionCase) {
+        cases.add(unionCase);
+    }
+    
+    public CorbaObjectHandler getValue() {
+        return value;
+    }
+    
+    public void setValue(String caseName, CorbaObjectHandler val) {
+        value = val;
+    }
+    
+    public int getDefaultIndex() {
+        // TODO: What will this be used for?
+        return defaultIndex;
+    }
+    
+    public String createDefaultDiscriminatorLabel() {
+        String label = null;
+
+        // According to the CORBA specification, an enumeration discriminator can be one of the 
+        // following types:
+        //   - *integer* (short, long, ulong, either signed or unsigned)
+        //   - boolean
+        //   - character
+        //   - enumeration
+        // So when we need to create a default discriminator to accomodate for the lack of a 
+        // discriminator in the Celtix object, these are the four cases we must check for.
+        if (discriminator.getTypeCodeKind().value() == TCKind._tk_boolean) {
+            // We can only have a default case with a boolean discriminator if we have
+            // only one case, either TRUE or FALSE.  Therefore, we only need to check
+            // against the first label, if there is one.
+            if (labels.isEmpty()) {
+                label = "false";
+            } else {
+                boolean boolValue = Boolean.parseBoolean(labels.get(0));
+                label = String.valueOf(!boolValue);
+            }
+        } else if (discriminator.getTypeCodeKind().value() == TCKind._tk_char) {
+            if (labels.isEmpty()) {
+                label = String.valueOf('0');
+            } else {
+                char charValue = labels.get(0).charAt(0);
+                while (labels.contains(String.valueOf(charValue))) {
+                    charValue++;
+                }
+                label = String.valueOf(charValue);
+            }
+        } else if (discriminator.getTypeCodeKind().value() == TCKind._tk_enum) {
+            // Get the list of possible enumerations in the enumerator and compare these to the
+            // labels we obtained from the Union definition.  In order for the union/enum 
+            // combination to be syntactically correct, there must be one enumeration not included
+            // as a case for the default case to be valid.
+            Enum enumType = (Enum)discriminator.getType();
+            List<Enumerator> enumerators = enumType.getEnumerator();
+            if (labels.isEmpty()) {
+                // Any value will do since we only have a default case.
+                label = enumerators.get(0).getValue();                  
+            } else {
+                String enumLabel = null;
+                for (Iterator<Enumerator> enumIter = enumerators.iterator(); enumIter.hasNext();) {
+                    enumLabel = ((Enumerator)enumIter.next()).getValue();
+                    if (!labels.contains(enumLabel)) {
+                        label = enumLabel;
+                        break;
+                    }
+                }
+            }
+        } else {
+            // this is some sort of integer (short, long, ulong)
+            if (labels.isEmpty()) {
+                label = String.valueOf(0);   
+            } else {
+                long longValue = Long.parseLong(labels.get(0));
+                while (labels.contains(String.valueOf(longValue))) {
+                    longValue++;
+                }   
+                label = String.valueOf(longValue);
+            }
+        }
+        return label;
+    }
+}

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaUnionHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/yoko/branches/cxf_port/bindings/src/main/java/org/apache/yoko/bindings/corba2/types/CorbaUnionHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date