tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjaniszew...@apache.org
Subject svn commit: r686643 [1/2] - in /tuscany/java/sca/modules/binding-corba-runtime/src: main/java/org/apache/tuscany/sca/binding/corba/impl/ main/java/org/apache/tuscany/sca/binding/corba/impl/service/ main/java/org/apache/tuscany/sca/binding/corba/impl/ty...
Date Sun, 17 Aug 2008 21:26:27 GMT
Author: wjaniszewski
Date: Sun Aug 17 14:26:26 2008
New Revision: 686643

URL: http://svn.apache.org/viewvc?rev=686643&view=rev
Log:
Added support for CORBA unions

Added:
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion5.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/RichUnion.java
Modified:
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsServant.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsTuscanyServant.java
    tuscany/java/sca/modules/binding-corba-runtime/src/test/resources/arrays_unions.idl

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java Sun Aug 17 14:26:26 2008
@@ -21,6 +21,8 @@
 
 import java.lang.reflect.Method;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.binding.corba.CorbaBinding;
 import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
@@ -38,6 +40,7 @@
  */
 public class CorbaReferenceBindingProvider implements ReferenceBindingProvider {
 
+    private static final Logger logger = Logger.getLogger(CorbaServiceBindingProvider.class.getName());
     private CorbaBinding binding;
     private CorbaHost host;
     private RuntimeComponentReference reference;
@@ -63,6 +66,7 @@
             }
             return new CorbaInvoker(reference, remoteObject, referenceClass, operationsMap);
         } catch (Exception e) {
+            logger.log(Level.WARNING, "Exception during creating CORBA invoker", e);
         }
         return null;
     }

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java Sun Aug 17 14:26:26 2008
@@ -21,6 +21,8 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
 import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
@@ -40,6 +42,8 @@
  */
 public class DynaCorbaServant extends ObjectImpl implements InvokeHandler {
 
+    private static final Logger logger = Logger.getLogger(DynaCorbaServant.class.getName());
+    
     private String[] ids;
     private InvocationProxy invocationProxy;
     private String typeId;
@@ -109,13 +113,10 @@
                     TypeHelpersProxy.write(tree.getRootNode(), out, ie.getTargetException());
                     return out;
                 } catch (Exception e) {
-                    // TODO: raise remote exception - exception while handling
-                    // target exception
-                    e.printStackTrace();
+                    logger.log(Level.WARNING, "Exception during handling invocation exception", e);
                 }
             } catch (Exception e) {
-                // TODO: raise remote exception
-                e.printStackTrace();
+                logger.log(Level.WARNING, "Unexpected exception during sending CORBA result to client", e);
             }
         }
         return null;

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java Sun Aug 17 14:26:26 2008
@@ -32,6 +32,8 @@
 
 import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
 import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
 
 /**
  * @version $Rev$ $Date$
@@ -137,6 +139,7 @@
 
     /**
      * Return given array without first element
+     * 
      * @param array
      * @return
      */
@@ -147,7 +150,9 @@
     }
 
     /**
-     * Converts objects annotations to structure which will be used by this class 
+     * Converts objects annotations to structure which will be used by this
+     * class
+     * 
      * @param notes
      * @return
      */
@@ -222,7 +227,16 @@
         } else if (nodeType.equals(NodeType.idl_enum)) {
 
         } else if (nodeType.equals(NodeType.union)) {
-            // TODO: unions
+            // inspect types for every structure member
+            Field[] fields = node.getJavaClass().getDeclaredFields();
+            children = new TypeTreeNode[fields.length];
+            for (int i = 0; i < fields.length; i++) {
+                Class<?> field = fields[i].getType();
+                AnnotationAttributes fAttrs = createAnnotationAttributes(fields[i].getAnnotations());
+                TypeTreeNode child = inspectClassHierarchy(field, fAttrs, tree);
+                child.setName(fields[i].getName());
+                children[i] = child;
+            }
         } else if (nodeType.equals(NodeType.reference)) {
             // TODO: CORBA references
         }
@@ -255,7 +269,6 @@
                     new RequestConfigurationException("Annotated array size doesn't match declared arrays size");
                 throw exc;
             }
