aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
committerJing Yu <jingyu@google.com>2010-07-22 14:03:48 -0700
commitb094d6c4bf572654a031ecc4afe675154c886dc5 (patch)
tree89394c56b05e13a5413ee60237d65b0214fd98e2 /gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication
parentdc34721ac3bf7e3c406fba8cfe9d139393345ec5 (diff)
downloadtoolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.gz
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.tar.bz2
toolchain_gcc-b094d6c4bf572654a031ecc4afe675154c886dc5.zip
commit gcc-4.4.3 which is used to build gcc-4.4.3 Android toolchain in master.
The source is based on fsf gcc-4.4.3 and contains local patches which are recorded in gcc-4.4.3/README.google. Change-Id: Id8c6d6927df274ae9749196a1cc24dbd9abc9887
Diffstat (limited to 'gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication')
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java230
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java111
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java344
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java284
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java66
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java103
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java37
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java71
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java116
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java60
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java60
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java162
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java100
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java75
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java117
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java209
-rw-r--r--gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java429
17 files changed, 2574 insertions, 0 deletions
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java
new file mode 100644
index 000000000..9af20d227
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java
@@ -0,0 +1,230 @@
+/* DemoServant.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+
+/**
+ * This class handles the actual server functionality in this test
+ * application. When the client calls the remote method, this
+ * finally results calling the method of this class.
+ *
+ * The parameters, passed to the server only, are just parameters of the
+ * java methods. The parameters that shuld be returned to client
+ * are wrapped into holder classes.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class DemoServant
+ extends _DemoTesterImplBase
+{
+ /**
+ * The field, that can be set and checked by remote client.
+ */
+ private int m_theField = 17;
+
+ /**
+ * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+ * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+ * encodings. Returs they generalization as a wide string.
+ */
+ public String passCharacters(String wide, String narrow)
+ {
+ System.out.println("SERVER: **** Wide and narrow string test.");
+ System.out.println("SERVER: Received '" + narrow + "' and '" + wide +
+ "'"
+ );
+
+ return "return '" + narrow + "' and '" + wide + "'";
+ }
+
+ /**
+ * Accept and return parameters, having various types.
+ */
+ public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
+ StringHolder a_string, DoubleHolder a_double
+ )
+ {
+ System.out.println("SERVER: ***** Test passing multiple parameters");
+ System.out.println("SERVER: Received:");
+ System.out.println("SERVER: octet " + an_octet.value);
+ System.out.println("SERVER: short " + a_short.value);
+ System.out.println("SERVER: string " + a_string.value);
+
+ // Returning incremented values.
+ an_octet.value++;
+ a_short.value++;
+
+ // OUT parameter, return only.
+ a_double.value = 1;
+ a_string.value += " [return]";
+ return 452572;
+ }
+
+ /**
+ * Accept and return the string arrays.
+ */
+ public String[] passStrings(String[] args)
+ {
+ System.out.println("SERVER: ***** Transferring string arrays");
+
+ String[] rt = new String[ args.length ];
+ for (int i = 0; i < args.length; i++)
+ {
+ System.out.println("SERVER: " + args [ i ]);
+
+ // Returning the changed content.
+ rt [ i ] = args [ i ] + ":" + args [ i ];
+ }
+ return rt;
+ }
+
+ /**
+ * Accept and return the structures.
+ */
+ public StructureToReturn passStructure(StructureToPass in_structure)
+ {
+ System.out.println("SERVER: ***** Transferring structures");
+ System.out.println("SERVER: Received " + in_structure.a + ":" +
+ in_structure.b
+ );
+
+ // Create and send back the returned structure.
+ StructureToReturn r = new StructureToReturn();
+ r.c = in_structure.a + in_structure.b;
+ r.n = 555;
+ r.arra = new int[] { 11, 22, 33 };
+ return r;
+ }
+
+ /**
+ * Pass and return the tree structure
+ */
+ public void passTree(TreeNodeHolder tree)
+ {
+ System.out.println("SERVER: ***** Transferring tree");
+
+ StringBuilder b = new StringBuilder();
+
+ // This both creates the tree string representation
+ // and changes the TreeNode names.
+ getImage(b, tree.value);
+ System.out.println("SERVER: The tree was: " + b + ", returning changed.");
+ }
+
+ /**
+ * Just prints the hello message.
+ */
+ public void sayHello()
+ {
+ System.out.println("SERVER: ***** Hello, world!");
+ }
+
+ /**
+ * Get the value of our field.
+ */
+ public int theField()
+ {
+ System.out.println("SERVER: ***** Getting the field value, " + m_theField);
+ return m_theField;
+ }
+
+ /**
+ * Set the value of our field.
+ */
+ public void theField(int a_field)
+ {
+ System.out.println("SERVER: ***** Setting the field value to " + a_field);
+ m_theField = a_field;
+ }
+
+ /**
+ * Throw an exception.
+ *
+ * @param parameter specifies which exception will be thrown.
+ *
+ * @throws WeThrowThisException for the non negative parameter.
+ * @throws BAD_OPERATION for the negative parameter.
+ */
+ public void throwException(int parameter)
+ throws WeThrowThisException
+ {
+ System.out.println("SERVER: ***** Testing exceptions");
+ if (parameter > 0)
+ {
+ System.out.println("SERVER: Throwing the user exception, " +
+ "specific field = "+parameter
+ );
+ throw new WeThrowThisException(parameter);
+ }
+ else
+ {
+ System.out.println("SERVER: Throwing " +
+ "the BAD_OPERATION, minor 456, completed"
+ );
+ throw new BAD_OPERATION(456, CompletionStatus.COMPLETED_YES);
+ }
+ }
+
+ /**
+ * Visit all tree nodes, getting the string representation
+ * and adding '++' to the TreeNode names.
+ *
+ * @param b the buffer to collect the string representation.
+ * @param n the rott tree TreeNode.
+ */
+ private void getImage(StringBuilder b, TreeNode n)
+ {
+ b.append(n.name);
+ n.name = n.name + "++";
+ b.append(": (");
+
+ for (int i = 0; i < n.children.length; i++)
+ {
+ getImage(b, n.children [ i ]);
+ b.append(' ');
+ }
+ b.append(") ");
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java
new file mode 100644
index 000000000..f3766f325
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java
@@ -0,0 +1,111 @@
+/* DemoTester.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+
+/**
+ * The interface of our remote object. Some IDL compiles split it
+ * into "DemoTester" and "comTesterOperations", but we do not see
+ * much sense in doing this here.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface DemoTester
+{
+ /**
+ * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+ * Both types are mapped into java String.
+ *
+ * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+ * encodings.
+ */
+ String passCharacters(String wide, String narrow);
+
+ /**
+ * Passes various parameters in both directions.
+ * The parameters that must return the value are wrapped in holders.
+ */
+ int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
+ StringHolder a_string, DoubleHolder a_double
+ );
+
+ /**
+ * Passes and returns the string sequence (flexible length).
+ */
+ String[] passStrings(String[] arg);
+
+ /**
+ * Passes and returns the structures.
+ */
+ StructureToReturn passStructure(StructureToPass in_structure);
+
+ /**
+ * Pass and return the tree structure
+ *
+ * @param tree the root TreeNode of the tree.
+ */
+ void passTree(TreeNodeHolder tree);
+
+ /**
+ * Just prints the "Hello" message.
+ */
+ void sayHello();
+
+ /**
+ * Gets the value of the field in our object.
+ */
+ int theField();
+
+ /**
+ * Sets the value for the field in our object.
+ */
+ void theField(int newTheField);
+
+ /**
+ * Throws either 'WeThrowThisException' with the 'ourField' field
+ * initialised to the passed positive value
+ * or system exception (if the parameter is zero or negative).
+ */
+ void throwException(int parameter)
+ throws WeThrowThisException;
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
new file mode 100644
index 000000000..843530de5
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
@@ -0,0 +1,344 @@
+/* DirectTest.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.UserException;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+/**
+ * This code uses CORBA to call various methods of the remote object,
+ * passing data structures in both directions. It finds the server by
+ * reading the IOR.txt file that must be present in the folder,
+ * where the program has been started.
+ *
+ * The IOR.txt file is written by the server
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
+ * The server should be reachable over Internet, unless blocked by
+ * security tools.
+ *
+ * This code is tested for interoperability with Sun Microsystems
+ * java implementation 1.4.2 (08.b03). Server, client of both can
+ * be started either on Sun's or on Classpath CORBA implementation,
+ * in any combinations.
+ *
+ * BE SURE TO START THE SERVER BEFORE STARTING THE CLIENT.
+ *
+ * This version uses direct casting. This is the most convenient
+ * method, but it is normally used together with the IDL compiler.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class DirectTest
+{
+ /*
+ * The IOR.txt file, used to find the server and the object on the server. is written when starting the accompanying
+ */
+ public static final String IOR_FILE = "IOR.txt";
+
+ /**
+ * The invocation target.
+ */
+ DemoTester object;
+
+ /**
+ * Get the object reference.
+ */
+ public static void main(String[] args)
+ {
+ try
+ {
+ ORB orb = org.omg.CORBA.ORB.init(args, null);
+
+ File f = new File(IOR_FILE);
+ char[] c = new char[ (int) f.length() ];
+ FileReader fr = new FileReader(f);
+ fr.read(c);
+ fr.close();
+
+ String ior = new String(c);
+ DirectTest we = new DirectTest();
+ we.object = (DemoTester) orb.string_to_object(ior);
+ we.Demo();
+ orb.shutdown(false);
+ }
+ catch (IOException ex)
+ {
+ System.out.println("Cannot find or read the IOR file " +
+ "in the current folder"
+ );
+ ex.printStackTrace();
+ }
+ }
+
+ /** Run all demos. */
+ public void Demo()
+ {
+ testHello();
+ testField();
+ testParameters();
+ testStringArray();
+ testStructure();
+ testWideNarrowStrings();
+ testTree();
+ testSystemException();
+ testUserException();
+ }
+
+ /**
+ * Test the field getter/setter.
+ */
+ public void testField()
+ {
+ System.out.println("***** Test the remote field getter/setter.");
+ System.out.println("The field value is now " + object.theField());
+ System.out.println("Setting it to 555");
+ object.theField(555);
+ System.out.println("The field value is now " + object.theField());
+ }
+
+ /** The simple invocation of the parameterless remote method. */
+ public void testHello()
+ {
+ System.out.println("***** Say hello (see the server console).");
+ object.sayHello();
+ }
+
+ /**
+ * Test passing multiple parameters in both directions.
+ */
+ public void testParameters()
+ {
+ System.out.println("***** Pass multiple parameters.");
+
+ // Holder classes are required to simulate passing
+ // "by reference" (modification is returned back to the server).
+ ByteHolder a_byte = new ByteHolder((byte) 0);
+ ShortHolder a_short = new ShortHolder((short) 3);
+ StringHolder a_string = new StringHolder("[string 4]");
+
+ // This is an 'out' parameter; the value must not be passed to servant.
+ DoubleHolder a_double = new DoubleHolder(56.789);
+
+ int returned = object.passSimple(a_byte, 2, a_short, a_string, a_double);
+
+ System.out.println(" Returned value " + returned);
+ System.out.println(" Returned parameters: ");
+ System.out.println(" octet " + a_byte.value);
+ System.out.println(" short " + a_short.value);
+ System.out.println(" string '" + a_string.value+"'");
+ System.out.println(" double " + a_double.value);
+ }
+
+ /**
+ * Test passing the string array, flexible size.
+ */
+ public void testStringArray()
+ {
+ System.out.println("***** Pass string array.");
+
+ String[] x = new String[] { "one", "two" };
+
+ // The array is passed as CORBA sequence, variable size is supported.
+ String[] y = object.passStrings(x);
+
+ for (int i = 0; i < y.length; i++)
+ {
+ System.out.println(" Passed " + x [ i ] + ", returned: " + y [ i ]);
+ }
+ }
+
+ /**
+ * Test passing the structures.
+ */
+ public void testStructure()
+ {
+ System.out.println("***** Pass structure");
+
+ StructureToPass arg = new StructureToPass();
+ arg.a = "A";
+ arg.b = "B";
+
+ StructureToReturn r = object.passStructure(arg);
+
+ System.out.println(" Fields of the returned structure:");
+
+ System.out.println(" c: " + r.c);
+ System.out.println(" n: " + r.n);
+
+ // The field r.arra is declared as the fixed size CORBA array.
+ System.out.println(" r[0]: " + r.arra [ 0 ]);
+ System.out.println(" r[1]: " + r.arra [ 1 ]);
+ System.out.println(" r[3]: " + r.arra [ 2 ]);
+ }
+
+ /**
+ * Test catching the system exception, thrown on the remote side.
+ */
+ public void testSystemException()
+ {
+ System.out.println("**** Test system exception:");
+ try
+ {
+ // Negative parameter = system exception.
+ object.throwException(-55);
+ }
+ catch (BAD_OPERATION ex)
+ {
+ System.out.println(" The expected BAD_OPERATION, minor code " +
+ ex.minor + ", has been thrown on remote side."
+ );
+ }
+ catch (UserException uex)
+ {
+ throw new InternalError();
+ }
+ }
+
+ /**
+ * Test passing the tree structure. Any shape of the tree is
+ * supported without rewriting the code.
+ */
+ public void testTree()
+ {
+ // Manually create the tree of nodes:
+ // Root
+ // +-- a
+ // |
+ // +-- b
+ // +-- ba
+ // | |
+ // | +-- bac
+ // |
+ // +-- bb
+ System.out.println("***** Pass and return the tree.");
+
+ TreeNode n = nod("Root");
+
+ n.children = new TreeNode[] { nod("a"), nod("b") };
+ n.children [ 1 ].children = new TreeNode[] { nod("ba"), nod("bb") };
+ n.children [ 1 ].children [ 0 ].children = new TreeNode[] { nod("bac") };
+
+ TreeNodeHolder nh = new TreeNodeHolder(n);
+
+ // The server should add '++' to each TreeNode name.
+ object.passTree(nh);
+
+ // Convert the returned tree to some strig representation.
+ StringBuilder img = new StringBuilder();
+ getImage(img, nh.value);
+
+ System.out.println("Returned tree: " + img.toString());
+ }
+
+ /**
+ * Test catching the user exception, thrown on the remote side.
+ */
+ public void testUserException()
+ {
+ System.out.println("**** Test user exception:");
+ try
+ {
+ // The user exception contains one user-defined field that will
+ // be initialised to the passed parameter.
+ object.throwException(123);
+ throw new InternalError();
+ }
+ catch (WeThrowThisException uex)
+ {
+ System.out.println(" The user exception with field " + uex.ourField +
+ ", has been thrown on remote side."
+ );
+ }
+ }
+
+ /**
+ * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+ * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+ * encodings.
+ */
+ public void testWideNarrowStrings()
+ {
+ System.out.println("**** Test 8 bit and 16 bit char strings");
+
+ String r = object.passCharacters("wide string", "narrow string");
+ System.out.println(" returned: '" + r + "'");
+ }
+
+ /**
+ * Get the string representation of the passed tree.
+ * @param b the string buffer to accumulate the representation.
+ * @param n the tree (root TreeNode).
+ */
+ private void getImage(StringBuilder b, TreeNode n)
+ {
+ b.append(n.name);
+ b.append(": (");
+
+ for (int i = 0; i < n.children.length; i++)
+ {
+ getImage(b, n.children [ i ]);
+ b.append(' ');
+ }
+ b.append(") ");
+ }
+
+ /**
+ * Create a TreeNode with the given header.
+ *
+ * @param hdr the TreeNode header.
+ * @return the created TreeNode.
+ */
+ private TreeNode nod(String hdr)
+ {
+ TreeNode n = new TreeNode();
+ n.children = new TreeNode[ 0 ];
+ n.name = hdr;
+
+ return n;
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
new file mode 100644
index 000000000..9c908e520
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
@@ -0,0 +1,284 @@
+/* RequestTest.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.UnknownUserException;
+
+/**
+ * This code uses CORBA to call various methods of the remote object,
+ * passing data structures in both directions. It finds the server by
+ * reading the IOR.txt file that must be present in the folder,
+ * where the program has been started.
+ *
+ * The IOR.txt file is written by the server
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
+ * The server should be reachable over Internet, unless blocked by
+ * security tools.
+ *
+ * This code is tested for interoperability with Sun Microsystems
+ * java implementation 1.4.2 (08.b03). Server, client of both can
+ * be started either on Sun's or on Classpath CORBA implementation,
+ * in any combinations.
+ *
+ * BE SURE TO START THE SERVER BEFORE STARTING THE CLIENT.
+ *
+ * Test invocations using org.omg.CORBA.Request. The methods are
+ * called by "name", like in java.lang.reflect.
+ * No need to have the local pre-compiled stub classes.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class RequestTest
+{
+ /*
+ * The IOR.txt file, used to find the server and the object on the server. is written when starting the accompanying
+ */
+ public static final String IOR_FILE = "IOR.txt";
+
+ /**
+ * The Object Request Brocker, used for various CORBA operations.
+ */
+ ORB orb;
+
+ /**
+ * Our remote object - the invocation target.
+ */
+ org.omg.CORBA.Object object;
+
+ /**
+ * Prepare for work. Read the file IOR.txt in the current folder
+ * and find the server using its information.
+ */
+ public static void main(String[] args)
+ {
+ RequestTest we = new RequestTest();
+
+ we.orb = org.omg.CORBA.ORB.init(new String[ 0 ], null);
+
+ char[] c = null;
+ try
+ {
+ File f = new File(IOR_FILE);
+ c = new char[ (int) f.length() ];
+
+ FileReader fr = new FileReader(f);
+ fr.read(c);
+ fr.close();
+ }
+ catch (IOException ex)
+ {
+ System.out.println("Unable to write the IOR.txt into the current folder");
+ ex.printStackTrace();
+ }
+
+ String ior = new String(c);
+
+ we.object = we.orb.string_to_object(ior);
+ we.Demo();
+ we.orb.shutdown(false);
+ }
+
+ /** Run all demos. */
+ public void Demo()
+ {
+ testHello();
+ try
+ {
+ testParameters();
+ }
+ catch (Exception ex)
+ {
+ // Not expected.
+ throw new InternalError();
+ }
+ testSystemException();
+ testWideNarrowStrings();
+ }
+
+ /**
+ * Send the hello message, one way.
+ */
+ public void testHello()
+ {
+ System.out.println("***** Test 'HELLO WORLD' (see the server console).");
+
+ Request hello =
+ object._create_request(null, "sayHello", orb.create_list(0), null);
+
+ // No response expected.
+ hello.send_oneway();
+ }
+
+ /**
+ * Test passing various parameters in both directions.
+ */
+ public void testParameters()
+ throws Exception
+ {
+ System.out.println("***** Test passing multiple parameters:");
+
+ Request r =
+ object._create_request(null, "passSimple", orb.create_list(0), null);
+
+ r.add_inout_arg().insert_octet((byte) 0);
+ r.add_in_arg().insert_long(2);
+ r.add_inout_arg().insert_short((short) 3);
+ r.add_inout_arg().insert_string("[string 4]");
+ r.add_out_arg().type(orb.get_primitive_tc(TCKind.tk_double));
+
+ NVList para = r.arguments();
+
+ System.out.println(" --- Parameters before invocation: ");
+
+ System.out.println(" octet " + para.item(0).value().extract_octet());
+ System.out.println(" long (in parameter) " +
+ para.item(1).value().extract_long()
+ );
+ System.out.println(" short " + para.item(2).value().extract_short());
+ System.out.println(" string " + para.item(3).value().extract_string());
+
+ // For the last parameter, the value is not set.
+ r.set_return_type(orb.get_primitive_tc(TCKind.tk_long));
+
+ r.invoke();
+
+ para = r.arguments();
+
+ System.out.println(" --- Parameters after invocation:");
+
+ System.out.println(" octet " + para.item(0).value().extract_octet());
+ System.out.println(" long (in parameter, must not be changed) " +
+ para.item(1).value().extract_long()
+ );
+ System.out.println(" short " + para.item(2).value().extract_short());
+ System.out.println(" string " + para.item(3).value().extract_string());
+ System.out.println(" double " + para.item(4).value().extract_double());
+
+ System.out.println(" Returned value " + r.result().value().extract_long());
+ }
+
+ /**
+ * Test catching the system exception, thrown on the remote side.
+ */
+ public void testSystemException()
+ {
+ System.out.println("**** Test system exception:");
+ try
+ {
+ ExceptionList exList = orb.create_exception_list();
+ exList.add(WeThrowThisExceptionHelper.type());
+
+ Request rq =
+ object._create_request(null, "throwException", orb.create_list(1),
+ null, exList, null
+ );
+
+ rq.add_in_arg().insert_long(-55);
+
+ rq.invoke();
+
+ throw new InternalError();
+ }
+ catch (BAD_OPERATION ex)
+ {
+ System.out.println(" The expected BAD_OPERATION, minor code " +
+ ex.minor + ", has been thrown on remote side."
+ );
+ }
+ }
+
+ /**
+ * Test catching the user exception, thrown on the remote side.
+ */
+ public void testUserException()
+ {
+ System.out.println("**** Test user exception:");
+
+ ExceptionList exList = orb.create_exception_list();
+ exList.add(WeThrowThisExceptionHelper.type());
+
+ Request rq =
+ object._create_request(null, "throwException", orb.create_list(1), null,
+ exList, null
+ );
+
+ rq.add_in_arg().insert_long(123);
+ rq.invoke();
+
+ UnknownUserException uku = (UnknownUserException) rq.env().exception();
+ WeThrowThisException our_exception = WeThrowThisExceptionHelper.extract(uku.except);
+
+ System.out.println(" Our user exception, field " + our_exception.ourField +
+ ", has been thrown on remote side."
+ );
+ }
+
+ /**
+ * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+ * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+ * encodings.
+ */
+ public void testWideNarrowStrings()
+ throws BAD_OPERATION
+ {
+ System.out.println("**** Test 8 bit and 16 bit char strings");
+
+ Request rq =
+ object._create_request(null, "passCharacters", orb.create_list(0), null);
+
+ rq.add_in_arg().insert_wstring("wide string");
+ rq.add_in_arg().insert_string("narrow string");
+
+ rq.set_return_type(orb.get_primitive_tc(TCKind.tk_wstring));
+
+ rq.invoke();
+
+ System.out.println(" Returned ' " + rq.result().value().extract_wstring());
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java
new file mode 100644
index 000000000..d17e91fba
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java
@@ -0,0 +1,66 @@
+/* StructureToPass.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+
+/**
+ * The data structure, passed from to the server from client in our tests.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class StructureToPass
+ implements org.omg.CORBA.portable.IDLEntity
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The first string, stored in this structure (defined as
+ * "narrow string").
+ */
+ public String a;
+
+ /**
+ * The second string, stored in this structure (define as
+ * "wide" (usually Unicode) string.
+ */
+ public String b;
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java
new file mode 100644
index 000000000..155ad170b
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java
@@ -0,0 +1,103 @@
+/* StructureToPassHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The helper operations for the {@link StructureToPass}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class StructureToPassHelper
+{
+ /**
+ * The repository ID of the {@link StructureToPass}.
+ */
+ private static String id =
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass:1.0";
+
+ /**
+ * Get the repository id.
+ */
+ public static String id()
+ {
+ return id;
+ }
+
+ /**
+ * Read the structure from the CDR stram.
+ */
+ public static StructureToPass read(InputStream istream)
+ {
+ StructureToPass value = new StructureToPass();
+ value.a = istream.read_string();
+ value.b = istream.read_wstring();
+ return value;
+ }
+
+ /**
+ * Get the type code of this structure.
+ */
+ public static synchronized TypeCode type()
+ {
+ StructMember[] members = new StructMember[2];
+ TypeCode member = null;
+ member = OrbRestricted.Singleton.create_string_tc(0);
+ members[0] = new StructMember("a", member, null);
+ member = OrbRestricted.Singleton.create_string_tc(0);
+ members[1] = new StructMember("b", member, null);
+ return OrbRestricted.Singleton.create_struct_tc(StructureToPassHelper.id(),
+ "StructureToPass", members);
+ }
+
+ /**
+ * Write the structure into the CDR stream.
+ */
+ public static void write(OutputStream ostream, StructureToPass value)
+ {
+ ostream.write_string(value.a);
+ ostream.write_wstring(value.b);
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java
new file mode 100644
index 000000000..5bbe6908e
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java
@@ -0,0 +1,37 @@
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+public final class StructureToPassHolder
+ implements Streamable
+{
+ public StructureToPass value;
+
+ public StructureToPassHolder()
+ {
+ }
+
+ public StructureToPassHolder(StructureToPass initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read(InputStream i)
+ {
+ value = StructureToPassHelper.read(i);
+ }
+
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return StructureToPassHelper.type();
+ }
+
+ public void _write(OutputStream o)
+ {
+ StructureToPassHelper.write(o, value);
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java
new file mode 100644
index 000000000..5dc843ae8
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java
@@ -0,0 +1,71 @@
+/* StructureToReturn.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * This data structure is returned from the server to client in our tests.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class StructureToReturn
+ implements IDLEntity
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The string field.
+ */
+ public String c;
+
+ /**
+ * The CORBA array field. This field is handled as the fixed
+ * size CORBA array, but structures can also have the variable
+ * size CORBA sequences.
+ */
+ public int[] arra = new int[3];
+
+ /**
+ * The int (CORBA long) field.
+ */
+ public int n;
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java
new file mode 100644
index 000000000..83f422c52
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java
@@ -0,0 +1,116 @@
+/* StructureToReturnHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * This class defines the helper operations for {@link StructureToReturn}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class StructureToReturnHelper
+{
+ /**
+ * The repository id.
+ */
+ private static String _id =
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn:1.0";
+
+ /**
+ * Return the repository id.
+ */
+ public static String id()
+ {
+ return _id;
+ }
+
+ /**
+ * Read the structure from the CDR stream.
+ */
+ public static StructureToReturn read(InputStream istream)
+ {
+ StructureToReturn value = new StructureToReturn();
+ value.n = istream.read_long();
+ value.c = istream.read_wstring();
+ value.arra = new int[ 3 ];
+
+ // Read the fixed size array.
+ for (int i = 0; i < 3; i++)
+ value.arra [ i ] = istream.read_long();
+ return value;
+ }
+
+ /**
+ * Create the typecode.
+ */
+ public static synchronized TypeCode type()
+ {
+ StructMember[] members = new StructMember[3];
+ TypeCode member = OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_long);
+ members[0] = new StructMember("n", member, null);
+ member = OrbRestricted.Singleton.create_string_tc(0);
+ members[1] = new StructMember("c", member, null);
+ member = OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_long);
+ member = OrbRestricted.Singleton.create_array_tc(3, member);
+ members[2] = new StructMember("arra", member, null);
+ return OrbRestricted.Singleton.create_struct_tc(
+ StructureToReturnHelper.id(),
+ "StructureToReturn",
+ members);
+ }
+
+ /**
+ * Write the structure to the CDR stream.
+ */
+ public static void write(OutputStream ostream, StructureToReturn value)
+ {
+ ostream.write_long(value.n);
+ ostream.write_wstring(value.c);
+
+ // Write the fixed size array.
+ for (int i = 0; i < 3; i++)
+ ostream.write_long(value.arra [ i ]);
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java
new file mode 100644
index 000000000..c70f9cfcc
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java
@@ -0,0 +1,60 @@
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * The holder for the structure, returned from the server.
+ */
+public final class StructureToReturnHolder
+ implements Streamable
+{
+ /**
+ * The enclosed structure.
+ */
+ public StructureToReturn value = null;
+
+ /**
+ * Create the empty holder.
+ */
+ public StructureToReturnHolder()
+ {
+ }
+
+ /**
+ * Crate the holder with the defined initial value.
+ */
+ public StructureToReturnHolder(StructureToReturn initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Read the value from the CDR stream.
+ */
+ public void _read(InputStream in)
+ {
+ value = StructureToReturnHelper.read(in);
+ }
+
+ /**
+ * Get the typecode of this structure.
+ */
+ public TypeCode _type()
+ {
+ return StructureToReturnHelper.type();
+ }
+
+ /**
+ * Write the value from the CDR stream.
+ * @param out
+ */
+ public void _write(OutputStream out)
+ {
+ StructureToReturnHelper.write(out, value);
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java
new file mode 100644
index 000000000..b267f39ea
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java
@@ -0,0 +1,60 @@
+/* TreeNode.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+/**
+ * The support for the tree structure, used in the test of
+ * ability to pass and return the tree structure.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class TreeNode
+ implements org.omg.CORBA.portable.IDLEntity
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /** The TreeNode name */
+ public String name = null;
+
+ /** The TreeNode children. */
+ public TreeNode[] children = null;
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java
new file mode 100644
index 000000000..eac1c9a24
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java
@@ -0,0 +1,162 @@
+/* TreeNodeHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * This class is used for various helper operations around the
+ * tree {@link} structure.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class TreeNodeHelper
+{
+ /**
+ * The TreeNode repository id, used to identify the structure.
+ */
+ private static String _id =
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode:1.0";
+
+ /**
+ * Caches the typecode, allowing to compute it only once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * This is used to handle the recursive object references in
+ * CORBA - supported way. The tree TreeNode definition is recursive,
+ * as the TreeNode contains the sequence of the nodes as its field.
+ */
+ private static boolean active;
+
+ /**
+ * Extract the tree TreeNode from the unversal CORBA wrapper, Any.
+ */
+ public static TreeNode extract(Any a)
+ {
+ return read(a.create_input_stream());
+ }
+
+ /**
+ * Get the TreeNode string identifer.
+ */
+ public static String id()
+ {
+ return _id;
+ }
+
+ /**
+ * Insert the TreeNode into the universal CORBA wrapper, Any.
+ */
+ public static void insert(Any a, TreeNode that)
+ {
+ OutputStream out = a.create_output_stream();
+ a.type(type());
+ write(out, that);
+ a.read_value(out.create_input_stream(), type());
+ }
+
+ /**
+ * Read the TreeNode from the common data reprentation (CDR) stream.
+ */
+ public static TreeNode read(InputStream istream)
+ {
+ TreeNode value = new TreeNode();
+ value.name = istream.read_string();
+
+ int _len0 = istream.read_long();
+ value.children = new TreeNode[ _len0 ];
+ for (int i = 0; i < value.children.length; ++i)
+ value.children [ i ] = TreeNodeHelper.read(istream);
+ return value;
+ }
+
+ /**
+ * Get the TreeNode type code definition.
+ */
+ public static synchronized TypeCode type()
+ {
+ // Compute the type code only once.
+ if (typeCode == null)
+ {
+ synchronized (TypeCode.class)
+ {
+ if (typeCode == null)
+ {
+ // To avoid the infinite recursion loop, the
+ // recursive reference is handled in specific way.
+ if (active)
+ return OrbRestricted.Singleton.create_recursive_tc(_id);
+ active = true;
+
+ // List all memebers of the TreeNode structure.
+ StructMember[] members = new StructMember[ 2 ];
+ TypeCode memberType;
+ memberType = OrbRestricted.Singleton.create_string_tc(0);
+ members [ 0 ] = new StructMember("name", memberType, null);
+ memberType = OrbRestricted.Singleton.create_recursive_tc("");
+ members [ 1 ] = new StructMember("children", memberType, null);
+ typeCode =
+ OrbRestricted.Singleton.create_struct_tc(TreeNodeHelper.id(), "TreeNode", members);
+ active = false;
+ }
+ }
+ }
+ return typeCode;
+ }
+
+ /**
+ * Write the TreeNode into the common data reprentation (CDR) stream.
+ */
+ public static void write(OutputStream ostream, TreeNode value)
+ {
+ ostream.write_string(value.name);
+ ostream.write_long(value.children.length);
+ for (int i = 0; i < value.children.length; ++i)
+ TreeNodeHelper.write(ostream, value.children [ i ]);
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java
new file mode 100644
index 000000000..ec180ce57
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java
@@ -0,0 +1,100 @@
+/* TreeNodeHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * The TreeNode holder is a wrapper about the TreeNode data structure. It
+ * can be used where the TreeNode must be passed both to and from
+ * the method being called. The same structure holds the tree,
+ * as it can be represented as a root TreeNode with children.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class TreeNodeHolder
+ implements Streamable
+{
+ /**
+ * Stores the TreeNode value.
+ */
+ public TreeNode value;
+
+ /**
+ * Creates the TreeNode holder with the null initial value.
+ */
+ public TreeNodeHolder()
+ {
+ }
+
+ /**
+ * Creates the TreeNode holder with the given initial value.
+ */
+ public TreeNodeHolder(TreeNode initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Reads the TreeNode value from the common data representation (CDR)
+ * stream.
+ */
+ public void _read(InputStream in)
+ {
+ value = TreeNodeHelper.read(in);
+ }
+
+ /**
+ * Writes the TreeNode value into common data representation (CDR)
+ * stream.
+ * @return
+ */
+ public TypeCode _type()
+ {
+ return TreeNodeHelper.type();
+ }
+
+ public void _write(OutputStream out)
+ {
+ TreeNodeHelper.write(out, value);
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java
new file mode 100644
index 000000000..cf20d61ec
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java
@@ -0,0 +1,75 @@
+/* WeThrowThisException.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * Our user exception, thrown in the tests of handling the exceptions,
+ * thrown on remote side. The exception contains the user - defined
+ * data field that is transferred from client to the server when the
+ * exception is thrown.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class WeThrowThisException
+ extends UserException
+ implements IDLEntity
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Our specific field, transferred to client.
+ */
+ public int ourField;
+
+ /**
+ * Create the exception.
+ *
+ * @param _ourField the value of our specific field.
+ */
+ public WeThrowThisException(int _ourField)
+ {
+ ourField = _ourField;
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java
new file mode 100644
index 000000000..adf4d25d5
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java
@@ -0,0 +1,117 @@
+/* WeThrowThisExceptionHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+/**
+ * The class, providing various helper operations with our user
+ * exception.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class WeThrowThisExceptionHelper
+{
+ /**
+ * The exception repository id. This name is also used to find the
+ * mapping local CORBA class.
+ */
+ private static String _id =
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0";
+
+ /**
+ * Get the exception repository id.
+ */
+ public static String id()
+ {
+ return _id;
+ }
+
+ /**
+ * Extract the exception from the given Any where it might be
+ * wrapped.
+ */
+ public static WeThrowThisException extract(Any a)
+ {
+ return read(a.create_input_stream());
+ }
+
+ /**
+ * Read the exception from the CDR stream.
+ */
+ public static WeThrowThisException read(org.omg.CORBA.portable.InputStream istream)
+ {
+ WeThrowThisException value = new WeThrowThisException(0);
+
+ // The repository ID is not used
+ istream.read_string();
+ value.ourField = istream.read_long();
+ return value;
+ }
+
+ /**
+ * Create the type code of this exception.
+ */
+ public static synchronized TypeCode type()
+ {
+ StructMember[] members = new StructMember[ 1 ];
+ TypeCode member = null;
+ member = OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_long);
+ members [ 0 ] = new StructMember("ourField", member, null);
+ return OrbRestricted.Singleton.create_struct_tc(WeThrowThisExceptionHelper.id(),
+ "WeThrowThisException", members
+ );
+ }
+
+ /**
+ * Write the exception into the CDR stream.
+ */
+ public static void write(org.omg.CORBA.portable.OutputStream ostream,
+ WeThrowThisException value
+ )
+ {
+ ostream.write_string(id());
+ ostream.write_long(value.ourField);
+ }
+} \ No newline at end of file
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java
new file mode 100644
index 000000000..237c23086
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java
@@ -0,0 +1,209 @@
+/* _DemoTesterImplBase.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+
+/**
+ * The base for the class that is actually implementing the functionality
+ * of the object on the server side ({@link DemoServant} of our case).
+ *
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "ImplBase".
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class _DemoTesterImplBase
+ extends ObjectImpl
+ implements DemoTester, InvokeHandler
+{
+/**
+ * When the server receives the request message from client, it
+ * calls this method.
+ *
+ * @param a_method the method name.
+ * @param in the CDR stream, from where the implementing code must
+ * read the method parameters.
+ * @param rh the response handler, used to get the stream where
+ * the returned values must be written.
+ *
+ * @return the stream, obtained from the response handler.
+ */
+ public OutputStream _invoke(String a_method, InputStream in,
+ ResponseHandler rh
+ )
+ {
+ OutputStream out;
+
+ /* Get the field value. */
+ if (a_method.equals("_get_theField"))
+ {
+ int result = (int) 0;
+ result = theField();
+ out = rh.createReply();
+ out.write_long(result);
+ }
+ else
+ /* Set the field value. */
+ if (a_method.equals("_set_theField"))
+ {
+ int newTheField = in.read_long();
+ theField(newTheField);
+ out = rh.createReply();
+ }
+ else
+ /* Logs calls to the file. */
+ if (a_method.equals("sayHello"))
+ {
+ sayHello();
+ out = rh.createReply();
+ }
+ else
+ /* Passes various parameters in both directions. */
+ if (a_method.equals("passSimple"))
+ {
+ ByteHolder an_octet = new ByteHolder();
+ an_octet.value = in.read_octet();
+
+ int a_long = in.read_long();
+ ShortHolder a_short = new ShortHolder();
+ a_short.value = in.read_short();
+
+ StringHolder a_string = new StringHolder();
+ a_string.value = in.read_string();
+
+ DoubleHolder a_double = new DoubleHolder();
+ int result = passSimple(an_octet, a_long, a_short, a_string, a_double);
+ out = rh.createReply();
+ out.write_long(result);
+ out.write_octet(an_octet.value);
+ out.write_short(a_short.value);
+ out.write_string(a_string.value);
+ out.write_double(a_double.value);
+ }
+ else
+ /* Passes the 'wide' (usually Unicode) string and the ordinary string. */
+ if (a_method.equals("passCharacters"))
+ {
+ String wide = in.read_wstring();
+ String narrow = in.read_string();
+ String result = null;
+ result = passCharacters(wide, narrow);
+ out = rh.createReply();
+ out.write_wstring(result);
+ }
+ else
+ /*
+ Throws either 'WeThrowThisException' with the 'ourField' field
+ initialised to the passed positive value
+ or system exception (if the parameter is zero or negative).
+ */
+ if (a_method.equals("throwException"))
+ {
+ try
+ {
+ int parameter = in.read_long();
+ throwException(parameter);
+ out = rh.createReply();
+ }
+ catch (WeThrowThisException exception)
+ {
+ out = rh.createExceptionReply();
+ WeThrowThisExceptionHelper.write(out, exception);
+ }
+ }
+ else
+ /* Passes and returns the structures. */
+ if (a_method.equals("passStructure"))
+ {
+ StructureToPass in_structure = StructureToPassHelper.read(in);
+ StructureToReturn result = null;
+ result = passStructure(in_structure);
+ out = rh.createReply();
+ StructureToReturnHelper.write(out, result);
+ }
+ else
+ /* Passes and returns the string sequence. */
+ if (a_method.equals("passStrings"))
+ {
+ String[] arg = StringSeqHelper.read(in);
+ String[] result = null;
+ result = passStrings(arg);
+ out = rh.createReply();
+ StringSeqHelper.write(out, result);
+ }
+ else
+ /** Pass and return the tree structure */
+ if (a_method.equals("passTree"))
+ {
+ TreeNodeHolder tree = new TreeNodeHolder();
+ tree.value = TreeNodeHelper.read(in);
+ passTree(tree);
+ out = rh.createReply();
+ TreeNodeHelper.write(out, tree.value);
+ }
+
+ else
+ throw new BAD_OPERATION("No method: " + a_method, 0,
+ CompletionStatus.COMPLETED_MAYBE
+ );
+
+ return out;
+ }
+
+ /**
+ * Return an array of this object repository ids.
+ */
+ public String[] _ids()
+ {
+ // They are the same as for the stub.
+ return _DemoTesterStub._ids;
+ }
+}
diff --git a/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java
new file mode 100644
index 000000000..c8e0ccd6d
--- /dev/null
+++ b/gcc-4.4.3/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java
@@ -0,0 +1,429 @@
+/* _DemoTesterStub.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
+
+import org.omg.CORBA.ByteHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+
+/**
+ * The stub (proxy) class, representing the remote object on the client
+ * side. It has all the same methods as the actual implementation
+ * on the server side. These methods contain the code for remote
+ * invocation.
+ *
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "Stub".
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class _DemoTesterStub
+ extends ObjectImpl
+ implements DemoTester
+{
+ /**
+ * A string array of DemoTester repository ids.
+ */
+ public static String[] _ids =
+ {
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester:1.0"
+ };
+
+ /**
+ * Return an array of DemoTester repository ids.
+ */
+ public String[] _ids()
+ {
+ return _ids;
+ }
+
+ /**
+ * Passes wide (UTF-16) string and narrow (ISO8859_1) string.
+ * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default
+ * encodings.
+ */
+ public String passCharacters(String wide, String narrow)
+ {
+ InputStream in = null;
+ try
+ {
+ // Get the output stream.
+ OutputStream out = _request("passCharacters", true);
+
+ // Write the parameters.
+
+ // The first string is passed as "wide"
+ // (usually 16 bit UTF-16) string.
+ out.write_wstring(wide);
+
+ // The second string is passed as "narrow"
+ // (usually 8 bit ISO8859_1) string.
+ out.write_string(narrow);
+
+ // Do the invocation.
+ in = _invoke(out);
+
+ // Read the method return value.
+ String result = in.read_wstring();
+ return result;
+ }
+ catch (ApplicationException ex)
+ {
+ // The exception has been throws on remote side, but we
+ // do not expect any. Throw the MARSHAL exception.
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ // This exception means that the parameters must be re-written.
+ return passCharacters(wide, narrow);
+ }
+ finally
+ {
+ // Release the resources, associated with the reply stream.
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ * Passes various parameters in both directions. The parameters that
+ * shoud also return the values are wrapped into holders.
+ */
+ public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short,
+ StringHolder a_string, DoubleHolder a_double
+ )
+ {
+ InputStream in = null;
+ try
+ {
+ // Get the stream where the parameters must be written:
+ OutputStream out = _request("passSimple", true);
+
+ // Write the parameters.
+ out.write_octet(an_octet.value);
+ out.write_long(a_long);
+ out.write_short(a_short.value);
+ out.write_string(a_string.value);
+
+ // Invoke the method.
+ in = _invoke(out);
+
+ // Read the returned values.
+ int result = in.read_long();
+
+ // Read the inout and out parameters.
+ an_octet.value = in.read_octet();
+ a_short.value = in.read_short();
+ a_string.value = in.read_string();
+ a_double.value = in.read_double();
+ return result;
+ }
+ catch (ApplicationException ex)
+ {
+ // Handle excepion on remote side.
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ // Handle instruction to resend the parameters.
+ return passSimple(an_octet, a_long, a_short, a_string, a_double);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ Passes and returns the string sequence.
+ */
+ public String[] passStrings(String[] arg)
+ {
+ InputStream in = null;
+ try
+ {
+ // Get the stream where the parameters must be written:
+ OutputStream out = _request("passStrings", true);
+
+ // Wrap the string array using the string sequence helper.
+ StringSeqHelper.write(out, arg);
+
+ // Invoke the method.
+ in = _invoke(out);
+
+ // Read the returned result using the string sequence helper.
+ String[] result = StringSeqHelper.read(in);
+ return result;
+ }
+ catch (ApplicationException ex)
+ {
+ // Handle the exception, thrown on remote side.
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ return passStrings(arg);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ Passes and returns the structures.
+ */
+ public StructureToReturn passStructure(StructureToPass in_structure)
+ {
+ InputStream in = null;
+ try
+ {
+ // Get the stream where the parameters must be written.
+ OutputStream out = _request("passStructure", true);
+
+ // Write the structure, using its helper.
+ StructureToPassHelper.write(out, in_structure);
+
+ // Invoke the method.
+ in = _invoke(out);
+
+ // Read the returned structer, using another helper.
+ StructureToReturn result = StructureToReturnHelper.read(in);
+ return result;
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ return passStructure(in_structure);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ * Pass and return the tree structure
+ */
+ public void passTree(TreeNodeHolder tree)
+ {
+ InputStream in = null;
+ try
+ {
+ // Get the stream where the parameters must be written.
+ OutputStream out = _request("passTree", true);
+
+ // Write the tree (TreeNode with its chilred, grandchildren and so on),
+ // using the appropriate helper.
+ TreeNodeHelper.write(out, tree.value);
+
+ // Call the method.
+ in = _invoke(out);
+
+ // Read the returned tree.
+ tree.value = TreeNodeHelper.read(in);
+ }
+ catch (ApplicationException ex)
+ {
+ // Handle eception on remote side.
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ passTree(tree);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ * One way call of the remote method.
+ */
+ public void sayHello()
+ {
+ InputStream in = null;
+ try
+ {
+ // As we do not expect any response, the second
+ // parameter is 'false'.
+ OutputStream out = _request("sayHello", false);
+ in = _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ sayHello();
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ * Get the field value.
+ */
+ public int theField()
+ {
+ InputStream in = null;
+ try
+ {
+ // The special name of operation instructs just to get
+ // the field value rather than calling the method.
+ OutputStream out = _request("_get_theField", true);
+ in = _invoke(out);
+
+ int result = in.read_long();
+ return result;
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ return theField();
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ * Set the field value.
+ */
+ public void theField(int newTheField)
+ {
+ InputStream in = null;
+ try
+ {
+ // The special name of operation instructs just to set
+ // the field value rather than calling the method.
+ OutputStream out = _request("_set_theField", true);
+ out.write_long(newTheField);
+ in = _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+ throw new MARSHAL(ex.getId());
+ }
+ catch (RemarshalException _rm)
+ {
+ theField(newTheField);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+
+ /**
+ * The server side exception tests.
+ *
+ * @param parameter the server throws the user exception in the case
+ * of the positive value of this argument, and system
+ * exception otherwise.
+ *
+ * @throws WeThrowThisException
+ */
+ public void throwException(int parameter)
+ throws WeThrowThisException
+ {
+ InputStream in = null;
+ try
+ {
+ // Get stream.
+ OutputStream out = _request("throwException", true);
+
+ // Write parameter.
+ out.write_long(parameter);
+
+ // Call method.
+ in = _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+
+ // Get the exception id.
+ String id = ex.getId();
+
+ // If this is the user exception we expect to catch, read and throw
+ // it here. The system exception, if thrown, is handled by _invoke.
+ if (id.equals("IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0")
+ )
+ throw WeThrowThisExceptionHelper.read(in);
+ else
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException _rm)
+ {
+ throwException(parameter);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+}