PatchSet 5585 
Date: 2005/03/21 19:16:19
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: CORBA fixes

2005-03-19  Audrius Meskauskas  <[EMAIL PROTECTED]>

        * org/omg/CORBA/AnySeqHolder.java,
        org/omg/CORBA/AnySeqHelper.java,
        org/omg/CORBA/CompletionStatusHelper.java:
        New files.

Members: 
        libraries/javalib/Makefile.am:1.327->1.328 
        libraries/javalib/Makefile.in:1.414->1.415 
        libraries/javalib/all.files:1.107->1.108 
        libraries/javalib/org/omg/CORBA/AnySeqHelper.java:INITIAL->1.1 
        libraries/javalib/org/omg/CORBA/AnySeqHolder.java:INITIAL->1.1 
        
libraries/javalib/org/omg/CORBA/CompletionStatusHelper.java:INITIAL->1.1 

Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.327 
kaffe/libraries/javalib/Makefile.am:1.328
--- kaffe/libraries/javalib/Makefile.am:1.327   Tue Mar 15 01:57:21 2005
+++ kaffe/libraries/javalib/Makefile.am Mon Mar 21 19:16:19 2005
@@ -4419,6 +4419,8 @@
        org/omg/CORBA/ARG_OUT.java \
        org/omg/CORBA/Any.java \
        org/omg/CORBA/AnyHolder.java \
+       org/omg/CORBA/AnySeqHelper.java \
+       org/omg/CORBA/AnySeqHolder.java \
        org/omg/CORBA/BAD_CONTEXT.java \
        org/omg/CORBA/BAD_INV_ORDER.java \
        org/omg/CORBA/BAD_OPERATION.java \
@@ -4434,6 +4436,7 @@
        org/omg/CORBA/CharSeqHelper.java \
        org/omg/CORBA/CharSeqHolder.java \
        org/omg/CORBA/CompletionStatus.java \
+       org/omg/CORBA/CompletionStatusHelper.java \
        org/omg/CORBA/Context.java \
        org/omg/CORBA/ContextList.java \
        org/omg/CORBA/DATA_CONVERSION.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.414 
kaffe/libraries/javalib/Makefile.in:1.415
--- kaffe/libraries/javalib/Makefile.in:1.414   Wed Mar 16 10:31:36 2005
+++ kaffe/libraries/javalib/Makefile.in Mon Mar 21 19:16:19 2005
@@ -5028,6 +5028,8 @@
        org/omg/CORBA/ARG_OUT.java \
        org/omg/CORBA/Any.java \
        org/omg/CORBA/AnyHolder.java \
+       org/omg/CORBA/AnySeqHelper.java \
+       org/omg/CORBA/AnySeqHolder.java \
        org/omg/CORBA/BAD_CONTEXT.java \
        org/omg/CORBA/BAD_INV_ORDER.java \
        org/omg/CORBA/BAD_OPERATION.java \
@@ -5043,6 +5045,7 @@
        org/omg/CORBA/CharSeqHelper.java \
        org/omg/CORBA/CharSeqHolder.java \
        org/omg/CORBA/CompletionStatus.java \
+       org/omg/CORBA/CompletionStatusHelper.java \
        org/omg/CORBA/Context.java \
        org/omg/CORBA/ContextList.java \
        org/omg/CORBA/DATA_CONVERSION.java \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.107 
kaffe/libraries/javalib/all.files:1.108
--- kaffe/libraries/javalib/all.files:1.107     Tue Mar 15 01:57:23 2005
+++ kaffe/libraries/javalib/all.files   Mon Mar 21 19:16:20 2005
@@ -3823,6 +3823,8 @@
 org/omg/CORBA/ARG_OUT.java
 org/omg/CORBA/Any.java
 org/omg/CORBA/AnyHolder.java
+org/omg/CORBA/AnySeqHelper.java
+org/omg/CORBA/AnySeqHolder.java
 org/omg/CORBA/BAD_CONTEXT.java
 org/omg/CORBA/BAD_INV_ORDER.java
 org/omg/CORBA/BAD_OPERATION.java
@@ -3838,6 +3840,7 @@
 org/omg/CORBA/CharSeqHelper.java
 org/omg/CORBA/CharSeqHolder.java
 org/omg/CORBA/CompletionStatus.java
+org/omg/CORBA/CompletionStatusHelper.java
 org/omg/CORBA/Context.java
 org/omg/CORBA/ContextList.java
 org/omg/CORBA/DATA_CONVERSION.java