-
         } else if (primitives.contains(forClass)) {
             node.setNodeType(NodeType.primitive);
             node.setJavaClass(forClass);
@@ -273,6 +286,10 @@
         } else if (isUserException(forClass)) {
             node.setNodeType(NodeType.exception);
             node.setJavaClass(forClass);
+        } else if (isUnionType(forClass)) {
+            node.setNodeType(NodeType.union);
+            node.setJavaClass(forClass);
+            node.setAttributes(getUnionAttributes(forClass));
         } else {
             RequestConfigurationException e =
                 new RequestConfigurationException("User defined type which cannot be handled: " + forClass
@@ -382,7 +399,7 @@
     }
 
     /**
-     * Tells whether given class is corba user exception
+     * Tells whether given class is CORBA user exception
      * 
      * @param forClass
      * @return
@@ -398,4 +415,83 @@
         return false;
     }
 
+    /**
+     * Tells whether given class is CORBA union. This method validates usage of
+     * unions annotations.
+     * 
+     * @param forClass
+     * @return
+     * @throws RequestConfigurationException
+     */
+    private static boolean isUnionType(Class<?> forClass) throws RequestConfigurationException {
+        int classMods = forClass.getModifiers();
+        if (!Modifier.isFinal(classMods)) {
+            return false;
+        }
+        boolean atLeastOneOption = false;
+        boolean discriminatorPresent = false;
+        for (int i = 0; i < forClass.getDeclaredFields().length; i++) {
+            CorbaUnionElement note = forClass.getDeclaredFields()[i].getAnnotation(CorbaUnionElement.class);
+            if (note != null) {
+                int fieldMod = forClass.getDeclaredFields()[i].getModifiers();
+                if (Modifier.isPrivate(fieldMod) && !Modifier.isFinal(fieldMod) && !Modifier.isStatic(fieldMod)) {
+                    if (note.type().equals(CorbaUnionElementType.discriminator)) {
+                        if (discriminatorPresent) {
+                            throw new RequestConfigurationException(
+                                                                    "More than one discriminators declared on: " + forClass);
+                        }
+                        discriminatorPresent = true;
+                    } else {
+                        atLeastOneOption = true;
+                    }
+                } else {
+                    throw new RequestConfigurationException(
+                                                            "Annotated union field should be private, not final and no static on class: " + forClass);
+                }
+            }
+        }
+        if (atLeastOneOption && !discriminatorPresent) {
+            throw new RequestConfigurationException("No discriminator annotation found on: " + forClass);
+        } else if (!atLeastOneOption && discriminatorPresent) {
+            throw new RequestConfigurationException("No union option found on: " + forClass);
+        } else if (discriminatorPresent && atLeastOneOption) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Gets union attributes - discriminator field name, option fields etc. This
+     * method relies that previously scanned class is valid (method isUnionType)
+     * 
+     * @param forClass
+     * @return
+     * @throws RequestConfigurationException
+     */
+    private static UnionAttributes getUnionAttributes(Class<?> forClass) throws RequestConfigurationException {
+        UnionAttributes attributes = new UnionAttributes();
+        for (int i = 0; i < forClass.getDeclaredFields().length; i++) {
+            CorbaUnionElement note = forClass.getDeclaredFields()[i].getAnnotation(CorbaUnionElement.class);
+            if (note != null) {
+                if (note.type().equals(CorbaUnionElementType.discriminator)) {
+                    attributes.setDiscriminatorName(forClass.getDeclaredFields()[i].getName());
+                } else if (note.type().equals(CorbaUnionElementType.defaultOption)) {
+                    attributes.setDefaultOptionName(forClass.getDeclaredFields()[i].getName());
+                } else if (note.type().equals(CorbaUnionElementType.option)) {
+                    if (attributes.getOptionsMapping().containsKey(note.optionNumber())) {
+                        throw new RequestConfigurationException("In " + forClass
+                            + ": field \""
+                            + forClass.getDeclaredFields()[i].getName()
+                            + "\" uses already used option id: "
+                            + note.optionNumber());
+                    } else {
+                        attributes.getOptionsMapping().put(note.optionNumber(),
+                                                           forClass.getDeclaredFields()[i].getName());
+                    }
+                }
+            }
+        }
+        return attributes;
+    }
 }

Added: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.binding.corba.impl.types;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ * Stores attributes for previously scanned CORBA union type 
+ */
+public class UnionAttributes {
+
+    public String discriminatorName;
+    public String defaultOptionName;
+    public Map<Integer, String> optionsMapping = new HashMap<Integer, String>();
+
+    public String getDiscriminatorName() {
+        return discriminatorName;
+    }
+
+    public void setDiscriminatorName(String discriminatorName) {
+        this.discriminatorName = discriminatorName;
+    }
+
+    public String getDefaultOptionName() {
+        return defaultOptionName;
+    }
+
+    public void setDefaultOptionName(String defaultOptionName) {
+        this.defaultOptionName = defaultOptionName;
+    }
+
+    public Map<Integer, String> getOptionsMapping() {
+        return optionsMapping;
+    }
+
+    public void setOptionsMapping(Map<Integer, String> optionsMapping) {
+        this.optionsMapping = optionsMapping;
+    }
+
+}

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java Sun Aug 17 14:26:26 2008
@@ -1,6 +1,8 @@
 package org.apache.tuscany.sca.binding.corba.impl.types.util;
 
 import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
 import org.omg.CORBA.portable.InputStream;
@@ -11,6 +13,8 @@
  */
 public class EnumTypeHelper implements TypeHelper {
 
+    private static final Logger logger = Logger.getLogger(EnumTypeHelper.class.getName());
+    
     public Object read(TypeTreeNode node, InputStream is) {
         int value = is.read_long();
         Object result = null;
@@ -18,7 +22,7 @@
             Method method = node.getJavaClass().getMethod("from_int", new Class[] {int.class});
             result = method.invoke(null, new Object[] {value});
         } catch (Exception e) {
-            // TODO Auto-generated catch block
+            logger.log(Level.WARNING, "Exception during reading CORBA enum data", e);
             e.printStackTrace();
         }
         return result;
@@ -30,8 +34,7 @@
             Method method = data.getClass().getMethod("value", new Class[] {});
             value = (Integer)method.invoke(data, new Object[] {});
         } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            logger.log(Level.WARNING, "Exception during writing CORBA enum data", e);
         }
         os.write_long(value);
     }

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java Sun Aug 17 14:26:26 2008
@@ -20,6 +20,8 @@
 package org.apache.tuscany.sca.binding.corba.impl.types.util;
 
 import java.lang.reflect.Field;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
 import org.omg.CORBA.portable.InputStream;
