From 027e08ca2bc8411d313a36f881f56bd5d578c71d Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 27 Jun 2008 09:59:34 +0000 Subject: Remove as not required in release git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@672208 13f79535-47bb-0310-9956-ffa450edef68 --- .../binding/corba/types/util/ArrayTypeHelper.java | 46 ------- .../corba/types/util/BooleanTypeHelper.java | 45 ------- .../binding/corba/types/util/ByteTypeHelper.java | 45 ------- .../binding/corba/types/util/CharTypeHelper.java | 45 ------- .../binding/corba/types/util/DoubleTypeHelper.java | 45 ------- .../binding/corba/types/util/FloatTypeHelper.java | 45 ------- .../binding/corba/types/util/IntTypeHelper.java | 45 ------- .../binding/corba/types/util/LongTypeHelper.java | 46 ------- .../corba/types/util/ReferenceTypeHelper.java | 48 -------- .../corba/types/util/SequenceTypeHelper.java | 83 ------------- .../binding/corba/types/util/ShortTypeHelper.java | 46 ------- .../binding/corba/types/util/StringTypeHelper.java | 46 ------- .../binding/corba/types/util/StructTypeHelper.java | 90 -------------- .../sca/binding/corba/types/util/TypeHelper.java | 55 --------- .../binding/corba/types/util/TypeHelpersProxy.java | 132 --------------------- 15 files changed, 862 deletions(-) delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ArrayTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/BooleanTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ByteTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/CharTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/DoubleTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/FloatTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/IntTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/LongTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ReferenceTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/SequenceTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ShortTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StringTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StructTypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelper.java delete mode 100644 branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelpersProxy.java (limited to 'branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util') diff --git a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ArrayTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ArrayTypeHelper.java deleted file mode 100644 index e1d047b543..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ArrayTypeHelper.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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -/** - * @version $Rev$ $Date$ - */ -public class ArrayTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - // TODO Auto-generated method stub - return null; - } - - public Object read(TypeTreeNode node, InputStream is) { - // TODO Auto-generated method stub - return null; - } - - public void write(TypeTreeNode node, OutputStream os, Object data) { - // TODO Auto-generated method stub - - } - -} diff --git a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/BooleanTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/BooleanTypeHelper.java deleted file mode 100644 index 681d46342b..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/BooleanTypeHelper.java +++ /dev/null @@ -1,45 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class BooleanTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(8)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ByteTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ByteTypeHelper.java deleted file mode 100644 index f9d58bdf9a..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ByteTypeHelper.java +++ /dev/null @@ -1,45 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class ByteTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(10)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/CharTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/CharTypeHelper.java deleted file mode 100644 index 393493c925..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/CharTypeHelper.java +++ /dev/null @@ -1,45 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class CharTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(9)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/DoubleTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/DoubleTypeHelper.java deleted file mode 100644 index fb4e319939..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/DoubleTypeHelper.java +++ /dev/null @@ -1,45 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class DoubleTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(7)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/FloatTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/FloatTypeHelper.java deleted file mode 100644 index ffccf94f4a..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/FloatTypeHelper.java +++ /dev/null @@ -1,45 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class FloatTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(6)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/IntTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/IntTypeHelper.java deleted file mode 100644 index ecb886333a..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/IntTypeHelper.java +++ /dev/null @@ -1,45 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class IntTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(3)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/LongTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/LongTypeHelper.java deleted file mode 100644 index bbcdc6a07a..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/LongTypeHelper.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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class LongTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(23)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ReferenceTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ReferenceTypeHelper.java deleted file mode 100644 index c34e38b76d..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ReferenceTypeHelper.java +++ /dev/null @@ -1,48 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.impl.reference.InterfaceInstanceCreator; -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.Object; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class ReferenceTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - // TODO Auto-generated method stub - return null; - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/SequenceTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/SequenceTypeHelper.java deleted file mode 100644 index b14aa6f972..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/SequenceTypeHelper.java +++ /dev/null @@ -1,83 +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.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.types.TypeTreeNode; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class SequenceTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - TypeCode typeCode = - org.omg.CORBA.ORB.init().create_alias_tc( - node.getJavaClass().getSimpleName(), - node.getJavaClass().getSimpleName(), - org.omg.CORBA.ORB.init().create_sequence_tc(0, - TypeHelpersProxy.getType(node.getChildren()[0]))); - return typeCode; - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ShortTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ShortTypeHelper.java deleted file mode 100644 index 36c89984c7..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/ShortTypeHelper.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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class ShortTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(2)); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StringTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StringTypeHelper.java deleted file mode 100644 index b3f22c6737..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StringTypeHelper.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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class StringTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - return ORB.init().create_string_tc(0); - } - - 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StructTypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StructTypeHelper.java deleted file mode 100644 index 50e28cbd85..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/StructTypeHelper.java +++ /dev/null @@ -1,90 +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.types.util; - -import java.lang.reflect.Field; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.StructMember; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public class StructTypeHelper implements TypeHelper { - - public TypeCode getType(TypeTreeNode node) { - TypeTreeNode[] children = node.getChildren(); - if (children != null) { - StructMember[] members = new StructMember[children.length]; - for (int i = 0; i < children.length; i++) { - members[i] = new StructMember(children[i].getJavaClass() - .getSimpleName(), - TypeHelpersProxy.getType(children[i]), null); - } - TypeCode result = org.omg.CORBA.ORB.init().create_struct_tc( - node.getJavaClass().getSimpleName(), - node.getJavaClass().getSimpleName(), members); - return result; - } else { - return null; - } - } - - 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) { - // TODO: handle exception - e.printStackTrace(); - } - } - 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) { - // TODO: handle exception - e.printStackTrace(); - } - } - } - -} diff --git a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelper.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelper.java deleted file mode 100644 index c94fa79d83..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelper.java +++ /dev/null @@ -1,55 +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.types.util; - -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * @version $Rev$ $Date$ - */ -public interface TypeHelper { - - /** - * Gets type definition for CORBA API. - * @param node - * @return - */ - TypeCode getType(TypeTreeNode node); - - /** - * 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/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelpersProxy.java b/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelpersProxy.java deleted file mode 100644 index c81f101a7e..0000000000 --- a/branches/sca-java-1.3/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/types/util/TypeHelpersProxy.java +++ /dev/null @@ -1,132 +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.types.util; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.binding.corba.types.NodeType; -import org.apache.tuscany.sca.binding.corba.types.TypeTreeNode; -import org.omg.CORBA.TypeCode; -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()); - } - - /** - * 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 getType method invocation to appropriate TypeHelper - * implementation. It's not being used since I've changed method for passing - * arguments. May be useful while implementing CORBA service bindings. - * - * @param node - * @return - */ - public static final TypeCode getType(TypeTreeNode node) { - TypeHelper typeHelper = getTypeHelper(node); - TypeCode typeCode = typeHelper.getType(node); - return typeCode; - } - - /** - * 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); - } - -} -- cgit v1.2.3