summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog44
-rw-r--r--gnu/CORBA/CDR/Vio.java170
-rw-r--r--gnu/CORBA/CDR/cdrInput.java3
-rw-r--r--gnu/CORBA/CDR/cdrOutput.java2
-rw-r--r--gnu/CORBA/CDR/noHeaderInput.java166
-rw-r--r--gnu/CORBA/DynAn/NameValuePairHolder.java7
-rw-r--r--gnu/CORBA/DynAn/abstractDynAny.java177
-rw-r--r--gnu/CORBA/DynAn/abstractRecord.java405
-rw-r--r--gnu/CORBA/DynAn/anyDivideable.java514
-rw-r--r--gnu/CORBA/DynAn/anyUndivideable.java493
-rw-r--r--gnu/CORBA/DynAn/gnuDynAny.java985
-rw-r--r--gnu/CORBA/DynAn/gnuDynAnyFactory.java356
-rw-r--r--gnu/CORBA/DynAn/gnuDynArray.java338
-rw-r--r--gnu/CORBA/DynAn/gnuDynEnum.java250
-rw-r--r--gnu/CORBA/DynAn/gnuDynFixed.java257
-rw-r--r--gnu/CORBA/DynAn/gnuDynSequence.java254
-rw-r--r--gnu/CORBA/DynAn/gnuDynStruct.java109
-rw-r--r--gnu/CORBA/DynAn/gnuDynUnion.java439
-rw-r--r--gnu/CORBA/DynAn/gnuDynValue.java395
-rw-r--r--gnu/CORBA/DynAn/gnuDynValueBox.java389
-rw-r--r--gnu/CORBA/DynAn/valueChangedListener.java50
-rw-r--r--gnu/CORBA/Poa/ORB_1_4.java11
-rw-r--r--gnu/CORBA/Restricted_ORB.java9
-rw-r--r--gnu/CORBA/fixedTypeCode.java14
-rw-r--r--gnu/CORBA/gnuAny.java94
-rw-r--r--gnu/CORBA/gnuValueHolder.java135
-rw-r--r--gnu/CORBA/holderFactory.java123
-rw-r--r--gnu/CORBA/typeNamer.java13
-rw-r--r--gnu/CORBA/universalHolder.java23
-rw-r--r--org/omg/CORBA/Any.java12
-rw-r--r--org/omg/CORBA/ORB.java4
-rw-r--r--org/omg/CORBA/ObjectHelper.java7
-rw-r--r--org/omg/CORBA/ObjectHolder.java17
-rw-r--r--org/omg/CORBA/TypeCode.java66
-rw-r--r--org/omg/CORBA_2_3/portable/InputStream.java13
-rw-r--r--org/omg/CORBA_2_3/portable/OutputStream.java2
-rw-r--r--org/omg/DynamicAny/DynAnyFactoryHelper.java4
-rw-r--r--org/omg/DynamicAny/DynAnyFactoryOperations.java5
-rw-r--r--org/omg/DynamicAny/DynAnyOperations.java82
-rw-r--r--org/omg/DynamicAny/DynUnionOperations.java24
-rw-r--r--org/omg/DynamicAny/DynValueBox.java4
-rw-r--r--org/omg/DynamicAny/DynValueCommon.java6
42 files changed, 6233 insertions, 238 deletions
diff --git a/ChangeLog b/ChangeLog
index f8af15964..4b755795f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+2005-08-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/noHeaderInput.java,
+ gnu/CORBA/gnuValueHolder.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynArray.java,
+ gnu/CORBA/DynAn/gnuDynSequence.java,
+ gnu/CORBA/DynAn/gnuDynValueBox.java,
+ gnu/CORBA/DynAn/abstractRecord.java,
+ gnu/CORBA/DynAn/gnuDynAnyFactory.java,
+ gnu/CORBA/DynAn/gnuDynValue.java,
+ gnu/CORBA/DynAn/gnuDynStruct.java,
+ gnu/CORBA/DynAn/anyDivideable.java,
+ gnu/CORBA/DynAn/anyUndivideable.java,
+ gnu/CORBA/DynAn/gnuDynEnum.java,
+ gnu/CORBA/DynAn/abstractDynAny.java,
+ gnu/CORBA/DynAn/gnuDynFixed.java,
+ gnu/CORBA/DynAn/valueChangedListener.java,
+ gnu/CORBA/DynAn/gnuDynUnion.java: New files.
+ * org/omg/DynamicAny/DynUnionOperations.java,
+ org/omg/DynamicAny/DynAnyOperations.java,
+ org/omg/DynamicAny/DynAnyFactoryOperations.java,
+ org/omg/DynamicAny/DynValueBox.java,
+ org/omg/DynamicAny/DynValueCommon.java,
+ org/omg/DynamicAny/DynAnyFactoryHelper.java,
+ gnu/CORBA/typeNamer.java,
+ gnu/CORBA/fixedTypeCode.java,
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/holderFactory.java,
+ gnu/CORBA/universalHolder.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/gnuAny.java,
+ org/omg/CORBA/TypeCode.java
+ org/omg/CORBA/Any.java,
+ org/omg/CORBA/ORB.java,
+ org/omg/CORBA/ObjectHelper.java,
+ org/omg/CORBA/ObjectHolder.java,
+ org/omg/CORBA_2_3/portable/InputStream.java,
+ org/omg/CORBA_2_3/portable/OutputStream.java,
+ gnu/CORBA/DynAn/NameValuePairHolder.java: Rewritten.
+
2005-08-06 Jeroen Frijters <jeroen@frijters.net>
* java/io/ObjectInputStream.java
diff --git a/gnu/CORBA/CDR/Vio.java b/gnu/CORBA/CDR/Vio.java
index 8f17bd2f5..d7a749dd6 100644
--- a/gnu/CORBA/CDR/Vio.java
+++ b/gnu/CORBA/CDR/Vio.java
@@ -46,6 +46,7 @@ import org.omg.CORBA.DataOutputStream;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.portable.*;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
@@ -55,6 +56,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
+import java.lang.reflect.Method;
+
/**
* A specialised class for reading and writing the value types.
*
@@ -222,7 +225,7 @@ public abstract class Vio
throw new MARSHAL("Unable to instantiate the value type");
else
{
- read_instance(input, ox, value_tag);
+ read_instance(input, ox, value_tag, null);
return (Serializable) ox;
}
}
@@ -285,7 +288,7 @@ public abstract class Vio
}
}
- read_instance(input, ox, value_tag);
+ read_instance(input, ox, value_tag, null);
return (Serializable) ox;
}
catch (Exception ex)
@@ -301,17 +304,22 @@ public abstract class Vio
* an instance.
*
* @param input a stream to read from.
- * @param value_instance an instance of the value.
+ *
+ * @param value_instance an pre-created instance of the value. If the
+ * helper is not null, this parameter is ignored an should be null.
+ *
+ * @param helper a helper to create an instance and read the object-
+ * specific part of the record. If the value_instance is used instead,
+ * this parameter should be null.
*
* @return the loaded value.
*
* @throws MARSHAL if the reading has failed due any reason.
*/
- public static Serializable read(InputStream input, Serializable value_instance)
+ public static Object read(InputStream input, Object value_instance,
+ Object helper
+ )
{
- // Explicitly prevent the stream from closing as we may need
- // to read the subsequent bytes as well. Stream may be auto-closed
- // in its finalizer.
try
{
int value_tag = input.read_long();
@@ -345,8 +353,9 @@ public abstract class Vio
}
}
- read_instance(input, value_instance, value_tag);
- return (Serializable) value_instance;
+ value_instance =
+ read_instance(input, value_instance, value_tag, helper);
+ return value_instance;
}
catch (Exception ex)
{
@@ -355,18 +364,43 @@ public abstract class Vio
}
/**
+ * Read using provided boxed value helper. This method expects
+ * the full value type header, followed by contents, that are
+ * delegated to the provided helper. It handles null.
+ *
+ * @param input the stream to read from.
+ * @param helper the helper that reads the type-specific part of
+ * the content.
+ *
+ * @return the value, created by the helper, or null if the
+ * header indicates that null was previously written.
+ */
+ public static Serializable read(InputStream input, Object helper)
+ {
+ return (Serializable) read(input, null, helper);
+ }
+
+ /**
* Fill in the instance fields by the data from the input stream.
* The method assumes that the value header, if any, is already
* behind. The information from the stream is stored into the
* passed ox parameter.
*
* @param input an input stream to read from.
- * @param value a value type object, must be either Streamable or
- * CustomMarshal.
+ *
+ * @param value a pre-instantiated value type object, must be either
+ * Streamable or CustomMarshal. If the helper is used, this parameter
+ * is ignored and should be null.
+ *
+ * @param value_tag the tag that must be read previously.
+ * @param helper the helper for read object specific part; may be
+ * null to read in using other methods.
+ *
+ * @return the value that was read.
*/
- public static void read_instance(InputStream input, Object value,
- int value_tag
- )
+ private static Object read_instance(InputStream input, Object value,
+ int value_tag, Object helper
+ )
{
try
{
@@ -377,7 +411,7 @@ public abstract class Vio
// Read all chunks.
int chunk_size = input.read_long();
- if (chunk_size <= 0)
+ if (chunk_size < 0)
throw new MARSHAL("Invalid first chunk size " + chunk_size);
byte[] r = new byte[ chunk_size ];
@@ -412,12 +446,29 @@ public abstract class Vio
// More than one chunk was present.
// Add the last chunk.
bout.write(r, 0, n);
- input = new cdrBufInput(bout.toByteArray());
+ input = new noHeaderInput(bout.toByteArray());
}
else
{
// Only one chunk was present.
- input = new cdrBufInput(r);
+ input = new noHeaderInput(r);
+ }
+ }
+ else
+ {
+ if (input instanceof cdrBufInput)
+ {
+ // Highly probable case.
+ input =
+ new noHeaderInput(((cdrBufInput) input).buffer.getBuffer());
+ }
+ else
+ {
+ cdrBufOutput bout = new cdrBufOutput();
+ int c;
+ while ((c = input.read()) >= 0)
+ bout.write((byte) c);
+ input = new noHeaderInput(bout.buffer.toByteArray());
}
}
}
@@ -447,6 +498,11 @@ public abstract class Vio
{
((Streamable) value)._read(input);
}
+ else if (helper instanceof BoxedValueHelper)
+ value = ((BoxedValueHelper) helper).read_value(input);
+ else if (helper instanceof ValueFactory)
+ value =
+ ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input);
else
// Stating the interfaces that the USER should use.
@@ -462,6 +518,8 @@ public abstract class Vio
if (eor >= 0)
throw new MARSHAL("End of state marker has an invalid value " + eor);
}
+
+ return value;
}
/**
@@ -527,7 +585,35 @@ public abstract class Vio
if (value == null)
output.write_long(vt_NULL);
else
- write_instance(output, value, id);
+ write_instance(output, value, id, null);
+ }
+
+ /**
+ * Write standard value type header, followed by contents, produced
+ * by the boxed value helper.
+ *
+ * @param output the stream to write to.
+ * @param value the value to write, can be null.
+ * @param helper the helper that writes the value content if it is
+ * not null.
+ */
+ public static void write(OutputStream output, Serializable value,
+ Object helper
+ )
+ {
+ if (value == null)
+ output.write_long(vt_NULL);
+ else
+ {
+ String id;
+
+ if (helper instanceof BoxedValueHelper)
+ id = ((BoxedValueHelper) helper).get_id();
+ else
+ id = "";
+
+ write_instance(output, value, id, helper);
+ }
}
/**
@@ -537,9 +623,11 @@ public abstract class Vio
* @param output an output stream to write into.
* @param value a value to write.
* @param id a value repository id.
+ * @param helper a helper, writing object - specifica part. Can be null
+ * if the value should be written unsing other methods.
*/
private static void write_instance(OutputStream output, Serializable value,
- String id
+ String id, Object helper
)
{
// This implementation always writes a single repository id.
@@ -563,6 +651,11 @@ public abstract class Vio
output.write_long(value_tag);
output.write_string(id);
+ if (helper instanceof BoxedValueHelper)
+ {
+ ((BoxedValueHelper) helper).write_value(outObj, value);
+ }
+ else
// User defince write method is present.
if (value instanceof CustomMarshal)
{
@@ -580,11 +673,38 @@ public abstract class Vio
((Streamable) value)._write(outObj);
}
else
+ {
+ // Try to find helper via class loader.
+ boolean ok = false;
+ try
+ {
+ Class helperClass = Class.forName(ObjectCreator.toHelperName(id));
+
+ // It will be the helper for the encapsulated boxed value, not the
+ // for the global boxed value type itself.
+ Method write =
+ helperClass.getMethod("write",
+ new Class[]
+ {
+ org.omg.CORBA.portable.OutputStream.class,
+ value.getClass()
+ }
+ );
+ write.invoke(null, new Object[] { outObj, value });
+ ok = true;
+ }
+ catch (Exception ex)
+ {
+ ok = false;
+ }
- // Stating the interfaces that the USER should use.
- throw new MARSHAL("The " + value.getClass().getName() +
- " must implement either StreamableValue or CustomValue."
- );
+ // Stating the interfaces that the USER should use.
+ if (!ok)
+ throw new MARSHAL("The " + value.getClass().getName() +
+ " must implement either StreamableValue" +
+ " or CustomValue."
+ );
+ }
if (USE_CHUNKING)
{
@@ -611,8 +731,8 @@ public abstract class Vio
*
* @throws NO_IMPLEMENT, always.
*/
- private static void incorrect_plug_in(Throwable ex)
- throws NO_IMPLEMENT
+ static void incorrect_plug_in(Throwable ex)
+ throws NO_IMPLEMENT
{
NO_IMPLEMENT no = new NO_IMPLEMENT("Incorrect CORBA plug-in");
no.initCause(ex);
diff --git a/gnu/CORBA/CDR/cdrInput.java b/gnu/CORBA/CDR/cdrInput.java
index 859f93ae5..69f9c8c58 100644
--- a/gnu/CORBA/CDR/cdrInput.java
+++ b/gnu/CORBA/CDR/cdrInput.java
@@ -1180,7 +1180,8 @@ public abstract class cdrInput
}
// Discard the null terminator and, if needed, the endian marker.
- return new String(s, p, n - nt - p);
+ String r = new String(s, p, n - nt - p);
+ return r;
}
catch (EOFException ex)
{
diff --git a/gnu/CORBA/CDR/cdrOutput.java b/gnu/CORBA/CDR/cdrOutput.java
index 86ca3b1cb..36a00e132 100644
--- a/gnu/CORBA/CDR/cdrOutput.java
+++ b/gnu/CORBA/CDR/cdrOutput.java
@@ -99,7 +99,7 @@ public abstract class cdrOutput
/**
* The GIOP version.
*/
- protected Version giop = new Version(1, 0);
+ protected Version giop = new Version(1, 2);
/**
* The code set information.
diff --git a/gnu/CORBA/CDR/noHeaderInput.java b/gnu/CORBA/CDR/noHeaderInput.java
new file mode 100644
index 000000000..0c787ddc2
--- /dev/null
+++ b/gnu/CORBA/CDR/noHeaderInput.java
@@ -0,0 +1,166 @@
+/* noHeaderInput.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.CDR;
+
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.DataInputStream;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.ValueFactory;
+
+import java.io.Serializable;
+
+/**
+ * Substitutes the main stream in factories when the header is already
+ * behind. Overrides methods that may be invoked from the factory,
+ * forcing not to read the header if called first time on this stream.
+ *
+ * This stream reverts to default behavior if one or more call are
+ * made (reading value types that are nested fields of the value type).
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+class noHeaderInput
+ extends cdrBufInput
+ implements DataInputStream
+{
+ /**
+ * If true, this is not the first call.
+ */
+ boolean notFirst;
+
+ /**
+ * Create an instance, reading from the given buffer.
+ */
+ public noHeaderInput(byte[] buffer)
+ {
+ super(buffer);
+ }
+
+ /**
+ * Read when knowning the class instance.
+ */
+ public Serializable read_value(Class clz)
+ {
+ if (notFirst)
+ return super.read_value(clz);
+ else
+ {
+ try
+ {
+ notFirst = true;
+ return read_value((Serializable) clz.newInstance());
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Unable to create an instance");
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ }
+
+ /**
+ * Tries to read using boxed value helper.
+ */
+ public Serializable read_value(BoxedValueHelper helper)
+ {
+ if (notFirst)
+ return super.read_value(helper);
+ else
+ {
+ notFirst = true;
+ return helper.read_value(this);
+ }
+ }
+
+ /**
+ * Tries to locate a factory using repository id.
+ */
+ public Serializable read_value(String repository_id)
+ {
+ if (notFirst)
+ return super.read_value(repository_id);
+ else
+ {
+ notFirst = true;
+
+ ValueFactory factory =
+ ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
+ if (factory == null)
+ throw new MARSHAL("No factory");
+ return factory.read_value(this);
+ }
+ }
+
+ /**
+ * Try to read when having an unitialised value.
+ */
+ public Serializable read_value(Serializable value)
+ {
+ if (notFirst)
+ return super.read_value(value);
+ else
+ {
+ notFirst = true;
+
+ // The user-defines io operations are implemented.
+ if (value instanceof CustomMarshal)
+ {
+ CustomMarshal marsh = (CustomMarshal) value;
+ try
+ {
+ marsh.unmarshal((DataInputStream) this);
+ }
+ catch (ClassCastException ex)
+ {
+ Vio.incorrect_plug_in(ex);
+ }
+ }
+ else
+ // The IDL-generated io operations are implemented.
+ if (value instanceof Streamable)
+ {
+ ((Streamable) value)._read(this);
+ }
+ return value;
+ }
+ }
+} \ No newline at end of file
diff --git a/gnu/CORBA/DynAn/NameValuePairHolder.java b/gnu/CORBA/DynAn/NameValuePairHolder.java
index 7afc81cd4..2558f5335 100644
--- a/gnu/CORBA/DynAn/NameValuePairHolder.java
+++ b/gnu/CORBA/DynAn/NameValuePairHolder.java
@@ -46,9 +46,8 @@ 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}.
+ * 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@Bioinformatics.org)
*/
@@ -92,4 +91,4 @@ public class NameValuePairHolder
{
NameValuePairHelper.write(output, value);
}
-}
+} \ No newline at end of file
diff --git a/gnu/CORBA/DynAn/abstractDynAny.java b/gnu/CORBA/DynAn/abstractDynAny.java
new file mode 100644
index 000000000..47176c4b5
--- /dev/null
+++ b/gnu/CORBA/DynAn/abstractDynAny.java
@@ -0,0 +1,177 @@
+/* abstractDynAny.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.typeNamer;
+
+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@Bioinformatics.org)
+ */
+public abstract class abstractDynAny
+ 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.
+ */
+ valueChangedListener listener;
+
+ /**
+ * Create the abstract dyn any.
+ */
+ public abstractDynAny(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 typeNamer.nameIt(expected) + " expected " +
+ typeNamer.nameIt(actual);
+ }
+
+ /**
+ * Format "size mismatch" string.
+ */
+ String sizeMismatch(int here, int other)
+ {
+ return "Size mismatch, " + other + " (expected " + here + ")";
+ }
+} \ No newline at end of file
diff --git a/gnu/CORBA/DynAn/abstractRecord.java b/gnu/CORBA/DynAn/abstractRecord.java
new file mode 100644
index 000000000..8d8b7a559
--- /dev/null
+++ b/gnu/CORBA/DynAn/abstractRecord.java
@@ -0,0 +1,405 @@
+/* abstractRecord.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.holderFactory;
+
+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@Bioinformatics.org)
+ */
+public abstract class abstractRecord
+ extends anyDivideable
+ 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 abstractRecord(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();
+ }
+
+ abstractRecord d = newInstance(official_type, final_type, factory, orb);
+ d.array = c;
+ return d;
+ }
+
+ /**
+ * Create a new instance when copying.
+ */
+ protected abstract abstractRecord newInstance(TypeCode oType, TypeCode aType,
+ gnuDynAnyFactory aFactory,
+ ORB anOrb
+ );
+
+ /**
+ * Done via reflection.
+ */
+ public Any to_any()
+ {
+ try
+ {
+ Streamable sHolder = holderFactory.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 = holderFactory.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
diff --git a/gnu/CORBA/DynAn/anyDivideable.java b/gnu/CORBA/DynAn/anyDivideable.java
new file mode 100644
index 000000000..5f52c8078
--- /dev/null
+++ b/gnu/CORBA/DynAn/anyDivideable.java
@@ -0,0 +1,514 @@
+/* anyDivideable.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.typeNamer;
+
+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@Bioinformatics.org)
+ */
+public abstract class anyDivideable
+ extends abstractDynAny
+ 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 anyDivideable(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 anyDivideable)
+ {
+ anyDivideable x = (anyDivideable) 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 abstractDynAny)
+ 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
diff --git a/gnu/CORBA/DynAn/anyUndivideable.java b/gnu/CORBA/DynAn/anyUndivideable.java
new file mode 100644
index 000000000..b31a6b357
--- /dev/null
+++ b/gnu/CORBA/DynAn/anyUndivideable.java
@@ -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@Bioinformatics.org)
+ */
+public abstract class anyUndivideable
+ extends abstractDynAny
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Create a new instance with the given typecode.
+ */
+ public anyUndivideable(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);
+
+}
diff --git a/gnu/CORBA/DynAn/gnuDynAny.java b/gnu/CORBA/DynAn/gnuDynAny.java
new file mode 100644
index 000000000..a12706176
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynAny.java
@@ -0,0 +1,985 @@
+/* primitiveDynAny.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.*;
+import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.OctetHolder;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.WCharHolder;
+import gnu.CORBA.WStringHolder;
+import gnu.CORBA.typeNamer;
+
+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.*;
+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@Bioinformatics.org)
+ */
+public class gnuDynAny
+ extends abstractDynAny
+ 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)
+ {
+ cdrBufOutput buffer = new cdrBufOutput();
+ 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 " +
+ typeNamer.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 universalHolder)
+ {
+ holder = holderFactory.createHolder(official_type);
+ if (holder == null)
+ holder = holderFactory.createHolder(final_type);
+
+ if (holder == null)
+ holder = ((universalHolder) 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 abstractDynAny)
+ {
+ if (other instanceof gnuDynAny)
+ {
+ gnuDynAny x = (gnuDynAny) other;
+
+ if (!x.holder.getClass().equals(holder.getClass()))
+ return false;
+
+ cdrBufOutput b1 = new cdrBufOutput();
+ x.holder._write(b1);
+
+ cdrBufOutput b2 = new cdrBufOutput(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
diff --git a/gnu/CORBA/DynAn/gnuDynAnyFactory.java b/gnu/CORBA/DynAn/gnuDynAnyFactory.java
new file mode 100644
index 000000000..dd1762890
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynAnyFactory.java
@@ -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.holderFactory;
+import gnu.CORBA.typeNamer;
+
+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@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 = holderFactory.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 " +
+ typeNamer.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
diff --git a/gnu/CORBA/DynAn/gnuDynArray.java b/gnu/CORBA/DynAn/gnuDynArray.java
new file mode 100644
index 000000000..1c08496d4
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynArray.java
@@ -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.holderFactory;
+
+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@Bioinformatics.org)
+ */
+public class gnuDynArray
+ extends anyDivideable
+ 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 =
+ holderFactory.createHolder(official_components);
+
+ if (memberHolder == null)
+ memberHolder = holderFactory.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 = holderFactory.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 = holderFactory.createHolder(official_components);
+ if (holder == null)
+ holder = holderFactory.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
diff --git a/gnu/CORBA/DynAn/gnuDynEnum.java b/gnu/CORBA/DynAn/gnuDynEnum.java
new file mode 100644
index 000000000..148d99375
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynEnum.java
@@ -0,0 +1,250 @@
+/* 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.*;
+
+import java.util.Arrays;
+
+/**
+ * Our implementation of dynamic enumeration.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class gnuDynEnum
+ extends anyUndivideable
+ 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
diff --git a/gnu/CORBA/DynAn/gnuDynFixed.java b/gnu/CORBA/DynAn/gnuDynFixed.java
new file mode 100644
index 000000000..13ec24e6c
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynFixed.java
@@ -0,0 +1,257 @@
+/* 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.CORBA.TypeCodePackage.*;
+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@Bioinformatics.org)
+ */
+public class gnuDynFixed
+ extends anyUndivideable
+ 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
diff --git a/gnu/CORBA/DynAn/gnuDynSequence.java b/gnu/CORBA/DynAn/gnuDynSequence.java
new file mode 100644
index 000000000..cfa122f07
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynSequence.java
@@ -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
diff --git a/gnu/CORBA/DynAn/gnuDynStruct.java b/gnu/CORBA/DynAn/gnuDynStruct.java
new file mode 100644
index 000000000..b086d6478
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynStruct.java
@@ -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@Bioinformatics.org)
+ */
+public class gnuDynStruct
+ extends abstractRecord
+ 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 abstractRecord 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();
+ }
+}
diff --git a/gnu/CORBA/DynAn/gnuDynUnion.java b/gnu/CORBA/DynAn/gnuDynUnion.java
new file mode 100644
index 000000000..ad41e24b6
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynUnion.java
@@ -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@Bioinformatics.org)
+ */
+public class gnuDynUnion
+ extends anyDivideable
+ implements DynUnion, Serializable, valueChangedListener
+{
+ /**
+ * 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());
+
+ ((abstractDynAny) 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.anyDivideable#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();
+ ((abstractDynAny) 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
diff --git a/gnu/CORBA/DynAn/gnuDynValue.java b/gnu/CORBA/DynAn/gnuDynValue.java
new file mode 100644
index 000000000..db37be016
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynValue.java
@@ -0,0 +1,395 @@
+/* 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.Unexpected;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.*;
+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@Bioinformatics.org)
+ */
+public class gnuDynValue
+ extends abstractRecord
+ 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 abstractRecord 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)
+ throw new MARSHAL("Factory for " + official_type.id() +
+ " not registered."
+ );
+
+ 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
diff --git a/gnu/CORBA/DynAn/gnuDynValueBox.java b/gnu/CORBA/DynAn/gnuDynValueBox.java
new file mode 100644
index 000000000..66e18f3b2
--- /dev/null
+++ b/gnu/CORBA/DynAn/gnuDynValueBox.java
@@ -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.holderFactory;
+
+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@Bioinformatics.org)
+ */
+public class gnuDynValueBox
+ extends anyDivideable
+ 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 = holderFactory.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
diff --git a/gnu/CORBA/DynAn/valueChangedListener.java b/gnu/CORBA/DynAn/valueChangedListener.java
new file mode 100644
index 000000000..94ddffbec
--- /dev/null
+++ b/gnu/CORBA/DynAn/valueChangedListener.java
@@ -0,0 +1,50 @@
+/* valueChangedListener.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@Bioinformatics.org)
+ */
+public interface valueChangedListener
+{
+ void changed();
+} \ No newline at end of file
diff --git a/gnu/CORBA/Poa/ORB_1_4.java b/gnu/CORBA/Poa/ORB_1_4.java
index 6302ddf12..00ca3bf76 100644
--- a/gnu/CORBA/Poa/ORB_1_4.java
+++ b/gnu/CORBA/Poa/ORB_1_4.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.CORBA.Poa;
import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.DynAn.gnuDynAnyFactory;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.OBJECT_NOT_EXIST;
@@ -62,10 +63,15 @@ public class ORB_1_4
* Maps the active threads to the invocation data ("Current's").
*/
public gnuPoaCurrent currents = new gnuPoaCurrent();
+
+ /**
+ * Creates dynamic anys.
+ */
+ public gnuDynAnyFactory factory = new gnuDynAnyFactory(this);
/**
- * Calls the parent constructor and additionally puts the "RootPOA" and
- * "RootPOAManager" into initial references.
+ * Calls the parent constructor and additionally puts the "RootPOA",
+ * "RootPOAManager", "POACurrent" and "DynAnyFactory" into initial references.
*/
public ORB_1_4()
{
@@ -84,6 +90,7 @@ public class ORB_1_4
initial_references.put("RootPOA", rootPOA);
initial_references.put("RootPOAManager", rootPOA.the_POAManager());
initial_references.put("POACurrent", currents);
+ initial_references.put("DynAnyFactory", factory);
}
/**
diff --git a/gnu/CORBA/Restricted_ORB.java b/gnu/CORBA/Restricted_ORB.java
index 801154e20..698c8b11e 100644
--- a/gnu/CORBA/Restricted_ORB.java
+++ b/gnu/CORBA/Restricted_ORB.java
@@ -240,13 +240,16 @@ public class Restricted_ORB
}
/** {@inheritDoc} */
- public TypeCode create_union_tc(String id, String name, TypeCode type,
+ 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++)
{
@@ -454,7 +457,9 @@ public class Restricted_ORB
if (f != null)
return f;
- f = (ValueFactory) ObjectCreator.createObject(repository_id, "DefaultFactory");
+ f = (ValueFactory) ObjectCreator.createObject(repository_id,
+ "DefaultFactory"
+ );
if (f != null)
factories.put(repository_id, f);
diff --git a/gnu/CORBA/fixedTypeCode.java b/gnu/CORBA/fixedTypeCode.java
index ec88c22be..eb610417b 100644
--- a/gnu/CORBA/fixedTypeCode.java
+++ b/gnu/CORBA/fixedTypeCode.java
@@ -109,16 +109,12 @@ public class fixedTypeCode
return number.unscaledValue().abs().toString().length();
}
- public boolean equals(Object other)
+ /**
+ * Compare with other type code for equality.
+ */
+ public boolean equal(TypeCode other)
{
- if (other == this)
- {
- return true;
- }
- if (!(other instanceof TypeCode))
- {
- return false;
- }
+ if (other == this) return true;
try
{
TypeCode that = (TypeCode) other;
diff --git a/gnu/CORBA/gnuAny.java b/gnu/CORBA/gnuAny.java
index a48c50d61..7e5ef3351 100644
--- a/gnu/CORBA/gnuAny.java
+++ b/gnu/CORBA/gnuAny.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.CDR.Vio;
import gnu.CORBA.CDR.cdrBufInput;
import gnu.CORBA.CDR.cdrBufOutput;
@@ -63,6 +64,7 @@ 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.BoxedValueHelper;
import org.omg.CORBA.portable.Streamable;
import java.io.IOException;
@@ -499,20 +501,33 @@ public class gnuAny
}
/** {@inheritDoc} */
- public void insert_Value(Serializable x, TypeCode typecode)
+ public void insert_Value(Serializable x, TypeCode c_typecode)
{
- type(typecode);
- insert_Value(x);
+ 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)
{
- resetTypes();
- if (has instanceof ValueBaseHolder)
- ((ValueBaseHolder) has).value = x;
+ if (typecode != null && typecode.kind() == TCKind.tk_value_box)
+ {
+ has = new gnuValueHolder(x, typecode);
+ }
else
- has = new ValueBaseHolder(x);
+ {
+ if (has instanceof ValueBaseHolder)
+ ((ValueBaseHolder) has).value = x;
+ else
+ has = new ValueBaseHolder(x);
+ }
}
/**
@@ -748,15 +763,38 @@ public class gnuAny
}
}
type(a_type);
- has._read(input);
- }
- catch (BadKind ex)
- {
- throw new MARSHAL("Bad kind: " + ex.getMessage());
+
+ if (!(has instanceof universalHolder) &&
+ (kind == TCKind._tk_value_box))
+ {
+ // The streamable only contains operations for
+ // reading the value, not the value header.
+ Field vField = has.getClass().getField("value");
+
+ BoxedValueHelper helper;
+
+ try
+ {
+ Class helperClass =
+ Class.forName(ObjectCreator.toHelperName(a_type.id()));
+ helper = (BoxedValueHelper) helperClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ helper = null;
+ }
+
+ Object content = Vio.read(input, helper);
+ vField.set(has, content);
+ }
+ else
+ has._read(input);
}
- catch (IOException ex)
+ catch (Exception ex)
{
- throw new MARSHAL("IO exception: " + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.initCause(ex);
+ throw m;
}
}
@@ -790,6 +828,12 @@ public class gnuAny
{
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);
}
/**
@@ -806,16 +850,26 @@ public class gnuAny
if (xKind >= 0)
{
if (xKind != kind)
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " when stored " + typeNamer.nameIt(xKind)
- );
+ if (!(
+ xKind == TCKind._tk_alias &&
+ has._type().kind().value() == kind
+ )
+ )
+ throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
+ " when stored " + typeNamer.nameIt(xKind)
+ );
}
else
{
if (type().kind().value() != kind)
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " stored " + typeNamer.nameIt(type())
- );
+ if (!(
+ type().kind().value() == TCKind._tk_alias &&
+ has._type().kind().value() == kind
+ )
+ )
+ throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
+ " stored " + typeNamer.nameIt(type())
+ );
}
}
diff --git a/gnu/CORBA/gnuValueHolder.java b/gnu/CORBA/gnuValueHolder.java
new file mode 100644
index 000000000..0b3826489
--- /dev/null
+++ b/gnu/CORBA/gnuValueHolder.java
@@ -0,0 +1,135 @@
+/* gnuValueHolder.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 org.omg.CORBA.TypeCode;
+import org.omg.CORBA.ValueBaseHolder;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+
+/**
+ * Boxed value holder that also remembers the value type and the value helper.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class gnuValueHolder
+ extends ValueBaseHolder
+{
+ /**
+ * The type code of the stored value.
+ */
+ TypeCode type;
+
+ /**
+ * The helper that could read and write fields of the boxed value.
+ */
+ transient BoxedValueHelper helper;
+
+ /**
+ * If true, the helper not available.
+ */
+ transient boolean helper_NA;
+
+ /**
+ * Create a new instance for the given value and given type.
+ */
+ public gnuValueHolder(Serializable value, TypeCode a_type)
+ {
+ super(value);
+ type = a_type;
+ }
+
+ /**
+ * Get the true type, as it was passed in the constructor.
+ */
+ public TypeCode _type()
+ {
+ return type;
+ }
+
+ /**
+ * Write content to the output stream. Tries to locate the
+ * corresponding helper class.
+ */
+ public void _write(OutputStream output)
+ {
+ findHelper();
+ if (helper == null)
+ super._write(output);
+ else
+ Vio.write(output, value, helper);
+ }
+
+ /**
+ * Read, trying to locate helper, if possible.
+ */
+ public void _read(InputStream input)
+ {
+ findHelper();
+ if (helper == null)
+ super._read(input);
+ else
+ value = Vio.read(input, helper);
+ }
+
+ /**
+ * Set the read and write methods.
+ */
+ void findHelper()
+ {
+ if (helper != null || helper_NA)
+ return;
+ try
+ {
+ Class helperClass =
+ Class.forName(ObjectCreator.toHelperName(type.id()));
+
+ helper = (BoxedValueHelper) helperClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ helper_NA = true;
+ }
+ }
+} \ No newline at end of file
diff --git a/gnu/CORBA/holderFactory.java b/gnu/CORBA/holderFactory.java
index 177797a9c..159d22332 100644
--- a/gnu/CORBA/holderFactory.java
+++ b/gnu/CORBA/holderFactory.java
@@ -68,74 +68,76 @@ 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
- * type.
+ * Creates the suitable holder for storing the value of the given final_type.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class holderFactory
{
/**
- * The array, sufficiently large to use any {@link TCKind}._tk* constant
- * as an index.
+ * 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;
-
- 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;
- }
+ {
+ 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 type.
- * This function returns the defined holders for the built-in primitive
- * types and they sequences.
+ * 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 type. The holder is created with a
- * parameterless constructor.
+ * @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)
{
@@ -145,24 +147,23 @@ public class holderFactory
int componentKind;
Streamable holder = null;
- Streamable component;
- if (kind < holders.length && holders [ kind ] != null)
- holder = (Streamable) holders [ kind ].newInstance();
+ 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;
+ 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)
diff --git a/gnu/CORBA/typeNamer.java b/gnu/CORBA/typeNamer.java
index 8b701015e..f790dc959 100644
--- a/gnu/CORBA/typeNamer.java
+++ b/gnu/CORBA/typeNamer.java
@@ -83,7 +83,7 @@ public class typeNamer
new primitiveTypeCode(TCKind.tk_any),
new primitiveTypeCode(TCKind.tk_TypeCode),
new primitiveTypeCode(TCKind.tk_Principal),
- new primitiveTypeCode(TCKind.tk_objref),
+ new recordTypeCode(TCKind.tk_objref),
new primitiveTypeCode(TCKind.tk_struct),
new primitiveTypeCode(TCKind.tk_union),
new primitiveTypeCode(TCKind.tk_enum),
@@ -104,6 +104,15 @@ public class typeNamer
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.
*
@@ -168,4 +177,4 @@ public class typeNamer
return "type of kind '" + type.kind().value() + "'";
}
}
-}
+} \ No newline at end of file
diff --git a/gnu/CORBA/universalHolder.java b/gnu/CORBA/universalHolder.java
index 6d8b77472..c20dac442 100644
--- a/gnu/CORBA/universalHolder.java
+++ b/gnu/CORBA/universalHolder.java
@@ -60,7 +60,7 @@ import java.io.IOException;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-class universalHolder
+public class universalHolder
implements Streamable
{
/**
@@ -71,7 +71,7 @@ class universalHolder
/**
* Create the universal holder that uses the given buffer to store the data.
*/
- universalHolder(cdrBufOutput buffer)
+ public universalHolder(cdrBufOutput buffer)
{
value = buffer;
}
@@ -154,4 +154,21 @@ class universalHolder
{
return value.create_input_stream();
}
-}
+
+ /**
+ * Clone.
+ */
+ public universalHolder Clone()
+ {
+ try
+ {
+ cdrBufOutput nb = new cdrBufOutput(value.buffer.size());
+ value.buffer.writeTo(nb);
+ return new universalHolder(nb);
+ }
+ catch (IOException ex)
+ {
+ throw new Unexpected(ex);
+ }
+ }
+} \ No newline at end of file
diff --git a/org/omg/CORBA/Any.java b/org/omg/CORBA/Any.java
index d8c892d21..1e72709d2 100644
--- a/org/omg/CORBA/Any.java
+++ b/org/omg/CORBA/Any.java
@@ -51,7 +51,7 @@ import org.omg.CORBA.portable.IDLEntity;
public abstract class Any
implements Serializable, IDLEntity
{
- /**
+ /**
* Using v 1.4 serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1217179597823814463L;
@@ -312,12 +312,18 @@ public abstract class Any
public abstract void insert_TypeCode(TypeCode typecode);
/**
- * Insert the CORBA <code>Value</code> into this <code>Any</code>
+ * Insert the CORBA <code>Value</code> into this <code>Any</code>.
+ *
+ * The type of the Any should be set (by {@link #type(TypeCode)})
+ * before inserting the value.
*/
public abstract void insert_Value(Serializable x, TypeCode typecode);
/**
- * Insert the CORBA <code>Value</code> into this <code>Any</code>
+ * Insert the CORBA <code>Value</code> into this <code>Any</code>.
+ *
+ * The type of the Any should be set (by {@link #type(TypeCode)})
+ * before inserting the value.
*/
public abstract void insert_Value(Serializable x);
diff --git a/org/omg/CORBA/ORB.java b/org/omg/CORBA/ORB.java
index 6a53ccc11..772642e93 100644
--- a/org/omg/CORBA/ORB.java
+++ b/org/omg/CORBA/ORB.java
@@ -881,6 +881,10 @@ public abstract class ORB
* <td>Encodes/decodes IDL data types into/from byte arrays.</td>
* </tr>
*
+ * <tr><td>DynAnyFactory</td><td>{@link org.omg.DynamicAny.DynAnyFactory}</td>
+ * <td>Creates DynAny's.</td>
+ * </tr>
+ *
* </table>
*
* @param name the object name.
diff --git a/org/omg/CORBA/ObjectHelper.java b/org/omg/CORBA/ObjectHelper.java
index 0e0efa51e..1324c621f 100644
--- a/org/omg/CORBA/ObjectHelper.java
+++ b/org/omg/CORBA/ObjectHelper.java
@@ -50,10 +50,7 @@ import org.omg.CORBA.portable.OutputStream;
*/
public abstract class ObjectHelper
{
- /**
- * The cached binding list type code.
- */
- private static TypeCode typeCode = new primitiveTypeCode(TCKind.tk_objref);
+ static TypeCode typeCode;
/**
* Extract the array of object from the given {@link Any}.
@@ -100,6 +97,8 @@ public abstract class ObjectHelper
*/
public static TypeCode type()
{
+ if (typeCode == null)
+ typeCode = ORB.init().get_primitive_tc(TCKind.tk_objref);
return typeCode;
}
diff --git a/org/omg/CORBA/ObjectHolder.java b/org/omg/CORBA/ObjectHolder.java
index 02526bee1..27ae67416 100644
--- a/org/omg/CORBA/ObjectHolder.java
+++ b/org/omg/CORBA/ObjectHolder.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.recordTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -59,10 +60,16 @@ public final class ObjectHolder
implements Streamable
{
/**
- * The default type code for this holder.
+ * The default type code for this holder if the object type code with
+ * the zero length string as id.
*/
- private static final TypeCode t_object =
- new primitiveTypeCode(TCKind.tk_objref);
+ private static final recordTypeCode t_object;
+
+ static
+ {
+ t_object = new recordTypeCode(TCKind.tk_objref);
+ t_object.setId("");
+ }
/**
* The <code>org.omg.CORBA.Object</code> (CORBA <code>Object</code>) value,
@@ -109,7 +116,7 @@ public final class ObjectHolder
*/
public TypeCode _type()
{
- return t_object;
+ return ObjectHelper.type();
}
/**
@@ -124,4 +131,4 @@ public final class ObjectHolder
{
output.write_Object(value);
}
-}
+} \ No newline at end of file
diff --git a/org/omg/CORBA/TypeCode.java b/org/omg/CORBA/TypeCode.java
index 38fb0564f..a1ad3db9e 100644
--- a/org/omg/CORBA/TypeCode.java
+++ b/org/omg/CORBA/TypeCode.java
@@ -38,11 +38,11 @@ exception statement from your version. */
package org.omg.CORBA;
-import java.io.Serializable;
-
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.IDLEntity;
+import java.io.Serializable;
+
/**
* An information about a CORBA data type.
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
@@ -57,10 +57,12 @@ public abstract class TypeCode
private static final long serialVersionUID = -6521025782489515676L;
/**
- * Returns the concrete base type for this TypeCode.
- * @return a TypeCode, defining the concrete base type for this
- * Typecode.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind
+ * For value types that support inheritance this method returns the
+ * of the ancestor type code.
+ *
+ * @return the ancestor TypeCode.
+ *
+ * @throws BadKind for all typecodes except the value type typecodes.
*/
public abstract TypeCode concrete_base_type()
throws BadKind;
@@ -69,7 +71,7 @@ public abstract class TypeCode
* For sequences, arrays, aliases and value boxes, returns the IDL type for
* the members of the object.
* @return a TypeCode of the memebers of this type.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* sequences, arrays, aliases and value boxes.
*/
public abstract TypeCode content_type()
@@ -79,7 +81,7 @@ public abstract class TypeCode
* For unions, returs the index of the default member.
* @return the index of the default member, -1 if there is
* no default member.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not
+ * @throws BadKind if this type is not
* a union.
*/
public abstract int default_index()
@@ -88,15 +90,15 @@ public abstract class TypeCode
/**
* Returs definition of member labels for untions
* @return a TypeCode, describing all non-default member labels.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not a
+ * @throws BadKind if this type is not a
* union.
*/
public abstract TypeCode discriminator_type()
throws BadKind;
/**
- * Test two types for equality. The default implementation
- * returs true of the types of the same kind.
+ * Test two types for equality.
+ *
* @param other the other type to compere with
* @return true if the types are interchangeable.
*/
@@ -112,7 +114,7 @@ public abstract class TypeCode
/**
* For the fixed type, returns the number of digits.
* @return the number of digits for the fixed type
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed
+ * @throws BadKind if this is not a fixed
* type.
*/
public abstract short fixed_digits()
@@ -123,7 +125,7 @@ public abstract class TypeCode
* positive (the number of digits to the right of the decimal point) or
* negative (adds zeros to the left of the decimal point).
* @return the scale.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed
+ * @throws BadKind if this is not a fixed
* type.
*/
public abstract short fixed_scale()
@@ -140,7 +142,7 @@ public abstract class TypeCode
* Returns the RepositoryId globally identifying the type, defined by
* this TypeCode.
* @return tje RepositoryId. In some cases, it may be an empty string.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if the type is other than
+ * @throws BadKind if the type is other than
* reference, structure, union, enumeration, alias, exception, valuetype,
* boxed valuetype and also native and abstract interfaces.
*/
@@ -161,7 +163,7 @@ public abstract class TypeCode
*
* @return length or bound
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* string, sequence and array.
*/
public abstract int length()
@@ -171,7 +173,7 @@ public abstract class TypeCode
* Returns the number of type memebers.
*
* @return the number of memebers
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* structure, union, enumeration or exception.
*/
public abstract int member_count()
@@ -185,14 +187,14 @@ public abstract class TypeCode
*
* @return the label
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a union
+ * @throws BadKind if this is not a union
* type.
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract Any member_label(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Retrieves the simple name of the member identified by the given index.
@@ -201,14 +203,14 @@ public abstract class TypeCode
*
* @return the member name that in some cases can be an empty string.
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* structure, union or enumeration.
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract String member_name(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Retrieves the member type of the member identified by the given index.
@@ -217,14 +219,14 @@ public abstract class TypeCode
*
* @return the member type.
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
+ * @throws BadKind for types other than
* structure, union, enumeration or exception.
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract TypeCode member_type(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Returns the visibility scope of the member at the given index.
@@ -234,22 +236,21 @@ public abstract class TypeCode
*
* @return either PRIVATE_MEMBER.value or PUBLIC_MEMBER.value
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a non boxed
+ * @throws BadKind if this is not a non boxed
* value type.
*
* @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of
* valid bounds.
*/
public abstract short member_visibility(int index)
- throws BadKind,
- org.omg.CORBA.TypeCodePackage.Bounds;
-
+ throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds;
/**
* Retrieves the simple name identifying this TypeCode object
* within its enclosing scope.
* @return the name, can be an empty string.
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for typer other than
+ * @throws BadKind for typer other than
* reference, structure, union, enumeration, alias, exception,
* valuetype, boxed valuetype, native, and abstract interface
*/
@@ -263,9 +264,8 @@ public abstract class TypeCode
* VM_NONE.value, VM_ABSTRACT.value, VM_CUSTOM.value, or
* VM_TRUNCATABLE.value,
*
- * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than
- * value type.
+ * @throws BadKind for all types other than value type.
*/
public abstract short type_modifier()
throws BadKind;
-}
+} \ No newline at end of file
diff --git a/org/omg/CORBA_2_3/portable/InputStream.java b/org/omg/CORBA_2_3/portable/InputStream.java
index 3ab264f60..06ee33e66 100644
--- a/org/omg/CORBA_2_3/portable/InputStream.java
+++ b/org/omg/CORBA_2_3/portable/InputStream.java
@@ -40,7 +40,9 @@ package org.omg.CORBA_2_3.portable;
import gnu.CORBA.CDR.Vio;
+import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.ValueFactory;
import java.io.Serializable;
@@ -170,7 +172,7 @@ public abstract class InputStream
*/
public Serializable read_value(Serializable unitialised_value)
{
- return Vio.read(this, unitialised_value);
+ return (Serializable) Vio.read(this, unitialised_value, null);
}
/**
@@ -190,8 +192,11 @@ public abstract class InputStream
*/
public Serializable read_value(String repository_id)
{
- return ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id)
- .read_value(this);
+ ValueFactory factory =
+ ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
+ if (factory == null)
+ throw new MARSHAL("No factory");
+ return (Serializable) Vio.read(this, null, factory);
}
/**
@@ -203,6 +208,6 @@ public abstract class InputStream
*/
public Serializable read_value(BoxedValueHelper helper)
{
- return helper.read_value(this);
+ return Vio.read(this, helper);
}
} \ No newline at end of file
diff --git a/org/omg/CORBA_2_3/portable/OutputStream.java b/org/omg/CORBA_2_3/portable/OutputStream.java
index 2f83a939f..2ff8c226a 100644
--- a/org/omg/CORBA_2_3/portable/OutputStream.java
+++ b/org/omg/CORBA_2_3/portable/OutputStream.java
@@ -117,7 +117,7 @@ public abstract class OutputStream
*/
public void write_value(Serializable value, BoxedValueHelper helper)
{
- helper.write_value(this, value);
+ Vio.write(this, value, helper);
}
/**
diff --git a/org/omg/DynamicAny/DynAnyFactoryHelper.java b/org/omg/DynamicAny/DynAnyFactoryHelper.java
index b6fd15151..0c02916e5 100644
--- a/org/omg/DynamicAny/DynAnyFactoryHelper.java
+++ b/org/omg/DynamicAny/DynAnyFactoryHelper.java
@@ -62,7 +62,7 @@ public abstract class DynAnyFactoryHelper
{
/**
* Cast the passed object into the DynAnyFactory. As DynAnyFactory is a local
- * object, the method just uses java type cast.
+ * object, the method just uses java final_type cast.
*
* @param obj the object to narrow.
* @return narrowed instance.
@@ -82,7 +82,7 @@ public abstract class DynAnyFactoryHelper
}
/**
- * Get the type code of the {@link DynAnyFactory}.
+ * Get the final_type code of the {@link DynAnyFactory}.
*/
public static TypeCode type()
{
diff --git a/org/omg/DynamicAny/DynAnyFactoryOperations.java b/org/omg/DynamicAny/DynAnyFactoryOperations.java
index c3ea4a9dc..058e36958 100644
--- a/org/omg/DynamicAny/DynAnyFactoryOperations.java
+++ b/org/omg/DynamicAny/DynAnyFactoryOperations.java
@@ -118,6 +118,11 @@ public interface DynAnyFactoryOperations
* <td>null</td>
* <td>{@link DynValue}, {@link DynValueBox}</td>
* </tr>
+ * <tr>
+ * <td>TypeCode</td>
+ * <td>Typecode of kind <code>TCKind.tk_null</code></td>
+ * <td>{@link DynValue}, {@link DynValueBox}</td>
+ * </tr>
*
* </table>
*
diff --git a/org/omg/DynamicAny/DynAnyOperations.java b/org/omg/DynamicAny/DynAnyOperations.java
index 9c1aaf686..0e743136d 100644
--- a/org/omg/DynamicAny/DynAnyOperations.java
+++ b/org/omg/DynamicAny/DynAnyOperations.java
@@ -59,7 +59,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if the source DynAny is invalid.
*/
void assign(DynAny from)
- throws TypeMismatch;
+ throws TypeMismatch;
/**
* Fully clones the content of this Any, returning a deep copy.
@@ -77,7 +77,7 @@ public interface DynAnyOperations
* components, like {@link DynEnum}.
*/
DynAny current_component()
- throws TypeMismatch;
+ throws TypeMismatch;
/**
* Destroys this DynAny, freeing the used resources. In java, resources are
@@ -98,7 +98,7 @@ public interface DynAnyOperations
* otherwise invalid.
*/
void from_any(Any an_any)
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* This method is used when the wrapped Any contains an instance of another
@@ -108,7 +108,7 @@ public interface DynAnyOperations
* the typecode of this DynAny.
*/
Any get_any()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the boolean value that is expected to be stored in this DynAny.
@@ -116,7 +116,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
boolean get_boolean()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the char value that is expected to be stored in this DynAny.
@@ -124,7 +124,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
char get_char()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the <code>double</code> value that is expected to be stored in
@@ -133,7 +133,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
double get_double()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the <code>float</code> value that is expected to be stored in
@@ -142,7 +142,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
float get_float()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the int (CORBA long) value that is expected to be stored in this
@@ -151,7 +151,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
int get_long()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the long (CORBA long long) value that is expected to be stored in
@@ -160,7 +160,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
long get_longlong()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the byte (CORBA octet) value that is expected to be stored in this
@@ -169,7 +169,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
byte get_octet()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the CORBA object reference that is expected to be stored in this
@@ -178,7 +178,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
org.omg.CORBA.Object get_reference()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the <code>short</code> value that is expected to be stored in
@@ -187,7 +187,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
short get_short()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the string value that is expected to be stored in this DynAny.
@@ -195,7 +195,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
String get_string()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the {@link TypeCode} value that is expected to be stored in this
@@ -204,7 +204,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
TypeCode get_typecode()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the unsigned int (CORBA ulong) value that is expected to be stored
@@ -213,7 +213,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
int get_ulong()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the unsingel long (CORBA unsigned long long )value that is expected
@@ -222,7 +222,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
long get_ulonglong()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the unsigned short value that is expected to be stored in this
@@ -231,7 +231,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
short get_ushort()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the value that is expected to be stored in this DynAny.
@@ -239,7 +239,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
Serializable get_val()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the wide (usually UTF-16) character value that is expected to be
@@ -248,7 +248,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
char get_wchar()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Extract the wide (usually UFT-16) string that is expected to be stored in
@@ -257,7 +257,7 @@ public interface DynAnyOperations
* @throws TypeMismatch if this DynAny holds the value of the different type.
*/
String get_wstring()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Insert the {@link Any} value into the enclosed {@link Any} inside this
@@ -268,7 +268,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_any(Any an_any)
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Insert the boolean value into the enclosed {@link Any} inside this DynAny
@@ -278,7 +278,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_boolean(boolean a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the char value into the enclosed {@link Any} inside this DynAny
@@ -288,7 +288,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_char(char a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the double value into the enclosed {@link Any} inside this DynAny
@@ -298,7 +298,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_double(double a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the float value into the enclosed {@link Any} inside this DynAny
@@ -308,7 +308,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_float(float a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the int (CORBA long) value into the enclosed {@link Any} inside this
@@ -319,7 +319,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_long(int a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the long (CORBA long long) value into the enclosed {@link Any}
@@ -330,7 +330,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_longlong(long a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the byte (CORBA octet) value into the enclosed {@link Any} inside
@@ -341,7 +341,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_octet(byte a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the object reference into the enclosed {@link Any} inside this
@@ -352,7 +352,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_reference(org.omg.CORBA.Object a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the <code>short</code> value into the enclosed {@link Any} inside
@@ -363,7 +363,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_short(short a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the string value into the enclosed {@link Any} inside this DynAny
@@ -373,7 +373,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_string(String a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the {@link TypeCode} value into the enclosed {@link Any} inside this
@@ -384,7 +384,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_typecode(TypeCode a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the int (CORBA unsinged long) value into the enclosed {@link Any}
@@ -395,7 +395,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_ulong(int a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the long (CORBA unsigned long long) value into the enclosed
@@ -406,7 +406,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_ulonglong(long a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the short (CORBA unsigned short) value into the enclosed {@link Any}
@@ -417,7 +417,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_ushort(short a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the value into the enclosed {@link Any} inside this DynAny
@@ -427,7 +427,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_val(Serializable a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the wide char (usually UTF-16) value into the enclosed {@link Any}
@@ -438,7 +438,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_wchar(char a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Insert the wide string (usually UTF-16) into the enclosed {@link Any}
@@ -449,7 +449,7 @@ public interface DynAnyOperations
* enclosed {@link Any}.
*/
void insert_wstring(String a_x)
- throws InvalidValue, TypeMismatch;
+ throws InvalidValue, TypeMismatch;
/**
* Advances the internal pointer, described in the {@link current_component},
@@ -503,7 +503,7 @@ public interface DynAnyOperations
* @throws InvalidValue if the current position points nowhere.
*/
void insert_dyn_any(DynAny insert_it)
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
/**
* Checks for equality with another Dynamic Any.
@@ -536,5 +536,5 @@ public interface DynAnyOperations
* @throws InvalidValue if the current position points nowhere.
*/
DynAny get_dyn_any()
- throws TypeMismatch, InvalidValue;
+ throws TypeMismatch, InvalidValue;
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/DynUnionOperations.java b/org/omg/DynamicAny/DynUnionOperations.java
index c45eb17a7..c046e69e7 100644
--- a/org/omg/DynamicAny/DynUnionOperations.java
+++ b/org/omg/DynamicAny/DynUnionOperations.java
@@ -59,24 +59,28 @@ public interface DynUnionOperations
extends DynAnyOperations
{
/**
- * Get the value of discriminator, defining which content variant (member) is
- * active.
+ * <p>Get the value of discriminator, defining which content variant
+ * (member) is active.
+ * </p><p>
+ * In the current implementation, the later changes on the returned value
+ * alter the state of the union via implemented internal listener.
+ * </p>
*/
DynAny get_discriminator();
/**
- * Set the value of discriminator, activating the member variant that is
+ * <p>Set the value of discriminator, activating the member variant that is
* consistent with the discriminator value. If the current member variant
* matches the discriminator being set, it is unchanged. Otherwise, it is
* replaced by the matching member variant with fields, initialised to default
* values. The current position is set to 0 if the discriminator value does
* not match any member variant. Otherwise, the current position is set to 1,
* index of the member variant.
- *
+ * </p>
* @throws TypeMismatch if the discriminator has a wrong type of this union.
*/
void set_discriminator(DynAny aDiscriminator)
- throws TypeMismatch;
+ throws TypeMismatch;
/**
* Get the kind of the union descriminator.
@@ -94,7 +98,7 @@ public interface DynUnionOperations
* @throws InvalidValue if the union has no active member.
*/
DynAny member()
- throws InvalidValue;
+ throws InvalidValue;
/**
* Returns the kind of the currently active union member.
@@ -104,7 +108,7 @@ public interface DynUnionOperations
* @throws InvalidValue if the union has no active member.
*/
TCKind member_kind()
- throws InvalidValue;
+ throws InvalidValue;
/**
* Returns the name of the currently active union member.
@@ -114,7 +118,7 @@ public interface DynUnionOperations
* @throws InvalidValue if the union has no active member.
*/
String member_name()
- throws InvalidValue;
+ throws InvalidValue;
/**
* Returns true if the union has no active member. This happens if If the
@@ -131,7 +135,7 @@ public interface DynUnionOperations
* @throws TypeMismatch if the default case is not defined for this union.
*/
void set_to_default_member()
- throws TypeMismatch;
+ throws TypeMismatch;
/**
* Set the discriminator to value that does not correspond any content variant
@@ -141,5 +145,5 @@ public interface DynUnionOperations
* @throws TypeMismatch if the union has explicit default case.
*/
void set_to_no_active_member()
- throws TypeMismatch;
+ throws TypeMismatch;
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/DynValueBox.java b/org/omg/DynamicAny/DynValueBox.java
index e3806464f..bd758b50c 100644
--- a/org/omg/DynamicAny/DynValueBox.java
+++ b/org/omg/DynamicAny/DynValueBox.java
@@ -49,7 +49,7 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public interface DynValueBox
- extends DynValueBoxOperations, DynAny, IDLEntity, org.omg.CORBA.Object,
- Serializable
+ extends DynValueBoxOperations, DynValueCommon, DynAny, IDLEntity,
+ org.omg.CORBA.Object, Serializable
{
} \ No newline at end of file
diff --git a/org/omg/DynamicAny/DynValueCommon.java b/org/omg/DynamicAny/DynValueCommon.java
index 0982eee12..1b324aa7d 100644
--- a/org/omg/DynamicAny/DynValueCommon.java
+++ b/org/omg/DynamicAny/DynValueCommon.java
@@ -47,16 +47,16 @@ import java.io.Serializable;
* {@link DynValueCommonOperations} provides methods for setting the value to
* <code>null</code> or non-<code>null</code> and checking if the value is
* <code>null</code>.
- *
+ *
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public interface DynValueCommon
- extends DynValueOperations, DynAny, IDLEntity, org.omg.CORBA.Object,
+ extends DynValueCommonOperations, DynAny, IDLEntity, org.omg.CORBA.Object,
Serializable
{
/**
* Check if this {@link DynAny} is holding the <code>null</code>.
- *
+ *
* @return true if this {@link DynAny} is holding the <code>null</code>,
* false otherwise.
*/