From c0bef68247bd8a6d0bbbe7c9f07cc927ca2861d2 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 16 Feb 2012 15:41:56 +0000 Subject: Delete old RC tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1245041 13f79535-47bb-0310-9956-ffa450edef68 --- .../corba/provider/types/AnnotationAttributes.java | 46 -- .../sca/binding/corba/provider/types/NodeType.java | 28 -- .../sca/binding/corba/provider/types/TypeTree.java | 50 --- .../corba/provider/types/TypeTreeCreator.java | 497 --------------------- .../binding/corba/provider/types/TypeTreeNode.java | 75 ---- .../corba/provider/types/UnionAttributes.java | 59 --- .../corba/provider/types/util/ArrayTypeHelper.java | 53 --- .../provider/types/util/BooleanTypeHelper.java | 39 -- .../corba/provider/types/util/ByteTypeHelper.java | 39 -- .../corba/provider/types/util/CharTypeHelper.java | 39 -- .../provider/types/util/DoubleTypeHelper.java | 39 -- .../corba/provider/types/util/EnumTypeHelper.java | 59 --- .../corba/provider/types/util/FloatTypeHelper.java | 39 -- .../corba/provider/types/util/IntTypeHelper.java | 39 -- .../corba/provider/types/util/LongTypeHelper.java | 39 -- .../provider/types/util/ReferenceTypeHelper.java | 42 -- .../provider/types/util/SequenceTypeHelper.java | 70 --- .../corba/provider/types/util/ShortTypeHelper.java | 39 -- .../provider/types/util/StringTypeHelper.java | 39 -- .../provider/types/util/StructTypeHelper.java | 69 --- .../corba/provider/types/util/TypeHelper.java | 47 -- .../provider/types/util/TypeHelpersProxy.java | 119 ----- .../corba/provider/types/util/UnionTypeHelper.java | 92 ---- .../binding/corba/provider/types/util/Utils.java | 40 -- 24 files changed, 1697 deletions(-) delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/AnnotationAttributes.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/NodeType.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTree.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeCreator.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeNode.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/UnionAttributes.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ArrayTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/BooleanTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ByteTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/CharTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/DoubleTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/EnumTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/FloatTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/IntTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/LongTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ReferenceTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/SequenceTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ShortTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StringTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StructTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelpersProxy.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/UnionTypeHelper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/Utils.java (limited to 'sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types') diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/AnnotationAttributes.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/AnnotationAttributes.java deleted file mode 100644 index ab7371bbe8..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/AnnotationAttributes.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.provider.types; - -/** - * Holds information retrieved from objects annotations - */ -public class AnnotationAttributes { - - private boolean corbaArray; - private int[] corbaArrayLength; - - public boolean isCorbaArray() { - return corbaArray; - } - - public void setCorbaArray(boolean isCorbaArray) { - this.corbaArray = isCorbaArray; - } - - public int[] getCorbaArrayLength() { - return corbaArrayLength; - } - - public void setCorbaArrayLength(int[] corbaArrayLength) { - this.corbaArrayLength = corbaArrayLength; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/NodeType.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/NodeType.java deleted file mode 100644 index 706a44406b..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/NodeType.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.provider.types; - -/** - * @version $Rev$ $Date$ - * Types of CORBA objects. - */ -public enum NodeType { - primitive, struct, union, array, sequence, reference, idl_enum, exception -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTree.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTree.java deleted file mode 100644 index d4207ab735..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTree.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.provider.types; - -/** - * @version $Rev$ $Date$ - * Helper tree for Java object hierarchy. It's closer to CORBA types - * structure than plain Java hierarchy - it helps reading and writing - * complex structures. - */ -public class TypeTree { - - private TypeTreeNode rootNode; - - /** - * Returns root node. - * - * @return root of type tree - */ - public TypeTreeNode getRootNode() { - return rootNode; - } - - /** - * Sets root of the type tree. - * - * @param rootNode root node. - */ - public void setRootNode(TypeTreeNode rootNode) { - this.rootNode = rootNode; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeCreator.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeCreator.java deleted file mode 100644 index 1ba4002303..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeCreator.java +++ /dev/null @@ -1,497 +0,0 @@ -/* - * 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.provider.types; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.tuscany.sca.binding.corba.provider.exceptions.RequestConfigurationException; -import org.apache.tuscany.sca.binding.corba.provider.meta.CorbaArray; -import org.apache.tuscany.sca.binding.corba.provider.meta.CorbaUnionElement; -import org.apache.tuscany.sca.binding.corba.provider.meta.CorbaUnionElementType; - -/** - * @version $Rev$ $Date$ - * Creator of types tree. - */ -public class TypeTreeCreator { - - /** - * Helps to determine if type is a primitive. - */ - private static List> primitives = new ArrayList>(); - - static { - primitives.add(boolean.class); - primitives.add(byte.class); - primitives.add(short.class); - primitives.add(int.class); - primitives.add(long.class); - primitives.add(double.class); - primitives.add(float.class); - primitives.add(char.class); - primitives.add(String.class); - primitives.add(Boolean.class); - primitives.add(Byte.class); - primitives.add(Short.class); - primitives.add(Integer.class); - primitives.add(Long.class); - primitives.add(Double.class); - primitives.add(Float.class); - primitives.add(Character.class); - } - - /** - * Creates class for given string argument. - * - * @param name name of type - * @return type - */ - private static Class createClassFromString(String name) { - Class result = null; - try { - if (name.length() == 1) { - // primitives - switch (name.charAt(0)) { - case 'Z': - result = boolean.class; - break; - case 'C': - result = char.class; - break; - case 'B': - result = byte.class; - break; - case 'S': - result = short.class; - break; - case 'I': - result = int.class; - break; - case 'J': - result = long.class; - break; - case 'F': - result = float.class; - break; - case 'D': - result = double.class; - break; - } - } else { - // class - name = name.substring(1, name.length() - 1); - result = Class.forName(name); - } - } catch (Exception e) { - e.printStackTrace(); - } - return result; - } - - /** - * Reduces dimension of array. - * - * @param forClass array class - * @return reduced array - */ - private static Class reduceArrayDimension(Class forClass) { - String name = forClass.getName(); - try { - String reduced = name.substring(1, name.length()); - if (reduced.startsWith("[")) { - // reduced class is still an array - return Class.forName(reduced); - } else { - // reduced class may be primitive or class - return createClassFromString(reduced); - } - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - return null; - } - - /** - * Return given array without first element - * - * @param array - * @return - */ - private static int[] removeFirstElement(int[] array) { - int[] result = new int[array.length - 1]; - System.arraycopy(array, 1, result, 0, result.length); - return result; - } - - /** - * Converts objects annotations to structure which will be used by this - * class - * - * @param notes - * @return - */ - private static AnnotationAttributes createAnnotationAttributes(Annotation[] notes) { - AnnotationAttributes attrs = new AnnotationAttributes(); - for (int i = 0; notes != null && i < notes.length; i++) { - if (notes[i].annotationType().equals(CorbaArray.class)) { - attrs.setCorbaArray(true); - attrs.setCorbaArrayLength(((CorbaArray)notes[i]).value()); - } - } - return attrs; - } - - /** - * Creates tree for given type. - * - * @param forClass - * @return type tree - */ - public static TypeTree createTypeTree(Class forClass, Annotation[] notes) throws RequestConfigurationException { - TypeTree tree = new TypeTree(); - TypeTreeNode rootNode = null; - AnnotationAttributes attrs = createAnnotationAttributes(notes); - rootNode = inspectClassHierarchy(forClass, attrs, tree); - tree.setRootNode(rootNode); - return tree; - - } - - /** - * Recurrent method which builds type tree. - * - * @param forClass - * @param tree - * @return - */ - private static TypeTreeNode inspectClassHierarchy(Class forClass, AnnotationAttributes attributes, TypeTree tree) - throws RequestConfigurationException { - - TypeTreeNode node = null; - node = createTypeNode(forClass, attributes); - - NodeType nodeType = node.getNodeType(); - TypeTreeNode[] children = null; - - if (nodeType.equals(NodeType.primitive)) { - // stop condition for recurrent method - } else if (nodeType.equals(NodeType.array)) { - Class reduced = reduceArrayDimension(node.getJavaClass()); - children = new TypeTreeNode[1]; - int[] newLengths = removeFirstElement(attributes.getCorbaArrayLength()); - attributes.setCorbaArrayLength(newLengths); - children[0] = inspectClassHierarchy(reduced, attributes, tree); - } else if (nodeType.equals(NodeType.sequence)) { - // reducing sequence dimension - Class reduced = reduceArrayDimension(node.getJavaClass()); - children = new TypeTreeNode[1]; - children[0] = inspectClassHierarchy(reduced, attributes, tree); - // System.arraycopy(src, srcPos, dest, destPos, length) - } else if (nodeType.equals(NodeType.struct) || nodeType.equals(NodeType.exception)) { - // inspect types for every structure member - Field[] fields = node.getJavaClass().getFields(); - 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.idl_enum)) { - - } else if (nodeType.equals(NodeType.union)) { - // 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 - } - - node.setChildren(children); - return node; - } - - /** - * Creating and configuring TypeTreeNode for given class. - * - * @param forClass class - * @return node - * @throws RequestConfigurationException - */ - private static TypeTreeNode createTypeNode(Class forClass, AnnotationAttributes attributes) - throws RequestConfigurationException { - TypeTreeNode node = new TypeTreeNode(); - if (forClass.isArray() && !attributes.isCorbaArray()) { - node.setNodeType(NodeType.sequence); - node.setJavaClass(forClass); - } else if (forClass.isArray() && attributes.isCorbaArray()) { - node.setNodeType(NodeType.array); - node.setJavaClass(forClass); - try { - // set the actual array size for further use by ArrayTypeHelper - node.setAttributes(attributes.getCorbaArrayLength()[0]); - } catch (ArrayIndexOutOfBoundsException e) { - RequestConfigurationException exc = - 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); - node.setChildren(null); - } else if (forClass.isInterface()) { - node.setNodeType(NodeType.reference); - node.setJavaClass(forClass); - node.setChildren(null); - } else if (isStructType(forClass)) { - node.setNodeType(NodeType.struct); - node.setJavaClass(forClass); - } else if (isEnumType(forClass)) { - node.setNodeType(NodeType.idl_enum); - node.setJavaClass(forClass); - } 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 - .getCanonicalName()); - throw e; - } - return node; - } - - /** - * Tells whether given class is structure - * - * @param forClass - * @return - */ - private static boolean isStructType(Class forClass) { - int classMods = forClass.getModifiers(); - if (!Modifier.isFinal(classMods)) { - return false; - } - boolean areCtorsValid = false; - Class[] fieldsTypes = null; - Constructor[] ctors = forClass.getConstructors(); - /* - * Do we have 2 ctors and one of them is null ctor? - */ - if (ctors.length != 2) { - return false; - } - for (int i = 0; i < ctors.length; i++) { - Class[] params = ctors[i].getParameterTypes(); - if (params.length == 0) { - areCtorsValid = true; - } else { - fieldsTypes = params; - } - } - if (!areCtorsValid) { - return false; - } - /* - * Are constructor args declared as class fields? - */ - Field[] fields = forClass.getFields(); - Set> fieldsSet = new HashSet>(Arrays.asList(fieldsTypes)); - for (int i = 0; i < fields.length && !fieldsSet.isEmpty(); i++) { - int mods = fields[i].getModifiers(); - if (Modifier.isPublic(mods) && !Modifier.isStatic(mods) && !Modifier.isFinal(mods)) { - fieldsSet.remove(fields[i].getType()); - } - - } - return fieldsSet.isEmpty(); - } - - /** - * Tells whether given class is enum - * - * @param forClass - * @return - */ - private static boolean isEnumType(Class forClass) { - boolean isValueMethod = false; - boolean isFromIntMethod = false; - /* - * enum type should have value and from_int methods - */ - try { - Method valueMet = forClass.getMethod("value", new Class[] {}); - int modValueMet = valueMet.getModifiers(); - if (valueMet.getReturnType().equals(int.class) && Modifier.isPublic(modValueMet)) { - isValueMethod = true; - } - Method fromIntMet = forClass.getMethod("from_int", new Class[] {int.class}); - int modFromIntMet = fromIntMet.getModifiers(); - if ((fromIntMet.getReturnType().equals(forClass) && Modifier.isPublic(modFromIntMet) && Modifier - .isStatic(modFromIntMet))) { - isFromIntMethod = true; - } - } catch (NoSuchMethodException e) { - } - if (!isFromIntMethod || !isValueMethod) { - return false; - } - /* - * enum type should also contain minimum one pair of fields: EnumType - * field and int _field - */ - int enumCount = 0; - Field[] fields = forClass.getFields(); - for (int i = 0; i < fields.length; i++) { - if (fields[i].getType().equals(forClass)) { - int modifiers = fields[i].getModifiers(); - if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers) && Modifier.isFinal(modifiers)) { - try { - Field field = forClass.getField("_" + fields[i].getName()); - if (field.getType().equals(int.class)) { - enumCount++; - } - } catch (NoSuchFieldException e) { - } - - } - } - } - return enumCount > 0; - } - - /** - * Tells whether given class is CORBA user exception - * - * @param forClass - * @return - */ - private static boolean isUserException(Class forClass) { - do { - if (forClass.equals(Exception.class)) { - return true; - } else { - forClass = forClass.getSuperclass(); - } - } while (forClass != null && !forClass.equals(Object.class)); - 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; - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeNode.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeNode.java deleted file mode 100644 index 009eac3377..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/TypeTreeNode.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.provider.types; - -/** - * @version $Rev$ $Date$ - * Represents single tree node. - * - */ -public class TypeTreeNode { - - private NodeType nodeType; - private TypeTreeNode[] children; - private Class javaClass; - private String name; - private Object attributes; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public NodeType getNodeType() { - return nodeType; - } - - public void setNodeType(NodeType nodeType) { - this.nodeType = nodeType; - } - - public TypeTreeNode[] getChildren() { - return children; - } - - public void setChildren(TypeTreeNode[] children) { - this.children = children; - } - - public Class getJavaClass() { - return javaClass; - } - - public void setJavaClass(Class javaClass) { - this.javaClass = javaClass; - } - - public Object getAttributes() { - return attributes; - } - - public void setAttributes(Object attributes) { - this.attributes = attributes; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/UnionAttributes.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/UnionAttributes.java deleted file mode 100644 index 34bee2a0e4..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/UnionAttributes.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.provider.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 optionsMapping = new HashMap(); - - 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 getOptionsMapping() { - return optionsMapping; - } - - public void setOptionsMapping(Map optionsMapping) { - this.optionsMapping = optionsMapping; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ArrayTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ArrayTypeHelper.java deleted file mode 100644 index 35a1e539d9..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ArrayTypeHelper.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.provider.types.util; - -import java.lang.reflect.Array; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class ArrayTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - Object array = null; - try { - int size = (Integer)node.getAttributes(); - array = Array.newInstance(node.getChildren()[0].getJavaClass(), size); - for (int i = 0; i < size; i++) { - Array.set(array, i, TypeHelpersProxy.read(node.getChildren()[0], is)); - } - } catch (Exception e) { - e.printStackTrace(); - } - return array; - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - for (int i = 0; i < (Integer)node.getAttributes(); i++) { - TypeHelpersProxy.write(node.getChildren()[0], os, Array.get(data, i)); - } - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/BooleanTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/BooleanTypeHelper.java deleted file mode 100644 index bbc2012a38..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/BooleanTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class BooleanTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_boolean(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_boolean((Boolean)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ByteTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ByteTypeHelper.java deleted file mode 100644 index 761cc5d62c..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ByteTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class ByteTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_octet(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_octet((Byte)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/CharTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/CharTypeHelper.java deleted file mode 100644 index b2d2afd011..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/CharTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class CharTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_char(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_char((Character)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/DoubleTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/DoubleTypeHelper.java deleted file mode 100644 index f667123bb7..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/DoubleTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class DoubleTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_double(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_double((Double)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/EnumTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/EnumTypeHelper.java deleted file mode 100644 index ae52bd6bbf..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/EnumTypeHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.provider.types.util; - -import java.lang.reflect.Method; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -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; - try { - Method method = node.getJavaClass().getMethod("from_int", new Class[] {int.class}); - result = method.invoke(null, new Object[] {value}); - } catch (Exception e) { - logger.log(Level.WARNING, "Exception during reading CORBA enum data", e); - e.printStackTrace(); - } - return result; - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - int value = 0; - try { - Method method = data.getClass().getMethod("value", new Class[] {}); - value = (Integer)method.invoke(data, new Object[] {}); - } catch (Exception e) { - logger.log(Level.WARNING, "Exception during writing CORBA enum data", e); - } - os.write_long(value); - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/FloatTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/FloatTypeHelper.java deleted file mode 100644 index 7c39725012..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/FloatTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class FloatTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_float(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_float((Float)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/IntTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/IntTypeHelper.java deleted file mode 100644 index e903b59e50..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/IntTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class IntTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_long(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_long((Integer)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/LongTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/LongTypeHelper.java deleted file mode 100644 index 79d3c0cbc8..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/LongTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class LongTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_longlong(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_longlong((Long)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ReferenceTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ReferenceTypeHelper.java deleted file mode 100644 index c89a25401d..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ReferenceTypeHelper.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.reference.InterfaceInstanceCreator; -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.Object; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class ReferenceTypeHelper implements TypeHelper { - - public java.lang.Object read(TypeTreeNode node, InputStream is) { - Object reference = is.read_Object(); - return (java.lang.Object)InterfaceInstanceCreator.createInstance(reference, node.getJavaClass()); - } - - public void write(TypeTreeNode node, OutputStream os, java.lang.Object data) { - os.write_Object((Object)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/SequenceTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/SequenceTypeHelper.java deleted file mode 100644 index 911c787b11..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/SequenceTypeHelper.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.provider.types.util; - -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class SequenceTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - Object sequence = null; - try { - int size = is.read_long(); - sequence = Array.newInstance(node.getChildren()[0].getJavaClass(), size); - for (int i = 0; i < size; i++) { - Array.set(sequence, i, TypeHelpersProxy.read(node.getChildren()[0], is)); - } - } catch (Exception e) { - e.printStackTrace(); - } - return sequence; - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - int sum = 0; - // determine length of array - List array = new ArrayList(); - while (true) { - try { - array.add(Array.get(data, sum)); - sum++; - } catch (ArrayIndexOutOfBoundsException e) { - break; - } - } - os.write_long(sum); - Iterator iter = array.iterator(); - while (iter.hasNext()) { - Object elem = iter.next(); - TypeHelpersProxy.write(node.getChildren()[0], os, elem); - } - - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ShortTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ShortTypeHelper.java deleted file mode 100644 index f4cdabc8e2..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/ShortTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class ShortTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_short(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_short((Short)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StringTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StringTypeHelper.java deleted file mode 100644 index 5a4fcba221..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StringTypeHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class StringTypeHelper implements TypeHelper { - - public Object read(TypeTreeNode node, InputStream is) { - return is.read_string(); - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - os.write_string((String)data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StructTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StructTypeHelper.java deleted file mode 100644 index 1fc729b926..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/StructTypeHelper.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.provider.types.util; - -import java.lang.reflect.Field; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -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; - if (children != null) { - try { - result = node.getJavaClass().newInstance(); - for (int i = 0; i < children.length; i++) { - Object childResult = TypeHelpersProxy.read(children[i], is); - Field childField = result.getClass().getField(children[i].getName()); - childField.set(result, childResult); - } - } catch (Exception e) { - logger.log(Level.WARNING, "Exception during reading CORBA struct data", e); - } - } - return result; - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - TypeTreeNode[] children = node.getChildren(); - if (children != null) { - try { - for (int i = 0; i < children.length; i++) { - Field childField = node.getJavaClass().getField(children[i].getName()); - TypeHelpersProxy.write(children[i], os, childField.get(data)); - } - } catch (Exception e) { - logger.log(Level.WARNING, "Exception during writing CORBA struct data", e); - } - } - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelper.java deleted file mode 100644 index 0f1f973f49..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.provider.types.util; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public interface TypeHelper { - - /** - * Reads CORBA object - * @param node - * @param is - * @return - */ - Object read(TypeTreeNode node, InputStream is); - - /** - * Writes CORBA object - * @param node - * @param os - * @param data - */ - void write(TypeTreeNode node, OutputStream os, Object data); - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelpersProxy.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelpersProxy.java deleted file mode 100644 index ded82bf12e..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/TypeHelpersProxy.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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.provider.types.util; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.binding.corba.provider.types.NodeType; -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - * Proxies getType(), write(), read() methods to appropriate TypeHelper implementation. - */ -public class TypeHelpersProxy { - - /** - * Maps primitive types to its TypeHelper implementations - */ - private static Map, TypeHelper> primitiveTypes = null; - - /** - * Maps other types to its TypeHelper implementations - */ - private static Map complexTypes = null; - - static { - // initiate type helpers - primitiveTypes = new HashMap, TypeHelper>(); - complexTypes = new HashMap(); - - primitiveTypes.put(boolean.class, new BooleanTypeHelper()); - primitiveTypes.put(char.class, new CharTypeHelper()); - primitiveTypes.put(byte.class, new ByteTypeHelper()); - primitiveTypes.put(short.class, new ShortTypeHelper()); - primitiveTypes.put(int.class, new IntTypeHelper()); - primitiveTypes.put(long.class, new LongTypeHelper()); - primitiveTypes.put(float.class, new FloatTypeHelper()); - primitiveTypes.put(double.class, new DoubleTypeHelper()); - primitiveTypes.put(String.class, new StringTypeHelper()); - primitiveTypes.put(Boolean.class, primitiveTypes.get(boolean.class)); - primitiveTypes.put(Character.class, primitiveTypes.get(char.class)); - primitiveTypes.put(Byte.class, primitiveTypes.get(byte.class)); - primitiveTypes.put(Short.class, primitiveTypes.get(short.class)); - primitiveTypes.put(Integer.class, primitiveTypes.get(int.class)); - primitiveTypes.put(Long.class, primitiveTypes.get(long.class)); - primitiveTypes.put(Float.class, primitiveTypes.get(float.class)); - primitiveTypes.put(Double.class, primitiveTypes.get(double.class)); - primitiveTypes.put(String.class, primitiveTypes.get(String.class)); - complexTypes.put(NodeType.array, new ArrayTypeHelper()); - complexTypes.put(NodeType.struct, new StructTypeHelper()); - complexTypes.put(NodeType.reference, new ReferenceTypeHelper()); - 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()); - } - - /** - * Gets type helper basing on given type - * - * @param node - * @return - */ - private static TypeHelper getTypeHelper(TypeTreeNode node) { - TypeHelper typeHelper = null; - NodeType type = node.getNodeType(); - if (type.equals(NodeType.primitive)) { - typeHelper = primitiveTypes.get(node.getJavaClass()); - } else { - typeHelper = complexTypes.get(type); - } - return typeHelper; - } - - /** - * Proxies read method invocation to appropriate TypeHelper implementation. - * - * @param node - * @param is - * @return - */ - public static final Object read(TypeTreeNode node, InputStream is) { - TypeHelper helper = getTypeHelper(node); - return helper.read(node, is); - } - - /** - * Proxies write method invocation to appropriate TypeHelper implementation. - * - * @param node - * @param os - * @param data - */ - public static final void write(TypeTreeNode node, OutputStream os, Object data) { - TypeHelper helper = getTypeHelper(node); - helper.write(node, os, data); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/UnionTypeHelper.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/UnionTypeHelper.java deleted file mode 100644 index df2e833fcd..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/UnionTypeHelper.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.provider.types.util; - -import java.lang.reflect.Field; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeNode; -import org.apache.tuscany.sca.binding.corba.provider.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); - } - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/Utils.java b/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/Utils.java deleted file mode 100644 index 7ccd70f69e..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC3/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/types/util/Utils.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.provider.types.util; - -/** - * @version $Rev$ $Date$ - * Class for type utilities - */ -public class Utils { - - /** - * Creates CORBA id for Java class - * @param forClass - * @return - */ - public static String getTypeId(Class forClass) { - String result = forClass.getName().replace('.', '/'); - result = result.replaceAll("Package", ""); - result = "IDL:" + result + ":1.0"; - return result; - } - -} -- cgit v1.2.3