incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmidd...@apache.org
Subject svn commit: r420941 - in /incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba: ./ extensions/
Date Tue, 11 Jul 2006 18:09:53 GMT
Author: dmiddlem
Date: Tue Jul 11 11:09:52 2006
New Revision: 420941

URL: http://svn.apache.org/viewvc?rev=420941&view=rev
Log:
Commit for complex type support in the Corba Binding runtime (YOKO-40)
 - Updates to array and sequence support
 - Support for structs and exceptions
 - Propagation of exceptions between Yoko Server and Corba Client
 - Preliminary support for additional complex types (e.g. enum)

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingImpl.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaClientBinding.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDSIServant.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaMessage.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/extensions/CorbaTypesExtensionHelper.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingImpl.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingImpl.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingImpl.java Tue Jul 11 11:09:52 2006
@@ -21,7 +21,9 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -40,16 +42,19 @@
 import javax.xml.stream.events.EndElement;
 import javax.xml.stream.events.StartElement;
 import javax.xml.ws.Holder;
+import javax.xml.ws.WebFault;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 
 import org.apache.schemas.yoko.bindings.corba.Array;
+import org.apache.schemas.yoko.bindings.corba.Enum;
 import org.apache.schemas.yoko.bindings.corba.Exception;
 import org.apache.schemas.yoko.bindings.corba.MemberType;
 import org.apache.schemas.yoko.bindings.corba.ModeType;
 import org.apache.schemas.yoko.bindings.corba.NamedType;
 import org.apache.schemas.yoko.bindings.corba.OperationType;
 import org.apache.schemas.yoko.bindings.corba.ParamType;
+import org.apache.schemas.yoko.bindings.corba.RaisesType;
 import org.apache.schemas.yoko.bindings.corba.Sequence;
 import org.apache.schemas.yoko.bindings.corba.Struct;
 import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
@@ -125,6 +130,7 @@
             }
         } catch (java.lang.Exception ex) {
             // Proceed without the type maps.
+            LOG.info("Received exception [" + ex + "] while reading typemaps.  Proceeding anyway.");
         }
     }
 
@@ -163,8 +169,7 @@
             XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
             outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
 
-            // Get information about the operation being invoked from the WSDL
-            // definition.
+            // Get information about the operation being invoked from the WSDL definition.
             // We need this to marshal data correctly
             OperationType opElement = 
                 CorbaUtils.getCorbaOperationType(callback.getOperationName(), bus, endpointRef);
@@ -207,8 +212,7 @@
                 corbaCtx.getMessage().addStreamableArgument(streamable);
             }
 