@@ -30,6 +32,8 @@
  */
 public class StructTypeHelper implements TypeHelper {
 
+    private static final Logger logger = Logger.getLogger(StructTypeHelper.class.getName());
+    
     public Object read(TypeTreeNode node, InputStream is) {
         TypeTreeNode[] children = node.getChildren();
         Object result = null;
@@ -42,8 +46,7 @@
                     childField.set(result, childResult);
                 }
             } catch (Exception e) {
-                // TODO: handle exception
-                e.printStackTrace();
+                logger.log(Level.WARNING, "Exception during reading CORBA struct data", e);
             }
         }
         return result;
@@ -58,8 +61,7 @@
                     TypeHelpersProxy.write(children[i], os, childField.get(data));
                 }
             } catch (Exception e) {
-                // TODO: handle exception
-                e.printStackTrace();
+                logger.log(Level.WARNING, "Exception during writing CORBA struct data", e);
             }
         }
     }

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java Sun Aug 17 14:26:26 2008
@@ -72,6 +72,7 @@
         complexTypes.put(NodeType.sequence, new SequenceTypeHelper());
         complexTypes.put(NodeType.idl_enum, new EnumTypeHelper());
         complexTypes.put(NodeType.exception, new StructTypeHelper());
+        complexTypes.put(NodeType.union, new UnionTypeHelper());
     }
 
     /**

Added: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,92 @@
+/*
+ * 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.tuscany.sca.binding.corba.impl.types.util;
+
+import java.lang.reflect.Field;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
+import org.apache.tuscany.sca.binding.corba.impl.types.UnionAttributes;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UnionTypeHelper implements TypeHelper {
+
+    private static final Logger logger = Logger.getLogger(UnionTypeHelper.class.getName());
+    
+    public Object read(TypeTreeNode node, InputStream is) {
+        Object result = null;
+        try {
+            int discriminator = is.read_long();
+            UnionAttributes attrs = (UnionAttributes)node.getAttributes();
+            String childName = attrs.getOptionsMapping().get(discriminator);
+            if (childName == null) {
+                // get default if option numbers field not found
+                childName = attrs.getDefaultOptionName();
+            }
+            result = node.getJavaClass().newInstance();
+            Field discField = result.getClass().getDeclaredField(attrs.getDiscriminatorName());
+            discField.setAccessible(true);
+            discField.set(result, discriminator);
+            for (int i = 0; i < node.getChildren().length; i++) {
+                if (node.getChildren()[i].getName().equals(childName)) {
+                    Object unionValue = TypeHelpersProxy.read(node.getChildren()[i], is);
+                    Field childField = result.getClass().getDeclaredField(childName);
+                    childField.setAccessible(true);
+                    childField.set(result, unionValue);
+                    break;
+                }
+            }
+        } catch (Exception e) {
+            logger.log(Level.WARNING, "Exception during reading CORBA union data", e);
+        }
+        return result;
+    }
+
+    public void write(TypeTreeNode node, OutputStream os, Object data) {
+        try {
+            UnionAttributes attrs = (UnionAttributes)node.getAttributes();
+            Field discriminatorField = data.getClass().getDeclaredField(attrs.getDiscriminatorName());
+            discriminatorField.setAccessible(true);
+            int discriminator = discriminatorField.getInt(data);
+            os.write_long(discriminator);
+            String childName = attrs.getOptionsMapping().get(discriminator);
+            if (childName == null) {
+                // get default if option numbers field not found
+                childName = attrs.getDefaultOptionName();
+            }
+            for (int i = 0; i < node.getChildren().length; i++) {
+                if (node.getChildren()[i].getName().equals(childName)) {
+                    Field childField = data.getClass().getDeclaredField(childName);
+                    childField.setAccessible(true);
+                    TypeHelpersProxy.write(node.getChildren()[i], os, childField.get(data));
+                    break;
+                }
+            }
+        } catch (Exception e) {
+            logger.log(Level.WARNING, "Exception during writing CORBA union data", e);
+        }
+    }
+
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.tuscany.sca.binding.corba.meta;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @version $Rev$ $Date$ Declares CORBA union object
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CorbaUnionElement {
+    
+    // number of option in switch clause
+    int optionNumber() default -1;
+    
+    // type of element
+    CorbaUnionElementType type();
+    
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.tuscany.sca.binding.corba.meta;
+
+/**
+ * @version $Rev$ $Date$
+ * Types for union element
+ */
+public enum CorbaUnionElementType {
+    discriminator, defaultOption, option;
+}
\ No newline at end of file

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java Sun Aug 17 14:26:26 2008
@@ -508,6 +508,9 @@
         }
     }
     
