[llvm-commits] [llvm-gcc-4.2] r43913 [18/80] - in /llvm-gcc-4.2/trunk: boehm-gc/ boehm-gc/Mac_files/ boehm-gc/cord/ boehm-gc/doc/ boehm-gc/include/ boehm-gc/include/private/ boehm-gc/tests/ libffi/ libffi/include/ libffi/src/ libffi/src/alpha/ libffi/src/arm/ libffi/src/cris/ libffi/src/frv/ libffi/src/ia64/ libffi/src/m32r/ libffi/src/m68k/ libffi/src/mips/ libffi/src/pa/ libffi/src/powerpc/ libffi/src/s390/ libffi/src/sh/ libffi/src/sh64/ libffi/src/sparc/ libffi/src/x86/ libffi/testsuite/ libffi/testsuite/config/ li...

Bill Wendling isanbard at gmail.com
Thu Nov 8 14:57:11 PST 2007


Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,358 @@
+/* CdrEncapsCodecImpl.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.CORBA;
+
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UserException;
+import org.omg.IOP.Codec;
+import org.omg.IOP.CodecPackage.FormatMismatch;
+import org.omg.IOP.CodecPackage.InvalidTypeForEncoding;
+import org.omg.IOP.CodecPackage.TypeMismatch;
+
+/**
+ * The local {@link Codec} implementation for ENCODING_CDR_ENCAPS
+ * encoding. This is a local implementation; the remote side should
+ * have its own Codec of this kind. 
+ *
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class CdrEncapsCodecImpl
+  extends LocalObject
+  implements Codec
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * If set to true, no wide string or wide character is allowed (GIOP 1.0).
+   */
+  private final boolean noWide;
+
+  /**
+   * The version of this encoding.
+   */
+  private final Version version;
+
+  /**
+   * The associated ORB.
+   */
+  protected final ORB orb;
+
+  /**
+   * If true, this Codec writes the record length (as int) in the beginning
+   * of the record. This indicator is part of the formal OMG standard, but it is
+   * missing in Sun's implementation. Both Suns's and this Codec detects
+   * the indicator, if present, but can also decode data where this information
+   * is missing. If the length indicator is missing, the first four bytes in
+   * Suns encoding are equal to 0 (Big Endian marker).
+   */
+  private boolean lengthIndicator = true;
+
+  /**
+   * Create an instance of this Codec, encoding following the given version.
+   */
+  public CdrEncapsCodecImpl(ORB _orb, Version _version)
+  {
+    orb = _orb;
+    version = _version;
+    noWide = version.until_inclusive(1, 0);
+  }
+
+  /**
+   * Return the array of repository ids for this object.
+   *
+   * @return { "IDL:gnu/CORBA/cdrEnapsCodec:1.0" }, always.
+   */
+  public String[] _ids()
+  {
+    return new String[] { "IDL:gnu/CORBA/cdrEnapsCodec:1.0" };
+  }
+
+  /**
+   * Decode the contents of the byte array into Any.
+   * The byte array may have the optional four byte length indicator
+   * in the beginning. If these four bytes are zero, it is assumed,
+   * that no length indicator is present.
+   */
+  public Any decode(byte[] them)
+             throws FormatMismatch
+  {
+    BufferredCdrInput input = createInput(them);
+    BufferredCdrInput encapsulation = createEncapsulation(them, input);
+
+    TypeCode type = encapsulation.read_TypeCode();
+
+    try
+      {
+        checkTypePossibility("", type);
+      }
+    catch (InvalidTypeForEncoding ex)
+      {
+        throw new FormatMismatch(ex.getMessage());
+      }
+
+    return readAny(type, encapsulation);
+  }
+
+  private BufferredCdrInput createEncapsulation(byte[] them, BufferredCdrInput input)
+  {
+    BufferredCdrInput encapsulation;
+
+    if ((them [ 0 ] | them [ 1 ] | them [ 2 ] | them [ 3 ]) == 0)
+      {
+        // Skip that appears to be the always present Big Endian marker.
+        encapsulation = input;
+        input.read_short();
+      }
+    else
+      encapsulation = input.read_encapsulation();
+    return encapsulation;
+  }
+
+  /** {@inheritDoc} */
+  public byte[] encode(Any that)
+                throws InvalidTypeForEncoding
+  {
+    checkTypePossibility("", that.type());
+
+    BufferedCdrOutput output = createOutput(that);
+
+    // BufferedCdrOutput has internal support for this encoding.
+    AbstractCdrOutput encapsulation = output.createEncapsulation();
+
+    try
+      {
+        TypeCodeHelper.write(encapsulation, that.type());
+        that.write_value(encapsulation);
+
+        encapsulation.close();
+        output.close();
+      }
+    catch (Exception ex)
+      {
+        MARSHAL m = new MARSHAL();
+        m.minor = Minor.Encapsulation;
+        m.initCause(ex);
+        throw m;
+      }
+    return output.buffer.toByteArray();
+  }
+
+  /**
+   * Decode the value, stored in the byte array, into Any, assuming,
+   * that the byte array holds the data structure, defined by the
+   * given typecode.
+   *
+   * The byte array may have the optional four byte length indicator
+   * in the beginning. If these four bytes are zero, it is assumed,
+   * that no length indicator is present.
+   */
+  public Any decode_value(byte[] them, TypeCode type)
+                   throws FormatMismatch, TypeMismatch
+  {
+    try
+      {
+        checkTypePossibility("", type);
+      }
+    catch (InvalidTypeForEncoding ex)
+      {
+        throw new TypeMismatch(ex.getMessage());
+      }
+
+    BufferredCdrInput input = createInput(them);
+    BufferredCdrInput encapsulation = createEncapsulation(them, input);
+    return readAny(type, encapsulation);
+  }
+
+  /**
+   * Read an Any from the given stream.
+   *
+   * @param type a type of the Any to read.
+   * @param input the encapsulation stream.
+   */
+  private Any readAny(TypeCode type, BufferredCdrInput encapsulation)
+               throws MARSHAL
+  {
+    gnuAny a = new gnuAny();
+    a.setOrb(orb);
+
+    // BufferredCdrInput has internal support for this encoding.
+    a.read_value(encapsulation, type);
+    return a;
+  }
+
+  /** {@inheritDoc} */
+  public byte[] encode_value(Any that)
+                      throws InvalidTypeForEncoding
+  {
+    checkTypePossibility("", that.type());
+
+    BufferedCdrOutput output = createOutput(that);
+
+    AbstractCdrOutput encapsulation = output.createEncapsulation();
+
+    try
+      {
+        that.write_value(encapsulation);
+
+        encapsulation.close();
+        output.close();
+      }
+    catch (Exception ex)
+      {
+        MARSHAL m = new MARSHAL();
+        m.minor = Minor.Encapsulation;
+        m.initCause(ex);
+        throw m;
+      }
+    return output.buffer.toByteArray();
+  }
+
+  /**
+   * Create the CDR output stream for writing the given Any.
+   * The BufferedCdrOutput has internal support for encapsulation encodings.
+   *
+   * @param that the Any that will be written.
+   *
+   * @return the stream.
+   *
+   * @throws InvalidTypeForEncoding if that Any cannot be written under the
+   * given version.
+   */
+  private BufferedCdrOutput createOutput(Any that)
+                             throws InvalidTypeForEncoding
+  {
+    BufferedCdrOutput output = new BufferedCdrOutput();
+    output.setOrb(orb);
+    output.setVersion(version);
+    return output;
+  }
+
+  /**
+   * Checks if the given type can be encoded. Currently only checks for wide
+   * strings and wide chars for GIOP 1.0.
+   *
+   * @param t a typecode to chek.
+   *
+   * @throws InvalidTypeForEncoding if the typecode is not valid for the given
+   * version.
+   */
+  private void checkTypePossibility(String name, TypeCode t)
+                             throws InvalidTypeForEncoding
+  {
+    if (noWide)
+      {
+        try
+          {
+            int kind = t.kind().value();
+
+            if (kind == TCKind._tk_wchar || kind == TCKind._tk_wstring)
+              throw new InvalidTypeForEncoding(name + " wide char in " +
+                                               version
+                                              );
+            else if (kind == TCKind._tk_alias || kind == TCKind._tk_array ||
+                     kind == TCKind._tk_sequence
+                    )
+              checkTypePossibility("Array member", t.content_type());
+
+            else if (kind == TCKind._tk_struct || kind == TCKind._tk_union)
+              {
+                for (int i = 0; i < t.member_count(); i++)
+                  {
+                    checkTypePossibility(t.member_name(i), t.member_type(i));
+                  }
+              }
+          }
+        catch (UserException ex)
+          {
+            InternalError ierr = new InternalError();
+            ierr.initCause(ex);
+            throw ierr;
+          }
+      }
+  }
+
+  /**
+   * Create the CDR input stream for reading the given byte array.
+   *
+   * @param them a byte array to read.
+   *
+   * @return the stream.
+   */
+  private BufferredCdrInput createInput(byte[] them)
+  {
+    BufferredCdrInput input = new BufferredCdrInput(them);
+    input.setOrb(orb);
+    input.setVersion(version);
+    return input;
+  }
+
+  /**
+   * Check if the Codec writes the length indicator.
+   */
+  public boolean hasLengthIndicator()
+  {
+    return lengthIndicator;
+  }
+
+  /**
+   * Sets if the Codec must write the record length in the beginning of the
+   * array. Encodings both with and without that indicator are understood
+   * both by Suns and this codec, but the OMG specification seems requiring
+   * it. The default behavior is to use the length indicator.
+   *
+   * @param use_lengthIndicator
+   */
+  public void setUseLengthIndicator(boolean use_lengthIndicator)
+  {
+    lengthIndicator = use_lengthIndicator;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Connected_objects.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Connected_objects.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Connected_objects.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Connected_objects.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,245 @@
+/* Connected_objects.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.CORBA;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * The repository of objects, that have been connected to the
+ * {@link FunctionalORB} by the method
+ * {@link ORB.connect(org.omg.CORBA.Object)}.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class Connected_objects
+{
+  /**
+   * The reference data about the connected object.
+   */
+  public class cObject
+  {
+    /**
+     * Create an initialised instance.
+     */
+    cObject(org.omg.CORBA.Object _object, int _port, byte[] _key,
+            java.lang.Object an_identity
+           )
+    {
+      object = _object;
+      port = _port;
+      key = _key;
+      identity = an_identity;
+    }
+
+    /**
+     * The object.
+     */
+    public final org.omg.CORBA.Object object;
+
+    /**
+     * The port on that the object is connected.
+     */
+    public final int port;
+
+    /**
+     * The object key.
+     */
+    public final byte[] key;
+
+    /**
+     * The shared serving identity (usually POA) or null if no such
+     * applicable.
+     */
+    public final java.lang.Object identity;
+  }
+
+  /**
+   * The free number to give for the next instance.
+   * This field is incremented each time the
+   * new collection of the connected objects is created.
+   * Each collection has its own unique instance number.
+   */
+  private static long free_object_number;
+
+  /**
+   * The map of the all connected objects, maps the object key to the
+   * object.
+   */
+  private Map objects = new TreeMap(new ByteArrayComparator());
+
+  /**
+   * Get the record of the stored object.
+   *
+   * @param object the stored object
+   *
+   * @return the record about the stored object, null if
+   * this object is not stored here.
+   */
+  public cObject getKey(org.omg.CORBA.Object stored_object)
+  {
+    synchronized (objects)
+      {
+        Map.Entry item;
+        Iterator iter = objects.entrySet().iterator();
+        cObject ref;
+
+        while (iter.hasNext())
+          {
+            item = (Map.Entry) iter.next();
+            ref = (cObject) item.getValue();
+            if (stored_object.equals(ref.object) ||
+                stored_object._is_equivalent(ref.object)
+               )
+              return ref;
+          }
+      }
+
+    return null;
+  }
+
+  /**
+   * Add the new object to the repository. The object key is
+   * generated automatically.
+   *
+   * @param object the object to add.
+   * @param port, on that the ORB will be listening to the remote
+   * invocations.
+   *
+   * @return the newly created object record.
+   */
+  public cObject add(org.omg.CORBA.Object object, int port)
+  {
+    return add(generateObjectKey(object), object, port, null);
+  }
+
+  /**
+   * Add the new object to the repository.
+   *
+   * @param key the object key.
+   * @param object the object to add.
+   * @param port the port, on that the ORB will be listening on the
+   * remote invocations.
+   */
+  public cObject add(byte[] key, org.omg.CORBA.Object object, int port,
+                     java.lang.Object identity
+                    )
+  {
+    cObject rec = new cObject(object, port, key, identity);
+    synchronized (objects)
+      {
+        objects.put(key, rec);
+      }
+    return rec;
+  }
+
+  /**
+   * Get the stored object.
+   *
+   * @param key the key (in the byte array form).
+   *
+   * @return the matching object, null if none is matching.
+   */
+  public cObject get(byte[] key)
+  {
+    synchronized (objects)
+      {
+        return (cObject) objects.get(key);
+      }
+  }
+
+  /**
+   * Get the map entry set.
+   */
+  public Set entrySet()
+  {
+    return objects.entrySet();
+  }
+
+  /**
+   * Remove the given object.
+   *
+   * @param object the object to remove.
+   */
+  public void remove(org.omg.CORBA.Object object)
+  {
+    synchronized (objects)
+      {
+        cObject ref = getKey(object);
+        if (ref != null)
+          objects.remove(ref.key);
+      }
+  }
+
+  /**
+   * Remove the given object, indiciating it by the key.
+   *
+   * @param object the object to remove.
+   */
+  public void remove(byte[] key)
+  {
+    objects.remove(key);
+  }
+
+  /**
+   * Generate the object key, unique in the currently
+   * running java virtual machine.
+   *
+   * The generated key includes the object class name
+   * and the absolute instance number.
+   *
+   * @return the generated key.
+   */
+  protected byte[] generateObjectKey(org.omg.CORBA.Object object)
+  {
+    return (object.getClass().getName() + ":" + getFreeInstanceNumber()).getBytes();
+  }
+
+  /**
+   * Get next free instance number.
+   */
+  private static synchronized long getFreeInstanceNumber()
+  {
+    long instance_number = free_object_number;
+    free_object_number++;
+    return instance_number;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CorbaList.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CorbaList.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CorbaList.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/CorbaList.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,115 @@
+/* CorbaList.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.CORBA;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+
+import org.omg.CORBA.Bounds;
+
+/**
+ * This class is used to store array lists. Differently from
+ * the java.util lists,
+ * it throws {@link org.omg.CORBA.Bounds} rather than
+ * {@link IndexOutOfBoundsException}.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class CorbaList
+  extends ArrayList
+  implements Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * Creates the list with the given initial size.
+   */
+  public CorbaList(int initial_size)
+  {
+    super(initial_size);
+  }
+
+  /**
+   * Creates the list with the default size.
+   */
+  public CorbaList()
+  {
+  }
+
+  /**
+   * Remove the item at the given index.
+   * @param at the index
+   * @throws org.omg.CORBA.Bounds if the index is out of bounds.
+   */
+  public void drop(int at)
+            throws Bounds
+  {
+    try
+      {
+        super.remove(at);
+      }
+    catch (IndexOutOfBoundsException ex)
+      {
+        throw new Bounds("[" + at + "], valid [0.." + size() + "]");
+      }
+  }
+
+  /**
+   * Get the item at the given index.
+   * @param at the index
+   * @return the item at the index
+   * @throws org.omg.CORBA.Bounds if the index is out of bounds.
+   */
+  public Object item(int at)
+              throws Bounds
+  {
+    try
+      {
+        return super.get(at);
+      }
+    catch (IndexOutOfBoundsException ex)
+      {
+        throw new Bounds("[" + at + "], valid [0.." + size() + "]");
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* DefaultSocketFactory.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.CORBA;
+
+import gnu.CORBA.interfaces.SocketFactory;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * The default socket factory that forges "plain" server and client sockets. The
+ * class can be replaced by setting the gnu.CORBA.SocketFactory property.
+ * 
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class DefaultSocketFactory
+  implements SocketFactory
+{
+  /**
+   * It is enough to have one instance of this class for all ORBs.
+   */
+  public static final DefaultSocketFactory Singleton = new DefaultSocketFactory();
+
+  /**
+   * Create a client socket.
+   */
+  public Socket createClientSocket(String host, int port)
+    throws IOException
+  {
+    return new Socket(host, port);
+  }
+
+  /**
+   * Create a server socket.
+   */
+  public ServerSocket createServerSocket(int port)
+    throws IOException
+  {
+    return new ServerSocket(port);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefinitionKindHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefinitionKindHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefinitionKindHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DefinitionKindHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,91 @@
+/* DefinitionKindHolder.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.CORBA;
+
+import org.omg.CORBA.DefinitionKind;
+import org.omg.CORBA.DefinitionKindHelper;
+
+
+/**
+ * The definition kind holder. This class is not included in the original
+ * API specification, so we place it outside the org.omg namespace.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class DefinitionKindHolder
+  implements org.omg.CORBA.portable.Streamable
+{
+  /**
+   * The stored value.
+   */
+  public DefinitionKind value;
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue
+   */
+  public DefinitionKindHolder(DefinitionKind initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Read from the CDR stream.
+   */
+  public void _read(org.omg.CORBA.portable.InputStream in)
+  {
+    value = DefinitionKindHelper.read(in);
+  }
+
+  /**
+   * Get the typecode.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return DefinitionKindHelper.type();
+  }
+
+  /**
+   * Write into the CDR stream.
+   */
+  public void _write(org.omg.CORBA.portable.OutputStream out)
+  {
+    DefinitionKindHelper.write(out, value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DuplicateNameHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DuplicateNameHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DuplicateNameHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DuplicateNameHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,106 @@
+/* DuplicateNameHolder.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.CORBA;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateNameHelper;
+
+/**
+* A holder for the exception {@link DuplicateName}.
+
+* @author Audrius Meskauskas, Lithiania (AudriusA at Bioinformatics.org)
+*/
+public class DuplicateNameHolder
+  implements Streamable
+{
+  /**
+   * The stored DuplicateName value.
+   */
+  public DuplicateName value;
+
+  /**
+   * Create the unitialised instance, leaving the value field
+   * with default <code>null</code> value.
+   */
+  public DuplicateNameHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the value that will be assigned to
+   * the <code>value</code> field.
+   */
+  public DuplicateNameHolder(DuplicateName initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Fill in the {@link value} by data from the CDR stream.
+   *
+   * @param input the org.omg.CORBA.portable stream to read.
+   */
+  public void _read(InputStream input)
+  {
+    value = DuplicateNameHelper.read(input);
+  }
+
+  /**
+   * Write the stored value into the CDR stream.
+   *
+   * @param output the org.omg.CORBA.portable stream to write.
+   */
+  public void _write(OutputStream output)
+  {
+    DuplicateNameHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the DuplicateName.
+   */
+  public TypeCode _type()
+  {
+    return DuplicateNameHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,177 @@
+/* AbstractAny.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.CORBA.DynAn;
+
+import gnu.CORBA.TypeKindNamer;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+
+import java.io.Serializable;
+
+/**
+ * The top of our DynAny implementation, this class provides ORB that is
+ * required to create anys and factory that is required to initialise DynAnys.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class AbstractAny
+  extends LocalObject
+  implements Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The "initial final_type" that can be an alias of the known final_type.
+   */
+  public TypeCode official_type;
+
+  /**
+   * The "basic" final_type to that the final_type finally evaluates.
+   */
+  public final TypeCode final_type;
+
+  /**
+   * The DynAny factory, required in initializations.
+   */
+  public final gnuDynAnyFactory factory;
+
+  /**
+   * The ORB, to that this DynAny belongs.
+   */
+  public final ORB orb;
+
+  /**
+   * The minor code, indicating the error, related to work with non - GNU
+   * Classpath DynAny.
+   */
+  short MINOR = 8148;
+
+  /**
+   * The message about the empty structure or exception.
+   */
+  static final String EMPTY = "Empty structure with no fields.";
+
+  /**
+   * The message about the structure or exception size mismatch.
+   */
+  static final String SIZE = "Size mismatch.";
+
+  /**
+   * The message about the content of this DynAny being equal to
+   * <code>null</code>
+   */
+  static final String ISNULL = "The content is null";
+
+  /**
+   * The change value listener.
+   */
+  ValueChangeListener listener;
+
+  /**
+   * Create the abstract dyn any.
+   */
+  public AbstractAny(TypeCode oType, TypeCode aType,
+                        gnuDynAnyFactory aFactory, ORB anOrb
+                       )
+  {
+    official_type = oType;
+    final_type = aType;
+    factory = aFactory;
+    orb = anOrb;
+  }
+
+  /**
+   * Get the typecode.
+   */
+  public TypeCode type()
+  {
+    return official_type;
+  }
+
+  /**
+   * Create the Any.
+   */
+  public Any createAny()
+  {
+    return orb.create_any();
+  }
+
+  /**
+   * The "value changed" listener.
+   */
+  protected void valueChanged()
+  {
+    if (listener != null)
+      listener.changed();
+  }
+
+  /**
+   * Check the type.
+   */
+  void checkType(TypeCode expected, TypeCode actual)
+          throws TypeMismatch
+  {
+    if (!expected.equal(actual))
+      throw new TypeMismatch(typeMismatch(expected, actual));
+  }
+
+  /**
+   * Format "Type mismatch" string.
+   */
+  String typeMismatch(TypeCode expected, TypeCode actual)
+  {
+    return TypeKindNamer.nameIt(expected) + " expected " +
+           TypeKindNamer.nameIt(actual);
+  }
+
+  /**
+   * Format "size mismatch" string.
+   */
+  String sizeMismatch(int here, int other)
+  {
+    return "Size mismatch, " + other + " (expected " + here + ")";
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,514 @@
+/* DivideableAny.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.CORBA.DynAn;
+
+import gnu.CORBA.TypeKindNamer;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynValueCommon;
+
+import java.io.Serializable;
+
+/**
+ * Provides a base for DynAnys, having multiple components.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class DivideableAny
+  extends AbstractAny
+  implements Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The array of the components that in general case may have different
+   * final_type.
+   */
+  protected DynAny[] array;
+
+  /**
+   * The internal pointer.
+   */
+  protected int pos = 0;
+
+  public DivideableAny(TypeCode oType, TypeCode aType,
+                       gnuDynAnyFactory aFactory, ORB anOrb
+                      )
+  {
+    super(oType, aType, aFactory, anOrb);
+  }
+
+  /**
+   * Advance forward.
+   */
+  public boolean next()
+  {
+    pos++;
+    return array.length > pos;
+  }
+
+  /**
+   * Set zero position.
+   */
+  public void rewind()
+  {
+    pos = 0;
+  }
+
+  /**
+   * Set a position.
+   */
+  public boolean seek(int p)
+  {
+    pos = p;
+    return pos >= 0 && array.length > pos;
+  }
+
+  /**
+   * Get the insertion point as DynAny. This method may throw exceptions if the
+   * current insertion point does not support reading or insertion of the
+   * primitive types.
+   *
+   * @return the focused component, from where the primitve value can be read or
+   * where it can be inserted.
+   * @throws InvalidValue if the primitive value cannot be inserted at the given
+   * point.
+   */
+  protected DynAny focused()
+                    throws InvalidValue, TypeMismatch
+  {
+    if (pos >= 0 && pos < array.length)
+      {
+        if (array [ pos ].component_count() == 0)
+          return array [ pos ];
+        else
+          throw new TypeMismatch("Multiple coponents at " + pos);
+      }
+    else
+      throw new InvalidValue("Out of bounds at " + pos + " valid 0.." +
+                             (array.length - 1)
+                            );
+  }
+
+  /** {@inheritDoc} */
+  public int component_count()
+  {
+    return array.length;
+  }
+
+  /**
+   * Return the second (enclosed any) that is stored in the wrapped Any.
+   */
+  public Any get_any()
+              throws TypeMismatch, InvalidValue
+  {
+    return focused().get_any();
+  }
+
+  /** {@inheritDoc} */
+  public boolean get_boolean()
+                      throws TypeMismatch, InvalidValue
+  {
+    return focused().get_boolean();
+  }
+
+  /** {@inheritDoc} */
+  public char get_char()
+                throws TypeMismatch, InvalidValue
+  {
+    return focused().get_char();
+  }
+
+  /** {@inheritDoc} */
+  public double get_double()
+                    throws TypeMismatch, InvalidValue
+  {
+    return focused().get_double();
+  }
+
+  /** {@inheritDoc} */
+  public float get_float()
+                  throws TypeMismatch, InvalidValue
+  {
+    return focused().get_float();
+  }
+
+  /** {@inheritDoc} */
+  public int get_long()
+               throws TypeMismatch, InvalidValue
+  {
+    return focused().get_long();
+  }
+
+  /** {@inheritDoc} */
+  public long get_longlong()
+                    throws TypeMismatch, InvalidValue
+  {
+    return focused().get_longlong();
+  }
+
+  /** {@inheritDoc} */
+  public byte get_octet()
+                 throws TypeMismatch, InvalidValue
+  {
+    return focused().get_octet();
+  }
+
+  /** {@inheritDoc} */
+  public Object get_reference()
+                       throws TypeMismatch, InvalidValue
+  {
+    return focused().get_reference();
+  }
+
+  /** {@inheritDoc} */
+  public short get_short()
+                  throws TypeMismatch, InvalidValue
+  {
+    return focused().get_short();
+  }
+
+  /** {@inheritDoc} */
+  public String get_string()
+                    throws TypeMismatch, InvalidValue
+  {
+    return focused().get_string();
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode get_typecode()
+                        throws TypeMismatch, InvalidValue
+  {
+    return focused().get_typecode();
+  }
+
+  /** {@inheritDoc} */
+  public int get_ulong()
+                throws TypeMismatch, InvalidValue
+  {
+    return focused().get_ulong();
+  }
+
+  /** {@inheritDoc} */
+  public long get_ulonglong()
+                     throws TypeMismatch, InvalidValue
+  {
+    return focused().get_ulonglong();
+  }
+
+  /** {@inheritDoc} */
+  public short get_ushort()
+                   throws TypeMismatch, InvalidValue
+  {
+    return focused().get_ushort();
+  }
+
+  /** {@inheritDoc} */
+  public Serializable get_val()
+                       throws TypeMismatch, InvalidValue
+  {
+    if (pos >= 0 && pos < array.length)
+      {
+        if (array [ pos ] instanceof DynValueCommon)
+          return array [ pos ].get_val();
+        else
+          throw new TypeMismatch();
+      }
+    else
+      throw new InvalidValue("Out of bounds at " + pos + " valid 0.." +
+                             (array.length - 1)
+                            );
+  }
+
+  /** {@inheritDoc} */
+  public char get_wchar()
+                 throws TypeMismatch, InvalidValue
+  {
+    return focused().get_wchar();
+  }
+
+  /** {@inheritDoc} */
+  public String get_wstring()
+                     throws TypeMismatch, InvalidValue
+  {
+    return focused().get_wstring();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_any(Any a_x)
+                  throws TypeMismatch, InvalidValue
+  {
+    focused().insert_any(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_boolean(boolean a_x)
+                      throws InvalidValue, TypeMismatch
+  {
+    focused().insert_boolean(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_char(char a_x)
+                   throws InvalidValue, TypeMismatch
+  {
+    focused().insert_char(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_double(double a_x)
+                     throws InvalidValue, TypeMismatch
+  {
+    focused().insert_double(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_float(float a_x)
+                    throws InvalidValue, TypeMismatch
+  {
+    focused().insert_float(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_long(int a_x)
+                   throws InvalidValue, TypeMismatch
+  {
+    focused().insert_long(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_longlong(long a_x)
+                       throws InvalidValue, TypeMismatch
+  {
+    focused().insert_longlong(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_octet(byte a_x)
+                    throws InvalidValue, TypeMismatch
+  {
+    focused().insert_octet(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_reference(Object a_x)
+                        throws InvalidValue, TypeMismatch
+  {
+    focused().insert_reference(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_short(short a_x)
+                    throws InvalidValue, TypeMismatch
+  {
+    focused().insert_short(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_string(String a_x)
+                     throws InvalidValue, TypeMismatch
+  {
+    focused().insert_string(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_typecode(TypeCode a_x)
+                       throws InvalidValue, TypeMismatch
+  {
+    focused().insert_typecode(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ulong(int a_x)
+                    throws InvalidValue, TypeMismatch
+  {
+    focused().insert_ulong(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ulonglong(long a_x)
+                        throws InvalidValue, TypeMismatch
+  {
+    focused().insert_ulonglong(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ushort(short a_x)
+                     throws InvalidValue, TypeMismatch
+  {
+    focused().insert_ushort(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_val(Serializable a_x)
+                  throws InvalidValue, TypeMismatch
+  {
+    if (pos >= 0 && pos < array.length)
+      {
+        if (array [ pos ] instanceof DynValueCommon)
+          array [ pos ].insert_val(a_x);
+        else
+          throw new TypeMismatch();
+      }
+    else
+      throw new InvalidValue("Out of bounds at " + pos + " valid 0.." +
+                             (array.length - 1)
+                            );
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_wchar(char a_x)
+                    throws InvalidValue, TypeMismatch
+  {
+    focused().insert_wchar(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_wstring(String a_x)
+                      throws InvalidValue, TypeMismatch
+  {
+    focused().insert_wstring(a_x);
+    valueChanged();
+  }
+
+  /** {@inheritDoc} */
+  public DynAny get_dyn_any()
+                     throws TypeMismatch, InvalidValue
+  {
+    return focused().get_dyn_any();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_dyn_any(DynAny insert_it)
+                      throws TypeMismatch, InvalidValue
+  {
+    focused().insert_dyn_any(insert_it);
+  }
+
+  /**
+   * Get current component.
+   *
+   * @return current component or <code>null</code> if the pointer is out of
+   * bounds.
+   */
+  public DynAny current_component()
+                           throws TypeMismatch
+  {
+    if (array.length == 0)
+      throw new TypeMismatch("empty");
+    return (pos >= 0 && pos < array.length) ? array [ pos ] : null;
+  }
+
+  /**
+   * No action, cleanup is done by garbage collector in java.
+   */
+  public void destroy()
+  {
+  }
+
+  /**
+   * Involved in equal(DynAny).
+   */
+  public abstract Any to_any()
+                      throws TypeMismatch;
+
+  /**
+   * Compares with other DynAny for equality. The final_type, array size and
+   * array members must match.
+   */
+  public boolean equal(DynAny other)
+  {
+    try
+      {
+        if (!official_type.equal(other.type()))
+          return false;
+        else if (other instanceof DivideableAny)
+          {
+            DivideableAny x = (DivideableAny) other;
+            if (x.array.length != array.length)
+              return false;
+
+            for (int i = 0; i < array.length; i++)
+              {
+                if (!array [ i ].equal(x.array [ i ]))
+                  return false;
+              }
+            return true;
+          }
+        else if (other == null || other instanceof AbstractAny)
+          return false;
+        else
+          return other.to_any().equal(to_any());
+      }
+    catch (TypeMismatch e)
+      {
+        UNKNOWN u = new UNKNOWN(MINOR, CompletionStatus.COMPLETED_NO);
+        u.initCause(e);
+        throw u;
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/NameValuePairHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,94 @@
+/* NameValuePairHolder.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.CORBA.DynAn;
+
+import org.omg.CORBA.NameValuePair;
+import org.omg.CORBA.NameValuePairHelper;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * The name-value pair holder. The {@link NameValuePair} has no standard holder
+ * defined, but it is needed to store the {@link NameValuePair} into {@link Any}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameValuePairHolder
+  implements Streamable
+{
+  /**
+   * The stored value of the name value pair.
+   */
+  public NameValuePair value;
+
+  public NameValuePairHolder()
+  {
+  }
+
+  public NameValuePairHolder(NameValuePair a_value)
+  {
+    value = a_value;
+  }
+
+  /**
+   * Read the name value pair.
+   */
+  public void _read(InputStream input)
+  {
+    value = NameValuePairHelper.read(input);
+  }
+
+  /**
+   * Return the typecode of the name value pair.
+   */
+  public TypeCode _type()
+  {
+    return NameValuePairHelper.type();
+  }
+
+  /**
+   * Write the name value pair.
+   */
+  public void _write(OutputStream output)
+  {
+    NameValuePairHelper.write(output, value);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,405 @@
+/* RecordAny.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.CORBA.DynAn;
+
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.HolderLocator;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynStruct;
+import org.omg.DynamicAny.DynValueCommonOperations;
+import org.omg.DynamicAny.NameDynAnyPair;
+import org.omg.DynamicAny.NameValuePair;
+
+import java.io.Serializable;
+
+import java.lang.reflect.Field;
+
+/**
+ * A shared base for both dynamic structure an dynamic value final_type.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class RecordAny
+  extends DivideableAny
+  implements DynAny, Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+  String[] fNames;
+
+  /**
+   * Creates the structure with the given typecode.
+   *
+   * @param fields The DynAny's, representing the fields of the structure.
+   */
+  public RecordAny(TypeCode oType, TypeCode aType,
+                        gnuDynAnyFactory aFactory, ORB anOrb
+                       )
+  {
+    super(oType, aType, aFactory, anOrb);
+  }
+
+  /** @inheritDoc */
+  public TCKind current_member_kind()
+                             throws TypeMismatch, InvalidValue
+  {
+    if (array.length == 0)
+      throw new TypeMismatch(EMPTY);
+    try
+      {
+        return final_type.member_type(pos).kind();
+      }
+    catch (BadKind e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+    catch (Bounds e)
+      {
+        InvalidValue t = new InvalidValue();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /** @inheritDoc */
+  public String current_member_name()
+                             throws TypeMismatch, InvalidValue
+  {
+    if (array.length == 0)
+      throw new TypeMismatch(EMPTY);
+    try
+      {
+        return final_type.member_name(pos);
+      }
+    catch (BadKind e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+    catch (Bounds e)
+      {
+        InvalidValue t = new InvalidValue();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /**
+   * Get content of the structure. This method must be defined on a different
+   * name because get_members_as_dyn_any() throws exception only in some of the
+   * supported interfaces.
+   */
+  public NameDynAnyPair[] gnu_get_members_as_dyn_any()
+  {
+    NameDynAnyPair[] r = new NameDynAnyPair[ array.length ];
+    for (int i = 0; i < r.length; i++)
+      {
+        try
+          {
+            r [ i ] = new NameDynAnyPair(fNames [ i ], array [ i ]);
+          }
+        catch (Exception ex)
+          {
+            throw new Unexpected(ex);
+          }
+      }
+    return r;
+  }
+
+  /**
+   * Get content of the structure. This method must be defined on a different
+   * name because get_members_as_dyn_any() throws exception only in some of the
+   * supported interfaces.
+   */
+  public NameValuePair[] gnu_get_members()
+  {
+    NameValuePair[] r = new NameValuePair[ array.length ];
+    for (int i = 0; i < r.length; i++)
+      {
+        try
+          {
+            r [ i ] = new NameValuePair(fNames [ i ], array [ i ].to_any());
+          }
+        catch (Exception ex)
+          {
+            throw new Unexpected(ex);
+          }
+      }
+    return r;
+  }
+
+  /**
+   * Set members from the provided array.
+   */
+  public void set_members_as_dyn_any(NameDynAnyPair[] value)
+                              throws TypeMismatch, InvalidValue
+  {
+    if (value.length != array.length)
+      throw new InvalidValue(sizeMismatch(array.length, value.length));
+
+    for (int i = 0; i < value.length; i++)
+      {
+        DynAny dynAny = value [ i ].value;
+        checkType(dynAny.type(), i);
+        checkName(value [ i ].id, i);
+
+        array [ i ] = dynAny;
+      }
+    pos = 0;
+  }
+
+  /**
+   * Check the name at the given position ("" matches everything).
+   */
+  private void checkName(String xName, int i)
+                  throws TypeMismatch
+  {
+    if (xName.length() > 0 && fNames [ i ].length() > 0)
+      if (!xName.equals(fNames [ i ]))
+        throw new TypeMismatch("Field name mismatch " + xName + " expected " +
+                               fNames [ i ]
+                              );
+  }
+
+  /**
+   * Check the type at the given position.
+   */
+  private void checkType(TypeCode t, int i)
+                  throws TypeMismatch
+  {
+    if (!array [ i ].type().equal(t))
+      throw new TypeMismatch(typeMismatch(array [ i ].type(), t) + " field " +
+                             i
+                            );
+  }
+
+  /**
+   * Set members from the provided array.
+   */
+  public void set_members(NameValuePair[] value)
+                   throws TypeMismatch, InvalidValue
+  {
+    if (value.length != array.length)
+      throw new InvalidValue(sizeMismatch(array.length, value.length));
+
+    for (int i = 0; i < value.length; i++)
+      {
+        Any any = value [ i ].value;
+        checkType(any.type(), i);
+        checkName(value [ i ].id, i);
+
+        array [ i ].from_any(any);
+      }
+    pos = 0;
+  }
+
+  /** @inheritDoc */
+  public void assign(DynAny from)
+              throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+    if (from instanceof DynStruct)
+      {
+        try
+          {
+            set_members_as_dyn_any(((DynStruct) from).get_members_as_dyn_any());
+          }
+        catch (InvalidValue e)
+          {
+            TypeMismatch t = new TypeMismatch("Invalid value");
+            t.initCause(e);
+            throw t;
+          }
+      }
+    else
+      throw new TypeMismatch("Not a DynStruct");
+  }
+
+  /**
+   * Create a copy.
+   */
+  public DynAny copy()
+  {
+    DynAny[] c = new DynAny[ array.length ];
+    for (int i = 0; i < c.length; i++)
+      {
+        c [ i ] = array [ i ].copy();
+      }
+
+    RecordAny d = newInstance(official_type, final_type, factory, orb);
+    d.array = c;
+    return d;
+  }
+
+  /**
+   * Create a new instance when copying.
+   */
+  protected abstract RecordAny newInstance(TypeCode oType, TypeCode aType,
+                                                gnuDynAnyFactory aFactory,
+                                                ORB anOrb
+                                               );
+
+  /**
+   * Done via reflection.
+   */
+  public Any to_any()
+  {
+    try
+      {
+        Streamable sHolder = HolderLocator.createHolder(official_type);
+
+        Class sHolderClass = sHolder.getClass();
+        Field sHolderValue = sHolderClass.getField("value");
+        Class sClass = sHolderValue.getType();
+
+        Object structure = sClass.newInstance();
+        Object member;
+        Any am;
+        Field vread;
+        Field vwrite;
+        Streamable memberHolder;
+
+        for (int i = 0; i < array.length; i++)
+          {
+            am = array [ i ].to_any();
+            memberHolder = am.extract_Streamable();
+            vwrite = structure.getClass().getField(final_type.member_name(i));
+            vread = memberHolder.getClass().getField("value");
+            member = vread.get(memberHolder);
+            vwrite.set(structure, member);
+          }
+
+        Any g = createAny();
+        sHolderValue.set(sHolder, structure);
+        g.insert_Streamable(sHolder);
+        g.type(official_type);
+        return g;
+      }
+    catch (Exception e)
+      {
+        throw new Unexpected(e);
+      }
+  }
+
+  /**
+   * Done via reflection.
+   */
+  public void from_any(Any an_any)
+                throws TypeMismatch, InvalidValue
+  {
+    checkType(official_type, an_any.type());
+    try
+      {
+        Streamable s = an_any.extract_Streamable();
+        if (s == null)
+          {
+            if (this instanceof DynValueCommonOperations)
+              {
+                ((DynValueCommonOperations) this).set_to_null();
+                return;
+              }
+            else
+              throw new InvalidValue(ISNULL);
+          }
+
+        Object structure = s.getClass().getField("value").get(s);
+        if (structure == null && (this instanceof DynValueCommonOperations))
+          {
+            ((DynValueCommonOperations) this).set_to_null();
+            return;
+          }
+
+        Any member;
+        Streamable holder;
+        Object field;
+        TypeCode fType;
+        Field fField;
+
+        for (int i = 0; i < array.length; i++)
+          {
+            fField = structure.getClass().getField(fNames [ i ]);
+            field = fField.get(structure);
+            fType = array [ i ].type();
+            holder = HolderLocator.createHolder(fType);
+
+            member = createAny();
+            holder.getClass().getField("value").set(holder, field);
+            member.insert_Streamable(holder);
+            member.type(fType);
+
+            array [ i ].from_any(member);
+          }
+
+        if (this instanceof DynValueCommonOperations)
+          ((DynValueCommonOperations) this).set_to_value();
+      }
+    catch (InvalidValue v)
+      {
+        throw v;
+      }
+    catch (NoSuchFieldException ex)
+      {
+        TypeMismatch v =
+          new TypeMismatch("holder value does not match typecode");
+        v.initCause(ex);
+        throw v;
+      }
+    catch (Exception ex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(ex);
+        throw t;
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,493 @@
+/* Undivideable.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.CORBA.DynAn;
+
+import java.io.Serializable;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.TypeCode;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+
+/**
+ * Represent DynAny that has no internal components (DynEnum and so on). The
+ * methods, related to internal components, throw exceptions or return agreed
+ * values like null.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class UndivideableAny
+  extends AbstractAny
+  implements Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * Create a new instance with the given typecode.
+   */
+  public UndivideableAny(TypeCode oType, TypeCode aType,
+                         gnuDynAnyFactory aFactory, ORB anOrb)
+  {
+    super(oType, aType, aFactory, anOrb);
+  }
+
+  /**
+   * There are no components.
+   *
+   * @return 0, always.
+   */
+  public int component_count()
+  {
+    return 0;
+  }
+
+  /**
+   * There is no current component.
+   *
+   * @throws TypeMismatch, always.
+   */
+  public DynAny current_component()
+    throws TypeMismatch
+  {
+    throw new TypeMismatch("Not applicable");
+  }
+
+  /**
+   * Returns without action.
+   */
+  public void destroy()
+  {
+  }
+
+  /**
+   * Not in use.
+   */
+  public Any get_any()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public boolean get_boolean()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public char get_char()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public double get_double()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public DynAny get_dyn_any()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public float get_float()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public int get_long()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public long get_longlong()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public byte get_octet()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public Object get_reference()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public short get_short()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public String get_string()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public TypeCode get_typecode()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public int get_ulong()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public long get_ulonglong()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public short get_ushort()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public Serializable get_val()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public char get_wchar()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public String get_wstring()
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_any(Any an_any)
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_boolean(boolean a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_char(char a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_double(double a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_dyn_any(DynAny insert_it)
+    throws TypeMismatch, InvalidValue
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_float(float a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_long(int a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_longlong(long a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_octet(byte a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_reference(Object a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_short(short a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_string(String a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_typecode(TypeCode a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_ulong(int a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_ulonglong(long a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_ushort(short a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_val(Serializable a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_wchar(char a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public void insert_wstring(String a_x)
+    throws InvalidValue, TypeMismatch
+  {
+    throw new TypeMismatch();
+  }
+
+  /**
+   * Not in use.
+   */
+  public boolean next()
+  {
+    return false;
+  }
+
+  /**
+   * Not in use.
+   */
+  public void rewind()
+  {
+  }
+
+  /**
+   * Not in use.
+   */
+  public boolean seek(int p)
+  {
+    return false;
+  }
+
+  /**
+   * Get the typecode of this enumeration.
+   */
+  public TypeCode type()
+  {
+    return official_type;
+  }
+
+  /**
+   * Compares with other DynAny for equality.
+   */
+  public boolean equals(java.lang.Object other)
+  {
+    if (other instanceof DynAny)
+      return equal((DynAny) other);
+    else
+      return false;
+  }
+
+  /**
+   * This depends on an object.
+   */
+  public abstract boolean equal(DynAny other);
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,50 @@
+/* ValueChangeListener.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.CORBA.DynAn;
+
+/**
+ * An interface, able to receive notification about the change of value
+ * of some DynAny.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public interface ValueChangeListener
+{
+  void changed();
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,945 @@
+/* gnuDynAny.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.CORBA.DynAn;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.OctetHolder;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.WCharHolder;
+import gnu.CORBA.WStringHolder;
+import gnu.CORBA.HolderLocator;
+import gnu.CORBA.TypeKindNamer;
+import gnu.CORBA.GeneralHolder;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.AnyHolder;
+import org.omg.CORBA.BooleanHolder;
+import org.omg.CORBA.CharHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.FloatHolder;
+import org.omg.CORBA.IntHolder;
+import org.omg.CORBA.LongHolder;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.ObjectHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodeHolder;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.ValueBaseHolder;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+import java.util.Arrays;
+
+/**
+ * The primitive dynamic Any holds the value basic final_type that cannot be
+ * traversed.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynAny extends AbstractAny implements DynAny, Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The enclosed Streamable, holding the actual value.
+   */
+  protected Streamable holder;
+
+  /**
+   * Create DynAny providing the holder.
+   *
+   * @param a_holder
+   */
+  public gnuDynAny(Streamable aHolder, TypeCode oType, TypeCode aType,
+    gnuDynAnyFactory aFactory, ORB anOrb
+  )
+  {
+    super(oType, aType, aFactory, anOrb);
+    holder = aHolder;
+  }
+
+  /**
+   * Assign the contents of the given {@link DynAny} to this DynAny.
+   *
+   * @param from the source to assign from.
+   */
+  public void assign(DynAny from) throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+
+    if (from instanceof gnuDynAny)
+      holder = ((gnuDynAny) from).holder;
+    else
+      holder = from.to_any().extract_Streamable();
+    valueChanged();
+  }
+
+  /**
+   * Create a copy of this {@link DynAny} via buffer read/write.
+   */
+  public DynAny copy()
+  {
+    if (holder != null)
+      {
+        BufferedCdrOutput buffer = new BufferedCdrOutput();
+        holder._write(buffer);
+
+        gnuDynAny other;
+        try
+          {
+            other =
+              new gnuDynAny((Streamable) (holder.getClass().newInstance()),
+                official_type, final_type, factory, orb
+              );
+          }
+        catch (Exception e)
+          {
+            // Holder must have parameterless constructor.
+            throw new Unexpected(e);
+          }
+        other.holder._read(buffer.create_input_stream());
+        return other;
+      }
+    else
+      {
+        return new gnuDynAny(null, official_type, final_type, factory, orb);
+      }
+  }
+
+  /**
+   * Always returns <code>null</code>.
+   *
+   * @return <code>null</code>, always.
+   */
+  public DynAny current_component() throws TypeMismatch
+  {
+    throw new TypeMismatch("Not applicable for " +
+      TypeKindNamer.nameIt(final_type)
+    );
+  }
+
+  /**
+   * Returns without action, leaving all work to the garbage collector.
+   */
+  public void destroy()
+  {
+  }
+
+  /**
+   * Takes the passed parameter as the enclosed {@link Any} reference.
+   *
+   * @param an_any the {@link Any} that will be used as an enclosed reference.
+   *
+   * @throws TypeMismatch if the final_type of the passed Any is not the same as
+   * the final_type, currently stored in this Any.
+   */
+  public void from_any(Any an_any) throws TypeMismatch, InvalidValue
+  {
+    checkType(official_type, an_any.type());
+
+    Streamable a_holder = an_any.extract_Streamable();
+    if (a_holder == null)
+      {
+        throw new InvalidValue(ISNULL);
+      }
+    else if (a_holder instanceof GeneralHolder)
+      {
+        holder = HolderLocator.createHolder(official_type);
+        if (holder == null)
+          holder = HolderLocator.createHolder(final_type);
+
+        if (holder == null)
+          holder = ((GeneralHolder) a_holder).Clone();
+        else
+          {
+            InputStream in = an_any.create_input_stream();
+            holder._read(in);
+            try
+              {
+                in.close();
+              }
+            catch (IOException ex)
+              {
+                throw new Unexpected(ex);
+              }
+          }
+      }
+    else
+      {
+        try
+          {
+            InputStream in = an_any.create_input_stream();
+            holder = (Streamable) a_holder.getClass().newInstance();
+            holder._read(in);
+            in.close();
+          }
+        catch (Exception ex)
+          {
+            TypeMismatch t = new TypeMismatch();
+            t.initCause(ex);
+            throw t;
+          }
+      }
+    valueChanged();
+  }
+
+  /**
+   * Return the second (enclosed any) that is stored in the wrapped Any.
+   */
+  public Any get_any() throws TypeMismatch
+  {
+    try
+      {
+        return ((AnyHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public boolean get_boolean() throws TypeMismatch
+  {
+    try
+      {
+        return ((BooleanHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public char get_char() throws TypeMismatch
+  {
+    try
+      {
+        return ((CharHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public double get_double() throws TypeMismatch
+  {
+    try
+      {
+        return ((DoubleHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public float get_float() throws TypeMismatch
+  {
+    try
+      {
+        return ((FloatHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public int get_long() throws TypeMismatch
+  {
+    try
+      {
+        return ((IntHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public long get_longlong() throws TypeMismatch
+  {
+    try
+      {
+        return ((LongHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public byte get_octet() throws TypeMismatch
+  {
+    try
+      {
+        return ((OctetHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public Object get_reference() throws TypeMismatch
+  {
+    try
+      {
+        return ((ObjectHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public short get_short() throws TypeMismatch
+  {
+    try
+      {
+        return ((ShortHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public String get_string() throws TypeMismatch
+  {
+    try
+      {
+        return ((StringHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode get_typecode() throws TypeMismatch
+  {
+    try
+      {
+        return ((TypeCodeHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public int get_ulong() throws TypeMismatch
+  {
+    check(TCKind.tk_ulong);
+    return get_long();
+  }
+
+  /** {@inheritDoc} */
+  public long get_ulonglong() throws TypeMismatch
+  {
+    check(TCKind.tk_ulonglong);
+    return get_longlong();
+  }
+
+  /** {@inheritDoc} */
+  public short get_ushort() throws TypeMismatch
+  {
+    check(TCKind.tk_ushort);
+    return get_short();
+  }
+
+  /** {@inheritDoc} */
+  public Serializable get_val() throws TypeMismatch
+  {
+    try
+      {
+        return ((ValueBaseHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public char get_wchar() throws TypeMismatch
+  {
+    try
+      {
+        return ((WCharHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public String get_wstring() throws TypeMismatch
+  {
+    try
+      {
+        return ((WStringHolder) holder).value;
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch m = new TypeMismatch();
+        m.initCause(cex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_any(Any a_x) throws TypeMismatch, InvalidValue
+  {
+    try
+      {
+        if (a_x.type().kind().value() == TCKind._tk_null)
+          ((AnyHolder) holder).value = a_x;
+        else
+          {
+            OutputStream buf = a_x.create_output_stream();
+            buf.write_any(a_x);
+            holder._read(buf.create_input_stream());
+            buf.close();
+          }
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+    catch (MARSHAL m)
+      {
+        InvalidValue v = new InvalidValue();
+        v.initCause(m);
+        throw v;
+      }
+    catch (IOException ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_boolean(boolean a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((BooleanHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_char(char a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((CharHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_double(double a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((DoubleHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_float(float a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((FloatHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_long(int a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((IntHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_longlong(long a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((LongHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_octet(byte a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((OctetHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_reference(Object a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((ObjectHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_short(short a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((ShortHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_string(String a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        if (a_x != null &&
+          final_type.length() > 0 &&
+          a_x.length() > final_type.length()
+        )
+          throw new InvalidValue(a_x.length() + " exceeds bound, " +
+            final_type.length()
+          );
+        ((StringHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+    catch (BadKind e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_typecode(TypeCode a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((TypeCodeHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ulong(int a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((IntHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ulonglong(long a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((LongHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ushort(short a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((ShortHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_val(Serializable a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((ValueBaseHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_wchar(char a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        ((WCharHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_wstring(String a_x) throws InvalidValue, TypeMismatch
+  {
+    try
+      {
+        if (a_x != null &&
+          final_type.length() > 0 &&
+          a_x.length() > type().length()
+        )
+          throw new InvalidValue(a_x.length() + " exceeds bound, " +
+            final_type.length()
+          );
+        ((WStringHolder) holder).value = a_x;
+        valueChanged();
+      }
+    catch (ClassCastException cex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(cex);
+        throw t;
+      }
+    catch (BadKind e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /**
+   * The objects, enclosed inside this class, have only one component (self).
+   *
+   * @return false, always (no other action).
+   */
+  public boolean next()
+  {
+    return false;
+  }
+
+  /**
+   * Returns without action.
+   */
+  public void rewind()
+  {
+  }
+
+  /**
+   * This objects, stored in this wrapper, never have multiple internal
+   * components to seek.
+   *
+   * @return false, always (no other action).
+   */
+  public boolean seek(int p)
+  {
+    return false;
+  }
+
+  /**
+   * Returns the enclosed {@link Any}.
+   *
+   * @return the enclosed {@link Any}.
+   */
+  public Any to_any()
+  {
+    Any a = createAny();
+    a.insert_Streamable(holder);
+    a.type(official_type);
+    return a;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode type()
+  {
+    return official_type;
+  }
+
+  /**
+   * Compute hashcode in a trivial way.
+   */
+  protected int getHashCodeSimple(int maximum)
+  {
+    int h = super.hashCode() / 2;
+    if (h < 0)
+      h = -h;
+    return h % maximum;
+  }
+
+  /**
+   * Inserts Any, contained in the parameter, into Any, contained in this
+   * DynAny.
+   */
+  public void insert_dyn_any(DynAny d) throws TypeMismatch, InvalidValue
+  {
+    check(d.type().kind());
+
+    Any a = d.to_any();
+    holder = a.extract_Streamable();
+    valueChanged();
+  }
+
+  /**
+   * Checks for equality. The DynAnys are equal if the stored Anys are equal.
+   */
+  public boolean equal(DynAny other)
+  {
+    if (other instanceof AbstractAny)
+      {
+        if (other instanceof gnuDynAny)
+          {
+            gnuDynAny x = (gnuDynAny) other;
+
+            if (!x.holder.getClass().equals(holder.getClass()))
+              return false;
+
+            BufferedCdrOutput b1 = new BufferedCdrOutput();
+            x.holder._write(b1);
+
+            BufferedCdrOutput b2 = new BufferedCdrOutput(b1.buffer.size() + 10);
+            holder._write(b2);
+
+            return Arrays.equals(b1.buffer.toByteArray(),
+              b2.buffer.toByteArray()
+            );
+          }
+        else
+          return false;
+      }
+    if (other == null)
+      return false;
+    else if (other.component_count() != component_count() ||
+      !official_type.equal(other.type())
+    )
+      return false;
+    else
+      return other.to_any().equal(to_any());
+  }
+
+  /**
+   * This final_type has no components.
+   *
+   * @return 0, always.
+   */
+  public int component_count()
+  {
+    return 0;
+  }
+
+  public DynAny get_dyn_any() throws TypeMismatch, InvalidValue
+  {
+    return new gnuDynAny(holder, official_type, final_type, factory, orb);
+  }
+
+  private void check(TCKind t) throws TypeMismatch
+  {
+    if (t.value() != final_type.kind().value())
+      throw new TypeMismatch(t.value() + "!=" + final_type.kind().value());
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,356 @@
+/* gnuDynAnyFactory.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.CORBA.DynAn;
+
+import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.HolderLocator;
+import gnu.CORBA.TypeKindNamer;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyFactory;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+import org.omg.DynamicAny.DynArray;
+import org.omg.DynamicAny.DynEnum;
+import org.omg.DynamicAny.DynFixed;
+import org.omg.DynamicAny.DynSequence;
+import org.omg.DynamicAny.DynStruct;
+import org.omg.DynamicAny.DynUnion;
+import org.omg.DynamicAny.DynValue;
+import org.omg.DynamicAny.DynValueBox;
+
+/**
+ * This class is returned by ORB when resolving
+ * initial reference "DynAnyFactory".
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynAnyFactory
+  extends LocalObject
+  implements DynAnyFactory
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The ORB, to that the factory belongs.
+   */
+  final ORB_1_4 orb;
+
+  /**
+   * Create a new factory, specifying the ORB to that the factory belongs.
+   *
+   * @param anOrb
+   */
+  public gnuDynAnyFactory(ORB_1_4 anOrb)
+  {
+    orb = anOrb;
+  }
+
+  /**
+   * Get the orb.
+   */
+  public ORB_1_4 getOrb()
+  {
+    return orb;
+  }
+
+  /**
+   * Create an initialised array.
+   */
+  public DynArray create_array(TypeCode official, TypeCode type)
+  {
+    return new gnuDynArray(official, type, this, orb, true);
+  }
+
+  /**
+   * Create an empty sequence.
+   */
+  public DynSequence create_sequence(TypeCode official, TypeCode type)
+  {
+    return new gnuDynSequence(official, type, this, orb);
+  }
+
+  /**
+   * Create structure.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynStruct create_structure(TypeCode official, TypeCode type)
+  {
+    return new gnuDynStruct(official, type, this, orb);
+  }
+
+  /**
+   * Create union.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynUnion create_union(TypeCode official, TypeCode type)
+  {
+    try
+      {
+        return new gnuDynUnion(official, type, this, orb);
+      }
+    catch (Exception ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+
+  /**
+   * Create value.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynValue create_value(TypeCode official, TypeCode type)
+  {
+    return new gnuDynValue(official, type, this, orb);
+  }
+
+  /**
+   * Create value box.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynValueBox create_value_box(TypeCode official, TypeCode type)
+  {
+    return new gnuDynValueBox(official, type, this, orb);
+  }
+
+  /**
+   * Create enumeration.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynEnum create_enumeration(TypeCode official, TypeCode type)
+  {
+    return new gnuDynEnum(official, type, this, orb);
+  }
+
+  /**
+   * Create fixed.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynFixed create_fixed(TypeCode official, TypeCode type)
+  {
+    return new gnuDynFixed(official, type, this, orb);
+  }
+
+  /**
+   * Create alias.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynAny create_alias(TypeCode official, TypeCode type)
+                      throws InconsistentTypeCode
+  {
+    try
+      {
+        return create_dyn_any_from_type_code(official, type.content_type());
+      }
+    catch (BadKind e)
+      {
+        throw new Unexpected(e);
+      }
+  }
+
+  /**
+   * Create the undivideable DynAny.
+   */
+  public DynAny create_simple(TypeCode official, TypeCode type)
+  {
+    Streamable holder = HolderLocator.createHolder(type);
+    return new gnuDynAny(holder, official, type, this, orb);
+  }
+
+  /**
+   * Create the DynAny from typecode.
+   */
+  public DynAny create_dyn_any_from_type_code(TypeCode type)
+                                       throws InconsistentTypeCode
+  {
+    return create_dyn_any_from_type_code(type, type);
+  }
+
+  /**
+   * Create the DynAny from typecode.
+   *
+   * @param official the type that was originally passed as a parameter by user.
+   * May be alias of some other type.
+   * @param type the type into that the "official type" evaluates during alias
+   * resolving. Initially equal to "official type".
+   */
+  public DynAny create_dyn_any_from_type_code(TypeCode official, TypeCode type)
+                                       throws InconsistentTypeCode
+  {
+    DynAny d;
+    try
+      {
+        switch (type.kind().value())
+          {
+            case TCKind._tk_array :
+              return create_array(official, type);
+
+            case TCKind._tk_sequence :
+              return create_sequence(official, type);
+
+            case TCKind._tk_struct :
+            case TCKind._tk_except :
+              return create_structure(official, type);
+
+            case TCKind._tk_union :
+              return create_union(official, type);
+
+            case TCKind._tk_value :
+              return create_value(official, type);
+
+            case TCKind._tk_value_box :
+              return create_value_box(official, type);
+
+            case TCKind._tk_enum :
+              return create_enumeration(official, type);
+
+            case TCKind._tk_fixed :
+              return create_fixed(official, type);
+
+            case TCKind._tk_alias :
+              return create_alias(official, type);
+
+            case TCKind._tk_null :
+              return new gnuDynAny(null, official, type, this, orb);
+
+            case TCKind._tk_TypeCode :
+              d = create_simple(official, type);
+              d.insert_typecode(orb.get_primitive_tc(TCKind.tk_null));
+              return d;
+
+            case TCKind._tk_any :
+              d = create_simple(official, type);
+
+              Any empty_any = orb.create_any();
+              empty_any.type(orb.get_primitive_tc(TCKind.tk_null));
+              d.insert_any(empty_any);
+              return d;
+
+            case TCKind._tk_wstring :
+              d = create_simple(official, type);
+              d.insert_wstring("");
+              return d;
+
+            case TCKind._tk_string :
+              d = create_simple(official, type);
+              d.insert_string("");
+              return d;
+
+            case TCKind._tk_native :
+            case TCKind._tk_Principal :
+            case TCKind._tk_abstract_interface :
+              throw new InconsistentTypeCode("Following API, the " +
+                                             TypeKindNamer.nameIt(type) +
+                                             " must not be supported."
+                                            );
+
+            default :
+              return create_simple(official, type);
+          }
+      }
+    catch (UserException uex)
+      {
+        InconsistentTypeCode it = new InconsistentTypeCode();
+        it.initCause(uex);
+        throw it;
+      }
+  }
+
+  /**
+   * Create the DynAny using the passed value as template and assign this value.
+   */
+  public DynAny create_dyn_any(Any value)
+                        throws InconsistentTypeCode
+  {
+    DynAny created = create_dyn_any_from_type_code(value.type());
+    try
+      {
+        created.from_any(value);
+      }
+    catch (UserException uex)
+      {
+        InconsistentTypeCode t = new InconsistentTypeCode("Inconsistent Any");
+        t.initCause(uex);
+        throw t;
+      }
+    catch (Exception e)
+      {
+        throw new Unexpected(e);
+      }
+    return created;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,338 @@
+/* gnuDynArray.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.CORBA.DynAn;
+
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.HolderLocator;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynArray;
+
+import java.io.Serializable;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+
+/**
+ * Provides support for dynamic array or sequence, where all members have the
+ * same final_type.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynArray
+  extends DivideableAny
+  implements DynArray, Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The component "official" type (may be alias).
+   */
+  final TypeCode official_components;
+
+  /**
+   * The component "final" type, after resolving any aliases.
+   */
+  final TypeCode final_components;
+
+  /**
+   * Creates new array.
+   *
+   * @param aType the final_type of array.
+   * @param aFactory the factory, used to initialise default values.
+   * @param orb the ORB to that this DynAny belongs.
+   * @param initialise_array if false, the array is not initialised in
+   * constructor.
+   *
+   *
+   * @throws BAD_PARAM if the passed typecode does not provide the length().
+   */
+  public gnuDynArray(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
+                     ORB anOrb, boolean initialise_array
+                    )
+              throws BAD_PARAM
+  {
+    super(oType, aType, aFactory, anOrb);
+
+    try
+      {
+        official_components = final_type.content_type();
+
+        TypeCode component = official_components;
+        while (component.kind().value() == TCKind._tk_alias)
+          component = component.content_type();
+        final_components = component;
+
+        if (initialise_array)
+          {
+            array = new DynAny[ aType.length() ];
+            for (int i = 0; i < array.length; i++)
+              {
+                array [ i ] =
+                  factory.create_dyn_any_from_type_code(official_components);
+              }
+          }
+      }
+    catch (Exception e)
+      {
+        BAD_PARAM bad = new BAD_PARAM("Unable to initialise array");
+        bad.initCause(e);
+        throw bad;
+      }
+  }
+
+  /**
+   * Copy one DynAny into another.
+   */
+  public void assign(DynAny from)
+              throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+    if (from instanceof DynArray && from.component_count() == array.length)
+      {
+        DynArray dyn = (DynArray) from;
+        array = dyn.get_elements_as_dyn_any();
+      }
+    else
+      throw new TypeMismatch();
+  }
+
+  /**
+   * Create a copy.
+   */
+  public DynAny copy()
+  {
+    DynAny[] c = new DynAny[ array.length ];
+    for (int i = 0; i < c.length; i++)
+      {
+        c [ i ] = array [ i ].copy();
+      }
+
+    gnuDynArray d =
+      new gnuDynArray(official_type, final_type, factory, orb, false);
+    d.array = c;
+    return d;
+  }
+
+  /**
+   * Get elements as array of anys.
+   */
+  public Any[] get_elements()
+  {
+    Any[] r = new Any[ array.length ];
+    for (int i = 0; i < r.length; i++)
+      r [ i ] = array [ i ].to_any();
+    return r;
+  }
+
+  /** {@inheritDoc} */
+  public DynAny[] get_elements_as_dyn_any()
+  {
+    DynAny[] a = new DynAny[ array.length ];
+    for (int i = 0; i < a.length; i++)
+      {
+        a [ i ] = array [ i ].copy();
+      }
+    return a;
+  }
+
+  /**
+   * Set elements when array of dyn anys is provided. This method can set nested
+   * data structures as an array components.
+   */
+  public void set_elements_as_dyn_any(DynAny[] value)
+                               throws InvalidValue, TypeMismatch
+  {
+    if (value.length != array.length)
+      throw new InvalidValue(sizeMismatch(array.length, value.length));
+    for (int i = 0; i < value.length; i++)
+      {
+        checkType(official_components, value [ i ].type());
+        array [ i ].assign(value [ i ]);
+      }
+    pos = 0;
+    valueChanged();
+  }
+
+  /**
+   * Set elements when array of ordinary anys is provided.
+   */
+  public void set_elements(Any[] value)
+                    throws InvalidValue, TypeMismatch
+  {
+    if (value.length != array.length)
+      throw new InvalidValue(sizeMismatch(array.length, value.length));
+
+    for (int i = 0; i < value.length; i++)
+      {
+        checkType(official_components, value [ i ].type());
+        try
+          {
+            array [ i ] = factory.create_dyn_any(value [ i ]);
+          }
+        catch (InconsistentTypeCode e)
+          {
+            TypeMismatch t = new TypeMismatch();
+            t.initCause(e);
+            throw t;
+          }
+      }
+    pos = 0;
+    valueChanged();
+  }
+
+  /**
+   * Done via reflection.
+   */
+  public Any to_any()
+  {
+    try
+      {
+        Streamable memberHolder =
+          HolderLocator.createHolder(official_components);
+
+        if (memberHolder == null)
+          memberHolder = HolderLocator.createHolder(final_components);
+
+        Class memberHolderClass = memberHolder.getClass();
+        Class memberClass = memberHolderClass.getField("value").getType();
+
+        Object members = Array.newInstance(memberClass, array.length);
+        Object member;
+        Any am;
+        Field value = memberHolder.getClass().getField("value");
+
+        for (int i = 0; i < array.length; i++)
+          {
+            // Recursive call should support multidimensional arrays.
+            am = array [ i ].to_any();
+            memberHolder = am.extract_Streamable();
+            member = value.get(memberHolder);
+            Array.set(members, i, member);
+          }
+
+        Streamable arrayHolder = HolderLocator.createHolder(official_type);
+        arrayHolder.getClass().getField("value").set(arrayHolder, members);
+
+        Any g = createAny();
+        g.insert_Streamable(arrayHolder);
+        g.type(official_type);
+        return g;
+      }
+    catch (Exception e)
+      {
+        throw new Unexpected(e);
+      }
+  }
+
+  /**
+   * Done via reflection.
+   */
+  public void from_any(Any an_any)
+                throws TypeMismatch, InvalidValue
+  {
+    checkType(official_type, an_any.type());
+    try
+      {
+        Streamable s = an_any.extract_Streamable();
+        Object members = s.getClass().getField("value").get(s);
+
+        checkArrayValid(members);
+
+        Any member;
+        Streamable holder;
+        Class holderClass = null;
+
+        for (int i = 0; i < array.length; i++)
+          {
+            if (holderClass == null)
+              {
+                holder = HolderLocator.createHolder(official_components);
+                if (holder == null)
+                  holder = HolderLocator.createHolder(final_components);
+                holderClass = holder.getClass();
+              }
+            else
+              holder = (Streamable) holderClass.newInstance();
+
+            member = createAny();
+            holder.getClass().getField("value").set(holder,
+                                                    Array.get(members, i)
+                                                   );
+            member.insert_Streamable(holder);
+            member.type(official_components);
+
+            // This may lead to recursion, supporting multidimensional
+            // arrays.
+            array [ i ].from_any(member);
+          }
+      }
+    catch (Exception ex)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(ex);
+        throw t;
+      }
+    valueChanged();
+  }
+
+  /**
+   * Check if array size is valid and (for sequences) resized
+   * if required. Called from from_any.
+   */
+  protected void checkArrayValid(Object members)
+                          throws TypeMismatch, InvalidValue
+  {
+    if (array.length != Array.getLength(members))
+      throw new InvalidValue(sizeMismatch(array.length, Array.getLength(members)));
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,244 @@
+/* gnuDynEnum.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.CORBA.DynAn;
+
+import gnu.CORBA.Unexpected;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynEnum;
+
+import java.io.IOException;
+
+import java.util.Arrays;
+
+/**
+ * Our implementation of dynamic enumeration.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynEnum extends UndivideableAny implements DynEnum
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The valid string values of the enumeration. Most of enumerations are short,
+   * counting 2-5 memebers. With so small number of memebers, it seems not
+   * reasonable to use hashtables.
+   */
+  final String[] values;
+
+  /**
+   * The current value of enum.
+   */
+  int current;
+
+  /**
+   * Create a new dyn enum from the given typecode.
+   */
+  public gnuDynEnum(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
+    ORB anOrb
+  )
+  {
+    super(oType, aType, aFactory, anOrb);
+    try
+      {
+        values = new String[ final_type.member_count() ];
+
+        for (int i = 0; i < values.length; i++)
+          {
+            values [ i ] = final_type.member_name(i);
+          }
+      }
+    catch (Exception e)
+      {
+        throw new BAD_PARAM("Not enum");
+      }
+  }
+
+  /**
+   * Create a clone of the given enum, sharing values and final_type.
+   */
+  public gnuDynEnum(gnuDynEnum from)
+  {
+    super(from.official_type, from.final_type, from.factory, from.orb);
+    values = from.values;
+  }
+
+  /**
+   * Assign the Enum from the passed value. The passed DynAny must hold the
+   * enumeration of exactly the same final_type.
+   */
+  public void assign(DynAny from) throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+    if (!(from instanceof DynEnum))
+      throw new TypeMismatch("Not a DynEnum");
+    try
+      {
+        set_as_ulong(((DynEnum) from).get_as_ulong());
+      }
+    catch (InvalidValue e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /**
+   * Copy this DynEnum.
+   */
+  public DynAny copy()
+  {
+    gnuDynEnum other = new gnuDynEnum(this);
+    other.current = current;
+    return other;
+  }
+
+  /**
+   * Compares for equality.
+   */
+  public boolean equal(DynAny other)
+  {
+    if (other instanceof gnuDynEnum)
+      {
+        gnuDynEnum oe = (gnuDynEnum) other;
+        return current == oe.current &&
+        (oe.values == values || Arrays.equals(values, oe.values));
+      }
+    else if (other instanceof DynEnum)
+      {
+        DynEnum oe = (DynEnum) other;
+        return current == oe.get_as_ulong() && official_type.equal(oe.type());
+      }
+    else
+      return false;
+  }
+
+  /**
+   * Set value from any that must contain enumeration.
+   */
+  public void from_any(Any an_any) throws TypeMismatch, InvalidValue
+  {
+    checkType(official_type, an_any.type());
+    try
+      {
+        InputStream in = an_any.create_input_stream();
+        set_as_ulong(in.read_long());
+        in.close();
+      }
+    catch (MARSHAL eof)
+      {
+        throw new InvalidValue();
+      }
+    catch (IOException ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+
+  /**
+   * Get the value of this enumeration as string.
+   */
+  public String get_as_string()
+  {
+    return values [ current ];
+  }
+
+  /**
+   * Get the value of this enumeration as int.
+   */
+  public int get_as_ulong()
+  {
+    return current;
+  }
+
+  /**
+   * Set the value of this enumeration as string.
+   */
+  public void set_as_string(String value) throws InvalidValue
+  {
+    for (int i = 0; i < values.length; i++)
+      {
+        if (values [ i ].equals(value))
+          {
+            current = i;
+            valueChanged();
+            return;
+          }
+      }
+    throw new InvalidValue(value);
+  }
+
+  /**
+   * Set the value of this enumeration as int.
+   */
+  public void set_as_ulong(int value) throws InvalidValue
+  {
+    if (value < 0 || value >= values.length)
+      throw new InvalidValue(value + " not in [0.." + values.length);
+    else
+      {
+        current = value;
+        valueChanged();
+      }
+  }
+
+  /**
+   * Wrap the enumeration value into any.
+   */
+  public Any to_any()
+  {
+    Any a = createAny();
+    a.insert_long(current);
+    a.type(official_type);
+    return a;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,252 @@
+/* gnuDynFixed.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.CORBA.DynAn;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynFixed;
+import org.omg.DynamicAny.DynFixedOperations;
+
+import java.math.BigDecimal;
+
+/**
+ * Implements DynAny, holding CORBA <code>fixed</code>. This class is derived
+ * from gnuDynEnm to avoid repetetive inclusion of unused DynAny methods.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynFixed extends UndivideableAny implements DynFixed
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The default value, assigned in the new instance.
+   */
+  static final BigDecimal ZERO = new BigDecimal("0.0");
+
+  /**
+   * The content of the dyn fixed, wrapped in this DynAny.
+   */
+  BigDecimal value;
+
+  /**
+   * The number of digits after the decimal point.
+   */
+  final int scale;
+
+  /**
+   * The number of digits.
+   */
+  final int digits;
+
+  /**
+   * Create a new instance of the dyn fixed.
+   */
+  public gnuDynFixed(TypeCode oType, TypeCode aType,
+    gnuDynAnyFactory aFactory, ORB anOrb
+  )
+  {
+    super(oType, aType, aFactory, anOrb);
+    try
+      {
+        digits = final_type.fixed_digits();
+        scale = final_type.fixed_scale();
+      }
+    catch (Exception e)
+      {
+        throw new BAD_PARAM("Not a fixed");
+      }
+    value = ZERO;
+  }
+
+  /**
+   * Clone the current instance.
+   */
+  public gnuDynFixed(gnuDynFixed from)
+  {
+    super(from.official_type, from.final_type, from.factory, from.orb);
+    digits = from.digits;
+    scale = from.scale;
+    value = from.value;
+  }
+
+  /**
+   * Get the value of the wrapped dyn fixed, as string.
+   */
+  public String get_value()
+  {
+    return value.toString();
+  }
+
+  /**
+   * Set the value.
+   */
+  public boolean set_value(String fixed_value)
+    throws TypeMismatch, InvalidValue
+  {
+    // Count the digits till decimal point.
+    int digs = 0;
+    char c;
+    boolean leading0 = true;
+    Digs:
+    for (int i = 0; i < fixed_value.length(); i++)
+      {
+        c = fixed_value.charAt(i);
+        if (Character.isDigit(c))
+          {
+            if (!(c == '0' && leading0))
+              digs++;
+            if (c != '0')
+              leading0 = false;
+          }
+        else if (c == '.')
+          break Digs;
+      }
+    if (digs > (digits - scale))
+      throw new InvalidValue("Too many digits: " + digs + " for " + digits +
+        "." + scale
+      );
+
+    try
+      {
+        value = new BigDecimal(fixed_value);
+      }
+    catch (NumberFormatException ex)
+      {
+        if (fixed_value.trim().length() == 0)
+          throw new InvalidValue("Empty string passed");
+
+        TypeMismatch inva =
+          new TypeMismatch("Not a number: '" + fixed_value + "'");
+        inva.initCause(ex);
+        throw inva;
+      }
+
+    valueChanged();
+    return value.scale() <= scale;
+  }
+
+  /**
+   * Assign the value from another BigDecimal.
+   */
+  public void assign(DynAny from) throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+
+    if (from instanceof gnuDynFixed)
+      {
+        gnuDynFixed other = (gnuDynFixed) from;
+        value = other.value;
+      }
+    else if (from instanceof DynFixedOperations)
+      {
+        value = new BigDecimal(((DynFixedOperations) from).get_value());
+      }
+    else
+      throw new TypeMismatch("Not a DynFixed");
+    valueChanged();
+  }
+
+  /**
+   * Create a copy.
+   */
+  public DynAny copy()
+  {
+    return new gnuDynFixed(this);
+  }
+
+  /**
+   * Compare for equality.
+   */
+  public boolean equal(DynAny other)
+  {
+    if (other instanceof gnuDynFixed)
+      {
+        // Normally, this code would be executed.
+        return value.equals(((gnuDynFixed) other).value);
+      }
+    if (other instanceof DynFixedOperations)
+      {
+        // This may be involved when mixing implementations.
+        return ((DynFixedOperations) other).get_value().equals(get_value());
+      }
+    else
+      return false;
+  }
+
+  /**
+   * Set the value from Any (must hold <code>fixed</code> with the matching
+   * typecode.).
+   */
+  public void from_any(Any an_any) throws TypeMismatch, InvalidValue
+  {
+    try
+      {
+        checkType(official_type, an_any.type());
+
+        value = an_any.extract_fixed();
+        valueChanged();
+      }
+    catch (BAD_OPERATION e)
+      {
+        InvalidValue t = new InvalidValue();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /**
+   * Create and return Any, holding this DynFixed value.
+   */
+  public Any to_any()
+  {
+    Any g = createAny();
+    g.insert_fixed(value, official_type);
+    return g;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynSequence.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynSequence.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynSequence.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynSequence.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,254 @@
+/* gnuDynSequence.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.CORBA.DynAn;
+
+import gnu.CORBA.Unexpected;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynSequence;
+
+import java.io.Serializable;
+
+import java.lang.reflect.*;
+
+public class gnuDynSequence
+  extends gnuDynArray
+  implements DynSequence, Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The bound of the sequence, as defined in typecode.
+   */
+  final int bound;
+
+  /**
+   * Create a new gnuDynSequence with the given typecode.
+   *
+   * @throws BAD_PARAM if the passed typecode is probably not a sequence
+   * typecode.
+   */
+  public gnuDynSequence(TypeCode oType, TypeCode aType,
+                        gnuDynAnyFactory aFactory, ORB anOrb
+                       )
+                 throws BAD_PARAM
+  {
+    super(oType, aType, aFactory, anOrb, false);
+    array = new DynAny[ 0 ];
+    try
+      {
+        bound = final_type.length();
+      }
+    catch (BadKind ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+
+  /**
+   * Get the length of the sequence.
+   */
+  public int get_length()
+  {
+    return array.length;
+  }
+
+  /**
+   * Resize the sequence, preserving components.
+   */
+  public void set_length(int length)
+                  throws InvalidValue
+  {
+    checkBound(length);
+    if (length == array.length)
+      return; // Nothing to do.
+    else if (length < array.length)
+      {
+        // Truncate.
+        DynAny[] d = new DynAny[ length ];
+        for (int i = 0; i < d.length; i++)
+          d [ i ] = array [ i ];
+        array = d;
+      }
+    else
+      {
+        // Expand.
+        DynAny[] d = new DynAny[ length ];
+        for (int i = 0; i < array.length; i++)
+          d [ i ] = array [ i ];
+
+        for (int i = array.length; i < d.length; i++)
+          {
+            try
+              {
+                d [ i ] =
+                  factory.create_dyn_any_from_type_code(official_components);
+              }
+            catch (InconsistentTypeCode e)
+              {
+                throw new Unexpected(e);
+              }
+          }
+        array = d;
+      }
+    valueChanged();
+  }
+
+  /**
+   * Copy one DynAny into another.
+   */
+  public void assign(DynAny from)
+              throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+    if (from instanceof DynSequence)
+      {
+        DynSequence dyn = (DynSequence) from;
+        array = dyn.get_elements_as_dyn_any();
+      }
+    else
+      throw new TypeMismatch();
+  }
+
+  /*
+   * Set the contenst of the sequence, resizing if required.
+   */
+  public void set_elements_as_dyn_any(DynAny[] value)
+                               throws InvalidValue, TypeMismatch
+  {
+    checkBound(value.length);
+    if (array.length != value.length)
+      set_length(value.length);
+
+    for (int i = 0; i < value.length; i++)
+      {
+        checkType(official_components, value [ i ].type());
+        array [ i ].assign(value [ i ]);
+      }
+    valueChanged();
+  }
+
+  /**
+   * Set the elements from array of Any's.
+   */
+  public void set_elements(Any[] value)
+                    throws InvalidValue, TypeMismatch
+  {
+    checkBound(value.length);
+
+    DynAny[] prev = array;
+
+    array = new DynAny[ value.length ];
+    try
+      {
+        super.set_elements(value);
+
+        // valueChanged() is called in super.set_elements(value).
+      }
+
+    // On the problem, value does not change.
+    catch (TypeMismatch ex)
+      {
+        array = prev;
+        throw ex;
+      }
+    catch (InvalidValue ex)
+      {
+        array = prev;
+        throw ex;
+      }
+    catch (RuntimeException rex)
+      {
+        array = prev;
+        throw rex;
+      }
+  }
+
+  /**
+   * Create a copy.
+   */
+  public DynAny copy()
+  {
+    DynAny[] c = new DynAny[ array.length ];
+    for (int i = 0; i < c.length; i++)
+      {
+        c [ i ] = array [ i ].copy();
+      }
+
+    gnuDynSequence d =
+      new gnuDynSequence(official_type, final_type, factory, orb);
+    d.array = c;
+    return d;
+  }
+
+  /**
+   * Check the bound.
+   *
+   * @param x the value to check.
+   */
+  void checkBound(int x)
+           throws InvalidValue
+  {
+    if (bound != 0)
+      if (x < 0 || x > bound)
+        throw new InvalidValue(x + " out of bounds, valid [0.." + bound + "]");
+  }
+
+  /**
+   * Check if array size is valid. Called from from_any.
+   */
+  protected void checkArrayValid(Object members)
+                          throws TypeMismatch, InvalidValue
+  {
+    checkBound(Array.getLength(members));
+    if (get_length() != Array.getLength(members))
+      set_length(Array.getLength(members));
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,109 @@
+/* gnuDynStruct.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.CORBA.DynAn;
+
+import java.io.Serializable;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.DynamicAny.DynStruct;
+import org.omg.DynamicAny.NameDynAnyPair;
+import org.omg.DynamicAny.NameValuePair;
+import gnu.CORBA.Unexpected;
+import org.omg.DynamicAny.DynAny;
+
+/**
+ * Implementation of the DynStruct.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynStruct
+  extends RecordAny
+  implements DynStruct, Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * Create an instance.
+   */
+  public gnuDynStruct(TypeCode oType, TypeCode aType,
+                      gnuDynAnyFactory aFactory, ORB anOrb)
+  {
+    super(oType, aType, aFactory, anOrb);
+
+    // Initialise fields.
+    try
+      {
+        array = new DynAny[ final_type.member_count() ];
+        fNames = new String[ array.length ];
+        for (int i = 0; i < array.length; i++)
+          {
+            array [ i ] =
+              factory.create_dyn_any_from_type_code(final_type.member_type(i));
+            fNames [ i ] = final_type.member_name(i);
+          }
+      }
+    catch (Exception e)
+      {
+        throw new Unexpected(e);
+      }
+  }
+
+  /** @inheritDoc */
+  protected RecordAny newInstance(TypeCode oType, TypeCode aType,
+                                       gnuDynAnyFactory aFactory, ORB anOrb)
+  {
+    return new gnuDynStruct(oType, aType, aFactory, anOrb);
+  }
+
+  /** @inheritDoc */
+  public NameDynAnyPair[] get_members_as_dyn_any()
+  {
+    return super.gnu_get_members_as_dyn_any();
+  }
+
+  /** @inheritDoc */
+  public NameValuePair[] get_members()
+  {
+    return super.gnu_get_members();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,439 @@
+/* gnuDynUnion.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.CORBA.DynAn;
+
+import gnu.CORBA.Unexpected;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynUnion;
+
+import java.io.Serializable;
+
+/**
+ * Implementation of DynUnion.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynUnion
+  extends DivideableAny
+  implements DynUnion, Serializable, ValueChangeListener
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The discrimintor of this union.
+   */
+  DynAny discriminator;
+
+  /**
+   * The message string that occurs several times throwing exception.
+   */
+  static String NOAM = "No active member";
+
+  /**
+   * Create a new instance with the given typecode.
+   *
+   * @param aType the final_type, must be final_type of the union.
+   */
+  public gnuDynUnion(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
+                     ORB anOrb
+                    )
+              throws InconsistentTypeCode
+  {
+    super(oType, aType, aFactory, anOrb);
+    try
+      {
+        discriminator =
+          factory.create_dyn_any_from_type_code(final_type.discriminator_type());
+
+        ((AbstractAny) discriminator).listener = this;
+
+        if (final_type.default_index() >= 0)
+          set_to_default_member();
+        else
+          set_to_no_active_member();
+      }
+    catch (Exception ex)
+      {
+        InconsistentTypeCode inc = new InconsistentTypeCode("discriminator");
+        inc.initCause(ex);
+        throw inc;
+      }
+  }
+
+  /*
+   * (non-Javadoc)
+   *
+   * @see gnu.CORBA.DynAn.DivideableAny#to_any()
+   */
+  public Any to_any()
+  {
+    Any a = createAny();
+    OutputStream ou = a.create_output_stream();
+    discriminator.to_any().write_value(ou);
+    if (array.length == 2)
+      array [ 1 ].to_any().write_value(ou);
+    a.read_value(ou.create_input_stream(), final_type);
+    return a;
+  }
+
+  /**
+   * Assign from another identical structure.
+   */
+  public void assign(DynAny from)
+              throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+    if (!(from instanceof DynUnion))
+      throw new TypeMismatch("DynUnion required");
+    else
+      {
+        try
+          {
+            DynUnion u = (DynUnion) from;
+            discriminator.assign(u.get_discriminator());
+            if (u.has_no_active_member())
+              {
+                if (array.length != 1)
+                  array = new DynAny[] { discriminator };
+              }
+            else
+              {
+                if (array.length != 2)
+                  array = new DynAny[] { discriminator, u.member().copy() };
+                else
+                  array [ 1 ] = u.member().copy();
+              }
+          }
+        catch (InvalidValue e)
+          {
+            throw new Unexpected(e);
+          }
+      }
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public DynAny copy()
+  {
+    try
+      {
+        gnuDynUnion other =
+          new gnuDynUnion(official_type, final_type, factory, orb);
+        other.discriminator = discriminator.copy();
+        ((AbstractAny) other.discriminator).listener = other;
+        if (array.length == 1)
+          {
+            other.array = new DynAny[] { other.discriminator };
+          }
+        else
+          {
+            other.array =
+              new DynAny[] { other.discriminator, array [ 1 ].copy() };
+          }
+        return other;
+      }
+    catch (InconsistentTypeCode ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+
+  /**
+   * Done via reading from stream.
+   */
+  public void from_any(Any an_any)
+                throws TypeMismatch, InvalidValue
+  {
+    checkType(official_type, an_any.type());
+
+    Any adis = createAny();
+    try
+      {
+        InputStream stream = an_any.create_input_stream();
+        adis.read_value(stream, final_type.discriminator_type());
+
+        DynAny nd = factory.create_dyn_any(adis);
+
+        set_discriminator(nd);
+        if (array.length == 2)
+          {
+            // Reusing the same Any <code>adis</code>.
+            adis.read_value(stream, array [ 1 ].type());
+            array [ 1 ].from_any(adis);
+          }
+      }
+    catch (InconsistentTypeCode it)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(it);
+        throw t;
+      }
+    catch (MARSHAL m)
+      {
+        InvalidValue t = new InvalidValue();
+        t.initCause(m);
+        throw t;
+      }
+    catch (BadKind b)
+      {
+        throw new Unexpected(b);
+      }
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public TCKind discriminator_kind()
+  {
+    return discriminator.type().kind();
+  }
+
+  /** @inheritDoc */
+  public DynAny get_discriminator()
+  {
+    return discriminator;
+  }
+
+  /** @inheritDoc */
+  public boolean has_no_active_member()
+  {
+    return array.length == 1;
+  }
+
+  /** @inheritDoc */
+  public TCKind member_kind()
+                     throws InvalidValue
+  {
+    return member().type().kind();
+  }
+
+  /**
+   * Get the name of the current variant of the union.
+   */
+  public String member_name()
+                     throws InvalidValue
+  {
+    if (array.length == 1)
+      throw new InvalidValue(NOAM);
+    try
+      {
+        Any da = discriminator.to_any();
+
+
+        // Get the discriminator variant.
+        Variants:
+        for (int i = 0; i < final_type.member_count(); i++)
+          {
+            if (final_type.member_label(i).equal(da))
+              return final_type.member_name(i);
+          }
+        throw new InvalidValue(NOAM);
+      }
+    catch (Exception e)
+      {
+        InvalidValue t = new InvalidValue("Err");
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /** @inheritDoc */
+  public DynAny member()
+                throws InvalidValue
+  {
+    if (array.length < 2)
+      throw new InvalidValue(NOAM);
+    else
+      return array [ 1 ];
+  }
+
+  /**
+   * Set the union discriminator.
+   */
+  public void set_discriminator(DynAny aDiscriminator)
+                         throws TypeMismatch
+  {
+    try
+      {
+        if (!aDiscriminator.type().equal(final_type.discriminator_type()))
+          throw new TypeMismatch("Wrong discriminator final_type for " +
+                                 final_type.name()
+                                );
+
+        // Seting the same discriminator value again should not change
+        // the fields of the current member.
+        if (!discriminator.equal(aDiscriminator))
+          {
+            discriminator.assign(aDiscriminator);
+            updateMember();
+          }
+        else
+          {
+            pos = array.length == 2 ? 1 : 0;
+          }
+      }
+    catch (Exception e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /**
+   * Set to default member, if one exists.
+   */
+  public void set_to_default_member()
+                             throws TypeMismatch
+  {
+    try
+      {
+        int di = final_type.default_index();
+        if (di < 0)
+          throw new TypeMismatch("Union " + final_type.name() +
+                                 "has no default index"
+                                );
+
+        Any da = final_type.member_label(di);
+        discriminator.from_any(da);
+        updateMember();
+      }
+    catch (TypeMismatch m)
+      {
+        // This one OK.
+        throw m;
+      }
+    catch (Exception e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /** @inheritDoc */
+  public void set_to_no_active_member()
+                               throws TypeMismatch
+  {
+    try
+      {
+        if (final_type.default_index() >= 0)
+          {
+            throw new TypeMismatch("Explicit default case defined.");
+          }
+      }
+    catch (BadKind ex)
+      {
+        // The default index is not set.
+      }
+    array = new DynAny[] { discriminator };
+    valueChanged();
+  }
+
+  /**
+   * Update member, in accordance with discriminator value.
+   */
+  public void updateMember()
+                    throws TypeMismatch
+  {
+    try
+      {
+        Any da = discriminator.to_any();
+
+
+        // Get the discriminator variant.
+        Variants:
+        for (int i = 0; i < final_type.member_count(); i++)
+          {
+            if (final_type.member_label(i).equal(da))
+              {
+                array =
+                  new DynAny[]
+                  {
+                    discriminator,
+                    factory.create_dyn_any_from_type_code(final_type.member_type(i))
+                  };
+                pos = 1;
+                valueChanged();
+                return;
+              }
+          }
+      }
+    catch (Exception e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+
+    // Discrimintator does not point to valid member.
+    array = new DynAny[] { discriminator };
+    pos = 0;
+    valueChanged();
+  }
+
+  /**
+   * Called when the discriminator is changed.
+   */
+  public void changed()
+  {
+    try
+      {
+        updateMember();
+      }
+    catch (TypeMismatch ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,386 @@
+/* gnuDynValue.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.CORBA.DynAn;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.Unexpected;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.VM_TRUNCATABLE;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueFactory;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynStruct;
+import org.omg.DynamicAny.DynValue;
+import org.omg.DynamicAny.DynValueCommon;
+import org.omg.DynamicAny.DynValueOperations;
+import org.omg.DynamicAny.NameDynAnyPair;
+import org.omg.DynamicAny.NameValuePair;
+
+import java.io.Serializable;
+
+/**
+ * Implementation of DynValue.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynValue extends RecordAny implements DynValue,
+  Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * If true, the value of this ValueType is set to null.
+   */
+  boolean isNull;
+
+  /**
+   * Create an instance.
+   */
+  public gnuDynValue(TypeCode oType, TypeCode aType,
+    gnuDynAnyFactory aFactory, ORB anOrb
+  )
+  {
+    super(oType, aType, aFactory, anOrb);
+
+    // Initialise fields. The array of fields also includes all inherited
+    // fields.
+    try
+      {
+        array = new DynAny[ final_type.member_count() ];
+        fNames = new String[ array.length ];
+        for (int i = 0; i < array.length; i++)
+          {
+            array [ i ] =
+              factory.create_dyn_any_from_type_code(final_type.member_type(i));
+            fNames [ i ] = final_type.member_name(i);
+          }
+
+        // Search of inherited members.
+        if (final_type.type_modifier() == VM_TRUNCATABLE.value)
+          {
+            TypeCode parent = final_type.concrete_base_type();
+            DynAny ancestor = factory.create_dyn_any_from_type_code(parent);
+
+            if (ancestor instanceof DynValue)
+              {
+                // Add members of ancestor in front of the curren members.
+                DynValue anc = (DynValue) ancestor;
+                anc.set_to_value();
+
+                NameDynAnyPair[] aar = anc.get_members_as_dyn_any();
+                inheritFields(aar);
+              }
+            else if (ancestor instanceof DynStruct)
+              {
+                // Add members of ancestor in front of the curren members.
+                DynStruct anc = (DynStruct) ancestor;
+                NameDynAnyPair[] aar = anc.get_members_as_dyn_any();
+                inheritFields(aar);
+              }
+            else
+              throw new BAD_PARAM("The parent of " + final_type.id() + ", " +
+                parent.id() + ", is not structure nor value."
+              );
+          }
+      }
+    catch (Exception e)
+      {
+        throw new Unexpected(e);
+      }
+
+    set_to_null();
+  }
+
+  /**
+   * Inherit the provided fields.
+   */
+  private void inheritFields(NameDynAnyPair[] aar)
+  {
+    DynAny[] nArray = new DynAny[ array.length + aar.length ];
+    String[] nNames = new String[ array.length + aar.length ];
+    int p = 0;
+    for (int i = 0; i < aar.length; i++)
+      {
+        nArray [ p ] = aar [ i ].value;
+        nNames [ p ] = aar [ i ].id;
+        p++;
+      }
+
+    for (int i = 0; i < array.length; i++)
+      {
+        nArray [ p ] = array [ i ];
+        nNames [ p ] = fNames [ i ];
+        p++;
+      }
+
+    array = nArray;
+    fNames = nNames;
+  }
+
+  /** @inheritDoc */
+  public TCKind current_member_kind() throws TypeMismatch, InvalidValue
+  {
+    if (isNull)
+      throw new TypeMismatch(ISNULL);
+    else
+      return super.current_member_kind();
+  }
+  ;
+
+  /** @inheritDoc */
+  public String current_member_name() throws TypeMismatch, InvalidValue
+  {
+    if (isNull)
+      throw new TypeMismatch(ISNULL);
+    else
+      return super.current_member_name();
+  }
+  ;
+
+  /** @inheritDoc */
+  public NameDynAnyPair[] get_members_as_dyn_any() throws InvalidValue
+  {
+    if (isNull)
+      throw new InvalidValue(ISNULL);
+    return super.gnu_get_members_as_dyn_any();
+  }
+  ;
+
+  /** @inheritDoc */
+  public NameValuePair[] get_members() throws InvalidValue
+  {
+    if (isNull)
+      throw new InvalidValue(ISNULL);
+    else
+      return super.gnu_get_members();
+  }
+  ;
+
+  /** @inheritDoc */
+  public void set_members_as_dyn_any(NameDynAnyPair[] value)
+    throws TypeMismatch, InvalidValue
+  {
+    super.set_members_as_dyn_any(value);
+    isNull = false;
+  }
+  ;
+
+  /** @inheritDoc */
+  public void set_members(NameValuePair[] value)
+    throws TypeMismatch, InvalidValue
+  {
+    super.set_members(value);
+    isNull = false;
+  }
+  ;
+
+  /** @inheritDoc */
+  public boolean is_null()
+  {
+    return isNull;
+  }
+
+  /** @inheritDoc */
+  public void set_to_null()
+  {
+    isNull = true;
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public void set_to_value()
+  {
+    isNull = false;
+    valueChanged();
+  }
+
+  /**
+   * Create a new instance.
+   */
+  protected RecordAny newInstance(TypeCode oType, TypeCode aType,
+    gnuDynAnyFactory aFactory, ORB anOrb
+  )
+  {
+    gnuDynValue v = new gnuDynValue(oType, aType, aFactory, anOrb);
+    if (isNull)
+      v.set_to_null();
+    else
+      v.set_to_value();
+    return v;
+  }
+
+  /**
+   * Compare for equality, minding null values.
+   */
+  public boolean equal(DynAny other)
+  {
+    if (other instanceof DynValueOperations)
+      {
+        DynValueCommon o = (DynValueCommon) other;
+        if (isNull)
+          return o.is_null() && o.type().equal(official_type);
+        else
+          return !o.is_null() && super.equal(other);
+      }
+    else
+      return false;
+  }
+
+  /**
+   * Get the focused component, throwing exception if the current value is null.
+   */
+  protected DynAny focused() throws InvalidValue, TypeMismatch
+  {
+    if (isNull)
+      throw new TypeMismatch(ISNULL);
+    else
+      return super.focused();
+  }
+
+  /**
+   * Convert into Any.
+   */
+  public Any to_any()
+  {
+    if (isNull)
+      {
+        Any a0 = createAny();
+        a0.type(orb.get_primitive_tc(TCKind.tk_null));
+        return a0;
+      }
+    else
+      {
+        try
+          {
+            ValueFactory factory =
+              ((org.omg.CORBA_2_3.ORB) orb).lookup_value_factory(official_type.id());
+            if (factory == null)
+              {
+                MARSHAL m = new MARSHAL("Factory for " + official_type.id() +
+                " not registered.");
+                m.minor = Minor.Factory;
+                throw m;
+              }
+
+            OutputStream out = orb.create_output_stream();
+
+            for (int i = 0; i < array.length; i++)
+              array [ i ].to_any().write_value(out);
+
+            org.omg.CORBA_2_3.portable.InputStream in =
+              (org.omg.CORBA_2_3.portable.InputStream) out.create_input_stream();
+            Serializable v = factory.read_value(in);
+
+            Any g = createAny();
+            g.type(official_type);
+            g.insert_Value(v, official_type);
+
+            return g;
+          }
+        catch (Exception e)
+          {
+            throw new Unexpected(e);
+          }
+      }
+  }
+
+  /** @inheritDoc */
+  public void assign(DynAny from) throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+
+    if (from instanceof DynValue)
+      {
+        DynValue other = (DynValue) from;
+        if (other.is_null())
+          set_to_null();
+        else
+          {
+            set_to_value();
+            try
+              {
+                DynValueOperations src = (DynValueOperations) from;
+                set_members_as_dyn_any(src.get_members_as_dyn_any());
+              }
+            catch (InvalidValue e)
+              {
+                TypeMismatch t = new TypeMismatch("Invalid value");
+                t.initCause(e);
+                throw t;
+              }
+          }
+      }
+    else
+      throw new TypeMismatch("Not a DynValue");
+  }
+
+  /**
+   * Get the number of components.
+   */
+  public int component_count()
+  {
+    return isNull ? 0 : super.component_count();
+  }
+
+  /** {@inheritDoc} */
+  public Serializable get_val() throws TypeMismatch, InvalidValue
+  {
+    return to_any().extract_Value();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_val(Serializable a_x) throws InvalidValue, TypeMismatch
+  {
+    Any a = to_any();
+    a.insert_Value(a_x);
+    from_any(a);
+    valueChanged();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,389 @@
+/* gnuDynValueBox.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.CORBA.DynAn;
+
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.HolderLocator;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynValueBox;
+import org.omg.DynamicAny.DynValueBoxOperations;
+import org.omg.DynamicAny.DynValueCommon;
+
+import java.io.Serializable;
+
+import java.lang.reflect.Field;
+
+/**
+ * Implementation of the DynValueBox.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuDynValueBox
+  extends DivideableAny
+  implements DynValueBox, Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The final_type of contents of this value box.
+   */
+  final TypeCode content;
+
+  /**
+   * The string for some TypeMismatch exceptions.
+   */
+  String CONTENT = "Box content final_type mismatch";
+
+  /**
+   * Create a new instance of gnuDynValueBox.
+   */
+  public gnuDynValueBox(TypeCode oType, TypeCode aType,
+                        gnuDynAnyFactory aFactory, ORB anOrb
+                       )
+  {
+    super(oType, aType, aFactory, anOrb);
+    try
+      {
+        content = final_type.content_type();
+        array = new DynAny[] { factory.create_dyn_any_from_type_code(content) };
+        set_to_null();
+      }
+    catch (Exception e)
+      {
+        throw new Unexpected(e);
+      }
+  }
+
+  /** @inheritDoc */
+  public void assign(DynAny from)
+              throws TypeMismatch
+  {
+    checkType(official_type, from.type());
+    if (from instanceof DynValueBoxOperations)
+      {
+        DynValueBoxOperations other = (DynValueBoxOperations) from;
+        if (other.is_null())
+          set_to_null();
+        else
+          {
+            DynAny inBox;
+            try
+              {
+                inBox = other.get_boxed_value_as_dyn_any();
+              }
+            catch (InvalidValue e)
+              {
+                TypeMismatch t = new TypeMismatch("Invalid value");
+                t.initCause(e);
+                throw t;
+              }
+            if (!content.equal(inBox.type()))
+              throw new TypeMismatch(CONTENT);
+            array = new DynAny[] { inBox.copy() };
+          }
+      }
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public DynAny copy()
+  {
+    gnuDynValueBox other =
+      new gnuDynValueBox(official_type, final_type, factory, orb);
+    if (is_null())
+      other.set_to_null();
+    else
+      {
+        try
+          {
+            other.array = new DynAny[] { array [ 0 ].copy() };
+          }
+        catch (Exception e)
+          {
+            throw new Unexpected(e);
+          }
+      }
+    return other;
+  }
+
+  /**
+   * Returns null for null value, delegates to super. otherwise.
+   */
+  public DynAny current_component()
+                           throws TypeMismatch
+  {
+    if (is_null())
+      return null;
+    else
+      return super.current_component();
+  }
+
+  /**
+   * Compare for equality, minding null values.
+   */
+  public boolean equal(DynAny other)
+  {
+    if (other instanceof DynValueCommon)
+      {
+        DynValueCommon o = (DynValueCommon) other;
+        if (is_null())
+          return o.is_null() && o.type().equal(official_type);
+        else
+          return !o.is_null() && super.equal(other);
+      }
+    else
+      return false;
+  }
+
+  /** @inheritDoc */
+  public void from_any(Any an_any)
+                throws TypeMismatch, InvalidValue
+  {
+    checkType(official_type, an_any.type());
+    try
+      {
+        if (!an_any.type().content_type().equal(content))
+          throw new InvalidValue(CONTENT);
+      }
+    catch (BadKind e)
+      {
+        TypeMismatch t = new TypeMismatch("Not a box");
+        t.initCause(e);
+        throw t;
+      }
+
+    Serializable s = an_any.extract_Value();
+    if (s == null)
+      set_to_null();
+    else
+      {
+        try
+          {
+            Streamable holder = HolderLocator.createHolder(content);
+            Field v = holder.getClass().getField("value");
+            v.set(holder, s);
+
+            Any cont = createAny();
+            cont.insert_Streamable(holder);
+
+            array = new DynAny[] { factory.create_dyn_any(cont) };
+          }
+        catch (Exception ex)
+          {
+            throw new Unexpected(ex);
+          }
+      }
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public Any get_boxed_value()
+                      throws InvalidValue
+  {
+    try
+      {
+        if (is_null())
+          throw new InvalidValue(ISNULL);
+        else
+          return array [ 0 ].to_any();
+      }
+    catch (Exception e)
+      {
+        InvalidValue t = new InvalidValue();
+        t.initCause(e);
+        throw t;
+      }
+  }
+
+  /** @inheritDoc */
+  public DynAny get_boxed_value_as_dyn_any()
+                                    throws InvalidValue
+  {
+    if (is_null())
+      throw new InvalidValue(ISNULL);
+    else
+      return array [ 0 ].copy();
+  }
+
+  /** {@inheritDoc} */
+  public Serializable get_val()
+                       throws TypeMismatch, InvalidValue
+  {
+    return to_any().extract_Value();
+  }
+
+  /** {@inheritDoc} */
+  public void insert_val(Serializable a_x)
+                  throws InvalidValue, TypeMismatch
+  {
+    Any a = to_any();
+    a.insert_Value(a_x);
+    from_any(a);
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public boolean is_null()
+  {
+    return array.length == 0;
+  }
+
+  /** @inheritDoc */
+  public void set_boxed_value(Any boxIt)
+                       throws TypeMismatch
+  {
+    if (!content.equal(boxIt.type()))
+      throw new TypeMismatch(CONTENT);
+    try
+      {
+        if (is_null())
+          {
+            array = new DynAny[] { factory.create_dyn_any(boxIt) };
+          }
+        else
+          {
+            array [ 0 ].from_any(boxIt);
+          }
+      }
+    catch (Exception e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public void set_boxed_value_as_dyn_any(DynAny boxIt)
+                                  throws TypeMismatch
+  {
+    if (!content.equal(boxIt.type()))
+      throw new TypeMismatch(CONTENT);
+    try
+      {
+        if (is_null())
+          {
+            array = new DynAny[] { boxIt.copy() };
+          }
+        else
+          {
+            array [ 0 ].assign(boxIt);
+          }
+      }
+    catch (Exception e)
+      {
+        TypeMismatch t = new TypeMismatch();
+        t.initCause(e);
+        throw t;
+      }
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public void set_to_null()
+  {
+    array = new DynAny[ 0 ];
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public void set_to_value()
+  {
+    try
+      {
+        if (array.length == 0)
+          {
+            array =
+              new DynAny[] { factory.create_dyn_any_from_type_code(content) };
+          }
+      }
+    catch (InconsistentTypeCode e)
+      {
+        throw new Unexpected(e);
+      }
+    valueChanged();
+  }
+
+  /** @inheritDoc */
+  public Any to_any()
+  {
+    Any a = createAny();
+
+    if (!is_null())
+      {
+        try
+          {
+            Streamable holder;
+            if (array [ 0 ] instanceof gnuDynAny)
+              holder = ((gnuDynAny) array [ 0 ]).holder;
+            else
+              {
+                Any uan = array [ 0 ].to_any();
+                holder = uan.extract_Streamable();
+              }
+
+            Field v = holder.getClass().getField("value");
+            Serializable value = (Serializable) v.get(holder);
+            a.type(official_type);
+            a.insert_Value(value, content);
+          }
+        catch (Exception ex)
+          {
+            throw new Unexpected(ex);
+          }
+      }
+    else
+      a.type(orb.get_primitive_tc(TCKind.tk_null));
+    return a;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAnySeqHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAnySeqHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAnySeqHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/DynAnySeqHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,116 @@
+/* DynAnySeqHolder.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.CORBA;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.DynAny;
+import org.omg.DynamicAny.DynAnySeqHelper;
+
+/**
+ * A holder for the sequence of {@link DynAny}
+ * ({@link DynAnySeq}).
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class DynAnySeqHolder
+  implements Streamable
+{
+  /**
+   * The stored array of <code>DynAny</code>.
+   */
+  public DynAny[] value;
+
+  /**
+   * Create the unitialised instance, leaving the value array
+   * with default <code>null</code> value.
+   */
+  public DynAnySeqHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the array that will be assigned to
+   * the <code>value</code> array.
+   */
+  public DynAnySeqHolder(DynAny[] initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * The method should read this object from the CDR input stream, but
+   * (following the JDK 1.5 API) it does not.
+   *
+   * @param input a org.omg.CORBA.portable stream to read from.
+   *
+   * @specenote Sun throws the same exception.
+   *
+   * @throws MARSHAL always.
+   */
+  public void _read(InputStream input)
+  {
+    value = DynAnySeqHelper.read(input);
+  }
+
+  /**
+   * The method should write this object to the CDR input stream, but
+   * (following the JDK 1.5 API) it does not.
+   *
+   * @param input a org.omg.CORBA.portable stream to read from.
+   *
+   * @specenote Sun throws the same exception.
+   *
+   * @throws MARSHAL always.
+   */
+  public void _write(OutputStream output)
+  {
+    DynAnySeqHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the DynAny.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return DynAnySeqHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,133 @@
+/* EmptyStructHolder.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.CORBA;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.UnknownUserException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * This holder can store any CORBA exception that has no user defined fields.
+ * Only the repository ID is written when the method {@link #_write} is called.
+ * The _read method is not supported for this holder.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class EmptyExceptionHolder
+  implements Streamable
+{
+  /**
+   * The wrapped exception.
+   */
+  public Throwable value;
+
+  /**
+   * The typecode of the wrapped exception.
+   */
+  public TypeCode typecode;
+
+  /**
+   * Create the exception holder, initialised to the given values.
+   *
+   * @param an_exception the wrapped exception.
+   * @param an_id the exception repository id.
+   */
+  public EmptyExceptionHolder(Throwable an_exception, TypeCode a_typecode)
+  {
+    value = an_exception;
+    typecode = a_typecode;
+  }
+
+  /**
+   * Reads the exception from the input stream.
+   *
+   * The value field obtains the value of either the read exception or
+   * the UNKNOWN if the repository ID does not match
+   * the exception from the reachable code.
+   */
+  public void _read(InputStream input)
+  {
+    String id = input.read_string();
+    Object ex = ObjectCreator.Idl2Object(id);
+    if (ex == null)
+      value = new UNKNOWN(id);
+    else
+      value = (Throwable) ex;
+  }
+
+  /**
+   * Return the typecode of the stored exception.
+   *
+   * @return the value, passed as a_typecode in constructor.
+   */
+  public TypeCode _type()
+  {
+    return typecode;
+  }
+
+  /**
+   * Write the exception into the give output stream. Writes the
+   * repository id that is taken from the typecode. This method also
+   * works when no helper class is available.
+   *
+   * @param output a stream to write into.
+   *
+   * @throws BAD_OPERATION if the value for the holder is not set or
+   * the typecode cannot provide repository id.
+   */
+  public void _write(OutputStream output)
+  {
+    try
+      {
+        output.write_string(typecode.id());
+      }
+    catch (Exception ex)
+      {
+        BAD_OPERATION bad = new BAD_OPERATION();
+        bad.minor = Minor.CDR;
+        bad.initCause(ex);
+        throw bad;
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,152 @@
+/* ForwardRequestHelper.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.CORBA;
+
+import gnu.CORBA.Poa.ForwardRequestHolder;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ObjectHelper;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.PortableServer.ForwardRequest;
+
+/**
+ * The helper operations for the exception {@link ForwardRequest}.
+ *
+ * @specnote The helper must be here and not in POA subpackage as it must
+ * be discovered by the {@link ObjectCreator} when reading this remote
+ * exception.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class ForwardRequestHelper
+{
+  /**
+   * Extract the ForwardRequest from given Any.
+   * This method uses the ForwardRequestHolder.
+   *
+   * @throws BAD_OPERATION if the passed Any does not contain ForwardRequest.
+   */
+  public static ForwardRequest extract(Any any)
+  {
+    try
+      {
+        return ((ForwardRequestHolder) any.extract_Streamable()).value;
+      }
+    catch (ClassCastException cex)
+      {
+        BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected");
+        bad.minor = Minor.Any;
+        bad.initCause(cex);
+        throw bad;
+      }
+  }
+
+  /**
+   * Get the ForwardRequest repository id.
+   *
+   * @return "ForwardRequest", always.
+   */
+  public static String id()
+  {
+    return "ForwardRequest";
+  }
+
+  /**
+  * Insert the ForwardRequest into the given Any.
+  * This method uses the ForwardRequestHolder.
+  *
+  * @param any the Any to insert into.
+  * @param that the ForwardRequest to insert.
+  */
+  public static void insert(Any any, ForwardRequest that)
+  {
+    any.insert_Streamable(new ForwardRequestHolder(that));
+  }
+
+  /**
+   * Read the exception from the CDR intput stream.
+   *
+   * @param input a org.omg.CORBA.portable stream to read from.
+   */
+  public static ForwardRequest read(InputStream input)
+  {
+    // Read the exception repository id.
+    String id = input.read_string();
+    ForwardRequest value = new ForwardRequest();
+
+    value.forward_reference = input.read_Object();
+    return value;
+  }
+
+  /**
+   * Create the ForwardRequest typecode (structure,
+   * named "ForwardRequest").
+   * The typecode states that the structure contains the
+   * following fields: forward_reference.
+   */
+  public static TypeCode type()
+  {
+    ORB orb = OrbRestricted.Singleton;
+    StructMember[] members = new StructMember[ 1 ];
+    
+    TypeCode field;
+    
+    field = ObjectHelper.type();
+    members [ 0 ] = new StructMember("forward_reference", field, null);
+    return orb.create_exception_tc(id(), "ForwardRequest", members);
+  }
+
+  /**
+   * Write the exception to the CDR output stream.
+   *
+   * @param output a org.omg.CORBA.portable stream stream to write into.
+   * @param value a value to write.
+   */
+  public static void write(OutputStream output, ForwardRequest value)
+  {
+    // Write the exception repository id.
+    output.write_string(id());
+    output.write_Object(value.forward_reference);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* CancelHeader.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.CORBA.GIOP;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The message header for cancelling the request.
+ *
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public abstract class CancelHeader
+{
+  /**
+   * The Id of request being cancelled.
+   */
+  public int request_id;
+
+  /**
+   * Write the header.
+   *
+   * @param out a stream to write to.
+   */
+  public abstract void read(InputStream input);
+
+  /**
+   * Write the header.
+   *
+   * @param out a stream to write to.
+   */
+  public abstract void write(OutputStream output);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,238 @@
+/* CharSets_OSF.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.CORBA.GIOP;
+
+import java.nio.charset.Charset;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * This class contains the codes, used to identify character sets
+ * in CORBA. These codes are defined in Open Software Foundation (OSF)
+ * code set registry.
+ * 
+ * The name of this class specially sets "OSF" apart if somebody would start
+ * searching Open Software Foundation abbreviation.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class CharSets_OSF
+{
+  public static final int ASCII = 0x00010020;
+  public static final int ISO8859_1 = 0x00010001;
+  public static final int ISO8859_2 = 0x00010002;
+  public static final int ISO8859_3 = 0x00010003;
+  public static final int ISO8859_4 = 0x00010004;
+  public static final int ISO8859_5 = 0x00010005;
+  public static final int ISO8859_6 = 0x00010006;
+  public static final int ISO8859_7 = 0x00010007;
+  public static final int ISO8859_8 = 0x00010008;
+  public static final int ISO8859_9 = 0x00010009;
+  public static final int ISO8859_15_FDIS = 0x0001000F;
+  public static final int UTF8 = 0x05010001;
+  public static final int UTF16 = 0x00010109;
+  public static final int UCS2 = 0x00010100;
+  public static final int Cp1047 = 0x10020417;
+  public static final int Cp1250 = 0x100204E2;
+  public static final int Cp1251 = 0x100204E3;
+  public static final int Cp1252 = 0x100204E4;
+  public static final int Cp1253 = 0x100204E5;
+  public static final int Cp1254 = 0x100204E6;
+  public static final int Cp1255 = 0x100204E7;
+  public static final int Cp1256 = 0x100204E8;
+  public static final int Cp1257 = 0x100204E9;
+  public static final int Cp1363 = 0x10020553;
+  public static final int Cp1363C = 0x10020553;
+  public static final int Cp1381 = 0x10020565;
+  public static final int Cp1383 = 0x10020567;
+  public static final int Cp1386 = 0x1002056A;
+  public static final int Cp33722 = 0x100283BA;
+  public static final int Cp33722C = 0x100283BA;
+  public static final int Cp930 = 0x100203A2;
+  public static final int Cp943 = 0x100203AF;
+  public static final int Cp943C = 0x100203AF;
+  public static final int Cp949 = 0x100203B5;
+  public static final int Cp949C = 0x100203B5;
+  public static final int Cp950 = 0x100203B6;
+  public static final int Cp964 = 0x100203C4;
+  public static final int Cp970 = 0x100203CA;
+  public static final int EUC_JP = 0x00030010;
+  public static final int EUC_KR = 0x0004000A;
+  public static final int EUC_TW = 0x00050010;
+
+  /**
+   * The native character set for the narrow character.
+   */
+  public static final int NATIVE_CHARACTER = ISO8859_1;
+
+  /**
+   * The native character set for the wide character.
+   */
+  public static final int NATIVE_WIDE_CHARACTER = UTF16;
+
+  /**
+   * Table to convert from the code to string name.
+   */
+  private static Hashtable code_to_string;
+
+  /**
+   * Table to convert from the string name to code.
+   */
+  private static Hashtable string_to_code;
+
+  /**
+   * Get the charset code from its name.
+   *
+   * @return the charset code of 0 if not defined.
+   */
+  public static int getCode(String name)
+  {
+    if (string_to_code == null)
+      makeMap();
+
+    Integer code = (Integer) string_to_code.get(name);
+    return code == null ? 0 : code.intValue();
+  }
+
+  /**
+   * Get the charset name from its code.
+   *
+   * @return the code set name or nullfor the unknown code set.
+   */
+  public static String getName(int code)
+  {
+    if (code_to_string == null)
+      makeMap();
+    return (String) code_to_string.get(new Integer(code));
+  }
+
+  /**
+   * Get the list of supported char sets for that the CORBA codes are
+   * also known.
+   */
+  public static int[] getSupportedCharSets()
+  {
+    Set supported_sets = Charset.availableCharsets().keySet();
+    int[] supported = new int[ supported_sets.size() ];
+    Iterator iter = supported_sets.iterator();
+
+    int i = 0;
+    int code;
+    while (iter.hasNext())
+      {
+        code = getCode(iter.next().toString());
+        if (code > 0)
+          supported [ i++ ] = code;
+      }
+
+    // Truncate the unused part.
+    int[] f = new int[ i ];
+    System.arraycopy(supported, 0, f, 0, f.length);
+
+    return f;
+  }
+
+  /**
+   * Create a convertion map.
+   */
+  private static void makeMap()
+  {
+    code_to_string = new Hashtable();
+    string_to_code = new Hashtable();
+
+    // Put standard char sets.
+    put(ASCII, "US-ASCII");
+    put(ISO8859_1, "ISO-8859-1");
+    put(UTF16, "UTF-16");
+
+    // Put other known char sets.
+    put(ISO8859_2, "ISO-8859-2");
+    put(ISO8859_3, "ISO-8859-3");
+    put(ISO8859_4, "ISO-8859-4");
+    put(ISO8859_5, "ISO-8859-5");
+    put(ISO8859_6, "ISO-8859-6");
+    put(ISO8859_7, "ISO-8859-7");
+    put(ISO8859_8, "ISO-8859-8");
+    put(ISO8859_9, "ISO-8859-9");
+
+    put(UTF8, "UTF-8");
+    put(UCS2, "UCS-2");
+
+    put(ISO8859_15_FDIS, "ISO8859-15-FDIS");
+
+    put(Cp1047, "Cp1047");
+    put(Cp1250, "Cp1250");
+    put(Cp1251, "Cp1251");
+    put(Cp1252, "Cp1252");
+    put(Cp1253, "Cp1253");
+    put(Cp1254, "Cp1254");
+    put(Cp1255, "Cp1255");
+    put(Cp1256, "Cp1256");
+    put(Cp1257, "Cp1257");
+    put(Cp1363, "Cp1363");
+    put(Cp1363C, "Cp1363C");
+    put(Cp1381, "Cp1381");
+    put(Cp1383, "Cp1383");
+    put(Cp1386, "Cp1386");
+    put(Cp33722, "Cp33722");
+    put(Cp33722C, "Cp33722C");
+    put(Cp930, "Cp930");
+    put(Cp943, "Cp943");
+    put(Cp943C, "Cp943C");
+    put(Cp949, "Cp949");
+    put(Cp949C, "Cp949C");
+    put(Cp950, "Cp950");
+    put(Cp964, "Cp964");
+    put(Cp970, "Cp970");
+
+    put(EUC_JP, "EUC-JP");
+    put(EUC_KR, "EUC-KR");
+    put(EUC_TW, "EUC-TW");
+  }
+
+  private static void put(int code, String name)
+  {
+    Integer ic = new Integer(code);
+
+    code_to_string.put(ic, name);
+    string_to_code.put(name, ic);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,106 @@
+/* CloseMessage.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.CORBA.GIOP;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.MARSHAL;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * The explicit command to close the connection.
+ *
+ *
+ * The close message consists from the message header only and
+ * is the same for GIOP 1.0, 1.1, 1.2 and 1.3. The CloseMessage
+ * uses the default value from the {@link MessageHeader}.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class CloseMessage
+  extends MessageHeader
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * The singleton close message is typically enough, despite new
+   * instances may be instantiated if the specific version field
+   * value is mandatory.
+   */
+  private static final CloseMessage Singleton = new CloseMessage();
+
+  /**
+   * Create a new error message, setting the message field
+   * to the {@link MESSAGE_CLOSE} and the version number to
+   * the given major and minor values.
+   */
+  public CloseMessage()
+  {
+    message_type = CLOSE_CONNECTION;
+  }
+
+  /**
+   * Send the close message to the given output stream. The method,
+   * however, does not close the socket itself, this must be done
+   * explicitly in the calling code.
+   *
+   * @param socketStream a stream, where the close message is
+   * written.
+   */
+  public static void close(OutputStream socketStream)
+  {
+    try
+      {
+        Singleton.write(socketStream);
+        socketStream.flush();
+      }
+    catch (IOException ex)
+      {
+        MARSHAL m = new MARSHAL("Unable to flush the stream");
+        m.minor = Minor.Header;
+        m.initCause(ex);
+        throw m;
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,224 @@
+/* CodeSet_sctx.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.CORBA.GIOP;
+
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.IOR;
+import gnu.CORBA.IOR.CodeSets_profile;
+
+import java.io.IOException;
+
+/**
+ * The code set service context. This context must be included in all
+ * messages that use wide characters.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class CodeSetServiceContext
+  extends ServiceContext
+{
+  /**
+   * The context code sets id.
+   */
+  public static final int ID = 1;
+
+  /**
+   * The standard component to include in the messages.
+   */
+  public static final CodeSetServiceContext STANDARD = new CodeSetServiceContext();
+
+  /**
+   * The encoding, used to transfer the narrow (1 byte) character data.
+   * The default value is taken from {@link CharSets_OSF#NATIVE_CHARACTER}.
+   */
+  public int char_data = CharSets_OSF.NATIVE_CHARACTER;
+
+  /**
+   * The encoding, used to transfer the wide character data.
+   * The default value is taken from
+   * {@link CharSets_OSF#NATIVE_WIDE_CHARACTER}.
+   */
+  public int wide_char_data = CharSets_OSF.NATIVE_WIDE_CHARACTER;
+
+  /**
+   * Find and return the code set service context in the give
+   * contexts array. Returns {@link #STANDARD} if no code set
+   * context is present.
+   *
+   * @param contexts the array of contexts, can be null.
+   */
+  public static CodeSetServiceContext find(ServiceContext[] contexts)
+  {
+    if (contexts != null)
+      for (int i = 0; i < contexts.length; i++)
+        {
+          if (contexts [ i ] instanceof CodeSetServiceContext)
+            return (CodeSetServiceContext) contexts [ i ];
+        }
+    return STANDARD;
+  }
+
+  /**
+   * Select the suitable encoding that is defined in the provided profile.
+   *
+   * TODO character encoding. Now the encoding can be set, but it is ignored.
+   * If you take this task, scan 'TODO character encoding' for
+   * relevant places.
+   */
+  public static CodeSetServiceContext negotiate(IOR.CodeSets_profile profile)
+  {
+    if (profile.negotiated != null)
+      return profile.negotiated;
+
+    CodeSetServiceContext use = new CodeSetServiceContext();
+
+    use.char_data =
+      negotiate(profile.narrow, STANDARD.char_data, CharSets_OSF.ISO8859_1);
+
+    use.wide_char_data =
+      negotiate(profile.wide, STANDARD.wide_char_data, CharSets_OSF.UTF16);
+
+    profile.negotiated = use;
+
+    return use;
+  }
+
+  /**
+   * Read the context from the given stream. Does not read the
+   * code sets id.
+   */
+  public void readContext(AbstractCdrInput input)
+  {
+    AbstractCdrInput encap = input.read_encapsulation();
+
+    char_data = encap.read_ulong();
+    wide_char_data = encap.read_ulong();
+  }
+
+  /**
+   * Return a string representation.
+   */
+  public String toString()
+  {
+    return " Encoding: narrow " + name(char_data) + ", wide " +
+           name(wide_char_data) + ". ";
+  }
+
+  /**
+   * Write the context to the given stream, including the code
+   * sets id.
+   */
+  public void write(AbstractCdrOutput output)
+  {
+    output.write_ulong(ID);
+
+    AbstractCdrOutput enout = output.createEncapsulation();
+
+    enout.write_long(char_data);
+    enout.write_ulong(wide_char_data);
+
+    try
+      {
+        enout.close();
+      }
+    catch (IOException ex)
+      {
+        InternalError t = new InternalError();
+        t.initCause(ex);
+        throw t;
+      }
+  }
+
+  /**
+   * Negotiate about the character encoding. Prefer our native encoding,
+   * if no, prefer IORs native encoding, if no, find any encoding,
+   * supported by both sides, if no, return the specified final decission.
+   *
+   * @param profile the component profile in IOR.
+   * @param our_native our native encoding
+   * @param final_decission the encoding that must be returned if no
+   * compromise is found.
+   *
+   * @return the resulted encoding.
+   */
+  protected static int negotiate(IOR.CodeSets_profile.CodeSet_component profile,
+                                 int our_native, int final_decission
+                                )
+  {
+    // If our and IORs native sets match, use the native set.
+    if (profile.native_set == our_native)
+      return our_native;
+
+    // If the native sets do not match, but the IOR says it
+    // supports our native set, use our native set.
+    if (profile.conversion != null)
+      for (int i = 0; i < profile.conversion.length; i++)
+        {
+          if (our_native == profile.conversion [ i ])
+            return our_native;
+        }
+
+    // At this point, we suggest to use the IORs native set.
+    int[] allSupported = CharSets_OSF.getSupportedCharSets();
+
+    for (int s = 0; s < allSupported.length; s++)
+      if (allSupported [ s ] == profile.native_set)
+        return profile.native_set;
+
+    // Any compromise left?
+    if (profile.conversion != null)
+      for (int s = 0; s < allSupported.length; s++)
+        for (int i = 0; i < profile.conversion.length; i++)
+          if (allSupported [ s ] == profile.conversion [ i ])
+            return allSupported [ s ];
+
+    // Return the CORBA default char encoding.
+    return final_decission;
+  }
+
+  /**
+   * Conveniency method, used in toString()
+   */
+  private String name(int set)
+  {
+    return "0x" + Integer.toHexString(set) + " (" + CharSets_OSF.getName(set) +
+           ") ";
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,76 @@
+/* ContextHandler.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.CORBA.GIOP;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+
+/**
+ * A header, supporting the service contexts. Such header has a context field
+ * and methods for adding the new contexts.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class ContextHandler
+{
+
+  /**
+   * Empty array, indicating that no service context is available.
+   */
+  protected static final ServiceContext[] NO_CONTEXT = new ServiceContext[0];
+
+  /**
+   * The context data.
+   */
+  public ServiceContext[] service_context = NO_CONTEXT;
+
+  /**
+   * Add service context to this header.
+   *
+   * @param context_to_add context to add.
+   * @param replace if true, the existing context with this ID is replaced.
+   * Otherwise, BAD_INV_ORDER is throwsn.
+   */
+  public void addContext(org.omg.IOP.ServiceContext context_to_add,
+    boolean replace)
+    throws BAD_INV_ORDER
+  {
+    service_context = ServiceContext.add(service_context, context_to_add,
+      replace);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,114 @@
+/* ErrorMessage.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.CORBA.GIOP;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.IOR;
+import gnu.CORBA.Minor;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import java.net.Socket;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+
+/**
+ * The error message is sent in response to the message, encoded
+ * in the unsupported version of the format or otherwise invalid.
+ *
+ * The error message consists from the message header only and
+ * is the same for GIOP 1.0, 1.1, 1.2 and 1.3.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ErrorMessage
+  extends MessageHeader
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * Create a new error message, setting the message field
+   * to the {@link MESSAGE_ERROR} and the version number to
+   * the given major and minor values.
+   */
+  public ErrorMessage(gnu.CORBA.Version msg_version)
+  {
+    version = msg_version;
+    message_type = MESSAGE_ERROR;
+  }
+
+  /**
+   * Send the error message to the given IOR address.
+   *
+   * @param ior the IOR address (host and port, other fields
+   * are not used).
+   * 
+   * @param orb the ORB, sending the error message.
+   */
+  public void send(IOR ior, ORB orb)
+  {
+    try
+      {
+        Socket socket;
+        
+        if (orb instanceof OrbFunctional)
+          socket = ((OrbFunctional) orb).socketFactory.createClientSocket(
+            ior.Internet.host, ior.Internet.port);
+        else
+          socket = new Socket(ior.Internet.host, ior.Internet.port);
+
+        OutputStream socketOutput = socket.getOutputStream();
+        write(socketOutput);
+        socketOutput.close();
+        socket.close();
+      }
+    catch (IOException ex)
+      {
+        MARSHAL t = new MARSHAL();
+        t.minor = Minor.Header;
+        t.initCause(ex);
+        throw t;
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,463 @@
+/* MessageHeader.java -- GIOP message header.
+   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.CORBA.GIOP;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.Version;
+import gnu.CORBA.CDR.BigEndianInputStream;
+import gnu.CORBA.CDR.BigEndianOutputStream;
+import gnu.CORBA.CDR.LittleEndianInputStream;
+import gnu.CORBA.CDR.LittleEndianOutputStream;
+import gnu.CORBA.CDR.AbstractDataInput;
+import gnu.CORBA.CDR.AbstractDataOutput;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.portable.IDLEntity;
+
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.Arrays;
+
+/**
+ * The GIOP message header.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class MessageHeader
+  implements IDLEntity
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * Request message.
+   */
+  public static final byte REQUEST = 0;
+
+  /**
+   * Reply message
+   */
+  public static final byte REPLY = 1;
+
+  /**
+   * Cancel request message.
+   */
+  public static final byte CANCEL_REQUEST = 2;
+
+  /**
+   * Locate request message, used to check the server ability to process
+   * requests for the object reference. This message is also used to get the
+   * address where the object reference should be sent.
+   */
+  public static final byte LOCATE_REQUEST = 3;
+
+  /**
+   * Locate reply message, sent in response to the {@link #LocateRequest}
+   * message.
+   */
+  public static final byte LOCATE_REPLY = 4;
+
+  /**
+   * Instruction to close the connection.
+   */
+  public static final byte CLOSE_CONNECTION = 5;
+
+  /**
+   * Error report.
+   */
+  public static final byte MESSAGE_ERROR = 6;
+
+  /**
+   * The fragment messge, following the previous message that has more fragments
+   * flag set. Added in GIOP 1.1
+   */
+  public static final byte FRAGMENT = 7;
+
+  /**
+   * This must always be "GIOP".
+   */
+  public static final byte[] MAGIC = new byte[] { 'G', 'I', 'O', 'P' };
+
+  /**
+   * The message type names.
+   */
+  protected static String[] types = new String[] { "Request", "Reply",
+    "Cancel", "Locate request", "Locate reply", "Close connection", "Error",
+    "Fragment" };
+
+  /**
+   * The GIOP version. Initialised to 1.0 .
+   */
+  public Version version;
+
+  /**
+   * The flags field, introduced since GIOP 1.1.
+   */
+  public byte flags = 0;
+
+  /**
+   * The message type.
+   */
+  public byte message_type = REQUEST;
+
+  /**
+   * The message size, excluding the message header.
+   */
+  public int message_size = 0;
+
+  /**
+   * Create an empty message header, corresponding version 1.0.
+   */
+  public MessageHeader()
+  {
+    version = new Version(1, 0);
+  }
+
+  /**
+   * Create an empty message header, corresponding the given version.
+   * 
+   * @param major the major message header version.
+   * @param minor the minot message header version.
+   */
+  public MessageHeader(int major, int minor)
+  {
+    version = new Version(major, minor);
+  }
+
+  /**
+   * Checks if the message is encoded in the Big Endian, most significant byte
+   * first.
+   */
+  public boolean isBigEndian()
+  {
+    return (flags & 0x1) == 0;
+  }
+
+  /**
+   * Checks if the message is partial, and more subsequent fragments follow.
+   */
+  public boolean moreFragmentsFollow()
+  {
+    return (flags & 0x2) != 0;
+  }
+
+  /**
+   * Set the encoding to use.
+   * 
+   * @param use_big_endian if true (default), the Big Endian encoding is used.
+   * If false, the Little Endian encoding is used.
+   */
+  public void setBigEndian(boolean use_big_endian)
+  {
+    if (use_big_endian)
+      flags = (byte) (flags & ~1);
+    else
+      flags = (byte) (flags | 1);
+  }
+
+  /**
+   * Get the size of the message header itself. So far, it is always 12 bytes.
+   */
+  public int getHeaderSize()
+  {
+    return 12;
+  }
+
+  /**
+   * Get the message type as string.
+   * 
+   * @param type the message type as int (the field {@link message_type}).
+   * 
+   * @return the message type as string.
+   */
+  public String getTypeString(int type)
+  {
+    try
+      {
+        return types[type];
+      }
+    catch (ArrayIndexOutOfBoundsException ex)
+      {
+        return "unknown type (" + type + ")";
+      }
+  }
+
+  /**
+   * Creates reply header, matching the message header version number.
+   * 
+   * @return one of {@link gnu.CORBA.GIOP.v1_0.ReplyHeader},
+   * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on the version
+   * number in this header.
+   */
+  public ReplyHeader create_reply_header()
+  {
+    if (version.since_inclusive(1, 2))
+      return new gnu.CORBA.GIOP.v1_2.ReplyHeader();
+    else
+      return new gnu.CORBA.GIOP.v1_0.ReplyHeader();
+  }
+
+  /**
+   * Creates request header, matching the message header version number.
+   * 
+   * @return one of {@link gnu.CORBA.GIOP.v1_0.RequestHeader},
+   * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on the version
+   * number in this header.
+   */
+  public RequestHeader create_request_header()
+  {
+    if (version.since_inclusive(1, 2))
+      return new gnu.CORBA.GIOP.v1_2.RequestHeader();
+    else
+      return new gnu.CORBA.GIOP.v1_0.RequestHeader();
+  }
+
+  /**
+   * Create the cancel header, matching the message header version number.
+   */
+  public CancelHeader create_cancel_header()
+  {
+    return new gnu.CORBA.GIOP.v1_0.CancelHeader();
+  }
+
+  /**
+   * Create the error message.
+   */
+  public ErrorMessage create_error_message()
+  {
+    return new ErrorMessage(version);
+  }
+
+  /**
+   * Read the header from the stream.
+   * 
+   * @param istream a stream to read from.
+   * @throws MARSHAL if this is not a GIOP 1.0 header.
+   */
+  public void read(java.io.InputStream istream) 
+    throws MARSHAL, EOFException
+  {
+    try
+      {
+        byte[] xMagic = new byte[MAGIC.length];
+        int r = istream.read(xMagic);
+        int minor;
+        if (! Arrays.equals(xMagic, MAGIC))
+          {
+            StringBuffer b = new StringBuffer();
+            if (r == - 1)
+              {
+                b.append("Immediate EOF");
+                minor = Minor.EOF;
+              }
+            else
+              {
+                minor = Minor.Giop;
+                b.append(r + " bytes: ");
+                for (int i = 0; i < xMagic.length; i++)
+                  {
+                    b.append(Integer.toHexString(xMagic[i] & 0xFF));
+                    b.append(' ');
+                  }
+              }
+            MARSHAL m = new MARSHAL("Not a GIOP message: " + b);
+            m.minor = minor;
+            throw m;
+          }
+
+        version = Version.read_version(istream);
+
+        AbstractDataInput din;
+
+        flags = (byte) istream.read();
+
+        // This checks the bit in the byte we have just received.
+        if (isBigEndian())
+          din = new BigEndianInputStream(istream);
+        else
+          din = new LittleEndianInputStream(istream);
+
+        message_type = (byte) din.read();
+
+        message_size = din.readInt();
+      }
+    catch (IOException ex)
+      {
+        MARSHAL t = new MARSHAL();
+        t.minor = Minor.Header;
+        t.initCause(ex);
+        throw t;
+      }
+  }
+
+  /**
+   * Get the short string summary of the message.
+   * 
+   * @return a short message summary.
+   */
+  public String toString()
+  {
+    return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little")
+      + " endian, " + getTypeString(message_type) + ", " + message_size
+      + " bytes. ";
+  }
+
+  /**
+   * Write the header to stream.
+   * 
+   * @param out a stream to write into.
+   */
+  public void write(java.io.OutputStream out)
+  {
+    try
+      {
+        AbstractDataOutput dout;
+
+        if (isBigEndian())
+          dout = new BigEndianOutputStream(out);
+        else
+          dout = new LittleEndianOutputStream(out);
+
+        // Write magic sequence.
+        dout.write(MAGIC);
+
+        // Write version number.
+        version.write((OutputStream) dout);
+        dout.write(flags);
+        dout.write(message_type);
+        dout.writeInt(message_size);
+      }
+    catch (IOException ex)
+      {
+        MARSHAL t = new MARSHAL(ex.getMessage());
+        t.minor = Minor.Header;
+        t.initCause(ex);
+        throw t;
+      }
+  }
+
+  /**
+   * Read data, followed by the message header. Handle fragmented messages.
+   * 
+   * @param source the data source to read from.
+   * @param service the socket on that the time outs are set. Can be null (no
+   * timeouts are set).
+   * @param to_read the timeout while reading the message.
+   * @param to_pause the timeout for pauses between the message parts.
+   */
+  public byte[] readMessage(InputStream source, Socket service, int to_read,
+    int to_pause)
+  {
+    try
+      {
+        byte[] r = new byte[message_size];
+
+        int n = 0;
+        if (service != null)
+          service.setSoTimeout(to_read);
+
+        reading: while (n < r.length)
+          {
+            n += source.read(r, n, r.length - n);
+          }
+        if (service != null)
+          service.setSoTimeout(to_pause);
+
+        // Read the message remainder if the message is fragmented.
+        if (moreFragmentsFollow())
+          {
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream(
+              2 * r.length);
+            buffer.write(r);
+
+            if (r.length < 10)
+              // Increase the buffer size if the default value (size of the
+              // previous message) is really too small.
+              r = new byte[1024];
+
+            MessageHeader h2 = new MessageHeader();
+
+            do
+              {
+                h2.read(source);
+
+                int dn;
+
+                n = 0;
+                reading: while (n < h2.message_size)
+                  {
+                    dn = source.read(r, 0, h2.message_size - n);
+
+                    if (n == 0 && service != null)
+                      service.setSoTimeout(to_read);
+
+                    if (n == 0 && version.since_inclusive(1, 2))
+                      {
+                        // Skip the four byte request id.
+                        buffer.write(r, 4, dn - 4);
+                      }
+                    else
+                      buffer.write(r, 0, dn);
+                    n = +dn;
+                  }
+
+                if (service != null)
+                  service.setSoTimeout(to_pause);
+              }
+            while (h2.moreFragmentsFollow());
+            return buffer.toByteArray();
+          }
+        else
+          return r;
+      }
+    catch (IOException ioex)
+      {
+        MARSHAL m = new MARSHAL("Unable to read the message continuation.");
+        m.minor = Minor.Header;
+        m.initCause(ioex);
+        throw m;
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,145 @@
+/* ReplyHeader.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.CORBA.GIOP;
+
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+
+/**
+ * The header of the standard reply.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public abstract class ReplyHeader
+  extends ContextHandler
+{
+  /**
+   * Reply status, if no exception occured.
+   */
+  public static final int NO_EXCEPTION = 0;
+
+  /**
+   * Reply status, user exception.
+   */
+  public static final int USER_EXCEPTION = 1;
+
+  /**
+   * Reply status, system exception.
+   */
+  public static final int SYSTEM_EXCEPTION = 2;
+
+  /**
+   * Reply status, if the client ORB must re - send the request to another
+   * destination. The body contains IOR.
+   */
+  public static final int LOCATION_FORWARD = 3;
+
+  /**
+   * Reply status, indicating that the target has permanently changed the
+   * address to the supplied IOR.
+   */
+  public static final int LOCATION_FORWARD_PERM = 4;
+
+  /**
+   * Reply status, indicating, that the ORB requires to resend the object
+   * address in the required addressing mode, contained as the reply body.
+   */
+  public static final int NEEDS_ADDRESSING_MODE = 5;
+
+  /**
+   * The status of this reply, holds one of the reply status constants.
+   */
+  public int reply_status;
+
+  /**
+   * The Id of request into response of which this reply has been sent.
+   */
+  public int request_id;
+
+  /**
+   * Return the message status as a string.
+   */
+  public String getStatusString()
+  {
+    switch (reply_status)
+      {
+        case NO_EXCEPTION:
+          return "ok";
+
+        case USER_EXCEPTION:
+          return "user exception";
+
+        case SYSTEM_EXCEPTION:
+          return "system exception";
+
+        case LOCATION_FORWARD:
+          return "moved";
+
+        default:
+          return null;
+      }
+  }
+
+  /**
+   * Reads the header from the stream.
+   *
+   * @param in a stream to read from.
+   */
+  public abstract void read(AbstractCdrInput in);
+
+  /**
+   * Returns a short string representation.
+   *
+   * @return a string representation.
+   */
+  public String toString()
+  {
+    String status = getStatusString();
+    if (status == null)
+      status = "status " + reply_status;
+    return request_id + ", " + status;
+  }
+
+  /**
+   * Writes the header to the stream.
+   *
+   * @param out a stream to write into.
+   */
+  public abstract void write(AbstractCdrOutput out);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,154 @@
+/* RequestHeader.java -- The GIOP 1.0 request message.
+   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.CORBA.GIOP;
+
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * The GIOP request message.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public abstract class RequestHeader
+  extends ContextHandler
+  implements IDLEntity
+{
+  /**
+   * The currently free request id. This field is incremented each time the new
+   * request header is constructed. To facilitate error detection, the first
+   * free id is equal to 0x01234567 (19088743).
+   */
+  private static int freeId = 0x01234567;
+
+  /**
+   * The operation being invoked (IDL scope name).
+   */
+  public String operation;
+
+  /**
+   * Identifies the object that is the target of the invocation.
+   */
+  public byte[] object_key;
+
+  /**
+   * A value identifying the requesting principal. Initialised into a single
+   * zero byte.
+   *
+   * @deprecated by CORBA 2.2.
+   */
+  public byte[] requesting_principal;
+
+  /**
+   * This is used to associate the reply message with the previous request
+   * message. Initialised each time by the different value, increasing form 1 to
+   * Integer.MAX_VALUE.
+   */
+  public int request_id = getNextId();
+
+  /**
+   * If true, the response from the server is expected.
+   */
+  protected boolean response_expected = true;
+
+  /**
+   * Get next free request id. The value of the free request id starts from
+   * 0x02345678, it is incremented each time this function is called and is
+   * reset to 1 after reaching Integer.MAX_VALUE.
+   *
+   * @return the next free request id.
+   */
+  public static synchronized int getNextId()
+  {
+    int f = freeId;
+    if (freeId == Integer.MAX_VALUE)
+      freeId = 1;
+    else
+      freeId++;
+
+    return f;
+  }
+
+  /**
+   * Set if the sender expects any response to this message.
+   */
+  public abstract void setResponseExpected(boolean expected);
+
+  /**
+   * Return true if response is expected.
+   */
+  public abstract boolean isResponseExpected();
+
+  /**
+   * Converts an byte array into hexadecimal string values. Used in various
+   * toString() methods.
+   */
+  public String bytes(byte[] array)
+  {
+    StringBuffer b = new StringBuffer();
+    for (int i = 0; i < array.length; i++)
+      {
+        b.append(Integer.toHexString(array[i] & 0xFF));
+        b.append(" ");
+      }
+    return b.toString();
+  }
+
+  /**
+   * Reads the header from the stream.
+   *
+   * @param in a stream to read from.
+   */
+  public abstract void read(AbstractCdrInput in);
+
+  /**
+   * Return a string representation.
+   */
+  public abstract String toString();
+
+  /**
+   * Writes the header to the stream.
+   *
+   * @param out a stream to write into.
+   */
+  public abstract void write(AbstractCdrOutput out);
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,301 @@
+/* ServiceContext.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.CORBA.GIOP;
+
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * Contains the ORB service data being passed.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ServiceContext
+  implements IDLEntity
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /* Standard values for the context_id. */
+  public static final int TransactionService = 0;
+
+  /**
+   * Defines code sets, used to encode wide and narrow characters. Required for
+   * messages with data structures, involving wide characters.
+   */
+  public static final int CodeSets = 1;
+
+  public static final int ChainBypassCheck = 2;
+
+  public static final int ChainBypassInfo = 3;
+
+  public static final int LogicalThreadId = 4;
+
+  public static final int BI_DIR_IIOP = 5;
+
+  public static final int SendingContextRunTime = 6;
+
+  public static final int INVOCATION_POLICIES = 7;
+
+  public static final int FORWARDED_IDENTITY = 8;
+
+  /**
+   * Contains exception details if exception being transferred is other than
+   * System or User exception. javax.rmi uses this context to transfer arbitrary
+   * java exceptions as CORBA value types.
+   */
+  public static final int UnknownExceptionInfo = 9;
+
+  public static final int RTCorbaPriority = 10;
+
+  public static final int RTCorbaPriorityRange = 11;
+
+  public static final int FT_GROUP_VERSION = 12;
+
+  public static final int FT_REQUEST = 13;
+
+  public static final int ExceptionDetailMessage = 14;
+
+  public static final int SecurityAttributeService = 15;
+
+  public static final int ActivityService = 16;
+
+  /**
+   * The context id (for instance, 0x1 for code sets context). At the moment of
+   * writing, the OMG defines 16 standard values and provides rules to register
+   * the vendor specific context ids. The range 0-4095 is reserved for the
+   * future standard OMG contexts.
+   */
+  public int context_id;
+
+  /**
+   * The context_data.
+   */
+  public byte[] context_data;
+
+  /**
+   * Crete unitialised instance.
+   */
+  public ServiceContext()
+  {
+  }
+
+  /**
+   * Create from omg context.
+   */
+  public ServiceContext(org.omg.IOP.ServiceContext from)
+  {
+    context_id = from.context_id;
+    context_data = from.context_data;
+  }
+
+  /**
+   * Read the context values from the stream.
+   * 
+   * @param istream a stream to read from.
+   */
+  public static ServiceContext read(AbstractCdrInput istream)
+  {
+    int id = istream.read_ulong();
+
+    switch (id)
+      {
+        case CodeSetServiceContext.ID:
+
+          CodeSetServiceContext codeset = new CodeSetServiceContext();
+          codeset.readContext(istream);
+          return codeset;
+
+        default:
+
+          ServiceContext ctx = new ServiceContext();
+          ctx.context_id = id;
+          ctx.context_data = istream.read_sequence();
+          return ctx;
+      }
+  }
+
+  /**
+   * Read a sequence of contexts from the input stream.
+   */
+  public static ServiceContext[] readSequence(AbstractCdrInput istream)
+  {
+    int size = istream.read_long();
+    ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];
+    for (int i = 0; i < value.length; i++)
+      value[i] = read(istream);
+    return value;
+  }
+
+  /**
+   * Write the context values into the stream.
+   * 
+   * @param ostream a stream to write the data to.
+   */
+  public void write(AbstractCdrOutput ostream)
+  {
+    ostream.write_ulong(context_id);
+    ostream.write_sequence(context_data);
+  }
+
+  /**
+   * Write the sequence of contexts into the input stream.
+   */
+  public static void writeSequence(AbstractCdrOutput ostream, ServiceContext[] value)
+  {
+    ostream.write_long(value.length);
+    for (int i = 0; i < value.length; i++)
+      value[i].write(ostream);
+  }
+
+  /**
+   * Add context to the given array of contexts.
+   */
+  public static void add(org.omg.IOP.ServiceContext[] cx,
+    org.omg.IOP.ServiceContext service_context, boolean replace)
+  {
+    int exists = -1;
+
+    for (int i = 0; i < cx.length; i++)
+      if (cx[i].context_id == service_context.context_id)
+        exists = i;
+
+    if (exists < 0)
+      {
+        // Add context.
+        org.omg.IOP.ServiceContext[] n = new org.omg.IOP.ServiceContext[cx.length + 1];
+        for (int i = 0; i < cx.length; i++)
+          n[i] = cx[i];
+        n[cx.length] = service_context;
+      }
+    else
+      {
+        // Replace context.
+        if (!replace)
+          throw new BAD_INV_ORDER("Repetetive setting of the context "
+            + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
+        else
+          cx[exists] = service_context;
+      }
+  }
+
+  /**
+   * Add context to the given array of contexts.
+   */
+  public static ServiceContext[] add(ServiceContext[] cx,
+    org.omg.IOP.ServiceContext service_context, boolean replace)
+  {
+    int exists = -1;
+
+    for (int i = 0; i < cx.length; i++)
+      if (cx[i].context_id == service_context.context_id)
+        exists = i;
+
+    if (exists < 0)
+      {
+        // Add context.
+        ServiceContext[] n = new ServiceContext[cx.length + 1];
+        for (int i = 0; i < cx.length; i++)
+          n[i] = cx[i];
+        n[cx.length] = new ServiceContext(service_context);
+        return n;
+      }
+    else
+      {
+        // Replace context.
+        if (!replace)
+          throw new BAD_INV_ORDER("Repetetive setting of the context "
+            + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
+        else
+          cx[exists] = new ServiceContext(service_context);
+        return cx;
+      }
+  }
+
+  /**
+   * Find context with the given name in the context array.
+   */
+  public static org.omg.IOP.ServiceContext findContext(int ctx_name,
+    org.omg.IOP.ServiceContext[] cx)
+  {
+    for (int i = 0; i < cx.length; i++)
+      if (cx[i].context_id == ctx_name)
+        return cx[i];
+    throw new BAD_PARAM("No context with id " + ctx_name);
+  }
+
+  /**
+   * Find context with the given name in the context array, converting into
+   * org.omg.IOP.ServiceContext.
+   */
+  public static org.omg.IOP.ServiceContext findContext(int ctx_name,
+    ServiceContext[] cx)
+  {
+    for (int i = 0; i < cx.length; i++)
+      if (cx[i].context_id == ctx_name)
+        return new org.omg.IOP.ServiceContext(ctx_name, cx[i].context_data);
+    throw new BAD_PARAM("No context with id " + ctx_name);
+  }
+
+  /**
+   * Find context with the given name in the context array without conversions.
+   */
+  public static ServiceContext find(int ctx_name, ServiceContext[] cx)
+  {
+    for (int i = 0; i < cx.length; i++)
+      if (cx[i].context_id == ctx_name)
+        return cx[i];
+    return null;
+  }
+
+  /**
+   * Return a string representation.
+   */
+  public String toString()
+  {
+    return "ctx " + context_id + ", size " + context_data.length;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,72 @@
+/* CancelHeader.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.CORBA.GIOP.v1_0;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The message header for cancelling the request.
+ *
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class CancelHeader
+  extends gnu.CORBA.GIOP.CancelHeader
+{
+  /**
+   * Write the header.
+   *
+   * @param out a stream to write to.
+   */
+  public void read(InputStream input)
+  {
+    request_id = input.read_ulong();
+  }
+
+  /**
+   * Write the header.
+   *
+   * @param out a stream to write to.
+   */
+  public void write(OutputStream output)
+  {
+    output.write_ulong(request_id);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,139 @@
+/* ReplyHeader.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.CORBA.GIOP.v1_0;
+
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.GIOP.ServiceContext;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+
+/**
+ * The header of the standard reply.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ReplyHeader
+  extends gnu.CORBA.GIOP.ReplyHeader
+{
+  /**
+   * Return the message status as a string.
+   */
+  public String getStatusString()
+  {
+    switch (reply_status)
+      {
+        case NO_EXCEPTION :
+          return "ok";
+
+        case USER_EXCEPTION :
+          return "user exception";
+
+        case SYSTEM_EXCEPTION :
+          return "system exception";
+
+        case LOCATION_FORWARD :
+          return "moved";
+
+        default :
+          return null;
+      }
+  }
+
+  /**
+   * Get the string representation of all included contexts.
+   */
+  public String contexts()
+  {
+    StringBuffer b = new StringBuffer();
+    for (int i = 0; i < service_context.length; i++)
+      {
+        b.append(service_context [ i ].toString());
+        b.append(' ');
+      }
+    return b.toString();
+  }
+
+  /**
+   * Reads the header from the stream.
+   *
+   * Sets the code set of this stream to
+   * the code set, specfied in the header.
+   *
+   * @param in a stream to read from.
+   */
+
+  public void read(AbstractCdrInput in)
+  {
+    service_context = ServiceContext.readSequence(in);
+    request_id = in.read_ulong();
+    reply_status = in.read_ulong();
+
+    in.setCodeSet(CodeSetServiceContext.find(service_context));
+  }
+
+  /**
+   * Returns a short string representation.
+   *
+   * @return a string representation.
+   */
+  public String toString()
+  {
+    String status = getStatusString();
+    if (status == null)
+      status = "status " + reply_status;
+    return request_id + ", " + status + " " + contexts();
+  }
+
+  /**
+   * Writes the header to the stream.
+   *
+   * Sets the code set of this stream to
+   * the code set, specfied in the header.
+   *
+   * @param out a stream to write into.
+   */
+  public void write(AbstractCdrOutput out)
+  {
+    ServiceContext.writeSequence(out, service_context);
+    out.write_ulong(request_id);
+    out.write_ulong(reply_status);
+
+    out.setCodeSet(CodeSetServiceContext.find(service_context));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,157 @@
+/* RequestHeader.java -- The GIOP 1.0 request message.
+   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.CORBA.GIOP.v1_0;
+
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.GIOP.ServiceContext;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * The GIOP 1.0 request message.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class RequestHeader
+  extends gnu.CORBA.GIOP.RequestHeader
+  implements IDLEntity
+{
+  /**
+   * Creates an empty request header, setting requesting principal
+   * to byte[] { 'P' }.
+   */
+  public RequestHeader()
+  {
+    requesting_principal = new byte[] { 'P' };
+  }
+
+  /**
+   * Set if the sender expects any response to this message.
+   */
+  public void setResponseExpected(boolean expected)
+  {
+    response_expected = expected;
+  }
+
+  /**
+   * Return true if response is expected.
+   */
+  public boolean isResponseExpected()
+  {
+    return response_expected;
+  }
+
+  public String bytes(byte[] array)
+  {
+    StringBuffer b = new StringBuffer();
+    for (int i = 0; i < array.length; i++)
+      {
+        b.append(Integer.toHexString(array [ i ] & 0xFF));
+        b.append(" ");
+      }
+    return b.toString();
+  }
+
+  /**
+   * Get the string representation of all included contexts.
+   */
+  public String contexts()
+  {
+    StringBuffer b = new StringBuffer();
+    for (int i = 0; i < service_context.length; i++)
+      {
+        b.append(service_context [ i ].toString());
+        b.append(' ');
+      }
+    return b.toString();
+  }
+
+  /**
+   * Reads the header from the stream.
+   *
+   * Sets the code set of this stream to
+   * the code set, specfied in the header.
+   *
+   * @param in a stream to read from.
+   */
+  public void read(AbstractCdrInput in)
+  {
+    service_context = ServiceContext.readSequence(in);
+    request_id = in.read_ulong();
+    response_expected = in.read_boolean();
+    object_key = in.read_sequence();
+    operation = in.read_string();
+    requesting_principal = in.read_sequence();
+
+    in.setCodeSet(CodeSetServiceContext.find(service_context));
+  }
+
+  /**
+   * Return a string representation.
+   */
+  public String toString()
+  {
+    return "Request " + request_id + ", call '" + operation + "' on " +
+           bytes(object_key) + ", " +
+           (response_expected ? "wait response" : "one way") + ", from " +
+           bytes(requesting_principal) + contexts();
+  }
+
+  /**
+   * Writes the header to the stream.
+   *
+   * Sets the code set of this stream to
+   * the code set, specfied in the header.
+   *
+   * @param out a stream to write into.
+   */
+  public void write(AbstractCdrOutput out)
+  {
+    ServiceContext.writeSequence(out, service_context);
+    out.write_ulong(request_id);
+    out.write_boolean(response_expected);
+    out.write_sequence(object_key);
+    out.write_string(operation);
+    out.write_sequence(requesting_principal);
+
+    out.setCodeSet(CodeSetServiceContext.find(service_context));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* ReplyHeader.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.CORBA.GIOP.v1_2;
+
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.GIOP.ServiceContext;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+
+/**
+ * GIOP 1.2 reply header.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ReplyHeader
+  extends gnu.CORBA.GIOP.v1_0.ReplyHeader
+{
+  /**
+   * Adds the standard encoding context.
+   */
+  public ReplyHeader()
+  {
+    service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
+  }
+
+  /**
+   * Return the message status as a string.
+   */
+  public String getStatusString()
+  {
+    String s = super.getStatusString();
+    if (s != null)
+      return s;
+    switch (reply_status)
+      {
+        case LOCATION_FORWARD_PERM :
+          return "moved permanently";
+
+        case NEEDS_ADDRESSING_MODE :
+          return "the alternative addressing mode required";
+
+        default :
+          return null;
+      }
+  }
+
+  /**
+   * Reads the header from the stream.
+   * The fields go in different order than in the previous GIOP versions.
+   *
+   * Sets the code set of this stream to
+   * the code set, specfied in the header.
+   *
+   * @param in a stream to read from.
+   */
+  public void read(AbstractCdrInput in)
+  {
+    request_id = in.read_ulong();
+    reply_status = in.read_ulong();
+    service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
+
+    in.setCodeSet(CodeSetServiceContext.find(service_context));
+  }
+
+  /**
+   * Writes the header to the stream.
+   * The fields go in different order than in the previous GIOP versions.
+   *
+   * Sets the code set of this stream to
+   * the code set, specfied in the header.
+   *
+   * @param out a stream to write into.
+   */
+  public void write(AbstractCdrOutput out)
+  {
+    out.write_ulong(request_id);
+    out.write_ulong(reply_status);
+    gnu.CORBA.GIOP.ServiceContext.writeSequence(out, service_context);
+
+    out.setCodeSet(CodeSetServiceContext.find(service_context));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,222 @@
+/* RequestHeader.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.CORBA.GIOP.v1_2;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.GIOP.ServiceContext;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+
+import java.io.IOException;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_IMPLEMENT;
+
+/**
+ * The GIOP 1.2 request header. The GIOP 1.1 request header
+ * is the same as GIOP 1.0 request header, if taking the
+ * alignment into consideration.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class RequestHeader
+  extends gnu.CORBA.GIOP.v1_0.RequestHeader
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * Indicates that the object is addressed by the object key.
+   */
+  public static final short KeyAddr = 0;
+
+  /**
+   * Indicates that the object is addressed by the IOP tagged profile.
+   */
+  public static final short ProfileAddr = 1;
+
+  /**
+   * Indicates that the objec is addressed by IOR addressing info.
+   */
+  public static final short ReferenceAddr = 2;
+
+  /**
+   * The response flags of the header. By default, the flags are initialised
+   * by value 0x3 (response expected).
+   */
+  public byte response_flags = 3;
+
+  /**
+   * The used addressing method.
+   */
+  public short AddressingDisposition;
+
+  /**
+   * Adds the standard encoding context.
+   */
+  public RequestHeader()
+  {
+    service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
+  }
+
+  /**
+   * Set if the sender expects any response to this message.
+   * Clears or sets the 2 lower bits of flags
+   * (0 - not expected, 0x3 - expected).
+   */
+  public void setResponseExpected(boolean expected)
+  {
+    response_expected = expected;
+
+    if (expected)
+      response_flags = (byte) (response_flags | 0x3);
+    else
+      response_flags = (byte) (response_flags & (~0x3));
+  }
+
+  /**
+   * Return true if response is expected.
+   *
+   * @return true if the two lowest bits of the flags are set or
+   * the response expected is explicitly set to true.
+   */
+  public boolean isResponseExpected()
+  {
+    return response_expected || ((response_flags & 0x3) == 0x3);
+  }
+
+  /**
+   * Read the header from the given stream.
+   *
+   * @param in a stream to read from.
+   */
+  public void read(AbstractCdrInput in)
+  {
+    try
+      {
+        request_id = in.read_ulong();
+        response_flags = (byte) in.read();
+
+        // Skip 3 reserved octets:
+        in.skip(3);
+
+        // Read target address.
+        AddressingDisposition = in.read_ushort();
+
+        switch (AddressingDisposition)
+          {
+            case KeyAddr :
+              object_key = in.read_sequence();
+              break;
+
+            // TODO FIXME add other addressing methods.
+            case ProfileAddr :
+              throw new NO_IMPLEMENT("Object addressing by IOP tagged profile");
+
+            case ReferenceAddr :
+              throw new NO_IMPLEMENT("Object addressing by by IOR addressing info");
+
+            default :
+              MARSHAL m = new MARSHAL("Unknow addressing method in request, " +
+                                AddressingDisposition
+                               );
+              m.minor = Minor.UnsupportedAddressing;
+              throw m;
+          }
+
+        operation = in.read_string();
+        service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
+
+        // No requesting principal in this new format.
+        in.setCodeSet(CodeSetServiceContext.find(service_context));
+      }
+    catch (IOException ex)
+      {
+        MARSHAL t = new MARSHAL();
+        t.minor = Minor.Header;
+        t.initCause(ex);
+        throw t;
+      }
+  }
+
+  /**
+   * Return a string representation.
+   */
+  public String toString()
+  {
+    return "Request " + request_id + ", call '" + operation + "' on " +
+           bytes(object_key) + ", " +
+           (response_expected ? "wait response" : "one way") +
+           " addressed by " + " method " + AddressingDisposition + "." +
+           contexts();
+  }
+
+  /**
+   * Write the header to the given stream.
+   *
+   * @param out a stream to write into.
+   */
+  public void write(AbstractCdrOutput out)
+  {
+    out.write_ulong(request_id);
+
+    out.write(response_flags);
+
+    // Skip 3 reserved octets:
+    out.write(0);
+    out.write(0);
+    out.write(0);
+
+    // Write addressing disposition from IOR.
+    // TODO FIXME add other addressing methods.
+    out.write_ushort(KeyAddr);
+
+    out.write_sequence(object_key);
+
+    out.write_string(operation);
+
+    ServiceContext.writeSequence(out, service_context);
+
+    // No requesting principal in this new format.
+    out.setCodeSet(CodeSetServiceContext.find(service_context));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GeneralHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GeneralHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GeneralHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/GeneralHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,178 @@
+/* universalStreamable.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.CORBA;
+
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+import java.io.IOException;
+
+/**
+ * This class holds the abstract binary data array of the Streamable
+ * being stored. It is used to insert and extract into {@link Any} objects
+ * that have no holder, but have the helper classes.
+ * Encoding/decoding then must be performed by the helper. This class is
+ * defined as package private because it is not idiot proof and
+ * must be used with care.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class GeneralHolder
+  implements Streamable
+{
+  /**
+   * The binary data, stored inside this holder.
+   */
+  private BufferedCdrOutput value = new BufferedCdrOutput();
+
+  /**
+   * Create the universal holder that uses the given buffer to store the data.
+   */
+  public GeneralHolder(BufferedCdrOutput buffer)
+  {
+    value = buffer;
+  }
+
+  /**
+   * Reads into the internal buffer till the end of stream is
+   * reached. No alignment operations are performed. This operation
+   * normally reads from the stream, where the single value,
+   * stored using {@link #_write}, is written.
+   *
+   * @throws MARSHALL, if the IOException is thrown during the
+   * stream operation.
+   */
+  public void _read(InputStream input)
+  {
+    try
+      {
+        if (input instanceof BufferredCdrInput)
+          {
+            BufferredCdrInput b = (BufferredCdrInput) input;
+            value.write(b.buffer.getBuffer());
+          }
+        else
+          {
+            int c;
+
+            do
+              {
+                c = input.read();
+                if (c >= 0)
+                  value.write(c);
+              }
+            while (c >= 0);
+          }
+      }
+    catch (IOException ex)
+      {
+        MARSHAL t = new MARSHAL();
+        t.minor = Minor.Any;
+        t.initCause(ex);
+        throw t;
+      }
+  }
+
+  /**
+   * The type is not known and cannot be returned.
+   *
+   * @throws BAD_OPERATION, always.
+   */
+  public TypeCode _type()
+  {
+    BAD_OPERATION bad = new BAD_OPERATION();
+    bad.minor = Minor.Inappropriate;
+    throw bad;
+  }
+
+  /**
+   * Writes the binary data being stored into the given output
+   * stream. This operation supposes that the current stream
+   * position is 0 or satisfies the required alignments anyway.
+   *
+   * @throws MARSHAL if the IOExeption is thrown when writing the
+   * byte array.
+   */
+  public void _write(OutputStream output)
+  {
+    try
+      {
+        value.buffer.writeTo(output);
+      }
+    catch (IOException ex)
+      {
+        MARSHAL t = new MARSHAL();
+        t.minor = Minor.Any;
+        t.initCause(ex);
+        throw t;
+      }
+  }
+
+  /**
+   * Get the input stream that reads the fields of the stored value.
+   */
+  InputStream getInputStream()
+  {
+    return value.create_input_stream();
+  }
+
+  /**
+   * Clone.
+   */
+  public GeneralHolder Clone()
+  {
+    try
+      {
+        BufferedCdrOutput nb = new BufferedCdrOutput(value.buffer.size());
+        value.buffer.writeTo(nb);
+        return new GeneralHolder(nb);
+      }
+    catch (IOException ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/HolderLocator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/HolderLocator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/HolderLocator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/HolderLocator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,184 @@
+/* HolderLocator.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.CORBA;
+
+import org.omg.CORBA.AnyHolder;
+import org.omg.CORBA.AnySeqHolder;
+import org.omg.CORBA.BooleanHolder;
+import org.omg.CORBA.BooleanSeqHolder;
+import org.omg.CORBA.CharHolder;
+import org.omg.CORBA.CharSeqHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.DoubleSeqHolder;
+import org.omg.CORBA.FixedHolder;
+import org.omg.CORBA.FloatHolder;
+import org.omg.CORBA.FloatSeqHolder;
+import org.omg.CORBA.IntHolder;
+import org.omg.CORBA.LongHolder;
+import org.omg.CORBA.LongLongSeqHolder;
+import org.omg.CORBA.LongSeqHolder;
+import org.omg.CORBA.OctetSeqHolder;
+import org.omg.CORBA.PrincipalHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.ShortSeqHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.StringSeqHolder;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodeHolder;
+import org.omg.CORBA.ULongLongSeqHolder;
+import org.omg.CORBA.ULongSeqHolder;
+import org.omg.CORBA.UShortSeqHolder;
+import org.omg.CORBA.WCharSeqHolder;
+import org.omg.CORBA.WStringSeqHolder;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.ObjectHolder;
+
+/**
+ * Creates the suitable holder for storing the value of the given final_type.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class HolderLocator
+{
+  /**
+   * The array, sufficiently large to use any {@link TCKind}._tk* constant as
+   * an index.
+   */
+  private static final Class[] holders;
+
+  private static final Class[] seqHolders;
+
+  static
+    {
+      holders = new Class[32];
+      holders[TCKind._tk_Principal] = PrincipalHolder.class;
+      holders[TCKind._tk_TypeCode] = TypeCodeHolder.class;
+      holders[TCKind._tk_any] = AnyHolder.class;
+      holders[TCKind._tk_boolean] = BooleanHolder.class;
+      holders[TCKind._tk_char] = CharHolder.class;
+      holders[TCKind._tk_double] = DoubleHolder.class;
+      holders[TCKind._tk_float] = FloatHolder.class;
+      holders[TCKind._tk_fixed] = FixedHolder.class;
+      holders[TCKind._tk_long] = IntHolder.class;
+      holders[TCKind._tk_longdouble] = DoubleHolder.class;
+      holders[TCKind._tk_longlong] = LongHolder.class;
+      holders[TCKind._tk_octet] = OctetHolder.class;
+      holders[TCKind._tk_short] = ShortHolder.class;
+      holders[TCKind._tk_string] = StringHolder.class;
+      holders[TCKind._tk_ulong] = IntHolder.class;
+      holders[TCKind._tk_ulonglong] = LongHolder.class;
+      holders[TCKind._tk_ushort] = ShortHolder.class;
+      holders[TCKind._tk_wchar] = WCharHolder.class;
+      holders[TCKind._tk_wstring] = WStringHolder.class;
+      holders[TCKind._tk_objref] = ObjectHolder.class;
+
+      seqHolders = new Class[32];
+
+      seqHolders[TCKind._tk_ulonglong] = ULongLongSeqHolder.class;
+      seqHolders[TCKind._tk_short] = ShortSeqHolder.class;
+      seqHolders[TCKind._tk_octet] = OctetSeqHolder.class;
+      seqHolders[TCKind._tk_any] = AnySeqHolder.class;
+      seqHolders[TCKind._tk_long] = LongSeqHolder.class;
+      seqHolders[TCKind._tk_longlong] = LongLongSeqHolder.class;
+      seqHolders[TCKind._tk_float] = FloatSeqHolder.class;
+      seqHolders[TCKind._tk_double] = DoubleSeqHolder.class;
+      seqHolders[TCKind._tk_char] = CharSeqHolder.class;
+      seqHolders[TCKind._tk_boolean] = BooleanSeqHolder.class;
+      seqHolders[TCKind._tk_wchar] = WCharSeqHolder.class;
+      seqHolders[TCKind._tk_ushort] = UShortSeqHolder.class;
+      seqHolders[TCKind._tk_ulong] = ULongSeqHolder.class;
+      seqHolders[TCKind._tk_string] = StringSeqHolder.class;
+      seqHolders[TCKind._tk_wstring] = WStringSeqHolder.class;
+    }
+
+  /**
+   * Create a holder for storing the value of the given built-in final_type. This
+   * function returns the defined holders for the built-in primitive types and
+   * they sequences.
+   *
+   * @param t the typecode
+   *
+   * @return an instance of the corresponding built-in holder of null if no such
+   * is defined for this final_type. The holder is created with a parameterless
+   * constructor.
+   */
+  public static Streamable createHolder(TypeCode t)
+  {
+    try
+      {
+        int kind = t.kind().value();
+        int componentKind;
+
+        Streamable holder = null;
+
+        if (kind < holders.length && holders[kind] != null)
+          holder = (Streamable) holders[kind].newInstance();
+
+        if (holder != null)
+          return holder;
+
+        switch (kind)
+          {
+          case TCKind._tk_sequence:
+            componentKind = t.content_type().kind().value();
+            if (componentKind < seqHolders.length)
+              return (Streamable) seqHolders[componentKind].newInstance();
+            break;
+
+          default:
+            break;
+          }
+      }
+    catch (Exception ex)
+      {
+        throw new Unexpected(ex);
+      }
+
+    try
+      {
+        Object ox = ObjectCreator.createObject(t.id(), "Holder");
+        return (Streamable) ox;
+      }
+    catch (Exception ex)
+      {
+        return null;
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IOR.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IOR.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IOR.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IOR.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,822 @@
+/* IOR.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.CORBA;
+
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.GIOP.CharSets_OSF;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ULongSeqHelper;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.IOP.TAG_MULTIPLE_COMPONENTS;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.TaggedComponentHelper;
+import org.omg.IOP.TaggedProfile;
+import org.omg.IOP.TaggedProfileHelper;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.zip.Adler32;
+
+/**
+ * The implementaton of the Interoperable Object Reference (IOR). IOR can be
+ * compared with the Internet address for a web page, it provides means to
+ * locate the CORBA service on the web. IOR contains the host address, port
+ * number, the object identifier (key) inside the server, the communication
+ * protocol version, supported charsets and so on.
+ *
+ * Ths class provides method for encoding and decoding the IOR information
+ * from/to the stringified references, usually returned by
+ * {@link org.omg.CORBA.ORB#String object_to_string()}.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ *
+ * @see org.mog.CORBA.Object.object_to_string(Object forObject)
+ * @see string_to_object(String IOR)
+ */
+public class IOR
+{
+  /**
+   * The code sets tagged component, normally part of the Internet profile. This
+   * compone consists of the two componenets itself.
+   */
+  public static class CodeSets_profile
+  {
+    public CodeSets_profile()
+    {
+      int[] supported = CharSets_OSF.getSupportedCharSets();
+
+      narrow.native_set = CharSets_OSF.NATIVE_CHARACTER;
+      narrow.conversion = supported;
+
+      wide.native_set = CharSets_OSF.NATIVE_WIDE_CHARACTER;
+      wide.conversion = supported;
+    }
+
+    /**
+     * The code set component.
+     */
+    public static class CodeSet_component
+    {
+      /**
+       * The conversion code sets.
+       */
+      public int[] conversion;
+
+      /**
+       * The native code set.
+       */
+      public int native_set;
+
+      /**
+       * Read from the CDR stream.
+       */
+      public void read(org.omg.CORBA.portable.InputStream in)
+      {
+        native_set = in.read_ulong();
+        conversion = ULongSeqHelper.read(in);
+      }
+
+      /**
+       * Get a string representation.
+       */
+      public String toString()
+      {
+        StringBuffer b = new StringBuffer();
+        b.append("native " + name(native_set));
+        if (conversion != null && conversion.length > 0)
+          {
+            b.append(" conversion ");
+            for (int i = 0; i < conversion.length; i++)
+              {
+                b.append(name(conversion[i]));
+                b.append(' ');
+              }
+          }
+        b.append(' ');
+        return b.toString();
+      }
+      
+      /**
+       * Get a better formatted multiline string representation.
+       */
+      public String toStringFormatted()
+      {
+        StringBuffer b = new StringBuffer();
+        b.append("\n  Native set " + name(native_set));
+        if (conversion != null && conversion.length > 0)
+          {
+            b.append("\n  Other supported sets:\n    ");
+            for (int i = 0; i < conversion.length; i++)
+              {
+                b.append(name(conversion[i]));
+                b.append(' ');
+              }
+          }
+        b.append("\n");
+        return b.toString();
+      }
+      
+
+      /**
+       * Write into CDR stream.
+       */
+      public void write(org.omg.CORBA.portable.OutputStream out)
+      {
+        out.write_long(native_set);
+        ULongSeqHelper.write(out, conversion);
+      }
+
+      private String name(int set)
+      {
+        return "0x" + Integer.toHexString(set) + " ("
+               + CharSets_OSF.getName(set) + ") ";
+      }
+    }
+
+    /**
+     * The agreed tag for the Codesets profile.
+     */
+    public static final int TAG_CODE_SETS = 1;
+
+    /**
+     * Information about narrow character encoding (TCS-C).
+     */
+    public CodeSet_component narrow = new CodeSet_component();
+
+    /**
+     * About wide character encoding (TCS-W).
+     */
+    public CodeSet_component wide = new CodeSet_component();
+
+    /**
+     * The negotiated coding result for this IOR. Saves time, requred for
+     * negotiation computations.
+     */
+    public CodeSetServiceContext negotiated;
+
+    /**
+     * Read the code set profile information from the given input stream.
+     *
+     * @param profile a stream to read from.
+     */
+    public void read(AbstractCdrInput profile)
+    {
+      BufferredCdrInput encapsulation = profile.read_encapsulation();
+      narrow.read(encapsulation);
+      wide.read(encapsulation);
+    }
+
+    /**
+     * Returns a string representation.
+     */
+    public String toString()
+    {
+      return "Narrow char: " + narrow + ", Wide char: " + wide;
+    }
+
+    /**
+     * Write the code set profile information into the given input stream.
+     *
+     * @param profile a stream to write into.
+     */
+    public void write(AbstractCdrOutput profile)
+    {
+      AbstractCdrOutput encapsulation = profile.createEncapsulation();
+      narrow.write(encapsulation);
+      wide.write(encapsulation);
+      try
+        {
+          encapsulation.close();
+        }
+      catch (IOException ex)
+        {
+          throw new InternalError();
+        }
+    }
+  }
+
+  /**
+   * The internet profile.
+   */
+  public class Internet_profile
+  {
+    /**
+     * The agreed tag for the Internet profile.
+     */
+    public static final int TAG_INTERNET_IOP = 0;
+
+    /**
+     * The host.
+     */
+    public String host;
+
+    /**
+     * The IIOP version (initialised to 1.2 by default).
+     */
+    public Version version = new Version(1, 2);
+
+    /**
+     * The port.
+     */
+    public int port;
+
+    /**
+     * The code sets component in the internet profile of this IOR. This is not
+     * a separate profile.
+     */
+    public CodeSets_profile CodeSets = new CodeSets_profile();
+
+    /**
+     * Reserved for all components of this profile, this array holds the
+     * components other than code set components.
+     */
+    ArrayList components = new ArrayList();
+
+    /**
+     * Return the human readable representation.
+     */
+    public String toString()
+    {
+      StringBuffer b = new StringBuffer();
+      b.append(host);
+      b.append(":");
+      b.append(port);
+      b.append(" (v");
+      b.append(version);
+      b.append(")");
+      if (components.size() > 0)
+        b.append(" " + components.size() + " extra components.");
+      return b.toString();
+    }
+
+    /**
+     * Write the internet profile (except the heading tag.
+     */
+    public void write(AbstractCdrOutput out)
+    {
+      try
+        {
+          // Need to write the Internet profile into the separate
+          // stream as we must know the size in advance.
+          AbstractCdrOutput b = out.createEncapsulation();
+
+          version.write(b);
+          b.write_string(host);
+
+          b.write_ushort((short) (port & 0xFFFF));
+
+          // Write the object key.
+          b.write_long(key.length);
+          b.write(key);
+
+          // Number of the tagged components.
+          b.write_long(1 + components.size());
+
+          b.write_long(CodeSets_profile.TAG_CODE_SETS);
+          CodeSets.write(b);
+
+          TaggedComponent t;
+
+          for (int i = 0; i < components.size(); i++)
+            {
+              t = (TaggedComponent) components.get(i);
+              TaggedComponentHelper.write(b, t);
+            }
+
+          b.close();
+        }
+      catch (Exception e)
+        {
+          MARSHAL m = new MARSHAL("Unable to write Internet profile.");
+          m.minor = Minor.IOR;
+          m.initCause(e);
+          throw m;
+        }
+    }
+  }
+
+  /**
+   * The standard minor code, indicating that the string to object converstio
+   * has failed due non specific reasons.
+   */
+  public static final int FAILED = 10;
+
+  /**
+   * The internet profile of this IOR.
+   */
+  public Internet_profile Internet = new Internet_profile();
+
+  /**
+   * The object repository Id.
+   */
+  public String Id;
+
+  /**
+   * The object key.
+   */
+  public byte[] key;
+
+  /**
+   * All tagged profiles of this IOR, except the separately defined Internet
+   * profile.
+   */
+  ArrayList profiles = new ArrayList();
+
+  /**
+   * True if the profile was encoded using the Big Endian or the encoding is not
+   * known.
+   *
+   * false if it was encoded using the Little Endian.
+   */
+  public boolean Big_Endian = true;
+
+  /**
+   * Create an empty instance, initialising the code sets to default values.
+   */
+  public IOR()
+  {
+  }
+
+  /**
+   * Parse the provided stringifed reference.
+   *
+   * @param stringified_reference, in the form of IOR:nnnnnn.....
+   *
+   * @return the parsed IOR
+   *
+   * @throws BAD_PARAM, minor code 10, if the IOR cannot be parsed.
+   *
+   * TODO corballoc and other alternative formats.
+   */
+  public static IOR parse(String stringified_reference)
+    throws BAD_PARAM
+  {
+    try
+      {
+        if (!stringified_reference.startsWith("IOR:"))
+          throw new BAD_PARAM("The string refernce must start with IOR:",
+                              FAILED, CompletionStatus.COMPLETED_NO);
+
+        IOR r = new IOR();
+
+        ByteArrayOutputStream buf = new ByteArrayOutputStream();
+        String x = stringified_reference;
+        x = x.substring(x.indexOf(":") + 1);
+
+        char cx;
+
+        for (int i = 0; i < x.length(); i = i + 2)
+          {
+            cx = (char) Integer.parseInt(x.substring(i, i + 2), 16);
+            buf.write(cx);
+          }
+
+        BufferredCdrInput cdr = new BufferredCdrInput(buf.toByteArray());
+
+        r._read(cdr);
+        return r;
+      }
+    catch (Exception ex)
+      {
+        ex.printStackTrace();
+        throw new BAD_PARAM(ex + " while parsing " + stringified_reference,
+                            FAILED, CompletionStatus.COMPLETED_NO);
+      }
+  }
+
+  /**
+   * Read the IOR from the provided input stream.
+   *
+   * @param c a stream to read from.
+   * @throws IOException if the stream throws it.
+   */
+  public void _read(AbstractCdrInput c)
+    throws IOException, BAD_PARAM
+  {
+    int endian;
+
+    endian = c.read_long();
+    if (endian != 0)
+      {
+        Big_Endian = false;
+        c.setBigEndian(false);
+      }
+    _read_no_endian(c);
+  }
+
+  /**
+   * Read the IOR from the provided input stream, not reading the endian data at
+   * the beginning of the stream. The IOR is thansferred in this form in
+   * {@link write_Object(org.omg.CORBA.Object)}.
+   *
+   * If the stream contains a null value, the Id and Internet fields become
+   * equal to null. Otherwise Id contains some string (possibly empty).
+   *
+   * Id is checked for null in AbstractCdrInput that then returns null instead of
+   * object.
+   *
+   * @param c a stream to read from.
+   * @throws IOException if the stream throws it.
+   */
+  public void _read_no_endian(AbstractCdrInput c)
+    throws IOException, BAD_PARAM
+  {
+    Id = c.read_string();
+
+    int n_profiles = c.read_long();
+
+    if (n_profiles == 0)
+      {
+        Id = null;
+        Internet = null;
+        return;
+      }
+
+    for (int i = 0; i < n_profiles; i++)
+      {
+        int tag = c.read_long();
+        BufferredCdrInput profile = c.read_encapsulation();
+
+        if (tag == Internet_profile.TAG_INTERNET_IOP)
+          {
+            Internet = new Internet_profile();
+            Internet.version = Version.read_version(profile);
+            Internet.host = profile.read_string();
+            Internet.port = profile.gnu_read_ushort();
+
+            key = profile.read_sequence();
+
+            // Read tagged components.
+            int n_components = 0;
+
+            try
+              {
+                if (Internet.version.since_inclusive(1, 1))
+                  n_components = profile.read_long();
+
+                for (int t = 0; t < n_components; t++)
+                  {
+                    int ctag = profile.read_long();
+
+                    if (ctag == CodeSets_profile.TAG_CODE_SETS)
+                      {
+                        Internet.CodeSets.read(profile);
+                      }
+                    else
+                      {
+                        // Construct a generic component for codesets
+                        // profile.
+                        TaggedComponent pc = new TaggedComponent();
+                        pc.tag = ctag;
+                        pc.component_data = profile.read_sequence();
+                        Internet.components.add(pc);
+                      }
+                  }
+              }
+            catch (Unexpected ex)
+              {
+                ex.printStackTrace();
+              }
+          }
+        else
+          {
+            // Construct a generic profile.
+            TaggedProfile p = new TaggedProfile();
+            p.tag = tag;
+            p.profile_data = profile.buffer.getBuffer();
+
+            profiles.add(p);
+          }
+      }
+  }
+
+  /**
+   * Write this IOR record to the provided CDR stream. This procedure writes the
+   * zero (Big Endian) marker first.
+   */
+  public void _write(AbstractCdrOutput out)
+  {
+    // Always use Big Endian.
+    out.write(0);
+    _write_no_endian(out);
+  }
+
+  /**
+   * Write a null value to the CDR output stream.
+   *
+   * The null value is written as defined in OMG specification (zero length
+   * string, followed by an empty set of profiles).
+   */
+  public static void write_null(AbstractCdrOutput out)
+  {
+    // Empty Id string.
+    out.write_string("");
+
+    // Empty set of profiles.
+    out.write_long(0);
+  }
+
+  /**
+   * Write this IOR record to the provided CDR stream. The procedure writed data
+   * in Big Endian, but does NOT add any endian marker to the beginning.
+   */
+  public void _write_no_endian(AbstractCdrOutput out)
+  {
+    // Write repository id.
+    out.write_string(Id);
+
+    out.write_long(1 + profiles.size());
+
+    // Write the Internet profile.
+    out.write_long(Internet_profile.TAG_INTERNET_IOP);
+    Internet.write(out);
+
+    // Write other profiles.
+    TaggedProfile tp;
+
+    for (int i = 0; i < profiles.size(); i++)
+      {
+        tp = (TaggedProfile) profiles.get(i);
+        TaggedProfileHelper.write(out, tp);
+      }
+  }
+
+  /**
+   * Returns a human readable string representation of this IOR object.
+   */
+  public String toString()
+  {
+    StringBuffer b = new StringBuffer();
+    b.append(Id);
+    b.append(" at ");
+    b.append(Internet);
+
+    if (!Big_Endian)
+      b.append(" (Little endian) ");
+
+    b.append(" Key ");
+
+    for (int i = 0; i < key.length; i++)
+      {
+        b.append(Integer.toHexString(key[i] & 0xFF));
+      }
+
+    b.append(" ");
+    b.append(Internet.CodeSets);
+
+    return b.toString();
+  }
+  
+  /**
+   * Returns a multiline formatted human readable string representation of 
+   * this IOR object.
+   */
+  public String toStringFormatted()
+  {
+    StringBuffer b = new StringBuffer();
+    b.append("\nObject Id:\n  ");
+    b.append(Id);
+    b.append("\nObject is accessible at:\n  ");
+    b.append(Internet);
+
+    if (Big_Endian)
+      b.append("\n  Big endian encoding");
+    else
+      b.append("\n  Little endian encoding.");      
+
+    b.append("\nObject Key\n  ");
+
+    for (int i = 0; i < key.length; i++)
+      {
+        b.append(Integer.toHexString(key[i] & 0xFF));
+      }
+
+    b.append("\nSupported code sets:");
+    b.append("\n Wide:");
+    b.append(Internet.CodeSets.wide.toStringFormatted());
+    b.append(" Narrow:");
+    b.append(Internet.CodeSets.wide.toStringFormatted());
+
+    return b.toString();
+  }  
+
+  /**
+   * Returs a stringified reference.
+   *
+   * @return a newly constructed stringified reference.
+   */
+  public String toStringifiedReference()
+  {
+    BufferedCdrOutput out = new BufferedCdrOutput();
+
+    _write(out);
+
+    StringBuffer b = new StringBuffer("IOR:");
+
+    byte[] binary = out.buffer.toByteArray();
+    String s;
+
+    for (int i = 0; i < binary.length; i++)
+      {
+        s = Integer.toHexString(binary[i] & 0xFF);
+        if (s.length() == 1)
+          b.append('0');
+        b.append(s);
+      }
+
+    return b.toString();
+  }
+
+  /**
+   * Adds a service-specific component to the IOR profile. The specified
+   * component will be included in all profiles, present in the IOR.
+   *
+   * @param tagged_component a tagged component being added.
+   */
+  public void add_ior_component(TaggedComponent tagged_component)
+  {
+    // Add to the Internet profile.
+    Internet.components.add(tagged_component);
+
+    // Add to others.
+    for (int i = 0; i < profiles.size(); i++)
+      {
+        TaggedProfile profile = (TaggedProfile) profiles.get(i);
+        addComponentTo(profile, tagged_component);
+      }
+  }
+
+  /**
+   * Adds a service-specific component to the IOR profile.
+   *
+   * @param tagged_component a tagged component being added.
+   *
+   * @param profile_id the IOR profile to that the component must be added. The
+   * 0 value ({@link org.omg.IOP.TAG_INTERNET_IOP#value}) adds to the Internet
+   * profile where host and port are stored by default.
+   */
+  public void add_ior_component_to_profile(TaggedComponent tagged_component,
+                                           int profile_id)
+  {
+    if (profile_id == TAG_INTERNET_IOP.value)
+      // Add to the Internet profile
+      Internet.components.add(tagged_component);
+    else
+      {
+        // Add to others.
+        for (int i = 0; i < profiles.size(); i++)
+          {
+            TaggedProfile profile = (TaggedProfile) profiles.get(i);
+            if (profile.tag == profile_id)
+              addComponentTo(profile, tagged_component);
+          }
+      }
+  }
+
+  /**
+   * Add given component to the given profile that is NOT an Internet profile.
+   *
+   * @param profile the profile, where the component should be added.
+   * @param component the component to add.
+   */
+  private static void addComponentTo(TaggedProfile profile,
+                                     TaggedComponent component)
+  {
+    if (profile.tag == TAG_MULTIPLE_COMPONENTS.value)
+      {
+        TaggedComponent[] present;
+        if (profile.profile_data.length > 0)
+          {
+            BufferredCdrInput in = new BufferredCdrInput(profile.profile_data);
+
+            present = new TaggedComponent[in.read_long()];
+
+            for (int i = 0; i < present.length; i++)
+              {
+                present[i] = TaggedComponentHelper.read(in);
+              }
+          }
+        else
+          present = new TaggedComponent[0];
+
+        BufferedCdrOutput out = new BufferedCdrOutput(profile.profile_data.length
+                                            + component.component_data.length
+                                            + 8);
+
+        // Write new amount of components.
+        out.write_long(present.length + 1);
+
+        // Write other components.
+        for (int i = 0; i < present.length; i++)
+          TaggedComponentHelper.write(out, present[i]);
+
+        // Write the passed component.
+        TaggedComponentHelper.write(out, component);
+
+        try
+          {
+            out.close();
+          }
+        catch (IOException e)
+          {
+            throw new Unexpected(e);
+          }
+        profile.profile_data = out.buffer.toByteArray();
+      }
+    else
+      // The future supported tagged profiles should be added here.
+      throw new BAD_PARAM("Unsupported profile type " + profile.tag);
+  }
+  
+  /**
+   * Checks for equality.
+   */
+  public boolean equals(Object x)
+  {
+    if (x instanceof IOR)
+      {
+        boolean keys;
+        boolean hosts = true;
+
+        IOR other = (IOR) x;
+        
+        if (Internet==null || other.Internet==null)
+          return Internet == other.Internet;
+        
+        if (key != null && other.key != null)
+          keys = Arrays.equals(key, other.key);
+        else
+          keys = key == other.key;
+
+        if (Internet != null && Internet.host != null)
+          if (other.Internet != null && other.Internet.host != null)
+            hosts = other.Internet.host.equals(Internet.host);
+
+        return keys & hosts && Internet.port==other.Internet.port;
+      }
+    else
+      return false;
+  }
+  
+  /**
+   * Get the hashcode of this IOR.
+   */
+  public int hashCode()
+  {
+    Adler32 adler = new Adler32();
+    if (key != null)
+      adler.update(key);
+    if (Internet != null)
+      {
+        if (Internet.host != null)
+          adler.update(Internet.host.getBytes());
+        adler.update(Internet.port);
+      }
+    return (int) adler.getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ClientRequestInterceptors.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ClientRequestInterceptors.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ClientRequestInterceptors.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ClientRequestInterceptors.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,139 @@
+/* ClientRequestInterceptors.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.CORBA.Interceptor;
+
+import org.omg.PortableInterceptor.ClientRequestInfo;
+import org.omg.PortableInterceptor.ClientRequestInterceptor;
+import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
+import org.omg.PortableInterceptor.ForwardRequest;
+
+/**
+ * A block of the all registered ClientRequest interceptors.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class ClientRequestInterceptors
+  implements ClientRequestInterceptorOperations
+{
+  /**
+   * The array of all registered ClientRequest interceptors.
+   */
+  private final ClientRequestInterceptor[] interceptors;
+
+  /**
+   * Create the interceptor pack with the registerend interceptor array,
+   * obtained from the registrator.
+   */
+  public ClientRequestInterceptors(Registrator registrator)
+  {
+    interceptors = registrator.getClientRequestInterceptors();
+  }
+
+  /** @inheritDoc */
+  public void receive_exception(ClientRequestInfo info)
+    throws ForwardRequest
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].receive_exception(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void receive_other(ClientRequestInfo info) throws ForwardRequest
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].receive_other(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void receive_reply(ClientRequestInfo info)
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].receive_reply(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void send_poll(ClientRequestInfo info)
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].send_poll(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void send_request(ClientRequestInfo info) throws ForwardRequest
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].send_request(info);
+      }
+  }
+
+  /**
+   * Call destroy on all registered interceptors.
+   */
+  public void destroy()
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        try
+          {
+            interceptors [ i ].destroy();
+          }
+        catch (Exception exc)
+          {
+            // OMG states we should ignore.
+          }
+      }
+  }
+
+  /**
+   * Get the class name.
+   */
+  public String name()
+  {
+    return getClass().getName();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ForwardRequestHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ForwardRequestHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ForwardRequestHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ForwardRequestHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,106 @@
+/* ForwardRequestHolder.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.CORBA.Interceptor;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.ForwardRequestHelper;
+
+/**
+ * A holder for the exception {@link ForwardRequest}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class ForwardRequestHolder implements Streamable
+{
+  /**
+   * The stored ForwardRequest value.
+   */
+  public ForwardRequest value;
+
+  /**
+   * Create the unitialised instance, leaving the value field with default
+   * <code>null</code> value.
+   */
+  public ForwardRequestHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   *
+   * @param initialValue the value that will be assigned to the
+   * <code>value</code> field.
+   */
+  public ForwardRequestHolder(ForwardRequest initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Fill in the {@link value} by data from the CDR stream.
+   *
+   * @param input the org.omg.CORBA.portable stream to read.
+   */
+  public void _read(InputStream input)
+  {
+    value = ForwardRequestHelper.read(input);
+  }
+
+  /**
+   * Write the stored value into the CDR stream.
+   *
+   * @param output the org.omg.CORBA.portable stream to write.
+   */
+  public void _write(OutputStream output)
+  {
+    ForwardRequestHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the ForwardRequest.
+   */
+  public TypeCode _type()
+  {
+    return ForwardRequestHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,190 @@
+/* IORInterceptors.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.CORBA.Interceptor;
+
+import org.omg.CORBA.OBJ_ADAPTER;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.PortableInterceptor.IORInfo;
+import org.omg.PortableInterceptor.IORInterceptor;
+import org.omg.PortableInterceptor.IORInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+
+/**
+ * A block of the all registered IOR interceptors.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class IORInterceptors implements IORInterceptor_3_0Operations
+{
+  /**
+   * The array of all registered IOR interceptors.
+   */
+  private final IORInterceptor[] interceptors;
+
+  /**
+   * Create the interceptor pack with the registerend interceptor array,
+   * obtained from the registrator.
+   */
+  public IORInterceptors(Registrator registrator)
+  {
+    interceptors = registrator.getIORInterceptors();
+  }
+
+  /**
+   * Call this method for all registered interceptors.
+   */
+  public void establish_components(IORInfo info)
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        try
+          {
+            interceptors [ i ].establish_components(info);
+          }
+        catch (Exception exc)
+          {
+            // OMG states we should ignore.
+          }
+      }
+  }
+
+  /**
+   * Call destroy on all registered interceptors.
+   */
+  public void destroy()
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        try
+          {
+            interceptors [ i ].destroy();
+          }
+        catch (Exception exc)
+          {
+            // OMG states we should ignore.
+          }
+      }
+  }
+
+  /**
+   * Get the class name.
+   */
+  public String name()
+  {
+    return getClass().getName();
+  }
+
+  /**
+   * Call this method for all registered CORBA 3.0 interceptors.
+   */
+  public void adapter_manager_state_changed(int adapterManagerId, short adapterState)
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        try
+          {
+            if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+              {
+                ((IORInterceptor_3_0Operations) interceptors[i]).
+                  adapter_manager_state_changed(adapterManagerId, adapterState);
+              }
+          }
+        catch (Exception exc)
+          {
+            OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+            oa.initCause(exc);
+            oa.minor = 6 | OMGVMCID.value;
+            throw oa;
+          }
+      }
+  }
+
+  /**
+   * Call this method for all registered CORBA 3.0 interceptors.
+   */
+  public void adapter_state_changed(ObjectReferenceTemplate[] adapters, short adaptersState)
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        try
+          {
+            if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+              {
+                ((IORInterceptor_3_0Operations) interceptors[i]).
+                  adapter_state_changed(adapters, adaptersState);
+              }
+          }
+        catch (Exception exc)
+          {
+            OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+            oa.initCause(exc);
+            oa.minor = 6 | OMGVMCID.value;
+            throw oa;
+          }
+      }
+  }
+
+  /**
+   * Call this method for all registered CORBA 3.0 interceptors.
+   * 
+   * @throws OBJ_ADAPTER minor 6 on any failure (as defined by OMG specs).
+   */
+  public void components_established(IORInfo info)
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        try
+          {
+            if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+              {
+                ((IORInterceptor_3_0Operations) interceptors[i]).
+                  components_established(info);
+              }
+          }
+        catch (Exception exc)
+          {
+            OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+            oa.initCause(exc);
+            oa.minor = 6 | OMGVMCID.value;
+            throw oa;
+          }
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,472 @@
+/* Registrator.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.CORBA.Interceptor;
+
+import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.gnuCodecFactory;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.Object;
+import org.omg.IOP.CodecFactory;
+import org.omg.PortableInterceptor.ClientRequestInterceptor;
+import org.omg.PortableInterceptor.IORInterceptor;
+import org.omg.PortableInterceptor.Interceptor;
+import org.omg.PortableInterceptor.ORBInitInfo;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName;
+import org.omg.PortableInterceptor.ORBInitializer;
+import org.omg.PortableInterceptor.ORBInitializerOperations;
+import org.omg.PortableInterceptor.PolicyFactory;
+import org.omg.PortableInterceptor.ServerRequestInterceptor;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+
+/**
+ * Collects interceptors, references and factories into arrays during
+ * registration. As the class is security sensitive, the most of the fields are
+ * private.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class Registrator extends LocalObject implements ORBInitInfo
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The agreed properties prefix.
+   */
+  public static final String m_prefix =
+    "org.omg.PortableInterceptor.ORBInitializerClass.";
+
+  /**
+   * The initialization - time server request interceptors.
+   */
+  private ArrayList m_server = new ArrayList();
+
+  /**
+   * The initialization - time client request interceptors.
+   */
+  private ArrayList m_client = new ArrayList();
+
+  /**
+   * The initialization - time ior interceptors.
+   */
+  private ArrayList m_ior = new ArrayList();
+
+  /**
+   * The policy factories.
+   */
+  public Hashtable m_policyFactories = new Hashtable();
+
+  /**
+   * The registered references. To avoid exposing the ORB's references map, the
+   * are added by ORB from inside the ORB code. The ORB is responsible for
+   * taking them from this field between pre_init and post_init.
+   */
+  public TreeMap m_references = new TreeMap();
+
+  /**
+   * The initializers.
+   */
+  public ArrayList m_initializers = new ArrayList();
+
+  /**
+   * The ORB being intialised.
+   */
+  final ORB_1_4 orb;
+
+  /**
+   * The argument string array, passed to ORB.init.
+   */
+  final String[] m_args;
+
+  /**
+   * The codec factory.
+   */
+  final gnuCodecFactory m_codecFactory;
+
+  /**
+   * Create the interceptor collection from the given properties, using the
+   * agreed naming convention.
+   *
+   * @param orb the ORB being initialised.
+   * @param props the cumulated set of properties where the orb initializer
+   * pattern is searched.
+   * @param an_args the argument string array, passed to ORB.init.
+   */
+  public Registrator(ORB_1_4 an_orb, Properties props, String[] an_args)
+  {
+    orb = an_orb;
+    m_args = an_args;
+    m_codecFactory = new gnuCodecFactory(orb);
+    checkProperties(props);
+    checkProperties(System.getProperties());
+    checkFile("user.home", null);
+    checkFile("java.home", "lib");
+  }
+
+  /**
+   * Scan the given properties for the possible interceptors.
+   */
+  private void checkProperties(Properties props)
+  {
+    if (props == null)
+      {
+        return;
+      }
+
+    Enumeration names = props.propertyNames();
+    java.lang.Object key;
+    String sk;
+
+    while (names.hasMoreElements())
+      {
+        key = names.nextElement();
+        if (key != null)
+          {
+            sk = key.toString();
+            if (sk.startsWith(m_prefix))
+              {
+                try
+                  {
+                    String cn = sk.substring(m_prefix.length());
+                    Class iClass = ObjectCreator.forName(cn);
+                    
+                    ORBInitializer initializer =
+                      (ORBInitializer) iClass.newInstance();
+                    m_initializers.add(initializer);
+                  }
+                catch (Exception exc)
+                  {
+                    // OMG states we should not throw an exception, but
+                    // this will help the user to detect his error
+                    // in initialiser properties. Should never print during
+                    // normal run.
+                    System.err.println(sk + " failed");
+                  }
+              }
+          }
+      }
+  }
+
+  /**
+   * Check if the property is defined in the existsting file orb.properties.
+   */
+  private void checkFile(String dir, String subdir)
+  {
+    try
+      {
+        File f = new File(dir);
+        if (!f.exists())
+          {
+            return;
+          }
+
+        if (subdir != null)
+          {
+            f = new File(f, subdir);
+          }
+        f = new File(f, "orb.properties");
+
+        if (!f.exists())
+          {
+            return;
+          }
+
+        Properties p = new Properties();
+        p.load(new BufferedInputStream(new FileInputStream(f)));
+
+        checkProperties(p);
+      }
+    catch (IOException ex)
+      {
+      }
+  }
+
+  /**
+   * Called by ORB as a pre_init for all initializers.
+   */
+  public void pre_init()
+  {
+    Iterator iter = m_initializers.iterator();
+    while (iter.hasNext())
+      {
+        ORBInitializerOperations initializer =
+          (ORBInitializerOperations) iter.next();
+        initializer.pre_init(this);
+      }
+  }
+
+  /**
+   * Get the map of the registered references. The ORB calls this method to
+   * import the references into its references map.
+   */
+  public Map getRegisteredReferences()
+  {
+    return m_references;
+  }
+
+  /**
+   * Called by ORB as a post-init for all initializers. After this call, the
+   * interceptor sets are fixed and redundant information is discarded.
+   */
+  public void post_init()
+  {
+    Iterator iter = m_initializers.iterator();
+    while (iter.hasNext())
+      {
+        ORBInitializerOperations initializer =
+          (ORBInitializerOperations) iter.next();
+        initializer.post_init(this);
+      }
+  }
+
+  public ServerRequestInterceptor[] getServerRequestInterceptors()
+  {
+    ServerRequestInterceptor[] iServer =
+      new ServerRequestInterceptor[ m_server.size() ];
+    for (int i = 0; i < iServer.length; i++)
+      {
+        iServer [ i ] = (ServerRequestInterceptor) m_server.get(i);
+      }
+    return iServer;
+  }
+
+  public ClientRequestInterceptor[] getClientRequestInterceptors()
+  {
+    ClientRequestInterceptor[] iClient =
+      new ClientRequestInterceptor[ m_client.size() ];
+    for (int i = 0; i < iClient.length; i++)
+      {
+        iClient [ i ] = (ClientRequestInterceptor) m_client.get(i);
+      }
+    return iClient;
+  }
+
+  public IORInterceptor[] getIORInterceptors()
+  {
+    IORInterceptor[] iIor = new IORInterceptor[ m_ior.size() ];
+    for (int i = 0; i < iIor.length; i++)
+      {
+        iIor [ i ] = (IORInterceptor) m_ior.get(i);
+      }
+    return iIor;
+  }
+
+  public void add_client_request_interceptor(
+    ClientRequestInterceptor interceptor
+  ) throws DuplicateName
+  {
+    add(m_client, interceptor);
+  }
+
+  public void add_ior_interceptor(IORInterceptor interceptor)
+    throws DuplicateName
+  {
+    add(m_ior, interceptor);
+  }
+
+  public void add_server_request_interceptor(
+    ServerRequestInterceptor interceptor
+  ) throws DuplicateName
+  {
+    add(m_server, interceptor);
+  }
+
+  /**
+   * Allocate a new slot for request - specific records.
+   */
+  public int allocate_slot_id()
+  {
+    return orb.icSlotSize++;
+  }
+
+  /**
+   * Add the interceptor to the given collection.
+   *
+   * @param list the collection to add.
+   * @param interceptor the interceptor to add.
+   */
+  private void add(ArrayList list, Interceptor interceptor)
+    throws DuplicateName
+  {
+    if (interceptor.name().length() > 0)
+      {
+        Iterator iter = list.iterator();
+        Interceptor ic;
+
+        while (iter.hasNext())
+          {
+            ic = (Interceptor) iter.next();
+            if (ic.name().equals(interceptor.name()))
+              {
+                throw new DuplicateName(interceptor.name());
+              }
+          }
+      }
+    list.add(interceptor);
+  }
+
+  /**
+   * Get string array, passed to ORB.init.
+   */
+  public String[] arguments()
+  {
+    return m_args;
+  }
+
+  /**
+   * Get the codec factory.
+   */
+  public CodecFactory codec_factory()
+  {
+    return m_codecFactory;
+  }
+
+  /**
+   * Get the ORB's id, currently using .toString.
+   */
+  public String orb_id()
+  {
+    return "orb_" + orb;
+  }
+
+  /**
+   * Register reference.
+   */
+  public void register_initial_reference(String object_name, Object object)
+    throws InvalidName
+  {
+    if (object_name == null)
+      {
+        throw new InvalidName("null");
+      }
+    else if (object_name.length() == 0)
+      {
+        throw new InvalidName("Empty string");
+      }
+    else if (m_references.containsKey(object_name))
+      {
+        throw new InvalidName(object_name);
+      }
+    else
+      {
+        m_references.put(object_name, object);
+      }
+  }
+
+  /**
+   * Accumulates the policy factory map.
+   */
+  public void register_policy_factory(int policy_type,
+    PolicyFactory policy_factory
+  )
+  {
+    Integer it = new Integer(policy_type);
+    if (m_policyFactories.containsKey(it))
+      {
+        throw new BAD_INV_ORDER(
+          "Repetetive registration of the policy factory for type " +
+          policy_type,
+          16,
+          CompletionStatus.COMPLETED_NO
+        );
+      }
+    m_policyFactories.put(it, policy_factory);
+  }
+
+  /**
+   * Delegates to ORB.
+   */
+  public org.omg.CORBA.Object resolve_initial_references(String object_name)
+    throws InvalidName
+  {
+    try
+      {
+        return orb.resolve_initial_references(object_name);
+      }
+    catch (org.omg.CORBA.ORBPackage.InvalidName e)
+      {
+        InvalidName in = new InvalidName(e.getMessage());
+        in.initCause(e);
+        throw in;
+      }
+  }
+
+  /**
+   * Check if any interceptors of this type were registered.
+   */
+  public boolean hasClientRequestInterceptors()
+  {
+    return m_client.size() > 0;
+  }
+
+  /**
+   * Check if any interceptors of this type were registered.
+   */
+  public boolean hasServerRequestInterceptors()
+  {
+    return m_server.size() > 0;
+  }
+
+  /**
+   * Check if any interceptors of this type were registered.
+   */
+  public boolean hasIorInterceptors()
+  {
+    return m_ior.size() > 0;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ServerRequestInterceptors.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ServerRequestInterceptors.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ServerRequestInterceptors.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/ServerRequestInterceptors.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,139 @@
+/* ServerRequestInterceptors.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.CORBA.Interceptor;
+
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.ServerRequestInfo;
+import org.omg.PortableInterceptor.ServerRequestInterceptor;
+import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
+
+/**
+ * A block of the all registered ServerRequest interceptors.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class ServerRequestInterceptors
+  implements ServerRequestInterceptorOperations
+{
+  /**
+   * The array of all registered ServerRequest interceptors.
+   */
+  private final ServerRequestInterceptor[] interceptors;
+
+  /**
+   * Create the interceptor pack with the registerend interceptor array,
+   * obtained from the registrator.
+   */
+  public ServerRequestInterceptors(Registrator registrator)
+  {
+    interceptors = registrator.getServerRequestInterceptors();
+  }
+
+  /** @inheritDoc */
+  public void receive_request_service_contexts(ServerRequestInfo info)
+    throws ForwardRequest
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].receive_request_service_contexts(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void receive_request(ServerRequestInfo info) throws ForwardRequest
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].receive_request(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void send_exception(ServerRequestInfo info) throws ForwardRequest
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].send_exception(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void send_other(ServerRequestInfo info) throws ForwardRequest
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].send_other(info);
+      }
+  }
+
+  /** @inheritDoc */
+  public void send_reply(ServerRequestInfo info)
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        interceptors [ i ].send_reply(info);
+      }
+  }
+
+  /**
+   * Call destroy on all registered interceptors.
+   */
+  public void destroy()
+  {
+    for (int i = 0; i < interceptors.length; i++)
+      {
+        try
+          {
+            interceptors [ i ].destroy();
+          }
+        catch (Exception exc)
+          {
+            // OMG states we should ignore.
+          }
+      }
+  }
+
+  /**
+   * Get the class name.
+   */
+  public String name()
+  {
+    return getClass().getName();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuClientRequestInfo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuClientRequestInfo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuClientRequestInfo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuClientRequestInfo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,337 @@
+/* gnuClientRequestInfo.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.CORBA.Interceptor;
+
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.gnuRequest;
+
+import org.omg.CORBA.ARG_IN;
+import org.omg.CORBA.ARG_INOUT;
+import org.omg.CORBA.ARG_OUT;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.INV_POLICY;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ParameterMode;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.Dynamic.Parameter;
+import org.omg.IOP.ServiceContext;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.TaggedProfile;
+import org.omg.PortableInterceptor.ClientRequestInfo;
+import org.omg.PortableInterceptor.InvalidSlot;
+
+/**
+ * Client request info. All requests on the client side in Classpath
+ * implementations are handled via gnuRequest class. This class holds the
+ * instance of the gnuRequest, accessing the request info this way.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuClientRequestInfo extends LocalObject
+  implements ClientRequestInfo
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The request structure, from that some methods take the needed information
+   * directly. The same request structure cannot be reused in parallel threads,
+   * the submission methods are synchronized.
+   */
+  private final gnuRequest request;
+
+  /**
+   * Provides possibility to set the wrapped thrown exception explicitly, where
+   * applicable.
+   */
+  public Any m_wrapped_exception;
+
+  /**
+   * Create the info on the given request.
+   */
+  public gnuClientRequestInfo(gnuRequest a_request)
+  {
+    request = a_request;
+  }
+
+  /** @inheritDoc */
+  public void add_request_service_context(ServiceContext service_context,
+    boolean replace
+  )
+  {
+    request.add_request_service_context(service_context, replace);
+  }
+
+  /** @inheritDoc */
+  public TaggedProfile effective_profile()
+  {
+    return request.effective_profile();
+  }
+
+  /** @inheritDoc */
+  public org.omg.CORBA.Object effective_target()
+  {
+    return request.effective_target();
+  }
+
+  /** @inheritDoc */
+  public TaggedComponent get_effective_component(int id)
+    throws BAD_PARAM
+  {
+    return request.get_effective_component(id);
+  }
+
+  /** @inheritDoc */
+  public TaggedComponent[] get_effective_components(int id)
+    throws BAD_PARAM
+  {
+    return request.get_effective_components(id);
+  }
+
+  /** @inheritDoc */
+  public Policy get_request_policy(int type) throws INV_POLICY
+  {
+    return request.get_request_policy(type);
+  }
+
+  /** @inheritDoc */
+  public String received_exception_id()
+  {
+    try
+      {
+        if (m_wrapped_exception != null)
+          {
+            return m_wrapped_exception.type().id();
+          }
+        else
+          {
+            return request.received_exception_id();
+          }
+      }
+    catch (BadKind e)
+      {
+        throw new Unexpected(e);
+      }
+  }
+
+  /** @inheritDoc */
+  public Any received_exception()
+  {
+    if (m_wrapped_exception != null)
+      {
+        return m_wrapped_exception;
+      }
+    else
+      {
+        return request.received_exception();
+      }
+  }
+
+  /** @inheritDoc */
+  public org.omg.CORBA.Object target()
+  {
+    return request.target();
+  }
+
+  /** @inheritDoc */
+  public Parameter[] arguments()
+  {
+    request.checkDii();
+
+    NVList args = request.arguments();
+    Parameter[] p = new Parameter[ args.count() ];
+    try
+      {
+        for (int i = 0; i < p.length; i++)
+          {
+            ParameterMode mode;
+
+            switch (args.item(i).flags())
+              {
+                case ARG_IN.value :
+                  mode = ParameterMode.PARAM_IN;
+                  break;
+
+                case ARG_OUT.value :
+                  mode = ParameterMode.PARAM_OUT;
+                  break;
+
+                case ARG_INOUT.value :
+                  mode = ParameterMode.PARAM_INOUT;
+                  break;
+
+                default :
+                  throw new Unexpected();
+              }
+
+            p [ i ] = new Parameter(args.item(i).value(), mode);
+          }
+      }
+    catch (Bounds e)
+      {
+        throw new Unexpected(e);
+      }
+    return p;
+  }
+
+  /** @inheritDoc */
+  public Any result()
+  {
+    request.checkDii();
+
+    Any rt = request.return_value();
+
+    if (rt == null)
+      {
+        ORB orb = request.orb();
+        rt = orb.create_any();
+        rt.type(orb.get_primitive_tc(TCKind.tk_void));
+        return rt;
+      }
+
+    return request.return_value();
+  }
+
+  /** @inheritDoc */
+  public String[] contexts()
+  {
+    return request.ice_contexts();
+  }
+
+  /** @inheritDoc */
+  public TypeCode[] exceptions()
+  {
+    request.checkDii();
+
+    ExceptionList ex = request.exceptions();
+    TypeCode[] et = new TypeCode[ ex.count() ];
+    try
+      {
+        for (int i = 0; i < et.length; i++)
+          {
+            et [ i ] = ex.item(i);
+          }
+      }
+    catch (Bounds e)
+      {
+        throw new Unexpected(e);
+      }
+    return et;
+  }
+
+  /** @inheritDoc */
+  public org.omg.CORBA.Object forward_reference()
+  {
+    return request.forward_reference();
+  }
+
+  /** @inheritDoc */
+  public String[] operation_context()
+  {
+    return request.operation_context();
+  }
+
+  /** @inheritDoc */
+  public Any get_slot(int id) throws InvalidSlot
+  {
+    return request.get_slot(id);
+  }
+
+  /** @inheritDoc */
+  public String operation()
+  {
+    return request.operation();
+  }
+
+  /** @inheritDoc */
+  public short reply_status()
+  {
+    return request.reply_status();
+  }
+
+  /** @inheritDoc */
+  public int request_id()
+  {
+    return request.request_id();
+  }
+
+  /** @inheritDoc */
+  public boolean response_expected()
+  {
+    return request.response_expected();
+  }
+
+  /**
+       * Determines how far the request shall progress before control is returned to
+   * the client. However up till JDK 1.5 inclusive this method always returns
+   * SYNC_WITH_TRANSPORT.
+   *
+   * @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT.value (1), always.
+   *
+   * @specnote as defined in the Suns 1.5 JDK API.
+   */
+  public short sync_scope()
+  {
+    return request.sync_scope();
+  }
+
+  /** @inheritDoc */
+  public ServiceContext get_reply_service_context(int ctx_name)
+    throws BAD_PARAM
+  {
+    return request.get_reply_service_context(ctx_name);
+  }
+
+  /** @inheritDoc */
+  public ServiceContext get_request_service_context(int ctx_name)
+    throws BAD_PARAM
+  {
+    return request.get_request_service_context(ctx_name);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,255 @@
+/* gnuIcCurrent.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.CORBA.Interceptor;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.Poa.ORB_1_4;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableInterceptor.Current;
+import org.omg.PortableInterceptor.CurrentHelper;
+import org.omg.PortableInterceptor.InvalidSlot;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Supports the "Interceptor current" concept, providing the slot value
+ * information for the current thread. When making the invocation, this
+ * information is copied to the Current, returned by ClientRequestInfo.
+ *
+ * There is only one instance of this class per ORB. It maintains a thread to
+ * information map.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuIcCurrent extends ObjectImpl implements Current
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The ORB, controllin this Current. It provides data about the required size
+   * of the slot array.
+   */
+  final ORB_1_4 orb;
+
+  /**
+   * The table, mapping threads to records.
+   */
+  private Hashtable threads = new Hashtable();
+
+  /**
+   * An empty array when no slots are defined, computed once.
+   */
+  static final Any[] NO_SLOTS = new Any[ 0 ];
+
+  /**
+   * Create the IC current.
+   */
+  public gnuIcCurrent(ORB_1_4 an_orb)
+  {
+    orb = an_orb;
+  }
+
+  /**
+   * Get the array of POA current repository ids.
+   *
+   * @return a single member array, containing value, returned by the
+   * {@link CurrentHelper#id}, normally
+   * "IDL:omg.org/PortableInterceptor/Current:1.0".
+   */
+  public String[] _ids()
+  {
+    return new String[] { CurrentHelper.id() };
+  }
+
+  /**
+   * Add the entry to the map.
+   */
+  public void put(Thread t, Any[] record)
+  {
+    synchronized (threads)
+      {
+        threads.put(t, record);
+
+        // Remove non-running threads, avoiding memory leak.
+        if (threads.size() > 12)
+          {
+            Iterator it = threads.entrySet().iterator();
+            while (it.hasNext())
+              {
+                Map.Entry e = (Map.Entry) it.next();
+                Thread tx = (Thread) e.getKey();
+                if (!tx.isAlive())
+                  {
+                    it.remove();
+                  }
+              }
+          }
+      }
+  }
+
+  /**
+   * Check if this thread is registered.
+   */
+  public boolean has(Thread t)
+  {
+    synchronized (threads)
+      {
+        return threads.containsKey(t);
+      }
+  }
+
+  /**
+   * Remove the entry from the map.
+   */
+  public void remove(Thread t)
+  {
+    synchronized (threads)
+      {
+        threads.remove(t);
+      }
+  }
+
+  /**
+   * Get array of all slots, as it is applicable for the current thread. If the
+   * slots were not previously allocated, they are allocated during this call.
+   */
+  Any[] get_slots()
+  {
+    Any[] r;
+    synchronized (threads)
+      {
+        r = (Any[]) threads.get(Thread.currentThread());
+        if (r == null)
+          {
+            r = new Any[ orb.icSlotSize ];
+
+            for (int i = 0; i < r.length; i++)
+              {
+                Any a = orb.create_any();
+                a.type(orb.get_primitive_tc(TCKind.tk_null));
+                r [ i ] = a;
+              }
+
+            put(Thread.currentThread(), r);
+          }
+        return r;
+      }
+  }
+
+  /**
+       * Get copu array of all slots, as it is applicable for the current thread. If
+   * the slots were not previously allocated, they are allocated during this
+   * call.
+   */
+  public Any[] clone_slots()
+  {
+    if (orb.icSlotSize == 0)
+      {
+        return NO_SLOTS;
+      }
+    else
+      {
+        Any[] r = get_slots();
+        Any[] copy = new Any[ r.length ];
+
+        BufferedCdrOutput buf = new BufferedCdrOutput();
+        buf.setOrb(orb);
+
+        for (int i = 0; i < copy.length; i++)
+          {
+            r [ i ].write_value(buf);
+          }
+
+        InputStream input = buf.create_input_stream();
+
+        for (int i = 0; i < copy.length; i++)
+          {
+            copy [ i ] = orb.create_any();
+            copy [ i ].read_value(input, r [ i ].type());
+          }
+
+        return copy;
+      }
+  }
+
+  /**
+   * Get value for the slot with the given id. If the array of Currents has not
+   * been yet allocated for the current thread, it is allocated during the
+   * invocation of this method.
+   */
+  public Any get_slot(int slot_id) throws InvalidSlot, BAD_INV_ORDER
+  {
+    try
+      {
+        return get_slots() [ slot_id ];
+      }
+    catch (ArrayIndexOutOfBoundsException e)
+      {
+        throw new InvalidSlot("Slot " + slot_id);
+      }
+  }
+
+  /**
+   * Set value for the slot with the given id. If the array of Currents has not
+   * been yet allocated for the current thread, it is allocated during the
+   * invocation of this method.
+   */
+  public void set_slot(int slot_id, Any data)
+    throws InvalidSlot, BAD_INV_ORDER
+  {
+    try
+      {
+        get_slots() [ slot_id ] = data;
+      }
+    catch (ArrayIndexOutOfBoundsException e)
+      {
+        throw new InvalidSlot("Slot " + slot_id);
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,156 @@
+/* gnuIorInfo.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.CORBA.Interceptor;
+
+import gnu.CORBA.IOR;
+import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Poa.gnuPOA;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.Policy;
+import org.omg.IOP.TaggedComponent;
+import org.omg.PortableInterceptor.IORInfo;
+import org.omg.PortableInterceptor.ObjectReferenceFactory;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+
+/**
+ * Implements IORInfo.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuIorInfo extends LocalObject implements IORInfo
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The ORB, to that the IOR is related.
+   */
+  public final ORB_1_4 orb;
+
+  /**
+   * The POA, to that IOR is related.
+   */
+  public final gnuPOA poa;
+
+  /**
+   * The IOR itself.
+   */
+  private final IOR ior;
+
+  /**
+   * Create an instance.
+   */
+  public gnuIorInfo(ORB_1_4 an_orb, gnuPOA a_poa, IOR an_ior)
+  {
+    orb = an_orb;
+    poa = a_poa;
+    ior = an_ior;
+  }
+
+  /**
+   * Add component to tje specified profile of this IOR.
+   */
+  public void add_ior_component_to_profile(TaggedComponent tagged_component,
+    int profile_id
+  )
+  {
+    ior.add_ior_component_to_profile(tagged_component, profile_id);
+  }
+
+  /**
+   * Add component to all found profiles in this IOR.
+   */
+  public void add_ior_component(TaggedComponent tagged_component)
+  {
+    ior.add_ior_component(tagged_component);
+  }
+
+  /**
+   * Get the POA policy.
+   */
+  public Policy get_effective_policy(int policy_type)
+  {
+    return poa._get_policy(policy_type);
+  }
+
+  /**
+   * Return the state of the object POA.
+   */
+  public short state()
+  {
+    return (short) poa.the_POAManager().get_state().value();
+  }
+
+  /**
+   * Get the adapter template, associated with this poa.
+   */
+  public ObjectReferenceTemplate adapter_template()
+  {
+    return poa.getReferenceTemplate();
+  }
+
+  /**
+   * Get the object factory of the current POA.
+   */
+  public ObjectReferenceFactory current_factory()
+  {
+    return poa.getReferenceFactory();
+  }
+
+  /**
+   * Set the object factory of the current POA. 
+   */
+  public void current_factory(ObjectReferenceFactory factory)
+  {
+    poa.setReferenceFactory(factory);
+  }
+
+  /**
+   * The method currently uses system identity hashcode that should be 
+   * different for each object.
+   */
+  public int manager_id()
+  {
+    // The System.identityHashCode is also called in gnuPoaManager.    
+    return System.identityHashCode(poa.the_POAManager());
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,476 @@
+/* gnuServerRequestInfo.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.CORBA.Interceptor;
+
+import gnu.CORBA.GIOP.ReplyHeader;
+import gnu.CORBA.GIOP.RequestHeader;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.Poa.gnuServantObject;
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.gnuRequest;
+
+import org.omg.CORBA.ARG_IN;
+import org.omg.CORBA.ARG_INOUT;
+import org.omg.CORBA.ARG_OUT;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.INV_POLICY;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.ParameterMode;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.Dynamic.Parameter;
+import org.omg.IOP.ServiceContext;
+import org.omg.Messaging.SYNC_WITH_TRANSPORT;
+import org.omg.PortableInterceptor.InvalidSlot;
+import org.omg.PortableInterceptor.ServerRequestInfo;
+
+/**
+ * Implementation of the ServerRequestInfo, associacted with gnuServantObject.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuServerRequestInfo extends LocalObject
+  implements ServerRequestInfo
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * A local object that will serve the invocation.
+   */
+  final gnuServantObject m_object;
+
+  /**
+   * A message that the given resource is not available using this metod of
+   * invocation.
+   */
+  static final String not_available =
+    "The used invocation method provides" + "no access to this resource.";
+
+  /**
+   * An array of slots.
+   */
+  Any[] m_slots;
+
+  /**
+   * The request header.
+   */
+  public final RequestHeader m_request_header;
+
+  /**
+   * The reply header.
+   */
+  public final ReplyHeader m_reply_header;
+
+  /**
+   * The forward reference, if applicable.
+   */
+  public Object m_forward_reference;
+
+  /**
+   * The thrown systen exception.
+   */
+  public Exception m_sys_exception;
+
+  /**
+   * The Any, containing the thrown user exception.
+   */
+  public Any m_usr_exception;
+
+  /**
+   * The associated request, if any.
+   */
+  public gnuRequest m_request;
+
+  /**
+   * Create a new instance at the time when it is known which object will serve
+   * the invocation.
+   *
+   * @param an_object a local object, connected to the local servant that will
+   * serve the invocation.
+   */
+  public gnuServerRequestInfo(gnuServantObject an_object,
+    RequestHeader a_request_header, ReplyHeader a_reply_header
+  )
+  {
+    m_object = an_object;
+    m_request_header = a_request_header;
+    m_reply_header = a_reply_header;
+    m_slots = new Any[ m_object.orb.icSlotSize ];
+    reset();
+  }
+
+  /**
+   * Set the give slot.
+   */
+  public void set_slot(int id, Any data) throws InvalidSlot
+  {
+    try
+      {
+        m_slots [ id ] = data;
+      }
+    catch (Exception e)
+      {
+        InvalidSlot ex = new InvalidSlot("Cannot set slot " + id);
+        ex.initCause(e);
+        throw ex;
+      }
+  }
+
+  /**
+   * Get the given slot.
+   */
+  public Any get_slot(int id) throws InvalidSlot
+  {
+    try
+      {
+        return m_slots [ id ];
+      }
+    catch (Exception e)
+      {
+        InvalidSlot ex = new InvalidSlot("Cannot get slot " + id);
+        ex.initCause(e);
+        throw ex;
+      }
+  }
+
+  /**
+   * Reset slot data.
+   */
+  public void reset()
+  {
+    TypeCode tkNull = m_object.orb.get_primitive_tc(TCKind.tk_null);
+    for (int i = 0; i < m_slots.length; i++)
+      {
+        Any a = m_object.orb.create_any();
+        a.type(tkNull);
+        m_slots [ i ] = a;
+      }
+    m_sys_exception = null;
+    m_usr_exception = null;
+  }
+
+  /**
+   * Get the object id (not the object IOR key).
+   */
+  public byte[] object_id()
+  {
+    return m_object.Id;
+  }
+
+  /**
+   * Check if the target is an instance of the type, represented by the given
+   * repository Id.
+   */
+  public boolean target_is_a(String id)
+  {
+    return m_object._is_a(id);
+  }
+
+  /**
+   * Get the POA id.
+   */
+  public byte[] adapter_id()
+  {
+    return m_object.poa.id();
+  }
+
+  /**
+   * Get the POA policy of the given type that applies to the object being
+   * served (request being handled).
+   */
+  public Policy get_server_policy(int type) throws INV_POLICY
+  {
+    return m_object.poa._get_policy(type);
+  }
+
+  /**
+   * Get the first member of the object repository id array.
+   */
+  public String target_most_derived_interface()
+  {
+    return m_object._ids() [ 0 ];
+  }
+
+  /**
+   * Get the name of the operation being performed.
+   */
+  public String operation()
+  {
+    if (m_request != null)
+      {
+        return m_request.operation();
+      }
+    else
+      {
+        return m_request_header.operation;
+      }
+  }
+
+  /**
+   * Not available.
+   */
+  public TypeCode[] exceptions()
+  {
+    if (m_request == null)
+      {
+        throw new NO_RESOURCES(not_available, 1,
+          CompletionStatus.COMPLETED_MAYBE
+        );
+      }
+
+    m_request.checkDii();
+
+    ExceptionList ex = m_request.exceptions();
+    TypeCode[] et = new TypeCode[ ex.count() ];
+    try
+      {
+        for (int i = 0; i < et.length; i++)
+          {
+            et [ i ] = ex.item(i);
+          }
+      }
+    catch (Bounds e)
+      {
+        throw new Unexpected(e);
+      }
+    return et;
+  }
+
+  /**
+   * Get reply status.
+   */
+  public short reply_status()
+  {
+    return (short) m_reply_header.reply_status;
+  }
+
+  /**
+   * Get request id. All local requests have request id = -1.
+   */
+  public int request_id()
+  {
+    return m_request_header.request_id;
+  }
+
+  /**
+   * Check if the client expected any response.
+   */
+  public boolean response_expected()
+  {
+    return m_request_header.isResponseExpected();
+  }
+
+  /** @inheritDoc */
+  public void add_reply_service_context(ServiceContext service_context,
+    boolean replace
+  )
+  {
+    m_reply_header.addContext(service_context, replace);
+  }
+
+  /**
+   * Get an exception, wrapped into Any.
+   */
+  public Any sending_exception()
+  {
+    if (m_usr_exception != null)
+      {
+        return m_usr_exception;
+      }
+    else if (m_sys_exception != null)
+      {
+        Any a = m_object.orb.create_any();
+        ObjectCreator.insertException(a, m_sys_exception);
+        return a;
+      }
+    else
+      {
+        return null;
+      }
+  }
+
+  public org.omg.CORBA.Object forward_reference()
+  {
+    return m_forward_reference;
+  }
+
+  /** @inheritDoc */
+  public ServiceContext get_reply_service_context(int ctx_name)
+    throws BAD_PARAM
+  {
+    return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,
+      m_reply_header.service_context
+    );
+  }
+
+  /** @inheritDoc */
+  public ServiceContext get_request_service_context(int ctx_name)
+    throws BAD_PARAM
+  {
+    return gnu.CORBA.GIOP.ServiceContext.findContext(ctx_name,
+      m_request_header.service_context
+    );
+  }
+
+  /**
+   * Not available
+   */
+  public String[] operation_context()
+  {
+    if (m_request == null)
+      {
+        throw new NO_RESOURCES(not_available);
+      }
+    else
+      {
+        return m_request.operation_context();
+      }
+  }
+
+  /** @inheritDoc */
+  public Any result()
+  {
+    if (m_request == null)
+      {
+        throw new NO_RESOURCES(not_available);
+      }
+    else
+      {
+        return m_request.return_value();
+      }
+  }
+
+  /** @inheritDoc */
+  public String[] contexts()
+  {
+    if (m_request == null)
+      {
+        throw new NO_RESOURCES(not_available);
+      }
+    else
+      {
+        return m_request.ice_contexts();
+      }
+  }
+
+  /**
+   * Always returns "with transport".
+   */
+  public short sync_scope()
+  {
+    return SYNC_WITH_TRANSPORT.value;
+  }
+
+  /** @inheritDoc */
+  public Parameter[] arguments()
+  {
+    if (m_request == null)
+      {
+        throw new NO_RESOURCES(not_available);
+      }
+
+    m_request.checkDii();
+
+    NVList args = m_request.arguments();
+    Parameter[] p = new Parameter[ args.count() ];
+    try
+      {
+        for (int i = 0; i < p.length; i++)
+          {
+            ParameterMode mode;
+
+            switch (args.item(i).flags())
+              {
+                case ARG_IN.value :
+                  mode = ParameterMode.PARAM_IN;
+                  break;
+
+                case ARG_OUT.value :
+                  mode = ParameterMode.PARAM_OUT;
+                  break;
+
+                case ARG_INOUT.value :
+                  mode = ParameterMode.PARAM_INOUT;
+                  break;
+
+                default :
+                  throw new Unexpected();
+              }
+
+            p [ i ] = new Parameter(args.item(i).value(), mode);
+          }
+      }
+    catch (Bounds e)
+      {
+        throw new Unexpected(e);
+      }
+    return p;
+  }
+
+  /** @inheritDoc */
+  public String[] adapter_name()
+  {
+    return m_object.poa.getReferenceTemplate().adapter_name();
+  }
+
+  /** @inheritDoc */
+  public String orb_id()
+  {
+    return m_object.orb.orb_id;
+  }
+
+  /** @inheritDoc */
+  public String server_id()
+  {
+    return OrbFunctional.server_id;
+  }
+  
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,429 @@
+/* gnuDelegate.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.CORBA;
+
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.GIOP.ReplyHeader;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.PortableInterceptor.ForwardRequest;
+
+import java.io.IOException;
+
+import java.net.Socket;
+
+/**
+ * The Classpath implementation of the {@link Delegate} functionality in the
+ * case, when the object was constructed from an IOR object. The IOR can be
+ * constructed from the stringified object reference.
+ *
+ * There is an different instance of this delegate for each CORBA object.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class IorDelegate extends SimpleDelegate
+{
+  /**
+   * Contructs an instance of object using the given IOR.
+   */
+  public IorDelegate(ORB an_orb, IOR an_ior)
+  {
+    super(an_orb, an_ior);
+  }
+
+  /**
+   * Creates the request to invoke the method on this object.
+   *
+   * @param target the object, for that the operation must be invoked.
+   * @param context context (null allowed)
+   * @param operation the method name
+   * @param parameters the method parameters
+   * @param returns the return value holder
+   * @param exceptions the exceptions that can be thrown by the method
+   * @param ctx_list the context list (null allowed)
+   *
+   * @return the created request.
+   */
+  public Request create_request(org.omg.CORBA.Object target, Context context,
+    String operation, NVList parameters, NamedValue returns
+  )
+  {
+    gnuRequest request = getRequestInstance(target);
+
+    request.setIor(getIor());
+    request.set_target(target);
+
+    request.setOperation(operation);
+    request.set_args(parameters);
+    request.m_context = context;
+    request.set_result(returns);
+    request.setORB(orb);
+
+    return request;
+  }
+
+  /**
+   * Creates the request to invoke the method on this object.
+   *
+   * @param target the object, for that the operation must be invoked.
+   * @param context context (null allowed)
+   * @param operation the method name
+   * @param parameters the method parameters
+   * @param returns the return value holder
+   *
+   * @return the created request.
+   */
+  public Request create_request(org.omg.CORBA.Object target, Context context,
+    String operation, NVList parameters, NamedValue returns,
+    ExceptionList exceptions, ContextList ctx_list
+  )
+  {
+    gnuRequest request = getRequestInstance(target);
+
+    request.setIor(ior);
+    request.set_target(target);
+
+    request.setOperation(operation);
+    request.set_args(parameters);
+    request.m_context = context;
+    request.set_result(returns);
+    request.set_exceptions(exceptions);
+    request.set_context_list(ctx_list);
+    request.setORB(orb);
+
+    return request;
+  }
+
+  /**
+   * Get the instance of request.
+   */
+  protected gnuRequest getRequestInstance(org.omg.CORBA.Object target)
+  {
+    return new gnuRequest();
+  }
+
+  /**
+   * Invoke operation on the given object, als handling temproray and permanent
+   * redirections. The ReplyHeader.LOCATION_FORWARD will cause to resend the
+   * request to the new direction. The ReplyHeader.LOCATION_FORWARD_PERM will
+   * cause additionally to remember the new location by this delegate, so
+   * subsequent calls will be immediately delivered to the new target.
+   * 
+   * @param target the target object.
+   * @param output the output stream, previously returned by
+   * {@link #request(org.omg.CORBA.Object, String, boolean)}.
+   * 
+   * @return the input stream, to read the response from or null for a one-way
+   * request.
+   * 
+   * @throws SystemException if the SystemException has been thrown on the
+   * remote side (the exact type and the minor code matches the data of the
+   * remote exception that has been thrown).
+   * 
+   * @throws org.omg.CORBA.portable.ApplicationException as specified.
+   * @throws org.omg.CORBA.portable.RemarshalException as specified.
+   */
+  public InputStream invoke(org.omg.CORBA.Object target, OutputStream output)
+    throws ApplicationException, RemarshalException
+  {
+    StreamBasedRequest request = (StreamBasedRequest) output;
+    Forwardings: while (true)
+      {
+        try
+          {
+            if (request.response_expected)
+              {
+                RawReply response = request.request.submit();
+
+                // Read reply header.
+                ReplyHeader rh = response.header.create_reply_header();
+                BufferredCdrInput input = response.getStream();
+                input.setOrb(orb);
+                rh.read(input);
+                request.request.m_rph = rh;
+
+                boolean moved_permanently = false;
+
+                switch (rh.reply_status)
+                  {
+                    case ReplyHeader.NO_EXCEPTION:
+                      if (request.request.m_interceptor != null)
+                        request.request.m_interceptor.receive_reply(request.request.m_info);
+                      if (response.header.version.since_inclusive(1, 2))
+                        input.align(8);
+                      return input;
+
+                    case ReplyHeader.SYSTEM_EXCEPTION:
+                      if (response.header.version.since_inclusive(1, 2))
+                        input.align(8);
+                      showException(request, input);
+
+                      throw ObjectCreator.readSystemException(input,
+                        rh.service_context);
+
+                    case ReplyHeader.USER_EXCEPTION:
+                      if (response.header.version.since_inclusive(1, 2))
+                        input.align(8);
+                      showException(request, input);
+
+                      throw new ApplicationException(
+                        request.request.m_exception_id, input);
+
+                    case ReplyHeader.LOCATION_FORWARD_PERM:
+                      moved_permanently = true;
+
+                    case ReplyHeader.LOCATION_FORWARD:
+                      if (response.header.version.since_inclusive(1, 2))
+                        input.align(8);
+
+                      IOR forwarded = new IOR();
+                      try
+                        {
+                          forwarded._read_no_endian(input);
+                        }
+                      catch (IOException ex)
+                        {
+                          MARSHAL t = new MARSHAL("Cant read forwarding info",
+                            5102, CompletionStatus.COMPLETED_NO);
+                          t.initCause(ex);
+                          throw t;
+                        }
+
+                      gnuRequest prev = request.request;
+                      gnuRequest r = getRequestInstance(target);
+
+                      r.m_interceptor = prev.m_interceptor;
+                      r.m_slots = prev.m_slots;
+
+                      r.m_args = prev.m_args;
+                      r.m_context = prev.m_context;
+                      r.m_context_list = prev.m_context_list;
+                      r.m_environment = prev.m_environment;
+                      r.m_exceptions = prev.m_exceptions;
+                      r.m_operation = prev.m_operation;
+                      r.m_parameter_buffer = prev.m_parameter_buffer;
+                      r.m_parameter_buffer.request = r;
+                      r.m_result = prev.m_result;
+                      r.m_target = prev.m_target;
+                      r.oneWay = prev.oneWay;
+                      r.m_forward_ior = forwarded;
+
+                      if (r.m_interceptor != null)
+                        r.m_interceptor.receive_other(r.m_info);
+
+                      r.setIor(forwarded);
+
+                      IorObject it = new IorObject(orb,
+                        forwarded);
+
+                      r.m_target = it;
+
+                      request.request = r;
+
+                      IOR prev_ior = getIor();
+
+                      setIor(forwarded);
+
+                      try
+                        {
+                          return invoke(it, request);
+                        }
+                      finally
+                        {
+                          if (!moved_permanently)
+                            setIor(prev_ior);
+                        }
+
+                    default:
+                      throw new MARSHAL("Unknow reply status: "
+                        + rh.reply_status, 8000 + rh.reply_status,
+                        CompletionStatus.COMPLETED_NO);
+                  }
+              }
+            else
+              {
+                request.request.send_oneway();
+                return null;
+              }
+          }
+        catch (ForwardRequest forwarded)
+          {
+            ForwardRequest fw = forwarded;
+            Forwarding2: while (true)
+              {
+                try
+                  {
+                    gnuRequest prev = request.request;
+                    gnuRequest r = getRequestInstance(target);
+
+                    r.m_interceptor = prev.m_interceptor;
+                    r.m_args = prev.m_args;
+                    r.m_context = prev.m_context;
+                    r.m_context_list = prev.m_context_list;
+                    r.m_environment = prev.m_environment;
+                    r.m_exceptions = prev.m_exceptions;
+                    r.m_operation = prev.m_operation;
+                    r.m_parameter_buffer = prev.m_parameter_buffer;
+                    r.m_parameter_buffer.request = r;
+                    r.m_result = prev.m_result;
+                    r.m_target = prev.m_target;
+                    r.oneWay = prev.oneWay;
+
+                    r.m_forwarding_target = fw.forward;
+
+                    if (r.m_interceptor != null)
+                      r.m_interceptor.receive_other(r.m_info);
+
+                    r.m_target = fw.forward;
+                    request.request = r;
+                    break Forwarding2;
+                  }
+                catch (ForwardRequest e)
+                  {
+                    forwarded = e;
+                  }
+              }
+          }
+      }
+  }
+
+  /**
+   * Show exception to interceptor.
+   */
+  void showException(StreamBasedRequest request, BufferredCdrInput input)
+    throws ForwardRequest
+  {
+    input.mark(2048);
+    request.request.m_exception_id = input.read_string();
+    input.reset();
+
+    if (request.request.m_interceptor != null)
+      request.request.m_interceptor.receive_exception(request.request.m_info);
+  }
+
+  /**
+   * Create a request to invoke the method of this CORBA object.
+   *
+   * @param target the CORBA object, to that this operation must be applied.
+   * @param operation the name of the method to invoke.
+   *
+   * @return the request.
+   */
+  public Request request(org.omg.CORBA.Object target, String operation)
+  {
+    gnuRequest request = getRequestInstance(target);
+
+    request.setIor(ior);
+    request.set_target(target);
+
+    request.setOperation(operation);
+    request.setORB(orb);
+
+    return request;
+  }
+
+  /**
+   * Create a request to invoke the method of this CORBA object.
+   *
+   * @param target the CORBA object, to that this operation must be applied.
+   * @param operation the name of the method to invoke.
+   * @param response_expected specifies if this is one way message or the
+   * response to the message is expected.
+   *
+   * @return the stream where the method arguments should be written.
+   */
+  public OutputStream request(org.omg.CORBA.Object target, String operation,
+    boolean response_expected
+  )
+  {
+    gnuRequest request = getRequestInstance(target);
+
+    request.setIor(ior);
+    request.set_target(target);
+    request.setOperation(operation);
+
+    StreamBasedRequest out = request.getParameterStream();
+    out.response_expected = response_expected;
+    request.setORB(orb);
+    out.setOrb(orb);
+
+    return out;
+  }
+
+  /**
+   * If there is an opened cache socket to access this object, close that
+   * socket.
+   *
+   * @param target The target is not used, this delegate requires a single
+   * instance per object.
+   */
+  public void release(org.omg.CORBA.Object target)
+  {
+    // Do nothing here.
+  }
+
+  /**
+   * Reset the remote_ior flag, forcing to check if the object is local on the
+   * next getRequestInstance call.
+   */
+  public void setIor(IOR an_ior)
+  {
+    super.setIor(an_ior);
+  }
+
+  /**
+   * Checks if the ior is local so far it is easy.
+   */
+  public boolean is_local(org.omg.CORBA.Object self)
+  {
+    return false;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorObject.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorObject.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorObject.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorObject.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* IorObject.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.CORBA;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.ObjectImpl;
+
+/**
+ * Implements an object, constructed from an IOR reference.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class IorObject
+  extends ObjectImpl
+  implements IorProvider
+{
+  /**
+   * The IOR, from which the object was constructed.
+   */
+  protected final IOR ior;
+
+  /**
+   * The object id, as defined in IOR.
+   */
+  protected final String[] id;
+
+  /**
+   * Create the object from the given IOR.
+   *
+   * @param an_ior the IOR.
+   */
+  public IorObject(ORB orb, IOR an_ior)
+  {
+    ior = an_ior;
+    _set_delegate(new IorDelegate(orb, ior));
+    id = new String[] { ior.Id };
+  }
+
+  /**
+   * Create the object from the given string IOR representation.
+   *
+   * @param an_ior the IOR in the string form.
+   */
+  public IorObject(OrbFunctional orb, String an_ior)
+  {
+    ior = IOR.parse(an_ior);
+    _set_delegate(new IorDelegate(orb, ior));
+    id = new String[] { ior.Id };
+  }
+  
+  /**
+   * Get the IOR of this object.
+   */
+  public IOR getIor()
+  {
+    return ior;
+  }
+
+  public String[] _ids()
+  {
+    return id;
+  }
+
+  /**
+   * Get a string reference for this object.
+   *
+   * @return the class name:IOR profile
+   */
+  public String toString()
+  {
+    return getClass().getName() + ":IOR:" + ior;
+  }
+
+  /**
+   * Calls realease on the delegate.
+   */
+  protected void finalize()
+                   throws java.lang.Throwable
+  {
+    _get_delegate().release(this);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorProvider.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorProvider.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorProvider.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/IorProvider.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,52 @@
+/* IorProvider.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.CORBA;
+
+/**
+ * Marks the possibility of the implementing object to return the associated
+ * IOR.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public interface IorProvider
+{
+  /**
+   * Get the IOR of the associated object.
+   */
+  IOR getIor();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Minor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Minor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Minor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Minor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,282 @@
+/* Minor.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.CORBA;
+
+
+/**
+ * Provides information and operations, related to about the 20 bit vendor minor
+ * code Id. This code is included into all CORBA system exceptions and is also
+ * transferred to remote side.
+ * 
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public interface Minor
+{
+  // Note: MARSHAL done.
+
+  /* MARSHAL */
+
+  /**
+   * The GNU Classpath VMCID. The last 12 bits can be used to mark up to 4096
+   * possible exceptions.
+   */
+  int vendor = 0x47430000;
+
+  /*
+   * Minor codes form MARSHAL exception.
+   */
+
+  /**
+   * The message being received is not a GIOP message. It does not start from
+   * the expected magic sequence byte[] { 'G', 'I', 'O', 'P' }.
+   */
+  int Giop = 1 | vendor;
+
+  /**
+   * The unexpected IOException while reading or writing the GIOP message header
+   * or the subsequent request or response header
+   */
+  int Header = 2 | vendor;
+
+  /**
+   * The data stream ended before reading all expected values from it. This
+   * usually means that the CORBA message is corrupted, but may also indicate
+   * that the server expects the remote method being invoked to have more or
+   * different parameters.
+   */
+  int EOF = 3 | vendor;
+
+  /**
+   * The unexpected IOException while reading or writing the data via Commond
+   * Data Representation stream.
+   */
+  int CDR = 5 | vendor;
+
+  /**
+   * The unexpected IOException while reading or writing the Value type.
+   */
+  int Value = 6 | vendor;
+
+  /**
+   * The unexpected IOException while handling request forwarding.
+   */
+  int Forwarding = 7 | vendor;
+
+  /**
+   * The unexpected IOException while handling data encapsulation, tagged
+   * components, tagged profiles, etc.
+   */
+  int Encapsulation = 8 | vendor;
+
+  /**
+   * The unexpected IOException while inserting or extracting data to/from the
+   * Any or DynamicAny.
+   */
+  int Any = 9 | vendor;
+
+  /**
+   * The unexpected UserException in the context where it cannot be handled and
+   * must be converted to the SystemException.
+   */
+  int UserException = 10 | vendor;
+
+  /**
+   * While the operation could formally be applied to the target, the OMG
+   * standard states that it is actually not applicable. For example, some CORBA
+   * objects like POA are always local and should not be passed to or returned
+   * from the remote side.
+   */
+  int Inappropriate = 11 | vendor;
+
+  /**
+   * When reading data, it was discovered that size of the data structure like
+   * string, sequence or character is written as the negative number.
+   */
+  int Negative = 12 | vendor;
+
+  /**
+   * Reference to non-existing node in the data grapth while reading the value
+   * types.
+   */
+  int Graph = 14 | vendor;
+
+  /**
+   * Unexpected exception was thrown from the IDL type helper while handling the
+   * object of this type as a boxed value.
+   */
+  int Boxed = 15 | vendor;
+
+  /**
+   * Unable to instantiate an value type object while reading it from the
+   * stream.
+   */
+  int Instantiation = 16 | vendor;
+
+  /**
+   * The header tag of the value type being read from the CDR stream contains an
+   * unexpected value outside 0x7fffff00 .. 0x7fffffff and also not null and not
+   * an indirection.
+   */
+  int ValueHeaderTag = 17 | vendor;
+
+  /**
+   * The header tag flags of the value type being read from the CDR stream make
+   * the invalid combination (for instance, 0x7fffff04).
+   */
+  int ValueHeaderFlags = 18 | vendor;
+
+  /**
+   * The value type class, written on the wire, is not compatible with the
+   * expected class, passed as a parameter to the InputStream.read_value.
+   */
+  int ClassCast = 19 | vendor;
+
+  /**
+   * Positive or otherwise invalid indirection offset when reading the data
+   * graph of the value type.
+   */
+  int Offset = 20 | vendor;
+
+  /**
+   * Errors while reading the chunked value type.
+   */
+  int Chunks = 21 | vendor;
+
+  /**
+   * No means are provided to write this value type.
+   */
+  int UnsupportedValue = 22 | vendor;
+
+  /**
+   * The value factory, required for the operation being invoked, is not
+   * registered with this ORB.
+   */
+  int Factory = 23 | vendor;
+
+  /**
+   * Unsupported object addressing method in GIOP request header.
+   */
+  int UnsupportedAddressing = 24 | vendor;
+
+  /**
+   * Invalid stringified object reference (IOR).
+   */
+  int IOR = 25 | vendor;
+
+  /**
+   * Problems with converting between stubs, ties, interfaces and
+   * implementations.
+   */
+  int TargetConversion = 26 | vendor;
+
+  /**
+   * Problems with reading or writing the fields of the value type object.
+   */
+  int ValueFields = 27 | vendor;
+
+  /**
+   * The instance of the value type is not serializable.
+   */
+  int NonSerializable = 28 | vendor;
+
+  /* BAD_OPERATION */
+
+  /**
+   * The remote side requested to invoke the method that is not available on
+   * that target (client and server probably disagree in the object definition).
+   */
+  int Method = 0 | vendor;
+
+  /**
+   * Failed to activate the inactive object.
+   */
+  int Activation = 10 | vendor;
+
+  /*
+   * Any - Attempt to extract from the Any value of the different type that was
+   * stored into that Any.
+   */
+
+  /* ClassCast - Unable to narrow the object into stub. */
+
+  /**
+   * The policies, applying to ORB or POA prevent the requested operation.
+   */
+  int Policy = 11 | vendor;
+
+  /**
+   * Socket related errors like failure to open socket on the expected port,
+   * failure to get a free port when required and so on.
+   */
+  int Socket = 12 | vendor;
+
+  /**
+   * The passed value for enumeration is outside the valid range for that
+   * enumeration.
+   */
+  int Enumeration = 14 | vendor;
+
+  /**
+   * The passed policy code is outside the valid range of the possible policies
+   * for the given policy type.
+   */
+  int PolicyType = 15 | vendor;
+  
+  /* NO_RESOURCES */
+  
+  /**
+   * Unable to get a free port for a new socket. Proably too many objects under
+   * unsuitable POA policy.
+   */
+  int Ports = 20 | vendor;
+  
+  /**
+   * Too many parallel calls (too many parallel threads). The thread control
+   * prevents malicios client from knocking the server out by suddenly
+   * submitting large number of requests.
+   */
+  int Threads = 21 | vendor;
+  
+  /**
+   * The IOR starts with file://, http:// or ftp://, but this local or remote
+   * resource is not accessible.
+   */
+  int Missing_IOR = 22 | vendor;
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,115 @@
+/* NameDynAnyPairHolder.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.CORBA;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.NameDynAnyPair;
+import org.omg.DynamicAny.NameDynAnyPairHelper;
+
+/**
+ * A holder for the structure {@link NameDynAnyPair}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameDynAnyPairHolder
+  implements Streamable
+{
+  /**
+   * The stored NameDynAnyPair value.
+   */
+  public NameDynAnyPair value;
+
+  /**
+   * Create the unitialised instance, leaving the value field
+   * with default <code>null</code> value.
+   */
+  public NameDynAnyPairHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the value that will be assigned to
+   * the <code>value</code> field.
+   */
+  public NameDynAnyPairHolder(NameDynAnyPair initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * The method should read this object from the CDR input stream, but
+   * (following the JDK 1.5 API) it does not.
+   *
+   * @param input a org.omg.CORBA.portable stream to read from.
+   *
+   * @specenote Sun throws the same exception.
+   *
+   * @throws MARSHAL always.
+   */
+  public void _read(InputStream input)
+  {
+    value = NameDynAnyPairHelper.read(input);
+  }
+
+  /**
+   * The method should write this object to the CDR input stream, but
+   * (following the JDK 1.5 API) it does not.
+   *
+   * @param input a org.omg.CORBA.portable stream to read from.
+   *
+   * @specenote Sun throws the same exception.
+   *
+   * @throws MARSHAL always.
+   */
+  public void _write(OutputStream output)
+  {
+    NameDynAnyPairHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the NameDynAnyPair.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return NameDynAnyPairHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairSeqHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairSeqHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairSeqHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameDynAnyPairSeqHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,115 @@
+/* NameDynAnyPairSeqHolder.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.CORBA;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.NameDynAnyPair;
+import org.omg.DynamicAny.NameDynAnyPairSeqHelper;
+
+/**
+ * A holder for the sequence of {@link NameDynAnyPair}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameDynAnyPairSeqHolder
+  implements Streamable
+{
+  /**
+   * The stored array of <code>NameDynAnyPair</code>.
+   */
+  public NameDynAnyPair[] value;
+
+  /**
+   * Create the unitialised instance, leaving the value array
+   * with default <code>null</code> value.
+   */
+  public NameDynAnyPairSeqHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the array that will be assigned to
+   * the <code>value</code> array.
+   */
+  public NameDynAnyPairSeqHolder(NameDynAnyPair[] initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * The method should read this object from the CDR input stream, but
+   * (following the JDK 1.5 API) it does not.
+   *
+   * @param input a org.omg.CORBA.portable stream to read from.
+   *
+   * @specenote Sun throws the same exception.
+   *
+   * @throws MARSHAL always.
+   */
+  public void _read(InputStream input)
+  {
+    value = NameDynAnyPairSeqHelper.read(input);
+  }
+
+  /**
+   * The method should write this object to the CDR input stream, but
+   * (following the JDK 1.5 API) it does not.
+   *
+   * @param input a org.omg.CORBA.portable stream to read from.
+   *
+   * @specenote Sun throws the same exception.
+   *
+   * @throws MARSHAL always.
+   */
+  public void _write(OutputStream output)
+  {
+    NameDynAnyPairSeqHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the NameDynAnyPair.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return NameDynAnyPairSeqHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,105 @@
+/* NameValuePairHolder.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.CORBA;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.NameValuePair;
+import org.omg.DynamicAny.NameValuePairHelper;
+
+/**
+ * A holder for the structure {@link NameValuePair}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameValuePairHolder
+  implements Streamable
+{
+  /**
+   * The stored NameValuePair value.
+   */
+  public NameValuePair value;
+
+  /**
+   * Create the unitialised instance, leaving the value field
+   * with default <code>null</code> value.
+   */
+  public NameValuePairHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the value that will be assigned to
+   * the <code>value</code> field.
+   */
+  public NameValuePairHolder(NameValuePair initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Fill in the {@link value} by data from the CDR stream.
+   *
+   * @param input the org.omg.CORBA.portable stream to read.
+   */
+  public void _read(InputStream input)
+  {
+    value = NameValuePairHelper.read(input);
+  }
+
+  /**
+   * Write the stored value into the CDR stream.
+   *
+   * @param output the org.omg.CORBA.portable stream to write.
+   */
+  public void _write(OutputStream output)
+  {
+    NameValuePairHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the NameValuePair.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return NameValuePairHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairSeqHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairSeqHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairSeqHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NameValuePairSeqHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,105 @@
+/* NameValuePairSeqHolder.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.CORBA;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.DynamicAny.NameValuePair;
+import org.omg.DynamicAny.NameValuePairSeqHelper;
+
+/**
+ * A holder for the sequence of {@link NameValuePair}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameValuePairSeqHolder
+  implements Streamable
+{
+  /**
+   * The stored array of <code>NameValuePair</code>.
+   */
+  public NameValuePair[] value;
+
+  /**
+   * Create the unitialised instance, leaving the value array
+   * with default <code>null</code> value.
+   */
+  public NameValuePairSeqHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the array that will be assigned to
+   * the <code>value</code> array.
+   */
+  public NameValuePairSeqHolder(NameValuePair[] initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Read the {@link value} array from the CDR stream.
+   *
+   * @param input the org.omg.CORBA.portable stream to read.
+   */
+  public void _read(InputStream input)
+  {
+    value = NameValuePairSeqHelper.read(input);
+  }
+
+  /**
+   * Write the stored value into the CDR stream.
+   *
+   * @param output the org.omg.CORBA.portable stream to write.
+   */
+  public void _write(OutputStream output)
+  {
+    NameValuePairSeqHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the NameValuePair.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return NameValuePairSeqHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Binding_iterator_impl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,139 @@
+/* Binding_iterator.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.CORBA.NamingService;
+
+import org.omg.CosNaming.Binding;
+import org.omg.CosNaming.BindingHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming._BindingIteratorImplBase;
+
+/**
+ * The implementation of the {@link BindingIterator}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class Binding_iterator_impl
+  extends _BindingIteratorImplBase
+{
+  /**
+   * The value, returned by the {@link #next_one} when there
+   * are no bindings available.
+   */
+  private static final Binding no_more_bindings =
+    new Binding(new NameComponent[ 0 ], BindingType.nobject);
+
+  /**
+   * The collection of the available bindings.
+   */
+  private final Binding[] bindings;
+
+  /**
+   * The position of the internal iterator pointer.
+   */
+  private int p;
+
+  public Binding_iterator_impl(Binding[] a_bindings)
+  {
+    bindings = a_bindings;
+  }
+
+  /**
+   * Disconnect the iterator from its ORB. The iterator will
+   * no longer be accessible and will be a subject of the
+   * garbage collection.
+   */
+  public void destroy()
+  {
+    _orb().disconnect(this);
+  }
+
+  /**
+   * Return the desired amount of bindings.
+   *
+   * @param amount the maximal number of bindings to return.
+   * @param a_list a holder to store the returned bindings.
+   *
+   * @return false if there are no more bindings available,
+   * true otherwise.
+   */
+  public boolean next_n(int amount, BindingListHolder a_list)
+  {
+    if (p < bindings.length)
+      {
+        int n = bindings.length - p;
+        if (n > amount)
+          n = amount;
+
+        a_list.value = new Binding[ n ];
+        for (int i = 0; i < n; i++)
+          a_list.value [ i ] = bindings [ p++ ];
+
+        return true;
+      }
+    else
+      {
+        a_list.value = new Binding[ 0 ];
+        return false;
+      }
+  }
+
+  /**
+   * Return the next binding.
+   *
+   * @param a_binding a holder, where the next binding will be stored.
+   *
+   * @return false if there are no more bindings available, true
+   * otherwise.
+   */
+  public boolean next_one(BindingHolder a_binding)
+  {
+    if (p < bindings.length)
+      {
+        a_binding.value = (Binding) bindings [ p++ ];
+        return true;
+      }
+    else
+      {
+        a_binding.value = no_more_bindings;
+        return false;
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Ext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Ext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Ext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/Ext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,230 @@
+/* TransientContextExt.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.CORBA.NamingService;
+
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CosNaming.BindingIteratorHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
+import org.omg.CosNaming.NamingContextPackage.CannotProceed;
+import org.omg.CosNaming.NamingContextPackage.InvalidName;
+import org.omg.CosNaming.NamingContextPackage.NotEmpty;
+import org.omg.CosNaming.NamingContextPackage.NotFound;
+import org.omg.CosNaming._NamingContextExtImplBase;
+
+/**
+ * This naming context that adds the the string based extensions,
+ * defined by {@link NamingContextExt}. The basic functionality
+ * is handled by the enclosed instance of the {@link NamingContext}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class Ext
+  extends _NamingContextExtImplBase
+{
+  /**
+   * The older version of the naming context, where all relevant calls
+   * are forwarded.
+   */
+  private final NamingContext classic;
+
+  /**
+   * The converter class converts between string and array form of the
+   * name.
+   */
+  private NameTransformer converter = new NameTransformer();
+
+  /**
+   * Create the extensions for the given instance of the context.
+   *
+   * @param previous_version the previous version of the naming context.
+   */
+  public Ext(NamingContext previous_version)
+  {
+    classic = previous_version;
+  }
+
+  /**
+   * Sets a delegate to this context and, if appropriated, also
+   * sets the same delegate to the enclosing 'classic' context.
+   *
+   * @param a_delegate a delegate to set.
+   */
+  public void _set_delegate(Delegate a_delegate)
+  {
+    super._set_delegate(a_delegate);
+    if (classic instanceof ObjectImpl)
+      ((ObjectImpl) classic)._set_delegate(a_delegate);
+  }
+
+  /** {@inheritDoc} */
+  public void bind(NameComponent[] a_name, Object an_object)
+            throws NotFound, CannotProceed, InvalidName, AlreadyBound
+  {
+    classic.bind(a_name, an_object);
+  }
+
+  /** {@inheritDoc} */
+  public void bind_context(NameComponent[] a_name, NamingContext context)
+                    throws NotFound, CannotProceed, InvalidName, AlreadyBound
+  {
+    classic.bind_context(a_name, context);
+  }
+
+  /** {@inheritDoc} */
+  public NamingContext bind_new_context(NameComponent[] a_name)
+                                 throws NotFound, AlreadyBound, CannotProceed,
+                                        InvalidName
+  {
+    return classic.bind_new_context(a_name);
+  }
+
+  /** {@inheritDoc} */
+  public void destroy()
+               throws NotEmpty
+  {
+    classic.destroy();
+  }
+
+  /** {@inheritDoc} */
+  public void list(int amount, BindingListHolder a_list,
+                   BindingIteratorHolder an_iter
+                  )
+  {
+    classic.list(amount, a_list, an_iter);
+  }
+
+  /** {@inheritDoc} */
+  public NamingContext new_context()
+  {
+    return classic.new_context();
+  }
+
+  /** {@inheritDoc} */
+  public void rebind(NameComponent[] a_name, Object an_object)
+              throws NotFound, CannotProceed, InvalidName
+  {
+    classic.rebind(a_name, an_object);
+  }
+
+  /** {@inheritDoc} */
+  public void rebind_context(NameComponent[] a_name, NamingContext context)
+                      throws NotFound, CannotProceed, InvalidName
+  {
+    classic.rebind_context(a_name, context);
+  }
+
+  /** {@inheritDoc} */
+  public Object resolve(NameComponent[] a_name)
+                 throws NotFound, CannotProceed, InvalidName
+  {
+    return classic.resolve(a_name);
+  }
+
+  /**
+   * Resolves the name, represented in the form of the string. The name
+   * is first parsed into an array representation, then the call
+   * is forwarded to the {@link resolve(NameComponent[])}.
+   *
+   * @param a_name_string a name to resolve.
+   *
+   * @return the resolved object.
+   *
+   * @throws NotFound if the name cannot be resolved.
+   * @throws InvalidName if the name is invalid.
+   * @throws CannotProceed on unexpected circumstances.
+   */
+  public Object resolve_str(String a_name_string)
+                     throws NotFound, CannotProceed, InvalidName
+  {
+    return resolve(to_name(a_name_string));
+  }
+
+  /**
+   * Convert the name string representation into array representation.
+   *
+   * @param a_name_string a string to convert.
+   * @return a converted array of the name components
+   *
+   * @throws InvalidName on parsing error.
+   */
+  public NameComponent[] to_name(String a_name_string)
+                          throws InvalidName
+  {
+    return converter.toName(a_name_string);
+  }
+
+  /**
+   * Convert a name component array representation into string representation.
+   *
+   * @param a_name a name to convert.
+   *
+   * @return a string form.
+   *
+   * @throws InvalidName if the passed name is invalid.
+   */
+  public String to_string(NameComponent[] a_name)
+                   throws InvalidName
+  {
+    return converter.toString(a_name);
+  }
+
+  /**
+   * This method is not yet implemented.
+   * FIXME TODO implement it.
+   */
+  public String to_url(String an_address, String a_name_string)
+                throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
+                       InvalidName
+  {
+    throw new NO_IMPLEMENT("Method to_url() not yet implemented.");
+  }
+
+  /** {@inheritDoc} */
+  public void unbind(NameComponent[] a_name)
+              throws NotFound, CannotProceed, InvalidName
+  {
+    classic.unbind(a_name);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,98 @@
+/* NameComponentComparator.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.CORBA.NamingService;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CosNaming.NameComponent;
+
+import java.util.Comparator;
+
+/**
+ * This class implements the name component comparator, needed to
+ * sort and compare the name components in maps and sorted sets.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public final class NameComponentComparator
+  implements Comparator
+{
+  /**
+   * The singleton instance of the name comparator.
+   */
+  public static final NameComponentComparator singleton = new NameComponentComparator();
+
+  /**
+   * It is enough to have a singleton.
+   */
+  private NameComponentComparator()
+  {
+  }
+
+  /**
+   * Compare the two names components.
+   *
+   * @param nc_a the first name component.
+   * @param nc_b the second name component.
+   *
+   * @return 0 if the name components are equal, non zero value
+   * as result of comparison otherwise.
+   *
+   * @throws BAD_PARAM if one of the components is empty or
+   * has {@link NameComponent#id} or {@link NameComponent#kind}
+   * field intialised to null.
+   */
+  public final int compare(Object nc_a, Object nc_b)
+  {
+    NameComponent a = (NameComponent) nc_a;
+    NameComponent b = (NameComponent) nc_b;
+
+    int cn = a.id.compareTo(b.id);
+    if (cn != 0)
+      return cn;
+    return a.kind.compareTo(b.kind);
+  }
+
+  /**
+   * All instances of this class are equal.
+   */
+  public boolean equals(Object x)
+  {
+    return x instanceof NameComponentComparator;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameParser.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameParser.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameParser.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,529 @@
+/* NameParser.java --
+   Copyright (C) 2005, 2006 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.CORBA.NamingService;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.IOR;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.Version;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.DATA_CONVERSION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming._NamingContextStub;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+/**
+ * Parses the alternative IOR representations into our IOR structure.
+ * 
+ * TODO This parser currently supports only one address per target string. A
+ * string with the multiple addresses will be accepted, but only the last
+ * address will be taken into consideration. The fault tolerance is not yet
+ * implemented.
+ * 
+ * The key string is filtered using {@link java.net.URLDecoder} that replaces
+ * the agreed escape sequences by the corresponding non alphanumeric characters.
+ * 
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameParser
+  extends NameTransformer
+{
+  /**
+   * The corbaloc prefix.
+   */
+  public static final String pxCORBALOC = "corbaloc";
+
+  /**
+   * The corbaname prefix.
+   */
+  public static final String pxCORBANAME = "corbaname";
+
+  /**
+   * The IOR prefix.
+   */
+  public static final String pxIOR = "ior";
+  
+  /**
+   * The file:// prefix.
+   */
+  public static final String pxFILE = "file://";
+  
+  /**
+   * The ftp:// prefix.
+   */
+  public static final String pxFTP = "ftp://";
+  
+  /**
+   * The http:// prefix.
+   */
+  public static final String pxHTTP = "http://";
+
+  /**
+   * Marks iiop protocol.
+   */
+  public static final String IIOP = "iiop";
+
+  /**
+   * Marks rir protocol.
+   */
+  public static final String RIR = "rir";
+
+  /**
+   * The default port value, as specified in OMG documentation.
+   */
+  public static final int DEFAULT_PORT = 2809;
+
+  /**
+   * The default name.
+   */
+  public static final String DEFAULT_NAME = "NameService";
+
+  /**
+   * The string to name converter, initialized on demand.
+   */
+  static NameTransformer converter;
+
+  /**
+   * The current position.
+   */
+  int p;
+
+  /**
+   * The address being parsed, splitted into tokens.
+   */
+  String[] t;
+
+  /**
+   * Parse CORBALOC.
+   * 
+   * The expected format is: <br>
+   * 1. corbaloc:[iiop][version.subversion@]:host[:port]/key <br>
+   * 2. corbaloc:rir:[/key] <br>
+   * 3. corbaname:[iiop][version.subversion@]:host[:port]/key <br>
+   * 4. corbaname:rir:[/key] <br>
+   * 5. file://[file name]<br>
+   * 6. http://[url]<br>
+   * 7. ftp://[url]<br>
+   * 
+   * Protocol defaults to IOP, the object key defaults to the NameService.
+   * 
+   * @param corbaloc the string to parse.
+   * @param orb the ORB, needed to create IORs and resolve rir references.
+   * 
+   * @return the resolved object.
+   */
+  public synchronized org.omg.CORBA.Object corbaloc(String corbaloc,
+    OrbFunctional orb)
+    throws BAD_PARAM
+  {
+    return corbaloc(corbaloc, orb, 0);
+  }
+  
+  /**
+   * Parse controlling against the infinite recursion loop.
+   */
+  private org.omg.CORBA.Object corbaloc(String corbaloc,
+    OrbFunctional orb, int recursion)
+  {
+    // The used CORBA specification does not state how many times we should to
+    //redirect, but the infinite loop may be used to knock out the system.
+    // by malicious attempt.
+    if (recursion > 10)
+      throw new DATA_CONVERSION("More than 10 redirections");
+    
+    if (corbaloc.startsWith(pxFILE))
+      return corbaloc(readFile(corbaloc.substring(pxFILE.length())), orb, recursion+1);
+    else if (corbaloc.startsWith(pxHTTP))
+      return corbaloc(readUrl(corbaloc), orb, recursion+1);
+    else if (corbaloc.startsWith(pxFTP))
+      return corbaloc(readUrl(corbaloc), orb, recursion+1);
+
+    boolean corbaname;
+
+    // The alternative addresses, if given.
+    ArrayList alt_addr = new ArrayList();
+
+    // The version numbers with default values.
+    int major = 1;
+    int minor = 0;
+
+    // The host address.
+    String host;
+
+    // The port.
+    int port = DEFAULT_PORT;
+
+    // The object key as string.
+    String key;
+
+    StringTokenizer st = new StringTokenizer(corbaloc, ":@/.,#", true);
+
+    t = new String[st.countTokens()];
+
+    for (int i = 0; i < t.length; i++)
+      {
+        t[i] = st.nextToken();
+      }
+
+    p = 0;
+
+    if (t[p].startsWith(pxCORBANAME))
+      corbaname = true;
+    else if (t[p].equalsIgnoreCase(pxCORBALOC))
+      corbaname = false;
+    else if (t[p].equalsIgnoreCase(pxIOR))
+      {
+        IOR ior = IOR.parse(corbaloc);
+        return orb.ior_to_object(ior);
+      }
+    else
+      throw new DATA_CONVERSION("Unsupported protocol: '" + t[p] + "'");
+
+    p++;
+
+    if (!t[p++].equals(":"))
+      throw new BAD_PARAM("Syntax (':' expected after name prefix)");
+
+    // Check for rir:
+    if (t[p].equals(RIR))
+      {
+        p++;
+        if (!t[p++].equals(":"))
+          throw new BAD_PARAM("':' expected after 'rir'");
+
+        key = readKey("/");
+
+        Object object;
+        try
+          {
+            object = orb.resolve_initial_references(key);
+            return corbaname ? resolve(object) : object;
+          }
+        catch (InvalidName e)
+          {
+            throw new BAD_PARAM("Unknown initial reference '" + key + "'");
+          }
+      }
+    else
+    // Check for iiop.
+    if (t[p].equals(IIOP) || t[p].equals(":"))
+      {
+        IOR ior = new IOR();
+
+        Addresses: do
+          { // Read addresses.
+            if (t[p].equals(":"))
+              {
+                p++;
+              }
+            else
+              {
+                p++;
+                if (!t[p++].equals(":"))
+                  throw new BAD_PARAM("':' expected after 'iiop'");
+                // Check if version is present.
+                if (t[p + 1].equals("."))
+                  if (t[p + 3].equals("@"))
+                    {
+                      // Version info present.
+                      try
+                        {
+                          major = Integer.parseInt(t[p++]);
+                        }
+                      catch (NumberFormatException e)
+                        {
+                          throw new BAD_PARAM("Major version number '"
+                            + t[p - 1] + "'");
+                        }
+                      p++; // '.' at this point.
+                      try
+                        {
+                          minor = Integer.parseInt(t[p++]);
+                        }
+                      catch (NumberFormatException e)
+                        {
+                          throw new BAD_PARAM("Major version number '"
+                            + t[p - 1] + "'");
+                        }
+                      p++; // '@' at this point.
+                    }
+              }
+
+            ior.Internet.version = new Version(major, minor);
+
+            // Then host data goes till '/' or ':'.
+            StringBuffer bhost = new StringBuffer(corbaloc.length());
+            while (!t[p].equals(":") && !t[p].equals("/") && !t[p].equals(","))
+              bhost.append(t[p++]);
+
+            host = bhost.toString();
+
+            ior.Internet.host = host;
+
+            if (t[p].equals(":"))
+              {
+                // Port specified.
+                p++;
+                try
+                  {
+                    port = Integer.parseInt(t[p++]);
+                  }
+                catch (NumberFormatException e)
+                  {
+                    throw new BAD_PARAM("Invalid port '" + t[p - 1] + "'");
+                  }
+              }
+
+            ior.Internet.port = port;
+
+            // Id is not listed.
+            ior.Id = "";
+
+            if (t[p].equals(","))
+              p++;
+            else
+              break Addresses;
+          }
+        while (true);
+
+        key = readKey("/");
+        ior.key = key.getBytes();
+
+        org.omg.CORBA.Object object = orb.ior_to_object(ior);
+        return corbaname ? resolve(object) : object;
+      }
+
+    else
+      throw new DATA_CONVERSION("Unsupported protocol '" + t[p] + "'");
+  }
+  
+  /**
+   * Read IOR from the file in the local file system.
+   */
+  String readFile(String file)
+  {
+    File f = new File(file);
+    if (!f.exists())
+      {
+        DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath()
+          + " does not exist.");
+        err.minor = Minor.Missing_IOR;
+      }
+    try
+      {
+        char[] c = new char[(int) f.length()];
+        FileReader fr = new FileReader(f);
+        fr.read(c);
+        fr.close();
+        return new String(c).trim();
+      }
+    catch (IOException ex)
+      {
+        DATA_CONVERSION d = new DATA_CONVERSION();
+        d.initCause(ex);
+        d.minor = Minor.Missing_IOR;
+        throw (d);
+      }
+  }
+  
+  /**
+   * Read IOR from the remote URL.
+   */
+  String readUrl(String url)
+  {
+    URL u;
+    try
+      {
+        u = new URL(url);
+      }
+    catch (MalformedURLException mex)
+      {
+        throw new BAD_PARAM("Malformed URL: '" + url + "'");
+      }
+
+    try
+      {
+        InputStreamReader r = new InputStreamReader(u.openStream());
+
+        StringBuffer b = new StringBuffer();
+        int c;
+
+        while ((c = r.read()) > 0)
+          b.append((char) c);
+
+        return b.toString().trim();
+      }
+    catch (Exception exc)
+      {
+        DATA_CONVERSION d = new DATA_CONVERSION("Reading " + url + " failed.");
+        d.minor = Minor.Missing_IOR;
+        throw d;
+      }
+  }
+
+  private org.omg.CORBA.Object resolve(org.omg.CORBA.Object object)
+  {
+    NamingContext ns;
+    String key = "?";
+    try
+      {
+        if (object instanceof NamingContext)
+          ns = (NamingContext) object;
+        else
+          {
+            Delegate delegate = ((ObjectImpl) object)._get_delegate();
+            ns = new _NamingContextStub();
+            ((_NamingContextStub) ns)._set_delegate(delegate);
+          }
+      }
+    catch (Exception ex)
+      {
+        BAD_PARAM bad = new BAD_PARAM("The CORBANAME target " + object
+          + " is not a NamingContext");
+        bad.minor = 10;
+        bad.initCause(ex);
+        throw bad;
+      }
+
+    if (converter == null)
+      converter = new NameTransformer();
+
+    try
+      {
+        key = readKey("#");
+        object = ns.resolve(converter.toName(key));
+        return object;
+      }
+    catch (Exception ex)
+      {
+        BAD_PARAM bad = new BAD_PARAM("Wrong CORBANAME '" + key + "'");
+        bad.minor = 10;
+        bad.initCause(ex);
+        throw bad;
+      }
+  }
+
+  private String readKey(String delimiter)
+    throws BAD_PARAM
+  {
+    if (p < t.length)
+      if (!t[p].equals(delimiter))
+        {
+          if (t[p].equals("#"))
+            return DEFAULT_NAME;
+          else
+            throw new BAD_PARAM("'" + delimiter + "String' expected '" + t[p]
+              + "' found");
+        }
+
+    StringBuffer bKey = new StringBuffer();
+    p++;
+
+    while (p < t.length && !t[p].equals("#"))
+      bKey.append(t[p++]);
+
+    if (bKey.length() == 0)
+      return DEFAULT_NAME;
+
+    try
+      {
+        return URLDecoder.decode(bKey.toString(), "UTF-8");
+      }
+    catch (UnsupportedEncodingException e)
+      {
+        throw new Unexpected("URLDecoder does not support UTF-8", e);
+      }
+  }
+
+  static NameParser n = new NameParser();
+
+  static void corbalocT(String ior, OrbFunctional orb)
+  {
+    System.out.println(ior);
+    System.out.println(n.corbaloc(ior, orb));
+    System.out.println();
+  }
+
+  public static void main(String[] args)
+  {
+    try
+      {
+        OrbFunctional orb = (OrbFunctional) ORB.init(args, null);
+        corbalocT("corbaloc:iiop:1.3 at 155axyz.com/Prod/aTradingService", orb);
+        corbalocT("corbaloc:iiop:2.7 at 255bxyz.com/Prod/bTradingService", orb);
+        corbalocT("corbaloc:iiop:355cxyz.com/Prod/cTradingService", orb);
+        corbalocT("corbaloc:iiop:2.7 at 255bxyz.com/Prod/bTradingService", orb);
+        corbalocT("corbaloc:iiop:355cxyz.com:7777/Prod/cTradingService", orb);
+
+        corbalocT("corbaloc::556xyz.com:80/Dev/NameService", orb);
+        corbalocT("corbaloc:iiop:1.2 at host1:3076/0", orb);
+
+        corbalocT("corbaloc:rir:/NameService", orb);
+        corbalocT("corbaloc:rir:/", orb);
+        corbalocT("corbaloc:rir:", orb);
+
+        corbalocT("corbaloc:rir:/NameService", orb);
+        corbalocT("corbaloc:rir:/", orb);
+        corbalocT("corbaloc:rir:", orb);
+
+        corbalocT("corbaloc::555xyz.com,:556xyz.com:80/Dev/NameService", orb);
+      }
+    catch (BAD_PARAM e)
+      {
+        e.printStackTrace(System.out);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,328 @@
+/* NameTransformer.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.CORBA.NamingService;
+
+import org.omg.CORBA.IntHolder;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContextPackage.InvalidName;
+
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+/**
+ * This class converts between string and array representations of the
+ * multi component object names.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameTransformer
+{
+  /**
+   * A string, indicating the escape character.
+   */
+  public static final String ESCAPE = "\\";
+
+  /**
+   * Convert the string name representation into the array name
+   * representation. See {@link #toString(NameComponent)} for the
+   * description of this format.
+   *
+   * @param name the string form of the name.
+   *
+   * @return the array form of the name.
+   *
+   * @throws InvalidName if the name cannot be parsed.
+   */
+  public NameComponent[] toName(String a_name)
+                         throws InvalidName
+  {
+    ArrayList components = new ArrayList();
+    StringTokenizer st = new StringTokenizer(a_name, "./\\", true);
+
+    String id;
+    String kind;
+    String next;
+
+    // Create the buffer array, reserving the last element for null.
+    String[] n = new String[ st.countTokens() + 1 ];
+
+    int pp = 0;
+    while (st.hasMoreTokens())
+      n [ pp++ ] = st.nextToken();
+
+    IntHolder p = new IntHolder();
+
+    NameComponent node = readNode(p, n);
+
+    while (node != null)
+      {
+        components.add(node);
+        node = readNode(p, n);
+      }
+
+    NameComponent[] name = new NameComponent[ components.size() ];
+    for (int i = 0; i < name.length; i++)
+      {
+        name [ i ] = (NameComponent) components.get(i);
+      }
+
+    NameValidator.check(name);
+
+    return name;
+  }
+
+  /**
+   * Converts the name into its string representation, as defined in
+   * the specification CORBA naming service.
+   *
+   * A string representation for the name consists of the name components,
+   * separated by a slash '/' character (for example, 'a/b/c'). If the
+   * {@link NameComponent#kind} field is  not empty, it is given after
+   * period ('.'), for example 'a.b/c.d/.' .
+   * The period alone represents node where part where both
+   * {@link NameComponent#kind} and {@link NameComponent#id} are empty strings.
+   *
+   * If slash or dot are part of the name, they are escaped by backslash ('\').
+   * If the backslash itself is part of the name, it is doubled.
+   *
+   * @param a_name a name to convert.
+   * @return a string representation.
+   */
+  public String toString(NameComponent[] a_name)
+                  throws InvalidName
+  {
+    NameValidator.check(a_name);
+
+    StringBuffer b = new StringBuffer();
+
+    NameComponent n;
+
+    for (int ni = 0; ni < a_name.length; ni++)
+      {
+        n = a_name [ ni ];
+        appEscaping(b, n.id);
+        if (n.kind.length() > 0)
+          {
+            b.append('.');
+            appEscaping(b, n.kind);
+          }
+
+        if (ni < a_name.length - 1)
+          b.append('/');
+      }
+    return b.toString();
+  }
+
+  /**
+   * Append the contents of the string to this
+   * string buffer, inserting the escape sequences, where required.
+   *
+   * @param b a buffer to append the contents to.
+   * @param s a string to append.
+   */
+  private void appEscaping(StringBuffer b, String s)
+  {
+    char c;
+    for (int i = 0; i < s.length(); i++)
+      {
+        c = s.charAt(i);
+        switch (c)
+          {
+            case '.' :
+            case '/' :
+            case '\\' :
+              b.append('\\');
+              b.append(c);
+              break;
+
+            default :
+              b.append(c);
+              break;
+          }
+      }
+  }
+
+  /**
+   * Assert the end of the current name component.
+   */
+  private void assertEndOfNode(IntHolder p, String[] t)
+                        throws InvalidName
+  {
+    if (t [ p.value ] != null)
+      if (!t [ p.value ].equals("/"))
+        throw new InvalidName("End of node expected at token " + p.value);
+  }
+
+  /**
+   * Read the named component node. After reading the current positon
+   * advances to the beginning of the next node in an array.
+   *
+   * @param p the current position being wrapped inside the passed
+   * IntHolder.
+   *
+   * @param t the text buffer.
+   *
+   * @return the created node.
+   */
+  private NameComponent readNode(IntHolder p, String[] t)
+                          throws InvalidName
+  {
+    // End of stream has been reached.
+    if (t [ p.value ] == null)
+      return null;
+
+    NameComponent n = new NameComponent();
+
+    if (t [ p.value ].equals("."))
+      {
+        // The 'id' is missing, but the 'kind' may follow.
+        n.id = "";
+        p.value++;
+        n.kind = readPart(p, t);
+        assertEndOfNode(p, t);
+        if (t [ p.value ] != null)
+          p.value++;
+      }
+    else if (t [ p.value ].equals("/"))
+      {
+        // This is not allowed here and may happen only
+        // on two subsequent slashes.
+        throw new InvalidName("Unexpected '/' token " + p.value);
+      }
+    else
+      {
+        n.id = readPart(p, t);
+
+        // If some chars follow the id.
+        if (t [ p.value ] != null)
+          {
+            // Dot means that the kind part follows
+            if (t [ p.value ].equals("."))
+              {
+                p.value++;
+                n.kind = readPart(p, t);
+                assertEndOfNode(p, t);
+                if (t [ p.value ] != null)
+                  p.value++;
+              }
+
+            // The next name component follows - advance to
+            // the beginning of the next name component.
+            else if (t [ p.value ].equals("/"))
+              {
+                n.kind = "";
+                p.value++;
+              }
+            else
+              throw new InvalidName("Unexpected '" + t [ p.value ] +
+                                       "' at token " + p.value
+                                      );
+          }
+        else
+
+          // Id, and then end of sequence.
+          n.kind = "";
+      }
+
+    return n;
+  }
+
+  /**
+   * Read the name part (id or kind).
+   *
+   * @param p the current position. After reading, advances
+   * to the beginning of the next name fragment.
+   *
+   * @param t the string buffer.
+   *
+   * @return the name part with resolved escape sequences.
+   */
+  private String readPart(IntHolder p, String[] t)
+  {
+    StringBuffer part = new StringBuffer();
+
+    while (t [ p.value ] != null && !t [ p.value ].equals(".") &&
+           !t [ p.value ].equals("/")
+          )
+      {
+        if (t [ p.value ].equals(ESCAPE))
+          {
+            p.value++;
+            part.append(t [ p.value ]);
+          }
+        else
+          part.append(t [ p.value ]);
+
+        p.value++;
+      }
+
+    return part.toString();
+  }
+
+  public static void main(String[] args)
+  {
+    NameComponent a = new NameComponent("a", "ak");
+    NameComponent b = new NameComponent("b/z", "b.k");
+    NameComponent c = new NameComponent("c", "");
+
+    NameTransformer sn = new NameTransformer();
+
+    try
+      {
+        String s = sn.toString(new NameComponent[] { a, b, c });
+        System.out.println(s);
+
+        //NameComponent[] k = toName("a.k/b.k2/c/d/.");
+        //NameComponent[] k = toName("a.bc/.b/c.x");
+
+        NameComponent[] k = sn.toName(s);
+        System.out.println("ToString");
+
+        for (int i = 0; i < k.length; i++)
+          {
+            System.out.println(k [ i ].id + ":" + k [ i ].kind);
+          }
+      }
+    catch (InvalidName ex)
+      {
+        ex.printStackTrace();
+      }
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameValidator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameValidator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameValidator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NameValidator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* NameValidator.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.CORBA.NamingService;
+
+
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContextPackage.InvalidName;
+
+/**
+ * Checks the given name for validity.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NameValidator
+{
+  /**
+   * Check the given name. This method must be package level, as it is
+   * not defined in the API.
+   *
+   * @param name the name to check.
+   *
+   * @throws InvalidName if the given name is not valid.
+   */
+  public static void check(NameComponent[] name)
+             throws InvalidName
+  {
+    if (name == null)
+      throw new InvalidName("name=null");
+
+    if (name.length == 0)
+      throw new InvalidName("name.length=0");
+
+    for (int i = 0; i < name.length; i++)
+      {
+        if (name [ i ] == null)
+          throw new InvalidName("name[" + i + "]=null");
+        if (name [ i ].id == null)
+          throw new InvalidName("name[" + i + "].id=null");
+        if (name [ i ].kind == null)
+          throw new InvalidName("name[" + i + "].kind=null");
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,190 @@
+/* NamingMap.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.CORBA.NamingService;
+
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
+import org.omg.CosNaming.NamingContextPackage.InvalidName;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * The Naming Map maps the single names components into associated objects or
+ * naming contexts.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NamingMap
+{
+  /**
+   * The actual map.
+   */
+  protected final TreeMap map;
+
+  /**
+   * Creates an instance of the naming map, intialising the comparator
+   * to the {@link NameComponentComparator}.
+   */
+  public NamingMap()
+  {
+    map = new TreeMap(NameComponentComparator.singleton);
+  }
+
+  /**
+   * Put the given GIOP object, specifying the given name as a key.
+   * If the entry with the given name already exists, or if the given
+   * object is already mapped under another name, the
+   * {@link AlreadyBound} exception will be thrown.
+   *
+   * @param name the name
+   * @param object the object
+   */
+  public void bind(NameComponent name, org.omg.CORBA.Object object)
+            throws AlreadyBound, InvalidName
+  {
+    if (containsKey(name))
+      {
+        Object x = get(name);
+
+        // Do not throw an exception if the same object is named by
+        // the same name.
+        if (x.equals(object))
+          throw new AlreadyBound("The name is in use for another object");
+      }
+    else
+      {
+        if (containsValue(object))
+          throw new AlreadyBound("The object has another name");
+      }
+    
+    // There are no restrictions in binding the object.
+    rebind(name, object);
+  }
+
+  /**
+   * Checks if this map contains the definition of the given name.
+   *
+   * @param key the name to check.
+   */
+  public boolean containsKey(NameComponent key)
+  {
+    return map.containsKey(key);
+  }
+
+  /**
+   * Checks if this map contains the definition of the given object.
+   *
+   * @param object the object to check.
+   */
+  public boolean containsValue(org.omg.CORBA.Object object)
+  {
+    return map.containsValue(object);
+  }
+
+  /**
+   * Returns the map entry set.
+   *
+   * @return the map entry set, containing the instances of the
+   * Map.Entry.
+   */
+  public Set entries()
+  {
+    return map.entrySet();
+  }
+
+  /**
+   * Get the CORBA object, associated with the given name.
+   *
+   * @param name the name.
+   *
+   * @return the associated object, null if none.
+   */
+  public org.omg.CORBA.Object get(NameComponent name)
+  {
+    return (org.omg.CORBA.Object) map.get(name);
+  }
+
+  /**
+   * Put the given GIOP object, specifying the given name as a key.
+   * Remove all pre - existing mappings for the given name and object.
+   *
+   * @param name the name.
+   * @param object
+   */
+  public void rebind(NameComponent name, org.omg.CORBA.Object object)
+              throws InvalidName
+  {
+    // Remove the existing mapping for the given name, if present.
+    remove(name);
+
+    Iterator iter = entries().iterator();
+    Map.Entry item;
+
+    // Remove the existing mapping for the given object, if present.
+    while (iter.hasNext())
+      {
+        item = (Map.Entry) iter.next();
+        if (item.getValue().equals(object))
+          iter.remove();
+      }
+
+    map.put(name, object);
+  }
+
+  /**
+   * Removes the given name, if present.
+   *
+   * @param name a name to remove.
+   */
+  public void remove(NameComponent name)
+  {
+    map.remove(name);
+  }
+
+  /**
+   * Get the size of the map.
+   */
+  public int size()
+  {
+    return map.size();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,164 @@
+/* NamingServiceTransient.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.CORBA.NamingService;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.IOR;
+
+import org.omg.CosNaming.NamingContextExt;
+
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * The server for the gnu classpath naming service. This is an executable class
+ * that must be started to launch the GNU Classpath CORBA transient naming
+ * service.
+ * 
+ * GNU Classpath currently works with this naming service and is also
+ * interoperable with the Sun Microsystems naming services from releases 1.3 and
+ * 1.4, both transient <i>tnameserv</i> and persistent <i>orbd</i>.
+ * 
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class NamingServiceTransient
+{
+  /**
+   * The default port (900), on that the naming service starts if no
+   * -ORBInitialPort is specified in the command line.
+   */
+  public static final int PORT = 900;
+
+  /**
+   * Get the object key for the naming service. The default key is the string
+   * "NameService" in ASCII.
+   * 
+   * @return the byte array.
+   */
+  public static byte[] getDefaultKey()
+  {
+    try
+      { // NameService
+        return "NameService".getBytes("UTF-8");
+      }
+    catch (UnsupportedEncodingException ex)
+      {
+        throw new InternalError("UTF-8 unsupported");
+      }
+  }
+
+  /**
+   * Start the naming service on the current host at the given port. The
+   * parameter -org.omg.CORBA.ORBInitialPort NNN or -ORBInitialPort NNN, if
+   * present, specifies the port, on that the service must be started. If this
+   * key is not specified, the service starts at the port 900.
+   * 
+   * The parameter -ior FILE_NAME, if present, forces to store the ior string of
+   * this naming service to the specified file.
+   * 
+   * @param args the parameter string.
+   */
+  public static void main(String[] args)
+  {
+    int port = PORT;
+    String iorf = null;
+    try
+      {
+        // Create and initialize the ORB
+        final OrbFunctional orb = new OrbFunctional();
+
+        if (args.length > 1)
+          for (int i = 0; i < args.length - 1; i++)
+            {
+              if (args[i].endsWith("ORBInitialPort"))
+                port = Integer.parseInt(args[i + 1]);
+
+              if (args[i].equals("-ior"))
+                iorf = args[i + 1];
+            }
+
+        OrbFunctional.setPort(port);
+
+        // Create the servant and register it with the ORB
+        NamingContextExt namer = new Ext(new TransientContext());
+
+        // Case with the key "NameService".
+        orb.connect(namer, "NameService".getBytes());
+
+        // Storing the IOR reference.
+        String ior = orb.object_to_string(namer);
+        IOR iorr = IOR.parse(ior);
+        if (iorf != null)
+          {
+            FileOutputStream f = new FileOutputStream(iorf);
+            PrintStream p = new PrintStream(f);
+            p.print(ior);
+            p.close();
+          }
+
+        System.out.println("GNU Classpath transient naming service "
+          + "started at " + iorr.Internet.host + ":" + iorr.Internet.port
+          + " key 'NameService'.\n\n"
+          + "Copyright (C) 2006 Free Software Foundation\n"
+          + "This tool comes with ABSOLUTELY NO WARRANTY. "
+          + "This is free software, and you are\nwelcome to "
+          + "redistribute it under conditions, defined in "
+          + "GNU Classpath license.\n\n" + ior);
+
+        new Thread()
+        {
+          public void run()
+          {
+            // Wait for invocations from clients.
+            orb.run();
+          }
+        }.start();
+      }
+    catch (Exception e)
+      {
+        System.err.println("ERROR: " + e);
+        e.printStackTrace(System.out);
+      }
+
+    // Restore the default value for allocating ports for the subsequent
+    // objects.
+    OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/NamingService/TransientContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,441 @@
+/* nContext.java -- implementation of NamingContext
+   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.CORBA.NamingService;
+
+import org.omg.CORBA.Object;
+import org.omg.CosNaming.Binding;
+import org.omg.CosNaming.BindingIteratorHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextOperations;
+import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
+import org.omg.CosNaming.NamingContextPackage.CannotProceed;
+import org.omg.CosNaming.NamingContextPackage.InvalidName;
+import org.omg.CosNaming.NamingContextPackage.NotEmpty;
+import org.omg.CosNaming.NamingContextPackage.NotFound;
+import org.omg.CosNaming.NamingContextPackage.NotFoundReason;
+import org.omg.CosNaming._NamingContextImplBase;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * This class implements the transient naming service, defined by
+ * {@link NamingContext}. The 'transient' means that the service does
+ * not store its state into the persistent memory. If the service is
+ * restarted, the named objects must be re-registered again.
+ *
+ * TODO Write the persistent naming service.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class TransientContext
+  extends _NamingContextImplBase
+  implements NamingContext, NamingContextOperations
+{
+  /**
+   * Use serial version UID for interoperability.
+   */
+  private static final long serialVersionUID = 2;
+  
+  /**
+   * The already named contexts.
+   */
+  protected final NamingMap named_contexts;
+
+  /**
+   * The already named objects.
+   */
+  protected final NamingMap named_objects;
+  
+  /**
+   * Create the naming conetxt with default (transient) naming maps.
+   */
+  public TransientContext()
+  {
+    this(new NamingMap(), new NamingMap());
+  }
+  
+  /**
+   * Create the naming conetxt with the two provided naming maps.
+   * 
+   * @param context_map the map for contexts
+   * @param object_map the map for objectss
+   */
+  public TransientContext(NamingMap context_map, NamingMap object_map)
+  {
+    named_contexts = context_map;
+    named_objects = object_map;
+  }
+
+  /**
+   * Gives the object a name, valid in this context.
+   *
+   * @param a_name the name, being given to the object.
+   * @param an_object the object, being named.
+   *
+   * @throws AlreadyBound if the object is already named in this context.
+   * @throws InvalidName if the name has zero length or otherwise invalid.
+   */
+  public void bind(NameComponent[] a_name, Object an_object)
+            throws NotFound, CannotProceed, InvalidName, AlreadyBound
+  {
+    if (a_name.length == 1)
+      named_objects.bind(a_name [ 0 ], an_object);
+    else
+      {
+        NamingContext context =
+          (NamingContext) named_contexts.get(a_name [ 0 ]);
+        context.bind(getSuffix(a_name), an_object);
+      }
+  }
+
+  /**
+   * Gives a child context name, valid in this context.
+   *
+   * @param a_name the name, being given to the child context.
+   * @param a_context the child context being named.
+   *
+   * @throws AlreadyBound if the child context is already named in
+   * the current context.
+   */
+  public void bind_context(NameComponent[] a_name, NamingContext a_context)
+                    throws NotFound, CannotProceed, InvalidName, AlreadyBound
+  {
+    if (a_name.length == 1)
+      named_contexts.bind(a_name [ 0 ], a_context);
+    else
+      {
+        NamingContext context =
+          (NamingContext) named_contexts.get(a_name [ 0 ]);
+        context.bind_context(getSuffix(a_name), a_context);
+      }
+  }
+
+  /**
+   * Create a new context and give it a given name (bound it)
+   * in the current context.
+   *
+   * The context being created is returned by calling
+   * {@link #new_context()}.
+   *
+   * @param a_name the name being given to the new context.
+   *
+   * @return the newly created context.
+   *
+   * @throws AlreadyBound if the name is already in use.
+   * @throws InvalidName if the name has zero length or otherwise invalid.
+   */
+  public NamingContext bind_new_context(NameComponent[] a_name)
+                                 throws NotFound, AlreadyBound, CannotProceed,
+                                        InvalidName
+  {
+    if (named_contexts.containsKey(a_name [ 0 ]) ||
+        named_objects.containsKey(a_name [ 0 ])
+       )
+      throw new AlreadyBound();
+
+    NamingContext child = new_context();
+    bind_context(a_name, child);
+    return child;
+  }
+
+  /**
+   * Destroy this context (must be empty).
+   * @throws NotEmpty if the context being destroyed is not empty.
+   */
+  public void destroy()
+               throws NotEmpty
+  {
+    if (named_contexts.size() > 0 || named_objects.size() > 0)
+      throw new NotEmpty();
+  }
+
+  /**
+   * Iterate over all bindings, defined in this namind context.
+   *
+   * @param amount the maximal number of context to return in the
+   * holder a_list. The remaining bindings are accessible via iterator
+   * an_iter. If the parameter amount is zero, all bindings are accessed only
+   * via this iterator.
+   *
+   * This implementation list contexts first, then objects.
+   *
+   * @param a_list the holder, where the returned bindigs are stored.
+   * @param an_iter the iterator that can be used to access the remaining
+   * bindings.
+   */
+  public void list(int amount, BindingListHolder a_list,
+                   BindingIteratorHolder an_iter
+                  )
+  {
+    int nb = named_contexts.size() + named_objects.size();
+    int nl = nb;
+    if (nl > amount)
+      nl = amount;
+
+    a_list.value = new Binding[ nl ];
+
+    Iterator contexts = named_contexts.entries().iterator();
+    Iterator objects = named_objects.entries().iterator();
+
+    // Create a binding list.
+    for (int i = 0; i < nl; i++)
+      {
+        if (contexts.hasNext())
+          a_list.value [ i ] = mkBinding(contexts.next(), BindingType.ncontext);
+        else if (objects.hasNext())
+          a_list.value [ i ] = mkBinding(objects.next(), BindingType.nobject);
+        else
+          throw new InternalError();
+      }
+
+    // Create an iterator.
+    Binding[] remainder = new Binding[ nb - nl ];
+    int p = 0;
+
+    while (contexts.hasNext())
+      remainder [ p++ ] = mkBinding(contexts.next(), BindingType.ncontext);
+
+    while (objects.hasNext())
+      remainder [ p++ ] = mkBinding(objects.next(), BindingType.nobject);
+
+    Binding_iterator_impl bit = new Binding_iterator_impl(remainder);
+    _orb().connect(bit);
+    an_iter.value = bit;
+  }
+
+  /**
+   * Creates a new naming context, not bound to any name.
+   */
+  public NamingContext new_context()
+  {
+    Ext context = new Ext(new TransientContext());
+
+    // Connect the context to the current ORB:
+    _orb().connect(context);
+    return context;
+  }
+
+  /**
+   * Names or renames the object.
+   *
+   * @param a_name the new name, being given to the object
+   * in the scope of the current context. If the object is already
+   * named in this context, it is renamed.
+   *
+   * @param an_object the object, being named.
+   *
+   * @throws InvalidName if the name has zero length or otherwise invalid.
+   */
+  public void rebind(NameComponent[] a_name, Object an_object)
+              throws NotFound, CannotProceed, InvalidName
+  {
+    if (a_name.length == 1)
+      named_objects.rebind(a_name [ 0 ], an_object);
+    else
+      {
+        NamingContext context =
+          (NamingContext) named_contexts.get(a_name [ 0 ]);
+        context.rebind(getSuffix(a_name), an_object);
+      }
+  }
+
+  /**
+   * Names or renames the child context.
+   * If the child context is already named in
+   * the current context, it is renamed. The the name being given is in
+   * use, the old meaning of the name is discarded.
+   *
+   * @param a_name the name, being given to the child context in the scope
+   * of the current context.
+   *
+   * @param a_context the child context being named.
+   *
+   * @throws InvalidName if the name has zero length or otherwise invalid.
+   */
+  public void rebind_context(NameComponent[] a_name, NamingContext a_context)
+                      throws NotFound, CannotProceed, InvalidName
+  {
+    if (a_name.length == 1)
+      named_contexts.rebind(a_name [ 0 ], a_context);
+    else
+      {
+        NamingContext context =
+          (NamingContext) named_contexts.get(a_name [ 0 ]);
+        context.rebind_context(getSuffix(a_name), a_context);
+      }
+  }
+
+  /**
+   * Get the object, bound to the specified name in this
+   * context. The given object must match the bound
+   * name.
+   *
+   * This implementation resolves the names as defined in specification
+   * of the CORBA naming service. This means, if the beginning of the
+   * name can be resolved to some naming context, the request is
+   * forwarded to this context, passing the unresolved name part as a
+   * parameter. In this way, it is possible to have a hierarchy of the
+   * naming services. The central services resolve the the beginning
+   * of the name. The local services resolve the remaining nodes of the
+   * name that may be relevant to some local details. It can be three or
+   * more ranks of the naming services.
+   *
+   * @param a_name the object name.
+   *
+   * @return the object, matching this name. The client
+   * usually casts or narrows (using the helper) the returned value
+   * to the more specific type.
+   *
+   * @throws NotFound if the name cannot be resolved.
+   * @throws InvalidName if the name has zero length or otherwise invalid.
+   */
+  public Object resolve(NameComponent[] a_name)
+                 throws NotFound, CannotProceed, InvalidName
+  {
+    NameValidator.check(a_name);
+
+    if (a_name.length > 1)
+      return resolveSubContext(a_name);
+    else
+      {
+        // A single node name.
+        org.omg.CORBA.Object object;
+
+        object = named_objects.get(a_name [ 0 ]);
+        if (object != null)
+          return object;
+
+        object = named_contexts.get(a_name [ 0 ]);
+        if (object != null)
+          return object;
+      }
+
+    throw new NotFound(NotFoundReason.missing_node, a_name);
+  }
+
+  /**
+   * Removes the name from the binding context.
+   *
+   * @param a_name a name to remove.
+   *
+   * @throws InvalidName if the name has zero length or otherwise invalid.
+   */
+  public void unbind(NameComponent[] a_name)
+              throws NotFound, CannotProceed, InvalidName
+  {
+    NameValidator.check(a_name);
+
+    // Single node name - handle it.
+    if (a_name.length == 1)
+      {
+        if (named_objects.containsKey(a_name [ 0 ]))
+          named_objects.remove(a_name [ 0 ]);
+        else if (named_contexts.containsKey(a_name [ 0 ]))
+          named_contexts.remove(a_name [ 0 ]);
+        else
+          throw new NotFound(NotFoundReason.missing_node, a_name);
+      }
+    else
+      {
+        // Handle the first node and forward the command.
+        NamingContext subcontext =
+          (NamingContext) named_contexts.get(a_name [ 0 ]);
+
+        if (subcontext == null)
+          throw new NotFound(NotFoundReason.missing_node, a_name);
+
+        subcontext.unbind(getSuffix(a_name));
+      }
+  }
+
+  /**
+   * Get the name suffix, discarding the first member.
+   */
+  private NameComponent[] getSuffix(NameComponent[] a_name)
+  {
+    NameComponent[] suffix = new NameComponent[ a_name.length - 1 ];
+    System.arraycopy(a_name, 1, suffix, 0, suffix.length);
+    return suffix;
+  }
+
+  /**
+   * Create a binding.
+   *
+   * @param an_entry the entry, defining the bound object.
+   * @param type the binding type.
+   * @return the created binding.
+   */
+  private Binding mkBinding(java.lang.Object an_entry, BindingType type)
+  {
+    Map.Entry entry = (Map.Entry) an_entry;
+    Binding b = new Binding();
+
+    // The name component has always only one node (the current context)
+    b.binding_name = new NameComponent[] { (NameComponent) entry.getKey() };
+    b.binding_type = type;
+    return b;
+  }
+
+  /**
+   * Find the context, bound to the first name of the given
+   * name, and pass the remainder (without the first node)
+   * of the name for that context to resolve.
+   *
+   * @param a_name the name to resolve.
+   *
+   * @return the resolved context
+   */
+  private Object resolveSubContext(NameComponent[] a_name)
+                            throws NotFound, CannotProceed, InvalidName
+  {
+    // A multiple node name.
+    // This context resolves the first node only.
+    NamingContext context = (NamingContext) named_contexts.get(a_name [ 0 ]);
+    if (context == null)
+      throw new NotFound(NotFoundReason.missing_node, a_name);
+
+    NameComponent[] suffix = getSuffix(a_name);
+
+    return context.resolve(suffix);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ObjectCreator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ObjectCreator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ObjectCreator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ObjectCreator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,590 @@
+/* ObjectCreator.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.CORBA;
+
+import gnu.CORBA.CDR.UnknownExceptionCtxHandler;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.GIOP.ServiceContext;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.classpath.VMStackWalker;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.CompletionStatusHelper;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueBase;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javax.rmi.CORBA.Util;
+
+/**
+ * Creates java objects from the agreed IDL names for the simple case when the
+ * CORBA object is directly mapped into the locally defined java class.
+ * 
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ObjectCreator
+{
+  /**
+   * The standard OMG prefix.
+   */
+  public static final String OMG_PREFIX = "omg.org/";
+
+  /**
+   * The standard java prefix.
+   */
+  public static final String JAVA_PREFIX = "org.omg.";
+
+  /**
+   * The prefix for classes that are placed instide the gnu.CORBA namespace.
+   */
+  public static final String CLASSPATH_PREFIX = "gnu.CORBA.";
+
+  /**
+   * Maps classes to they IDL or RMI names. Computing RMI name is an expensive
+   * operations, so frequently used RMI keys are reused. The map must be weak to
+   * ensure that the class can be unloaded, when applicable.
+   */
+  public static Map m_names = new WeakHashMap();
+
+  /**
+   * Maps IDL strings into known classes. The map must be weak to ensure that
+   * the class can be unloaded, when applicable.
+   */
+  public static Map m_classes = new WeakHashMap();
+
+  /**
+   * Maps IDL types to they helpers.
+   */
+  public static Map m_helpers = new WeakHashMap();
+
+  /**
+   * Try to instantiate an object with the given IDL name. The object must be
+   * mapped to the local java class. The omg.org domain must be mapped into the
+   * object in either org/omg or gnu/CORBA namespace.
+   * 
+   * @param IDL name
+   * @return instantiated object instance or null if no such available.
+   */
+  public static java.lang.Object createObject(String idl, String suffix)
+  {
+    synchronized (m_classes)
+      {
+        Class known = (Class) (suffix == null ? m_classes.get(idl)
+          : m_classes.get(idl + 0xff + suffix));
+        Object object;
+
+        if (known != null)
+          {
+            try
+              {
+                return known.newInstance();
+              }
+            catch (Exception ex)
+              {
+                RuntimeException rex = new RuntimeException(idl + " suffix "
+                  + suffix, ex);
+                throw rex;
+              }
+          }
+        else
+          {
+            if (suffix == null)
+              suffix = "";
+            try
+              {
+                known = forName(toClassName(JAVA_PREFIX, idl) + suffix);
+                object = known.newInstance();
+              }
+            catch (Exception ex)
+              {
+                try
+                  {
+                    known = forName(toClassName(CLASSPATH_PREFIX, idl)
+                      + suffix);
+                    object = known.newInstance();
+                  }
+                catch (Exception exex)
+                  {
+                    return null;
+                  }
+              }
+            m_classes.put(idl + 0xff + suffix, known);
+            return object;
+          }
+      }
+  }
+
+  /**
+   * Read the system exception from the given stream.
+   * 
+   * @param input the CDR stream to read from.
+   * @param contexts the service contexts in request/reply header/
+   * 
+   * @return the exception that has been stored in the stream (IDL name, minor
+   * code and completion status).
+   */
+  public static SystemException readSystemException(InputStream input,
+    ServiceContext[] contexts)
+  {
+    SystemException exception;
+
+    String idl = input.read_string();
+    int minor = input.read_ulong();
+    CompletionStatus completed = CompletionStatusHelper.read(input);
+
+    try
+      {
+        exception = (SystemException) createObject(idl, null);
+        exception.minor = minor;
+        exception.completed = completed;
+      }
+    catch (Exception ex)
+      {
+        UNKNOWN u = new UNKNOWN("Unsupported system exception " + idl, minor,
+          completed);
+        u.initCause(ex);
+        throw u;
+      }
+
+    try
+      {
+        // If UnknownExceptionInfo is present in the contexts, read it and
+        // set as a cause of this exception.
+        ServiceContext uEx = ServiceContext.find(
+          ServiceContext.UnknownExceptionInfo, contexts);
+
+        if (uEx != null)
+          {
+            BufferredCdrInput in = new BufferredCdrInput(uEx.context_data);
+            in.setOrb(in.orb());
+            if (input instanceof AbstractCdrInput)
+              {
+                ((AbstractCdrInput) input).cloneSettings(in);
+              }
+
+            Throwable t = UnknownExceptionCtxHandler.read(in, contexts);
+            exception.initCause(t);
+          }
+      }
+    catch (Exception ex)
+      {
+        // Unsupported context format. Do not terminate as the user program may
+        // not need it.
+      }
+
+    return exception;
+  }
+
+  /**
+   * Reads the user exception, having the given Id, from the input stream. The
+   * id is expected to be in the form like
+   * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
+   * 
+   * @param idl the exception idl name.
+   * @param input the stream to read from.
+   * 
+   * @return the loaded exception.
+   * @return null if the helper class cannot be found.
+   */
+  public static UserException readUserException(String idl, InputStream input)
+  {
+    try
+      {
+        Class helperClass = findHelper(idl);
+
+        Method read = helperClass.getMethod("read",
+          new Class[] { org.omg.CORBA.portable.InputStream.class });
+
+        return (UserException) read.invoke(null, new Object[] { input });
+      }
+    catch (MARSHAL mex)
+      {
+        // This one is ok to throw
+        throw mex;
+      }
+    catch (Exception ex)
+      {
+        ex.printStackTrace();
+        return null;
+      }
+  }
+
+  /**
+   * Gets the helper class name from the string like
+   * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
+   * 
+   * @param IDL the idl name.
+   */
+  public static String toHelperName(String IDL)
+  {
+    String s = IDL;
+    int a = s.indexOf(':') + 1;
+    int b = s.lastIndexOf(':');
+
+    s = IDL.substring(a, b);
+
+    if (s.startsWith(OMG_PREFIX))
+      s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
+
+    return s.replace('/', '.') + "Helper";
+  }
+
+  /**
+   * Writes the system exception data to CDR output stream.
+   * 
+   * @param output a stream to write data to.
+   * @param ex an exception to write.
+   */
+  public static void writeSystemException(OutputStream output,
+    SystemException ex)
+  {
+    String exIDL = getRepositoryId(ex.getClass());
+    output.write_string(exIDL);
+    output.write_ulong(ex.minor);
+    CompletionStatusHelper.write(output, ex.completed);
+  }
+
+  /**
+   * Converts the given IDL name to class name.
+   * 
+   * @param IDL the idl name.
+   * 
+   */
+  protected static String toClassName(String prefix, String IDL)
+  {
+    String s = IDL;
+    int a = s.indexOf(':') + 1;
+    int b = s.lastIndexOf(':');
+
+    s = IDL.substring(a, b);
+
+    if (s.startsWith(OMG_PREFIX))
+      s = prefix + s.substring(OMG_PREFIX.length());
+
+    return s.replace('/', '.');
+  }
+
+  /**
+   * Converts the given IDL name to class name and tries to load the matching
+   * class. The OMG prefix (omg.org) is replaced by the java prefix org.omg. No
+   * other prefixes are added.
+   * 
+   * @param IDL the idl name.
+   * 
+   * @return the matching class or null if no such is available.
+   */
+  public static Class Idl2class(String IDL)
+  {
+    synchronized (m_classes)
+      {
+        Class c = (Class) m_classes.get(IDL);
+
+        if (c != null)
+          return c;
+        else
+          {
+            String s = IDL;
+            int a = s.indexOf(':') + 1;
+            int b = s.lastIndexOf(':');
+
+            s = IDL.substring(a, b);
+
+            if (s.startsWith(OMG_PREFIX))
+              s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
+
+            String cn = s.replace('/', '.');
+
+            try
+              {
+                c = forName(cn);
+                m_classes.put(IDL, c);
+                return c;
+              }
+            catch (ClassNotFoundException ex)
+              {
+                return null;
+              }
+          }
+      }
+  }
+
+  /**
+   * Converts the given IDL name to class name, tries to load the matching class
+   * and create an object instance with parameterless constructor. The OMG
+   * prefix (omg.org) is replaced by the java prefix org.omg. No other prefixes
+   * are added.
+   * 
+   * @param IDL the idl name.
+   * 
+   * @return instantiated object instance or null if such attempt was not
+   * successful.
+   */
+  public static java.lang.Object Idl2Object(String IDL)
+  {
+    Class cx = Idl2class(IDL);
+
+    try
+      {
+        if (cx != null)
+          return cx.newInstance();
+        else
+          return null;
+      }
+    catch (Exception ex)
+      {
+        return null;
+      }
+  }
+
+  /**
+   * Convert the class name to IDL or RMI name (repository id). If the class
+   * inherits from IDLEntity, ValueBase or SystemException, returns repository
+   * Id in the IDL:(..) form. If it does not, returns repository Id in the
+   * RMI:(..) form.
+   * 
+   * @param cx the class for that the name must be computed.
+   * 
+   * @return the idl or rmi name.
+   */
+  public static synchronized String getRepositoryId(Class cx)
+  {
+    String name = (String) m_names.get(cx);
+    if (name != null)
+      return name;
+
+    String cn = cx.getName();
+    if (!(IDLEntity.class.isAssignableFrom(cx)
+      || ValueBase.class.isAssignableFrom(cx) || SystemException.class.isAssignableFrom(cx)))
+      {
+        // Not an IDL entity.
+        name = Util.createValueHandler().getRMIRepositoryID(cx);
+      }
+    else
+      {
+        if (cn.startsWith(JAVA_PREFIX))
+          cn = OMG_PREFIX
+            + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
+        else if (cn.startsWith(CLASSPATH_PREFIX))
+          cn = OMG_PREFIX
+            + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');
+
+        name = "IDL:" + cn + ":1.0";
+      }
+    m_names.put(cx, name);
+    return name;
+  }
+
+  /**
+   * Insert the passed parameter into the given Any, assuming that the helper
+   * class is available. The helper class must have the "Helper" suffix and be
+   * in the same package as the class of the object being inserted.
+   * 
+   * @param into the target to insert.
+   * 
+   * @param object the object to insert. It can be any object as far as the
+   * corresponding helper is provided.
+   * 
+   * @return true on success, false otherwise.
+   */
+  public static boolean insertWithHelper(Any into, Object object)
+  {
+    try
+      {
+        String helperClassName = object.getClass().getName() + "Helper";
+        Class helperClass = forName(helperClassName);
+
+        Method insert = helperClass.getMethod("insert", new Class[] {
+          Any.class, object.getClass() });
+
+        insert.invoke(null, new Object[] { into, object });
+
+        return true;
+      }
+    catch (Exception exc)
+      {
+        // Failed due some reason.
+        return false;
+      }
+  }
+
+  /**
+   * Insert the system exception into the given Any.
+   */
+  public static boolean insertSysException(Any into, SystemException exception)
+  {
+    try
+      {
+        BufferedCdrOutput output = new BufferedCdrOutput();
+
+        String m_exception_id = getRepositoryId(exception.getClass());
+        output.write_string(m_exception_id);
+        output.write_ulong(exception.minor);
+        CompletionStatusHelper.write(output, exception.completed);
+
+        String name = getDefaultName(m_exception_id);
+
+        GeneralHolder h = new GeneralHolder(output);
+
+        into.insert_Streamable(h);
+
+        RecordTypeCode r = new RecordTypeCode(TCKind.tk_except);
+        r.setId(m_exception_id);
+        r.setName(name);
+        into.type(r);
+
+        return true;
+      }
+    catch (Exception ex)
+      {
+        ex.printStackTrace();
+        return false;
+      }
+  }
+
+  /**
+   * Get the type name from the IDL string.
+   */
+  public static String getDefaultName(String idl)
+  {
+    int f1 = idl.lastIndexOf("/");
+    int p1 = (f1 < 0) ? 0 : f1;
+    int p2 = idl.indexOf(":", p1);
+    if (p2 < 0)
+      p2 = idl.length();
+
+    String name = idl.substring(f1 + 1, p2);
+    return name;
+  }
+
+  /**
+   * Insert this exception into the given Any. On failure, insert the UNKNOWN
+   * exception.
+   */
+  public static void insertException(Any into, Throwable exception)
+  {
+    boolean ok = false;
+    if (exception instanceof SystemException)
+      ok = insertSysException(into, (SystemException) exception);
+    else if (exception instanceof UserException)
+      ok = insertWithHelper(into, exception);
+
+    if (!ok)
+      ok = insertSysException(into, new UNKNOWN());
+    if (!ok)
+      throw new InternalError("Exception wrapping broken");
+  }
+
+  /**
+   * Find helper for the class with the given name.
+   */
+  public static Class findHelper(String idl)
+  {
+    synchronized (m_helpers)
+      {
+        Class c = (Class) m_helpers.get(idl);
+        if (c != null)
+          return c;
+        try
+          {
+            String helper = toHelperName(idl);
+            c = forName(helper);
+
+            m_helpers.put(idl, c);
+            return c;
+          }
+        catch (Exception ex)
+          {
+            return null;
+          }
+      }
+  }
+  
+  /**
+   * Load the class with the given name. This method tries to use the context
+   * class loader first. If this fails, it searches for the suitable class
+   * loader in the caller stack trace. This method is a central point where all
+   * requests to find a class by name are delegated.
+   */
+  public static Class forName(String className) throws ClassNotFoundException
+  {
+    try
+      {
+        return Class.forName(className, true,
+                             Thread.currentThread().getContextClassLoader());
+      }
+    catch (ClassNotFoundException nex)
+      {
+        /**
+         * Returns the first user defined class loader on the call stack, or
+         * null when no non-null class loader was found.
+         */
+        Class[] ctx = VMStackWalker.getClassContext();
+        for (int i = 0; i < ctx.length; i++)
+          {
+            // Since we live in a class loaded by the bootstrap
+            // class loader, getClassLoader is safe to call without
+            // needing to be wrapped in a privileged action.
+            ClassLoader cl = ctx[i].getClassLoader();
+            try
+              {
+                if (cl != null)
+                  return Class.forName(className, true, cl);
+              }
+            catch (ClassNotFoundException nex2)
+              {
+                // Try next.
+              }
+          }
+      }
+    throw new ClassNotFoundException(className);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OctetHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OctetHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OctetHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OctetHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,129 @@
+/* OctetHolder.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.CORBA;
+
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+
+/**
+ * A holder for CORBA <code>octet</code> that is mapped into
+ * java <code>long</code>.
+ *
+ * The holders have several application areas. The end user usually
+ * sees them implementing CORBA methods where the primitive type
+ * is passed by reference. While CORBA (or, for example, C) supports
+ * this, the java does not and a wrapper class is required.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public final class OctetHolder
+  implements Streamable
+{
+  /**
+   * The default type code for this holder.
+   */
+  private static final TypeCode t_octet =
+    new PrimitiveTypeCode(TCKind.tk_octet);
+
+  /**
+   * The <code>long</code> (CORBA <code>octet</code>) value,
+   * held by this OctetHolder.
+   */
+  public byte value;
+
+  /**
+   * Constructs an instance of OctetHolder,
+   * initializing {@link #value} to <code>0 </code>.
+   */
+  public OctetHolder()
+  {
+  }
+
+  /**
+   * Constructs an instance of OctetHolder,
+   * initializing {@link #value} to the given <code>octed</code> (byte).
+   *
+   * @param initial_value a value that will be assigned to the
+   * {@link #value} field.
+   */
+  public OctetHolder(byte initial_value)
+  {
+    value = initial_value;
+  }
+
+  /**
+   * Fill in the {@link value } field by reading the required data
+   * from the given stream. For <code>octet</code>, the functionality
+   * is delegated to
+   * {@link org.omg.CORBA.portable.InputStream#read_octet}.
+   *
+   * @param input the input stream to read from.
+   */
+  public void _read(InputStream input)
+  {
+    value = input.read_octet();
+  }
+
+  /**
+   * Returns the TypeCode, corresponding the CORBA type that is stored
+   * using this holder.
+   */
+  public TypeCode _type()
+  {
+    return t_octet;
+  }
+
+  /**
+   * Write the {@link value } field to the given stream.
+   * For <code>octet</code>, the functionality
+   * is delegated to
+   * {@link org.omg.CORBA.portable.OutputStream#write_octet(long) }.
+   *
+   * @param output the output stream to write into.
+   */
+  public void _write(OutputStream output)
+  {
+    output.write_octet(value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFocused.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFocused.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFocused.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFocused.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,375 @@
+/* OrbFocused.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.CORBA;
+
+import gnu.CORBA.Poa.ORB_1_4;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.portable.InvokeHandler;
+
+import java.applet.Applet;
+import java.net.ServerSocket;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Random;
+import java.util.StringTokenizer;
+
+/**
+ * This class implements the ORB that uses a single port or the restricted port
+ * range for all its objects. It is required to for use together with various
+ * firewalls that does not allow opening multiple randomly selected ports, as
+ * the defauld CORBA implementation used to do. The firewal must be configured
+ * to allow CORBA to work on one fixed port or (for better performance) on a
+ * small fixed range of ports. This does not restrict the maximal number of the
+ * connected objects as the objects can share the same port.
+ * 
+ * The used port or the used port range can be specified via property
+ * gnu.CORBA.ListenerPort. The value of this property is a single port or range
+ * of ports, boundary values (inclusive) being separeted by dash (for instance,
+ * "1245-1250").
+ * 
+ * It is possible to instantiate multiple instances of the focused ORBs and
+ * combine them with the ordinary ORBs. If you instantiate several instances of
+ * the focused ORBs on the same host, they used port sets should not overlap.
+ * 
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class OrbFocused
+  extends ORB_1_4
+{
+  /**
+   * The name of the fixed port range property. The presence of this property
+   * indicates that the default focused ORB must be used.
+   */
+  public static final String LISTENER_PORT = "gnu.CORBA.ListenerPort";
+
+  /**
+   * The start of the range of the available ports, inclusive.
+   */
+  int m_ports_from = -1;
+
+  /**
+   * The end of the range of the available ports, inclusive.
+   */
+  int m_ports_to = -1;
+
+  /**
+   * The requests to port are served in parallel threads.
+   */
+  static final int PARALLEL = 0;
+
+  /**
+   * The requests to port are served in the same thread.
+   */
+  static final int SEQUENTIAL = 1;
+
+  /**
+   * The random number generator to get a random port in the valid range.
+   */
+  Random m_random = new Random();
+
+  /**
+   * Parse the "gnu.CORBA.ListenerPort" property and initialize the valid port
+   * set range.
+   */
+  public void setPortRange(String property)
+  {
+    int from, to;
+    try
+      {
+        StringTokenizer st = new StringTokenizer(property, " -");
+        if (st.countTokens() == 1)
+          from = to = Integer.parseInt(st.nextToken());
+        else
+          {
+            from = Integer.parseInt(st.nextToken());
+            to = Integer.parseInt(st.nextToken());
+            m_random = new Random();
+          }
+        setPortRange(from, to);
+      }
+    catch (Exception ex)
+      {
+        throw new BAD_PARAM("Unable to parse port range '" + property + "'");
+      }
+  }
+
+  /**
+   * Set the port range.
+   * 
+   * @param from - start of the port range, inclusive.
+   * @param to - end of the port range, inclusive.
+   */
+  public void setPortRange(int from, int to)
+  {
+    if (from < 0 || to < 0 || to < from)
+      throw new BAD_PARAM("Invalid range");
+    m_ports_from = from;
+    m_ports_to = to;
+  }
+
+  /**
+   * Get the port from the previously specified usage range.
+   */
+  int getPortFromRange(int attempt)
+  {
+    if (m_ports_from == m_ports_to)
+      return m_ports_from;
+    else if (m_ports_to - m_ports_from < RANDOM_PORT_ATTEMPTS)
+      return m_ports_from + (attempt % (m_ports_to - m_ports_from + 1));
+    else
+      return m_random.nextInt(m_ports_to - m_ports_from + 1) + m_ports_from;
+  }
+
+  /**
+   * Get the shared port server where the new object can be added. This may
+   * result reusing the existing server or instantiating a new server. If the
+   * new server is instantiated and the ORB is already running, the server is
+   * started.
+   */
+  protected portServer getPortServer(int type)
+  {
+    portServer p;
+
+    int n;
+    if (m_ports_from < m_ports_to)
+      n = RANDOM_PORT_ATTEMPTS;
+    else
+      n = 1;
+
+    Ports: for (int a = 0; a < n; a++)
+      {
+        int port = getPortFromRange(a);
+        for (int i = 0; i < portServers.size(); i++)
+          {
+            p = (portServer) portServers.get(i);
+            if (p.s_port == port)
+              {
+                return (portServer) p;
+              }
+          }
+        // The server is not yet instantiated. Instantiate.
+        try
+          {
+            // Check if the port is ok:
+            ServerSocket s = socketFactory.createServerSocket(port);
+            s.close();
+
+            portServer shared;
+
+            switch (type)
+              {
+                case PARALLEL:
+                  shared = new portServer(port);
+                  break;
+
+                case SEQUENTIAL:
+                  shared = new sharedPortServer(port);
+                  break;
+
+                default:
+                  throw new InternalError("Invalid server type " + type);
+              }
+
+            portServers.add(shared);
+
+            if (running)
+              shared.start();
+
+            return shared;
+          }
+        catch (Exception ex)
+          {
+            // Port is taken or probably other problems.
+            continue Ports;
+          }
+      }
+    throw new NO_RESOURCES("No free port available at " + m_ports_from + "-"
+      + m_ports_to, Minor.Ports, CompletionStatus.COMPLETED_NO);
+  }
+
+  /**
+   * Start the ORBs main working cycle (receive invocation - invoke on the local
+   * object - send response - wait for another invocation).
+   * 
+   * The method only returns after calling {@link #shutdown(boolean)}.
+   */
+  public void run()
+  {
+    if (m_ports_from < 0 || m_ports_to < 0)
+      throw new BAD_INV_ORDER("For " + getClass().getName() + " "
+        + LISTENER_PORT + " property must be set");
+
+    running = true;
+
+    // Start all port servers. In the current subclass, the portServers
+    // collection must be already filled in.
+    Iterator iter = portServers.iterator();
+
+    while (iter.hasNext())
+      {
+        portServer subserver = (portServer) iter.next();
+
+        if (!subserver.isAlive())
+          {
+            // Reuse the current thread for the last portServer.
+            if (!iter.hasNext())
+              {
+                // Discard the iterator.
+                iter = null;
+                subserver.run();
+                return;
+              }
+            else
+              subserver.start();
+          }
+      }
+  }
+
+  /**
+   * Get free port from the allowed range. This method instantiates the port
+   * server for the returned port.
+   */
+  public int getFreePort()
+    throws BAD_OPERATION
+  {
+    portServer s = getPortServer(PARALLEL);
+    return s.s_port;
+  }
+
+  /**
+   * Connect the given CORBA object to this ORB, explicitly specifying the
+   * object key and the identity of the thread (and port), where the object must
+   * be served. The identity is normally the POA.
+   * 
+   * The new port server will be started only if there is no one already running
+   * for the same identity. Otherwise, the task of the existing port server will
+   * be widened, including duty to serve the given object. All objects,
+   * connected to a single identity by this method, will process they requests
+   * subsequently in the same thread. The method is used when the expected
+   * number of the objects is too large to have a single port and thread per
+   * object. This method is used by POAs, having a single thread policy.
+   * 
+   * @param object the object, must implement the {@link InvokeHandler})
+   * interface.
+   * @param key the object key, usually used to identify the object from remote
+   * side.
+   * @param port the port, where the object must be connected.
+   * 
+   * @throws BAD_PARAM if the object does not implement the
+   * {@link InvokeHandler}).
+   */
+  public void connect_1_thread(org.omg.CORBA.Object object, byte[] key,
+    java.lang.Object identity)
+  {
+    sharedPortServer shared = (sharedPortServer) identities.get(identity);
+    if (shared == null)
+      {
+        shared = (sharedPortServer) getPortServer(SEQUENTIAL);
+        identities.put(identity, shared);
+        if (running)
+          {
+            shared.start();
+          }
+      }
+
+    Connected_objects.cObject ref = connected_objects.add(key, object,
+      shared.s_port, identity);
+    IOR ior = createIOR(ref);
+    prepareObject(object, ior);
+  }
+
+  /**
+   * In this type of ORB, the service is started by {@link #getPortServer}. The
+   * method below is not in use and should return without action.
+   */
+  public void startService(IOR ior)
+  {
+  }
+
+  /**
+   * Set parameters (additionally search for the port range property).
+   */
+  protected void set_parameters(Applet applet, Properties props)
+  {
+    super.set_parameters(applet, props);
+    String lp = applet.getParameter(LISTENER_PORT);
+    if (lp != null)
+      setPortRange(lp);
+  }
+
+  /**
+   * Set parameters (additionally search for the port range property).
+   */
+  protected void set_parameters(String[] args, Properties props)
+  {
+    super.set_parameters(args, props);
+    String lp = null;
+
+    String lpKey = "-" + LISTENER_PORT;
+
+    if (args != null)
+      if (args.length >= 2)
+        {
+          for (int i = 0; i < args.length - 1; i++)
+            if (args[i].equals(lpKey))
+              lp = args[i + 1];
+        }
+
+    if (lp != null)
+      setPortRange(lp);
+
+  }
+
+  /**
+   * Additionally set the port range property, when applicable.
+   */
+  protected void useProperties(Properties props)
+  {
+    super.useProperties(props);
+    String lp = props.getProperty(LISTENER_PORT);
+    if (lp != null)
+      setPortRange(lp);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFunctional.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFunctional.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFunctional.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbFunctional.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1778 @@
+/* OrbFunctional.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.CORBA;
+
+import gnu.CORBA.CDR.UnknownExceptionCtxHandler;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.GIOP.CloseMessage;
+import gnu.CORBA.GIOP.ErrorMessage;
+import gnu.CORBA.GIOP.MessageHeader;
+import gnu.CORBA.GIOP.ReplyHeader;
+import gnu.CORBA.GIOP.RequestHeader;
+import gnu.CORBA.NamingService.NameParser;
+import gnu.CORBA.NamingService.NamingServiceTransient;
+import gnu.CORBA.Poa.gnuForwardRequest;
+import gnu.CORBA.interfaces.SocketFactory;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.WrongTransaction;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtHelper;
+
+import java.applet.Applet;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
+/**
+ * The ORB implementation, capable to handle remote invocations on the
+ * registered object. This class implements all features, required till the jdk
+ * 1.3 inclusive, but does not support the POA that appears since 1.4. The POA
+ * is supported by {@link gnu.CORBA.Poa.ORB_1_4}.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class OrbFunctional extends OrbRestricted
+{
+  /**
+   * A server, responsible for listening on requests on some local port. The ORB
+   * may listen on multiple ports and process the requests in separate threads.
+   * Normally the server takes one port per object being served.
+   */
+  protected class portServer
+    extends Thread
+  {
+    /**
+     * The number of the currently running parallel threads.
+     */
+    int running_threads;
+
+    /**
+     * The port on that this portServer is listening for requests.
+     */
+    int s_port;
+
+    /**
+     * The server socket of this portServer.
+     */
+    ServerSocket service;
+
+    /**
+     * True if the serving node must shutdown due call of the close_now().
+     */
+    boolean terminated;
+
+    /**
+     * Create a new portServer, serving on specific port.
+     */
+    portServer(int _port)
+    {
+      s_port = _port;
+      setDaemon(true);
+      try
+        {
+          service = socketFactory.createServerSocket(s_port);
+        }
+      catch (IOException ex)
+        {
+          BAD_OPERATION bad = new BAD_OPERATION(
+            "Unable to open the server socket at " + s_port);
+          bad.minor = Minor.Socket;
+          bad.initCause(ex);
+          throw bad;
+        }
+    }
+
+    /**
+     * Enter the serving loop (get request/process it). All portServer normally
+     * terminate thy threads when the OrbFunctional.running is set to false.
+     */
+    public void run()
+    {
+      while (running)
+        {
+          try
+            {
+              tick();
+            }
+          catch (SocketException ex)
+            {
+              // May be thrown when the service is closed by
+              // the close_now().
+              if (terminated)
+                return;
+            }
+          catch (Exception iex)
+            {
+              // Wait. Do not terminate the
+              // service due potentially transient error.
+              try
+                {
+                  Thread.sleep(TWAIT_SERVER_ERROR_PAUSE);
+                }
+              catch (InterruptedException ex)
+                {
+                }
+            }
+        }
+    }
+
+    /**
+     * Perform a single serving step.
+     * 
+     * @throws java.lang.Exception
+     */
+    void tick()
+      throws Exception
+    {
+      serve(this, service);
+    }
+
+    /**
+     * Forcibly close the server socket and mark this port as free.
+     */
+    public void close_now()
+    {
+      try
+        {
+          terminated = true;
+          service.close();
+        }
+      catch (Exception ex)
+        {
+          // This may happen if the service has not been opened or
+          // cannot be closed. Return without action.
+        }
+    }
+
+    /**
+     * If the thread is no longer in use, close the socket (if opened).
+     */
+    protected void finalize()
+    {
+      close_now();
+    }
+  }
+
+  /**
+   * A server, responsible for listening on requests on some local port and
+   * serving multiple requests (probably to the different objects) on the same
+   * thread.
+   */
+  protected class sharedPortServer extends portServer
+  {
+    /**
+     * Create a new portServer, serving on specific port.
+     */
+    sharedPortServer(int _port)
+    {
+      super(_port);
+    }
+
+    /**
+     * Perform a single serving step.
+     *
+     * @throws java.lang.Exception
+     */
+    void tick() throws Exception
+    {
+      Socket request = service.accept();
+      serveStep(request, false);
+    }
+  }
+
+  /**
+   * The default value where the first instance of this ORB will start looking
+   * for a free port.
+   */
+  public static int DEFAULT_INITIAL_PORT = 1126;
+  
+  /**
+   * When trying to open the socket on a random port, start of the interval to
+   * try.
+   */
+  public static int RANDOM_PORT_FROM = 1024;
+  
+  /**
+   * When trying to open the socket on a random port, end of the interval to
+   * try.
+   */
+  public static int RANDOM_PORT_TO = 4024;
+  
+  /**
+   * The number of attempts to try when opening random port.
+   */
+  public static int RANDOM_PORT_ATTEMPTS = 64;
+
+  /**
+   * The property of port, on that this ORB is listening for requests from
+   * clients. This class supports one port per ORB only.
+   */
+  public static final String LISTEN_ON = "gnu.classpath.CORBA.ListenOn";
+
+  /**
+   * The property, defining the IOR of the intial reference to resolve.
+   */
+  public static final String REFERENCE = "org.omg.CORBA.ORBInitRef";
+
+  /**
+   * The property, defining the port on that the default name service is
+   * running.
+   */
+  public static final String NS_PORT = "org.omg.CORBA.ORBInitialPort";
+
+  /**
+   * The property, defining the host on that the default name service is
+   * running.
+   */
+  public static final String NS_HOST = "org.omg.CORBA.ORBInitialHost";
+
+  /**
+   * The string, defining the naming service initial reference.
+   */
+  public static final String NAME_SERVICE = "NameService";
+  
+  /**
+   * Defines the ORB ID that is accessible by IOR interceptors.
+   */
+  public static final String ORB_ID = "org.omg.CORBA.ORBid";
+  
+  
+  /**
+   * Defines the SERVER ID that is accessible by IOR interceptors.
+   */
+  public static final String SERVER_ID = "org.omg.CORBA.ServerId";
+  
+  /**
+   * The if the client has once opened a socket, it should start sending the
+   * message header in a given time. Otherwise the server will close the socket.
+   * This prevents server hang when the client opens the socket, but does not
+   * send any message, usually due crash on the client side.
+   */
+  public static String START_READING_MESSAGE =
+    "gnu.classpath.CORBA.TOUT_START_READING_MESSAGE";
+
+  /**
+   * If the client has started to send the request message, the socket time out
+   * changes to the specified value.
+   */
+  public static String WHILE_READING =
+    "gnu.classpath.CORBA.TOUT_WHILE_READING";
+
+  /**
+   * If the message body is received, the time out changes to the specifice
+   * value. This must be longer, as includes time, required to process the
+   * received task. We make it 40 minutes.
+   */
+  public static String AFTER_RECEIVING =
+    "gnu.classpath.CORBA.TOUT_AFTER_RECEIVING";
+  
+  /**
+   * The server waits for this duration after the potentially transient error
+   * during its servicing cycle.
+   */
+  public static String SERVER_ERROR_PAUSE =
+    "gnu.classpath.CORBA.SERVER_ERROR_PAUSE";
+
+  /**
+   * The address of the local host.
+   */
+  public final String LOCAL_HOST;
+
+  /**
+   * The if the client has once opened a socket, it should start sending the
+   * message header in a given time. Otherwise the server will close the socket.
+   * This prevents server hang when the client opens the socket, but does not
+   * send any message, usually due crash on the client side.
+   */
+  public int TOUT_START_READING_MESSAGE = 20 * 1000;
+
+  // (Here and below, we use * to make the meaning of the constant clearler).
+
+  /**
+   * If the client has started to send the request message, the socket time out
+   * changes to the specified value.
+   */
+  public int TOUT_WHILE_READING = 2 * 60 * 1000;
+
+  /**
+   * If the message body is received, the time out changes to the specifice
+   * value. This must be longer, as includes time, required to process the
+   * received task. We make it 40 minutes.
+   */
+  public int TOUT_AFTER_RECEIVING = 40 * 60 * 1000;
+  
+  /**
+   * The server waits for this duration after the potentially transient error
+   * during its servicing cycle.
+   */
+  public int TWAIT_SERVER_ERROR_PAUSE = 5000;
+
+  /**
+   * Some clients tend to submit multiple requests over the same socket. The
+   * server waits for the next request on the same socket for the duration,
+   * specified below. In additions, the request of this implementation also
+   * waits for the same duration before closing the socket. The default time is
+   * seven seconds.
+   */
+  public static int TANDEM_REQUESTS = 7000;
+  
+  /**
+   * The Id of this ORB.
+   */
+  public String orb_id = "orb_"+hashCode();
+  
+  /**
+   * The Id of this Server. This field is defined static to ensure it has
+   * the same value over all ORB's in this machine.
+   */
+  public static String server_id = "server_"+OrbFunctional.class.hashCode(); 
+
+  /**
+   * The map of the already conncted objects.
+   */
+  protected final Connected_objects connected_objects =
+    new Connected_objects();
+
+  /**
+   * The maximal CORBA version, supported by this ORB. The default value 0 means
+   * that the ORB will not check the request version while trying to respond.
+   */
+  protected Version max_version;
+
+  /**
+   * Setting this value to false causes the ORB to shutdown after the latest
+   * serving operation is complete.
+   */
+  protected boolean running;
+
+  /**
+   * The map of the initial references.
+   */
+  protected Map initial_references = new TreeMap();
+
+  /**
+   * The currently active portServers.
+   */
+  protected ArrayList portServers = new ArrayList();
+
+  /**
+   * The host, on that the name service is expected to be running.
+   */
+  private String ns_host;
+
+  /**
+   * Probably free port, under that the ORB will try listening for remote
+   * requests first. When the new object is connected, this port is used first,
+   * then it is incremented by 1, etc. If the given port is not available, up to
+   * 20 subsequent values are tried and then the parameterless server socket
+   * contructor is called. The constant is shared between multiple instances of
+   * this ORB.
+   */
+  private static int Port = DEFAULT_INITIAL_PORT;
+
+  /**
+   * The port, on that the name service is expected to be running.
+   */
+  private int ns_port = 900;
+  
+  /**
+   * The name parser.
+   */
+  NameParser nameParser = new NameParser();
+
+  /**
+   * The instance, stored in this field, handles the asynchronous dynamic
+   * invocations.
+   */
+  protected Asynchron asynchron = new Asynchron();
+
+  /**
+   * The list of the freed ports. The ORB reuses ports, when possible.
+   */
+  protected LinkedList freed_ports = new LinkedList();
+
+  /**
+   * Maps a single-threaded POAs to they sharedPortServants.
+   */
+  protected Hashtable identities = new Hashtable();
+
+  /**
+   * The maximal allowed number of the currently running parallel threads per
+   * object. For security reasons, this is made private and unchangeable. After
+   * exceeding this limit, the NO_RESOURCES is thrown back to the client.
+   */
+  private int MAX_RUNNING_THREADS = 256;
+  
+  /**
+   * The producer of the client and server sockets for this ORB.
+   */
+  public SocketFactory socketFactory = DefaultSocketFactory.Singleton;
+
+  /**
+   * Create the instance of the Functional ORB.
+   */
+  public OrbFunctional()
+  {
+    try
+      {
+        LOCAL_HOST = ns_host = InetAddress.getLocalHost().getHostAddress();
+        initial_references.put("CodecFactory", new gnuCodecFactory(this));
+      }
+    catch (UnknownHostException ex)
+      {
+        BAD_OPERATION bad =
+          new BAD_OPERATION("Unable to open the server socket.");
+        bad.initCause(ex);
+        throw bad;
+      }
+  }
+
+  /**
+   * If the max version is assigned, the orb replies with the error message if
+   * the request version is above the supported 1.2 version. This behavior is
+   * recommended by OMG, but not all implementations respond that error message
+   * by re-sending the request, encoded in the older version.
+   */
+  public void setMaxVersion(Version max_supported)
+  {
+    max_version = max_supported;
+  }
+
+  /**
+   * Get the maximal supported GIOP version or null if the version is not
+   * checked.
+   */
+  public Version getMaxVersion()
+  {
+    return max_version;
+  }
+
+  /**
+   * Get the currently free port, starting from the initially set port and going
+   * up max 20 steps, then trying to bind into any free address.
+   * 
+   * @return the currently available free port.
+   * 
+   * @throws NO_RESOURCES if the server socked cannot be opened on the local
+   * host.
+   */
+  public int getFreePort()
+    throws BAD_OPERATION
+  {
+    ServerSocket s;
+    int a_port;
+
+    try
+      {
+        // If there are some previously freed ports, use them first.
+        if (!freed_ports.isEmpty())
+          {
+            Integer free = (Integer) freed_ports.getLast();
+            freed_ports.removeLast();
+            s = socketFactory.createServerSocket(free.intValue());
+            s.close();
+            return free.intValue();
+          }
+      }
+    catch (Exception ex)
+      {
+        // This may be thrown if the request for the new port has arrived
+        // before the current service is completly shutdown.
+        // OK then, use a new port.
+      }
+
+    for (a_port = Port; a_port < Port + 20; a_port++)
+      {
+        try
+          {
+            s = socketFactory.createServerSocket(a_port);
+            s.close();
+            Port = a_port + 1;
+            return a_port;
+          }
+        catch (IOException ex)
+          {
+            // Repeat the loop if this exception has been thrown.
+          }
+      }
+
+    Random rand = new Random();
+    // Try any random port in the interval RANDOM_PORT_FROM.RANDOM_PORT_TO.
+    int range = RANDOM_PORT_TO - RANDOM_PORT_FROM;
+    IOException ioex = null;
+    for (int i = 0; i < RANDOM_PORT_ATTEMPTS; i++)
+      {
+        try
+          {
+            a_port = RANDOM_PORT_FROM + rand.nextInt(range);
+            s = socketFactory.createServerSocket(a_port);
+            s.close();
+            return a_port;
+          }
+        catch (IOException ex)
+          {
+            // Repeat the loop if this exception has been thrown.
+            ioex = ex;
+          }
+      }
+
+    NO_RESOURCES bad = new NO_RESOURCES("Unable to open the server socket.");
+    bad.minor = Minor.Ports;
+    if (ioex != null)
+      bad.initCause(ioex);
+    throw bad;
+  }
+
+  /**
+   * Set the port, on that the server is listening for the client requests. If
+   * only one object is connected to the orb, the server will be try listening
+   * on this port first. It the port is busy, or if more objects are connected,
+   * the subsequent object will receive a larger port values, skipping
+   * unavailable ports, if required. The change applies globally.
+   * 
+   * @param a_Port a port, on that the server is listening for requests.
+   */
+  public static void setPort(int a_Port)
+  {
+    Port = a_Port;
+  }
+
+  /**
+   * Connect the given CORBA object to this ORB. After the object is connected,
+   * it starts receiving remote invocations via this ORB.
+   *
+   * The ORB tries to connect the object to the port, that has been previously
+   * set by {@link setPort(int)}. On failure, it tries 20 subsequent larger
+   * values and then calls the parameterless server socked constructor to get
+   * any free local port. If this fails, the {@link NO_RESOURCES} is thrown.
+   *
+   * @param object the object, must implement the {@link InvokeHandler})
+   * interface.
+   *
+   * @throws BAD_PARAM if the object does not implement the
+   * {@link InvokeHandler}).
+   */
+  public void connect(org.omg.CORBA.Object object)
+  {
+    int a_port = getFreePort();
+
+    Connected_objects.cObject ref = connected_objects.add(object, a_port);
+    IOR ior = createIOR(ref);
+    prepareObject(object, ior);
+    if (running)
+      startService(ior);
+  }
+
+  /**
+   * Connect the given CORBA object to this ORB, explicitly specifying the
+   * object key.
+   *
+   * The ORB tries to connect the object to the port, that has been previously
+   * set by {@link setPort(int)}. On failure, it tries 20 subsequent larger
+   * values and then calls the parameterless server socked constructor to get
+   * any free local port. If this fails, the {@link NO_RESOURCES} is thrown.
+   *
+   * @param object the object, must implement the {@link InvokeHandler})
+   * interface.
+   * @param key the object key, usually used to identify the object from remote
+   * side.
+   *
+   * @throws BAD_PARAM if the object does not implement the
+   * {@link InvokeHandler}).
+   */
+  public void connect(org.omg.CORBA.Object object, byte[] key)
+  {
+    int a_port = getFreePort();
+
+    Connected_objects.cObject ref =
+      connected_objects.add(key, object, a_port, null);
+    IOR ior = createIOR(ref);
+    prepareObject(object, ior);
+    if (running)
+      startService(ior);
+  }
+
+  /**
+   * Connect the given CORBA object to this ORB, explicitly specifying the
+   * object key and the identity of the thread (and port), where the object must
+   * be served. The identity is normally the POA.
+   *
+   * The new port server will be started only if there is no one already running
+   * for the same identity. Otherwise, the task of the existing port server will
+   * be widened, including duty to serve the given object. All objects,
+   * connected to a single identity by this method, will process they requests
+   * subsequently in the same thread. The method is used when the expected
+   * number of the objects is too large to have a single port and thread per
+   * object. This method is used by POAs, having a single thread policy.
+   *
+   * @param object the object, must implement the {@link InvokeHandler})
+   * interface.
+   * @param key the object key, usually used to identify the object from remote
+   * side.
+   * @param port the port, where the object must be connected.
+   *
+   * @throws BAD_PARAM if the object does not implement the
+   * {@link InvokeHandler}).
+   */
+  public void connect_1_thread(org.omg.CORBA.Object object, byte[] key,
+    java.lang.Object identity
+  )
+  {
+    sharedPortServer shared = (sharedPortServer) identities.get(identity);
+    if (shared == null)
+      {
+        int a_port = getFreePort();
+        shared = new sharedPortServer(a_port);
+        identities.put(identity, shared);
+        if (running)
+          {
+            portServers.add(shared);
+            shared.start();
+          }
+      }
+
+    Connected_objects.cObject ref =
+      connected_objects.add(key, object, shared.s_port, identity);
+    IOR ior = createIOR(ref);
+    prepareObject(object, ior);
+  }
+
+  /**
+   * Start the service on the given port of this IOR.
+   *
+   * @param ior the ior (only Internet.port is used).
+   */
+  public void startService(IOR ior)
+  {
+    portServer p = new portServer(ior.Internet.port);
+    portServers.add(p);
+    p.start();
+  }
+
+  /**
+   * Destroy this server, releasing the occupied resources.
+   */
+  public void destroy()
+  {
+    portServer p;
+    for (int i = 0; i < portServers.size(); i++)
+      {
+        p = (portServer) portServers.get(i);
+        p.close_now();
+      }
+    super.destroy();
+  }
+
+  /**
+   * Disconnect the given CORBA object from this ORB. The object will be no
+   * longer receiving the remote invocations. In response to the remote
+   * invocation on this object, the ORB will send the exception
+   * {@link OBJECT_NOT_EXIST}. The object, however, is not destroyed and can
+   * receive the local invocations.
+   *
+   * @param object the object to disconnect.
+   */
+  public void disconnect(org.omg.CORBA.Object object)
+  {
+    Connected_objects.cObject rmKey = null;
+
+    // Handle the case when it is possible to get the object key.
+    // Handle the case when the object is known, but not local.
+    if (object instanceof ObjectImpl)
+      {
+        Delegate delegate = ((ObjectImpl) object)._get_delegate();
+        if (delegate instanceof SimpleDelegate)
+          {
+            byte[] key = ((SimpleDelegate) delegate).getIor().key;
+            rmKey = connected_objects.get(key);
+          }
+      }
+
+    // Try to find and disconned the object that is not an instance of the
+    // object implementation.
+    if (rmKey == null)
+      rmKey = connected_objects.getKey(object);
+    if (rmKey != null)
+      {
+        // Find and stop the corresponding portServer.
+        portServer p;
+        StopService:
+        for (int i = 0; i < portServers.size(); i++)
+          {
+            p = (portServer) portServers.get(i);
+            if (p.s_port == rmKey.port && !(p instanceof sharedPortServer))
+              {
+                p.close_now();
+                freed_ports.addFirst(new Integer(rmKey.port));
+                break StopService;
+              }
+            connected_objects.remove(rmKey.key);
+          }
+      }
+  }
+
+  /**
+   * Notifies ORB that the shared service indentity (usually POA) is destroyed.
+   * The matching shared port server is terminated and the identity table entry
+   * is deleted. If this identity is not known for this ORB, the method returns
+   * without action.
+   *
+   * @param identity the identity that has been destroyed.
+   */
+  public void identityDestroyed(java.lang.Object identity)
+  {
+    if (identity == null)
+      return;
+
+    sharedPortServer ise = (sharedPortServer) identities.get(identity);
+    if (ise != null)
+      {
+        synchronized (connected_objects)
+          {
+            ise.close_now();
+            identities.remove(identity);
+
+            Connected_objects.cObject obj;
+            Map.Entry m;
+            Iterator iter = connected_objects.entrySet().iterator();
+            while (iter.hasNext())
+              {
+                m = (Map.Entry) iter.next();
+                obj = (Connected_objects.cObject) m.getValue();
+                if (obj.identity == identity)
+                  iter.remove();
+              }
+          }
+      }
+  }
+
+  /**
+   * Find the local object, connected to this ORB.
+   *
+   * @param ior the ior of the potentially local object.
+   *
+   * @return the local object, represented by the given IOR, or null if this is
+   * not a local connected object.
+   */
+  public org.omg.CORBA.Object find_local_object(IOR ior)
+  {
+    // Must be the same host.
+    if (!ior.Internet.host.equals(LOCAL_HOST))
+      return null;
+
+    return find_connected_object(ior.key, ior.Internet.port);
+  }
+
+  /**
+   * List the initially available CORBA objects (services).
+   *
+   * @return a list of services.
+   *
+   * @see resolve_initial_references(String)
+   */
+  public String[] list_initial_services()
+  {
+    String[] refs = new String[ initial_references.size() ];
+    int p = 0;
+
+    Iterator iter = initial_references.keySet().iterator();
+    while (iter.hasNext())
+      {
+        refs [ p++ ] = (String) iter.next();
+      }
+    return refs;
+  }
+
+  /**
+   * Get the IOR reference string for the given object. The string embeds
+   * information about the object repository Id, its access key and the server
+   * internet address and port. With this information, the object can be found
+   * by another ORB, possibly located on remote computer.
+   *
+   * @param the CORBA object
+   * @return the object IOR representation.
+   *
+   * @throws BAD_PARAM if the object has not been previously connected to this
+   * ORB.
+   *
+   * @throws BAD_OPERATION in the unlikely case if the local host address cannot
+   * be resolved.
+   *
+   * @see string_to_object(String)
+   */
+  public String object_to_string(org.omg.CORBA.Object forObject)
+  {
+    // Handle the case when the object is known, but not local.
+    if (forObject instanceof ObjectImpl)
+      {
+        Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
+        if (delegate instanceof SimpleDelegate)
+          return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
+      }
+
+    // Handle the case when the object is local.
+    Connected_objects.cObject rec = connected_objects.getKey(forObject);
+
+    if (rec == null)
+      throw new BAD_PARAM("The object " + forObject +
+        " has not been previously connected to this ORB"
+      );
+
+    IOR ior = createIOR(rec);
+
+    return ior.toStringifiedReference();
+  }
+
+  /**
+   * Get the local IOR for the given object, null if the object is not local.
+   */
+  public IOR getLocalIor(org.omg.CORBA.Object forObject)
+  {
+    Connected_objects.cObject rec = connected_objects.getKey(forObject);
+    if (rec == null)
+      return null;
+    else
+      return createIOR(rec);
+  }
+
+  /**
+   * Find and return the easily accessible CORBA object, addressed by name.
+   *
+   * @param name the object name.
+   * @return the object
+   *
+   * @throws org.omg.CORBA.ORBPackage.InvalidName if the given name is not
+   * associated with the known object.
+   */
+  public org.omg.CORBA.Object resolve_initial_references(String name)
+    throws InvalidName
+  {
+    org.omg.CORBA.Object object = null;
+    try
+      {
+        object = (org.omg.CORBA.Object) initial_references.get(name);
+        if (object == null && name.equals(NAME_SERVICE))
+          {
+            object = getDefaultNameService();
+            if (object != null)
+              initial_references.put(NAME_SERVICE, object);
+          }
+      }
+    catch (Exception ex)
+      {
+        InvalidName err = new InvalidName(name);
+        err.initCause(ex);
+        throw err;
+      }
+    if (object != null)
+      return object;
+    else
+      throw new InvalidName("Not found: '" + name + "'");
+  }
+
+  /**
+   * Start the ORBs main working cycle (receive invocation - invoke on the local
+   * object - send response - wait for another invocation).
+   *
+   * The method only returns after calling {@link #shutdown(boolean)}.
+   */
+  public void run()
+  {
+    running = true;
+
+    // Instantiate the port server for each socket.
+    Iterator iter = connected_objects.entrySet().iterator();
+    Map.Entry m;
+    Connected_objects.cObject obj;
+
+    while (iter.hasNext())
+      {
+        m = (Map.Entry) iter.next();
+        obj = (Connected_objects.cObject) m.getValue();
+
+        portServer subserver;
+
+        if (obj.identity == null)
+          {
+            subserver = new portServer(obj.port);
+            portServers.add(subserver);
+          }
+        else
+          subserver = (portServer) identities.get(obj.identity);
+        
+        if (!subserver.isAlive())
+          {
+            // Reuse the current thread for the last portServer.
+            if (!iter.hasNext())
+              {
+                // Discard the iterator, eliminating lock checks.
+                iter = null;
+                subserver.run();
+                return;
+              }
+            else
+              subserver.start();
+          }
+      }
+  }
+  
+  /**
+   * Start the server in a new thread, if not already running. This method is
+   * used to ensure that the objects being transfered will be served from the 
+   * remote side, if required. If the ORB is started using this method, it
+   * starts as a daemon thread.
+   */
+  public void ensureRunning()
+  {
+    final OrbFunctional THIS = this;
+    
+    if (!running)
+      {
+        Thread t = new Thread()
+        {
+          public void run()
+          {
+            THIS.run();
+          }
+        };
+        t.setDaemon(true);
+        t.start();
+      }
+  }
+
+  /**
+   * Shutdown the ORB server.
+   *
+   * @param wait_for_completion if true, the current thread is suspended until
+   * the shutdown process is complete.
+   */
+  public void shutdown(boolean wait_for_completion)
+  {
+    super.shutdown(wait_for_completion);
+    running = false;
+
+    if (!wait_for_completion)
+      {
+        for (int i = 0; i < portServers.size(); i++)
+          {
+            portServer p = (portServer) portServers.get(i);
+            p.close_now();
+          }
+      }
+  }
+
+  /**
+   * Find and return the CORBA object, addressed by the given IOR string
+   * representation. The object can (an usually is) located on a remote
+   * computer, possibly running a different (not necessary java) CORBA
+   * implementation.
+   * 
+   * @param ior the object IOR representation string.
+   * 
+   * @return the found CORBA object.
+   * @see object_to_string(org.omg.CORBA.Object)
+   */
+  public org.omg.CORBA.Object string_to_object(String an_ior)
+  {
+    return nameParser.corbaloc(an_ior, this);
+  }
+  
+  /**
+   * Convert ior reference to CORBA object.
+   */
+  public org.omg.CORBA.Object ior_to_object(IOR ior)
+  {
+    org.omg.CORBA.Object object = find_local_object(ior);
+    if (object == null)
+      {
+        ObjectImpl impl = StubLocator.search(this, ior);
+        try
+          {
+            if (impl._get_delegate() == null)
+              impl._set_delegate(new IorDelegate(this, ior));
+          }
+        catch (BAD_OPERATION ex)
+          {
+            // Some colaborants may throw this exception
+            // in response to the attempt to get the unset delegate.
+            impl._set_delegate(new IorDelegate(this, ior));
+          }
+
+        object = impl;
+        // TODO remove commented out code below.
+        // connected_objects.add(ior.key, impl, ior.Internet.port, null);
+      }
+    return object;
+  }
+
+  /**
+   * Get the default naming service for the case when there no NameService
+   * entries.
+   */
+  protected org.omg.CORBA.Object getDefaultNameService()
+  {
+    if (initial_references.containsKey(NAME_SERVICE))
+      return (org.omg.CORBA.Object) initial_references.get(NAME_SERVICE);
+
+    IOR ior = new IOR();
+    ior.Id = NamingContextExtHelper.id();
+    ior.Internet.host = ns_host;
+    ior.Internet.port = ns_port;
+    ior.key = NamingServiceTransient.getDefaultKey();
+
+    IorObject iorc = new IorObject(this, ior);
+    NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
+    initial_references.put(NAME_SERVICE, namer);
+    return namer;
+  }
+
+  /**
+   * Find and return the object, that must be previously connected to this ORB.
+   * Return null if no such object is available.
+   * 
+   * @param key the object key.
+   * @param port the port where the object is connected.
+   * 
+   * @return the connected object, null if none.
+   */
+  protected org.omg.CORBA.Object find_connected_object(byte[] key, int port)
+  {
+    Connected_objects.cObject ref = connected_objects.get(key);
+    if (ref == null)
+      return null;
+    if (port >= 0 && ref.port != port)
+      return null;
+    else
+      return ref.object;
+  }
+
+  /**
+   * Set the ORB parameters. This method is normally called from
+   * {@link #init(Applet, Properties)}.
+   * 
+   * @param app the current applet.
+   * 
+   * @param props application specific properties, passed as the second
+   * parameter in {@link #init(Applet, Properties)}. Can be <code>null</code>.
+   */
+  protected void set_parameters(Applet app, Properties props)
+  {
+    useProperties(props);
+
+    String[][] para = app.getParameterInfo();
+    if (para != null)
+      {
+        for (int i = 0; i < para.length; i++)
+          {
+            if (para[i][0].equals(LISTEN_ON))
+              Port = Integer.parseInt(para[i][1]);
+            if (para[i][0].equals(REFERENCE))
+              {
+                StringTokenizer st = new StringTokenizer(para[i][1], "=");
+                initial_references.put(st.nextToken(),
+                  string_to_object(st.nextToken()));
+              }
+
+            if (para[i][0].equals(ORB_ID))
+              orb_id = para[i][1];
+
+            if (para[i][0].equals(SERVER_ID))
+              server_id = para[i][1];
+
+            if (para[i][0].equals(NS_HOST))
+              ns_host = para[i][1];
+            if (para[i][0].equals(START_READING_MESSAGE))
+              TOUT_START_READING_MESSAGE = Integer.parseInt(para[i][1]);
+            if (para[i][0].equals(WHILE_READING))
+              TOUT_WHILE_READING = Integer.parseInt(para[i][1]);
+            if (para[i][0].equals(AFTER_RECEIVING))
+              TOUT_AFTER_RECEIVING = Integer.parseInt(para[i][1]);
+            try
+              {
+                if (para[i][0].equals(NS_PORT))
+                  ns_port = Integer.parseInt(para[i][1]);
+              }
+            catch (NumberFormatException ex)
+              {
+                BAD_PARAM bad = new BAD_PARAM("Invalid " + NS_PORT
+                  + "property, unable to parse '" + props.getProperty(NS_PORT)
+                  + "'");
+                bad.initCause(ex);
+                throw bad;
+              }
+          }
+      }
+  }
+
+  /**
+   * Set the ORB parameters. This method is normally called from
+   * {@link #init(String[], Properties)}.
+   * 
+   * @param para the parameters, that were passed as the parameters to the
+   * <code>main(String[] args)</code> method of the current standalone
+   * application.
+   * 
+   * @param props application specific properties that were passed as a second
+   * parameter in {@link init(String[], Properties)}). Can be <code>null</code>.
+   */
+  protected void set_parameters(String[] para, Properties props)
+  {
+    if (para.length > 1)
+      {
+        for (int i = 0; i < para.length - 1; i++)
+          {
+            if (para[i].endsWith("ListenOn"))
+              Port = Integer.parseInt(para[i + 1]);
+            if (para[i].endsWith("ORBInitRef"))
+              {
+                StringTokenizer st = new StringTokenizer(para[i + 1], "=");
+                initial_references.put(st.nextToken(),
+                  string_to_object(st.nextToken()));
+              }
+
+            if (para[i].endsWith("ORBInitialHost"))
+              ns_host = para[i + 1];
+
+            if (para[i].endsWith("ServerId"))
+              server_id = para[i++];
+            else if (para[i].endsWith("ORBid"))
+              orb_id = para[i++];
+
+            try
+              {
+                if (para[i].endsWith("ORBInitialPort"))
+                  ns_port = Integer.parseInt(para[i + 1]);
+              }
+            catch (NumberFormatException ex)
+              {
+                throw new BAD_PARAM("Invalid " + para[i]
+                  + "parameter, unable to parse '"
+                  + props.getProperty(para[i + 1]) + "'");
+              }
+          }
+      }
+
+    useProperties(props);
+  }
+
+  /**
+   * Create IOR for the given object references.
+   */
+  protected IOR createIOR(Connected_objects.cObject ref)
+    throws BAD_OPERATION
+  {
+    IOR ior = new IOR();
+    ior.key = ref.key;
+    ior.Internet.port = ref.port;
+
+    if (ref.object instanceof ObjectImpl)
+      {
+        ObjectImpl imp = (ObjectImpl) ref.object;
+        if (imp._ids().length > 0)
+          ior.Id = imp._ids() [ 0 ];
+      }
+    if (ior.Id == null)
+      ior.Id = ref.object.getClass().getName();
+    try
+      {
+        ior.Internet.host = InetAddress.getLocalHost().getHostAddress();
+        ior.Internet.port = ref.port;
+      }
+    catch (UnknownHostException ex)
+      {
+        throw new BAD_OPERATION("Cannot resolve the local host address");
+      }
+    return ior;
+  }
+
+  /**
+   * Prepare object for connecting it to this ORB.
+   *
+   * @param object the object being connected.
+   *
+   * @throws BAD_PARAM if the object does not implement the
+   * {@link InvokeHandler}).
+   */
+  protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
+    throws BAD_PARAM
+  {
+    /*
+     * if (!(object instanceof InvokeHandler)) throw new
+     * BAD_PARAM(object.getClass().getName() + " does not implement
+     * InvokeHandler. " );
+     */
+
+    // If no delegate is set, set the default delegate.
+    if (object instanceof ObjectImpl)
+      {
+        ObjectImpl impl = (ObjectImpl) object;
+        try
+          {
+            if (impl._get_delegate() == null)
+              impl._set_delegate(new SimpleDelegate(this, ior));
+          }
+        catch (BAD_OPERATION ex)
+          {
+            // Some colaborants may throw this exception.
+            impl._set_delegate(new SimpleDelegate(this, ior));
+          }
+      }
+  }
+
+  /**
+   * Write the response message.
+   *
+   * @param net_out the stream to write response into
+   * @param msh_request the request message header
+   * @param rh_request the request header
+   * @param handler the invocation handler that has been used to invoke the
+   * operation
+   * @param sysEx the system exception, thrown during the invocation, null if
+   * none.
+   *
+   * @throws IOException
+   */
+  private void respond_to_client(OutputStream net_out,
+    MessageHeader msh_request, RequestHeader rh_request,
+    ResponseHandlerImpl handler, SystemException sysEx
+  ) throws IOException
+  {
+    // Set the reply header properties.
+    ReplyHeader reply = handler.reply_header;
+
+    if (sysEx != null)
+      reply.reply_status = ReplyHeader.SYSTEM_EXCEPTION;
+    else if (handler.isExceptionReply())
+      reply.reply_status = ReplyHeader.USER_EXCEPTION;
+    else
+      reply.reply_status = ReplyHeader.NO_EXCEPTION;
+    reply.request_id = rh_request.request_id;
+
+    BufferedCdrOutput out =
+      new BufferedCdrOutput(50 + handler.getBuffer().buffer.size());
+    out.setOrb(this);
+
+    out.setOffset(msh_request.getHeaderSize());
+
+    reply.write(out);
+
+    if (msh_request.version.since_inclusive(1, 2))
+      {
+        out.align(8);
+
+        // Write the reply data from the handler. The handler data already
+        // include the necessary heading zeroes for alignment.
+      }
+    handler.getBuffer().buffer.writeTo(out);
+
+    MessageHeader msh_reply = new MessageHeader();
+
+    msh_reply.version = msh_request.version;
+    msh_reply.message_type = MessageHeader.REPLY;
+    msh_reply.message_size = out.buffer.size();
+
+    // Write the reply.
+    msh_reply.write(net_out);
+    out.buffer.writeTo(net_out);
+    net_out.flush();
+  }
+
+  /**
+   * Forward request to another target, as indicated by the passed exception.
+   */
+  private void forward_request(OutputStream net_out,
+    MessageHeader msh_request, RequestHeader rh_request, gnuForwardRequest info
+  ) throws IOException
+  {
+    MessageHeader msh_forward = new MessageHeader();
+    msh_forward.version = msh_request.version;
+
+    ReplyHeader rh_forward = msh_forward.create_reply_header();
+    msh_forward.message_type = MessageHeader.REPLY;
+    rh_forward.reply_status = info.forwarding_code;
+    rh_forward.request_id = rh_request.request_id;
+
+    // The forwarding code is either LOCATION_FORWARD or LOCATION_FORWARD_PERM.
+    BufferedCdrOutput out = new BufferedCdrOutput();
+    out.setOrb(this);
+    out.setOffset(msh_forward.getHeaderSize());
+
+    rh_forward.write(out);
+
+    if (msh_forward.version.since_inclusive(1, 2))
+      out.align(8);
+    out.write_Object(info.forward_reference);
+
+    msh_forward.message_size = out.buffer.size();
+
+    // Write the forwarding instruction.
+    msh_forward.write(net_out);
+    out.buffer.writeTo(net_out);
+    net_out.flush();
+  }
+
+  /**
+   * Contains a single servicing task.
+   *
+   * Normally, each task matches a single remote invocation. However under
+   * frequent tandem submissions the same task may span over several
+   * invocations.
+   *
+   * @param serverSocket the ORB server socket.
+   *
+   * @throws MARSHAL
+   * @throws IOException
+   */
+  void serve(final portServer p, ServerSocket serverSocket)
+    throws MARSHAL, IOException
+  {
+    final Socket service;
+    service = serverSocket.accept();
+
+    // Tell the server there are no more resources.
+    if (p.running_threads >= MAX_RUNNING_THREADS)
+      {
+        serveStep(service, true);
+        return;
+      }
+
+    new Thread()
+      {
+        public void run()
+        {
+          try
+            {
+              synchronized (p)
+                {
+                  p.running_threads++;
+                }
+              serveStep(service, false);
+            }
+          finally
+            {
+              synchronized (p)
+                {
+                  p.running_threads--;
+                }
+            }
+        }
+      }.start();
+  }
+
+  /**
+   * A single servicing step, when the client socket is alrady open.
+   * 
+   * Normally, each task matches a single remote invocation. However under
+   * frequent tandem submissions the same task may span over several
+   * invocations.
+   * 
+   * @param service the opened client socket.
+   * @param no_resources if true, the "NO RESOURCES" exception is thrown to the
+   * client.
+   */
+  void serveStep(Socket service, boolean no_resources)
+  {
+    try
+      {
+        Serving: while (true)
+          {
+            InputStream in = service.getInputStream();
+            service.setSoTimeout(TOUT_START_READING_MESSAGE);
+
+            MessageHeader msh_request = new MessageHeader();
+
+            try
+              {
+                msh_request.read(in);
+              }
+            catch (MARSHAL ex)
+              {
+                // This exception may be thrown due closing the connection.
+                return;
+              }
+
+            if (max_version != null)
+              {
+                if (!msh_request.version.until_inclusive(max_version.major,
+                  max_version.minor))
+                  {
+                    OutputStream out = service.getOutputStream();
+                    new ErrorMessage(max_version).write(out);
+                    return;
+                  }
+              }
+
+            byte[] r = msh_request.readMessage(in, service, TOUT_WHILE_READING,
+              TOUT_AFTER_RECEIVING);
+
+            if (msh_request.message_type == MessageHeader.REQUEST)
+              {
+                RequestHeader rh_request;
+
+                BufferredCdrInput cin = new BufferredCdrInput(r);
+                cin.setOrb(this);
+                cin.setVersion(msh_request.version);
+                cin.setOffset(msh_request.getHeaderSize());
+                cin.setBigEndian(msh_request.isBigEndian());
+
+                rh_request = msh_request.create_request_header();
+
+                // Read header and auto set the charset.
+                rh_request.read(cin);
+
+                // in 1.2 and higher, align the current position at
+                // 8 octet boundary.
+                if (msh_request.version.since_inclusive(1, 2))
+                  {
+                    cin.align(8);
+
+                    // find the target object.
+                  }
+
+                InvokeHandler target = (InvokeHandler) find_connected_object(
+                  rh_request.object_key, -1);
+
+                // Prepare the reply header. This must be done in advance,
+                // as the size must be known for handler to set alignments
+                // correctly.
+                ReplyHeader rh_reply = msh_request.create_reply_header();
+
+                // TODO log errors about not existing objects and methods.
+                ResponseHandlerImpl handler = new ResponseHandlerImpl(
+                  this, msh_request, rh_reply, rh_request);
+
+                SystemException sysEx = null;
+
+                try
+                  {
+                    if (no_resources)
+                      {
+                        NO_RESOURCES no = new NO_RESOURCES("Too many parallel calls");
+                        no.minor = Minor.Threads;
+                        throw no;
+                      }
+                    if (target == null)
+                      throw new OBJECT_NOT_EXIST();
+                    target._invoke(rh_request.operation, cin, handler);
+                  }
+                catch (gnuForwardRequest forwarded)
+                  {
+                    OutputStream sou = service.getOutputStream();
+                    forward_request(sou, msh_request, rh_request, forwarded);
+                    if (service != null && !service.isClosed())
+                      {
+                        // Wait for the subsequent invocations on the
+                        // same socket for the TANDEM_REQUEST duration.
+                        service.setSoTimeout(TANDEM_REQUESTS);
+                        continue Serving;
+                      }
+                  }
+                catch (UnknownException uex)
+                  {
+                    sysEx = new UNKNOWN("Unknown", 2,
+                      CompletionStatus.COMPLETED_MAYBE);
+                    sysEx.initCause(uex.originalEx);
+
+                    org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+                    rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+                      rh_reply.service_context, uex.originalEx, ech);
+
+                    ObjectCreator.writeSystemException(ech, sysEx);
+                  }
+                catch (SystemException ex)
+                  {
+                    sysEx = ex;
+                    
+                    org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+                    
+                    rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+                      rh_reply.service_context, ex, ech);
+                    
+                    ObjectCreator.writeSystemException(ech, ex);
+                  }
+                catch (Exception except)
+                  {
+                    // This should never happen under normal operation and
+                    // can only indicate errors in user object implementation.
+                    // We inform the user.
+                    except.printStackTrace();
+
+                    sysEx = new UNKNOWN("Unknown", 2,
+                      CompletionStatus.COMPLETED_MAYBE);
+                    sysEx.initCause(except);
+
+                    org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+                    rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+                      rh_reply.service_context, except, ech);
+
+                    ObjectCreator.writeSystemException(ech, sysEx);
+                  }
+
+                // Write the response.
+                if (rh_request.isResponseExpected())
+                  {
+                    OutputStream sou = service.getOutputStream();
+                    respond_to_client(sou, msh_request, rh_request, handler,
+                      sysEx);
+                  }
+              }
+            else if (msh_request.message_type == MessageHeader.CLOSE_CONNECTION
+              || msh_request.message_type == MessageHeader.MESSAGE_ERROR)
+              {
+                CloseMessage.close(service.getOutputStream());
+                service.close();
+                return;
+              }
+
+            if (service != null && !service.isClosed())
+
+              // Wait for the subsequent invocations on the
+              // same socket for the TANDEM_REQUEST duration.
+              service.setSoTimeout(TANDEM_REQUESTS);
+            else
+              return;
+          }
+      }
+    catch (SocketException ex)
+      {
+        // OK.
+        return;
+      }
+    catch (IOException ioex)
+      {
+        // Network error, probably transient.
+        // TODO log it.
+        return;
+      }
+    finally
+      {
+        try 
+          {
+            if (service!=null && !service.isClosed())
+              service.close();
+          }
+        catch (IOException ioex)
+          {
+            // OK.
+          }
+      }
+  }
+  
+  /**
+   * Set the ORB parameters from the properties that were accumulated
+   * from several locations.
+   */
+  protected void useProperties(Properties props)
+  {
+    if (props != null)
+      {
+        if (props.containsKey(LISTEN_ON))
+          Port = Integer.parseInt(props.getProperty(LISTEN_ON));
+        if (props.containsKey(NS_HOST))
+          ns_host = props.getProperty(NS_HOST);
+        try
+          {
+            if (props.containsKey(NS_PORT))
+              ns_port = Integer.parseInt(props.getProperty(NS_PORT));
+            if (props.containsKey(START_READING_MESSAGE))
+              TOUT_START_READING_MESSAGE =
+                Integer.parseInt(props.getProperty(START_READING_MESSAGE));
+            if (props.containsKey(WHILE_READING))
+              TOUT_WHILE_READING =
+                Integer.parseInt(props.getProperty(WHILE_READING));
+            if (props.containsKey(AFTER_RECEIVING))
+              TOUT_AFTER_RECEIVING =
+                Integer.parseInt(props.getProperty(AFTER_RECEIVING));
+            if (props.containsKey(SERVER_ERROR_PAUSE))
+              TWAIT_SERVER_ERROR_PAUSE = 
+                Integer.parseInt(props.getProperty(SERVER_ERROR_PAUSE));
+          }
+        catch (NumberFormatException ex)
+          {
+            throw new BAD_PARAM("Invalid " + NS_PORT +
+              "property, unable to parse '" + props.getProperty(NS_PORT) +
+              "'"
+            );
+          }
+        
+        if (props.containsKey(SocketFactory.PROPERTY))
+          {
+            String factory = null;
+            try
+              {
+                factory = props.getProperty(SocketFactory.PROPERTY);
+                if (factory!=null)
+                  socketFactory = (SocketFactory) 
+                    ObjectCreator.forName(factory).newInstance();
+              }
+            catch (Exception ex)
+              {
+                BAD_PARAM p = new BAD_PARAM("Bad socket factory "+factory);
+                p.initCause(ex);
+                throw p;
+              }
+          }
+        
+        if (props.containsKey(ORB_ID))
+          orb_id = props.getProperty(ORB_ID);
+        
+        if (props.containsKey(SERVER_ID))
+          server_id = props.getProperty(SERVER_ID);
+        
+        Enumeration en = props.elements();
+        while (en.hasMoreElements())
+          {
+            String item = (String) en.nextElement();
+            if (item.equals(REFERENCE))
+              initial_references.put(item,
+                string_to_object(props.getProperty(item))
+              );
+          }
+      }
+  }
+
+  /**
+   * Get the next instance with a response being received. If all currently sent
+   * responses not yet processed, this method pauses till at least one of them
+   * is complete. If there are no requests currently sent, the method pauses
+   * till some request is submitted and the response is received. This strategy
+   * is identical to the one accepted by Suns 1.4 ORB implementation.
+   *
+   * The returned response is removed from the list of the currently submitted
+   * responses and is never returned again.
+   *
+   * @return the previously sent request that now contains the received
+   * response.
+   *
+   * @throws WrongTransaction If the method was called from the transaction
+   * scope different than the one, used to send the request. The exception can
+   * be raised only if the request is implicitly associated with some particular
+   * transaction.
+   */
+  public Request get_next_response() throws org.omg.CORBA.WrongTransaction
+  {
+    return asynchron.get_next_response();
+  }
+
+  /**
+   * Find if any of the requests that have been previously sent with
+   * {@link #send_multiple_requests_deferred}, have a response yet.
+   *
+   * @return true if there is at least one response to the previously sent
+   * request, false otherwise.
+   */
+  public boolean poll_next_response()
+  {
+    return asynchron.poll_next_response();
+  }
+
+  /**
+   * Send multiple prepared requests expecting to get a reply. All requests are
+   * send in parallel, each in its own separate thread. When the reply arrives,
+   * it is stored in the agreed fields of the corresponing request data
+   * structure. If this method is called repeatedly, the new requests are added
+   * to the set of the currently sent requests, but the old set is not
+   * discarded.
+   *
+   * @param requests the prepared array of requests.
+   *
+   * @see #poll_next_response()
+   * @see #get_next_response()
+   * @see Request#send_deferred()
+   */
+  public void send_multiple_requests_deferred(Request[] requests)
+  {
+    asynchron.send_multiple_requests_deferred(requests);
+  }
+
+  /**
+   * Send multiple prepared requests one way, do not caring about the answer.
+   * The messages, containing requests, will be marked, indicating that the
+   * sender is not expecting to get a reply.
+   *
+   * @param requests the prepared array of requests.
+   *
+   * @see Request#send_oneway()
+   */
+  public void send_multiple_requests_oneway(Request[] requests)
+  {
+    asynchron.send_multiple_requests_oneway(requests);
+  }
+
+  /**
+   * Set the flag, forcing all server threads to terminate.
+   */
+  protected void finalize() throws java.lang.Throwable
+  {
+    running = false;
+    super.finalize();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbRestricted.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbRestricted.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbRestricted.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/OrbRestricted.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,584 @@
+/* RestrictedORB.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.CORBA;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.typecodes.AliasTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.Environment;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.UnionMember;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueFactory;
+import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
+import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
+
+import java.applet.Applet;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+/**
+ * This class implements so-called Singleton ORB, a highly restricted version
+ * that cannot communicate over network. This ORB is provided for the
+ * potentially malicious applets with heavy security restrictions. It, however,
+ * supports some basic features that might be needed even when the network
+ * access is not granted.
+ *
+ * This ORB can only create typecodes, {@link Any}, {@link ContextList},
+ * {@link NVList} and {@link org.omg.CORBA.portable.OutputStream} that writes to
+ * an internal buffer.
+ *
+ * All other methods throw the {@link NO_IMPLEMENT} exception.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class OrbRestricted extends org.omg.CORBA_2_3.ORB
+{
+  /**
+   * The singleton instance of this ORB.
+   */
+  public static final ORB Singleton = new OrbRestricted();
+
+  /**
+   * The cumulated listener for all IOR interceptors. Interceptors are used by
+   * {@link gnu.CORBA.Poa.ORB_1_4}.
+   */
+  public IORInterceptor_3_0Operations iIor;
+
+  /**
+   * The cumulated listener for all server request interceptors. Interceptors
+   * are used by {@link gnu.CORBA.Poa.ORB_1_4}.
+   */
+  public ServerRequestInterceptorOperations iServer;
+
+  /**
+   * The cumulated listener for all client request interceptros. Interceptors
+   * are used by {@link gnu.CORBA.Poa.ORB_1_4}.
+   */
+  public ClientRequestInterceptorOperations iClient;
+
+  /**
+   * The required size of the interceptor slot array.
+   */
+  public int icSlotSize = 0;
+
+  /**
+   * The value factories.
+   */
+  protected Hashtable factories = new Hashtable();
+
+  /**
+   * The policy factories.
+   */
+  protected Hashtable policyFactories = new Hashtable();
+
+  /**
+       * Create a new instance of the RestrictedORB. This is used in derived classes
+   * only.
+   */
+  protected OrbRestricted()
+  {
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_alias_tc(String id, String name, TypeCode typecode)
+  {
+    return new AliasTypeCode(typecode, id, name);
+  }
+
+  /** {@inheritDoc} */
+  public Any create_any()
+  {
+    gnuAny any = new gnuAny();
+    any.setOrb(this);
+    return any;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_array_tc(int length, TypeCode element_type)
+  {
+    ArrayTypeCode p =
+      new ArrayTypeCode(TCKind.tk_array, element_type);
+    p.setLength(length);
+    return p;
+  }
+
+  /** {@inheritDoc} */
+  public ContextList create_context_list()
+  {
+    return new gnuContextList();
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_enum_tc(String id, String name, String[] values)
+  {
+    RecordTypeCode r = new RecordTypeCode(TCKind.tk_enum);
+    for (int i = 0; i < values.length; i++)
+      {
+        r.field().name = values [ i ];
+      }
+
+    r.setId(id);
+    r.setName(name);
+
+    return r;
+  }
+
+  /** {@inheritDoc} */
+  public Environment create_environment()
+  {
+    return new gnuEnvironment();
+  }
+
+  /** {@inheritDoc} */
+  public ExceptionList create_exception_list()
+  {
+    return new gnuExceptionList();
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_exception_tc(String id, String name,
+    StructMember[] members
+  )
+  {
+    RecordTypeCode r = new RecordTypeCode(TCKind.tk_except);
+    r.setId(id);
+    r.setName(name);
+
+    for (int i = 0; i < members.length; i++)
+      {
+        r.add(members [ i ]);
+      }
+
+    return r;
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public TypeCode create_interface_tc(String id, String name)
+  {
+    no();
+    return null;
+  }
+
+  /** {@inheritDoc} */
+  public NVList create_list(int count)
+  {
+    return new gnuNVList(count);
+  }
+
+  /** {@inheritDoc} */
+  public NamedValue create_named_value(String s, Any any, int flags)
+  {
+    return new gnuNamedValue();
+  }
+
+  /** {@inheritDoc} */
+  public OutputStream create_output_stream()
+  {
+    BufferedCdrOutput stream = new BufferedCdrOutput();
+    stream.setOrb(this);
+    return stream;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_sequence_tc(int bound, TypeCode element_type)
+  {
+    ArrayTypeCode p =
+      new ArrayTypeCode(TCKind.tk_sequence, element_type);
+    p.setLength(bound);
+    return p;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_string_tc(int bound)
+  {
+    StringTypeCode p = new StringTypeCode(TCKind.tk_string);
+    p.setLength(bound);
+    return p;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_struct_tc(String id, String name,
+    StructMember[] members
+  )
+  {
+    RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
+    r.setId(id);
+    r.setName(name);
+
+    for (int i = 0; i < members.length; i++)
+      {
+        r.add(members [ i ]);
+      }
+
+    return r;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_union_tc(String id, String name,
+    TypeCode discriminator_type, UnionMember[] members
+  )
+  {
+    RecordTypeCode r = new RecordTypeCode(TCKind.tk_union);
+    r.setId(id);
+    r.setName(name);
+    r.setDiscriminator_type(discriminator_type);
+    r.setDefaultIndex(0);
+
+    for (int i = 0; i < members.length; i++)
+      {
+        r.add(members [ i ]);
+      }
+
+    return r;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode create_wstring_tc(int bound)
+  {
+    StringTypeCode p = new StringTypeCode(TCKind.tk_wstring);
+    p.setLength(bound);
+    return p;
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode get_primitive_tc(TCKind tcKind)
+  {
+    try
+      {
+        return TypeKindNamer.getPrimitveTC(tcKind);
+      }
+    catch (BadKind ex)
+      {
+        throw new BAD_PARAM("This is not a primitive type code: " +
+          tcKind.value()
+        );
+      }
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public String[] list_initial_services()
+  {
+    no();
+    throw new InternalError();
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public String object_to_string(org.omg.CORBA.Object forObject)
+  {
+    no();
+    throw new InternalError();
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws InvalidName never in this class, but it is thrown in the derived
+   * classes.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public org.omg.CORBA.Object resolve_initial_references(String name)
+    throws InvalidName
+  {
+    no();
+    throw new InternalError();
+  }
+
+  /**
+   * Shutdown the ORB server.
+   *
+   * For RestrictedORB, returns witout action.
+   */
+  public void run()
+  {
+  }
+
+  /**
+   * Shutdown the ORB server.
+   *
+   * For RestrictedORB, returns witout action.
+   */
+  public void shutdown(boolean wait_for_completion)
+  {
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public org.omg.CORBA.Object string_to_object(String IOR)
+  {
+    no();
+    throw new InternalError();
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  protected void set_parameters(Applet app, Properties props)
+  {
+    no();
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  protected void set_parameters(String[] args, Properties props)
+  {
+    no();
+  }
+
+  /**
+   * Throws an exception, stating that the given method is not supported by the
+   * Restricted ORB.
+   */
+  private final void no()
+  {
+    // Apart the programming errors, this can only happen if the
+    // malicious code is trying to do that it is not allowed.
+    throw new NO_IMPLEMENT("Use init(args, props) for the functional version.");
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public Request get_next_response() throws org.omg.CORBA.WrongTransaction
+  {
+    no();
+    throw new InternalError();
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public boolean poll_next_response()
+  {
+    no();
+    throw new InternalError();
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public void send_multiple_requests_deferred(Request[] requests)
+  {
+    no();
+  }
+
+  /**
+   * This method is not allowed for a RestrictedORB.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public void send_multiple_requests_oneway(Request[] requests)
+  {
+    no();
+  }
+
+  /**
+   * Register the value factory under the given repository id.
+   */
+  public ValueFactory register_value_factory(String repository_id,
+    ValueFactory factory
+  )
+  {
+    factories.put(repository_id, factory);
+    return factory;
+  }
+
+  /**
+   * Unregister the value factroy.
+   */
+  public void unregister_value_factory(String id)
+  {
+    factories.remove(id);
+  }
+
+  /**
+   * Look for the value factory for the value, having the given repository id.
+       * The implementation checks for the registered value factories first. If none
+       * found, it tries to load and instantiate the class, mathing the given naming
+   * convention. If this faild, null is returned.
+   *
+   * @param repository_id a repository id.
+   *
+   * @return a found value factory, null if none.
+   */
+  public ValueFactory lookup_value_factory(String repository_id)
+  {
+    ValueFactory f = (ValueFactory) factories.get(repository_id);
+    if (f != null)
+      {
+        return f;
+      }
+
+    f = (ValueFactory) ObjectCreator.createObject(repository_id,
+        "DefaultFactory"
+      );
+    if (f != null)
+      {
+        factories.put(repository_id, f);
+      }
+    return f;
+  }
+
+  /**
+   * Destroy the interceptors, if they are present.
+   */
+  public void destroy()
+  {
+    if (iIor != null)
+      {
+        iIor.destroy();
+        iIor = null;
+      }
+
+    if (iServer != null)
+      {
+        iServer.destroy();
+        iServer = null;
+      }
+
+    if (iClient != null)
+      {
+        iClient.destroy();
+        iClient = null;
+      }
+
+    super.destroy();
+  }
+  
+  /**
+   * Create a typecode, representing a tree-like structure.
+   * This structure contains a member that is a sequence of the same type,
+   * as the structure itself. You can imagine as if the folder definition
+   * contains a variable-length array of the enclosed (nested) folder
+   * definitions. In this way, it is possible to have a tree like
+   * structure that can be transferred via CORBA CDR stream.
+   *
+   * @deprecated It is easier and clearler to use a combination of
+   * create_recursive_tc and create_sequence_tc instead.
+   *
+   * @param bound the maximal expected number of the nested components
+   * on each node; 0 if not limited.
+   *
+   * @param offset the position of the field in the returned structure
+   * that contains the sequence of the structures of the same field.
+   * The members before this field are intialised using parameterless
+   * StructMember constructor.
+   *
+   * @return a typecode, defining a stucture, where a member at the
+   * <code>offset</code> position defines an array of the identical
+   * structures.
+   *
+   * @see #create_recursive_tc(String)
+   * @see #create_sequence_tc(int, TypeCode)
+   */
+  public TypeCode create_recursive_sequence_tc(int bound, int offset)
+  {
+    RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
+    for (int i = 0; i < offset; i++)
+      r.add(new StructMember());
+
+    TypeCode recurs = new PrimitiveTypeCode(TCKind.tk_sequence);
+
+    r.add(new StructMember("", recurs, null));
+    return r;
+  }
+  
+  /**
+   * Get the default context of this ORB. This is an initial root of all
+   * contexts.
+   *
+   * The default method returns a new context with the empty name and
+   * no parent context.
+   *
+   * @return the default context of this ORB.
+   */
+  public Context get_default_context()
+  {
+    return new gnuContext("", null);
+  }
+  
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AOM.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AOM.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AOM.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AOM.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,406 @@
+/* AOM.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.CORBA.Poa;
+
+import gnu.CORBA.ByteArrayComparator;
+
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.Servant;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * Implements the conception of the Active Object Map.
+ * If the POA supports the RETAIN policy, it maintains an Active
+ * Object Map, that associates Object Ids with active servants.
+ * Each association constitutes an active object. We use a single map
+ * for all POAs on the given orb.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class AOM
+{
+  /**
+   * The reference data about the object, placed on the AOM.
+   */
+  public class Obj
+  {
+    /**
+     * Create an initialised instance.
+     */
+    Obj(gnuServantObject _object, byte[] _key, Servant _servant, gnuPOA _poa)
+    {
+      object = _object;
+      key = _key;
+      servant = _servant;
+      poa = _poa;
+    }
+
+    /**
+     * The object.
+     */
+    public final gnuServantObject object;
+
+    /**
+     * The servant, serving the given object.
+     */
+    public Servant servant;
+
+    /**
+     * The local servant that once served this object.
+     * This field is used by {@link ForwardedServant} when it discovers that
+     * the forwarding chaing returns back to the original location.
+     * It should not be used anywhere else.
+     */
+    Servant primary_servant;
+
+    /**
+     * The POA, where the object is connected.
+     */
+    public final gnuPOA poa;
+
+    /**
+     * The object key.
+     */
+    public final byte[] key;
+
+    /**
+     * If true, this entry is deactivated.
+     */
+    public boolean deactivated;
+
+    /**
+     * Set the servant value, preserving any non null
+     * value as the primary servant.
+     */
+    public void setServant(Servant s)
+    {
+      if (primary_servant == null)
+        primary_servant = s;
+      servant = s;
+    }
+
+    /**
+     * Get the servant.
+     */
+    public Servant getServant()
+    {
+      return servant;
+    }
+
+    /**
+     * Get the deactivation state.
+     */
+    public boolean isDeactiveted()
+    {
+      return deactivated;
+    }
+
+    /**
+     * Set the deactivation state.
+     */
+    public void setDeactivated(boolean state)
+    {
+      deactivated = state;
+    }
+  }
+
+  /**
+   * The free number to give for the next instance.
+   * This field is incremented each time the
+   * new collection of the connected objects is created.
+   * Each collection has its own unique instance number.
+   */
+  private static long free_id;
+
+  /**
+   * The map of the all connected objects, maps the object key to the
+   * object.
+   */
+  Map objects = new TreeMap(new ByteArrayComparator());
+
+  /**
+   * Get the record of the stored object. If the object is mapped several times
+   * under the different keys, one of the mappings is used.
+   * 
+   * @param object the stored object
+   * 
+   * @return the record about the stored object, null if this object is not
+   * stored here.
+   */
+  public Obj findObject(org.omg.CORBA.Object stored_object)
+  {
+    if (stored_object == null)
+      return null;
+
+    Map.Entry item;
+    Iterator iter;
+    Obj ref;
+
+    if (stored_object instanceof ObjectImpl)
+      {
+        // If the delegate is available, search by delegate.
+        Delegate d = ((ObjectImpl) stored_object)._get_delegate();
+        Delegate d2;
+
+        if (d != null)
+          {
+            iter = objects.entrySet().iterator();
+            while (iter.hasNext())
+              {
+                item = (Map.Entry) iter.next();
+                ref = (Obj) item.getValue();
+                d2 = ref.object._get_delegate();
+
+                if (d == d2 || (d2 != null && d2.equals(d)))
+                  return ref;
+              }
+          }
+      }
+
+    // For other objects (or if not possible to get the delegate),
+    // search by .equals
+    iter = objects.entrySet().iterator();
+    while (iter.hasNext())
+      {
+        item = (Map.Entry) iter.next();
+        ref = (Obj) item.getValue();
+        if (stored_object.equals(ref.object))
+          return ref;
+      }
+    return null;
+  }
+
+  /**
+   * Find the reference info for the given servant. If the servant is mapped to
+   * several objects, this returns the first found occurence.
+   * 
+   * @param servant a servant to find.
+   * 
+   * @return the servant/object/POA binding or null if no such found.
+   */
+  public Obj findServant(Servant servant)
+  {
+    if (servant == null)
+      return null;
+
+    Map.Entry item;
+    Iterator iter = objects.entrySet().iterator();
+    Obj ref;
+
+    while (iter.hasNext())
+      {
+        item = (Map.Entry) iter.next();
+        ref = (Obj) item.getValue();
+        if (servant.equals(ref.servant))
+          return ref;
+      }
+    return null;
+  }
+
+  /**
+   * Find the reference info for the given servant.
+   * If the servant is mapped to several objects, this
+   * returns the first found occurence.
+   *
+   * @param servant a servant to find.
+   * @param speficies if to search for the inactive (true) or active
+   * (false) servant. A servant with unmatching activity is ignored
+   * by this method.
+   *
+   * @return the servant/object/POA binding or null if no such found.
+   */
+  public Obj findServant(Servant servant, boolean inactive)
+  {
+    if (servant == null)
+      return null;
+
+    Map.Entry item;
+    Iterator iter = objects.entrySet().iterator();
+    Obj ref;
+
+    while (iter.hasNext())
+      {
+        item = (Map.Entry) iter.next();
+        ref = (Obj) item.getValue();
+        if (ref.deactivated == inactive)
+          if (ref.servant != null)
+            if (servant.equals(ref.servant))
+              return ref;
+      }
+    return null;
+  }
+
+  /**
+   * Add the new object to the repository. The object key is
+   * generated automatically.
+   *
+   * @param object the object to add.
+   * @param servant a servant, serving the given object.
+   * @param poa the poa, where the object is connected.
+   *
+   * @return the newly created object record.
+   */
+  public Obj add(gnuServantObject object, Servant servant, gnuPOA poa)
+  {
+    return add(generateObjectKey(object), object, servant, poa);
+  }
+
+  /**
+   * Add the new object to the repository.
+   *
+   * @param key the object key.
+   * @param object the object to add.
+   * @param servant a servant, serving the given object.
+   * @param poa the POA, where the object is connected.
+   */
+  public Obj add(byte[] key, gnuServantObject object, Servant servant,
+                 gnuPOA poa
+                )
+  {
+    Obj rec = new Obj(object, key, servant, poa);
+    objects.put(key, rec);
+    return rec;
+  }
+
+  /**
+   * Add the new object to the repository.
+   *
+   * @param delegate the delegate, providing data about the servant, key, POA
+   * and object.
+   * @param port the port that this object would take.
+   */
+  public Obj add(ServantDelegateImpl delegate)
+  {
+    Obj rec =
+      new Obj(delegate.object, delegate.servant_id, delegate.servant,
+              delegate.poa
+             );
+    objects.put(delegate.servant_id, rec);
+    return rec;
+  }
+
+  /**
+   * Put back the definition structure that has probably been removed earlier.
+   */
+  public void put(Obj obj)
+  {
+    objects.put(obj.key, obj);
+  }
+
+  /**
+   * Get the stored object.
+   *
+   * @param key the key (in the byte array form).
+   *
+   * @return the matching object, null if none is matching.
+   */
+  public Obj get(byte[] key)
+  {
+    return (Obj) objects.get(key);
+  }
+
+  /**
+   * Get the map key set.
+   */
+  public Set keySet()
+  {
+    return objects.keySet();
+  }
+
+  /**
+   * Remove the given object, indiciating it by the key.
+   *
+   * @param object the object to remove.
+   */
+  public void remove(byte[] key)
+  {
+    objects.remove(key);
+  }
+
+  /**
+   * Generate the object key, unique in the currently
+   * running java virtual machine. The passed object
+   * parameter is currently not in use.
+   *
+   * @return the generated key.
+   */
+  protected byte[] generateObjectKey(org.omg.CORBA.Object object)
+  {
+    byte[] key;
+
+    // The repetetive keys cannot be generated, but theoretically
+    // the same keys can be passed when calling add(byte[]...).
+    // Hence we check if the key is not already in the map and,
+    // if it is, use the subsequent value.
+    do
+      {
+        key = getFreeId();
+      }
+    while (objects.containsKey(key));
+    return key;
+  }
+
+  /**
+   * Get the next free 8 byte id, surely unique between calls of this
+   * method for the currently running virtual machine.
+   */
+  public static synchronized byte[] getFreeId()
+  {
+    byte[] r = new byte[ 8 ];
+
+    // Start from the faster-changing.
+    r [ 0 ] = ((byte) (0xff & free_id));
+    r [ 1 ] = ((byte) (0xff & (free_id >> 8)));
+    r [ 2 ] = ((byte) (0xff & (free_id >> 16)));
+    r [ 3 ] = ((byte) (0xff & (free_id >> 24)));
+    r [ 4 ] = ((byte) (0xff & (free_id >> 32)));
+    r [ 5 ] = ((byte) (0xff & (free_id >> 40)));
+    r [ 6 ] = ((byte) (0xff & (free_id >> 48)));
+    r [ 7 ] = ((byte) (0xff & (free_id >> 56)));
+
+    free_id++;
+
+    return r;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* AccessiblePolicy.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.CORBA.Poa;
+
+import org.omg.CORBA.Policy;
+
+/**
+ * The Classpath implementation of the policy, providing the policy
+ * value and the code of the policy type.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public interface AccessiblePolicy
+  extends Policy
+{
+  /**
+   * Get the value of this policy
+   */
+  java.lang.Object getValue();
+
+  /**
+   * Get the integer code of this policy value.
+   */
+  int getCode();
+
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,85 @@
+/* DynamicImpHandler.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.CORBA.Poa;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.PortableServer.DynamicImplementation;
+
+/**
+ * The InvokeHandler, indicating, that the target is a dynamic
+ * implementation rather than an invoke handler. These two
+ * types are not substitutable, but in some methods have possibility
+ * just to handle them differently.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class DynamicImpHandler
+  implements InvokeHandler
+{
+  /**
+   * The servant that is a dynamic implementation rather than
+   * invoke handler.
+   */
+  public final DynamicImplementation servant;
+
+  /**
+   * Create a new instance, wrapping some dyn implementation.
+   * @param _servant
+   */
+  public DynamicImpHandler(DynamicImplementation _servant)
+  {
+    servant = _servant;
+  }
+
+  /**
+   * We cannot invoke properly without having parameter info.
+   *
+   * @throws BAD_OPERATION, always.
+   */
+  public OutputStream _invoke(String method, InputStream input,
+                              ResponseHandler handler
+                             )
+  {
+    throw new BAD_OPERATION(servant + " is not an InvokeHandler.");
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardRequestHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardRequestHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardRequestHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardRequestHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,107 @@
+/* ForwardRequestHolder.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.CORBA.Poa;
+
+import gnu.CORBA.ForwardRequestHelper;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.PortableServer.ForwardRequest;
+
+/**
+* A holder for the exception {@link ForwardRequest}.
+
+* @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+*/
+public class ForwardRequestHolder
+  implements Streamable
+{
+  /**
+   * The stored ForwardRequest value.
+   */
+  public ForwardRequest value;
+
+  /**
+   * Create the unitialised instance, leaving the value field
+   * with default <code>null</code> value.
+   */
+  public ForwardRequestHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the value that will be assigned to
+   * the <code>value</code> field.
+   */
+  public ForwardRequestHolder(ForwardRequest initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Fill in the {@link value} by data from the CDR stream.
+   *
+   * @param input the org.omg.CORBA.portable stream to read.
+   */
+  public void _read(InputStream input)
+  {
+    value = ForwardRequestHelper.read(input);
+  }
+
+  /**
+   * Get the typecode of the ForwardRequest.
+   */
+  public TypeCode _type()
+  {
+    return ForwardRequestHelper.type();
+  }
+
+  /**
+   * Write the stored value into the CDR stream.
+   *
+   * @param output the org.omg.CORBA.portable stream to write.
+   */
+  public void _write(OutputStream output)
+  {
+    ForwardRequestHelper.write(output, value);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,209 @@
+/* ForwardedServant.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.CORBA.Poa;
+
+import gnu.CORBA.IOR;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.IorObject;
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.Delegate;
+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.RemarshalException;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+
+import java.io.IOException;
+
+/**
+ * A "virtual servant", delegating all invocation to the wrapped
+ * object (usually remote). Used in cases when it is necessary to
+ * handle the request forwarding.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class ForwardedServant
+  extends Servant
+  implements InvokeHandler
+{
+  /**
+   * The reference object, handling requests.
+   */
+  public final ObjectImpl ref;
+
+  /**
+   * Create an instance, forwarding requests to the given object.
+   */
+  ForwardedServant(ObjectImpl a_ref)
+  {
+    ref = a_ref;
+  }
+
+  /**
+   * Create an instance of the forwarded servant.
+   *
+   * @param a_ref a reference where request should be forwarded.
+   *
+   * @return a created forwarded servant or null if the parameter
+   * forwards request to itself. Returning null will force to find
+   * a right servant in one of many possible ways, depending on
+   * policies.
+   */
+  public static Servant create(org.omg.CORBA.Object a_ref)
+  {
+    try
+      {
+        ObjectImpl fto = (ObjectImpl) a_ref;
+
+        // Check maybe the remote side forwarded back to our local object.
+        if (fto instanceof IorObject)
+          {
+            IorObject iref = (IorObject) fto;
+
+            // Check maybe the IOR is local.
+            ORB t_orb = iref._orb();
+            if (t_orb instanceof ORB_1_4)
+              {
+                ORB_1_4 orb = (ORB_1_4) t_orb;
+                Delegate d = iref._get_delegate();
+                if (d instanceof IorDelegate)
+                  {
+                    IorDelegate ird = (IorDelegate) iref._get_delegate();
+                    IOR ior = ird.getIor();
+                    if (orb.LOCAL_HOST.equalsIgnoreCase(ior.Internet.host))
+                      {
+                        AOM.Obj rx = orb.rootPOA.findIorKey(ior.key);
+                        if (rx != null)
+                          {
+                            if (rx.object == fto ||
+                                rx.object._is_equivalent(fto)
+                               )
+                              return rx.primary_servant;
+                            else
+                              fto = (ObjectImpl) rx.object;
+                          }
+                      }
+                  }
+              }
+          }
+        return new ForwardedServant(fto);
+      }
+    catch (ClassCastException ex)
+      {
+        throw new BAD_PARAM("ObjectImpl required but " + a_ref + " passed ",
+                            0x5005, CompletionStatus.COMPLETED_NO
+                           );
+      }
+  }
+
+  /**
+   * Forward the call to the wrapped object.
+   */
+  public OutputStream _invoke(String method, InputStream input,
+                              ResponseHandler handler
+                             )
+                       throws SystemException
+  {
+    org.omg.CORBA.portable.InputStream in = null;
+    org.omg.CORBA.portable.OutputStream out = null;
+    try
+      {
+        try
+          {
+            out = ref._request(method, true);
+
+            // Transfer request information.
+            int b;
+            while ((b = input.read()) >= 0)
+              {
+                out.write(b);
+              }
+            in = ref._invoke(out);
+
+            // Read the returned data.
+            out = handler.createReply();
+            while ((b = in.read()) >= 0)
+              {
+                out.write(b);
+              }
+          }
+        catch (IOException io_ex)
+          {
+            MARSHAL m = new MARSHAL();
+            m.minor = Minor.Forwarding;
+            m.initCause(io_ex);
+            throw m;
+          }
+      }
+    catch (ApplicationException ex)
+      {
+        in = ex.getInputStream();
+
+        String _id = ex.getId();
+        throw new MARSHAL(_id, 5101, CompletionStatus.COMPLETED_NO);
+      }
+    catch (RemarshalException remarsh)
+      {
+        _invoke(method, input, handler);
+      }
+    finally
+      {
+        ref._releaseReply(in);
+      }
+    return out;
+  }
+
+  /**
+   * Delegates to the wrapped object.
+   */
+  public String[] _all_interfaces(POA poa, byte[] key)
+  {
+    return ref._ids();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/InvalidPolicyHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/InvalidPolicyHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/InvalidPolicyHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/InvalidPolicyHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,106 @@
+/* InvalidPolicyHolder.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.CORBA.Poa;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.PortableServer.POAPackage.InvalidPolicy;
+import org.omg.PortableServer.POAPackage.InvalidPolicyHelper;
+
+/**
+* A holder for the exception {@link InvalidPolicy}.
+
+* @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+*/
+public class InvalidPolicyHolder
+  implements Streamable
+{
+  /**
+   * The stored InvalidPolicy value.
+   */
+  public InvalidPolicy value;
+
+  /**
+   * Create the unitialised instance, leaving the value field
+   * with default <code>null</code> value.
+   */
+  public InvalidPolicyHolder()
+  {
+  }
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue the value that will be assigned to
+   * the <code>value</code> field.
+   */
+  public InvalidPolicyHolder(InvalidPolicy initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Fill in the {@link value} by data from the CDR stream.
+   *
+   * @param input the org.omg.CORBA.portable stream to read.
+   */
+  public void _read(InputStream input)
+  {
+    value = InvalidPolicyHelper.read(input);
+  }
+
+  /**
+   * Write the stored value into the CDR stream.
+   *
+   * @param output the org.omg.CORBA.portable stream to write.
+   */
+  public void _write(OutputStream output)
+  {
+    InvalidPolicyHelper.write(output, value);
+  }
+
+  /**
+   * Get the typecode of the InvalidPolicy.
+   */
+  public TypeCode _type()
+  {
+    return InvalidPolicyHelper.type();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,385 @@
+/* LocalDelegate.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.CORBA.Poa;
+
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.IOR;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.StreamBasedRequest;
+
+import org.omg.CORBA.ARG_INOUT;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.UnknownUserException;
+import org.omg.CORBA.portable.ApplicationException;
+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.RemarshalException;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+
+import java.util.Arrays;
+
+/**
+ * A local delegate, transferring all object requests to the locally available
+ * servant. This class is involved in handling the method invocations on the
+ * local object, obtained by POA.create_reference_with_id.
+ * 
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class LocalDelegate
+  extends org.omg.CORBA_2_3.portable.Delegate
+  implements IorProvider
+{
+  /**
+   * The same servant as an invocation handler.
+   */
+  gnuServantObject object;
+
+  String operation;
+
+  public final gnuPOA poa;
+
+  final byte[] Id;
+
+  /**
+   * Create a local delegate, forwarding requests to the servant that must also
+   * be an invocation handler.
+   */
+  public LocalDelegate(gnuServantObject an_object, gnuPOA a_poa, byte[] an_id)
+  {
+    object = an_object;
+    poa = a_poa;
+    Id = an_id;
+  }
+  
+  /**
+   * Get the IOR of the connected object.
+   */
+  public IOR getIor()
+  {
+    return object.getIor();
+  }
+
+  public Request request(org.omg.CORBA.Object target, String method)
+  {
+    operation = method;
+
+    LocalRequest rq = new LocalRequest(object, poa, Id);
+    rq.setOperation(method);
+    rq.setORB(orb(target));
+    return rq;
+  }
+
+  public void release(org.omg.CORBA.Object target)
+  {
+  }
+
+  public boolean is_equivalent(org.omg.CORBA.Object target,
+    org.omg.CORBA.Object other)
+  {
+    if (target == other)
+      return true;
+    else if (target instanceof ObjectImpl && other instanceof ObjectImpl)
+      {
+        org.omg.CORBA.portable.Delegate a = null;
+        org.omg.CORBA.portable.Delegate b = null;
+        try
+          {
+            a = ((ObjectImpl) target)._get_delegate();
+            b = ((ObjectImpl) other)._get_delegate();
+          }
+        catch (Exception ex)
+          {
+            // Unable to get one of the delegates.
+            return false;
+          }
+        if (a instanceof LocalDelegate && b instanceof LocalDelegate)
+          {
+            byte[] k1 = ((LocalDelegate) a).Id;
+            byte[] k2 = ((LocalDelegate) b).Id;
+            return Arrays.equals(k1, k2);
+          }
+        else
+          return false;
+      }
+    else
+      return false;
+  }
+
+  /**
+   * Always return false.
+   */
+  public boolean non_existent(org.omg.CORBA.Object target)
+  {
+    return false;
+  }
+
+  /**
+   * Get hash code.
+   */
+  public int hash(org.omg.CORBA.Object target, int maximum)
+  {
+    return hashCode() % maximum;
+  }
+
+  /**
+   * Check if this object could be named by the given repository id.
+   * 
+   * @param idl_id the repository id to check.
+   * 
+   * @return true if it is one of the possible repository ids of this object.
+   */
+  public boolean is_a(org.omg.CORBA.Object a_servant, String idl_id)
+  {
+    String[] maybe = object._ids();
+    for (int i = 0; i < maybe.length; i++)
+      {
+        if (maybe[i].equals(idl_id))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Return <code>this</code>.
+   */
+  public org.omg.CORBA.Object duplicate(org.omg.CORBA.Object target)
+  {
+    return target;
+  }
+
+  /**
+   * Create request for using with DII.
+   */
+  public Request create_request(org.omg.CORBA.Object target, Context context,
+    String method, NVList parameters, NamedValue returns,
+    ExceptionList exceptions, ContextList ctx_list)
+  {
+    operation = method;
+
+    LocalRequest rq = new LocalRequest(object, poa, Id);
+    rq.setOperation(method);
+    rq.set_args(parameters);
+    rq.set_result(returns);
+    rq.set_exceptions(exceptions);
+    rq.set_context_list(ctx_list);
+    return rq;
+  }
+
+  /**
+   * Create request for using with DII.
+   */
+  public Request create_request(org.omg.CORBA.Object target, Context context,
+    String method, NVList parameters, NamedValue returns)
+  {
+    operation = method;
+
+    LocalRequest rq = new LocalRequest(object, poa, Id);
+    rq.setOperation(method);
+    rq.set_args(parameters);
+    rq.set_result(returns);
+    return rq;
+  }
+
+  /**
+   * Not in use.
+   */
+  public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object target)
+  {
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Create a request to invoke the method of this CORBA object.
+   * 
+   * @param operation the name of the method to invoke.
+   * @param response_expected specifies if this is one way message or the
+   * response to the message is expected.
+   * 
+   * @return the stream where the method arguments should be written.
+   */
+  public org.omg.CORBA.portable.OutputStream request(
+    org.omg.CORBA.Object target, String method, boolean response_expected)
+  {
+    operation = method;
+
+    // Check if the object is not explicitly deactivated.
+    AOM.Obj e = poa.aom.get(Id);
+    if (e != null && e.isDeactiveted())
+      {
+        if (poa.servant_activator != null || poa.servant_locator != null)
+          {
+            // This will force the subsequent activation.
+            object.setServant(null);
+            e.setServant(null);
+            e.setDeactivated(false);
+          }
+        else
+          throw new OBJECT_NOT_EXIST("Deactivated");
+      }
+
+    LocalRequest rq = new LocalRequest(object, poa, Id);
+    rq.setOperation(method);
+    rq.setORB(orb(target));
+    return rq.getParameterStream();
+  }
+
+  /**
+   * Return the associated invocation handler.
+   */
+  public InvokeHandler getHandler(String method, CookieHolder cookie)
+  {
+    return object.getHandler(method, cookie, false);
+  }
+
+  /**
+   * Return the ORB of the associated POA. The parameter is not in use.
+   */
+  public ORB orb(org.omg.CORBA.Object target)
+  {
+    return poa.orb();
+  }
+
+  /**
+   * Make an invocation.
+   * 
+   * @param target not in use.
+   * @param output the stream request that should be returned by
+   * {@link #m_request} in this method.
+   * @throws ApplicationException if the use exception is thrown by the servant
+   * method.
+   */
+  public InputStream invoke(org.omg.CORBA.Object target, OutputStream output)
+    throws ApplicationException
+  {
+    try
+      {
+        StreamBasedRequest sr = (StreamBasedRequest) output;
+
+        LocalRequest lr = (LocalRequest) sr.request;
+        InvokeHandler handler = lr.object.getHandler(lr.operation(), lr.cookie,
+          false);
+
+        if (handler instanceof DynamicImpHandler)
+          {
+            // The local request known how to handle it, but the different
+            // method must be called.
+            lr.invoke();
+
+            // The encapsulation will inherit orb, endian, charsets, etc.
+            AbstractCdrOutput buf = sr.createEncapsulation();
+
+            // Write all request parameters to the buffer stream.
+            if (lr.env().exception() != null)
+              {
+                try
+                  {
+                    UnknownUserException uex = (UnknownUserException) lr.env().exception();
+                    throw new ApplicationException(uex.except.type().id(),
+                      uex.except.create_input_stream());
+                  }
+                catch (BadKind ex)
+                  {
+                    InternalError ierr = new InternalError();
+                    ierr.initCause(ex);
+                    throw ierr;
+                  }
+              }
+            if (lr.return_value() != null)
+              lr.return_value().write_value(buf);
+
+            NamedValue a;
+            try
+              {
+                for (int i = 0; i < lr.arguments().count(); i++)
+                  {
+                    a = lr.arguments().item(i);
+                    if (a.flags() == ARG_INOUT.value
+                      || a.flags() == ARG_INOUT.value)
+                      {
+                        a.value().write_value(buf);
+                      }
+                  }
+              }
+            catch (Bounds ex)
+              {
+                InternalError ierr = new InternalError();
+                ierr.initCause(ex);
+                throw ierr;
+              }
+
+            return buf.create_input_stream();
+          }
+        else
+          {
+            LocalRequest lrq = (LocalRequest) sr.request;
+            return lrq.s_invoke(handler);
+          }
+      }
+    catch (gnuForwardRequest f)
+      {
+        try
+          {
+            return ((ObjectImpl) f.forward_reference)._invoke(f.forward_reference._request(
+              operation, true));
+          }
+        catch (RemarshalException e)
+          {
+            // Never thrown in this place by Classpath implementation.
+            throw new NO_IMPLEMENT();
+          }
+      }
+  }
+
+  public void releaseReply(org.omg.CORBA.Object target, InputStream input)
+  {
+    release(target);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,684 @@
+/* LocalRequest.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.CORBA.Poa;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.GIOP.MessageHeader;
+import gnu.CORBA.GIOP.v1_2.ReplyHeader;
+import gnu.CORBA.GIOP.v1_2.RequestHeader;
+import gnu.CORBA.Interceptor.gnuClientRequestInfo;
+import gnu.CORBA.Interceptor.gnuServerRequestInfo;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.gnuAny;
+import gnu.CORBA.gnuRequest;
+import gnu.CORBA.StreamHolder;
+import gnu.CORBA.StreamBasedRequest;
+
+import org.omg.CORBA.ARG_OUT;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.UnknownUserException;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.ApplicationException;
+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;
+import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
+import org.omg.PortableServer.CurrentOperations;
+import org.omg.PortableServer.CurrentPackage.NoContext;
+import org.omg.PortableServer.DynamicImplementation;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+import org.omg.PortableServer.portable.Delegate;
+
+import java.io.IOException;
+
+/**
+ * Directs the invocation to the locally available servant. The POA servant does
+ * not longer implement the CORBA object and cannot be substituted directly.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class LocalRequest extends gnuRequest implements ResponseHandler,
+  CurrentOperations
+{
+  /**
+   * Used by servant locator, if involved.
+   */
+  CookieHolder cookie;
+
+  /**
+   * The object Id.
+   */
+  final byte[] Id;
+
+  /**
+   * The message header (singleton is sufficient).
+   */
+  private static final MessageHeader header = new MessageHeader();
+
+  /**
+       * True if the stream was obtained by invoking {@link #createExceptionReply()},
+   * false otherwise.
+   */
+  boolean exceptionReply;
+
+  /**
+   * The buffer to write into.
+   */
+  BufferedCdrOutput buffer;
+
+  /**
+   * The responsible POA.
+   */
+  final gnuPOA poa;
+
+  /**
+   * The servant delegate to obtain the handler.
+   */
+  gnuServantObject object;
+
+  /**
+   * Used (reused) with dynamic implementation.
+   */
+  LocalServerRequest serverRequest;
+
+  /**
+   * Create an instance of the local request.
+   */
+  public LocalRequest(gnuServantObject local_object, gnuPOA a_poa, byte[] an_id)
+  {
+    Id = an_id;
+    poa = a_poa;
+
+    // Instantiate the cookie holder only if required.
+    if (poa.servant_locator != null)
+      {
+        cookie = new CookieHolder();
+      }
+    object = local_object;
+    prepareStream();
+  }
+
+  /**
+   * Make an invocation and return a stream from where the results can be read
+   * and throw ApplicationException, where applicable.
+   */
+  org.omg.CORBA.portable.InputStream s_invoke(InvokeHandler handler)
+    throws ApplicationException
+  {
+    try
+      {
+        poa.m_orb.currents.put(Thread.currentThread(), this);
+
+        org.omg.CORBA.portable.InputStream input = v_invoke(handler);
+
+        if (!exceptionReply)
+          {
+            return input;
+          }
+        else
+          {
+            input.mark(500);
+
+            String id = input.read_string();
+            try
+              {
+                input.reset();
+              }
+            catch (IOException ex)
+              {
+                InternalError ierr = new InternalError();
+                ierr.initCause(ex);
+                throw ierr;
+              }
+            throw new ApplicationException(id, input);
+          }
+      }
+    finally
+      {
+        poa.m_orb.currents.remove(Thread.currentThread());
+      }
+  }
+
+  /**
+   * Make an invocation and return a stream from where the results can be read.
+   *
+   * @param the invoke handler (can be null, then it is obtained self
+   * dependently).
+   */
+  public org.omg.CORBA.portable.InputStream v_invoke(InvokeHandler handler)
+  {
+    // Local request must be intercepted both by server and request
+    // interceptors.
+    boolean s_intercept = false;
+    ServerRequestInterceptorOperations s_interceptor = null;
+    gnuServerRequestInfo s_info = null;
+
+    boolean c_intercept = false;
+    ClientRequestInterceptorOperations c_interceptor = null;
+    gnuClientRequestInfo c_info = null;
+
+    try
+      {
+        if (poa.m_orb.iServer != null || poa.m_orb.iClient != null)
+          {
+            setORB(poa.m_orb);
+
+            // These two are only needed with interceptors.
+            m_rqh = new RequestHeader();
+            m_rqh.operation = m_operation;
+            m_rph = new ReplyHeader();
+
+            m_rqh.object_key = object.Id;
+            m_rph.request_id = m_rqh.request_id;
+          }
+
+        if (poa.m_orb.iClient != null)
+          {
+            c_interceptor = poa.m_orb.iClient;
+
+            c_info = new gnuClientRequestInfo(this);
+            c_intercept = true;
+
+            c_interceptor.send_request(c_info);
+
+            m_target = object;
+          }
+
+        if (poa.m_orb.iServer != null)
+          {
+            s_interceptor = poa.m_orb.iServer;
+
+            s_info = new gnuServerRequestInfo(object, m_rqh, m_rph);
+            s_info.m_request = this;
+
+            s_intercept = true;
+
+            s_interceptor.receive_request_service_contexts(s_info);
+          }
+
+        if (handler == null)
+          {
+            handler = object.getHandler(operation(), cookie, false);
+          }
+
+        BufferedCdrOutput request_part = new BufferedCdrOutput();
+
+        request_part.setOrb(orb());
+
+        if (m_args != null && m_args.count() > 0)
+          {
+            write_parameters(header, request_part);
+
+            if (m_parameter_buffer != null)
+              {
+                throw new BAD_INV_ORDER("Please either add parameters or " +
+                  "write them into stream, but not both " + "at once."
+                );
+              }
+          }
+
+        if (m_parameter_buffer != null)
+          {
+            write_parameter_buffer(header, request_part);
+          }
+
+        Servant servant;
+
+        if (handler instanceof Servant)
+          {
+            servant = (Servant) handler;
+          }
+        else
+          {
+            throw new BAD_OPERATION("Unexpected handler type " + handler);
+          }
+
+        org.omg.CORBA.portable.InputStream input =
+          request_part.create_input_stream();
+
+        // Ensure the servant (handler) has a delegate set.
+        ServantDelegateImpl sd = null;
+
+        Delegate d = null;
+
+        try
+          {
+            d = servant._get_delegate();
+          }
+        catch (Exception ex)
+          {
+            // In some cases exception is thrown if the delegate is not set.
+          }
+        if (d instanceof ServantDelegateImpl)
+          {
+            // If the delegate is already set, try to reuse the existing
+            // instance.
+            sd = (ServantDelegateImpl) d;
+            if (sd.object != object)
+              {
+                sd = new ServantDelegateImpl(servant, poa, Id);
+              }
+          }
+        else
+          {
+            sd = new ServantDelegateImpl(servant, poa, Id);
+          }
+        servant._set_delegate(sd);
+
+        try
+          {
+            ORB o = orb();
+            if (o instanceof ORB_1_4)
+              {
+                ((ORB_1_4) o).currents.put(Thread.currentThread(), this);
+              }
+
+            try
+              {
+                if (s_intercept)
+                  {
+                    s_interceptor.receive_request(s_info);
+                  }
+                handler._invoke(m_operation, input, this);
+
+                // Handler is casted into i_handler.
+                if ((s_intercept || c_intercept) && isExceptionReply())
+                  {
+                    s_info.m_reply_header.reply_status =
+                      ReplyHeader.USER_EXCEPTION;
+                    m_rph.reply_status = ReplyHeader.USER_EXCEPTION;
+
+                    // Make Any, holding the user exception.
+                    Any a = new gnuAny();
+                    OutputStream buf = getBuffer();
+                    InputStream in = buf.create_input_stream();
+                    String uex_idl = "unknown";
+                    try
+                      {
+                        in.mark(Integer.MAX_VALUE);
+                        uex_idl = in.read_string();
+                        m_exception_id = uex_idl;
+                        in.reset();
+                      }
+                    catch (IOException e)
+                      {
+                        throw new Unexpected(e);
+                      }
+
+                    try
+                      {
+                        UserException exception =
+                          ObjectCreator.readUserException(uex_idl, in);
+
+                        m_environment.exception(exception);
+                        ObjectCreator.insertWithHelper(a, exception);
+                      }
+                    catch (Exception e)
+                      {
+                        // Failed due any reason, insert without
+                        // helper.
+                        a.insert_Streamable(new StreamHolder(
+                            buf.create_input_stream()
+                          )
+                        );
+
+                        RecordTypeCode r =
+                          new RecordTypeCode(TCKind.tk_except);
+                        r.setId(uex_idl);
+                        r.setName(ObjectCreator.getDefaultName(uex_idl));
+                      }
+
+                    s_info.m_usr_exception = a;
+                    c_info.m_wrapped_exception = a;
+                    s_interceptor.send_exception(s_info);
+                    c_interceptor.receive_exception(c_info);
+                  }
+                else
+                  {
+                    if (s_intercept)
+                      {
+                        s_info.m_reply_header.reply_status =
+                          ReplyHeader.NO_EXCEPTION;
+                        s_interceptor.send_reply(s_info);
+                      }
+                    if (c_intercept)
+                      {
+                        m_rph.reply_status = ReplyHeader.NO_EXCEPTION;
+                        c_interceptor.receive_reply(c_info);
+                      }
+                  }
+              }
+            catch (SystemException sys_ex)
+              {
+                if (s_intercept)
+                  {
+                    s_info.m_reply_header.reply_status =
+                      ReplyHeader.SYSTEM_EXCEPTION;
+                    s_info.m_sys_exception = sys_ex;
+                    s_interceptor.send_exception(s_info);
+                  }
+
+                if (c_intercept)
+                  {
+                    m_rph.reply_status = ReplyHeader.SYSTEM_EXCEPTION;
+
+                    Any a = new gnuAny();
+                    if (ObjectCreator.insertSysException(a, sys_ex))
+                      {
+                        c_info.m_wrapped_exception = a;
+                      }
+                    c_interceptor.receive_exception(c_info);
+                  }
+
+                throw sys_ex;
+              }
+          }
+        finally
+          {
+            ORB o = orb();
+            if (o instanceof ORB_1_4)
+              {
+                ((ORB_1_4) o).currents.remove(Thread.currentThread());
+              }
+          }
+
+        if (poa.servant_locator != null)
+          {
+            poa.servant_locator.postinvoke(object.Id, poa, operation(),
+              cookie.value, object.getServant()
+            );
+          }
+        return buffer.create_input_stream();
+      }
+
+    catch (ForwardRequest fex)
+      {
+        // May be thrown by interceptor.
+        if (s_intercept)
+          {
+            Forwarding:
+            while (true)
+              {
+                s_info.m_reply_header.reply_status =
+                  ReplyHeader.LOCATION_FORWARD;
+                s_info.m_forward_reference = fex.forward;
+                try
+                  {
+                    s_interceptor.send_other(s_info);
+                    break Forwarding;
+                  }
+                catch (ForwardRequest fex2)
+                  {
+                    s_info.m_forward_reference = fex2.forward;
+                    fex.forward = s_info.m_forward_reference;
+                  }
+              }
+          }
+
+        if (c_intercept)
+          {
+            this.m_rph.reply_status = ReplyHeader.LOCATION_FORWARD;
+            this.m_forwarding_target = fex.forward;
+            try
+              {
+                c_interceptor.receive_other(c_info);
+              }
+            catch (ForwardRequest fex2)
+              {
+                fex.forward = fex2.forward;
+              }
+          }
+        throw new gnuForwardRequest(fex.forward);
+      }
+    catch (gnuForwardRequest fex)
+      {
+        // May be thrown during activation.
+        // May be thrown during activation.
+        if (s_intercept)
+          {
+            Forwarding:
+            while (true)
+              {
+                s_info.m_reply_header.reply_status =
+                  ReplyHeader.LOCATION_FORWARD;
+                s_info.m_forward_reference = fex.forward_reference;
+                try
+                  {
+                    s_interceptor.send_other(s_info);
+                    break Forwarding;
+                  }
+                catch (ForwardRequest fex2)
+                  {
+                    s_info.m_forward_reference = fex2.forward;
+                    fex.forward_reference = (ObjectImpl) fex2.forward;
+                  }
+              }
+          }
+
+        if (c_intercept)
+          {
+            this.m_rph.reply_status = ReplyHeader.LOCATION_FORWARD;
+            this.m_forwarding_target = fex.forward_reference;
+            try
+              {
+                c_interceptor.receive_other(c_info);
+              }
+            catch (ForwardRequest fex2)
+              {
+                fex.forward_reference = (ObjectImpl) fex2.forward;
+              }
+          }
+        throw fex;
+      }
+  }
+
+  /**
+   * Make an invocation and store the result in the fields of this Request. Used
+   * with DII only.
+   */
+  public void invoke()
+  {
+    InvokeHandler handler = object.getHandler(operation(), cookie, false);
+
+    if (handler instanceof DynamicImpHandler)
+      {
+        DynamicImplementation dyn = ((DynamicImpHandler) handler).servant;
+        if (serverRequest == null)
+          {
+            serverRequest = new LocalServerRequest(this);
+          }
+        try
+          {
+            poa.m_orb.currents.put(Thread.currentThread(), this);
+            dyn.invoke(serverRequest);
+          }
+        finally
+          {
+            poa.m_orb.currents.remove(Thread.currentThread());
+          }
+      }
+    else
+      {
+        org.omg.CORBA.portable.InputStream input = v_invoke(handler);
+
+        if (!exceptionReply)
+          {
+            NamedValue arg;
+
+            // Read return value, if set.
+            if (m_result != null)
+              {
+                m_result.value().read_value(input, m_result.value().type());
+              }
+
+            // Read returned parameters, if set.
+            if (m_args != null)
+              {
+                for (int i = 0; i < m_args.count(); i++)
+                  {
+                    try
+                      {
+                        arg = m_args.item(i);
+
+                        // Both ARG_INOUT and ARG_OUT have this binary flag set.
+                        if ((arg.flags() & ARG_OUT.value) != 0)
+                          {
+                            arg.value().read_value(input, arg.value().type());
+                          }
+                      }
+                    catch (Bounds ex)
+                      {
+                        Unexpected.error(ex);
+                      }
+                  }
+              }
+          }
+        else// User exception reply
+          {
+            // Prepare an Any that will hold the exception.
+            gnuAny exc = new gnuAny();
+
+            exc.insert_Streamable(new StreamHolder(input));
+
+            UnknownUserException unuex = new UnknownUserException(exc);
+            m_environment.exception(unuex);
+          }
+      }
+  }
+
+  /**
+   * Get an output stream for providing details about the exception. Before
+   * returning the stream, the handler automatically writes the message header
+   * and the reply about exception header, but not the message header.
+   *
+   * @return the stream to write exception details into.
+   */
+  public OutputStream createExceptionReply()
+  {
+    exceptionReply = true;
+    prepareStream();
+    return buffer;
+  }
+
+  /**
+   * Get an output stream for writing a regular reply (not an exception).
+   *
+   * Before returning the stream, the handler automatically writes the regular
+   * reply header, but not the message header.
+   *
+   * @return the output stream for writing a regular reply.
+   */
+  public OutputStream createReply()
+  {
+    exceptionReply = false;
+    prepareStream();
+    return buffer;
+  }
+
+  /**
+   * Get the buffer, normally containing the written reply. The reply includes
+   * the reply header (or the exception header) but does not include the message
+   * header.
+   *
+   * The stream buffer can also be empty if no data have been written into
+   * streams, returned by {@link #createReply()} or
+   * {@link #createExceptionReply()}.
+   *
+   * @return the CDR output stream, containing the written output.
+   */
+  BufferedCdrOutput getBuffer()
+  {
+    return buffer;
+  }
+
+  /**
+   * True if the stream was obtained by invoking {@link #createExceptionReply()},
+   * false otherwise (usually no-exception reply).
+   */
+  boolean isExceptionReply()
+  {
+    return exceptionReply;
+  }
+
+  /**
+   * Compute the header offset, set the correct version number and codeset.
+   */
+  private void prepareStream()
+  {
+    buffer = new BufferedCdrOutput();
+    buffer.setOrb(orb());
+  }
+
+  /**
+   * Get the parameter stream, where the invocation arguments should be written
+   * if they are written into the stream directly.
+   */
+  public StreamBasedRequest getParameterStream()
+  {
+    m_parameter_buffer = new StreamBasedRequest();
+    m_parameter_buffer.request = this;
+    m_parameter_buffer.setOrb(poa.orb());
+    return m_parameter_buffer;
+  }
+
+  public byte[] get_object_id() throws NoContext
+  {
+    return Id;
+  }
+
+  public POA get_POA() throws NoContext
+  {
+    return poa;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalServerRequest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalServerRequest.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalServerRequest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/LocalServerRequest.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,199 @@
+/* LocalServerRequest.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.CORBA.Poa;
+
+import gnu.CORBA.gnuNamedValue;
+
+import org.omg.CORBA.ARG_INOUT;
+import org.omg.CORBA.ARG_OUT;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.ServerRequest;
+import org.omg.CORBA.UnknownUserException;
+
+/**
+ * Used to make local invocations via LocalRequest.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class LocalServerRequest
+  extends ServerRequest
+{
+  /**
+   * The local request, on the base of that this instance is created.
+   */
+  final LocalRequest request;
+
+  /**
+   * Create a new instance.
+   */
+  public LocalServerRequest(LocalRequest _request)
+  {
+    request = _request;
+  }
+
+  /**
+   * Get the argument list that can be modified.
+   */
+  public void params(NVList args)
+  {
+    arguments(args);
+  }
+
+  /**
+   * Get contexts.
+   */
+  public Context ctx()
+  {
+    return request.ctx();
+  }
+
+  /**
+   * Get the operatin being performed.
+   */
+  public String operation()
+  {
+    return request.operation();
+  }
+
+  /**
+   * Get the argument list that can be modified.
+   * The direction depends on the size of the passed list.
+   * The empty list is filled with the request arguments.
+   * The non-empty list is used to set the request arguments.
+   */
+  public void arguments(NVList args)
+  {
+    NVList l = request.arguments();
+    NamedValue a;
+
+    try
+      {
+        if (args.count() == 0)
+          {
+            // Transfer to the passed parameter.
+            for (int i = 0; i < l.count(); i++)
+              {
+                a = l.item(i);
+                args.add_value(a.name(), a.value(), a.flags());
+              }
+          }
+        else
+          {
+            // Transfer from the passed parameter.
+            if (l.count() != args.count())
+              throw new BAD_PARAM("Argument number mismatch, current " +
+                                  l.count() + ", passed " + args.count()
+                                 );
+            try
+              {
+                for (int i = 0; i < l.count(); i++)
+                  {
+                    a = l.item(i);
+                    if (a.flags() == ARG_INOUT.value ||
+                        a.flags() == ARG_OUT.value
+                       )
+                      {
+                        ((gnuNamedValue) a).setValue(args.item(i).value());
+                      }
+                  }
+              }
+            catch (ClassCastException cex)
+              {
+                InternalError ierr = new InternalError();
+                ierr.initCause(cex);
+                throw ierr;
+              }
+          }
+      }
+    catch (Bounds ex)
+      {
+        InternalError ierr = new InternalError();
+        ierr.initCause(ex);
+        throw ierr;
+      }
+  }
+
+  /**
+   * Set the result.
+   */
+  public void set_result(Any result)
+  {
+    gnuNamedValue g = new gnuNamedValue();
+    g.setValue(result);
+    g.setFlags(ARG_OUT.value);
+    request.set_result(g);
+  }
+
+  /**
+   * Get the name of the method being called.
+   */
+  public String op_name()
+  {
+    return request.operation();
+  }
+
+  /**
+   * Set the exception that has been thrown.
+   */
+  public void set_exception(Any exc)
+  {
+    request.env().exception(new UnknownUserException(exc));
+  }
+
+  /**
+   * Set the result.
+   */
+  public void result(Any r)
+  {
+    set_result(r);
+  }
+
+  /**
+   * Set the exception.
+   */
+  public void except(Any exc)
+  {
+    set_exception(exc);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,293 @@
+/* ORB_1_4.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.CORBA.Poa;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.IOR;
+import gnu.CORBA.Connected_objects.cObject;
+import gnu.CORBA.DynAn.gnuDynAnyFactory;
+import gnu.CORBA.Interceptor.ClientRequestInterceptors;
+import gnu.CORBA.Interceptor.IORInterceptors;
+import gnu.CORBA.Interceptor.Registrator;
+import gnu.CORBA.Interceptor.ServerRequestInterceptors;
+import gnu.CORBA.Interceptor.gnuIcCurrent;
+import gnu.CORBA.Interceptor.gnuIorInfo;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.PolicyError;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableInterceptor.PolicyFactory;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
+import org.omg.PortableServer.POAPackage.InvalidPolicy;
+
+import java.applet.Applet;
+import java.util.Properties;
+
+/**
+ * The ORB, supporting POAs that are the feature of jdk 1.4.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class ORB_1_4
+  extends OrbFunctional
+{
+  /**
+   * The root POA.
+   */
+  public final gnuPOA rootPOA;
+
+  /**
+   * Maps the active threads to the invocation data ("POA Current's").
+   */
+  public gnuPoaCurrent currents = new gnuPoaCurrent();
+
+  /**
+   * Maps the active threads to the interceptor data ("Interceptor Current's").
+   */
+  public gnuIcCurrent ic_current = new gnuIcCurrent(this);
+
+  /**
+   * Creates dynamic anys.
+   */
+  public gnuDynAnyFactory factory = new gnuDynAnyFactory(this);
+
+  /**
+   * Calls the parent constructor and additionally puts the "RootPOA",
+   * "RootPOAManager", "POACurrent" and "DynAnyFactory" into initial references.
+   */
+  public ORB_1_4()
+  {
+    super();
+    try
+      {
+        rootPOA = new gnuPOA(null, "RootPOA", null, StandardPolicies.rootPoa(), this);
+      }
+    catch (InvalidPolicy ex)
+      {
+        // Invalid default policy set.
+        InternalError ierr = new InternalError();
+        ierr.initCause(ex);
+        throw ierr;
+      }
+    initial_references.put("RootPOA", rootPOA);
+    initial_references.put("RootPOAManager", rootPOA.the_POAManager());
+    initial_references.put("POACurrent", currents);
+    initial_references.put("DynAnyFactory", factory);
+    initial_references.put("PICurrent", ic_current);
+  }
+
+  /**
+   * If the super method detects that the object is not connected to this ORB,
+   * try to find and activate the object.
+   */
+  public String object_to_string(org.omg.CORBA.Object forObject)
+  {
+    try
+      {
+        return super.object_to_string(forObject);
+      }
+    catch (Exception ex)
+      {
+        try
+          {
+            AOM.Obj exists = rootPOA.findObject(forObject);
+            if (exists == null)
+              throw new OBJECT_NOT_EXIST(forObject == null ? "null"
+                : forObject.toString());
+            else if (exists.poa instanceof gnuPOA)
+              ((gnuPOA) exists.poa).connect_to_orb(exists.key, forObject);
+            else
+              exists.poa.create_reference_with_id(exists.key,
+                ((ObjectImpl) exists.object)._ids()[0]);
+          }
+        catch (Exception bex)
+          {
+            BAD_PARAM bad = new BAD_PARAM("Unable to activate " + forObject);
+            bad.initCause(bex);
+            throw bad;
+          }
+
+        return super.object_to_string(forObject);
+      }
+  }
+
+  /**
+   * Destroy all poas and then call the superclass method.
+   */
+  public void destroy()
+  {
+    // This will propagate through the whole POA tree.
+    rootPOA.destroy(true, false);
+
+    super.destroy();
+  }
+
+  /**
+   * Do interceptor registration.
+   *
+   * @param properties the properties, between those names the agreed prefix
+   * "org.omg.PortableInterceptor.ORBInitializerClass." is searched.
+   *
+   * @param args the string array, passed to the ORB.init
+   */
+  protected void registerInterceptors(Properties properties, String[] args)
+  {
+    Registrator registrator = new Registrator(this, properties, args);
+
+    policyFactories = registrator.m_policyFactories;
+
+    registrator.pre_init();
+    initial_references.putAll(registrator.getRegisteredReferences());
+    registrator.post_init();
+
+    if (registrator.hasIorInterceptors())
+      iIor = new IORInterceptors(registrator);
+
+    if (registrator.hasServerRequestInterceptors())
+      iServer = new ServerRequestInterceptors(registrator);
+
+    if (registrator.hasClientRequestInterceptors())
+      iClient = new ClientRequestInterceptors(registrator);
+
+    policyFactories = registrator.m_policyFactories;
+  }
+
+  /**
+   * Create IOR and allow registered interceptors to add additional components.
+   */
+  protected IOR createIOR(cObject ref)
+    throws BAD_OPERATION
+  {
+    IOR ior = super.createIOR(ref);
+    if (iIor != null)
+      {
+        AOM.Obj obj = rootPOA.findIorKey(ior.key);
+
+        gnuPOA poa;
+
+        // Null means that the object was connected to the ORB directly.
+        if (obj == null)
+          poa = rootPOA;
+        else
+          poa = obj.poa;
+
+        gnuIorInfo info = new gnuIorInfo(this, poa, ior);
+
+        // This may modify the ior.
+        iIor.establish_components(info);
+        iIor.components_established(info);
+      }
+    return ior;
+  }
+
+  /**
+   * Create policy using the previously registered factory.
+   */
+  public Policy create_policy(int type, Any value)
+    throws PolicyError
+  {
+    Integer policy = new Integer(type);
+
+    PolicyFactory forge = (PolicyFactory) policyFactories.get(policy);
+    if (forge == null)
+      throw new PolicyError("No factory registered for policy " + type,
+        (short) type);
+    else
+      return forge.create_policy(type, value);
+  }
+
+  /**
+   * Set the parameters and then register interceptors.
+   */
+  protected void set_parameters(Applet app, Properties props)
+  {
+    super.set_parameters(app, props);
+    registerInterceptors(props, new String[0]);
+  }
+
+  /**
+   * Set the parameters and then register interceptors.
+   */
+  protected void set_parameters(String[] para, Properties props)
+  {
+    super.set_parameters(para, props);
+    registerInterceptors(props, para);
+  }
+  
+  /**
+   * This method is called by RMI-IIOP {@link javax.rmi.Tie#orb(ORB)}, passing
+   * <code>this</code> as parameter. The ORB will try to connect that tie as
+   * one of its objects, if it is not already connected. If the wrapper is an
+   * instance of Servant this method also activates the root poa (if not already
+   * active).
+   */
+  public void set_delegate(java.lang.Object wrapper)
+  {
+    if (wrapper instanceof org.omg.CORBA.Object)
+      {
+        org.omg.CORBA.Object object = (org.omg.CORBA.Object) wrapper;
+        if (connected_objects.getKey(object) == null)
+          connect(object);
+      }
+    else if (wrapper instanceof Servant)
+      {
+        Servant s = (Servant) wrapper;
+        if (rootPOA.findServant(s) == null)
+          try
+            {
+              rootPOA.servant_to_reference(s);
+              if (rootPOA.the_POAManager().get_state().value() == State._HOLDING)
+                rootPOA.the_POAManager().activate();
+            }
+          catch (Exception e)
+            {
+              BAD_OPERATION bad = new BAD_OPERATION("Unable to connect "
+                + wrapper + " to " + this);
+              throw bad;
+            }
+      }
+  }  
+
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,232 @@
+/* ServantDelegateImpl.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.CORBA.Poa;
+
+import gnu.CORBA.Unexpected;
+
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.Object;
+import org.omg.PortableServer.CurrentPackage.NoContext;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.portable.Delegate;
+
+/**
+ * The implementation of the servant delegate for the locally existing
+ * servant.The associated servant that must also implement the
+ * {@link InvokeHandler} interface. Each servant requires a separate
+ * instance of this delegate and can serve a single object only.
+ * Hence the fields are final, but the delegate is typically reused
+ * unless the same servant is connected to different objects.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class ServantDelegateImpl
+  implements Delegate
+{
+  /**
+   * The servant, associated with this object.
+   */
+  final Servant servant;
+
+  /**
+   * The servant (not object) id.
+   */
+  final byte[] servant_id;
+
+  /**
+   * The POA, where the servant is connected.
+   */
+  final gnuPOA poa;
+
+  /**
+   * The object, exposed as an object, served by this servant.
+   */
+  final gnuServantObject object;
+
+  /**
+   * Create the delegat for the servant that will be connected to the
+   * given poa. The method is normally called from inside of gnuPOA.
+   * The constructor sets the newly created delegate as the delegate to this
+   * servant by calling Servant._set_delegate.
+   *
+   * @param a_poa the poa.
+   * @param a_servant the servant.
+   * @param a_servant_id the servant id.
+   */
+  public ServantDelegateImpl(Servant a_servant, gnuPOA a_poa, byte[] a_servant_id)
+  {
+    poa = a_poa;
+    servant = a_servant;
+    servant_id = a_servant_id;
+    servant._set_delegate(this);
+    object =
+      new gnuServantObject(servant, servant_id, (ORB_1_4) servant._orb(), a_poa);
+    object._set_delegate(new LocalDelegate(object, poa, a_servant_id));
+  }
+
+  /**
+   * Check if this object could be named by the given repository id.
+   * @param idl_id the repository id to check.
+   *
+   * @return true if it is one of the possible repository ids of this
+   * object.
+   */
+  public boolean is_a(Servant a_servant, String idl_id)
+  {
+    same(a_servant);
+
+    String[] maybe = object.repository_ids;
+    if (maybe == null)
+      maybe = servant._all_interfaces(poa, object.Id);
+    for (int i = 0; i < maybe.length; i++)
+      {
+        if (maybe [ i ].equals(idl_id))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Return the ORB's default POA.
+   */
+  public POA default_POA(Servant a_servant)
+  {
+    same(a_servant);
+    try
+      {
+        return POAHelper.narrow(orb(a_servant).resolve_initial_references("RootPOA"));
+      }
+    catch (InvalidName ex)
+      {
+        throw new Unexpected(ex);
+      }
+  }
+
+  /**
+   * Get ORB.
+   */
+  public ORB orb(Servant a_servant)
+  {
+    same(a_servant);
+    return poa.orb();
+  }
+
+  /**
+   * Get the object, exposing the servant.
+   */
+  public Object this_object(Servant a_servant)
+  {
+    same(a_servant);
+    try
+      {
+        return poa.aom.get(poa.m_orb.currents.get_object_id()).object;
+      }
+    catch (NoContext ex)
+      {
+        return object;
+      }
+  }
+
+  /**
+   * Not supported.
+   *
+   * @specnote Same as for Sun up till 1.5 inclusive.
+   */
+  public Object get_interface_def(Servant a_servant)
+  {
+    same(a_servant);
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Get the Id of the object being currently served.
+   */
+  public byte[] object_id(Servant a_servant)
+  {
+    same(a_servant);
+    try
+      {
+        byte[] id = poa.m_orb.currents.get_object_id();
+        return id;
+      }
+    catch (NoContext ex)
+      {
+        return object.Id;
+      }
+  }
+
+  /**
+   * Always returns false;
+   */
+  public boolean non_existent(Servant a_servant)
+  {
+    same(a_servant);
+    return false;
+  }
+
+  /**
+   * Return the associated POA.
+   */
+  public POA poa(Servant a_servant)
+  {
+    same(a_servant);
+    try
+      {
+        return poa.m_orb.currents.get_POA();
+      }
+    catch (NoContext ex)
+      {
+        return poa;
+      }
+  }
+
+  /**
+   * Checks if the passed servant is the same as the servant, associated with
+   * this delegate. This class requires a single servant per delegate.
+   */
+  void same(Servant some_servant)
+  {
+    if (servant != some_servant)
+      throw new InternalError("Only one servant per delegate is supported.");
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,128 @@
+/* StandardPolicies.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.CORBA.Poa;
+
+import org.omg.CORBA.Policy;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.IdUniquenessPolicyValue;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.omg.PortableServer.LifespanPolicyValue;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.omg.PortableServer.ThreadPolicyValue;
+
+import java.util.ArrayList;
+
+/**
+ * Contains the frequently uset POA policy sets. The policy
+ * arrays are package private for security reasons, the cloned
+ * copies are returned.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class StandardPolicies
+{
+  /**
+   * The default policy set, as defined in OMG specs. This is also
+   * the policy set for the root POA.
+   */
+  private static final AccessiblePolicy[] rootPOASet =
+    new AccessiblePolicy[]
+    {
+      new gnuThreadPolicy(ThreadPolicyValue.ORB_CTRL_MODEL),
+      new gnuLifespanPolicy(LifespanPolicyValue.TRANSIENT),
+      new gnuIdUniquenessPolicy(IdUniquenessPolicyValue.UNIQUE_ID),
+      new gnuIdAssignmentPolicy(IdAssignmentPolicyValue.SYSTEM_ID),
+      new gnuServantRetentionPolicy(ServantRetentionPolicyValue.RETAIN),
+      new gnuRequestProcessingPolicy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY),
+      new gnuImplicitActivationPolicy(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
+    };
+
+  /**
+   * Return the policy set, applicable for the root POA, as defined
+   * in OMG specs.
+   */
+  public static Policy[] rootPoa()
+  {
+    Policy[] p = new Policy[ rootPOASet.length ];
+    System.arraycopy(rootPOASet, 0, p, 0, p.length);
+    return p;
+  }
+
+  /**
+   * Convert the potentially incomplete policy array into array, containing
+   * the complete policy set.
+   *
+   * @param policies the policy list, may be incomplete (even zero size).
+   *
+   * @return the complete policy array. The missing, but needed policies
+   * are added with they default values.
+   */
+  public static Policy[] withDefault(Policy[] policies)
+  {
+    ArrayList current = new ArrayList(rootPOASet.length);
+    Policy p_default;
+    boolean specified;
+
+    for (int i = 0; i < rootPOASet.length; i++)
+      {
+        p_default = rootPOASet [ i ];
+        specified = false;
+        ForThis:
+        for (int j = 0; j < policies.length; j++)
+          {
+            if (policies [ j ].policy_type() == p_default.policy_type())
+              {
+                specified = true;
+                current.add(policies [ j ]);
+                break ForThis;
+              }
+          }
+        if (!specified)
+          current.add(p_default.copy());
+      }
+
+    Policy[] complete = new Policy[ current.size() ];
+    for (int i = 0; i < complete.length; i++)
+      {
+        complete [ i ] = (Policy) current.get(i);
+      }
+    return complete;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,81 @@
+/* gnuAdapterActivator.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.CORBA.Poa;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.PortableServer.AdapterActivator;
+import org.omg.PortableServer.POA;
+
+/**
+ * Defines a simple adapter activator.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuAdapterActivator
+  extends LocalObject
+  implements AdapterActivator
+{
+  /**
+   * Create a new POA on the parent, using the parent policy set
+   * from the suitable parent of grandparend and with independent
+   * POA manager (passing null to the createPOA).
+   *
+   * @param parent a parent. Either this parent or one of its
+   * grandparents must be gnuAbstractPOA, able to provide a
+   * policy set.
+   *
+   * @param child_name the name of the child being created.
+   *
+   * @return true on success or false if no gnuAbstractPOA
+   * found till the root poa.
+   */
+  public boolean unknown_adapter(POA parent, String child_name)
+  {
+    try
+      {
+        POA n = parent.create_POA(child_name, null, StandardPolicies.rootPoa());
+        n.the_POAManager().activate();
+      }
+    catch (Exception ex)
+      {
+        return false;
+      }
+    return true;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuForwardRequest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuForwardRequest.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuForwardRequest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuForwardRequest.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,90 @@
+/* gnuForwardRequest.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.CORBA.Poa;
+
+import gnu.CORBA.GIOP.ReplyHeader;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.portable.ObjectImpl;
+
+/**
+ * The class, indicating that the request should be forwarded to another
+ * target. We cannot use ForwardRequest because the exception is throws
+ * from methods that does not declare throwing it. Hence must be
+ * RuntimeException.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuForwardRequest
+  extends RuntimeException
+{
+  /**
+   * Use serialVersionUID (v1.4) for interoperability.
+   */
+  private static final long serialVersionUID = -1L;
+
+  /**
+   * The object reference, indicating the new location of the invocation target.
+   */
+  public ObjectImpl forward_reference;
+
+  /**
+   * This information shows if we use LOCATION_FORWARD or
+   * LOCATION_FORWARD_PERM in request. By defalult, LOCATION_FORWARD
+   * is always used. To use LOCATION_FORWARD_PERM, this exception should
+   * be thrown from the servant manager instead of ForwardRequest,
+   * with this field set to  ReplyHeader.LOCATION_FORWARD_PERM.
+   */
+  public byte forwarding_code = ReplyHeader.LOCATION_FORWARD;
+
+  /**
+   * Create the ForwardRequest with explaining message and
+   * initialising the object reference to the given value.
+   *
+   * @param why a string, explaining, why this exception has been thrown.
+   * @param a_forward_reference a value for forward_reference.
+   */
+  public gnuForwardRequest(org.omg.CORBA.Object a_forward_reference)
+  {
+    if (a_forward_reference instanceof ObjectImpl)
+      this.forward_reference = (ObjectImpl) a_forward_reference;
+    else
+      throw new BAD_PARAM("ObjectImpl expected");
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* gnuIdAssignmentPolicy.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.CORBA.Poa;
+
+import gnu.CORBA._PolicyImplBase;
+
+import org.omg.PortableServer.ID_ASSIGNMENT_POLICY_ID;
+import org.omg.PortableServer.IdAssignmentPolicy;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+
+/**
+ * Implementation of the id assignment policy.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuIdAssignmentPolicy
+  extends _PolicyImplBase
+  implements IdAssignmentPolicy, AccessiblePolicy
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Create the policy.
+   *
+   * @param v a value for the policy.
+   */
+  public gnuIdAssignmentPolicy(IdAssignmentPolicyValue v)
+  {
+    super(ID_ASSIGNMENT_POLICY_ID.value, v, v.value(),
+          "IDL:org.omg/PortableServer/IdAssignmentPolicy:1.0"
+         );
+  }
+
+  /**
+   * Get the value for the policy that was passed in a constructor.
+   */
+  public IdAssignmentPolicyValue value()
+  {
+    return (IdAssignmentPolicyValue) getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* gnuIdUniquenessPolicy.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.CORBA.Poa;
+
+import gnu.CORBA._PolicyImplBase;
+
+import org.omg.PortableServer.ID_UNIQUENESS_POLICY_ID;
+import org.omg.PortableServer.IdUniquenessPolicy;
+import org.omg.PortableServer.IdUniquenessPolicyValue;
+
+/**
+ * Implementation of the id uniqueness policy.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuIdUniquenessPolicy
+  extends _PolicyImplBase
+  implements IdUniquenessPolicy, AccessiblePolicy
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Create the policy.
+   *
+   * @param v a value for the policy.
+   */
+  public gnuIdUniquenessPolicy(IdUniquenessPolicyValue v)
+  {
+    super(ID_UNIQUENESS_POLICY_ID.value, v, v.value(),
+          "IDL:org.omg/PortableServer/IdUniquenessPolicy:1.0"
+         );
+  }
+
+  /**
+   * Get the value for the policy that was passed in a constructor.
+   */
+  public IdUniquenessPolicyValue value()
+  {
+    return (IdUniquenessPolicyValue) getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* gnuImplicitActivationPolicy.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.CORBA.Poa;
+
+import gnu.CORBA._PolicyImplBase;
+
+import org.omg.PortableServer.IMPLICIT_ACTIVATION_POLICY_ID;
+import org.omg.PortableServer.ImplicitActivationPolicy;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+
+/**
+ * Implementation of the implicit activation policy.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuImplicitActivationPolicy
+  extends _PolicyImplBase
+  implements ImplicitActivationPolicy, AccessiblePolicy
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Create the policy.
+   *
+   * @param v a value for the policy.
+   */
+  public gnuImplicitActivationPolicy(ImplicitActivationPolicyValue v)
+  {
+    super(IMPLICIT_ACTIVATION_POLICY_ID.value, v, v.value(),
+          "IDL:org.omg/PortableServer/ImplicitActivationPolicy:1.0"
+         );
+  }
+
+  /**
+   * Get the value for the policy that was passed in a constructor.
+   */
+  public ImplicitActivationPolicyValue value()
+  {
+    return (ImplicitActivationPolicyValue) getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* gnuLifespanPolicy.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.CORBA.Poa;
+
+import gnu.CORBA._PolicyImplBase;
+
+import org.omg.PortableServer.LIFESPAN_POLICY_ID;
+import org.omg.PortableServer.LifespanPolicy;
+import org.omg.PortableServer.LifespanPolicyValue;
+
+/**
+ * The implementation of the life span policy.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuLifespanPolicy
+  extends _PolicyImplBase
+  implements LifespanPolicy, AccessiblePolicy
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Create the policy.
+   *
+   * @param v a value for the policy.
+   */
+  public gnuLifespanPolicy(LifespanPolicyValue v)
+  {
+    super(LIFESPAN_POLICY_ID.value, v, v.value(),
+          "IDL:org.omg/PortableServer/LifespanPolicy:1.0"
+         );
+  }
+
+  /**
+   * Get the value for the policy that was passed in a constructor.
+   */
+  public LifespanPolicyValue value()
+  {
+    return (LifespanPolicyValue) getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1816 @@
+/* gnuAbstractPOA.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.CORBA.Poa;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.OBJ_ADAPTER;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.SetOverrideType;
+import org.omg.CORBA.TRANSIENT;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableInterceptor.NON_EXISTENT;
+import org.omg.PortableInterceptor.ObjectReferenceFactory;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper;
+import org.omg.PortableServer.AdapterActivator;
+import org.omg.PortableServer.ForwardRequest;
+import org.omg.PortableServer.IdAssignmentPolicy;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.IdUniquenessPolicy;
+import org.omg.PortableServer.IdUniquenessPolicyValue;
+import org.omg.PortableServer.ImplicitActivationPolicy;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.omg.PortableServer.LifespanPolicy;
+import org.omg.PortableServer.LifespanPolicyValue;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAManager;
+import org.omg.PortableServer.RequestProcessingPolicy;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.SERVANT_RETENTION_POLICY_ID;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.ServantActivator;
+import org.omg.PortableServer.ServantLocator;
+import org.omg.PortableServer.ServantManager;
+import org.omg.PortableServer.ServantRetentionPolicy;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.omg.PortableServer.ThreadPolicy;
+import org.omg.PortableServer.ThreadPolicyValue;
+import org.omg.PortableServer.POAManagerPackage.State;
+import org.omg.PortableServer.POAPackage.AdapterAlreadyExists;
+import org.omg.PortableServer.POAPackage.AdapterNonExistent;
+import org.omg.PortableServer.POAPackage.InvalidPolicy;
+import org.omg.PortableServer.POAPackage.NoServant;
+import org.omg.PortableServer.POAPackage.ObjectAlreadyActive;
+import org.omg.PortableServer.POAPackage.ObjectNotActive;
+import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
+import org.omg.PortableServer.POAPackage.ServantNotActive;
+import org.omg.PortableServer.POAPackage.WrongAdapter;
+import org.omg.PortableServer.POAPackage.WrongPolicy;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
+/**
+ * Our POA implementation.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuPOA
+  extends LocalObject
+  implements POA, ObjectReferenceFactory
+{
+  /**
+   * The object reference template, associated with this POA.
+   * 
+   * @since 1.5
+   */
+  class RefTemplate implements ObjectReferenceTemplate
+  {
+    /** 
+     * Use serialVersionUID for interoperability. 
+     */
+    private static final long serialVersionUID = 1;
+    
+    RefTemplate()
+    {
+      // The adapter name is computed once.
+      ArrayList names = new ArrayList();
+      names.add(the_name());
+
+      POA poa = the_parent();
+      while (poa != null)
+        {
+          names.add(poa.the_name());
+          poa = poa.the_parent();
+        }
+
+      // Fill in the string array in reverse (more natural) order,
+      // root POA first.
+      m_adapter_name = new String[names.size()];
+
+      for (int i = 0; i < m_adapter_name.length; i++)
+        m_adapter_name[i] = (String) names.get(m_adapter_name.length - i - 1);
+    }
+    
+    /**
+     * The adapter name
+     */
+    final String[] m_adapter_name;
+    
+    /**
+     * Get the name of this POA.
+     */
+    public String[] adapter_name()
+    {
+      return (String[]) m_adapter_name.clone();
+    }
+
+    /**
+     * Get the ORB id.
+     */
+    public String orb_id()
+    {
+      return m_orb.orb_id;
+    }
+
+    /**
+     * Get the server id.
+     */
+    public String server_id()
+    {
+      return OrbFunctional.server_id;
+    }
+
+    /**
+     * Create the object.
+     */
+    public Object make_object(String repositoryId, byte[] objectId)
+    {
+      return create_reference_with_id(objectId, repositoryId);
+    }
+
+    /**
+     * Get the array of truncatible repository ids.
+     */
+    public String[] _truncatable_ids()
+    {
+      return ref_template_ids;
+    }
+  }
+  
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * The adapter reference template.
+   */
+  ObjectReferenceTemplate refTemplate;
+  
+  /**
+   * The reference template repository ids. Defined outside the class as it
+   * cannot have static members.
+   */
+  final static String[] ref_template_ids = 
+    new String[] { ObjectReferenceTemplateHelper.id() };
+  
+  /**
+   * The active object map, mapping between object keys, objects and servants.
+   */
+  public final AOM aom = new AOM();
+
+  /**
+   * The children of this POA.
+   */
+  final ArrayList children = new ArrayList();
+
+  /**
+   * The name of this POA.
+   */
+  final String name;
+
+  /**
+   * The parent of this POA (null for the root POA).
+   */
+  final POA parent;
+
+  /**
+   * The ior key signature, indicating, that the ior key is encoded using
+   * internal agreements of this implementation (0x'free').
+   */
+  static final int SIGNATURE = 0x66726565;
+
+  /**
+   * The adapter activator for this POA, null if no activator is set.
+   */
+  AdapterActivator m_activator;
+
+  /**
+   * The POA manager for this POA.
+   */
+  POAManager m_manager;
+
+  /**
+   * The servant manager (servant activator) for this POA.
+   */
+  ServantActivator servant_activator;
+
+  /**
+   * The servant manager (servant locator) for this POA.
+   */
+  ServantLocator servant_locator;
+
+  /**
+   * The default servant, if on is in use.
+   */
+  Servant default_servant;
+
+  /**
+   * The cached poa id value, computed once.
+   */
+  private byte[] m_poa_id;
+
+  /**
+   * The all policy values that apply to this POA.
+   * The used policy values are singletons, unique between policies.
+   */
+  private final HashSet m_policies;
+
+  /**
+   * An array of the set policies.
+   */
+  Policy[] s_policies;
+
+  /**
+   * The ORB, where the POA is connected.
+   */
+  final ORB_1_4 m_orb;
+
+  /**
+   * When true, the POA is being destroyed or is destroyed.
+   */
+  boolean m_inDestruction;
+
+  /**
+   * True if the active object map is used by this POA.
+   * The value is moved into separate boolean value due
+   * necessity of the frequent checks.
+   */
+  public final boolean retain_servant;
+  
+  /**
+   * The object reference factory, used to create the new object
+   * references.
+   */
+  ObjectReferenceFactory m_object_factory = this;
+
+  /**
+   * Create a new abstract POA.
+   *
+   * @param a_parent the parent of this POA.
+   * @param a_name a name for this POA.
+   * @param a_manager a manager for this POA. If null, a new
+   * {@link gnuPOAManager} will be instantiated.
+   * @param a_policies an array of policies that apply to this POA.
+   * @param an_orb an ORB for this POA.
+   */
+  public gnuPOA(gnuPOA a_parent, String a_name, POAManager a_manager,
+                Policy[] a_policies, ORB_1_4 an_orb
+               )
+         throws InvalidPolicy
+  {
+    // Add default policies.
+    Policy[] all_policies = StandardPolicies.withDefault(a_policies);
+
+    name = a_name;
+    parent = a_parent;
+    m_orb = an_orb;
+
+    if (a_manager != null)
+      m_manager = a_manager;
+    else
+      m_manager = new gnuPOAManager();
+
+    if (m_manager instanceof gnuPOAManager)
+      {
+        gnuPOAManager g = (gnuPOAManager) m_manager;
+        g.addPoa(this);
+      }
+
+    m_policies = new HashSet(all_policies.length);
+
+    s_policies = new Policy[ all_policies.length ];
+    for (int i = 0; i < s_policies.length; i++)
+      {
+        s_policies [ i ] = all_policies [ i ].copy();
+        m_policies.add(((AccessiblePolicy) s_policies [ i ]).getValue());
+      }
+
+    retain_servant = applies(ServantRetentionPolicyValue.RETAIN);
+
+    validatePolicies(a_policies);
+    
+    refTemplate = new RefTemplate();
+  }
+
+  /**
+   * Wait while at least one of the threads in this POA is actively
+   * processing one of requests.
+   */
+  public void waitWhileRunning()
+  {
+    // First pause.
+    long time = 1;
+
+    // Maximal duration between checks.
+    long max = 500;
+
+    boolean runs;
+
+    do
+      {
+        runs = m_orb.currents.has(this);
+
+        if (runs)
+          {
+            // Avoid taking CPU resources
+            // from the thread that is running.
+            try
+              {
+                Thread.sleep(time);
+                time = time * 2;
+                if (time > max)
+                  time = max;
+              }
+            catch (InterruptedException ex)
+              {
+              }
+          }
+      }
+    while (runs);
+  }
+
+  /**
+   * Etherealize all objects, associated with this POA. Invoked from the
+   * {@link gnuPOAManager} only if it is known that the servant_activator
+   * holds non-null value.
+   */
+  protected void etherealizeAll()
+  {
+    if (servant_activator == null)
+      return;
+
+    ArrayList keys = new ArrayList();
+    keys.addAll(aom.keySet());
+
+    byte[] key;
+    AOM.Obj obj;
+    boolean last;
+    for (int i = 0; i < keys.size(); i++)
+      {
+        key = (byte[]) keys.get(i);
+        obj = aom.get(key);
+
+        if (obj.poa == this)
+          {
+            aom.remove(key);
+
+            if (!obj.isDeactiveted())
+              {
+                // Check if the servant still stays under the other key.
+                last = aom.findServant(obj.servant) == null;
+                servant_activator.etherealize(obj.key, this, obj.servant, true,
+                                              last
+                                             );
+              }
+          }
+      }
+  }
+
+  /**
+   * Create an instance of the POA with the given features.
+   * This method is not responsible for duplicate checking
+   * or adding the returned instance to any possible table.
+   *
+   * @param child_name the name of the poa being created.
+   * @param manager the poa manager (never null).
+   * @param policies the array of policies.
+   * @param an_orb the ORB for this POA.
+   *
+   * @return the created POA.
+   *
+   * @throws InvalidPolicy for conflicting or otherwise invalid policies.|
+   */
+  protected POA createPoaInstance(String child_name, POAManager a_manager,
+                                  Policy[] policies, ORB_1_4 an_orb
+                                 )
+                           throws InvalidPolicy
+  {
+    POAManager some_manager =
+      a_manager == null ? new gnuPOAManager() : a_manager;
+
+    if (some_manager instanceof gnuPOAManager)
+      {
+        ((gnuPOAManager) some_manager).addPoa(this);
+      }
+
+    return new gnuPOA(this, child_name, some_manager, policies, an_orb);
+  }
+
+  /**
+   * Check if the given policy value applies to this POA.
+   *
+   * @param policy_value a policy value to check. The policy values are
+   * singletons and unique between the different policies, so the policy
+   * type is not passed.
+   *
+   * @return true if the policy value applies, false otherwise.
+   */
+  public final boolean applies(java.lang.Object policy_value)
+  {
+    return m_policies.contains(policy_value);
+  }
+
+  /**
+   * Check for the presence of the required policy.
+   *
+   * @param policy_value a policy value to check.
+   *
+   * @throws WrongPolicy if the required policy value is not applicable.
+   */
+  public final void required(java.lang.Object policy_value)
+                      throws WrongPolicy
+  {
+    if (!applies(policy_value))
+      throw new WrongPolicy(policy_value + " policy required.");
+  }
+
+  /**
+   * Check for the absence of the given policy.
+   *
+   * @param policy_value a policy value to check.
+   *
+   * @throws WrongPolicy if the passed policy value is applicable.
+   */
+  public final void excluding(java.lang.Object policy_value)
+                       throws WrongPolicy
+  {
+    if (applies(policy_value))
+      throw new WrongPolicy(policy_value + " policy applies.");
+  }
+
+  /**
+  * Find and optionally activate the child POA with the given name.
+  *
+  * @param poa_name the name of the POA to find.
+  * @param activate_it if the child with the specified name is not found
+  * or inactive and this parameter is true, the target POA activator is
+  * invoked to activate that child. If this succeeds, that child POA
+  * is returned.
+  *
+  * @throws AdapterNonExistent if no active child with the given name
+  * is found and one of the following is true:
+  * a) the target POA has no associated
+  * {@link AdapterActivator}. b) that activator fails to activate the
+  * child POA. c) <code>activate_id</code> = false.
+  */
+  public POA find_POA(String poa_name, boolean activate_it)
+               throws AdapterNonExistent
+  {
+    POA child;
+    for (int i = 0; i < children.size(); i++)
+      {
+        child = (POA) children.get(i);
+        if (child.the_name().equals(poa_name))
+          return child;
+      }
+
+    if (activate_it && m_activator != null)
+      {
+        boolean activated = m_activator.unknown_adapter(this, poa_name);
+        if (!activated)
+          throw new AdapterNonExistent(poa_name + " activation failed.");
+
+        // Tha activator should add the child to the childrent table.
+        for (int i = 0; i < children.size(); i++)
+          {
+            child = (POA) children.get(i);
+            if (child.the_name().equals(poa_name))
+              return child;
+          }
+        throw new AdapterNonExistent(poa_name + " not created. ");
+      }
+    else
+      throw new AdapterNonExistent(poa_name);
+  }
+
+  /**
+   * Generate the Object Id for the given servant and add the servant to the
+   * Active Object Map using this Id a a key. If the servant activator is set,
+   * its incarnate method will be called.
+   * 
+   * @param a_servant a servant that would serve the object with the returned
+   * Object Id. If null is passed, under apporoprate policies the servant
+   * activator is invoked.
+   * 
+   * @return the generated objert Id for the given servant.
+   * 
+   * @throws ServantAlreadyActive if this servant is already in the Active
+   * Object Map and the UNIQUE_ID policy applies.
+   * 
+   * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN do not
+   * apply to this POA.
+   */
+  public byte[] activate_object(Servant a_servant)
+    throws ServantAlreadyActive, WrongPolicy
+  {
+    checkDiscarding();
+    required(ServantRetentionPolicyValue.RETAIN);
+    required(IdAssignmentPolicyValue.SYSTEM_ID);
+
+    AOM.Obj exists = aom.findServant(a_servant);
+
+    if (exists != null)
+      {
+        if (exists.isDeactiveted())
+          {
+            // If exists but deactivated, activate and return
+            // the existing key.
+            exists.setDeactivated(false);
+            incarnate(exists, exists.key, a_servant, false);
+            return exists.key;
+          }
+        else if (applies(IdUniquenessPolicyValue.UNIQUE_ID))
+          throw new ServantAlreadyActive();
+
+        // It multiple ids are allowed, exit block allowing repetetive
+        // activations.
+      }
+
+    byte[] object_key = AOM.getFreeId();
+    ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this,
+      object_key);
+    create_and_connect(object_key,
+      a_servant._all_interfaces(this, object_key)[0], delegate);
+    return object_key;
+  }
+
+  /**
+   * Add the given servant to the Active Object Map as a servant for the object
+   * with the provided Object Id. If the servant activator is set, its incarnate
+   * method will be called.
+   * 
+   * @param an_Object_Id an object id for the given object.
+   * @param a_servant a servant that will serve the object with the given Object
+   * Id. If null is passed, under apporoprate policies the servant activator is
+   * invoked.
+   * 
+   * @throws ObjectAlreadyActive if the given object id is already in the Active
+   * Object Map.
+   * @throws ServantAlreadyActive if the UNIQUE_ID policy applies and this
+   * servant is already in use.
+   * @throws WrongPolicy if the required RETAIN policy does not apply to this
+   * POA.
+   * @throws BAD_PARAM if the passed object id is invalid due any reason.
+   */
+  public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant)
+                               throws ServantAlreadyActive, ObjectAlreadyActive,
+                                      WrongPolicy
+  {
+    activate_object_with_id(an_Object_Id, a_servant, false);
+  }
+
+  /**
+   * Same as activate_object_with_id, but permits gnuForwardRequest forwarding
+   * exception. This is used when the activation is called from the remote
+   * invocation context and we have possibility to return the forwarding
+   * message.
+   */
+  public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant,
+    boolean use_forwarding)
+    throws ServantAlreadyActive, ObjectAlreadyActive, WrongPolicy
+  {
+    checkDiscarding();
+    required(ServantRetentionPolicyValue.RETAIN);
+
+    // If the UNIQUE_ID applies, the servant being passed must not be
+    // already active.
+    if (applies(IdUniquenessPolicyValue.UNIQUE_ID))
+      {
+        AOM.Obj sx = aom.findServant(a_servant, false);
+        if (sx != null)
+          throw new ServantAlreadyActive();
+      }
+
+    AOM.Obj exists = aom.get(an_Object_Id);
+    if (exists != null)
+      {
+        if (exists.servant == null)
+          {
+            locateServant(an_Object_Id, a_servant, exists, use_forwarding);
+            exists.setDeactivated(false);
+          }
+        else if (exists.isDeactiveted())
+          {
+            exists.setDeactivated(false);
+            incarnate(exists, an_Object_Id, a_servant, use_forwarding);
+          }
+        else
+          throw new ObjectAlreadyActive();
+      }
+    else
+      {
+        ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this,
+          an_Object_Id);
+        create_and_connect(an_Object_Id, a_servant._all_interfaces(this,
+          an_Object_Id)[0], delegate);
+      }
+  }
+
+  /**
+   * Locate the servant for this object Id and connect it to ORB.
+   * 
+   * @param an_Object_Id the object id.
+   * @param a_servant the servant (may be null).
+   * @param exists an existing active object map entry.
+   * @param use_forwarding allow to throw the gnuForwardRequest if the activator
+   * throws ForwardRequest.
+   * 
+   * @throws OBJ_ADAPTER minor 4 if the servant cannot be located (the required
+   * servant manager may be missing).
+   */
+  private void locateServant(byte[] an_Object_Id, Servant a_servant,
+                             AOM.Obj exists, boolean use_forwarding
+                            )
+                      throws InternalError
+  {
+    // An object was created with create_reference.
+    gnuServantObject object = (gnuServantObject) exists.object;
+    if (servant_activator != null)
+      {
+        exists.setServant(incarnate(exists, an_Object_Id, a_servant,
+                                    use_forwarding
+                                   )
+                         );
+      }
+    else if (default_servant != null)
+      {
+        exists.setServant(default_servant);
+      }
+    if (exists.servant == null)
+      {
+        exists.setServant(a_servant);
+      }
+    if (exists.servant == null)
+      {
+        throw new OBJ_ADAPTER("no servant", 4, CompletionStatus.COMPLETED_NO);
+      }
+
+    ServantDelegateImpl delegate =
+      new ServantDelegateImpl(exists.servant, this, an_Object_Id);
+    exists.servant._set_delegate(delegate);
+    object.setServant(exists.servant);
+    connect_to_orb(an_Object_Id, delegate.object);
+  }
+
+  /**
+   * Deactivate object with the given id.
+   *
+   * The deactivated object will continue to process requests that arrived
+   * before decativation. If this POA has the associated
+   * servant manager, a {@link ServantActivatorOperations#etherealize} is
+   * immediately invoked on the passed id.
+   *
+   * @throws WrongPolicy if the required RETAIN policy does not apply to
+   * this POA.
+   */
+  public void deactivate_object(byte[] the_Object_Id)
+                         throws ObjectNotActive, WrongPolicy
+  {
+    required(ServantRetentionPolicyValue.RETAIN);
+
+    AOM.Obj exists = aom.get(the_Object_Id);
+
+    if (exists == null || exists.isDeactiveted())
+      throw new ObjectNotActive();
+
+    exists.setDeactivated(true);
+
+    // Check if this servant is serving something else.
+    aom.remove(the_Object_Id);
+
+    AOM.Obj other = aom.findServant(exists.servant, false);
+
+    boolean remaining = other != null;
+
+    aom.put(exists);
+
+    if (servant_activator != null)
+      servant_activator.etherealize(the_Object_Id, this, exists.servant, false,
+                                    remaining
+                                   );
+  }
+
+  /**
+  * Create the object reference, encapsulating the given repository Id and
+  * the Object Id, generated by this POA. The returned object will not be
+  * activated by default and may be activated on the first invocation by
+  * the servant manager (if it is set and if policies are applicable).
+  *
+  * @param a_repository_id the repository id for the given object, can
+  * be null if to be requested from the servant later.
+  *
+  * @throws WrongPolicy if the required SYSTEM_ID policy does not apply to
+  * this POA.
+  */
+  public org.omg.CORBA.Object create_reference(String a_repository_id)
+                                        throws WrongPolicy
+  {
+    required(IdAssignmentPolicyValue.SYSTEM_ID);
+    return create_reference_with_id(AOM.getFreeId(), a_repository_id);
+  }
+
+  /**
+   * <p>
+   * Create the object reference, encapsulating the given repository Id and
+   * the given Object Id. The returned object will <i>not</i> be
+   * activated by default and may be activated on the first invocation by
+   * the servant manager (if the IMPLICIT_ACTIVATION policy applies).
+   *
+   * @param an_object_id the object id for the object being created. If this
+   * POA uses the SYSTEM_ID policy, the portable application should only
+   * pass the ids, generated by this POA.
+   *
+   * @param a_repository_id the repository id for the object being created,
+   * can be null if this information should be later requested from the
+   * servant.
+   */
+  public org.omg.CORBA.Object create_reference_with_id(byte[] an_object_id,
+    String a_repository_id
+   )
+  {
+    String[] ids;
+    if (a_repository_id == null)
+      ids = null;
+    else
+      ids = new String[] { a_repository_id };
+
+    // Check maybe such object is already activated.
+    AOM.Obj e = aom.get(an_object_id);
+
+    Servant servant;
+    if (e == null)
+      {
+        servant = null;
+      }
+    else
+      {
+        servant = e.servant;
+        e.setDeactivated(false);
+      }
+
+    gnuServantObject object =
+      new gnuServantObject(ids, an_object_id, this, m_orb);
+    object._set_delegate(new LocalDelegate(object, this, an_object_id));
+    aom.add(object.Id, object, servant, this);
+    connect_to_orb(an_object_id, object);
+
+    return object;
+  }
+
+  /**
+   * Creates a new POA as a child of the target POA.
+   *
+   * @param child_name the name of the child POA being created.
+   * @param manager the manager that will control the new POA. If this parameter
+   * is null, a new POA manager is created and associated with the new POA.
+   *
+   * @param policies the policies, applicable for the parent POA. Policies
+   * are <i>not</i> inherited from the parent POA.
+   *
+   * @return an newly created POA. The POA will be intially in the holding
+   * state and must be activated to start processing requests.
+   *
+   * @throws AdapterAlreadyExists if the child with the given child_name
+   * already exists for the current POA.
+   * @throws InvalidPolicy if the policies conflict with each other or are
+   * otherwise inappropriate.
+   *
+   * @see #the_children()
+   */
+  public POA create_POA(String child_name, POAManager manager, Policy[] policies)
+                 throws AdapterAlreadyExists, InvalidPolicy
+  {
+    POA child;
+    for (int i = 0; i < children.size(); i++)
+      {
+        child = (POA) children.get(i);
+        if (child.the_name().equals(child_name))
+          throw new AdapterAlreadyExists(name + "/" + child_name);
+      }
+
+    POA poa = createPoaInstance(child_name, manager, policies, m_orb);
+    children.add(poa);
+    return poa;
+  }
+
+  /**
+   * Returns a default servant for this POA.
+   *
+   * @return a servant that will be used for requests for
+   * which no servant is found in the Active Object Map.
+   *
+   * @throws NoServant if there is no default servant associated with this POA.
+   * @throws WrongPolicy if the USE_DEFAULT_SERVANT policy is not active.
+   */
+  public Servant get_servant()
+                      throws NoServant, WrongPolicy
+  {
+    required(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT);
+    if (default_servant == null)
+      throw new NoServant();
+    return default_servant;
+  }
+
+  /**
+   * Sets the default servant for this POA.
+   *
+   * @param a_servant a servant that will be used for requests for
+   * which no servant is found in the Active Object Map.
+   *
+   * @throws WrongPolicy if the USE_DEFAULT_SERVANT policy is not active.
+   */
+  public void set_servant(Servant a_servant)
+                   throws WrongPolicy
+  {
+    required(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT);
+    default_servant = a_servant;
+  }
+
+  /**
+   * Set a servant manager for this POA.
+   *
+   * @param a servant manager being set. If the RETAIN policy applies, the
+   * manager must implement a {@link ServantActivator}. If the NON_RETAIN
+   * policy applies, the manager must implement a {@link ServantLocator}.
+   *
+   * @throws WrongPolicy if the required USE_SERVANT_MANAGER policy does not
+   * apply to this POA.
+   *
+   * @throws OBJ_ADAPTER minor code 4 if the passed manager does not
+   * implement the required interface ({@link ServantActivator},
+   * {@link ServantLocator}). The POA, that has the RETAIN policy uses
+   * servant managers that are ServantActivators. When the POA has the
+   * NON_RETAIN policy it uses servant managers that are ServantLoacators.
+   *
+   * @throws BAD_INV_ORDER minor code 6 if the method is called more than once
+   * on the same POA. The manager can be set only once.
+   */
+  public void set_servant_manager(ServantManager a_manager)
+                           throws WrongPolicy
+  {
+    required(RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
+    if (servant_activator != null || servant_locator != null)
+      throw new BAD_INV_ORDER("Setting manager twice for " + name, 6,
+                              CompletionStatus.COMPLETED_NO
+                             );
+
+    if (applies(ServantRetentionPolicyValue.RETAIN))
+      {
+        if (a_manager instanceof ServantActivator)
+          servant_activator = (ServantActivator) a_manager;
+        else
+          throw new OBJ_ADAPTER("RETAIN requires ServantActivator", 4,
+                                CompletionStatus.COMPLETED_NO
+                               );
+      }
+    else if (applies(ServantRetentionPolicyValue.NON_RETAIN))
+      {
+        if (a_manager instanceof ServantLocator)
+          servant_locator = (ServantLocator) a_manager;
+        else
+          throw new OBJ_ADAPTER("NON_RETAIN requires ServantLocator", 4,
+                                CompletionStatus.COMPLETED_NO
+                               );
+      }
+    else
+      throw new WrongPolicy("No servant retention policy is specified.");
+  }
+
+  /**
+   * Get the servant manager, associated with this POA.
+   *
+   * @return the associated servant manager or null if it has
+   * been previously set.
+   *
+   * @throws WrongPolicy if the required USE_SERVANT_MANAGER policy does not
+   * apply to this POA.
+   */
+  public ServantManager get_servant_manager()
+                                     throws WrongPolicy
+  {
+    required(RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
+
+    if (servant_activator != null)
+      return servant_activator;
+    else
+      return servant_locator;
+  }
+
+  /**
+   * Get the unique Id of the POA in the process in which it is created.
+   * This Id is needed by portable interceptors. The id is unique
+   * for the life span of the POA in the process. For persistent
+   * POAs, if a POA is created in the same path with the same name as
+   * another POA, these POAs are identical have the same id. All transient
+   * POAs are assumed unique.
+   */
+  public byte[] id()
+  {
+    if (m_poa_id != null)
+      return m_poa_id;
+    else
+      {
+        BufferedCdrOutput buffer = new BufferedCdrOutput();
+        POA p = this;
+        while (p != null)
+          {
+            buffer.write_string(p.the_name());
+            p = p.the_parent();
+          }
+        m_poa_id = buffer.buffer.toByteArray();
+        return m_poa_id;
+      }
+  }
+
+  /**
+   * Returns the reference to the active object with the given Id.
+   *
+   * @param the_Object_Id the object id.
+   *
+   * @throws ObjectNotActive if there is no active object with such Id
+   * in the scope of this POA.
+   * @throws WrongPolicy if the required RETAIN policy does not apply to
+   * this POA.
+   */
+  public org.omg.CORBA.Object id_to_reference(byte[] the_Object_Id)
+                                       throws ObjectNotActive, WrongPolicy
+  {
+    required(ServantRetentionPolicyValue.RETAIN);
+
+    AOM.Obj ref = aom.get(the_Object_Id);
+    if (ref == null)
+      throw new ObjectNotActive();
+    else
+      return ref.object;
+  }
+
+  /**
+   * Returns the servant that serves the active object with the given Id.
+   *
+   * @param the_Object_Id the object id.
+   *
+   * @throws ObjectNotActive if there is no active object with such Id or
+   * it is not currently active.
+   * @throws WrongPolicy. This method requires either RETAIN or
+   * USE_DEFAULT_SERVANT policies and reaises the WrongPolicy if none of them
+   * apply to this POA.
+   */
+  public Servant id_to_servant(byte[] the_Object_Id)
+                        throws ObjectNotActive, WrongPolicy
+  {
+    if (applies(ServantRetentionPolicyValue.RETAIN))
+      {
+        AOM.Obj ref = aom.get(the_Object_Id);
+        if (ref == null || ref.isDeactiveted())
+          {
+            if (default_servant != null)
+              return default_servant;
+            else
+              throw new ObjectNotActive();
+          }
+        else if (ref.servant != null)
+          return ref.servant;
+        else if (default_servant != null)
+          return default_servant;
+        else
+          throw new ObjectNotActive();
+      }
+    else if (default_servant != null)
+      {
+        return default_servant;
+      }
+    else
+      throw new WrongPolicy("Either RETAIN or USE_DEFAULT_SERVANT required.");
+  }
+
+  /**
+   * Returns the Object Id, encapsulated in the given object reference.
+   *
+   * @param the_Object the object that has been previously created with this
+   * POA. It need not be active.
+   *
+   * @throws WrongAdapter if the passed object is not known for this POA.
+   * @throws WrongPolicy never (declared for the future extensions only).
+   */
+  public byte[] reference_to_id(org.omg.CORBA.Object the_Object)
+                         throws WrongAdapter, WrongPolicy
+  {
+    AOM.Obj ref = aom.findObject(the_Object);
+    if (ref == null)
+      throw new WrongAdapter();
+    return ref.key;
+  }
+
+  /**
+   * Returns the servant that is serving this object.
+   * 
+   * @return if the RETAIN policy applies and the object is in the Active Object
+   * Map, the method returns the servant, associated with this object.
+   * Otherwise, if the USE_DEFAULT_SERVANT policy applies, the method returns
+   * the default servant (if one was set).
+   * 
+   * @throws ObjectNotActive if none of the conditions above are satisfied.
+   * @throws WrongAdapter if the object reference was not created with this POA.
+   * @throws WrongPolicy. This method requires either RETAIN or
+   * USE_DEFAULT_SERVANT policies and reaises the WrongPolicy if none of them
+   * apply to this POA.
+   */
+  public Servant reference_to_servant(org.omg.CORBA.Object the_Object)
+    throws ObjectNotActive, WrongPolicy, WrongAdapter
+  {
+    if (applies(ServantRetentionPolicyValue.RETAIN))
+      {
+        AOM.Obj ref = aom.findObject(the_Object);
+        if (ref == null)
+          {
+            String object;
+            if (the_Object == null)
+              object = "null passed"; 
+            else if (the_Object instanceof gnuServantObject)
+              {
+                gnuServantObject gs = (gnuServantObject) the_Object;
+                object = "Wrong owner POA " + gs.poa.the_name();
+              }
+            else
+              object = "Unknown " + the_Object.getClass().getName();
+
+            throw new WrongAdapter(object + " for '" + the_name() + "'");
+          }
+        else if (ref.isDeactiveted() || ref.servant == null)
+          {
+            if (default_servant != null)
+              return default_servant;
+            else
+              throw new ObjectNotActive();
+          }
+        else
+          return ref.servant;
+      }
+    else if (default_servant != null)
+      {
+        return default_servant;
+      }
+    else
+      throw new WrongPolicy("Either RETAIN or USE_DEFAULT_SERVANT required.");
+  }
+
+  /**
+   * Returns the id of the object, served by the given servant (assuming that
+   * the servant serves only one object). The id is found in one of the
+   * following ways.
+   * <ul>
+   * <li>If the POA has both the RETAIN and the UNIQUE_ID policy and the
+   * specified servant is active, the method return the Object Id associated
+   * with that servant. </li>
+   * <li> If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and
+   * either the POA has the MULTIPLE_ID policy or the specified servant is
+   * inactive, the method activates the servant using a POA-generated Object Id
+   * and the Interface Id associated with the servant, and returns that Object
+   * Id. </li>
+   * <li>If the POA has the USE_DEFAULT_SERVANT policy, the servant specified
+   * is the default servant, and the method is being invoked in the context of
+   * executing a request on the default servant, the method returns the ObjectId
+   * associated with the current invocation. </li>
+   * </ul>
+   * 
+   * @throws ServantNotActive in all cases, not listed in the list above.
+   * @throws WrongPolicy The method requres USE_DEFAULT_SERVANT policy or a
+   * combination of the RETAIN policy and either the UNIQUE_ID or
+   * IMPLICIT_ACTIVATION policies and throws the WrongPolicy if these conditions
+   * are not satisfied.
+   */
+  public byte[] servant_to_id(Servant the_Servant)
+                       throws ServantNotActive, WrongPolicy
+  {
+    if (applies(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) ||
+        applies(ServantRetentionPolicyValue.RETAIN) &&
+        (
+          applies(IdUniquenessPolicyValue.UNIQUE_ID) ||
+          applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
+        )
+       )
+      {
+        AOM.Obj ref = null;
+        if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
+          ref = aom.findServant(the_Servant);
+        if (ref == null &&
+            applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
+           )
+          {
+            // Try to activate.
+            try
+              {
+                return activate_object(the_Servant);
+              }
+            catch (ServantAlreadyActive ex)
+              {
+                // Either it shuld not be or the policy allows multiple ids.
+                throw new InternalError();
+              }
+          }
+        if (ref == null)
+          throw new ServantNotActive();
+        else
+          return ref.key;
+      }
+    else
+      throw new WrongPolicy("(RETAIN and UNIQUE ID) " +
+                            "or USE_DEFAULT_SERVANT required."
+                           );
+  }
+
+  /**
+   * <p>
+   * Converts the given servant to the object reference. The servant will serve
+   * all methods, invoked on the returned object. The returned object reference
+   * can be passed to the remote client, enabling remote invocations.
+   * </p>
+   * <p>
+   * If the specified servant is active, it is returned. Otherwise, if the POA
+   * has the IMPLICIT_ACTIVATION policy the method activates the servant. In
+   * this case, if the servant activator is set, the
+   * {@link ServantActivatorOperations#incarnate} method will be called.
+   * </p>
+   * 
+   * @throws ServantNotActive if the servant is inactive and no
+   * IMPLICIT_ACTIVATION policy applies.
+   * @throws WrongPolicy This method needs the RETAIN policy and either the
+   * UNIQUE_ID or IMPLICIT_ACTIVATION policies.
+   * 
+   * @return the object, exposing the given servant in the context of this POA.
+   */
+  public org.omg.CORBA.Object servant_to_reference(Servant the_Servant)
+    throws ServantNotActive, WrongPolicy
+  {
+    required(ServantRetentionPolicyValue.RETAIN);
+
+    AOM.Obj exists = null;
+
+    if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
+      exists = aom.findServant(the_Servant);
+
+    if (exists != null)
+      {
+        if (exists.isDeactiveted())
+          {
+            if (applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
+              {
+                checkDiscarding();
+                exists.setDeactivated(false);
+                incarnate(exists, exists.key, the_Servant, false);
+              }
+            else
+              throw new ServantNotActive();
+          }
+        else
+          return exists.object;
+      }
+    if (exists == null
+      && applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
+      {
+        checkDiscarding();
+
+        byte[] object_key = AOM.getFreeId();
+
+        ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant,
+          this, object_key);
+        create_and_connect(object_key, the_Servant._all_interfaces(this,
+          object_key)[0], delegate);
+
+        return delegate.object;
+      }
+    else
+      throw new ServantNotActive();
+  }
+
+  /**
+   * Incarnate in cases when request forwarding is not expected because the
+   * servant must be provided by the servant activator.
+   * 
+   * @param x the aom entry, where the object is replaced by value, returned by
+   * servant activator (if not null).
+   * 
+   * @param key the object key.
+   * 
+   * @param a_servant the servant that was passed as a parameter in the
+   * activation method.
+   * 
+   * @param use_forwarding if true, the gnuForwardRequest is throw under the
+   * forwarding exception (for remote client). Otherwise, the request is
+   * internally redirected (for local invocation).
+   */
+  private Servant incarnate(AOM.Obj x, byte[] object_key,
+                            Servant a_servant, boolean use_forwarding
+                           )
+  {
+    if (servant_activator != null)
+      {
+        Servant servant;
+        try
+          {
+            servant = servant_activator.incarnate(object_key, this);
+          }
+        catch (ForwardRequest ex)
+          {
+            if (use_forwarding)
+              throw new gnuForwardRequest(ex.forward_reference);
+            else
+              servant =
+                ForwardedServant.create((ObjectImpl) ex.forward_reference);
+          }
+        if (servant != null && x != null)
+          x.setServant(servant);
+        if (servant == null && x != null)
+          servant = x.servant;
+        return servant;
+      }
+    else if (a_servant != null)
+      {
+        x.setServant(a_servant);
+        return a_servant;
+      }
+    else if (x.servant != null)
+      {
+        return x.servant;
+      }
+    else if (default_servant != null)
+      {
+        x.setServant(default_servant);
+        return x.servant;
+      }
+    else
+      throw new BAD_INV_ORDER("No servant given and the servant activator not set");
+  }
+
+  /**
+   * Return the POA manager, associated with this POA.
+   *
+   * @return the associated POA manager (always available).
+   */
+  public POAManager the_POAManager()
+  {
+    return m_manager;
+  }
+
+  /**
+   * Returns the adapter activator, associated with this POA.
+   * The newly created POA has no activator (null would be
+   * returned). The ORB root POA also initially has no activator.
+   *
+   * @return tha adapter activator or null if this POA has no
+   * associated adapter activator.
+   */
+  public AdapterActivator the_activator()
+  {
+    return m_activator;
+  }
+
+  /**
+  * Set the adapter activator for this POA.
+  *
+  * @param the activator being set.
+  */
+  public void the_activator(AdapterActivator an_activator)
+  {
+    m_activator = an_activator;
+  }
+
+  /**
+  * The children of this POA.
+  *
+  * @return the array of all childs for this POA.
+  */
+  public POA[] the_children()
+  {
+    POA[] poas = new POA[ children.size() ];
+    for (int i = 0; i < poas.length; i++)
+      {
+        poas [ i ] = (POA) children.get(i);
+      }
+    return poas;
+  }
+
+  /**
+   * Return the name of this POA.
+   *
+   * @return the name of POA, relative to its parent.
+   */
+  public String the_name()
+  {
+    return name;
+  }
+  ;
+
+  /**
+   * Return the parent of this POA.
+   *
+   * @return the parent POA or <code>null</code> if this is a root POA.
+   */
+  public POA the_parent()
+  {
+    return parent;
+  }
+
+  /** {@inheritDoc} */
+  public IdAssignmentPolicy create_id_assignment_policy(IdAssignmentPolicyValue a_value)
+  {
+    return new gnuIdAssignmentPolicy(a_value);
+  }
+
+  /** {@inheritDoc} */
+  public IdUniquenessPolicy create_id_uniqueness_policy(IdUniquenessPolicyValue a_value)
+  {
+    return new gnuIdUniquenessPolicy(a_value);
+  }
+
+  /** {@inheritDoc} */
+  public ImplicitActivationPolicy create_implicit_activation_policy(ImplicitActivationPolicyValue a_value)
+  {
+    return new gnuImplicitActivationPolicy(a_value);
+  }
+
+  /** {@inheritDoc} */
+  public LifespanPolicy create_lifespan_policy(LifespanPolicyValue a_value)
+  {
+    return new gnuLifespanPolicy(a_value);
+  }
+
+  /** {@inheritDoc} */
+  public RequestProcessingPolicy create_request_processing_policy(RequestProcessingPolicyValue a_value)
+  {
+    return new gnuRequestProcessingPolicy(a_value);
+  }
+
+  /** {@inheritDoc} */
+  public ServantRetentionPolicy create_servant_retention_policy(ServantRetentionPolicyValue a_value)
+  {
+    return new gnuServantRetentionPolicy(a_value);
+  }
+
+  /** {@inheritDoc} */
+  public ThreadPolicy create_thread_policy(ThreadPolicyValue a_value)
+  {
+    return new gnuThreadPolicy(a_value);
+  }
+
+  /**
+   * <p>
+   * Destroy this POA and all descendant POAs. The destroyed POAs can be later
+   * re-created via {@link AdapterActivator} or by invoking {@link #create_POA}.
+   * This differs from {@link PoaManagerOperations#deactivate} that does not
+   * allow recreation of the deactivated POAs. After deactivation, recreation is
+   * only possible if the POAs were later destroyed.
+   * </p>
+   * <p>
+   * The remote invocation on the target, belonging to the POA that is currently
+   * destroyed return the remote exception ({@link TRANSIENT}, minor code 4).
+   * </p>
+   * 
+   * @param etherealize_objects if true, and POA has RETAIN policy, and the
+   * servant manager is available, the servant manager method
+   * {@link ServantActivatorOperations#etherealize} is called for each <i>active</i>
+   * object in the Active Object Map. This method should not try to access POA
+   * being destroyed. If <code>destroy</code> is called multiple times before
+   * the destruction completes, the etherialization should be invoked only once.
+   * 
+   * @param wait_for_completion if true, the method waits till the POA being
+   * destroyed completes all current requests and etherialization. If false, the
+   * method returns immediately.
+   */
+  public void destroy(boolean etherealize_objects, boolean wait_for_completion)
+  {
+    // Notify the IOR interceptors about that the POA is destroyed.
+    if (m_orb.iIor != null)
+      m_orb.iIor.adapter_state_changed(
+        new ObjectReferenceTemplate[] { getReferenceTemplate() },
+        NON_EXISTENT.value);
+
+    if (wait_for_completion)
+      waitWhileRunning();
+
+    // Nofify the IOR interceptors that the POA is destroyed.
+    if (m_manager instanceof gnuPOAManager)
+      {
+        ((gnuPOAManager) m_manager).poaDestroyed(this);
+      }
+
+    // Put the brake instead of manager, preventing the subsequent
+    // requests.
+    gnuPOAManager g = new gnuPOAManager();
+    g.state = State.INACTIVE;
+    m_manager = g;
+
+    // Disconnect from parent.
+    if (parent instanceof gnuPOA)
+      {
+        ((gnuPOA) parent).children.remove(this);
+      }
+
+    unregisterFromManager();
+
+    // Disconnect from the ORB all objects, registered with this POA.
+    ArrayList keys = new ArrayList();
+    keys.addAll(aom.keySet());
+
+    byte[] key;
+    AOM.Obj obj;
+    for (int i = 0; i < keys.size(); i++)
+      {
+        key = (byte[]) keys.get(i);
+        obj = aom.get(key);
+        if (obj.poa == this)
+          m_orb.disconnect(obj.object);
+      }
+
+    m_orb.identityDestroyed(this);
+
+    if (etherealize_objects && servant_activator != null && !m_inDestruction)
+      {
+        etherealizeAll();
+      }
+    m_inDestruction = true;
+
+    POA[] ch = the_children();
+    for (int i = 0; i < ch.length; i++)
+      {
+        ch[i].destroy(etherealize_objects, wait_for_completion);
+      }
+  }
+
+  /**
+   * Destroy this POA if it has not been destroyed, destroys it.
+   */
+  protected void finalize()
+                   throws java.lang.Throwable
+  {
+    if (!m_inDestruction)
+      destroy(false, false);
+  }
+
+  /**
+   * Remove self from the manager list.
+   */
+  private void unregisterFromManager()
+  {
+    if (m_manager instanceof gnuPOAManager)
+      {
+        gnuPOAManager p = (gnuPOAManager) m_manager;
+        p.removePOA(this);
+      }
+  }
+
+  /**
+   * Get the policy of the given type, associated with this POA.
+   *
+   * @param a_policy_type a type of the requested policy.
+   * @return a policy of the given type, applyting to this POA.
+   *
+   * @throws org.omg.CORBA.BAD_PARAM if the policy of this type has not
+   * been specified for this POA.
+   */
+  public Policy _get_policy(int a_policy_type)
+                     throws org.omg.CORBA.BAD_PARAM
+  {
+    for (int i = 0; i < s_policies.length; i++)
+      {
+        if (s_policies [ i ].policy_type() == a_policy_type)
+          return s_policies [ i ].copy();
+      }
+    throw new BAD_PARAM("No policy type " + a_policy_type);
+  }
+
+  /**
+   * Get the copy of the policy array.
+   */
+  public Policy[] getPolicyArray()
+  {
+    Policy[] r = new Policy[ s_policies.length ];
+    for (int i = 0; i < s_policies.length; i++)
+      {
+        r [ i ] = s_policies [ i ].copy();
+      }
+    return r;
+  }
+
+  /**
+   * The POAs cannot be created by this method.
+   *
+   * @specnote this is also not possible in Suns jdk at least till 1.4.
+   *
+   * @throws NO_IMPLEMENT always.
+   */
+  public org.omg.CORBA.Object _set_policy_override(Policy[] policies,
+                                                   SetOverrideType how
+                                                  )
+  {
+    throw new NO_IMPLEMENT("Use createPOA instead.");
+  }
+
+  /**
+   * Get the ORB, where this POA is connected.
+   */
+  public ORB orb()
+  {
+    return m_orb;
+  }
+
+  /**
+   * Connect the given delegate under the given key, also calling incarnate.
+   */
+  private void create_and_connect(byte[] object_key, String repository_id,
+    ServantDelegateImpl delegate)
+  {
+    aom.add(delegate);
+    connect_to_orb(object_key, getReferenceFactory().make_object(repository_id,
+      object_key));
+    if (servant_activator != null)
+      incarnate(null, object_key, delegate.servant, false);
+  }
+
+  /**
+   * Check if the POA is not in a discarding mode. The activation
+   * operations are forbidded in discarding mode.
+   *
+   * @throws TRANSIENT if the POA is in discarding mode.
+   */
+  private void checkDiscarding()
+                        throws TRANSIENT
+  {
+    if (m_manager.get_state() == State.DISCARDING)
+      throw new TRANSIENT("Discarding mode", 1, CompletionStatus.COMPLETED_MAYBE);
+  }
+
+  /**
+   * Connect the given delegate object to orb.
+   */
+  protected void connect_to_orb(byte[] an_Object_Id, org.omg.CORBA.Object object)
+  {
+    if (applies(ThreadPolicyValue.SINGLE_THREAD_MODEL))
+      m_orb.connect_1_thread(object, toIORKey(an_Object_Id), this);
+    else
+      m_orb.connect(object, toIORKey(an_Object_Id));
+  }
+
+  /**
+   * Returns the representation of this POA tree.
+   */
+  public String toString()
+  {
+    StringBuffer b = new StringBuffer(name);
+
+    if (children.size() != 0)
+      {
+        b.append(" (");
+
+        for (int i = 0; i < children.size(); i++)
+          {
+            b.append(children.get(i));
+            if (i < children.size() - 2)
+              b.append(", ");
+          }
+        b.append(")");
+      }
+    return b.toString();
+  }
+
+  /**
+   * Check if the policy set is valid.
+   */
+  protected boolean validatePolicies(Policy[] a)
+                              throws InvalidPolicy
+  {
+    if (applies(ServantRetentionPolicyValue.NON_RETAIN))
+      {
+        if (!applies(RequestProcessingPolicyValue.USE_DEFAULT_SERVANT) &&
+            !applies(RequestProcessingPolicyValue.USE_SERVANT_MANAGER)
+           )
+          {
+            short p = 0;
+            for (short i = 0; i < a.length; i++)
+              {
+                if (a [ i ].policy_type() == SERVANT_RETENTION_POLICY_ID.value)
+                  p = i;
+              }
+            throw new InvalidPolicy("NON_RETAIN requires either " +
+                                    "USE_DEFAULT_SERVANT or USE_SERVANT_MANAGER",
+                                    p
+                                   );
+          }
+      }
+    return true;
+  }
+
+  /**
+   * Recursively searches for the given object in the POA tree.
+   */
+  public AOM.Obj findObject(org.omg.CORBA.Object object)
+  {
+    AOM.Obj h = aom.findObject(object);
+    if (h != null)
+      return h;
+    else
+      {
+        for (int i = 0; i < children.size(); i++)
+          {
+            h = ((gnuPOA) children.get(i)).findObject(object);
+            if (h != null)
+              return h;
+          }
+      }
+    return h;
+  }
+  
+  /**
+   * Recursively searches for the given key in the POA tree.
+   * @param ior_key the key, ecapsulating both object
+   * and poa ids.
+   * @return
+   */
+  public AOM.Obj findKey(byte[] object_id, byte[] poa_id)
+  {
+    AOM.Obj h = null;
+    if (Arrays.equals(poa_id, id()))
+      h = aom.get(object_id);
+    if (h != null)
+      return h;
+    else
+      {
+        for (int i = 0; i < children.size(); i++)
+          {
+            h = ((gnuPOA) children.get(i)).findKey(object_id, poa_id);
+            if (h != null)
+              return h;
+          }
+      }
+    return h;
+  }
+
+  /**
+   * Parses the given key, extracts poa and object id and searches
+   * for such reference.
+   */
+  public AOM.Obj findIorKey(byte[] ior_key)
+  {
+    BufferredCdrInput in = new BufferredCdrInput(ior_key);
+    int signature = in.read_long();
+    if (signature != SIGNATURE)
+      return null;
+
+    byte[] id = in.read_sequence();
+    byte[] poa = in.read_sequence();
+    return findKey(id, poa);
+  }
+
+  /**
+   * Converts the object Id into the IOR key. IOR key must be
+   * unique in the scope of the ORB, and Ids only in the scope of POA.
+   * Hence the IOR key includes the POA identifiers.
+   */
+  public byte[] toIORKey(byte[] object_id)
+  {
+    BufferedCdrOutput buffer = new BufferedCdrOutput();
+    buffer.write_long(SIGNATURE);
+    buffer.write_sequence(object_id);
+    buffer.write_sequence(id());
+    return buffer.buffer.toByteArray();
+  }
+
+  /**
+   * Extracts the object id from the ior key.
+   *
+   * @param ior_key
+   *
+   * @return the encapsulated object ior key or null if
+   * this ior key either refers a different POA or encoding signature
+   * mismatch.
+   */
+  public byte[] idFormIor(byte[] ior_key)
+  {
+    BufferredCdrInput in = new BufferredCdrInput(ior_key);
+    int signature = in.read_long();
+    if (signature != SIGNATURE)
+      return null;
+
+    byte[] object_id = in.read_sequence();
+    byte[] poa_id = in.read_sequence();
+    if (Arrays.equals(poa_id, id()))
+      return object_id;
+    else
+      return null;
+  }
+  
+  /**
+   * Recursively searches for the given servant in the POA tree.
+   */
+  public AOM.Obj findServant(Servant servant)
+  {
+    AOM.Obj h = aom.findServant(servant);
+    if (h != null)
+      return h;
+    else
+      {
+        for (int i = 0; i < children.size(); i++)
+          {
+            h = ((gnuPOA) children.get(i)).findServant(servant);
+            if (h != null)
+              return h;
+          }
+      }
+    return h;
+  }
+  
+  /**
+   * Get the object reference template of this POA.
+   * Instantiate a singleton instance, if required.
+   */
+  public ObjectReferenceTemplate getReferenceTemplate()
+  {
+    if (refTemplate == null)
+      refTemplate = new RefTemplate();
+    
+    return refTemplate;
+  }
+  
+  public ObjectReferenceFactory getReferenceFactory()
+  {
+    return m_object_factory;
+  }
+  
+  public void setReferenceFactory(ObjectReferenceFactory factory)
+  {
+    m_object_factory = factory;
+  }
+
+  /**
+   * Create the object (needed by the factory interface).
+   */
+  public Object make_object(String a_repository_id, byte[] an_object_id)
+  {
+    AOM.Obj existing = aom.get(an_object_id);
+    // The object may already exist. In this case, it is just returned.
+    if (existing != null && existing.object != null)
+      return existing.object;
+    else
+      {
+        return new gnuServantObject(new String[] { a_repository_id },
+          an_object_id, this, m_orb);
+      }
+  }
+
+  /**
+   * Required by object reference factory ops.
+   */
+  public String[] _truncatable_ids()
+  {
+    return ref_template_ids;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,273 @@
+/* gnuPOAManager.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.CORBA.Poa;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.LocalObject;
+import org.omg.PortableInterceptor.NON_EXISTENT;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+import org.omg.PortableServer.POAManager;
+import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
+import org.omg.PortableServer.POAManagerPackage.State;
+
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * The implementation of the POA manager. The manager is a controlled
+ * switch that can change its states in response to the method calls
+ * and throw exceptions if the requested change is invalid. It is possible
+ * to check the state this switch. It does not do anything else.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuPOAManager
+  extends LocalObject
+  implements POAManager
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * The POAs, controlled by this manager.
+   */
+  private HashSet POAs = new HashSet();
+
+  /**
+   * The state of the manager. The newly created manager is always
+   * in the holding state.
+   */
+  State state = State.HOLDING;
+  
+  /**
+   * Get the state of the POA manager.
+   */
+  public State get_state()
+  {
+    return state;
+  }
+
+  /**
+   * Turns the associated POAs into active state, allowing them to receive
+   * and process requests.
+   *
+   * @throws if the POAs are in the inactive state. If once inactivated,
+   * the POA cannot be activated again. This method can only be called
+   * to leave the holding or discarding state.
+   */
+  public void activate()
+                throws AdapterInactive
+  {
+    if (state != State.INACTIVE)
+      state = State.ACTIVE;
+    else
+      throw new AdapterInactive();
+    
+    notifyInterceptors(state.value());    
+  }
+
+  /**
+   * Turns the associated POAs into holding state. In this state, the POAs
+   * queue incoming requests but do not process them.
+   *
+   * @param wait_for_completion if true, the method call suspends the current
+   * thread till POAs complete the requests they are currently processing. If
+   * false, the method returns immediately.
+
+   * @throws AdapterInactive if the POAs are in the inactive state.
+   */
+  public void hold_requests(boolean wait_for_completion)
+                     throws AdapterInactive
+  {
+    if (state != State.INACTIVE)
+      state = State.HOLDING;
+    else
+      throw new AdapterInactive();
+    
+    notifyInterceptors(state.value());
+    
+    if (wait_for_completion)
+      waitForIdle();
+  }
+
+  /**
+   *
+   * Turns the asociated POAs into inactive state. The POAs in the incative
+   * state will reject new requests. If the POA is once inactivated, it
+   * cannot be activated again. The operation is used when
+   * the associated POAs are to be shut down.
+   *
+   * @param etherealize_objects if true, the servant managers of the
+   * associated POAs, having RETAIN and USE_SERVANT_MANAGER policies,
+   * will receive a call of {@link ServantActivatorOperations#etherealize}.
+   *
+   * @param wait_for_completion if true, the method call suspends the current
+   * thread till POAs complete the requests they are currently processing. If
+   * false, the method returns immediately.
+   *
+   * @throws AdapterInactive if the POAs are already in the inactive state.
+   *
+   * @see POAOperations#destroy
+   */
+  public void deactivate(boolean etherealize_objects,
+                         boolean wait_for_completion
+                        )
+                  throws AdapterInactive
+  {
+    if (state == State.INACTIVE)
+      throw new AdapterInactive("Repetetive inactivation");
+    state = State.INACTIVE;
+    
+    notifyInterceptors(state.value());    
+    
+    if (wait_for_completion)
+      waitForIdle();
+
+    Iterator iter = POAs.iterator();
+    while (iter.hasNext())
+      {
+        gnuPOA poa = (gnuPOA) iter.next();
+
+        // If the servant activator is non null, this means it has been
+        // set - hence the policies are appropriate.
+        if (poa.servant_activator != null)
+          poa.etherealizeAll();
+      }
+  }
+
+  /**
+   * Turns the associated POAs into discaring state. In this state, the POAs
+   * discard the incoming requests. This mode is used in situations when
+   * the server is flooded with requests. The client receives remote exception
+   * ({@link org.omg.CORBA.TRANSIENT}, minor code 1).
+   *
+   * @param wait_for_completion if true, the method call suspends the current
+   * thread till POAs complete the requests they are currently processing. If
+   * false, the method returns immediately.
+
+   * @throws AdapterInactive if the POAs are in the inactive state.
+   */
+  public void discard_requests(boolean wait_for_completion)
+                        throws AdapterInactive
+  {
+    if (state != State.INACTIVE)
+      state = State.DISCARDING;
+    else
+      throw new AdapterInactive();
+    
+    notifyInterceptors(state.value());    
+    
+    if (wait_for_completion)
+      waitForIdle();
+  }
+
+  /**
+   * Suspend the current thread while at least one of the associated POA is
+   * actively processing some requests. The method assumes that the POAs
+   * are not accepting the <i>new</i> requests due manager state.
+   *
+   * @throws BAD_INV_ORDER if the POAs are in the active state.
+   */
+  public void waitForIdle()
+  {
+    if (state == State.ACTIVE)
+      throw new BAD_INV_ORDER("The state is active");
+     
+    gnuPOA poa;
+    Iterator iter = POAs.iterator();
+    
+    while (iter.hasNext())
+      {
+        poa = (gnuPOA) iter.next();
+        poa.waitWhileRunning();
+      }
+  }
+
+  /**
+   * Add the POA that will be controlled by this manager.
+   *
+   * @param poa the POA.
+   */
+  public void addPoa(gnuPOA poa)
+  {
+    POAs.add(poa);
+  }
+
+  /**
+   * Remove the POA, releasing it from the control of this manager.
+   * Called in POA finaliser.
+   *
+   * @param poa the POA to remove.
+   */
+  public void removePOA(gnuPOA poa)
+  {
+    POAs.remove(poa);
+  }
+  
+  /**
+   * This method is called when POA is destryed. The interceptors are
+   * notified.
+   */
+  public void poaDestroyed(gnuPOA poa)
+  {
+    notifyInterceptors(NON_EXISTENT.value); 
+  }
+  
+  /**
+   * Notify CORBA 3.0 interceptors about the status change.
+   */
+  public synchronized void notifyInterceptors(int new_state)
+  {
+    gnuPOA poa;
+    Iterator iter = POAs.iterator();
+
+    // The System.identityHashCode is also called in gnuIorInfo.
+    while (iter.hasNext())
+      {
+        poa = (gnuPOA) iter.next();
+        if (poa.m_orb.iIor != null)
+          {
+            poa.m_orb.iIor.adapter_manager_state_changed(
+              System.identityHashCode(this), (short) new_state);
+          }
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPoaCurrent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPoaCurrent.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPoaCurrent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuPoaCurrent.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,179 @@
+/* gnuPoaCurrent.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.CORBA.Poa;
+
+import org.omg.CORBA.CurrentHelper;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.Current;
+import org.omg.PortableServer.CurrentOperations;
+import org.omg.PortableServer.CurrentPackage.NoContext;
+import org.omg.PortableServer.POA;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Supports the "Poa current" concept, providing the id and poa of
+ * the object currently being served. There is only one instance
+ * of this class per ORB. It maintains a thread to information map.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuPoaCurrent
+  extends ObjectImpl
+  implements Current
+{
+  /**
+   * The table, mapping threads to records.
+   */
+  private TreeMap threads = new TreeMap();
+
+  /**
+   * Get the array of POA current repository ids.
+   *
+   * @return a single member array, containing value, returned
+   * by the {@link CurrentHelper#id}, normally
+   * "IDL:omg.org/PortableServer/Current:2.3".
+   */
+  public String[] _ids()
+  {
+    return new String[] { CurrentHelper.id() };
+  }
+
+  /**
+   * Get the object id, associated with the thread currently being served.
+   *
+   * @throws NoContext if the current thread is not associated with any
+   * object.
+   */
+  public byte[] get_object_id()
+                       throws NoContext
+  {
+    CurrentOperations r;
+    synchronized (threads)
+      {
+        r = (CurrentOperations) threads.get(Thread.currentThread().getName());
+      }
+    if (r != null)
+      return r.get_object_id();
+    else
+      throw new NoContext(Thread.currentThread().getName());
+  }
+
+  /**
+   * Get the object POA, associated with the thread currently being served.
+   *
+   * @throws NoContext if the current thread is not associated with any
+   * object.
+   */
+  public POA get_POA()
+              throws NoContext
+  {
+    CurrentOperations r;
+    synchronized (threads)
+      {
+        r = (CurrentOperations) threads.get(Thread.currentThread().getName());
+      }
+    if (r != null)
+      return r.get_POA();
+    else
+      throw new NoContext(Thread.currentThread().getName());
+  }
+
+  /**
+   * Add the entry to the map.
+   */
+  public void put(Thread t, CurrentOperations record)
+  {
+    synchronized (threads)
+      {
+        threads.put(t.getName(), record);
+      }
+  }
+
+  /**
+   * Check if this Poa has some running threads.
+   */
+  public boolean has(POA poa)
+  {
+    synchronized (threads)
+      {
+        Iterator iter = threads.entrySet().iterator();
+        while (iter.hasNext())
+          {
+            Map.Entry item = (Map.Entry) iter.next();
+            try
+              {
+                if (((CurrentOperations) item.getValue()).get_POA() == poa)
+                  {
+                    return true;
+                  }
+              }
+            catch (NoContext ex)
+              {
+                throw new InternalError();
+              }
+          }
+      }
+    return false;
+  }
+
+  /**
+   * Check if this thread is registered.
+   */
+  public boolean has(Thread t)
+  {
+    synchronized (threads)
+      {
+        return threads.containsKey(t.getName());
+      }
+  }
+
+  /**
+   * Remove the entry from the map.
+   */
+  public void remove(Thread t)
+  {
+    synchronized (threads)
+      {
+        threads.remove(t.getName());
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* gnuRequestProcessingPolicy.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.CORBA.Poa;
+
+import gnu.CORBA._PolicyImplBase;
+
+import org.omg.PortableServer.REQUEST_PROCESSING_POLICY_ID;
+import org.omg.PortableServer.RequestProcessingPolicy;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+
+/**
+ * The implementation of the request processing policy.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuRequestProcessingPolicy
+  extends _PolicyImplBase
+  implements RequestProcessingPolicy, AccessiblePolicy
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Create the policy.
+   *
+   * @param v a value for the policy.
+   */
+  public gnuRequestProcessingPolicy(RequestProcessingPolicyValue v)
+  {
+    super(REQUEST_PROCESSING_POLICY_ID.value, v, v.value(),
+          "IDL:org.omg/PortableServer/RequestProcessingPolicy:1.0"
+         );
+  }
+
+  /**
+   * Get the value for the policy that was passed in a constructor.
+   */
+  public RequestProcessingPolicyValue value()
+  {
+    return (RequestProcessingPolicyValue) getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,812 @@
+/* gnuServantObject.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.CORBA.Poa;
+
+import gnu.CORBA.GIOP.ReplyHeader;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.IorObject;
+import gnu.CORBA.Interceptor.gnuServerRequestInfo;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.IOR;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.Minor;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.ResponseHandlerImpl;
+import gnu.CORBA.StreamHolder;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OBJ_ADAPTER;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TRANSIENT;
+import org.omg.CORBA.UserException;
+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;
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
+import org.omg.PortableServer.CurrentOperations;
+import org.omg.PortableServer.DynamicImplementation;
+import org.omg.PortableServer.ImplicitActivationPolicyValue;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAManager;
+import org.omg.PortableServer.POAManagerPackage.State;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.omg.PortableServer.portable.Delegate;
+
+import java.io.IOException;
+
+import java.util.Arrays;
+
+/**
+ * Represents a CORBA object, being locally served by the associated servant.
+ * The calls to the object are forwarded to the calls to the servant.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuServantObject extends ObjectImpl
+  implements org.omg.CORBA.Object,
+    InvokeHandler,
+    CurrentOperations,
+    IorProvider
+{
+  /**
+   * The associated servant that must also implement the {@link InvokeHandler}
+       * interface. This value can be temporary null if the object was created using
+   * POA.create_reference or POA.create_reference_with_id, private to force
+   * always to use {@link setServant}.
+   */
+  private Servant servant;
+
+  /**
+   * The Id of this object.
+   */
+  public final byte[] Id;
+
+  /**
+   * The poa that takes care about this object.
+   */
+  public final gnuPOA poa;
+
+  /**
+   * The POA manager, used to control the work of this object.
+   */
+  public final POAManager manager;
+
+  /**
+   * The orb.
+   */
+  public final ORB_1_4 orb;
+
+  /**
+   * The object repository ids, if they were specified separately. Normally, the
+   * ids are requested from the servant.
+   */
+  public final String[] repository_ids;
+
+  /**
+   * Create an object with no connected servant. The servant must be set later.
+   *
+   * @param a_repository_ids an array of repository ids, can be null (then ids
+   * will be requested from the servant).
+   * @param an_id the object id.
+   * @param a_poa the POA.
+   */
+  public gnuServantObject(String[] a_repository_ids, byte[] an_id,
+    gnuPOA a_poa, ORB_1_4 an_orb
+  )
+  {
+    repository_ids = a_repository_ids;
+    Id = an_id;
+    manager = a_poa.the_POAManager();
+    poa = a_poa;
+    orb = an_orb;
+  }
+  
+  /**
+   * Get the IOR as it would be for this object.
+   */
+  public IOR getIor()
+  {
+    return orb.getLocalIor(this);    
+  }
+
+  /**
+   * Create a servant object, associated with the passed servant.
+   *
+   * @param a_servant a servant, serving this object.
+   * @param an_id an Object Id for this object.
+   *
+   * @throws BAD_PARAM if the passed servant is not an {@link InvokeHandler}.
+   */
+  public gnuServantObject(Servant a_servant, byte[] an_id, ORB_1_4 an_orb,
+    gnuPOA a_poa
+  )
+  {
+    Id = an_id;
+    setServant(a_servant);
+    poa = a_poa;
+    if (poa != null)
+      {
+        manager = poa.the_POAManager();
+      }
+    else
+      {
+        manager = null;
+      }
+    repository_ids = null;
+    orb = an_orb;
+  }
+
+  /**
+   * Set a servant, if it has not been previously set.
+   *
+   * @param a_servant a servant to set, can be null to indicate the necessity
+   * for the subsequent activation.
+   *
+   * @throws BAD_PARAM if the passed servant is not an {@link InvokeHandler} or
+   * {@link DynamicImplementation} and also not null.
+   */
+  public void setServant(Servant a_servant)
+  {
+    if (a_servant != null &&
+      !(a_servant instanceof InvokeHandler) &&
+      !(a_servant instanceof DynamicImplementation)
+    )
+      {
+        throw new BAD_PARAM("Must be either InvokeHandler or " +
+          "DynamicImplementation, but is " + a_servant
+        );
+      }
+    servant = a_servant;
+  }
+
+  /**
+   * Returns the associated servant.
+   */
+  public Servant getServant()
+  {
+    return servant;
+  }
+
+  /**
+   * Return the associated invocation handler.
+   */
+  public InvokeHandler getHandler(String operation, CookieHolder cookie,
+    boolean forwarding_allowed
+  ) throws gnuForwardRequest
+  {
+    if (servant != null)
+      {
+        return servantToHandler(servant);
+      }
+    else
+      {
+        // Use servant locator to locate the servant.
+        if (poa.servant_locator != null)
+          {
+            try
+              {
+                servant =
+                  poa.servant_locator.preinvoke(Id, poa, operation, cookie);
+                return servantToHandler(servant);
+              }
+            catch (org.omg.PortableServer.ForwardRequest forw_ex)
+              {
+                if (forwarding_allowed)
+                  {
+                    throw new gnuForwardRequest(forw_ex.forward_reference);
+                  }
+                else
+                  {
+                    servant =
+                      ForwardedServant.create(forw_ex.forward_reference);
+                    return servantToHandler(servant);
+                  }
+              }
+          }
+        else
+        // Use servant activator to locate the servant.
+        if (poa.applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) &&
+          poa.applies(ServantRetentionPolicyValue.RETAIN)
+        )
+          {
+            try
+              {
+                poa.activate_object_with_id(Id, servant, forwarding_allowed);
+                servant = poa.id_to_servant(Id);
+                return servantToHandler(servant);
+              }
+            catch (gnuForwardRequest forwarded)
+              {
+                throw forwarded;
+              }
+            catch (Exception ex)
+              {
+                BAD_OPERATION bad =
+                  new BAD_OPERATION("Unable to activate", Minor.Activation,
+                    CompletionStatus.COMPLETED_NO
+                  );
+                bad.initCause(ex);
+                throw bad;
+              }
+          }
+        else if (poa.default_servant != null)
+          {
+            servant = poa.default_servant;
+            return servantToHandler(servant);
+          }
+
+        // No servant and no servant manager - throw exception.
+        else
+          {
+            throw new BAD_OPERATION("Unable to activate", Minor.Activation,
+              CompletionStatus.COMPLETED_NO
+            );
+          }
+      }
+  }
+
+  /**
+   * Convert the servant to invocation handler.
+   */
+  public InvokeHandler servantToHandler(Servant a_servant)
+  {
+    if (a_servant instanceof InvokeHandler)
+      {
+        return (InvokeHandler) a_servant;
+      }
+    else if (a_servant instanceof DynamicImplementation)
+      {
+        return new DynamicImpHandler((DynamicImplementation) a_servant);
+      }
+    else
+      {
+        throw new BAD_OPERATION(a_servant +
+          " must be either InvokeHandler or " + "POA DynamicImplementation"
+        );
+      }
+  }
+
+  /**
+   * Create a servant object, associated with the passed servant. Requests the
+   * object id from the servant. Depending on the policies of the servants POA,
+   * the calls are eithe not synchronized or synchronized on POA or ORB.
+   *
+   * @param a_servant a servant, serving this object.
+   * @param an_id an Object Id for this object.
+   */
+  public gnuServantObject(Servant a_servant, gnuPOA a_poa)
+  {
+    this(a_servant, a_servant._object_id(), (ORB_1_4) a_servant._orb(), a_poa);
+  }
+
+  /**
+   * Delegates call to servant, passing the poa and Id.
+   */
+  public String[] _ids()
+  {
+    if (repository_ids == null)
+      {
+        return getServant()._all_interfaces(poa, Id);
+      }
+    else
+      {
+        return repository_ids;
+      }
+  }
+
+  /**
+   * Gets a string representation.
+   */
+  public String toString()
+  {
+    StringBuffer b = new StringBuffer("Servant object (");
+    for (int i = 0; i < Id.length; i++)
+      {
+        b.append(Integer.toHexString(Id [ i ] & 0xFF));
+        b.append(' ');
+      }
+    b.append(')');
+    return b.toString();
+  }
+
+  /**
+   * Always returns true.
+   */
+  public boolean _is_local()
+  {
+    return true;
+  }
+
+  /**
+   * Check if this object could be named by the given repository id.
+   *
+   * @param idl_id the repository id to check.
+   *
+   * @return true if it is one of the possible repository ids of this object.
+   */
+  public boolean _is_a(String idl_id)
+  {
+    String[] maybe = _ids();
+    for (int i = 0; i < maybe.length; i++)
+      {
+        if (maybe [ i ].equals(idl_id))
+          {
+            return true;
+          }
+      }
+    return false;
+  }
+
+  /**
+   * Get an ORB, associated with the servant of this object.
+   *
+   * @return
+   */
+  public ORB _orb()
+  {
+    return getServant()._orb();
+  }
+
+  /**
+   * Handle the invocation (delegates to servant).
+   *
+   * @throws TRANSIENT minor 0x535503e9 if the POA is in discarding mode.
+   * @throws OBJ_ADAPTER minor 0x535503ea if the POA is inactivated.
+   * @throws OBJECT_NOT_EXISTS minor 0x535503ec if this object is inactivated.
+   *
+   * @specnote see {@link POAManagerOperations} for specnotes about the minor
+   * codes.
+   */
+  public OutputStream _invoke(String method, InputStream input,
+    ResponseHandler r_handler
+  ) throws SystemException
+  {
+    boolean intercept = false;
+    ServerRequestInterceptorOperations interceptor = null;
+    gnuServerRequestInfo info = null;
+    ResponseHandlerImpl i_handler = null;
+
+    try
+      {
+        if (orb.iServer != null &&
+          r_handler instanceof ResponseHandlerImpl
+        )
+          {
+            interceptor = orb.iServer;
+
+            i_handler = (ResponseHandlerImpl) r_handler;
+
+            info =
+              new gnuServerRequestInfo(this, i_handler.request_header,
+                i_handler.reply_header
+              );
+            intercept = true;
+
+            interceptor.receive_request_service_contexts(info);
+          }
+
+        try
+          {
+            CookieHolder cookie = null;
+            AOM.Obj self = poa.aom.get(Id);
+
+            if (poa.servant_locator != null)
+              {
+                // If the servant locator is in use, it is always responsible
+                // for providing the servant.
+                self.servant = servant = null;
+                cookie = new CookieHolder();
+              }
+            else if (self != null && self.isDeactiveted())
+              {
+                if (poa.applies(
+                    ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION
+                  ) &&
+                  poa.servant_activator != null
+                )
+                  {
+                    // Reset the servant, forcing the subsequent activation.
+                    servant = null;
+                  }
+                else
+                  {
+                    throw new OBJECT_NOT_EXIST("Object deactivated",
+                      0x535503ec, CompletionStatus.COMPLETED_NO
+                    );
+                  }
+              }
+
+            InvokeHandler handler = getHandler(method, cookie, true);
+
+            Delegate d = null;
+
+            try
+              {
+                d = servant._get_delegate();
+                orb.currents.put(Thread.currentThread(), this);
+              }
+            catch (Exception ex)
+              {
+                // In some cases exception is thrown if the delegate is not set.
+              }
+            if (d instanceof ServantDelegateImpl)
+              {
+                // If the delegate is already set, check maybe we can
+                // reuse the existing instance.
+                if (((ServantDelegateImpl) d).object != this)
+                  {
+                    servant._set_delegate(new ServantDelegateImpl(servant, poa, Id));
+                  }
+              }
+            else
+              {
+                servant._set_delegate(new ServantDelegateImpl(servant, poa, Id));
+              }
+
+            try
+              {
+                switch (manager.get_state().value())
+                  {
+                    case State._ACTIVE :
+
+                      OutputStream rt;
+                      try
+                        {
+                          if (intercept)
+                            {
+                              interceptor.receive_request(info);
+                            }
+
+                          rt = handler._invoke(method, input, r_handler);
+
+                          if (intercept)
+                            {
+                              // Handler is casted into i_handler.
+                              if (i_handler.isExceptionReply())
+                                {
+                                  info.m_reply_header.reply_status =
+                                    ReplyHeader.USER_EXCEPTION;
+
+                                  // Make Any, holding the user exception.
+                                  Any a = orb.create_any();
+                                  OutputStream buf = i_handler.getBuffer();
+                                  InputStream in = buf.create_input_stream();
+                                  String uex_idl = "unknown";
+                                  try
+                                    {
+                                      in.mark(Integer.MAX_VALUE);
+                                      uex_idl = in.read_string();
+                                      in.reset();
+                                    }
+                                  catch (IOException e)
+                                    {
+                                      throw new Unexpected(e);
+                                    }
+
+                                  try
+                                    {
+                                      UserException exception =
+                                        ObjectCreator.readUserException(uex_idl,
+                                          in
+                                        );
+
+                                      ObjectCreator.insertWithHelper(a,
+                                        exception
+                                      );
+                                    }
+                                  catch (Exception e)
+                                    {
+                                      // Failed due any reason, insert without
+                                      // helper.
+                                      a.insert_Streamable(new StreamHolder(
+                                          buf.create_input_stream()
+                                        )
+                                      );
+
+                                      RecordTypeCode r =
+                                        new RecordTypeCode(TCKind.tk_except);
+                                      r.setId(uex_idl);
+                                      r.setName(ObjectCreator.getDefaultName(
+                                          uex_idl
+                                        )
+                                      );
+                                    }
+
+                                  info.m_usr_exception = a;
+                                  interceptor.send_exception(info);
+                                }
+                              else
+                                {
+                                  info.m_reply_header.reply_status =
+                                    ReplyHeader.NO_EXCEPTION;
+                                  interceptor.send_reply(info);
+                                }
+                            }
+                        }
+                      catch (SystemException sys_ex)
+                        {
+                          if (intercept)
+                            {
+                              info.m_reply_header.reply_status =
+                                ReplyHeader.SYSTEM_EXCEPTION;
+                              info.m_sys_exception = sys_ex;
+                              interceptor.send_exception(info);
+                            }
+                          throw sys_ex;
+                        }
+
+                      return rt;
+
+                    case State._HOLDING :
+
+                      // The holding mode is implemented
+                      // relying on the holding capabilites of the network
+                      // support (if any).
+                      // TODO FIXME in more recent CORBA applications, the
+                      // client
+                      // ORB can free the connection and wait for a server side
+                      // notification about the completed request. Implement
+                      // this
+                      // as soon as JDK specification would allow bidirectional
+                      // policy.
+                      int sleep = 5;
+                      int max = 500;
+
+                      // Wait till the state will be switched into some other
+                      // mode.
+                      while (manager.get_state().value() == State._HOLDING)
+                        {
+                          try
+                            {
+                              Thread.sleep(sleep);
+                              if (sleep < max)
+                                {
+                                  sleep = max;
+                                }
+                            }
+                          catch (InterruptedException ex)
+                            {
+                            }
+                        }
+
+                      // Handle another mode.
+                      return _invoke(method, input, r_handler);
+
+                    case State._DISCARDING :
+                      throw new TRANSIENT("Discarding mode", 0x535503e9,
+                        CompletionStatus.COMPLETED_NO
+                      );
+
+                    case State._INACTIVE :
+                      throw new OBJ_ADAPTER("POA deactivated", 0x535503ea,
+                        CompletionStatus.COMPLETED_NO
+                      );
+
+                    default :
+                      throw new InternalError(); // No more states.
+                  }
+              }
+            finally
+              {
+                if (poa.servant_locator != null)
+                  {
+                    poa.servant_locator.postinvoke(Id, poa, method,
+                      cookie.value, servant
+                    );
+                    servant = null;
+                  }
+              }
+          }
+        finally
+          {
+            orb.currents.remove(Thread.currentThread());
+          }
+      }
+    catch (ForwardRequest fex)
+      {
+        // May be thrown by interceptor.
+        if (intercept)
+          {
+            Forwarding:
+            while (true)
+              {
+                info.m_reply_header.reply_status =
+                  ReplyHeader.LOCATION_FORWARD;
+                info.m_forward_reference = fex.forward;
+                try
+                  {
+                    interceptor.send_other(info);
+                    break Forwarding;
+                  }
+                catch (ForwardRequest fex2)
+                  {
+                    info.m_forward_reference = fex2.forward;
+                    fex.forward = info.m_forward_reference;
+                  }
+              }
+          }
+        throw new gnuForwardRequest(fex.forward);
+      }
+    catch (gnuForwardRequest fex)
+      {
+        // May be thrown during activation.
+        if (intercept)
+          {
+            Forwarding:
+            while (true)
+              {
+                info.m_reply_header.reply_status =
+                  ReplyHeader.LOCATION_FORWARD;
+                info.m_forward_reference = fex.forward_reference;
+                try
+                  {
+                    interceptor.send_other(info);
+                    break Forwarding;
+                  }
+                catch (ForwardRequest fex2)
+                  {
+                    info.m_forward_reference = fex2.forward;
+                    fex.forward_reference = (ObjectImpl) fex2.forward;
+                  }
+              }
+          }
+        throw fex;
+      }
+  }
+
+  /**
+   * Compare with another object for equality, comparing the object keys.
+   */
+  public boolean equals(java.lang.Object other)
+  {
+    if (other instanceof gnuServantObject)
+      {
+        gnuServantObject o = (gnuServantObject) other;
+
+        return Arrays.equals(o.Id, Id);
+      }
+    else
+      {
+        return false;
+      }
+  }
+
+  /**
+   * Get the hash code, based on the object key.
+   */
+  public int hashCode()
+  {
+    long s = 0;
+    int v = 1;
+    for (int i = 0; i < Id.length; i++)
+      {
+        s += Id [ i ] * v;
+        if (s > Integer.MAX_VALUE)
+          {
+            s = s % Integer.MAX_VALUE;
+            v = 1;
+          }
+        v = v * 8;
+      }
+    return (int) (s % Integer.MAX_VALUE);
+  }
+
+  /**
+   * Get the object id.
+   */
+  public byte[] get_object_id()
+  {
+    return Id;
+  }
+
+  /**
+   * Get POA.
+   */
+  public POA get_POA()
+  {
+    return poa;
+  }
+
+  /**
+   * Returns without action.
+   */
+  public void _release()
+  {
+  }
+
+  /**
+   * Returns without action.
+   */
+  public void _releaseReply(InputStream stream)
+  {
+  }
+
+  /**
+   * Checks if this object is equivalent to another instance. These objects are
+   * assumed equal if they are connected to the same orb and poa under the same
+   * Id, regardless of they delegates.
+   *
+   * @param another instance to check.
+   * @return
+   */
+  public boolean _is_equivalent(org.omg.CORBA.Object other)
+  {
+    if (other instanceof gnuServantObject)
+      {
+        gnuServantObject g = (gnuServantObject) other;
+        return orb == g.orb && poa == g.poa && Arrays.equals(Id, g.Id);
+      }
+    else if (other instanceof IorObject)
+      {
+        IorObject ir = ((IorObject) other);
+        try
+          {
+            IorDelegate ird = (IorDelegate) ir._get_delegate();
+            byte[] ior_id = poa.idFormIor(ird.getIor().key);
+            if (ior_id != null && Arrays.equals(ior_id, Id))
+              {
+                return true;
+              }
+            else
+              {
+                return false;
+              }
+          }
+        catch (Exception ex)
+          {
+            // Non - typical delegate or very specific subclass of
+            // IOR_constructed_object.
+            return super._is_equivalent(other);
+          }
+      }
+    return super._is_equivalent(other);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* gnuServantRetentionPolicy.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.CORBA.Poa;
+
+import gnu.CORBA._PolicyImplBase;
+
+import org.omg.PortableServer.SERVANT_RETENTION_POLICY_ID;
+import org.omg.PortableServer.ServantRetentionPolicy;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+
+/**
+ * The implementation of the servant retention policy.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuServantRetentionPolicy
+  extends _PolicyImplBase
+  implements ServantRetentionPolicy, AccessiblePolicy
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Create the policy.
+   *
+   * @param v a value for the policy.
+   */
+  public gnuServantRetentionPolicy(ServantRetentionPolicyValue v)
+  {
+    super(SERVANT_RETENTION_POLICY_ID.value, v, v.value(),
+          "IDL:org.omg/PortableServer/ServantRetentionPolicy:1.0"
+         );
+  }
+
+  /**
+   * Get the value for the policy that was passed in a constructor.
+   */
+  public ServantRetentionPolicyValue value()
+  {
+    return (ServantRetentionPolicyValue) getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* gnuThreadPolicy.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.CORBA.Poa;
+
+import gnu.CORBA._PolicyImplBase;
+
+import org.omg.PortableServer.THREAD_POLICY_ID;
+import org.omg.PortableServer.ThreadPolicy;
+import org.omg.PortableServer.ThreadPolicyValue;
+
+/**
+ * The implementation of the thread policy.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuThreadPolicy
+  extends _PolicyImplBase
+  implements ThreadPolicy, AccessiblePolicy
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * Create the policy.
+   *
+   * @param v a value for the policy.
+   */
+  public gnuThreadPolicy(ThreadPolicyValue v)
+  {
+    super(THREAD_POLICY_ID.value, v, v.value(),
+          "IDL:org.omg/PortableServer/ThreadPolicy:1.0"
+         );
+  }
+
+  /**
+   * Get the value for the policy that was passed in a constructor.
+   */
+  public ThreadPolicyValue value()
+  {
+    return (ThreadPolicyValue) getValue();
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/RawReply.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/RawReply.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/RawReply.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/RawReply.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,95 @@
+/* RawReply.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.CORBA;
+
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.GIOP.MessageHeader;
+
+import org.omg.CORBA.ORB;
+
+/**
+ * The remote object reply in the binary form, holding
+ * the message header and the following binary data.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+class RawReply
+{
+  /**
+   * The message header.
+   */
+  final MessageHeader header;
+
+  /**
+   * The associated orb.
+   */
+  final ORB orb;
+
+  /**
+   * The message data.
+   */
+  final byte[] data;
+
+  /**
+   * Create the binary reply.
+   *
+   * @param an_header the message header
+   * @param a_data the message data.
+   */
+  RawReply(ORB an_orb, MessageHeader an_header, byte[] a_data)
+  {
+    orb = an_orb;
+    header = an_header;
+    data = a_data;
+  }
+
+  /**
+   * Get the CDR input stream with the correctly set alignment.
+   *
+   * @return the CDR stream to read the message data.
+   */
+  BufferredCdrInput getStream()
+  {
+    BufferredCdrInput in = new BufferredCdrInput(data);
+    in.setOffset(header.getHeaderSize());
+    in.setVersion(header.version);
+    in.setOrb(orb);
+    in.setBigEndian(header.isBigEndian());
+    return in;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,189 @@
+/* ResponseHandlerImpl.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.CORBA;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.GIOP.MessageHeader;
+import gnu.CORBA.GIOP.ReplyHeader;
+import gnu.CORBA.GIOP.RequestHeader;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+
+/**
+ * Provides the CDR output streams for writing the response to the given buffer.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ResponseHandlerImpl
+  implements ResponseHandler
+{
+  /**
+   * The message header. This field is used to compute the size and alignments.
+   * It is, however, never directly written to the buffer stream.
+   */
+  public final MessageHeader message_header;
+
+  /**
+   * The associated orb.
+   */
+  public final ORB orb;
+
+  /**
+   * The reply header.
+   */
+  public final ReplyHeader reply_header;
+
+  /**
+   * The request header.
+   */
+  public final RequestHeader request_header;
+
+  /**
+   * True if the stream was obtained by invoking {@link #createExceptionReply()},
+   * false otherwise.
+   */
+  private boolean exceptionReply;
+
+  /**
+   * The buffer to write into.
+   */
+  private BufferedCdrOutput buffer;
+
+  /**
+   * Create a new buffered response handler that uses the given message headers.
+   * The headers are used to compute sizes and check the versions. They are not
+   * written into a stream inside this class.
+   *
+   * @param m_header a message header.
+   * @param r_header a reply header.
+   */
+  ResponseHandlerImpl(ORB an_orb, MessageHeader m_header,
+                          ReplyHeader r_header, RequestHeader rq_header)
+  {
+    message_header = m_header;
+    reply_header = r_header;
+    request_header = rq_header;
+    orb = an_orb;
+    prepareStream();
+  }
+
+  /**
+   * Get an output stream for providing details about the exception. Before
+   * returning the stream, the handler automatically writes the message header
+   * and the reply about exception header, but not the message header.
+   *
+   * @return the stream to write exception details into.
+   */
+  public OutputStream createExceptionReply()
+  {
+    exceptionReply = true;
+    prepareStream();
+    return buffer;
+  }
+
+  /**
+   * Get an output stream for writing a regular reply (not an exception).
+   *
+   * Before returning the stream, the handler automatically writes the regular
+   * reply header, but not the message header.
+   *
+   * @return the output stream for writing a regular reply.
+   */
+  public OutputStream createReply()
+  {
+    exceptionReply = false;
+    prepareStream();
+    reply_header.reply_status = ReplyHeader.NO_EXCEPTION;
+    return buffer;
+  }
+
+  /**
+   * Get the buffer, normally containing the written reply. The reply includes
+   * the reply header (or the exception header) but does not include the message
+   * header.
+   *
+   * The stream buffer can also be empty if no data have been written into
+   * streams, returned by {@link #createReply()} or
+   * {@link #createExceptionReply()}.
+   *
+   * @return the CDR output stream, containing the written output.
+   */
+  public BufferedCdrOutput getBuffer()
+  {
+    return buffer;
+  }
+
+  /**
+   * True if the stream was obtained by invoking {@link #createExceptionReply()},
+   * false otherwise (usually no-exception reply).
+   */
+  public boolean isExceptionReply()
+  {
+    return exceptionReply;
+  }
+
+  /**
+   * Compute the header offset, set the correct version number and codeset.
+   */
+  private void prepareStream()
+  {
+    buffer = new BufferedCdrOutput();
+    buffer.setOrb(orb);
+    buffer.setVersion(message_header.version);
+    buffer.setCodeSet(CodeSetServiceContext.find(reply_header.service_context));
+
+    // Since 1.2, the data section is always aligned on the 8 byte boundary.
+    // In older versions, it is necessary to set the offset correctly.
+    if (message_header.version.until_inclusive(1, 1))
+      {
+        buffer.setOffset(message_header.getHeaderSize());
+
+        // Get the position after the reply header would be written.
+        reply_header.write(buffer);
+
+        int new_offset = message_header.getHeaderSize() + buffer.buffer.size();
+
+        buffer.buffer.reset();
+        buffer.setOffset(new_offset);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceDetailHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceDetailHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceDetailHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceDetailHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,91 @@
+/* ServiceDetailHolder.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.CORBA;
+
+import org.omg.CORBA.ServiceDetail;
+import org.omg.CORBA.ServiceDetailHelper;
+
+
+/**
+ * The service detail holder. This class is not included in the original
+ * API specification, so we place it outside the org.omg namespace.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class ServiceDetailHolder
+  implements org.omg.CORBA.portable.Streamable
+{
+  /**
+   * The stored value.
+   */
+  public ServiceDetail value;
+
+  /**
+   * Create the initialised instance.
+   * @param initialValue
+   */
+  public ServiceDetailHolder(ServiceDetail initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Read from the CDR stream.
+   */
+  public void _read(org.omg.CORBA.portable.InputStream in)
+  {
+    value = ServiceDetailHelper.read(in);
+  }
+
+  /**
+   * Get the typecode.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return ServiceDetailHelper.type();
+  }
+
+  /**
+   * Write into the CDR stream.
+   */
+  public void _write(org.omg.CORBA.portable.OutputStream out)
+  {
+    ServiceDetailHelper.write(out, value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,168 @@
+/* ServiceRequestConverter.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.CORBA;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
+import org.omg.CORBA.ARG_IN;
+import org.omg.CORBA.ARG_INOUT;
+import org.omg.CORBA.ARG_OUT;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.ServerRequest;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * This class supports invocation using ServerRequest. When possible,
+ * it is better to use  the {@link ObjectImpl#_invoke} rather than
+ * working via ServerRequest. However since 1.4 the ServerRequest is
+ * involved into POA machinery making this type of call is sometimes
+ * inavoidable.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class ServiceRequestAdapter
+  implements ResponseHandler
+{
+  /**
+   * A buffer for writing the response.
+   */
+  BufferedCdrOutput reply = new BufferedCdrOutput();
+
+  /**
+   * If set to true, an exception has been thrown during the invocation.
+   */
+  boolean isException;
+
+  public OutputStream createExceptionReply()
+  {
+    isException = true;
+    return reply;
+  }
+
+  public OutputStream createReply()
+  {
+    isException = false;
+    return reply;
+  }
+
+  /**
+   * Make an invocation.
+   *
+   * @param request a server request, containg the invocation information.
+   * @param target the invocation target
+   * @param result the result holder with the set suitable streamable.
+   * Using this parameter only increase the performance. It can be
+   * null if the return type is void or unknown.
+   */
+  public static void invoke(ServerRequest request, InvokeHandler target,
+                            Streamable result
+                           )
+  {
+    try
+      {
+        int IN = ARG_IN.value;
+        int OUT = ARG_OUT.value;
+
+        // Write all arguments to the buffer output stream.
+        BufferedCdrOutput buffer = new BufferedCdrOutput();
+        gnuNVList args = new gnuNVList();
+        request.arguments(args);
+
+        for (int i = 0; i < args.count(); i++)
+          {
+            if ((args.item(i).flags() & IN) != 0)
+              {
+                args.item(i).value().write_value(buffer);
+              }
+          }
+
+        ServiceRequestAdapter h = new ServiceRequestAdapter();
+
+        target._invoke(request.operation(), buffer.create_input_stream(), h);
+
+        InputStream in = h.reply.create_input_stream();
+
+        if (h.isException)
+          {
+            // Write the exception information
+            gnuAny exc = new gnuAny();
+            GeneralHolder uku = new GeneralHolder(h.reply);
+            exc.insert_Streamable(uku);
+            request.set_exception(exc);
+          }
+        else
+          {
+            if (result != null)
+              {
+                // Use the holder for the return value, if provided.
+                result._read(in);
+
+                gnuAny r = new gnuAny();
+                r.insert_Streamable(result);
+                request.set_result(r);
+              }
+            else
+              {
+                // Use the universal holder otherwise.
+                gnuAny r = new gnuAny();
+                r.insert_Streamable(new StreamHolder(in));
+              }
+
+            // Unpack the arguments
+            for (int i = 0; i < args.count(); i++)
+              {
+                if ((args.item(i).flags() & OUT) != 0)
+                  {
+                    Any a = args.item(i).value();
+                    a.read_value(in, a.type());
+                  }
+              }
+          }
+      }
+    catch (Bounds ex)
+      {
+        throw new InternalError();
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SetOverrideTypeHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SetOverrideTypeHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SetOverrideTypeHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SetOverrideTypeHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,90 @@
+/* SetOverrideTypeHolder.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.CORBA;
+
+import org.omg.CORBA.SetOverrideType;
+import org.omg.CORBA.SetOverrideTypeHelper;
+
+/**
+ * The holder for SetOverrideType.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class SetOverrideTypeHolder
+  implements org.omg.CORBA.portable.Streamable
+{
+  /**
+   * The stored SetOverrideType value.
+   */
+  public SetOverrideType value;
+
+  /**
+   * Create the initialised instance.
+   *
+   * @param initialValue the initial value.
+   */
+  public SetOverrideTypeHolder(SetOverrideType initialValue)
+  {
+    value = initialValue;
+  }
+
+  /**
+   * Fill in the {@link value} by data from the CDR stream.
+   */
+  public void _read(org.omg.CORBA.portable.InputStream in)
+  {
+    value = SetOverrideTypeHelper.read(in);
+  }
+
+  /**
+   * Get the typecode of the SetOverrideType.
+   */
+  public org.omg.CORBA.TypeCode _type()
+  {
+    return SetOverrideTypeHelper.type();
+  }
+
+  /**
+   * Write the stored value into the CDR stream.
+   */
+  public void _write(org.omg.CORBA.portable.OutputStream out)
+  {
+    SetOverrideTypeHelper.write(out, value);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SimpleDelegate.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SimpleDelegate.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SimpleDelegate.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SimpleDelegate.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,294 @@
+/* Local_delegate.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.CORBA;
+
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+
+/**
+ * The delegate, implementing the basic functionality only. This delegate
+ * is set in {@link ORG.connect(org.omg.CORBA.Object)} if ORB
+ * determines that the object is an instance of the
+ * {@link org.omg.CORBA.portable.ObjectImpl} and no other delegate is set.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class SimpleDelegate
+  extends Delegate
+  implements IorProvider
+{
+  /**
+   * The orb.
+   */
+  protected final ORB orb;
+
+  /**
+   * The ior.
+   */
+  protected IOR ior;
+
+  public SimpleDelegate(ORB an_orb, IOR an_ior)
+  {
+    orb = an_orb;
+    ior = an_ior;
+  }
+
+  /**
+   * Set the IOR of this object. The IOR must be newly set if
+   * the server reports that the object has permanently moved to a new
+   * location.
+   *
+   * @param an_ior the new IOR.
+   */
+  public void setIor(IOR an_ior)
+  {
+    this.ior = an_ior;
+  }
+
+  /**
+   * Get the IOR of this object.
+   */
+  public IOR getIor()
+  {
+    return ior;
+  }
+
+  /**
+   * Not implemented.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public Request create_request(org.omg.CORBA.Object target, Context context,
+                                String operation, NVList parameters,
+                                NamedValue returns
+                               )
+  {
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Not implemented.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public Request create_request(org.omg.CORBA.Object target, Context context,
+                                String operation, NVList parameters,
+                                NamedValue returns, ExceptionList exceptions,
+                                ContextList ctx_list
+                               )
+  {
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Not implemented.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public org.omg.CORBA.Object duplicate(org.omg.CORBA.Object target)
+  {
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Performs direct comparison ('==').
+   */
+  public boolean equals(org.omg.CORBA.Object self, org.omg.CORBA.Object other)
+  {
+    return self == other;
+  }
+
+  /**
+   * Not implemented.
+   *
+   * @throws NO_IMPLEMENT, always.
+   */
+  public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object target)
+  {
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Return the hashcode (0 <= hashcode < maximum).
+   */
+  public int hash(org.omg.CORBA.Object target, int maximum)
+  {
+    return target == null ? 0 : target.hashCode() % maximum;
+  }
+
+  /**
+   * Delegates functionality to java.lang.Object.hashCode();
+   */
+  public int hashCode(org.omg.CORBA.Object target)
+  {
+    return target == null ? 0 : target.hashCode();
+  }
+
+  /**
+   * Check if this object can be referenced by the given repository id.
+   *
+   * @param target the CORBA object, must be an instance of
+   * {@link org.omg.CORBA.portable.ObjectImpl}.
+   *
+   * @param repositoryIdentifer the repository id.
+   *
+   * @return true if the passed parameter is a repository id of this
+   * CORBA object.
+   */
+  public boolean is_a(org.omg.CORBA.Object target, String repositoryIdentifer)
+  {
+    if (!(target instanceof ObjectImpl))
+      throw new NO_IMPLEMENT("Supported only for org.omg.CORBA.portable.ObjectImpl");
+
+    ObjectImpl imp = (ObjectImpl) target;
+    String[] ids = imp._ids();
+
+    for (int i = 0; i < ids.length; i++)
+      {
+        if (ids [ i ].equals(repositoryIdentifer))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Returns true if the objects are the same or have the same delegate set. All
+   * objects in this implementation have a separate delegate.
+   */
+  public boolean is_equivalent(org.omg.CORBA.Object target,
+    org.omg.CORBA.Object other)
+  {
+    if (target == other)
+      return true;
+    if ((target instanceof ObjectImpl) && other instanceof ObjectImpl)
+      {
+        try
+          {
+            org.omg.CORBA.portable.Delegate a = ((ObjectImpl) target)._get_delegate();
+            org.omg.CORBA.portable.Delegate b = ((ObjectImpl) other)._get_delegate();
+            if (a == b)
+              {
+                return true;
+              }
+            else
+              {
+                // We compere the IOR's in this case.
+                if (a instanceof IorProvider && b instanceof IorProvider)
+                  {
+                    IOR ia = ((IorProvider) a).getIor();
+                    IOR ib = ((IorProvider) b).getIor();
+
+                    if (ia != null && ib != null)
+                      return (ia.equals(ib));
+                    else
+                      return ia == ib;
+                  }
+              }
+            if (a != null && b != null)
+              {
+                return a.equals(b);
+              }
+          }
+        catch (Exception ex)
+          {
+            // Unable to get one of the delegates.
+            return false;
+          }
+      }
+    return false;
+  }
+
+  /**
+   * Returns true by default.
+   */
+  public boolean is_local(org.omg.CORBA.Object self)
+  {
+    return true;
+  }
+
+  /**
+   * Returns true if the target is null.
+   */
+  public boolean non_existent(org.omg.CORBA.Object target)
+  {
+    return target == null;
+  }
+
+  /**
+   * Returns the ORB, passed in constructor,
+   * regardless of the argument. This class requires a single instance
+   * per each object.
+   */
+  public ORB orb(org.omg.CORBA.Object target)
+  {
+    return orb;
+  }
+
+  /**
+   * Returns without action.
+   */
+  public void release(org.omg.CORBA.Object target)
+  {
+  }
+
+  /**
+   * This method assumes that the target is local and connected to the ORB.
+   */
+  public Request request(org.omg.CORBA.Object target, String operation)
+  {
+    if (orb instanceof OrbFunctional)
+      {
+        ((OrbFunctional) orb).ensureRunning();
+      }
+    gnuRequest g = new gnuRequest();
+    g.setORB(orb);
+    g.setOperation(operation);
+    g.setIor(ior);
+    g.m_target = target;
+    return g;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SocketRepository.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SocketRepository.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SocketRepository.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/SocketRepository.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,148 @@
+/* SocketRepository.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.CORBA;
+
+import java.net.Socket;
+import java.net.SocketException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * This class caches the opened sockets that are reused during the
+ * frequent calls. Otherwise, some CORBA applications may spend
+ * up to 90 % of the working time just for closing and opening the sockets.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class SocketRepository
+{
+  /**
+   * The socket map.
+   */
+  private static HashMap sockets = new HashMap();
+  
+  /**
+   * Put a socket. This method also discards all not reusable sockets from
+   * the map.
+   *
+   * @param key as socket key.
+   *
+   * @param s a socket.
+   */
+  public static void put_socket(Object key, Socket s)
+  {
+    synchronized (sockets)
+      {
+        sockets.put(key, s);
+        gc();
+      }
+  }
+  
+  /**
+   * Removes all non reusable sockets. As it is private,
+   * we know we call from the synchronized code already. 
+   */
+  private static void gc()
+  {
+    Iterator iter = sockets.entrySet().iterator();
+    
+    Map.Entry e;
+    Socket sx;
+    
+    while (iter.hasNext())
+      {
+        e = (Map.Entry) iter.next();
+        sx = (Socket) e.getValue();
+        
+        if (not_reusable(sx))
+          iter.remove();
+      }
+  }
+  
+  /**
+   * Return true if the socket is no longer reusable.
+   */
+  static boolean not_reusable(Socket s)
+  {
+    return (s.isClosed() || !s.isBound() || !s.isConnected() ||
+        s.isInputShutdown() || s.isOutputShutdown());
+  }
+
+  /**
+   * Get a socket.
+   * 
+   * @param key a socket key.
+   * 
+   * @return an opened socket for reuse, null if no such available or it is
+   * closed, its input or output has been shutown or otherwise the socket is not
+   * reuseable.
+   */
+  public static Socket get_socket(Object key)
+  {
+    synchronized (sockets)
+      {
+        Socket s = (Socket) sockets.get(key);
+        if (s == null)
+          return null;
+
+        // Ensure that the socket is fully reusable.
+        else if (not_reusable(s))
+          {
+            sockets.remove(key);
+            return null;
+          }
+        else
+          {
+            try
+              {
+                // Set one minute time out that will be changed later.
+                s.setSoTimeout(60 * 1000);
+              }
+            catch (SocketException e)
+              {
+                s = null;
+              }
+
+            sockets.remove(key);
+            return s;
+          }
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamBasedRequest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamBasedRequest.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamBasedRequest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamBasedRequest.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* gnuStreamRequest.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.CORBA;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
+/**
+ * A stream, additionally holding the gnu request.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class StreamBasedRequest
+  extends BufferedCdrOutput
+{
+  /**
+   * The enclosed request.
+   */
+  public gnuRequest request;
+
+  /**
+   * True if the response is expected.
+   */
+  public boolean response_expected = true;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StreamHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,123 @@
+/* StreamHolder.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.CORBA;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+import java.io.IOException;
+
+/**
+ * A holder that stores the input stream, from that the holder data
+ * can be read. There is no way to write the data into this holder.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class StreamHolder
+  implements Streamable
+{
+  /**
+   * The stream, holding the data for this holder.
+   */
+  protected final InputStream stream;
+
+  /**
+   * Create a holder that will read from the given stream.
+   *
+   * @param a_stream a stream.
+   */
+  public StreamHolder(InputStream a_stream)
+  {
+    stream = a_stream;
+  }
+
+  /**
+   * This method is not in use, should never be called.
+   */
+  public TypeCode _type()
+  {
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Writes the data from the stored stream into the provided
+   * output stream till the end of the input stream is reached.
+   *
+   * @throws MARSHAL if the IOException is thrown during operation.
+   */
+  public void _write(OutputStream output)
+  {
+    try
+      {
+        int d = stream.read();
+
+        while (d >= 0)
+          {
+            output.write(d);
+            d = stream.read();
+          }
+      }
+    catch (IOException ex)
+      {
+        MARSHAL m = new MARSHAL();
+        m.initCause(ex);
+        m.minor = Minor.CDR;
+        throw m;
+      }
+  }
+
+  /**
+   * This method is not in use, should never be called.
+   */
+  public void _read(InputStream input)
+  {
+    throw new NO_IMPLEMENT();
+  }
+
+  /**
+   * Get the input stream that has been passed in constructor.
+   */
+  InputStream getInputStream()
+  {
+    return stream;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StubLocator.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StubLocator.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StubLocator.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/StubLocator.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,110 @@
+/* StubLocator.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.CORBA;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.ObjectImpl;
+
+/**
+ * Finds a stub class like "_HelloStub" that can be instantiated
+ * from IOR reference. The returned object can be casted to the
+ * used type like "Hello" without using the helper .narrow method,
+ * and the object is not unnsecessarily re - instantiated if
+ * the .narrow method is used anyway. If no stub, matching the naming
+ * conventions, is available, the returned stub replacement can still be used
+ * to get the valid request, add parameter and invoke the method by name.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class StubLocator
+{
+  /**
+   * Search for the possibly available default stub.
+   *
+   * @param orb the current ORB. It is not required to find the binding
+   * classes, but is needed to instantiate the default implementation
+   * if no binding classes are found.
+   *
+   * @param ior the IOR, possibly containing the information about the
+   * correct implementation class.
+   */
+  public static ObjectImpl search(ORB orb, IOR ior)
+  {
+    try
+      {
+        int a = ior.Id.indexOf(':');
+        int b = ior.Id.lastIndexOf(':');
+
+        String s = ior.Id.substring(a + 1, b).replace('/', '.');
+
+        String path;
+
+        b = s.lastIndexOf('.');
+        if (b > 0)
+          path = s.substring(0, b + 1);
+        else
+          path = "";
+
+        String stub = "_" + s.substring(b + 1) + "Stub";
+
+        Class stubClass = ObjectCreator.forName(path + stub);
+
+        return (ObjectImpl) stubClass.newInstance();
+      }
+    catch (Exception failed)
+      {
+        // Various exceptions can be thrown if the Id cannot be parsed,
+        // the class is missing, cannot be instantiated or is not an
+        // instance of the ObjectImpl.
+        return createDefaultStub(orb, ior);
+      }
+  }
+
+  /**
+   * Return the default stub for the case when the client binding classes
+   * are not locally available. The returned stub can still be used
+   * to get the valid request, add parameter and invoke the method by name.
+   *
+   * @return the default implementation.
+   */
+  protected static ObjectImpl createDefaultStub(ORB orb, IOR ior)
+  {
+    return new IorObject(orb, ior);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeCodeHelper.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeCodeHelper.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeCodeHelper.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeCodeHelper.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,304 @@
+/* TypeCodeHelper.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.CORBA;
+
+import gnu.CORBA.typecodes.FixedTypeCode;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
+
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+
+/**
+ * Reads and writes the TypeCodes usind common data representation.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class TypeCodeHelper
+{
+  /**
+   * Read the CORBA {@link TypeCode}. First, the TypeCode kind
+   * is read as four byte long. Then, if needed, the additional
+   * parameters are loaded following CORBA specification.
+   *
+   * @param in a stream to read from.
+   */
+  public static TypeCode read(org.omg.CORBA.portable.InputStream in)
+                       throws BadKind, Bounds
+  {
+    TCKind kind = TCKind.from_int(in.read_long());
+    TypeCode rt;
+    GeneralTypeCode g;
+    RecordTypeCode r;
+    RecordTypeCode.Field f;
+    StringTypeCode s;
+    int n;
+
+    switch (kind.value())
+      {
+        case TCKind._tk_sequence :
+        case TCKind._tk_array :
+
+          ArrayTypeCode p = new ArrayTypeCode(kind);
+          p.setLength(in.read_long());
+          rt = p;
+          break;
+          
+        case TCKind._tk_string :
+        case TCKind._tk_wstring :
+          s = new StringTypeCode(kind);
+          s.setLength(in.read_long());
+          rt = s;
+          break;
+
+        case TCKind._tk_fixed :
+
+          FixedTypeCode fx = new FixedTypeCode();
+          fx.setDigits(in.read_short());
+          fx.setScale(in.read_short());
+          rt = fx;
+          break;
+
+        case TCKind._tk_objref :
+        case TCKind._tk_native :
+        case TCKind._tk_abstract_interface :
+          g = new GeneralTypeCode(kind);
+          g.setId(in.read_string());
+          g.setName(in.read_string());
+          rt = g;
+          break;
+
+        case TCKind._tk_alias :
+        case TCKind._tk_value_box :
+          g = new GeneralTypeCode(kind);
+          g.setId(in.read_string());
+          g.setName(in.read_string());
+          g.setContentType(in.read_TypeCode());
+          rt = g;
+          break;
+
+        case TCKind._tk_struct :
+        case TCKind._tk_except :
+          r = new RecordTypeCode(kind);
+          r.setId(in.read_string());
+          r.setName(in.read_string());
+
+          n = in.read_long();
+
+          for (int i = 0; i < n; i++)
+            {
+              f = r.field();
+              f.name = in.read_string();
+              f.type = in.read_TypeCode();
+            }
+          rt = r;
+          break;
+
+        case TCKind._tk_enum :
+          r = new RecordTypeCode(kind);
+          r.setId(in.read_string());
+          r.setName(in.read_string());
+
+          n = in.read_long();
+
+          for (int i = 0; i < n; i++)
+            {
+              f = r.field();
+              f.name = in.read_string();
+            }
+          rt = r;
+          break;
+
+        case TCKind._tk_union :
+          r = new RecordTypeCode(kind);
+          r.setId(in.read_string());
+          r.setName(in.read_string());
+          r.setDiscriminator_type(in.read_TypeCode());
+          r.setDefaultIndex(in.read_long());
+
+          n = in.read_long();
+
+          for (int i = 0; i < n; i++)
+            {
+              f = r.field();
+              f.label = in.read_any();
+              f.name = in.read_string();
+              f.type = in.read_TypeCode();
+            }
+          rt = r;
+
+          break;
+
+        case TCKind._tk_value :
+          r = new RecordTypeCode(kind);
+          r.setId(in.read_string());
+          r.setName(in.read_string());
+          r.setTypeModifier(in.read_short());
+          r.setConcreteBase_type(in.read_TypeCode());
+
+          n = in.read_long();
+
+          for (int i = 0; i < n; i++)
+            {
+              f = r.field();
+              f.name = in.read_string();
+              f.type = in.read_TypeCode();
+              f.visibility = in.read_short();
+            }
+          rt = r;
+          break;
+
+        default :
+          rt = new PrimitiveTypeCode(kind);
+      }
+    return rt;
+  }
+
+  /**
+   * Write the CORBA {@link TypeCode}. First, the TypeCode kind
+   * is written as four byte long. Then, if needed, the additional
+   * parameters are stored following CORBA specification.
+   *
+   * @param out a stream to write into.
+   * @param x a {@link TypeCode} to write.
+   */
+  public static void write(org.omg.CORBA.portable.OutputStream out, TypeCode x)
+                    throws BadKind, Bounds
+  {
+    out.write_long(x.kind().value());
+
+    switch (x.kind().value())
+      {
+        case TCKind._tk_string :
+        case TCKind._tk_wstring :
+          out.write_long(x.length());
+          break;
+
+        case TCKind._tk_sequence :
+        case TCKind._tk_array :
+          write(out, x.content_type());
+          out.write_long(x.length());
+          break;
+
+        case TCKind._tk_fixed :
+          out.write_short(x.fixed_digits());
+          out.write_short(x.fixed_scale());
+          break;
+
+        case TCKind._tk_objref :
+        case TCKind._tk_native :
+        case TCKind._tk_abstract_interface :
+          out.write_string(x.id());
+          out.write_string(x.name());
+          break;
+
+        case TCKind._tk_alias :
+        case TCKind._tk_value_box :
+          out.write_string(x.id());
+          out.write_string(x.name());
+          write(out, x.content_type());
+          break;
+
+        case TCKind._tk_struct :
+        case TCKind._tk_except :
+          out.write_string(x.id());
+          out.write_string(x.name());
+
+          out.write_long(x.member_count());
+
+          for (int i = 0; i < x.member_count(); i++)
+            {
+              out.write_string(x.member_name(i));
+              write(out, x.member_type(i));
+            }
+          break;
+
+        case TCKind._tk_enum :
+          out.write_string(x.id());
+          out.write_string(x.name());
+
+          out.write_long(x.member_count());
+
+          for (int i = 0; i < x.member_count(); i++)
+            {
+              out.write_string(x.member_name(i));
+            }
+          break;
+
+        case TCKind._tk_union :
+          out.write_string(x.id());
+          out.write_string(x.name());
+
+          write(out, x.discriminator_type());
+          out.write_long(x.default_index());
+
+          out.write_long(x.member_count());
+
+          for (int i = 0; i < x.member_count(); i++)
+            {
+              out.write_any(x.member_label(i));
+              out.write_string(x.member_name(i));
+              write(out, x.member_type(i));
+            }
+          break;
+
+        case TCKind._tk_value :
+          out.write_string(x.id());
+          out.write_string(x.name());
+          out.write_short(x.type_modifier());
+          write(out, x.concrete_base_type());
+
+          out.write_long(x.member_count());
+
+          for (int i = 0; i < x.member_count(); i++)
+            {
+              out.write_string(x.member_name(i));
+              write(out, x.member_type(i));
+              out.write_short(x.member_visibility(i));
+            }
+          break;
+
+        default :}
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeKindNamer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeKindNamer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeKindNamer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/TypeKindNamer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,183 @@
+/* primitiveTypes.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.CORBA;
+
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+
+/**
+ * A conveniency method for naming the built-in types.
+ * This is used in error reporting that is part of the user interface.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class TypeKindNamer
+{
+  /**
+   * Names of the primitve types.
+   */
+  protected static final String[] tk =
+    new String[]
+    {
+      "null", "void", "short", "long", "ushort", "ulong", "float", "double",
+      "boolean", "char", "octet", "any", "TypeCode", "Principal", "objref",
+      "struct", "union", "enum", "string", "sequence", "array", "alias",
+      "exception", "longlong", "ulonglong", "longdouble", "wchar", "wstring",
+      "fixed", "value", "value_box", "native", "abstract_interface"
+    };
+
+  /**
+   * Primitve TypeCodes.
+   */
+  protected static final TypeCode[] primitveCodes =
+    new TypeCode[]
+    {
+      new PrimitiveTypeCode(TCKind.tk_null),
+      new PrimitiveTypeCode(TCKind.tk_void),
+      new PrimitiveTypeCode(TCKind.tk_short),
+      new PrimitiveTypeCode(TCKind.tk_long),
+      new PrimitiveTypeCode(TCKind.tk_ushort),
+      new PrimitiveTypeCode(TCKind.tk_ulong),
+      new PrimitiveTypeCode(TCKind.tk_float),
+      new PrimitiveTypeCode(TCKind.tk_double),
+      new PrimitiveTypeCode(TCKind.tk_boolean),
+      new PrimitiveTypeCode(TCKind.tk_char),
+      new PrimitiveTypeCode(TCKind.tk_octet),
+      new PrimitiveTypeCode(TCKind.tk_any),
+      new PrimitiveTypeCode(TCKind.tk_TypeCode),
+      new PrimitiveTypeCode(TCKind.tk_Principal),
+      new RecordTypeCode(TCKind.tk_objref),
+      new PrimitiveTypeCode(TCKind.tk_struct),
+      new PrimitiveTypeCode(TCKind.tk_union),
+      new PrimitiveTypeCode(TCKind.tk_enum),
+      new PrimitiveTypeCode(TCKind.tk_string),
+      new PrimitiveTypeCode(TCKind.tk_sequence),
+      new PrimitiveTypeCode(TCKind.tk_array),
+      new PrimitiveTypeCode(TCKind.tk_alias),
+      new PrimitiveTypeCode(TCKind.tk_except),
+      new PrimitiveTypeCode(TCKind.tk_longlong),
+      new PrimitiveTypeCode(TCKind.tk_ulonglong),
+      new PrimitiveTypeCode(TCKind.tk_longdouble),
+      new PrimitiveTypeCode(TCKind.tk_wchar),
+      new PrimitiveTypeCode(TCKind.tk_wstring),
+      new PrimitiveTypeCode(TCKind.tk_fixed),
+      new PrimitiveTypeCode(TCKind.tk_value),
+      new PrimitiveTypeCode(TCKind.tk_value_box),
+      new PrimitiveTypeCode(TCKind.tk_native),
+      new PrimitiveTypeCode(TCKind.tk_abstract_interface)
+    };
+
+  static
+  {
+    // The Id of the "abstract object" is defined as empty string.
+    RecordTypeCode object =
+      (RecordTypeCode) primitveCodes [ TCKind._tk_objref ];
+    object.setId("");
+    object.setName("Object");
+  }
+
+  /**
+   * Get the primitive type code.
+   *
+   * @return the primitve type code, corresponding the passed value.
+   *
+   * @throws BadKind if this is not a primitive type code.
+   */
+  public static TypeCode getPrimitveTC(TCKind tc)
+                                throws BadKind
+  {
+    try
+      {
+        return primitveCodes [ tc.value() ];
+      }
+    catch (ArrayIndexOutOfBoundsException ex)
+      {
+        throw new BadKind(tc.value() + " is not a primitve type.");
+      }
+  }
+
+  /**
+   * Get the string name of the passed primitive type.
+   *
+   * @param kind the kind of the primitive type the must be defined
+   * in {@link omg.org.CORBA.TCKind}.
+   *
+   * @return the short string name, used in error reporting, etc.
+   */
+  public static String nameIt(int kind)
+  {
+    try
+      {
+        return tk [ kind ];
+      }
+    catch (ArrayIndexOutOfBoundsException ex)
+      {
+        return "type of kind '" + kind + "'";
+      }
+  }
+
+  /**
+   * Get the string name of the passed primitive type.
+   *
+   * @param kind the kind of the primitive type the must be defined
+   * in {@link omg.org.CORBA.TCKind}.
+   *
+   * @return the short string name, used in error reporting, etc.
+   */
+  public static String nameIt(TypeCode type)
+  {
+    try
+      {
+        if (type.kind().value() == TCKind._tk_array)
+          return "array of " + nameIt(type.content_type());
+        else if (type.kind().value() == TCKind._tk_sequence)
+          return "sequence of " + nameIt(type.content_type());
+        else
+          return nameIt(type.kind().value());
+      }
+    catch (Exception ex)
+      {
+        return "type of kind '" + type.kind().value() + "'";
+      }
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Unexpected.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Unexpected.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Unexpected.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Unexpected.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,128 @@
+/* DNW.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.CORBA;
+
+
+/**
+ * Contains the static method to throw an error in the case
+ * when the execution should never get into the current point.
+ *
+ * The error message contains the text, suggesting to check
+ * the user code first and then report a bug.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class Unexpected
+  extends InternalError
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The default message for the CORBA assertion error.
+   */
+  public static final String SHARED_MESSAGE =
+    "CORBA assertion error. Please check your code. " +
+    "If you think it is Classpath problem, please report " +
+    "this bug providing as much information as possible.";
+
+  /**
+   * Create an instance with explaining message and enclosing
+   * exception.
+   */
+  public Unexpected(String msg, Exception why)
+  {
+    super(msg + ". " + SHARED_MESSAGE);
+    if (why != null)
+      initCause(why);
+  }
+
+  /**
+   * Create an instance with enclosing exception.
+   */
+  public Unexpected(Exception why)
+  {
+    super(SHARED_MESSAGE);
+    if (why != null)
+      initCause(why);
+  }
+
+  /**
+   * Create an instance.
+   */
+  public Unexpected()
+  {
+    super(SHARED_MESSAGE);
+  }
+
+  /**
+   * Throws an error with the custom explaining message and
+   * the appended share message.
+   *
+   * @param msg the error message
+   * @param why the enclosing exception.
+   */
+  public static void error(String msg, Exception why)
+  {
+    throw new Unexpected(msg, why);
+  }
+
+  /**
+   * Throws an error with the shared explaining message.
+   *
+   * @param why the enclosing exception.
+   * @throws Error, always.
+   */
+  public static void error(Exception why)
+  {
+    throw new Unexpected(why);
+  }
+
+  /**
+   * Throws an error with the shared explaining message.
+   *
+   * @throws Error, always.
+   */
+  public static void error()
+  {
+    throw new Unexpected();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Version.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Version.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Version.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/Version.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,222 @@
+/* Version.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.CORBA;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+import org.omg.CORBA.MARSHAL;
+
+/**
+ * A version number, represented by the major version number
+ * and the minor version number.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class Version
+  implements Serializable
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * Major number (0..256, so the byte cannot be used).
+   */
+  public final int major;
+
+  /**
+   * Minor number.
+   */
+  public final int minor;
+
+  /**
+   * Create the version with the given version numbers.
+   *
+   * @param _major major number (0..255)
+   * @param _minor minor number (0..255)
+   */
+  public Version(int _major, int _minor)
+  {
+    major = (byte) _major;
+    minor = (byte) _minor;
+  }
+
+  /**
+   * Returns true if the versions are equal.
+   * @param other the other version to compare.
+   *
+   * @return true if the versions are equal
+   */
+  public boolean equals(java.lang.Object other)
+  {
+    if (other == this)
+      {
+        return true;
+      }
+    if (!(other instanceof Version))
+      {
+        return false;
+      }
+
+    Version that = (Version) other;
+    return same(that);
+  }
+  
+  /**
+   * Get the hashcode, higher 8 bits being the major version and lower 8 bits
+   * the minor version.
+   */
+  public int hashCode()
+  {
+    return major << 8 | minor;
+  }    
+
+  /**
+   * Read from the input stream, major number first.
+   * @param in a stream to read from.
+   */
+  public static Version read_version(java.io.InputStream in)
+  {
+    try
+      {
+        int major = in.read() & 0xFF;
+        int minor = in.read() & 0xFF;
+        return new Version(major, minor);
+      }
+    catch (IOException ex)
+      {
+        MARSHAL m = new MARSHAL("IOException while reading message header");
+        m.initCause(ex);
+        m.minor = Minor.Header;
+        throw m;
+      }
+  }
+
+  /**
+   * Returns true if the versions are the same.
+   *
+   * @param that the other version to compare.
+   *
+   * @return true if the versions are the same.
+   */
+  public boolean same(Version that)
+  {
+    return major == that.major && minor == that.minor;
+  }
+
+  /**
+   * Returns true if the given version is higher than
+   * or equals to the version, supplied as parameter
+   * in the form of two integers.
+   *
+   * @param a_major major number of the version to compare.
+   * @param a_minor minor number of the version to compare.
+   *
+   * @return true if this version is higher than or equals to
+   * the version v.
+   */
+  public boolean since_inclusive(int a_major, int a_minor)
+  {
+    if (major > a_major)
+      return true;
+    else if (major < a_major)
+      return false;
+    else
+
+      // Major numbers are equal.
+      return minor >= a_minor;
+  }
+
+  /**
+   * Return the string representation, in the form
+   * major.minor.
+   */
+  public String toString()
+  {
+    return major + "." + minor;
+  }
+
+  /**
+   * Returs true if the given version is lower or equal to the
+   * version, specified by the provided minor and major version
+   * number. This means, the version, specified by these two numbers,
+   * should be supported by the current version.
+   *
+   * @param a_major a major version number.
+   * @param a_minor a minor version number.
+   *
+   * @return true if the current version should be supported by the
+   * version, specified by the two passed numbers.
+   */
+  public boolean until_inclusive(int a_major, int a_minor)
+  {
+    if (major < a_major)
+      return true;
+    else if (major > a_major)
+      return false;
+    else
+
+      // Major numbers are equal.
+      return minor <= a_minor;
+  }
+
+  /**
+   * Write into the output stream, major number first.
+   *
+   * @param out a stream to write into.
+   */
+  public void write(java.io.OutputStream out)
+  {
+    try
+      {
+        out.write(major & 0xFF);
+        out.write(minor & 0xFF);
+      }
+    catch (IOException ex)
+      {
+        MARSHAL m = new MARSHAL("IOException while writing message header");
+        m.minor = Minor.Header;
+        m.initCause(ex);
+        throw m;
+      }
+  }
+ 
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WCharHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WCharHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WCharHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WCharHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,128 @@
+/* WCharHolder.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.CORBA;
+
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for CORBA <code>char</code> that is mapped into
+ * java <code>char</code>.
+ *
+ * The holders have several application areas. The end user usually
+ * sees them implementing CORBA methods where the primitive type
+ * is passed by reference. While CORBA (or, for example, C) supports
+ * this, the java does not and a wrapper class is required.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public final class WCharHolder
+  implements Streamable
+{
+  /**
+   * The default type code for this holder.
+   */
+  private static final TypeCode t_char = new PrimitiveTypeCode(TCKind.tk_wchar);
+
+  /**
+   * The <code>char</code> (CORBA <code>wchar</code>) value,
+   * held by this WCharHolder.
+   */
+  public char value;
+
+  /**
+   * Constructs an instance of WCharHolder,
+   * initializing {@link #value} to <code>0 </code>.
+   */
+  public WCharHolder()
+  {
+  }
+
+  /**
+   * Constructs an instance of WCharHolder,
+   * initializing {@link #value} to the given <code>char</code>.
+   *
+   * @param initial_value a value that will be assigned to the
+   * {@link #value} field.
+   */
+  public WCharHolder(char initial_value)
+  {
+    value = initial_value;
+  }
+
+  /**
+   * Fill in the {@link value } field by reading the required data
+   * from the given stream. For <code>char</code>, the functionality
+   * is delegated to
+   * {@link org.omg.CORBA.portable.InputStream#read_wchar}.
+   *
+   * @param input the input stream to read from.
+   */
+  public void _read(InputStream input)
+  {
+    value = input.read_wchar();
+  }
+
+  /**
+   * Returns the TypeCode, corresponding the CORBA type that is stored
+   * using this holder.
+   */
+  public TypeCode _type()
+  {
+    return t_char;
+  }
+
+  /**
+   * Write the {@link value } field to the given stream.
+   * For <code>char</code>, the functionality
+   * is delegated to
+   * {@link org.omg.CORBA.portable.OutputStream#write_wchar(char) }.
+   *
+   * @param output the output stream to write into.
+   */
+  public void _write(OutputStream output)
+  {
+    output.write_wchar(value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WStringHolder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WStringHolder.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WStringHolder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/WStringHolder.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,131 @@
+/* WStringHolder.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.CORBA;
+
+import gnu.CORBA.typecodes.StringTypeCode;
+
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for CORBA <code>wstring</code> that is mapped into
+ * java <code>String</code>. This holder writes and reads differently
+ * from the StringHolder.
+ *
+ * The holders have several application areas. The end user usually
+ * sees them implementing CORBA methods where the primitive type
+ * is passed by reference. While CORBA (or, for example, C) supports
+ * this, the java does not and a wrapper class is required.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class WStringHolder
+  implements Streamable
+{
+  /**
+   * The default type code for this holder.
+   */
+  private static final StringTypeCode t_string =
+    new StringTypeCode(TCKind.tk_wstring);
+
+  /**
+   * The <code>String</code> (CORBA <code>string</code>) value,
+   * held by this WStringHolder.
+   */
+  public String value;
+
+  /**
+   * Constructs an instance of WStringHolder,
+   * initializing {@link #value} to <code>null</code>.
+   */
+  public WStringHolder()
+  {
+  }
+
+  /**
+   * Constructs an instance of WStringHolder,
+   * initializing {@link #value} to the given <code>String</code>.
+   *
+   * @param initial_value a value that will be assigned to the
+   * {@link #value} field.
+   */
+  public WStringHolder(String initial_value)
+  {
+    value = initial_value;
+  }
+
+  /**
+   * Fill in the {@link #value } field by reading the required data
+   * from the given stream. For <code>string</code>, the functionality
+   * is delegated to
+   * {@link org.omg.CORBA.portable.InputStream#read_wstring}.
+   *
+   * @param input the input stream to read from.
+   */
+  public void _read(InputStream input)
+  {
+    value = input.read_wstring();
+  }
+
+  /**
+   * Returns the TypeCode, corresponding the CORBA type that is stored
+   * using this holder. The {@link TypeCode#length()} method of the
+   * returned typecode always returns 0.
+   */
+  public TypeCode _type()
+  {
+    return t_string;
+  }
+
+  /**
+   * Write the {@link #value } field to the given stream.
+   * For <code>string</code>, the functionality
+   * is delegated to
+   * {@link org.omg.CORBA.portable.OutputStream#write_wstring(String) }.
+   *
+   * @param output the output stream to write into.
+   */
+  public void _write(OutputStream output)
+  {
+    output.write_wstring(value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/_PolicyImplBase.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/_PolicyImplBase.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/_PolicyImplBase.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/_PolicyImplBase.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,232 @@
+/* _PolicyImplBase.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.CORBA;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.PolicyHelper;
+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 server side implementation base for the {@link Policy}.
+ *
+ * @specnote The java 1.4 API does not define the server side policy
+ * implementation base, but it defines the policy client side stub.
+ * As these two classes always work together, and even no separate testing is
+ * possible, the required implementation base is provided in gnu.CORBA
+ * namespace. Sun will probably include they base in the future java APIs.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public abstract class _PolicyImplBase
+  extends ObjectImpl
+  implements Policy, InvokeHandler
+{
+  /**
+   * Use serialVersionUID for interoperability.
+   */
+  private static final long serialVersionUID = 1;
+
+  /**
+   * The policy repository ids.
+   */
+  private final String[] ids;
+
+  /**
+   * The type of this policy.
+   */
+  private final int type;
+
+  /**
+   * The value of this policy. The value object is never the same
+   * for different policies.
+   */
+  private final java.lang.Object value;
+
+  /**
+   * The policy integer code, written in request to write
+   * the policy value.
+   */
+  private final int policyCode;
+
+  /**
+   * Create the new policy of the given type, having the given value.
+   * For security reasons, the method is kept package private.
+   *
+   * @param p_type the type of this policy.
+   * @param p_value the value of this policy.
+   * @param p_code the integer code of this policy.
+   * @param p_idl the policy IDL type string. The {@link #_ids()}
+   * will return array, first line being this string and another
+   * being PolicyHelper.id().
+   */
+  public _PolicyImplBase(int p_type, java.lang.Object p_value, int p_code,
+                         String p_idl
+                        )
+  {
+    type = p_type;
+    value = p_value;
+    policyCode = p_code;
+    ids = new String[] { p_idl, PolicyHelper.id() };
+  }
+
+  /**
+   * Get the integer code of the type of this policy.
+   */
+  public final int policy_type()
+  {
+    return type;
+  }
+
+  /**
+   * Return the list of repository ids.
+   */
+  public final String[] _ids()
+  {
+    return ids;
+  }
+
+  /**
+   * Call the required method.
+   */
+  public final OutputStream _invoke(String method, InputStream input,
+                                    ResponseHandler rh
+                                   )
+  {
+    OutputStream output = null;
+
+    if (method.equals("destroy"))
+      {
+        // The "destroy" has been invoked.
+        destroy();
+        output = rh.createReply();
+      }
+    else if (method.equals("copy"))
+      {
+        // The "copy" has been invoked.
+        org.omg.CORBA.Object returns = copy();
+        output = rh.createReply();
+        output.write_Object(this);
+      }
+    else if (method.equals("policy_type"))
+      {
+        // The "policy_type" has been invoked.
+        int returns = policy_type();
+        output = rh.createReply();
+        output.write_long(returns);
+      }
+    else if (method.equals("value"))
+      {
+        // The "value" can be invoked on the children types
+        // and must return an integer, representing the policy value
+        // (CORBA enumeration).
+        output = rh.createReply();
+        output.write_long(policyCode);
+      }
+    else
+      throw new BAD_OPERATION(method, Minor.Method, 
+        CompletionStatus.COMPLETED_MAYBE);
+
+    return output;
+  }
+
+  /**
+   * Get the value of this policy
+   */
+  public final java.lang.Object getValue()
+  {
+    return value;
+  }
+
+  /**
+   * Get the integer code of this policy value.
+   */
+  public final int getCode()
+  {
+    return policyCode;
+  }
+
+  /**
+   * Returns without action. It is a work of garbage collector
+   * to remove the unused objects.
+   */
+  public final void destroy()
+  {
+  }
+
+  /**
+   * Returns the string representation of the given policy.
+   */
+  public final String toString()
+  {
+    return value.toString();
+  }
+
+  /**
+   * Create a copy of this policy. The object is not mutable, so
+   * <code>this</code> can be returned.
+   *
+   * @return <code>this</code>
+   */
+  public Policy copy()
+  {
+    return this;
+  }
+
+  /**
+   * Use the value to get a hash code.
+   */
+  public int hashCode()
+  {
+    return getValue().hashCode();
+  }
+
+  /**
+   * Check the values for equality.
+   */
+  public boolean equals(Object x)
+  {
+    return x == null ? false : getValue().equals(x);
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuAny.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuAny.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuAny.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuAny.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,907 @@
+/* gnuAny.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.CORBA;
+
+import gnu.CORBA.CDR.Vio;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.AnyHolder;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BooleanHolder;
+import org.omg.CORBA.CharHolder;
+import org.omg.CORBA.DoubleHolder;
+import org.omg.CORBA.FixedHolder;
+import org.omg.CORBA.FloatHolder;
+import org.omg.CORBA.IntHolder;
+import org.omg.CORBA.LongHolder;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ObjectHolder;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.PrincipalHolder;
+import org.omg.CORBA.ShortHolder;
+import org.omg.CORBA.StringHolder;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodeHolder;
+import org.omg.CORBA.ValueBaseHolder;
+import org.omg.CORBA.portable.Streamable;
+
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.zip.Adler32;
+
+/**
+ * The implementation of {@link Any}.
+ *
+ * For performance reasonse, the inserted values are not cloned.
+ * If the value object allows modifications (like {@link Streamable}),
+ * these subsequent alterations are reflected by the instance of
+ * this gnuAny, and the gnuAny alterations are reflected by the
+ * returned value. If it is required to have the uncoupled value,
+ * it must be requested from the copy of the current instance.
+ * The {@link gnuAny} can be simply cloned by the provided
+ * {@link Clone()} method.
+ *
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class gnuAny
+  extends Any
+{
+  /** 
+   * Use serialVersionUID for interoperability. 
+   */
+  private static final long serialVersionUID = 1;
+  
+  /**
+   * The value, returned by {@link #type()} if the value has been
+   * not intialized.
+   */
+  protected static final TypeCode nullType =
+    new PrimitiveTypeCode(TCKind.tk_null);
+
+  /**
+   * The Streamable, representing the value, held by this gnuAny.
+   */
+  protected Streamable has;
+
+  /**
+   * The complete typecode of the Streamable, if explicitly set.
+   */
+  protected TypeCode typecode;
+
+  /**
+   * The typecode kind of the Streamable, if explicitly set.
+   */
+  protected int xKind = -1;
+
+  /**
+   * The associated ORB.
+   */
+  private ORB orb;
+
+  /**
+   * Set the associated orb.
+   */
+  public void setOrb(ORB an_orb)
+  {
+    orb = an_orb;
+  }
+
+  /**
+   * Creates a deep copy of this gnuAny, writing to and subsequently
+   * reading from from the byte buffer.
+   *
+   * @return the uncoupled gnuAny with all fields set to identical
+   * values.
+   */
+  public gnuAny Clone()
+  {
+    BufferedCdrOutput out = new BufferedCdrOutput();
+    out.setOrb(orb);
+    out.write_any(this);
+
+    BufferredCdrInput in = new BufferredCdrInput(out.buffer.toByteArray());
+    in.setOrb(orb);
+    return (gnuAny) in.read_any();
+  }
+
+  /**
+   * Create the buffered CDR input stream, containing the
+   * value, stored inside of this {@link Any}.
+   */
+  public org.omg.CORBA.portable.InputStream create_input_stream()
+  {
+    if (has instanceof GeneralHolder)
+      {
+        GeneralHolder u = (GeneralHolder) has;
+        return u.getInputStream();
+      }
+    else
+      {
+        BufferedCdrOutput out = new BufferedCdrOutput();
+        out.setOrb(orb);
+        write_value(out);
+
+        BufferredCdrInput in = new BufferredCdrInput(out.buffer.toByteArray());
+        in.setOrb(orb);
+        return in;
+      }
+  }
+
+  /**
+   * Create the buffered CDR output stream (empty).
+   */
+  public org.omg.CORBA.portable.OutputStream create_output_stream()
+  {
+    BufferedCdrOutput stream = new BufferedCdrOutput();
+    stream.setOrb(orb);
+    return stream;
+  }
+
+  /**
+   * Compare two Any's for equality.
+   * @param other the other Any to compare.
+   */
+  public boolean equal(Any other)
+  {
+    if (other == this)
+      return true;
+    if (type().kind() != other.type().kind())
+      return false;
+
+    if (has != null && other instanceof gnuAny)
+      if (has.equals(((gnuAny) other).has))
+        return true;
+
+    BufferedCdrOutput a = new BufferedCdrOutput();
+    a.setOrb(orb);
+    write_value(a);
+
+    BufferedCdrOutput b = new BufferedCdrOutput();
+    b.setOrb(orb);
+    other.write_value(b);
+
+    byte[] ba = a.buffer.toByteArray();
+    byte[] bb = b.buffer.toByteArray();
+
+    return Arrays.equals(ba, bb);
+  }
+  
+  /**
+   * Get the content - dependent hashcode.
+   */
+  public int hashCode()
+  {
+    if (has == null)
+      return type().kind().value();
+    else
+      {
+        Adler32 adler = new Adler32();
+
+        BufferedCdrOutput a = new BufferedCdrOutput();
+        a.setOrb(orb);
+        write_value(a);
+        
+        adler.update(a.buffer.toByteArray());
+        adler.update(type().kind().value());
+        
+        return (int) adler.getValue() & Integer.MAX_VALUE;
+      }
+  }
+
+  /**
+   * Delegates functionality to {@link #equal(Any)}.
+   */
+  public boolean equals(java.lang.Object other)
+  {
+    if (other == this)
+      return true;
+    if (!(other instanceof Any))
+      return false;
+
+    return equal((Any) other);
+  }
+
+  /**
+   * Extract the previously stored object.
+   */
+  public org.omg.CORBA.Object extract_Object()
+  {
+    try
+      {
+        return ((ObjectHolder) has).value;
+      }
+    catch (ClassCastException ex)
+      {
+        BAD_OPERATION bad = new BAD_OPERATION();
+        bad.initCause(ex);
+        bad.minor = Minor.Any;
+        throw bad;
+      }
+  }
+
+  /**
+   * Extract the previously inserted CORBA <code>Principal</code>/
+   * @return the previously inserted value.
+   *
+   * @throws org.omg.CORBA.BAD_OPERATION if the holder contains something
+   * else than Principal.
+   *
+   * @deprecated by CORBA 2.2.
+   */
+  public Principal extract_Principal()
+  {
+    check(TCKind._tk_Principal);
+    return ((PrincipalHolder) has).value;
+  }
+
+  /**
+   * Return the value, encapsulated in a suitable holder.
+   * This implementation returns the direct reference,
+   * so the alterations on the returned streamable are
+   * directly reflected to the content of this {@link Any}.
+   */
+  public Streamable extract_Streamable()
+  {
+    return has;
+  }
+
+  public TypeCode extract_TypeCode()
+                            throws BAD_OPERATION
+  {
+    check(TCKind._tk_TypeCode);
+    return ((TypeCodeHolder) has).value;
+  }
+
+  /**
+   * Extract the stored value type.
+   *
+   * @return the previously stored value type.
+   *
+   * @throws BAD_OPERATION if the Any contains something different.
+   *
+   * @see org.omg.CORBA.portable.ValueBase
+   */
+  public Serializable extract_Value()
+                             throws BAD_OPERATION
+  {
+    try
+      {
+        if (has instanceof ValueBaseHolder)
+          return ((ValueBaseHolder) has).value;
+        else
+          {
+            // Normally, ValueBase holder must be an instance of the
+            // ValueBaseHolder. However some IDL compilers probably
+            // have a bug, do not deriving this way. The the only
+            // way to access the wrapped value is via reflection.
+            Field f = has.getClass().getField("value");
+            return (Serializable) f.get(has);
+          }
+      }
+    catch (Exception ex)
+      {
+        BAD_OPERATION bad = new BAD_OPERATION("Value type expected");
+        bad.minor = Minor.Any;
+        bad.initCause(ex);
+        throw bad;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public Any extract_any()
+                  throws BAD_OPERATION
+  {
+    check(TCKind._tk_any);
+    return ((AnyHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public boolean extract_boolean()
+                          throws BAD_OPERATION
+  {
+    check(TCKind._tk_boolean);
+    return ((BooleanHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public char extract_char()
+                    throws BAD_OPERATION
+  {
+    check(TCKind._tk_char);
+    return ((CharHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public double extract_double()
+                        throws BAD_OPERATION
+  {
+    check(TCKind._tk_double);
+    return ((DoubleHolder) has).value;
+  }
+
+  /**
+   * Extract the previously inserted CORBA <code>fixed</code>/
+   * @return the previously inserted value.
+   *
+   * @throws org.omg.CORBA.BAD_OPERATION if the holder contains something
+   * else than BigDecimal.
+   */
+  public BigDecimal extract_fixed()
+                           throws org.omg.CORBA.BAD_OPERATION
+  {
+    check(TCKind._tk_fixed);
+    return ((FixedHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public float extract_float()
+                      throws BAD_OPERATION
+  {
+    check(TCKind._tk_float);
+    return ((FloatHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public int extract_long()
+                   throws BAD_OPERATION
+  {
+    // CORBA long = java int.
+    check(TCKind._tk_long);
+    return ((IntHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public long extract_longlong()
+                        throws BAD_OPERATION
+  {
+    check(TCKind._tk_longlong);
+    return ((LongHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public byte extract_octet()
+                     throws BAD_OPERATION
+  {
+    // ShortHolder holds also octets.
+    check(TCKind._tk_octet);
+    return (byte) ((OctetHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public short extract_short()
+                      throws BAD_OPERATION
+  {
+    check(TCKind._tk_short);
+    return ((ShortHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public String extract_string()
+                        throws BAD_OPERATION
+  {
+    check(TCKind._tk_string);
+    return ((StringHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public int extract_ulong()
+                    throws BAD_OPERATION
+  {
+    // IntHolder also holds ulongs.
+    check(TCKind._tk_ulong);
+    return ((IntHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public long extract_ulonglong()
+                         throws BAD_OPERATION
+  {
+    // LongHolder also holds ulonglong
+    check(TCKind._tk_ulonglong);
+    return ((LongHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public short extract_ushort()
+                       throws BAD_OPERATION
+  {
+    // ShortHolder also holds ushorts.
+    check(TCKind._tk_ushort);
+    return ((ShortHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public char extract_wchar()
+                     throws BAD_OPERATION
+  {
+    check(TCKind._tk_wchar);
+    return ((WCharHolder) has).value;
+  }
+
+  /** {@inheritDoc} */
+  public String extract_wstring()
+                         throws BAD_OPERATION
+  {
+    // StringHolder also holds wstrings.
+    check(TCKind._tk_wstring);
+    return ((WStringHolder) has).value;
+  }
+
+  /**
+   * Inserts the CORBA object and sets the typecode to the given type.
+   */
+  public void insert_Object(org.omg.CORBA.Object x, TypeCode typecode)
+  {
+    has = new ObjectHolder(x);
+    type(typecode);
+  }
+
+  /**
+   * Inserts the CORBA object.
+   */
+  public void insert_Object(org.omg.CORBA.Object x)
+  {
+    has = new ObjectHolder(x);
+  }
+
+  /**
+   * Insert the CORBA Principal.
+   * This implementation uses direct assignment, so the later
+   * alterations of that BigDecimal are reflected on the
+   * content of this {@link Any}.
+   *
+   * @deprecated by CORBA 2.2.
+   */
+  public void insert_Principal(Principal x)
+  {
+    resetTypes();
+    if (has instanceof PrincipalHolder)
+      ((PrincipalHolder) has).value = x;
+    else
+      has = new PrincipalHolder(x);
+  }
+
+  /**
+   * Sets the value to the value, encapsulated in this holder.
+   * This implementation uses direct assignment, so the later
+   * alterations of that streamable are reflected on the
+   * content of this {@link Any}.
+   */
+  public void insert_Streamable(Streamable x)
+  {
+    resetTypes();
+    has = x;
+  }
+
+  /**
+   * Insert the typecode into this Any
+   * @param typecode the typecode to insert.
+   */
+  public void insert_TypeCode(TypeCode typecode)
+  {
+    resetTypes();
+    if (has instanceof TypeCodeHolder)
+      ((TypeCodeHolder) has).value = typecode;
+    else
+      has = new TypeCodeHolder(typecode);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_Value(Serializable x, TypeCode c_typecode)
+  {
+    if (typecode != null && typecode.kind() == TCKind.tk_value_box)
+      {
+        has = new gnuValueHolder(x, typecode);
+      }
+    else
+      {
+        type(typecode);
+        insert_Value(x);
+      }
+  }
+
+  /** {@inheritDoc} */
+  public void insert_Value(Serializable x)
+  {
+    if (typecode != null && typecode.kind() == TCKind.tk_value_box)
+      {
+        has = new gnuValueHolder(x, typecode);
+      }
+    else
+      {
+        if (has instanceof ValueBaseHolder)
+          ((ValueBaseHolder) has).value = x;
+        else
+          has = new ValueBaseHolder(x);
+      }
+  }
+
+  /**
+  * Insert another {@link Any} into this {@link Any}.
+  * This implementation uses direct assignment, so the later
+  * alterations of that {@link Any} are reflected on the
+  * content of this {@link Any}.
+  */
+  public void insert_any(Any an_any)
+  {
+    resetTypes();
+    if (has instanceof AnyHolder)
+      ((AnyHolder) has).value = an_any;
+    else
+      has = new AnyHolder(an_any);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_boolean(boolean x)
+  {
+    resetTypes();
+    if (has instanceof BooleanHolder)
+      ((BooleanHolder) has).value = x;
+    else
+      has = new BooleanHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_char(char x)
+  {
+    resetTypes();
+    if (has instanceof CharHolder)
+      ((CharHolder) has).value = x;
+    else
+      has = new CharHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_double(double x)
+  {
+    resetTypes();
+    if (has instanceof DoubleHolder)
+      ((DoubleHolder) has).value = x;
+    else
+      has = new DoubleHolder(x);
+  }
+
+  /**
+   * Inserts the CORBA <code>fixed</code>, setting the typecode
+   * explicitly.
+   * This implementation uses direct assignment, so the later
+   * alterations of that BigDecimal are reflected on the
+   * content of this {@link Any}.
+   */
+  public void insert_fixed(BigDecimal x, TypeCode x_typecode)
+  {
+    resetTypes();
+    insert_fixed(x);
+    typecode = x_typecode;
+  }
+
+  /**
+   * Inserts the CORBA <code>fixed</code>, setting the typecode
+   * by example of the currently passed value.
+   * This implementation uses direct assignment, so the later
+   * alterations of that BigDecimal are reflected on the
+   * content of this {@link Any}, including the typecode.
+   */
+  public void insert_fixed(BigDecimal x)
+  {
+    resetTypes();
+    if (has instanceof FixedHolder)
+      ((FixedHolder) has).value = x;
+    else
+      has = new FixedHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_float(float x)
+  {
+    resetTypes();
+    if (has instanceof FloatHolder)
+      ((FloatHolder) has).value = x;
+    else
+      has = new FloatHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_long(int x)
+  {
+    resetTypes();
+    if (has instanceof IntHolder)
+      ((IntHolder) has).value = x;
+    else
+      has = new IntHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_longlong(long x)
+  {
+    resetTypes();
+    if (has instanceof LongHolder)
+      ((LongHolder) has).value = x;
+    else
+      has = new LongHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_octet(byte x)
+  {
+    resetTypes();
+    if (has instanceof OctetHolder)
+      ((OctetHolder) has).value = x;
+    else
+      has = new OctetHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_short(short x)
+  {
+    resetTypes();
+    if (has instanceof ShortHolder)
+      ((ShortHolder) has).value = x;
+    else
+      has = new ShortHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_string(String x)
+  {
+    resetTypes();
+    if (has instanceof StringHolder)
+      ((StringHolder) has).value = x;
+    else
+      has = new StringHolder(x);
+
+    typecode = new StringTypeCode(TCKind.tk_string);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ulong(int x)
+  {
+    resetTypes();
+    if (has instanceof IntHolder)
+      ((IntHolder) has).value = x;
+    else
+      has = new IntHolder(x);
+    xKind = TCKind._tk_ulong;
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ulonglong(long x)
+  {
+    resetTypes();
+    if (has instanceof LongHolder)
+      ((LongHolder) has).value = x;
+    else
+      has = new LongHolder(x);
+    xKind = TCKind._tk_ulonglong;
+  }
+
+  /** {@inheritDoc} */
+  public void insert_ushort(short x)
+  {
+    resetTypes();
+    if (has instanceof ShortHolder)
+      ((ShortHolder) has).value = x;
+    else
+      has = new ShortHolder(x);
+    xKind = TCKind._tk_ushort;
+  }
+
+  /** {@inheritDoc} */
+  public void insert_wchar(char x)
+  {
+    resetTypes();
+    if (has instanceof WCharHolder)
+      ((WCharHolder) has).value = x;
+    else
+      has = new WCharHolder(x);
+  }
+
+  /** {@inheritDoc} */
+  public void insert_wstring(String x)
+  {
+    resetTypes();
+    if (has instanceof WStringHolder)
+      ((WStringHolder) has).value = x;
+    else
+      has = new WStringHolder(x);
+  }
+
+  /**
+   * Return the associated orb.
+   */
+  public ORB orb()
+  {
+    return orb;
+  }
+
+  /**
+   * Read the value of the given type from the given stream.
+   *
+   * @param input a stream to read from.
+   * @param a_type a typecode of the value to read.
+   */
+  public void read_value(org.omg.CORBA.portable.InputStream input,
+                         TypeCode a_type
+                        )
+                  throws MARSHAL
+  {
+    try
+      {
+        int kind = a_type.kind().value();
+
+        // Fixed needs special handling.
+        if (kind == TCKind._tk_fixed)
+          {
+            BigDecimal dec = BigDecimalHelper.read(input, a_type.fixed_scale());
+            has = new FixedHolder(dec);
+          }
+        else
+          {
+            has = HolderLocator.createHolder(a_type);
+            if (has == null)
+              {
+                // Use the Universal Holder that reads till the end of stream.
+                // This works with the extract/insert pair of the typical
+                // Helper.
+                BufferedCdrOutput buffer = new BufferedCdrOutput();
+                buffer.setOrb(orb);
+                has = new GeneralHolder(buffer);
+              }
+          }
+        type(a_type);
+
+        if (!(has instanceof GeneralHolder) &&
+            (kind == TCKind._tk_value_box))
+          {
+            // The streamable only contains operations for
+            // reading the value, not the value header.
+            Field vField = has.getClass().getField("value");
+
+            Object content = Vio.read(input, a_type.id());
+            vField.set(has, content);
+          }
+        else
+          has._read(input);
+      }
+    catch (Exception ex)
+      {
+        MARSHAL m = new MARSHAL();
+        m.minor = Minor.Any;
+        m.initCause(ex);
+        throw m;
+      }
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode type()
+  {
+    if (typecode != null)
+      return typecode;
+    else if (xKind >= 0)
+      {
+        typecode = new PrimitiveTypeCode(TCKind.from_int(xKind));
+        return typecode;
+      }
+    else
+      return has != null ? has._type() : nullType;
+  }
+
+  /**
+   * Explicitly set the typecode of the value to the given type.
+   *
+   * @param valueTypeCode the typecode of the value.
+   */
+  public void type(TypeCode valueTypeCode)
+  {
+    xKind = valueTypeCode.kind().value();
+    typecode = valueTypeCode;
+  }
+
+  /** {@inheritDoc} */
+  public void write_value(org.omg.CORBA.portable.OutputStream output)
+  {
+    if (has != null)
+      has._write(output);
+    else
+    // These kinds support null.
+    if (xKind == TCKind._tk_null || xKind == TCKind._tk_objref ||
+        xKind == TCKind._tk_value || xKind == TCKind._tk_value_box
+       )
+      output.write_long(0);
+  }
+
+  /**
+   * Check if the current value if the value of the given kind.
+   * 
+   * @param kind a kind to check.
+   * @throws BAD_OPERATION if the value is not set of is different kind.
+   */
+  protected void check(int kind)
+    throws BAD_OPERATION
+  {
+    if (has == null)
+      {
+        BAD_OPERATION bad = new BAD_OPERATION("value not set");
+        bad.minor = Minor.Any;
+        throw bad;
+      }
+
+    if (xKind >= 0)
+      {
+        if (xKind != kind)
+          if (!(xKind == TCKind._tk_alias && has._type().kind().value() == kind))
+            {
+              BAD_OPERATION bad = new BAD_OPERATION("Extracting "
+                + TypeKindNamer.nameIt(kind) + " when stored "
+                + TypeKindNamer.nameIt(xKind));
+              bad.minor = Minor.Any;
+              throw bad;
+            }
+      }
+    else
+      {
+        if (type().kind().value() != kind)
+          if (!(type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind))
+            {
+              BAD_OPERATION bad = new BAD_OPERATION("Extracting "
+                + TypeKindNamer.nameIt(kind) + " stored "
+                + TypeKindNamer.nameIt(type()));
+              bad.minor = Minor.Any;
+              throw bad;
+            }
+      }
+  }
+
+  /**
+   * Clear the additional type information before reusing this instance.
+   */
+  private final void resetTypes()
+  {
+    typecode = null;
+    xKind = -1;
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuCodecFactory.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuCodecFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuCodecFactory.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,90 @@
+/* gnuCodecFactory.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.CORBA;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.ORB;
+import org.omg.IOP.Codec;
+import org.omg.IOP.CodecFactory;
+import org.omg.IOP.CodecFactoryPackage.UnknownEncoding;
+import org.omg.IOP.ENCODING_CDR_ENCAPS;
+import org.omg.IOP.Encoding;
+
+/**
+ * A simple implementation of the Codec factory, able to return the
+ * standard Codec's. Only ENCODING_CDR_ENCAPS encoding is supported.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA at Bioinformatics.org)
+ */
+public class gnuCodecFactory extends LocalObject implements CodecFactory
+{
+  /**
+   * The associated ORB.
+   */
+  private final ORB orb;
+
+  /**
+   * Create a new instance of the this factory, associated with the given ORB.
+   */
+  public gnuCodecFactory(ORB an_orb)
+  {
+    orb = an_orb;
+  }
+
+  /**
+   * Creates the Codec for the given encoding.
+   *
+   * @param for_encoding the encoding for that the Codec must be created.
+   *
+   * @return the suitable Codec.
+   *
+   * @throws UnknownEncoding if the encoding is not a ENCODING_CDR_ENCAPS.
+   */
+  public Codec create_codec(Encoding for_encoding) throws UnknownEncoding
+  {
+    if (for_encoding.format != ENCODING_CDR_ENCAPS.value)
+      throw new UnknownEncoding("Only ENCODING_CDR_ENCAPS is " +
+        "supported by this factory."
+      );
+
+    return new CdrEncapsCodecImpl(orb,
+      new Version(for_encoding.major_version, for_encoding.minor_version)
+    );
+  }
+}
\ No newline at end of file

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContext.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContext.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,202 @@
+/* gnuContext.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.CORBA;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.CTX_RESTRICT_SCOPE;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.NVList;
+
+/**
+ * The working implementation of the {@link org.omg.CORBA.Context}.
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class gnuContext
+  extends Context
+{
+  /**
+   * The parent context.
+   */
+  Context parent;
+
+  /**
+   * The collection to store the context properties.
+   */
+  Map properties = new Hashtable();
+
+  /**
+   * The name of this context.
+   */
+  String name;
+
+  /**
+   * Creates the new context with the given name and parent.
+   *
+   * @param a_name a name of the new context.
+   * @param a_parent a parent, used to resolve the missing references.
+   */
+  public gnuContext(String a_name, Context a_parent)
+  {
+    name = a_name;
+    parent = a_parent;
+  }
+
+  /** {@inheritDoc} */
+  public String context_name()
+  {
+    return name;
+  }
+
+  /** {@inheritDoc} */
+  public Context create_child(String child)
+  {
+    return new gnuContext(child, this);
+  }
+
+  /** {@inheritDoc} */
+  public void delete_values(String property)
+  {
+    boolean starts = false;
+    if (property.endsWith("*"))
+      {
+        starts = true;
+        property = property.substring(0, property.length() - 1);
+      }
+
+    Set keys = properties.keySet();
+
+    Iterator iter = keys.iterator();
+    while (iter.hasNext())
+      {
+        String key = (String) iter.next();
+        if ((starts && key.startsWith(property)) ||
+            (!starts && key.equals(property))
+           )
+          iter.remove();
+      }
+  }
+
+  /** {@inheritDoc} */
+  public NVList get_values(String start_scope, int flags, String pattern)
+  {
+    if (start_scope != null)
+      {
+        Context c = this;
+        while (c != null && !c.context_name().equals(start_scope))
+          c = c.parent();
+        if (c == null)
+          return new gnuNVList();
+      }
+
+    try
+      {
+        gnuNVList rt = new gnuNVList();
+
+        boolean starts = false;
+        if (pattern.endsWith("*"))
+          {
+            starts = true;
+            pattern = pattern.substring(0, pattern.length() - 1);
+          }
+
+        Set keys = properties.keySet();
+
+        Iterator iter = keys.iterator();
+        while (iter.hasNext())
+          {
+            String key = (String) iter.next();
+            if ((starts && key.startsWith(pattern)) ||
+                (!starts && key.equals(pattern))
+               )
+              {
+                rt.add_value(key, (Any) properties.get(key), 0);
+              }
+          }
+
+        if ((flags & CTX_RESTRICT_SCOPE.value) == 0 && parent != null)
+          {
+            NVList par = parent.get_values(start_scope, flags, pattern);
+            for (int i = 0; i < par.count(); i++)
+              {
+                rt.list.add(par.item(i));
+              }
+          }
+
+        return rt;
+      }
+    catch (Bounds ex)
+      {
+        throw new Error("Report this bug.");
+      }
+  }
+
+  /** {@inheritDoc} */
+  public Context parent()
+  {
+    return parent;
+  }
+
+  /** {@inheritDoc} */
+  public void set_one_value(String name, Any value)
+  {
+    properties.put(name, value);
+  }
+
+  /** {@inheritDoc} */
+  public void set_values(NVList values)
+  {
+    try
+      {
+        for (int i = 0; i < values.count(); i++)
+          {
+            properties.put(values.item(i).name(), values.item(i).value());
+          }
+      }
+    catch (Bounds ex)
+      {
+        throw new Error("Please report this bug.");
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContextList.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContextList.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContextList.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuContextList.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,83 @@
+/* gnuContextList.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.CORBA;
+
+import java.util.ArrayList;
+
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.ContextList;
+
+/**
+ * The working implementation of the {@link org.omg.CORBA.ContextList}.
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class gnuContextList
+  extends ContextList
+{
+  /**
+   * The collection, holding the actual list of strings.
+   */
+  CorbaList strings = new CorbaList();
+
+  /** {@inheritDoc} */
+  public void add(String name)
+  {
+    strings.add(name);
+  }
+
+  /** {@inheritDoc} */
+  public int count()
+  {
+    return strings.size();
+  }
+
+  /** {@inheritDoc} */
+  public String item(int at)
+              throws Bounds
+  {
+    return (String) strings.item(at);
+  }
+
+  /** {@inheritDoc} */
+  public void remove(int at)
+              throws Bounds
+  {
+    strings.drop(at);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuEnvironment.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuEnvironment.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuEnvironment.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuEnvironment.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,72 @@
+/* gnuEnvironment.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.CORBA;
+
+import org.omg.CORBA.Environment;
+
+/**
+ * The implementation of the exception container ("Environment").
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class gnuEnvironment
+  extends Environment
+{
+  /**
+   * The stored exception.
+   */
+  protected Exception exception;
+  
+  /** {@inheritDoc} */
+  public void clear()
+  {
+    exception = null;
+  }
+
+  /** {@inheritDoc} */
+  public void exception(Exception except)
+  {
+    exception = except;
+  }
+
+  /** {@inheritDoc} */
+  public Exception exception()
+  {
+    return exception;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuExceptionList.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuExceptionList.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuExceptionList.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuExceptionList.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,84 @@
+/* gnuExceptionList.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.CORBA;
+
+import java.util.ArrayList;
+
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.TypeCode;
+
+/**
+ * The implementation of the list of type codes for exceptions.
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org).
+ */
+public class gnuExceptionList
+  extends ExceptionList
+{
+  /**
+   * A list to store the objects.
+   */
+  protected CorbaList list = new CorbaList();
+
+  /** {@inheritDoc} */
+  public void add(TypeCode an_exception)
+  {
+    list.add(an_exception);
+  }
+
+  /** {@inheritDoc} */
+  public int count()
+  {
+    return list.size();
+  }
+
+  /** {@inheritDoc} */
+  public TypeCode item(int at)
+                throws Bounds
+  {
+    return (TypeCode) list.item(at);
+  }
+
+  /** {@inheritDoc} */
+  public void remove(int at)
+              throws Bounds
+  {
+    list.drop(at);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNVList.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNVList.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNVList.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNVList.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,127 @@
+/* gnuNVList.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.CORBA;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+
+/**
+ * The implementation of {@link NVList}.
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class gnuNVList
+  extends NVList
+{
+  /**
+   * The list of the named values.
+   */
+  protected CorbaList list;
+
+  /**
+   * Creates the list with the default initial size.
+   */
+  public gnuNVList()
+  {
+    list = new CorbaList();
+  }
+
+  /**
+   * Creates the list with the given initial size.
+   */
+  public gnuNVList(int initial_size)
+  {
+    list = new CorbaList(initial_size);
+  }
+
+  /** {@inheritDoc} */
+  public NamedValue add(int a_flags)
+  {
+    return add_value(null, new gnuAny(), a_flags);
+  }
+
+  /** {@inheritDoc} */
+  public NamedValue add_item(String a_name, int a_flags)
+  {
+    return add_value(a_name, new gnuAny(), a_flags);
+  }
+
+  /** {@inheritDoc} */
+  public NamedValue add_value(String a_name, Any a_value, int a_flags)
+  {
+    gnuNamedValue n = new gnuNamedValue();
+    n.setName(a_name);
+    n.setValue(a_value);
+    n.setFlags(a_flags);
+    list.add(n);
+    return n;
+  }
+
+  /**
+   * Add the given named value to the list directly.
+   *
+   * @param value the named vaue to add.
+   */
+  public void add(NamedValue value)
+  {
+    list.add(value);
+  }
+
+
+  /** {@inheritDoc} */
+  public int count()
+  {
+    return list.size();
+  }
+
+  /** {@inheritDoc} */
+  public NamedValue item(int at)
+                  throws Bounds
+  {
+    return (NamedValue) list.item(at);
+  }
+
+  /** {@inheritDoc} */
+  public void remove(int at)
+              throws Bounds
+  {
+    list.drop(at);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNamedValue.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNamedValue.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNamedValue.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/gnu/CORBA/gnuNamedValue.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,112 @@
+/* gnuNamedValue.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.CORBA;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.NamedValue;
+
+/**
+ * The implementation of the named value.
+ * @author Audrius Meskauskas (AudriusA at Bioinformatics.org)
+ */
+public class gnuNamedValue
+  extends NamedValue
+{
+  /**
+   * The named value value.
+   */
+  private Any m_value = new gnuAny();
+
+  /**
+   * The named value name.
+   */
+  private String m_name;
+
+  /**
+   * The named value flags.
+   */
+  private int m_flags;
+
+  /**
+   * Set the flags, the normally expected values are
+   * {@link org.omg.CORBA.ARG_IN#value},
+   * {@link org.omg.CORBA.ARG_OUT#value} and
+   * {@link org.omg.CORBA.ARG_INOUT#value}.
+   */
+  public void setFlags(int flags)
+  {
+    m_flags = flags;
+  }
+
+  /**
+   * Set the name of the value.
+   * @param name the name of this value
+   */
+  public void setName(String name)
+  {
+    m_name = name;
+  }
+
+  /**
+   * Set the value of the value.
+   * @param value the value of this object.
+   */
+  public void setValue(Any value)
+  {
+    m_value = value;
+  }
+
+  /** {@inheritDoc} */
+  public int flags()
+  {
+    return m_flags;
+  }
+
+  /** {@inheritDoc} */
+  public String name()
+  {
+    return m_name;
+  }
+
+  /** {@inheritDoc} */
+  public Any value()
+  {
+    return m_value;
+  }
+}





More information about the llvm-commits mailing list