-            // Check to see if we have an input or output message and handle the
-            // return type
+            // Check to see if we have an input or output message and handle the return type
             // appropriately
             boolean isInputMessage = (Boolean) mc.get(ObjectMessageContext.MESSAGE_INPUT);
             if (!isInputMessage && callback.getWebResult() != null) {
@@ -242,14 +246,66 @@
     public void marshalFault(ObjectMessageContext objContext, 
                              MessageContext mc, 
                              DataBindingCallback callback) {
+        CorbaMessageContext corbaCtx = (CorbaMessageContext) mc;
+        corbaCtx.setMessage(new CorbaMessage());
+
+        // TODO: This method right now assumes that the exception we get is actually an exception that 
+        // will be defined in IDL.  What do we want to do if the exception is instead a system exception 
+        // that don't have a definition for.  UPDATED: Or will those types of exceptions not get through
+        // to this method.  This should be a condition when we insert the exception into the object message 
+        // context object that is passed to this method.
+        
         try {
             DataWriter<XMLEventWriter> writer = callback.createWriter(XMLEventWriter.class);
             if (writer == null) {
                 throw new WebServiceException("Unable to create data writer");
             }
 
-            // TODO: Implement once we have support for exceptions
-            throw new CorbaBindingException("Method unmarshalFault not implemented");
+            // Get information about the operation being invoked from the WSDL definition.
+            // We need this to marshal data correctly
+            OperationType opElement = 
+                CorbaUtils.getCorbaOperationType(callback.getOperationName(), bus, endpointRef);
+            if (opElement == null) {
+                throw new CorbaBindingException("Unable to find operation definition");
+            }
+
+            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+            
+            Throwable except = objContext.getException();
+            Method faultInfoMethod = except.getClass().getMethod("getFaultInfo");
+            Object faultInfo = faultInfoMethod.invoke(except);
+            WebFault wfAnnotation = except.getClass().getAnnotation(WebFault.class);
+            QName elName = new QName(wfAnnotation.targetNamespace(), wfAnnotation.name());
+            
+            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+            XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
+            writer.write(faultInfo, elName, evtWriter);
+            
+            QName exIdlType = null;
+            List<RaisesType> exList = opElement.getRaises();
+            for (Iterator<RaisesType> i = exList.iterator(); i.hasNext();) {
+                // REVISIT: Note that this assumes that exception names need to be unique.  We should make
+                // sure that this is really the case.
+                RaisesType raises = i.next();
+                if (raises.getException().getLocalPart().equals(faultInfo.getClass().getSimpleName())) {
+                    exIdlType = raises.getException();
+                }
+            }
+            if (exIdlType == null) {
+                LOG.info("Could not find the exception in the raises list.  Must be a system exception.");
+                // This could be a system exception?
+            } else {
+                LOG.info("Found exception in the raises list.  Marshalling.");
+                ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
+                XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
+                CorbaObjectHolder obj = readCorbaObject(evtReader, exIdlType, false);
+                CorbaStreamable streamable = new CorbaStreamable(obj, elName);
+                corbaCtx.getMessage().setStreamableException(streamable);
+            }
+            
+            
         } catch (java.lang.Exception ex) {
             LOG.log(Level.SEVERE, "CORBA marshalFault exception", ex);
             // TODO: Throw a exception proper exception once implemented
@@ -319,12 +375,32 @@
 
     public void unmarshalFault(MessageContext mc, ObjectMessageContext objContext,
             DataBindingCallback callback) {
-        try {
-            DataReader<XMLEventReader> reader = callback.createReader(XMLEventReader.class);
-            if (reader == null) {
-                throw new CorbaBindingException("Unable to create data reader");
-            }
+//        CorbaMessageContext corbaCtx = (CorbaMessageContext) mc;
 
+        try {
+//            This won't work for faults since we can not tell a DataReader using XMLEventReaders to 
+//            read fault information.  They can only be used to read parameters and return values. 
+//
+//            DataReader<XMLEventReader> reader = callback.createReader(XMLEventReader.class);
+//            if (reader == null) {
+//                throw new CorbaBindingException("Unable to create data reader");
+//            }
+//            
+//            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+//            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+//            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+//
+//            CorbaStreamable exStreamable = corbaCtx.getMessage().getStreamableException();
+//            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+//            XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
+//            writeCorbaObject(exStreamable.getObject(), evtWriter, null);
+//            evtWriter.flush();
+//     
+//            ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
+//            XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
+//            Object obj = reader.read(new QName("exception"), -1, evtReader);
+//            
+            
             // TODO: Implement once we have support for exceptions
             throw new CorbaBindingException("Method unmarshalFault not implemented");
         } catch (java.lang.Exception ex) {
@@ -372,7 +448,38 @@
         if (CorbaUtils.isPrimitiveIdlType(idlType)) {
             obj = readPrimitiveCorbaObject(reader, idlType, tc);
         } else {
-            obj = readComplexCorbaObject(reader, idlType, tc);
+            // TODO: Move the switch statement from the readComplex and make each complex type have its
+            // own read, to get around the checkstyle rules
+            //obj = readComplexCorbaObject(reader, idlType, tc);
+        
+            switch(tc.kind().value()) {
+            case TCKind._tk_array:
+                LOG.info("Reading array type from XML reader");
+                obj = readArrayCorbaObject(reader, idlType, tc);
+                break;
+            case TCKind._tk_enum:
+                LOG.info("Reading enumeration type from XML reader");
+                obj = readEnumCorbaObject(reader, idlType, tc);
+                break;
+            case TCKind._tk_except:
+                LOG.info("Reading exception type from XML reader");
+                obj = readExceptionCorbaObject(reader, idlType, tc);
+                break;
+            case TCKind._tk_sequence:
+                LOG.info("Reading sequence type from XML reader");
+                obj = readSequenceCorbaObject(reader, idlType, tc);
+                break;
+            case TCKind._tk_struct:
+                LOG.info("Reading struct type from XML reader");
+                obj = readStructCorbaObject(reader, idlType, tc);
+                break;
+            case TCKind._tk_union:
+                LOG.info("Reading union type from XML reader");
+                obj = readUnionCorbaObject(reader, idlType, tc);
+                break;
+            default:
+                throw new CorbaBindingException("Unsupported complex type");
+            }
         }
 
         return obj;
@@ -399,91 +506,150 @@
         
         return obj;
     }
+    
+    public CorbaObjectHolder readArrayCorbaObject(XMLEventReader reader, QName idlType, TypeCode tc)
+        throws CorbaBindingException {
+        CorbaObjectHolder obj = null;
+        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
+        
+        try {
+            Array arrayType = (Array)typeDefinition;
+            StartElement arrayStartEl = reader.nextEvent().asStartElement();
+            obj = new CorbaObjectHolder(arrayStartEl.getName(), idlType, tc, arrayType);
+            for (int i = 0; i < arrayType.getBound(); ++i) {
+                CorbaObjectHolder member = readCorbaObject(reader, arrayType.getElemtype(), true);
+                obj.addNestedObject(member);
+            }
+            reader.nextEvent().asEndElement();
+        } catch (java.lang.Exception ex) {
+            LOG.severe("Received exception while reading object of type " + idlType);
+            throw new CorbaBindingException("Error while reading array corba type", ex);
+        }
+        
+        return obj;
+    }
 
-    public CorbaObjectHolder readComplexCorbaObject(XMLEventReader reader, QName idlType, TypeCode tc)
+    public CorbaObjectHolder readEnumCorbaObject(XMLEventReader reader, QName idlType, TypeCode tc)
         throws CorbaBindingException {
         CorbaObjectHolder obj = null;
         CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
         
         try {
-            // the way we handle complex types will depend on the structure of the complex type being handled.
-            switch(tc.kind().value()) {
-            case TCKind._tk_array:
-                LOG.info("Reading array type from XML reader");
-                Array arrayType = (Array)typeDefinition;
-                StartElement arrayStartEl = reader.nextEvent().asStartElement();
-                obj = new CorbaObjectHolder(arrayStartEl.getName(), idlType, tc, arrayType);
-                for (int i = 0; i < arrayType.getBound(); ++i) {
-                    CorbaObjectHolder member = readCorbaObject(reader, arrayType.getElemtype(), true);
-                    obj.addNestedObject(member);
-                }
-                break;
-            case TCKind._tk_enum:
-                LOG.info("Reading enumeration type from XML reader");
-                break;
-            case TCKind._tk_except:
-                LOG.info("Reading exception type from XML reader");
-                Exception exType = (Exception)typeDefinition;
-                StartElement exStartEl = reader.nextEvent().asStartElement();
-                obj = new CorbaObjectHolder(exStartEl.getName(), idlType, tc, exType);
-                List<MemberType> exMembers = exType.getMember();
-                for (int i = 0; i < exMembers.size(); ++i) {
-                    CorbaObjectHolder member = readCorbaObject(reader, exMembers.get(i).getIdltype(), true);
-                    obj.addNestedObject(member);
-                }
-                break;
-            case TCKind._tk_sequence:
-                LOG.info("Reading sequence type from XML reader");
-                Sequence seqType = (Sequence)typeDefinition;
-                StartElement seqStartEl = reader.nextEvent().asStartElement();
-                obj = new CorbaObjectHolder(seqStartEl.getName(), idlType, tc, seqType);
-                long bound = seqType.getBound();
-                if (bound == 0) {
-                    LOG.info("Unbounded sequence found");
-                    while (reader.peek().getEventType() == XMLStreamConstants.START_ELEMENT) {
-                        CorbaObjectHolder member = readCorbaObject(reader, seqType.getElemtype(), true);
-                        obj.addNestedObject(member);
-                    }
-                } else {
-                    LOG.info("Bounded sequence found");
-                    for (long i = 0; i < bound; ++i) {
-                        CorbaObjectHolder member = readCorbaObject(reader, seqType.getElemtype(), true);
-                        obj.addNestedObject(member);
-                    }
+            Enum enumType = (Enum)typeDefinition;
+            StartElement enumStartEl = reader.nextEvent().asStartElement();
+            obj = new CorbaObjectHolder(enumStartEl.getName(), idlType, tc, enumType);
+            Characters enumCharEl = reader.nextEvent().asCharacters();
+            obj.setObjectValueFromData(enumCharEl.getData());
+            reader.nextEvent().asEndElement();
+        } catch (java.lang.Exception ex) {
+            LOG.severe("Received exception while reading object of type " + idlType);
+            throw new CorbaBindingException("Error while reading enum corba type", ex);
+        }
+        
+        return obj;
+    }
+
+    public CorbaObjectHolder readExceptionCorbaObject(XMLEventReader reader, QName idlType, TypeCode tc)
+        throws CorbaBindingException {
+        CorbaObjectHolder obj = null;
+        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
+        
+        try {
+            Exception exType = (Exception)typeDefinition;
+            StartElement exStartEl = reader.nextEvent().asStartElement();
+            obj = new CorbaObjectHolder(exStartEl.getName(), idlType, tc, exType);
+            List<MemberType> exMembers = exType.getMember();
+            for (int i = 0; i < exMembers.size(); ++i) {
+                CorbaObjectHolder member = readCorbaObject(reader, exMembers.get(i).getIdltype(), true);
+                obj.addNestedObject(member);
+            }
+            reader.nextEvent().asEndElement();
+        } catch (java.lang.Exception ex) {
+            LOG.severe("Received exception while reading object of type " + idlType);
+            throw new CorbaBindingException("Error while reading exception corba type", ex);
+        }
+        
+        return obj;
+    }
+
+    public CorbaObjectHolder readSequenceCorbaObject(XMLEventReader reader, QName idlType, TypeCode tc)
+        throws CorbaBindingException {
+        CorbaObjectHolder obj = null;
+        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
+        
+        try {
+            Sequence seqType = (Sequence)typeDefinition;
+            StartElement seqStartEl = reader.nextEvent().asStartElement();
+            obj = new CorbaObjectHolder(seqStartEl.getName(), idlType, tc, seqType);
+            long bound = seqType.getBound();
+            if (bound == 0) {
+                LOG.info("Unbounded sequence found");
+                while (reader.peek().getEventType() == XMLStreamConstants.START_ELEMENT) {
+                    CorbaObjectHolder element = readCorbaObject(reader, seqType.getElemtype(), true);
+                    obj.addNestedObject(element);
                 }
-                break;
-            case TCKind._tk_struct:
-                LOG.info("Reading struct type from XML reader");
-                Struct structType = (Struct)typeDefinition;
-                StartElement structStartEl = reader.nextEvent().asStartElement();
-                obj = new CorbaObjectHolder(structStartEl.getName(), idlType, tc, structType);
-                List<MemberType> structMembers = structType.getMember();
-                for (int i = 0; i < structMembers.size(); ++i) {
-                    CorbaObjectHolder member = readCorbaObject(reader, 
-                                                               structMembers.get(i).getIdltype(), 
-                                                               true);
-                    obj.addNestedObject(member);
+            } else {
+                LOG.info("Bounded sequence found");
+                for (long i = 0; i < bound; ++i) {
+                    CorbaObjectHolder element = readCorbaObject(reader, seqType.getElemtype(), true);
+                    obj.addNestedObject(element);
                 }
-                break;
-            case TCKind._tk_union:
-                LOG.info("Reading union type from XML reader");
-                break;
-            default:
-                throw new CorbaBindingException("Unsupported complex type");
             }
-            // All the complex types will consume an end element before they return so that the reader is
-            // prepared to describe a new object if this complex is nested within another complex object.  
-            // This also serves as a check to make sure that the object is properly constructed in the XML 
-            // reader.
             reader.nextEvent().asEndElement();
         } catch (java.lang.Exception ex) {
-            LOG.severe("Received exception while reading complex object of type " + idlType);
-            throw new CorbaBindingException("Error while reading complex corba type", ex);
+            LOG.severe("Received exception while reading object of type " + idlType);
+            throw new CorbaBindingException("Error while reading sequence corba type", ex);
         }
         
         return obj;
     }
-    
+
+    public CorbaObjectHolder readStructCorbaObject(XMLEventReader reader, QName idlType, TypeCode tc)
+        throws CorbaBindingException {
+        CorbaObjectHolder obj = null;
+        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
+        
+        try {
+            Struct structType = (Struct)typeDefinition;
+            StartElement structStartEl = reader.nextEvent().asStartElement();
+            obj = new CorbaObjectHolder(structStartEl.getName(), idlType, tc, structType);
+            List<MemberType> structMembers = structType.getMember();
+            for (int i = 0; i < structMembers.size(); ++i) {
+                CorbaObjectHolder member = readCorbaObject(reader, 
+                                                           structMembers.get(i).getIdltype(), 
+                                                           true);
+                obj.addNestedObject(member);
+            }
+            reader.nextEvent().asEndElement();
+        } catch (java.lang.Exception ex) {
+            LOG.severe("Received exception while reading object of type " + idlType);
+            throw new CorbaBindingException("Error while reading struct corba type", ex);
+        }
+        
+        return obj;
+    }
+
+    public CorbaObjectHolder readUnionCorbaObject(XMLEventReader reader, QName idlType, TypeCode tc)
+        throws CorbaBindingException {
+        CorbaObjectHolder obj = null;
+        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
+        
+        try {
+            Union unionType = (Union)typeDefinition;
+            StartElement unionStartEl = reader.nextEvent().asStartElement();
+            obj = new CorbaObjectHolder(unionStartEl.getName(), idlType, tc, unionType);
+            
+            
+            
+            reader.nextEvent().asEndElement();
+        } catch (java.lang.Exception ex) {
+            LOG.severe("Received exception while reading object of type " + idlType);
+            throw new CorbaBindingException("Error while reading union corba type", ex);
+        }
+        
+        return obj;
+    }
+
     public void writeCorbaObject(CorbaObjectHolder obj, XMLEventWriter writer, XMLEventFactory factory) {
         try {
             // If the factory is null, then this should be the beginning of the

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaClientBinding.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaClientBinding.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaClientBinding.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaClientBinding.java Tue Jul 11 11:09:52 2006
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Executor;
@@ -29,8 +30,12 @@
 
 import javax.wsdl.Port;
 import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
 
 import org.apache.schemas.yoko.bindings.corba.AddressType;
+import org.apache.schemas.yoko.bindings.corba.Exception;
+import org.apache.schemas.yoko.bindings.corba.MemberType;
+import org.apache.schemas.yoko.bindings.corba.NamedType;
 import org.apache.schemas.yoko.bindings.corba.OperationType;
 import org.apache.schemas.yoko.bindings.corba.RaisesType;
 
@@ -54,6 +59,7 @@
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.Request;
 import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UnknownUserException;
 
 public class CorbaClientBinding extends AbstractBindingBase implements
         ClientBinding {
@@ -112,7 +118,7 @@
             }
 
             target = orb.string_to_object(address.getLocation());
-        } catch (Exception ex) {
+        } catch (java.lang.Exception ex) {
             LOG.log(Level.SEVERE, "Could not resolve target object");
             throw new WSDLException(WSDLException.OTHER_ERROR, "Could not resolve target object", ex);
         }
@@ -201,7 +207,7 @@
             request.invoke();
 
             mc.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.FALSE);
-            Exception ex = request.env().exception();
+            java.lang.Exception ex = request.env().exception();
             if (ex == null) {
                 if (retVal != null) {
                     message.setStreamableReturnValue(retVal.getObject());
@@ -214,23 +220,32 @@
                         message.setStreamableArgumentValue(streamable.getObject(), i);
                     }
                 }
-
                 corbaBinding.unmarshal(mc, objectCtx, callback);
-            } else {
-                // TODO: Do we need to check for any particular type of exception? This path
-                // is not complete until we have support for exceptions.
-                message.setException(ex);
-                corbaBinding.unmarshalFault(mc, objectCtx, callback);
+            } else if (ex instanceof UnknownUserException) {
+                objectCtx.setException(ex);
+                
+                // TODO: Revisit.  This is only a temporary way around the exception handling.
+                // We need to address the issue with converting a corba exception into a celtix
+                // fault to implement this properly.
+                
+                //UnknownUserException userEx = (UnknownUserException)ex;
+                //Any exAny = userEx.except;
+                //RaisesType raisesExType = exceptions.get(exAny.type());
+                
+                //CorbaStreamable streamableEx = 
+                //    createStreamableException(exAny, raisesExType);
+                //mc.getMessage().setStreamableException(streamableEx);
+                //corbaBinding.unmarshalFault(mc, objectCtx, callback);
             }
-        } catch (Exception ex) {
+        } catch (java.lang.Exception ex) {
             throw new CorbaBindingException("Exception during invoke", ex);
         }
 
         return objectCtx;
     }
-
-    public void invokeOneWay(ObjectMessageContext objectCtx,
-            DataBindingCallback callback) throws IOException {
+    
+    public void invokeOneWay(ObjectMessageContext objectCtx, DataBindingCallback callback) 
+        throws IOException {
         CorbaMessageContext mc = (CorbaMessageContext)corbaBinding.createBindingMessageContext(objectCtx);
         mc.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.TRUE);
 
@@ -288,14 +303,15 @@
                                        exList, 
                                        ctxList);
             request.send_oneway();
+           
         } catch (java.lang.Exception ex) {
             throw new CorbaBindingException("Exception during invokeOneWay", ex);
         }
     }
 
-    public Future<ObjectMessageContext> invokeAsync(
-            ObjectMessageContext objectCtx, DataBindingCallback callback,
-            Executor executor) throws IOException {
+    public Future<ObjectMessageContext> invokeAsync(ObjectMessageContext objectCtx, 
+                                                    DataBindingCallback callback,
+                                                    Executor executor) throws IOException {
         throw new CorbaBindingException("invokeAsync not yet implemented");
     }
 
@@ -312,5 +328,49 @@
         }
 
         return exceptions;
+    }
+
+    public CorbaStreamable createStreamableException(Any exception, RaisesType exRaises) {
+        // first, we need to get the definition of the exception.  All we have from the raises type is the 
+        // exception idl type
+        QName exIdlType = exRaises.getException();
+        List<CorbaTypeMap> typeMaps = corbaBinding.getCorbaTypeMaps();
+        Exception ex = null;
+        for (Iterator i = typeMaps.iterator(); i.hasNext();) {
+            CorbaTypeMap tm = (CorbaTypeMap)i.next();
+            if (tm.getPrefix().equals(exIdlType.getPrefix())) {
+                ex = (Exception)tm.getType(exIdlType.getLocalPart()); 
+                break;
+            }
+        }
+        
+        if (ex == null) {
+            throw new CorbaBindingException("Unable to find definition for thrown exception");
+        }
+        
+        CorbaObjectHolder obj = null;
+        TypeCode tc = CorbaUtils.getTypeCode(orb, exIdlType, typeMaps);
+        // TODO: What should the name of the object holder be?
+        obj = new CorbaObjectHolder(new QName("exception"), exIdlType, tc, ex);
+        List<MemberType> exMembers = ex.getMember();
+        for (Iterator i = exMembers.iterator(); i.hasNext();) {
+            MemberType member = (MemberType)i.next();
+            QName memberName = new QName(member.getName());
+            QName memberType = member.getIdltype();
+            TypeCode memberTC = CorbaUtils.getTypeCode(orb, memberType, typeMaps);
+            NamedType memberTypeDef = null;
+            if (!CorbaUtils.isPrimitiveIdlType(memberType)) {
+                memberTypeDef = CorbaUtils.getCorbaType(memberType, typeMaps);
+            }
+
+            CorbaObjectHolder memberObj = 
+                new CorbaObjectHolder(memberName, memberType, memberTC, memberTypeDef);
+            obj.addNestedObject(memberObj);
+        }
+
+        CorbaStreamable exStreamable = new CorbaStreamable(obj, new QName("exception"));
+        exStreamable._read(exception.create_input_stream());
+        
+        return exStreamable;
     }
 }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDSIServant.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDSIServant.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDSIServant.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDSIServant.java Tue Jul 11 11:09:52 2006
@@ -18,10 +18,12 @@
  */
 package org.apache.yoko.bindings.corba;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 
 import org.apache.schemas.yoko.bindings.corba.Array;
@@ -123,58 +125,38 @@
             // Build a list of streamables that correspond to the values that should be contained in the
             // argument list of the ServerRequest, build the correct NVList and retreive the arguments
             CorbaStreamable[] arguments = new CorbaStreamable[paramTypes.size()];
-            NVList list = orb.create_list(arguments.length);
-            for (int i = 0; i < paramTypes.size(); ++i) {
-                ParamType pType = paramTypes.get(i);
-                // TODO: Revisit.  Is this the correct namespace to use?
-                QName paramName = new QName(callback.getWebParam(i).targetNamespace(),
-                                            callback.getWebParam(i).name());
-                QName paramIdlType = pType.getIdltype();
-                ModeType paramMode = pType.getMode();
-
-                CorbaObjectHolder obj = createCorbaObjectHolder(paramName, paramIdlType, typeMaps);
-
-                arguments[i] = new CorbaStreamable(obj, paramName);
-                if (paramMode.value().equals("in")) {
-                    arguments[i].setMode(org.omg.CORBA.ARG_IN.value);
-                } else if (paramMode.value().equals("out")) {
-                    arguments[i].setMode(org.omg.CORBA.ARG_OUT.value);
-                } else {
-                    arguments[i].setMode(org.omg.CORBA.ARG_INOUT.value);
-                }
-
-                Any value = orb.create_any();
-                value.insert_Streamable(arguments[i]);
-                list.add_value(arguments[i].getName(), value, arguments[i].getMode());
-                corbaCtx.getMessage().addStreamableArgument(arguments[i]);
-            }
+            NVList list = prepareDIIArgsList(corbaCtx, arguments, paramTypes, typeMaps, callback);
             request.arguments(list);
 
             serverBinding.getBindingImpl().unmarshal(corbaCtx, objectCtx, callback);
 
             // TODO: Set if the request is one way or not. This needs to be determined
-            boolean isOneWay = false;
-
-            ServerDataBindingCallback method = (ServerDataBindingCallback) callback;
-            new WebServiceContextImpl(objectCtx);
-            method.invoke(objectCtx);
+            boolean isOneWay = callback.isOneWay();
+            doCeltixInvocation(callback, objectCtx);
 
             corbaCtx.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.FALSE);
             if (!isOneWay) {
-                serverBinding.getBindingImpl().marshal(objectCtx, corbaCtx, callback);
+                if (objectCtx.getException() != null) {
+                    serverBinding.getBindingImpl().marshalFault(objectCtx, corbaCtx, callback);
+                    Any exAny = orb.create_any();
+                    exAny.insert_Streamable(corbaCtx.getMessage().getStreamableException());
+                    request.set_exception(exAny);
+                } else {
+                    serverBinding.getBindingImpl().marshal(objectCtx, corbaCtx, callback);
 
-                arguments = corbaCtx.getMessage().getStreamableArguments();
-                for (int i = 0; i < arguments.length; ++i) {
-                    if (list.item(i).flags() != org.omg.CORBA.ARG_IN.value) {
-                        list.item(i).value().insert_Streamable(arguments[i]);
+                    arguments = corbaCtx.getMessage().getStreamableArguments();
+                    for (int i = 0; i < arguments.length; ++i) {
+                        if (list.item(i).flags() != org.omg.CORBA.ARG_IN.value) {
+                            list.item(i).value().insert_Streamable(arguments[i]);
+                        }
                     }
-                }
 
-                CorbaStreamable resultValue = corbaCtx.getMessage().getStreamableReturn();
-                if (resultValue != null) {
-                    Any resultAny = orb.create_any();
-                    resultAny.insert_Streamable(resultValue);
-                    request.set_result(resultAny);
+                    CorbaStreamable resultValue = corbaCtx.getMessage().getStreamableReturn();
+                    if (resultValue != null) {
+                        Any resultAny = orb.create_any();
+                        resultAny.insert_Streamable(resultValue);
+                        request.set_result(resultAny);
+                    }
                 }
             }
 
@@ -182,7 +164,60 @@
             throw new CorbaBindingException("Exception during invoke", ex);
         }
     }