===================================================================
Checking out kaffe/libraries/javalib/org/omg/CORBA/AnySeqHelper.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/org/omg/CORBA/AnySeqHelper.java,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/org/omg/CORBA/AnySeqHelper.java     Mon Mar 21 
19:20:57 2005
@@ -0,0 +1,147 @@
+/* AnySeqHelper.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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 org.omg.CORBA;
+
+import gnu.CORBA.primitiveArrayTypeCode;
+
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * Provides static helper methods for working with
+ * the array of the type [EMAIL PROTECTED] Any} (not with the "any array").
+ *
+ * @author Audrius Meskauskas ([EMAIL PROTECTED])
+ */
+public abstract class AnySeqHelper
+{
+  /**
+   * Extract the array of [EMAIL PROTECTED] Any}'s from the
+   * given [EMAIL PROTECTED] Any}. This implementation expects the
+   * [EMAIL PROTECTED] Any} to hold the instance of [EMAIL PROTECTED] 
AnySeqHolder}
+   * that is returned by [EMAIL PROTECTED] Any#extract_Streamable() }.
+   *
+   * @param a an Any to extract the array from.
+   *
+   * @return the extracted array.
+   *
+   * @throws ClassCastException if the Any contains something other than the
+   * the [EMAIL PROTECTED] AnySeqHolder}.
+   */
+  public static Any[] extract(Any a)
+  {
+    AnySeqHolder h = (AnySeqHolder) a.extract_Streamable();
+    return h.value;
+  }
+
+  /**
+   * Returns the agreed Id, delegating functionality to
+   * the [EMAIL PROTECTED] #type()}.id().
+   */
+  public static String id()
+  {
+    try
+      {
+        return type().id();
+      }
+    catch (BadKind ex)
+      {
+        // Should never happen under correct work.
+        throw new Error("Please report this bug.", ex);
+      }
+  }
+
+  /**
+  * Insert into the given [EMAIL PROTECTED] Any}[] into the
+  * given [EMAIL PROTECTED] Any}. This implementation first creates
+  * a [EMAIL PROTECTED] AnySeqHolder} and then calls
+  * [EMAIL PROTECTED] Any#insert_Streamable(Streamable)}.
+  *
+  * @param into the target Any.
+  * @param that the array to insert.
+  */
+  public static void insert(Any into, Any[] that)
+  {
+    AnySeqHolder holder = new AnySeqHolder(that);
+    into.insert_Streamable(holder);
+  }
+
+  /**
+   * Reads the [EMAIL PROTECTED] Any}[] from the CORBA input stream.
+   * This implementation first creates an instance of
+   * [EMAIL PROTECTED] AnySeqHolder} and then delegates functionality
+   * to its <code>_read()</code> method.
+   *
+   * @param input the CORBA (not java.io) stream to read from.
+   * @return the value from the stream.
+   */
+  public static Any[] read(InputStream input)
+  {
+    AnySeqHolder h = new AnySeqHolder();
+    h._read(input);
+    return h.value;
+  }
+
+  /**
+   * Creates and returns a new instance of the TypeCode,
+   * corresponding the array of [EMAIL PROTECTED] Any}'s.
+   * The length of the sequence is left with the initial
+   * value 0.
+   */
+  public static TypeCode type()
+  {
+    return new primitiveArrayTypeCode(TCKind.tk_any);
+  }
+
+  /**
+   * Writes the array of [EMAIL PROTECTED] Any}'s into the given stream.
+   * This implementation first creates an instance of
+   * [EMAIL PROTECTED] AnySeqHolder} and then delegates functionality
+   * to its <code>_write()</code> method.
+   *
+   * @param output the CORBA (not java.io) output stream to write.
+   * @param value the value that must be written.
+   */
+  public static void write(OutputStream output, Any[] value)
+  {
+    AnySeqHolder h = new AnySeqHolder(value);
+    h._write(output);
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/org/omg/CORBA/AnySeqHolder.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/org/omg/CORBA/AnySeqHolder.java,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/org/omg/CORBA/AnySeqHolder.java     Mon Mar 21 
19:20:57 2005
@@ -0,0 +1,128 @@
+/* AnySeqHolder.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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 org.omg.CORBA;
+
+import gnu.CORBA.primitiveArrayTypeCode;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A sequence holder for CORBA <code>AnySeq</code> that is mapped into
+ * java <code>Any[]</code>.
+ *
+ * @author Audrius Meskauskas ([EMAIL PROTECTED])
+ */
+public final class AnySeqHolder
+  implements Streamable
+{
+  /**
+   * The <code>Any[]</code> (CORBA <code>AnySeq</code>) value,
+   * held by this AnySeqHolder.
+   */
+  public Any[] value;
+
+  /**
+   * The type code for this holder. Each holder has a different instance.
+   */
+  private final primitiveArrayTypeCode typecode =
+    new primitiveArrayTypeCode(TCKind.tk_any);
+
+  /**
+   * Constructs an instance of AnySeqHolder,
+   * initializing [EMAIL PROTECTED] #value} to <code>null</code>.
+   */
+  public AnySeqHolder()
+  {
+  }
+
+  /**
+   * Constructs an instance of AnySeqHolder,  
+   * initializing [EMAIL PROTECTED] #value} to the given array
+   */
+  public AnySeqHolder(Any [] a_value)
+  {
+    value = a_value;
+  }
+
+  /**
+   * Fill in the [EMAIL PROTECTED] value } field by reading the required data
+   * from the given stream. This method first reads the array size
+   * (as CORBA <code>long</code>and then all Any's.
+   *
+   * @param input the input stream to read from.
+   */
+  public void _read(InputStream input)
+  {
+    value = new Any[ input.read_long() ];
+    for (int i = 0; i < value.length; i++)
+      {
+        value [ i ] = input.read_any();
+      }
+    typecode.setLength(value.length);
+  }
+
+  /**
+   * Returns the TypeCode, corresponding the CORBA type that is stored
+   * using this holder.
+   */
+  public TypeCode _type()
+  {
+    return typecode;
+  }
+
+  /**
+   * Write the [EMAIL PROTECTED] value } field to the given stream.
+   * This method first writes the array size
+   * (as CORBA <code>long</code> and then all Any's.
+   *
+   * @param output the output stream to write into.
+   */
+  public void _write(OutputStream output)
+  {
+    output.write_long(value.length);
+
+    for (int i = 0; i < value.length; i++)
+      {
+        output.write_any(value [ i ]);
+      }
+  }
+
+}
===================================================================
Checking out kaffe/libraries/javalib/org/omg/CORBA/CompletionStatusHelper.java
RCS:  
/home/cvs/kaffe/kaffe/libraries/javalib/org/omg/CORBA/CompletionStatusHelper.java,v
VERS: 1.1
***************
--- /dev/null   Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/org/omg/CORBA/CompletionStatusHelper.java   Mon Mar 
21 19:20:57 2005
@@ -0,0 +1,116 @@
+/* CompletionStatusHelper.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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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 org.omg.CORBA;
+
+import gnu.CORBA.primitiveArrayTypeCode;
+
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * Provides static helper methods for working with
+ * [EMAIL PROTECTED] CompletionStatus}.
+ *
+ * @author Audrius Meskauskas ([EMAIL PROTECTED])
+ */
+public abstract class CompletionStatusHelper
+{
+  /**
+   * Extract the [EMAIL PROTECTED] CompletionStatus} from the
+   * given [EMAIL PROTECTED] Any}. This implementation expects
+   * the integer (Corba long) value, stating the completion
+   * status.
+   *
+   * @param a an Any to extract the completion status from.
+   *
+   * @return completion status
+   */
+  public static CompletionStatus extract(Any a)
+  {
+    return CompletionStatus.from_int(a.extract_long());
+  }
+
+  /**
+   * Returns the agreed Id. 
+   * @return <code>IDL:omg.org/CORBA/CompletionStatus:1.0</code>, always.
+   */
+  public static String id()
+  {
+    return "IDL:omg.org/CORBA/CompletionStatus:1.0";
+  }
+
+  /**
+  * Insert into the given [EMAIL PROTECTED] CompletionStatus} into the
+  * given [EMAIL PROTECTED] Any}. This implementation inserts it as an
+  * integer (CORBA long).
+  *
+  * @param into the target Any.
+  * @param that the [EMAIL PROTECTED] CompletionStatus} to insert.
+  */
+  public static void insert(Any into, CompletionStatus that)
+  {
+    into.insert_long(that.value());
+  }
+
+  /**
+   * Reads the [EMAIL PROTECTED] CompletionStatus} from the CORBA input stream.
+   * This implementation reads an an integer (CORBA long).
+   *
+   * @param input the CORBA (not java.io) stream to read from.
+   * @return the value from the stream.
+   */
+  public static CompletionStatus read(InputStream input)
+  {
+    return CompletionStatus.from_int(input.read_long());
+  }
+
+  /**
+   * Writes the [EMAIL PROTECTED] CompletionStatus} into the given stream.
+   * This implementation writes an int (CORBA long), corresponding
+   * the status of completion.
+   *
+   * @param output the CORBA (not java.io) output stream to write.
+   * @param status the value that must be written.
+   */
+  public static void write(OutputStream output, CompletionStatus status)
+  {
+    output.write_long(status.value());
+  }
+}

_______________________________________________
kaffe mailing list
[email protected]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to