+    /**
+     * Tests serving CORBA arrays by Tuscany CORBA servants
+     */
     @Test
     public void test_arraysPassing() {
         try {

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java Sun Aug 17 14:26:26 2008
@@ -40,6 +40,7 @@
 import org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct;
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.ArraysTestStruct;
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.DummyObject;
+import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InnerUnion;
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidCorbaArray;
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidEnum1;
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidEnum2;
@@ -47,6 +48,12 @@
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidStruct1;
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidStruct2;
 import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidStruct3;
+import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion1;
+import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion2;
+import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion3;
+import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion4;
+import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion5;
+import org.apache.tuscany.sca.binding.corba.testing.hierarchy.RichUnion;
 import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysSetterServant;
 import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysUnionsServant;
 import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysUnionsTuscanyServant;
@@ -759,4 +766,76 @@
             fail();
         }
     }
+    
+    /**
+     * Tests passing CORBA unions
+     */
+    @Test
+    public void test_passingUnions() {
+        try {
+            DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passRichUnion");
+            request.setOutputType(RichUnion.class);
+            RichUnion arg = new RichUnion();
+            InnerUnion argIu = new InnerUnion();
+            argIu.setX(10);
+            arg.setIu(argIu);
+            request.addArgument(arg);
+            DynaCorbaResponse response = request.invoke();
+            RichUnion result = (RichUnion)response.getContent();
+            assertEquals(arg.getIu().getX(), result.getIu().getX());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+        try {
+            DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passRichUnion");
+            request.setOutputType(RichUnion.class);
+            RichUnion arg = new RichUnion();
+            arg.setDef(true);
+            request.addArgument(arg);
+            DynaCorbaResponse response = request.invoke();
+            RichUnion result = (RichUnion)response.getContent();
+            assertEquals(arg.isDef(), result.isDef());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+    /**
+     * Tests handling invalid union declarations
+     */
+    @Test
+    public void test_testInvalidUnionClasses() {
+        try {
+            DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
+            request.setOutputType(InvalidUnion1.class);
+        } catch (Exception e) {
+            assertEquals(RequestConfigurationException.class, e.getClass());
+        }
+        try {
+            DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
+            request.setOutputType(InvalidUnion2.class);
+        } catch (Exception e) {
+            assertEquals(RequestConfigurationException.class, e.getClass());
+        }
+        try {
+            DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
+            request.setOutputType(InvalidUnion3.class);
+        } catch (Exception e) {
+            assertEquals(RequestConfigurationException.class, e.getClass());
+        }
+        try {
+            DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
+            request.setOutputType(InvalidUnion4.class);
+        } catch (Exception e) {
+            assertEquals(RequestConfigurationException.class, e.getClass());
+        }
+        try {
+            DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
+            request.setOutputType(InvalidUnion5.class);
+        } catch (Exception e) {
+            assertEquals(RequestConfigurationException.class, e.getClass());
+        }
+    }
 }

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public interface ArraysUnionsTests extends ArraysUnionsTestsOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity 

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 abstract public class ArraysUnionsTestsHelper

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java Sun Aug 17 14:26:26 2008
@@ -4,7 +4,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public final class ArraysUnionsTestsHolder implements org.omg.CORBA.portable.Streamable

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java Sun Aug 17 14:26:26 2008
@@ -5,11 +5,12 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public interface ArraysUnionsTestsOperations 
 {
   org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct passTestStruct (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct arg);
   String[][] passStringArray (String[][] arg);
+  org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion passRichUnion (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion arg);
 } // interface ArraysUnionsTestsOperations

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,112 @@
+package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
+
+
+/**
+* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from arrays_unions.idl
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
+*/
+
+public final class InnerUnion implements org.omg.CORBA.portable.IDLEntity
+{
+  private int ___x;
+  private float ___y;
+  private int __discriminator;
+  private boolean __uninitialized = true;
+
+  public InnerUnion ()
+  {
+  }
+
+  public int discriminator ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    return __discriminator;
+  }
+
+  public int x ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    verifyx (__discriminator);
+    return ___x;
+  }
+
+  public void x (int value)
+  {
+    __discriminator = 1;
+    ___x = value;
+    __uninitialized = false;
+  }
+
+  public void x (int discriminator, int value)
+  {
+    verifyx (discriminator);
+    __discriminator = discriminator;
+    ___x = value;
+    __uninitialized = false;
+  }
+
+  private void verifyx (int discriminator)
+  {
+    if (discriminator != 1)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+  }
+
+  public float y ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    verifyy (__discriminator);
+    return ___y;
+  }
+
+  public void y (float value)
+  {
+    __discriminator = 2;
+    ___y = value;
+    __uninitialized = false;
+  }
+
+  public void y (int discriminator, float value)
+  {
+    verifyy (discriminator);
+    __discriminator = discriminator;
+    ___y = value;
+    __uninitialized = false;
+  }
+
+  private void verifyy (int discriminator)
+  {
+    if (discriminator != 2)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+  }
+
+  public void _default ()
+  {
+    __discriminator = -2147483648;
+    __uninitialized = false;
+  }
+
+  public void _default (int discriminator)
+  {
+    verifyDefault( discriminator ) ;
+    __discriminator = discriminator ;
+    __uninitialized = false;
+  }
+
+  private void verifyDefault( int value )
+  {
+    switch (value) {
+      case 1:
+      case 2:
+        throw new org.omg.CORBA.BAD_OPERATION() ;
+
+      default:
+        return;
+    }
+  }
+
+} // class InnerUnion

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,106 @@
+package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
+
+
+/**
+* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from arrays_unions.idl
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
+*/
+
+abstract public class InnerUnionHelper
+{
+  private static String  _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion/InnerUnion:1.0";
+
+  public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion that)
+  {
+    org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+    a.type (type ());
+    write (out, that);
+    a.read_value (out.create_input_stream (), type ());
+  }
+
+  public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion extract (org.omg.CORBA.Any a)
+  {
+    return read (a.create_input_stream ());
+  }
+
+  private static org.omg.CORBA.TypeCode __typeCode = null;
+  synchronized public static org.omg.CORBA.TypeCode type ()
+  {
+    if (__typeCode == null)
+    {
+      org.omg.CORBA.TypeCode _disTypeCode0;
+      _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+      org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [2];
+      org.omg.CORBA.TypeCode _tcOf_members0;
+      org.omg.CORBA.Any _anyOf_members0;
+
+      // Branch for x (case label 1)
+      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+      _anyOf_members0.insert_long ((int)1);
+      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+      _members0[0] = new org.omg.CORBA.UnionMember (
+        "x",
+        _anyOf_members0,
+        _tcOf_members0,
+        null);
+
+      // Branch for y (case label 2)
+      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+      _anyOf_members0.insert_long ((int)2);
+      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
+      _members0[1] = new org.omg.CORBA.UnionMember (
+        "y",
+        _anyOf_members0,
+        _tcOf_members0,
+        null);
+      __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.id (), "InnerUnion", _disTypeCode0, _members0);
+    }
+    return __typeCode;
+  }
+
+  public static String id ()
+  {
+    return _id;
+  }
+
+  public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion read (org.omg.CORBA.portable.InputStream istream)
+  {
+    org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value = new org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion ();
+    int _dis0 = (int)0;
+    _dis0 = istream.read_long ();
+    switch (_dis0)
+    {
+      case 1:
+        int _x = (int)0;
+        _x = istream.read_long ();
+        value.x (_x);
+        break;
+      case 2:
+        float _y = (float)0;
+        _y = istream.read_float ();
+        value.y (_y);
+        break;
+      default:
+        value._default( _dis0 ) ;
+        break;
+    }
+    return value;
+  }
+
+  public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value)
+  {
+    ostream.write_long (value.discriminator ());
+    switch (value.discriminator ())
+    {
+      case 1:
+        ostream.write_long (value.x ());
+        break;
+      case 2:
+        ostream.write_float (value.y ());
+        break;
+    }
+  }
+
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,38 @@
+package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
+
+/**
+* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from arrays_unions.idl
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
+*/
+
+public final class InnerUnionHolder implements org.omg.CORBA.portable.Streamable
+{
+  public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value = null;
+
+  public InnerUnionHolder ()
+  {
+  }
+
+  public InnerUnionHolder (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion initialValue)
+  {
+    value = initialValue;
+  }
+
+  public void _read (org.omg.CORBA.portable.InputStream i)
+  {
+    value = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.read (i);
+  }
+
+  public void _write (org.omg.CORBA.portable.OutputStream o)
+  {
+    org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.write (o, value);
+  }
+
+  public org.omg.CORBA.TypeCode _type ()
+  {
+    return org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.type ();
+  }
+
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,177 @@
+package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
+
+
+/**
+* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from arrays_unions.idl
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
+*/
+
+public final class RichUnion implements org.omg.CORBA.portable.IDLEntity
+{
+  private int ___x;
+  private float ___y;
+  private String ___z;
+  private org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion ___iu;
+  private boolean ___a;
+  private int __discriminator;
+  private boolean __uninitialized = true;
+
+  public RichUnion ()
+  {
+  }
+
+  public int discriminator ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    return __discriminator;
+  }
+
+  public int x ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    verifyx (__discriminator);
+    return ___x;
+  }
+
+  public void x (int value)
+  {
+    __discriminator = 1;
+    ___x = value;
+    __uninitialized = false;
+  }
+
+  public void x (int discriminator, int value)
+  {
+    verifyx (discriminator);
+    __discriminator = discriminator;
+    ___x = value;
+    __uninitialized = false;
+  }
+
+  private void verifyx (int discriminator)
+  {
+    if (discriminator != 1)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+  }
+
+  public float y ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    verifyy (__discriminator);
+    return ___y;
+  }
+
+  public void y (float value)
+  {
+    __discriminator = 2;
+    ___y = value;
+    __uninitialized = false;
+  }
+
+  public void y (int discriminator, float value)
+  {
+    verifyy (discriminator);
+    __discriminator = discriminator;
+    ___y = value;
+    __uninitialized = false;
+  }
+
+  private void verifyy (int discriminator)
+  {
+    if (discriminator != 2)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+  }
+
+  public String z ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    verifyz (__discriminator);
+    return ___z;
+  }
+
+  public void z (String value)
+  {
+    __discriminator = 3;
+    ___z = value;
+    __uninitialized = false;
+  }
+
+  public void z (int discriminator, String value)
+  {
+    verifyz (discriminator);
+    __discriminator = discriminator;
+    ___z = value;
+    __uninitialized = false;
+  }
+
+  private void verifyz (int discriminator)
+  {
+    if (discriminator != 3)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+  }
+
+  public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion iu ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    verifyiu (__discriminator);
+    return ___iu;
+  }
+
+  public void iu (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value)
+  {
+    __discriminator = 4;
+    ___iu = value;
+    __uninitialized = false;
+  }
+
+  public void iu (int discriminator, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value)
+  {
+    verifyiu (discriminator);
+    __discriminator = discriminator;
+    ___iu = value;
+    __uninitialized = false;
+  }
+
+  private void verifyiu (int discriminator)
+  {
+    if (discriminator != 4)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+  }
+
+  public boolean a ()
+  {
+    if (__uninitialized)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+    verifya (__discriminator);
+    return ___a;
+  }
+
+  public void a (boolean value)
+  {
+    __discriminator = -2147483648;
+    ___a = value;
+    __uninitialized = false;
+  }
+
+  public void a (int discriminator, boolean value)
+  {
+    verifya (discriminator);
+    __discriminator = discriminator;
+    ___a = value;
+    __uninitialized = false;
+  }
+
+  private void verifya (int discriminator)
+  {
+    if (discriminator == 1 || discriminator == 2 || discriminator == 3 || discriminator == 4)
+      throw new org.omg.CORBA.BAD_OPERATION ();
+  }
+
+} // class RichUnion

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,157 @@
+package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
+
+
+/**
+* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from arrays_unions.idl
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
+*/
+
+abstract public class RichUnionHelper
+{
+  private static String  _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion/RichUnion:1.0";
+
+  public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion that)
+  {
+    org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
+    a.type (type ());
+    write (out, that);
+    a.read_value (out.create_input_stream (), type ());
+  }
+
+  public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion extract (org.omg.CORBA.Any a)
+  {
+    return read (a.create_input_stream ());
+  }
+
+  private static org.omg.CORBA.TypeCode __typeCode = null;
+  synchronized public static org.omg.CORBA.TypeCode type ()
+  {
+    if (__typeCode == null)
+    {
+      org.omg.CORBA.TypeCode _disTypeCode0;
+      _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+      org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [5];
+      org.omg.CORBA.TypeCode _tcOf_members0;
+      org.omg.CORBA.Any _anyOf_members0;
+
+      // Branch for x (case label 1)
+      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+      _anyOf_members0.insert_long ((int)1);
+      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
+      _members0[0] = new org.omg.CORBA.UnionMember (
+        "x",
+        _anyOf_members0,
+        _tcOf_members0,
+        null);
+
+      // Branch for y (case label 2)
+      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+      _anyOf_members0.insert_long ((int)2);
+      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
+      _members0[1] = new org.omg.CORBA.UnionMember (
+        "y",
+        _anyOf_members0,
+        _tcOf_members0,
+        null);
+
+      // Branch for z (case label 3)
+      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+      _anyOf_members0.insert_long ((int)3);
+      _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
+      _members0[2] = new org.omg.CORBA.UnionMember (
+        "z",
+        _anyOf_members0,
+        _tcOf_members0,
+        null);
+
+      // Branch for iu (case label 4)
+      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+      _anyOf_members0.insert_long ((int)4);
+      _tcOf_members0 = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.type ();
+      _members0[3] = new org.omg.CORBA.UnionMember (
+        "iu",
+        _anyOf_members0,
+        _tcOf_members0,
+        null);
+
+      // Branch for a (Default case)
+      _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
+      _anyOf_members0.insert_octet ((byte)0); // default member label
+      _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
+      _members0[4] = new org.omg.CORBA.UnionMember (
+        "a",
+        _anyOf_members0,
+        _tcOf_members0,
+        null);
+      __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.id (), "RichUnion", _disTypeCode0, _members0);
+    }
+    return __typeCode;
+  }
+
+  public static String id ()
+  {
+    return _id;
+  }
+
+  public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion read (org.omg.CORBA.portable.InputStream istream)
+  {
+    org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion value = new org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion ();
+    int _dis0 = (int)0;
+    _dis0 = istream.read_long ();
+    switch (_dis0)
+    {
+      case 1:
+        int _x = (int)0;
+        _x = istream.read_long ();
+        value.x (_x);
+        break;
+      case 2:
+        float _y = (float)0;
+        _y = istream.read_float ();
+        value.y (_y);
+        break;
+      case 3:
+        String _z = null;
+        _z = istream.read_string ();
+        value.z (_z);
+        break;
+      case 4:
+        org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion _iu = null;
+        _iu = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.read (istream);
+        value.iu (_iu);
+        break;
+      default:
+        boolean _a = false;
+        _a = istream.read_boolean ();
+        value.a (_dis0, _a);
+        break;
+    }
+    return value;
+  }
+
+  public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion value)
+  {
+    ostream.write_long (value.discriminator ());
+    switch (value.discriminator ())
+    {
+      case 1:
+        ostream.write_long (value.x ());
+        break;
+      case 2:
+        ostream.write_float (value.y ());
+        break;
+      case 3:
+        ostream.write_string (value.z ());
+        break;
+      case 4:
+        org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.write (ostream, value.iu ());
+        break;
+      default:
+        ostream.write_boolean (value.a ());
+        break;
+    }
+  }
+
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,38 @@
+package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
+
+/**
+* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.2"
+* from arrays_unions.idl
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
+*/
+
+public final class RichUnionHolder implements org.omg.CORBA.portable.Streamable
+{
+  public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion value = null;
+
+  public RichUnionHolder ()
+  {
+  }
+
+  public RichUnionHolder (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion initialValue)
+  {
+    value = initialValue;
+  }
+
+  public void _read (org.omg.CORBA.portable.InputStream i)
+  {
+    value = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.read (i);
+  }
+
+  public void _write (org.omg.CORBA.portable.OutputStream o)
+  {
+    org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.write (o, value);
+  }
+
+  public org.omg.CORBA.TypeCode _type ()
+  {
+    return org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.type ();
+  }
+
+}

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 abstract public class StringArrayHelper

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public final class StringArrayHolder implements org.omg.CORBA.portable.Streamable

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public final class TestStruct implements org.omg.CORBA.portable.IDLEntity

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 abstract public class TestStructHelper

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java Sun Aug 17 14:26:26 2008
@@ -4,7 +4,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public final class TestStructHolder implements org.omg.CORBA.portable.Streamable

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public abstract class _ArraysUnionsTestsImplBase extends org.omg.CORBA.portable.ObjectImpl
@@ -22,6 +22,7 @@
   {
     _methods.put ("passTestStruct", new java.lang.Integer (0));
     _methods.put ("passStringArray", new java.lang.Integer (1));
+    _methods.put ("passRichUnion", new java.lang.Integer (2));
   }
 
   public org.omg.CORBA.portable.OutputStream _invoke (String $method,
@@ -55,6 +56,16 @@
          break;
        }
 