+    
+    public NVList prepareDIIArgsList(CorbaMessageContext corbaCtx, CorbaStreamable[] streamables, 
+                                     List<ParamType> params, List<CorbaTypeMap> typeMaps,
+                                     DataBindingCallback callback) {
+        NVList list = orb.create_list(streamables.length);
+
+        for (int i = 0; i < params.size(); ++i) {
+            ParamType pType = params.get(i);
+            QName paramName = new QName(callback.getWebParam(i).targetNamespace(),
+                                        callback.getWebParam(i).name());
+            QName paramIdlType = pType.getIdltype();
+            ModeType paramMode = pType.getMode();
+
+            CorbaObjectHolder obj = createCorbaObjectHolder(paramName, paramIdlType, typeMaps);
+
+            streamables[i] = new CorbaStreamable(obj, paramName);
+            if (paramMode.value().equals("in")) {
+                streamables[i].setMode(org.omg.CORBA.ARG_IN.value);
+            } else if (paramMode.value().equals("out")) {
+                streamables[i].setMode(org.omg.CORBA.ARG_OUT.value);
+            } else {
+                streamables[i].setMode(org.omg.CORBA.ARG_INOUT.value);
+            }
 
+            Any value = orb.create_any();
+            value.insert_Streamable(streamables[i]);
+            list.add_value(streamables[i].getName(), value, streamables[i].getMode());
+            corbaCtx.getMessage().addStreamableArgument(streamables[i]);
+        }
+        return list;
+    }
+
+    public void doCeltixInvocation(DataBindingCallback callback, ObjectMessageContext objectCtx) {
+        try {
+            ServerDataBindingCallback method = (ServerDataBindingCallback) callback;
+            new WebServiceContextImpl(objectCtx);
+            method.invoke(objectCtx);
+        } catch (WebServiceException ex) {
+            Throwable cause = ex.getCause();
+            if (cause != null) {
+                objectCtx.setException(cause);
+            } else {
+                objectCtx.setException(ex);
+            }
+        } catch (InvocationTargetException ex) {
+            Throwable cause = ex.getCause();
+            if (cause != null) {
+                objectCtx.setException(cause);
+            } else {
+                objectCtx.setException(ex);
+            }
+        }
+    }
+    
     public String[] _all_interfaces(POA poa, byte[] objectId) {
         return interfaces.toArray(new String[interfaces.size()]);
     }
@@ -221,7 +256,7 @@
 
                 for (int i = 0; i < exceptMembers.size(); ++i) {
                     MemberType member = exceptMembers.get(i);
-                    QName memberName = new QName(member.getName());
+                    QName memberName = new QName(name.getNamespaceURI(), member.getName());
                     QName memberType = member.getIdltype();
                     CorbaObjectHolder memberObj = createCorbaObjectHolder(memberName, memberType, typeMaps);
                     obj.addNestedObject(memberObj);
@@ -252,7 +287,7 @@
 
                 for (int i = 0; i < structMembers.size(); ++i) {
                     MemberType member = structMembers.get(i);
-                    QName memberName = new QName(member.getName());
+                    QName memberName = new QName(name.getNamespaceURI(), member.getName());
                     QName memberType = member.getIdltype();
                     CorbaObjectHolder memberObj = createCorbaObjectHolder(memberName, memberType, typeMaps);
                     obj.addNestedObject(memberObj);

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaMessage.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaMessage.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaMessage.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaMessage.java Tue Jul 11 11:09:52 2006
@@ -26,6 +26,7 @@
     private String operation;
     private List<CorbaStreamable> arguments;
     private CorbaStreamable returnParam;
+    private CorbaStreamable except;
     private Exception exception;
 
     public CorbaMessage() {
@@ -33,6 +34,7 @@
         arguments = new ArrayList<CorbaStreamable>();
         returnParam = null;
         exception = null;
+        except = null;
     }
 
     public String getOperationName() {
@@ -50,6 +52,10 @@
     public Exception getException() {
         return exception;
     }
+    
+    public CorbaStreamable getStreamableException() {
+        return except;
+    }
 
     public CorbaStreamable[] getStreamableArguments() {
         return arguments.toArray(new CorbaStreamable[0]);
@@ -96,7 +102,17 @@
     }
 
     public void setStreamableReturnValue(CorbaObjectHolder data) {
+        // TODO: Handle case of the return parameter has not yet been initialized.
         returnParam.setObject(data);
+    }
+    
+    public void setStreamableException(CorbaStreamable ex) {
+        except = ex;
+    }
+    
+    public void setStreamableExceptionValue(CorbaObjectHolder exData) {
+        // TODO: Handle case of the return parameter has not yet been initialized.
+        except.setObject(exData);
     }
 
     public String toString() {

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectReader.java Tue Jul 11 11:09:52 2006
@@ -48,16 +48,18 @@
             break;
         case TCKind._tk_char:
             Character charValue = this.readChar();
-            byte charByteValue = (byte) charValue.charValue();
-            obj.setObjectValue(new Byte(charByteValue));
+//            byte charByteValue = (byte) charValue.charValue();
+//            obj.setObjectValue(new Byte(charByteValue));
+            obj.setObjectValue(charValue);
             break;
         case TCKind._tk_wchar:
             obj.setObjectValue(this.readWChar());
             break;
         case TCKind._tk_octet:
             Byte octetValue = this.readOctet();
-            short octetShortValue = octetValue.shortValue();
-            obj.setObjectValue(new Short(octetShortValue));
+//            short octetShortValue = octetValue.shortValue();
+//            obj.setObjectValue(new Short(octetShortValue));
+            obj.setObjectValue(octetValue);
             break;
         case TCKind._tk_short:
             obj.setObjectValue(this.readShort());
@@ -280,7 +282,6 @@
 
     public void readEnum(CorbaObjectHolder obj) throws CorbaBindingException {
         int enumIndex = stream.read_long();
-
         Enum enumType = (Enum) obj.getTypeDefintion();
         List<Enumerator> enumerators = enumType.getEnumerator();
 

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaObjectWriter.java Tue Jul 11 11:09:52 2006
@@ -21,6 +21,10 @@
 import java.math.BigInteger;
 import java.util.List;
 
+import org.apache.schemas.yoko.bindings.corba.Enum;
+import org.apache.schemas.yoko.bindings.corba.Enumerator;
+import org.apache.schemas.yoko.bindings.corba.Exception;
+
 import org.omg.CORBA.Any;
 import org.omg.CORBA.TCKind;
 import org.omg.CORBA.portable.OutputStream;
@@ -171,8 +175,18 @@
     }
 
     public void writeEnum(CorbaObjectHolder type) throws CorbaBindingException {
-        // TODO: provide implementation
-        throw new CorbaBindingException("CorbaObjectWriter: writeEnum not yet implemented");
+        Enum enumType = (Enum)type.getTypeDefintion();
+        String enumLabel = type.getValueData();
+        List<Enumerator> enumerators = enumType.getEnumerator();
+        
+        for (int i = 0; i < enumerators.size(); ++i) {
+            if (enumerators.get(i).getValue().equals(enumLabel)) {
+                stream.write_long(i);
+                return;
+            }
+        }
+        
+        throw new CorbaBindingException("CorbaObjectWriter: unable to find enumeration label");
     }
 
     public void writeEnumLabel(String label) throws CorbaBindingException {
@@ -189,8 +203,13 @@
     }
 
     public void writeException(CorbaObjectHolder type) throws CorbaBindingException {
-        // TODO: provide implementation
-        throw new CorbaBindingException("CorbaObjectWriter: writeException not yet implemented");
+        Exception exType = (Exception)type.getTypeDefintion();
+        List<CorbaObjectHolder> exMembers = type.getNestedObjects();
+    
+        stream.write_string(exType.getRepositoryID());
+        for (int i = 0; i < exMembers.size(); ++i) {
+            this.write(exMembers.get(i));
+        }
     }
 
     public void writeFixed(CorbaObjectHolder type) throws CorbaBindingException {

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java Tue Jul 11 11:09:52 2006
@@ -188,7 +188,7 @@
                                               getTypeCode(orb, member.getIdltype(), typeMaps), null);
             }
             String name = structType.getName();
-            tc = orb.create_exception_tc(structType.getRepositoryID(), name, members);
+            tc = orb.create_struct_tc(structType.getRepositoryID(), name, members);
         } else if (obj instanceof Union) {
             // TODO: Implement
         }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/extensions/CorbaTypesExtensionHelper.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/extensions/CorbaTypesExtensionHelper.java?rev=420941&r1=420940&r2=420941&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/extensions/CorbaTypesExtensionHelper.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/extensions/CorbaTypesExtensionHelper.java Tue Jul 11 11:09:52 2006
@@ -37,6 +37,7 @@
 import org.apache.schemas.yoko.bindings.corba.Anonsequence;
 import org.apache.schemas.yoko.bindings.corba.Anonstring;
 import org.apache.schemas.yoko.bindings.corba.Array;
+import org.apache.schemas.yoko.bindings.corba.CaseType;
 import org.apache.schemas.yoko.bindings.corba.Const;
 import org.apache.schemas.yoko.bindings.corba.Enum;
 import org.apache.schemas.yoko.bindings.corba.Enumerator;
@@ -47,6 +48,7 @@
 import org.apache.schemas.yoko.bindings.corba.Struct;
 import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
 import org.apache.schemas.yoko.bindings.corba.Union;
+import org.apache.schemas.yoko.bindings.corba.Unionbranch;
 import org.apache.yoko.bindings.corba.CorbaConstants;
 
 public class CorbaTypesExtensionHelper implements ExtensionDeserializer {
@@ -166,8 +168,11 @@
         NodeList enumChildNodes = node.getChildNodes();
         for (int i = 0; i < enumChildNodes.getLength(); ++i) {
             Node currentNode = enumChildNodes.item(i);
-
-            if (currentNode.getNodeName().equals("corba:enumeration")) {
+            
+            // The spec uses corba:enumeration but the tool we have uses corba:enumerator.
+            // REVISIT: Which one is correct?
+            //if (currentNode.getNodeName().equals("corba:enumeration")) {
+            if (currentNode.getNodeName().equals("corba:enumerator")) {
                 Enumerator enumerator = new Enumerator();
                 NamedNodeMap enumeratorAttrs = currentNode.getAttributes();
 
@@ -284,9 +289,71 @@
     }
 
     public Union getUnionDefinition(Node node, Definition def) {
-        return null;
-    }
+        Union unionType = new Union();
+        NamedNodeMap unionAttributes = node.getAttributes();
 
+        for (int i = 0; i < unionAttributes.getLength(); ++i) {
+            if (unionAttributes.item(i).getNodeName().equals("name")) {
+                unionType.setName(unionAttributes.item(i).getNodeValue());
+            } else if (unionAttributes.item(i).getNodeName().equals("repositoryID")) {
+                unionType.setRepositoryID(unionAttributes.item(i).getNodeValue());
+            } else if (unionAttributes.item(i).getNodeName().equals("discriminator")) {
+                String idlType = unionAttributes.item(i).getNodeValue();
+                int seperatorIndex = idlType.indexOf(':');
+                String prefix = idlType.substring(0, seperatorIndex);
+                String localPart = idlType.substring(seperatorIndex + 1, idlType.length());
+                unionType.setDiscriminator(new QName(def.getNamespace(prefix), localPart, prefix));
+            }
+        }
+
+        NodeList unionChildNodes = node.getChildNodes();
+        for (int i = 0; i < unionChildNodes.getLength(); ++i) {
+            Node currentNode = unionChildNodes.item(i);
+            
+            if (currentNode.getNodeName().equals("corba:unionbranch")) {
+                Unionbranch branch = getUnionBranch(currentNode, def);
+                unionType.getUnionbranch().add(branch);
+            }
+        }
+        
+        return unionType;
+    }
+    
+    public Unionbranch getUnionBranch(Node node, Definition def) {
+        Unionbranch branchType = new Unionbranch();
+        NamedNodeMap branchAttributes = node.getAttributes();
+        
+        for (int i = 0; i < branchAttributes.getLength(); ++i) {
+            if (branchAttributes.item(i).getNodeName().equals("name")) {
+                branchType.setName(branchAttributes.item(i).getNodeValue());
+            } else if (branchAttributes.item(i).getNodeName().equals("idltype")) {
+                branchType.setName(branchAttributes.item(i).getNodeValue());
+            } else if (branchAttributes.item(i).getNodeName().equals("default")) {
+                Boolean defaultValue = new Boolean(branchAttributes.item(i).getNodeValue());
+                branchType.setDefault(defaultValue);
+            }
+        }
+        
+        NodeList branchChildNodes = node.getChildNodes();
+        for (int i = 0; i < branchChildNodes.getLength(); ++i) {
+            Node currentNode = branchChildNodes.item(i);
+            
+            if (currentNode.getNodeName().equals("corba:case")) {
+                CaseType caseType = new CaseType();
+                NamedNodeMap caseAttributes = currentNode.getAttributes();
+                
+                for (int j = 0; i < caseAttributes.getLength(); ++j) {
+                    if (caseAttributes.item(j).getNodeName().equals("label")) {
+                        caseType.setLabel(caseAttributes.item(j).getNodeValue());
+                    }
+                }
+                branchType.getCase().add(caseType);
+            }
+        }
+        
+        return branchType;
+    }
+    
     public Alias getAliasDefinition(Node node, Definition def) {
         Alias aliasType = new Alias();
 
@@ -355,18 +422,76 @@
     }
 
     public Anonstring getAnonStringDefinition(Node node, Definition def) {
-        return null;
+        Anonstring anonStringType = new Anonstring();
+
+        // Store information about the fixed type
+        NamedNodeMap anonStringAttributes = node.getAttributes();
+        for (int i = 0; i < anonStringAttributes.getLength(); ++i) {
+            if (anonStringAttributes.item(i).getNodeName().equals("name")) {
+                anonStringType.setName(anonStringAttributes.item(i).getNodeValue());
+            } else if (anonStringAttributes.item(i).getNodeName().equals("bound")) {
+                anonStringType.setBound(new Long(anonStringAttributes.item(i).getNodeValue()));
+            }
+        }
+        return anonStringType;
     }
 
     public Anonfixed getAnonFixedDefinition(Node node, Definition def) {
-        return null;
+        Anonfixed anonFixedType = new Anonfixed();
+
+        // Store information about the fixed type
+        NamedNodeMap anonFixedAttributes = node.getAttributes();
+        for (int i = 0; i < anonFixedAttributes.getLength(); ++i) {
+            if (anonFixedAttributes.item(i).getNodeName().equals("name")) {
+                anonFixedType.setName(anonFixedAttributes.item(i).getNodeValue());
+            } else if (anonFixedAttributes.item(i).getNodeName().equals("digits")) {
+                anonFixedType.setDigits(new Long(anonFixedAttributes.item(i).getNodeValue()));
+            } else if (anonFixedAttributes.item(i).getNodeName().equals("scale")) {
+                anonFixedType.setScale(new Long(anonFixedAttributes.item(i).getNodeValue()));
+            }
+        }
+        return anonFixedType;
     }
 
     public Anonsequence getAnonSequenceDefinition(Node node, Definition def) {
-        return null;
+        Anonsequence anonSequenceType = new Anonsequence();
+
+        // Store information about the sequence
+        NamedNodeMap anonSequenceAttributes = node.getAttributes();
+        for (int i = 0; i < anonSequenceAttributes.getLength(); ++i) {
+            if (anonSequenceAttributes.item(i).getNodeName().equals("name")) {
+                anonSequenceType.setName(anonSequenceAttributes.item(i).getNodeValue());
+            } else if (anonSequenceAttributes.item(i).getNodeName().equals("elemtype")) {
+                String elemType = anonSequenceAttributes.item(i).getNodeValue();
+                int seperatorIndex = elemType.indexOf(':');
+                String prefix = elemType.substring(0, seperatorIndex);
+                String localPart = elemType.substring(seperatorIndex + 1, elemType.length());
+                anonSequenceType.setElemtype(new QName(def.getNamespace(prefix), localPart, prefix));
+            } else if (anonSequenceAttributes.item(i).getNodeName().equals("bound")) {
+                anonSequenceType.setBound(Long.parseLong(anonSequenceAttributes.item(i).getNodeValue()));
+            }
+        }
+        return anonSequenceType;
     }
 
     public Anonarray getAnonArrayDefinition(Node node, Definition def) {
-        return null;
+        Anonarray anonArrayType = new Anonarray();
+
+        // Store information about the array
+        NamedNodeMap anonArrayAttributes = node.getAttributes();
+        for (int i = 0; i < anonArrayAttributes.getLength(); ++i) {
+            if (anonArrayAttributes.item(i).getNodeName().equals("name")) {
+                anonArrayType.setName(anonArrayAttributes.item(i).getNodeValue());
+            } else if (anonArrayAttributes.item(i).getNodeName().equals("elemtype")) {
+                String elemType = anonArrayAttributes.item(i).getNodeValue();
+                int seperatorIndex = elemType.indexOf(':');
+                String prefix = elemType.substring(0, seperatorIndex);
+                String localPart = elemType.substring(seperatorIndex + 1, elemType.length());
+                anonArrayType.setElemtype(new QName(def.getNamespace(prefix), localPart, prefix));
+            } else if (anonArrayAttributes.item(i).getNodeName().equals("bound")) {
+                anonArrayType.setBound(Long.parseLong(anonArrayAttributes.item(i).getNodeValue()));
+            }
+        }
+        return anonArrayType;
     }
 }                



Mime
View raw message