+       case 2:  // org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests/passRichUnion
+       {
+         org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion arg = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.read (in);
+         org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion $result = null;
+         $result = this.passRichUnion (arg);
+         out = $rh.createReply();
+         org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.write (out, $result);
+         break;
+       }
+
        default:
          throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
     }

Modified: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java?rev=686643&r1=686642&r2=686643&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java (original)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java Sun Aug 17 14:26:26 2008
@@ -5,7 +5,7 @@
 * org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java .
 * Generated by the IDL-to-Java compiler (portable), version "3.2"
 * from arrays_unions.idl
-* sobota, 16 sierpieñ 2008 00:51:16 CEST
+* niedziela, 17 sierpieñ 2008 15:45:39 CEST
 */
 
 public class _ArraysUnionsTestsStub extends org.omg.CORBA.portable.ObjectImpl implements org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests
@@ -51,6 +51,26 @@
             }
   } // passStringArray
 
+  public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion passRichUnion (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion arg)
+  {
+            org.omg.CORBA.portable.InputStream $in = null;
+            try {
+                org.omg.CORBA.portable.OutputStream $out = _request ("passRichUnion", true);
+                org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.write ($out, arg);
+                $in = _invoke ($out);
+                org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion $result = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.read ($in);
+                return $result;
+            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
+                $in = $ex.getInputStream ();
+                String _id = $ex.getId ();
+                throw new org.omg.CORBA.MARSHAL (_id);
+            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
+                return passRichUnion (arg        );
+            } finally {
+                _releaseReply ($in);
+            }
+  } // passRichUnion
+
   // Type-specific CORBA::Object operations
   private static String[] __ids = {
     "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests:1.0"};

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,55 @@
+/*
+ * 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.tuscany.sca.binding.corba.testing.hierarchy;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
+
+public final class InnerUnion {
+
+    @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
+    private int x;
+   
+    @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 2)
+    private float y;
+    
+    @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
+    @SuppressWarnings("unused")
+    private int discriminator;
+
+    public int getX() {
+        return x;
+    }
+
+    public void setX(int x) {
+        discriminator = 1;
+        this.x = x;
+    }
+
+    public float getY() {
+        return y;
+    }
+
+    public void setY(float y) {
+        discriminator = 2;
+        this.y = y;
+    }
+
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.tuscany.sca.binding.corba.testing.hierarchy;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
+
+/**
+ * More than one discriminators
+ */
+public final class InvalidUnion1 {
+
+    @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
+    @SuppressWarnings("unused")
+    private int a;
+    @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
+    @SuppressWarnings("unused")
+    private int b;
+
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.tuscany.sca.binding.corba.testing.hierarchy;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
+
+/**
+ * Discriminator is missing
+ */
+public final class InvalidUnion2 {
+
+    @CorbaUnionElement(type=CorbaUnionElementType.defaultOption)
+    @SuppressWarnings("unused")
+    private int a;
+
+}

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscany.sca.binding.corba.testing.hierarchy;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
+
+/**
+ * No option, only discriminator
+ */
+public final class InvalidUnion3{
+
+    @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
+    @SuppressWarnings("unused")
+    private int a;
+
+}
+

Added: tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java?rev=686643&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java (added)
+++ tuscany/java/sca/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java Sun Aug 17 14:26:26 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.tuscany.sca.binding.corba.testing.hierarchy;
+
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
+import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
+
+/**
+ * Invalid field modifiers 
+ */
+public final class InvalidUnion4{
+
+    @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
+    @SuppressWarnings("unused")
+    private static int a;
+    
+    @CorbaUnionElement(type = CorbaUnionElementType.defaultOption)
+    @SuppressWarnings("unused")
+    private static int b;
+
+}
+



Mime
View raw message