diff options
Diffstat (limited to 'org/omg/DynamicAny')
-rw-r--r-- | org/omg/DynamicAny/DynAny.java | 72 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynAnyOperations.java | 538 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynArray.java | 53 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynArrayOperations.java | 92 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynEnum.java | 56 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynEnumOperations.java | 80 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynFixed.java | 55 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynFixedOperations.java | 70 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynSequence.java | 54 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynSequenceOperations.java | 122 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynStruct.java | 54 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynStructOperations.java | 137 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynUnion.java | 54 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynUnionOperations.java | 139 | ||||
-rw-r--r-- | org/omg/DynamicAny/NameDynAnyPair.java | 87 | ||||
-rw-r--r-- | org/omg/DynamicAny/NameValuePair.java | 90 |
16 files changed, 1753 insertions, 0 deletions
diff --git a/org/omg/DynamicAny/DynAny.java b/org/omg/DynamicAny/DynAny.java new file mode 100644 index 000000000..7e26ce505 --- /dev/null +++ b/org/omg/DynamicAny/DynAny.java @@ -0,0 +1,72 @@ +/* DynAny.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 org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The DynAny interface provides possibility to access the components of the + * CORBA object, stored inside the {@link Any}. The DynAny and derived classes + * additionally allows to access the members of the sequence, structure, union + * and get the data about enumeration, value type and CORBA <code>fixed</code> + * without knowing the exact type at the run time. The returned members are also + * wrapped into DynAny objects, allowing them to be the nested structures. + * </p> + * <p> + * The DynAny's are usually produced by {@link DynAnyFactory}. This factory is + * obtained from the ORB: <br> + * <code> + * DynAnyFactory f = DynAnyFactoryHelper.narrow + * (orb.resolve_initial_references("DynAnyFactory")); + * </code> + * </p> + * <p> + * DynAny can also be returned by a method, invoked on another DynAny. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAny extends DynAnyOperations, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynAnyOperations.java b/org/omg/DynamicAny/DynAnyOperations.java new file mode 100644 index 000000000..1e9aac5cc --- /dev/null +++ b/org/omg/DynamicAny/DynAnyOperations.java @@ -0,0 +1,538 @@ +/* DynAnyOperations.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 org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Defines the operations, applicable to {@link DynAny}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAnyOperations +{ + /** + * Initialises the value of this DynAny with the value, stored inside the + * passed DynAny, making a shallow copy. + * + * @param from the DynAny to copy from. + * @throws TypeMismatch if the source DynAny is invalid. + */ + void assign(DynAny from) + throws TypeMismatch, InvalidValue; + + /** + * Fully clones the content of this Any, returning a deep copy. + */ + DynAny copy(); + + /** + * Returns the focused component of this DynAny. The DynAny has the internal + * pointer (reference) that can point to one of its components. The returned + * DynAny can be used to get or set the value of the focused component. If the + * DynAny holds a primitive type with no components, this implementation + * returns <code>null</code>. + */ + DynAny current_component(); + + /** + * Destroys this DynAny, freeing the used resources. In java, resources are + * freed by the garbage collectors, so this method typically returns without + * action. + */ + void destroy(); + + /** + * Makes a DynAny from the {@link Any}. The passed {@link Any} becomes the + * enclosed instance of this DynAny, allowing to change/traverse the + * {@link Any} fields by the {@link DynAny} methods. + * + * @throws TypeMismatch if the type of this DynAny differs from the type of + * the passed Any. The DynAny cannot be reused with the enclosed type + * different from that it was initially created. + * @throws InvalidValue if the value, stored in the passed parameter, is + * otherwise invalid. + */ + void from_any(Any an_any) + throws TypeMismatch, InvalidValue; + + /** + * This method is used when the wrapped Any contains an instance of another + * Any itself. The method returns this second enclosed Any. + * + * @throws TypeMismatch if the typecode of the accessed Any is not the same as + * the typecode of this DynAny. + */ + Any get_any() + throws TypeMismatch, InvalidValue; + + /** + * Extract the boolean value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + boolean get_boolean() + throws TypeMismatch, InvalidValue; + + /** + * Extract the char value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + char get_char() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>double</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + double get_double() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>float</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + float get_float() + throws TypeMismatch, InvalidValue; + + /** + * Extract the int (CORBA long) value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + int get_long() + throws TypeMismatch, InvalidValue; + + /** + * Extract the long (CORBA long long) value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + long get_longlong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the byte (CORBA octet) value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + byte get_octet() + throws TypeMismatch, InvalidValue; + + /** + * Extract the CORBA object reference that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>short</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + short get_short() + throws TypeMismatch, InvalidValue; + + /** + * Extract the string value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + String get_string() + throws TypeMismatch, InvalidValue; + + /** + * Extract the {@link TypeCode} value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + TypeCode get_typecode() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsigned int (CORBA ulong) value that is expected to be stored + * in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + int get_ulong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsingel long (CORBA unsigned long long )value that is expected + * to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + long get_ulonglong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsigned short value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + short get_ushort() + throws TypeMismatch, InvalidValue; + + /** + * Extract the value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + Serializable get_val() + throws TypeMismatch, InvalidValue; + + /** + * Extract the wide (usually UTF-16) character value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + char get_wchar() + throws TypeMismatch, InvalidValue; + + /** + * Extract the wide (usually UFT-16) string that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + String get_wstring() + throws TypeMismatch, InvalidValue; + + /** + * Insert the {@link Any} value into the enclosed {@link Any} inside this + * DynAny. + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_any(Any an_any) + throws TypeMismatch, InvalidValue; + + /** + * Insert the boolean value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_boolean(boolean a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the char value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_char(char a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the double value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_double(double a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the float value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_float(float a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the int (CORBA long) value into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_long(int a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the long (CORBA long long) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_longlong(long a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the byte (CORBA octet) value into the enclosed {@link Any} inside + * this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_octet(byte a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the object reference into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_reference(org.omg.CORBA.Object a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the <code>short</code> value into the enclosed {@link Any} inside + * this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_short(short a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the string value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_string(String a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the {@link TypeCode} value into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_typecode(TypeCode a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the int (CORBA unsinged long) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ulong(int a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the long (CORBA unsigned long long) value into the enclosed + * {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ulonglong(long a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the short (CORBA unsigned short) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ushort(short a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_val(Serializable a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the wide char (usually UTF-16) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_wchar(char a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the wide string (usually UTF-16) into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_wstring(String a_x) + throws InvalidValue, TypeMismatch; + + /** + * Advances the internal pointer, described in the {@link current_component}, + * one position forward. + * + * @return true if the pointer now points to the new component, false if there + * are no more components of this DynAny holds a basic type that is not + * divided into components. + */ + boolean next(); + + /** + * Moves the internal pointer, described in the {@link current_component}, to + * the first component. + */ + void rewind(); + + /** + * Moves the internal pointer, described in the {@link current_component}, to + * the given position. + * + * @param p the number of the internal component on that the internal pointer + * must be focused. + * @return true on success or false if there is no component with the given + * number. If the DynAny holds the basic type, this method returs false p + * values other than 0. + */ + boolean seek(int p); + + /** + * Returns a shallow copy of the enclosed {@link Any}, + * + * @return shallow copy of the enclosed {@link Any}. + */ + Any to_any() + throws TypeMismatch; + + /** + * Returns the typecode of the object, inserted into this DynAny. + * + * @return the typecode of the inserted {@link Any} or null typecode if no + * {@link Any has been yet inserted}. + */ + TypeCode type(); + + /** + * Insert a value at the current position. + * + * @param insert_it a value to insert. + * @throws TypeMismatch if the component at the current position has a + * different type. + * @throws InvalidValue if the current position points nowhere. + */ + void insert_dyn_any(DynAny insert_it) + throws TypeMismatch, InvalidValue; + + /** + * Checks for equality with another Dynamic Any. + * + * + * @specnote This method is currently only implemented only for case when + * another DynAny was created by the factory of this implementation and + * is not an independent class, just implementing interface. Otherwise, + * a NO_IMPLEMENT minor 8148 will be thrown. General implementation is + * highly ineffective, but we will do if somebody would ever need it. + */ + boolean equal(DynAny other); + + /** + * Get the number number of fields in the enclosed structure or number of + * memebers in the enclosed array, sequence, enumeration, etc. This method + * only counts elements at the top level. For instance, if invoked on a + * DynStruct with a single member, it returns 1, irrespective of the type of + * the member. + * + * @return number of components or 0 if the enclosed Any is not divideable. + */ + int component_count(); + + /** + * Return DynAny, wrapping the second (enclosed any) that is stored in the + * wrapped Any. + * + * @throws TypeMismatch if the wrapped Any does not store another Any. + * @throws InvalidValue if the current position points nowhere. + */ + DynAny get_dyn_any() + throws TypeMismatch, InvalidValue; +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynArray.java b/org/omg/DynamicAny/DynArray.java new file mode 100644 index 000000000..f2285970a --- /dev/null +++ b/org/omg/DynamicAny/DynArray.java @@ -0,0 +1,53 @@ +/* DynArray.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 org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Represents a fixed size array. All components in the array have the same type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynArray extends DynArrayOperations, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/org/omg/DynamicAny/DynArrayOperations.java b/org/omg/DynamicAny/DynArrayOperations.java new file mode 100644 index 000000000..c1cf2e428 --- /dev/null +++ b/org/omg/DynamicAny/DynArrayOperations.java @@ -0,0 +1,92 @@ +/* DynArrayOperations.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 org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for {@link DynArray}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynArrayOperations extends DynAnyOperations +{ + /** + * Returns the array. + * + * @return the array of elements as an array of DynAny's. + */ + DynAny[] get_elements_as_dyn_any(); + + /** + * Returns the array. + * + * @return the array of elements as an array of Any's. + */ + Any[] get_elements(); + + /** + * Sets the array. + * + * @param value the array of elements an DynAny's. + * + * @throws TypeMismatch if the members of the passed array does not + * match array component type. + * + * @throws InvalidValue if the number of elements in the passed array + * is not the same as the size of this DynArray. + */ + void set_elements_as_dyn_any(DynAny[] value) throws TypeMismatch, + InvalidValue; + + /** + * Sets the array. + * + * @param value the array of elements as Any's. + * + * @throws TypeMismatch if the members of the passed array does not + * match array component type. + * + * @throws InvalidValue if the number of elements in the passed array + * is not the same as the size of this DynArray. + */ + void set_elements(Any[] value) throws TypeMismatch, InvalidValue; +} diff --git a/org/omg/DynamicAny/DynEnum.java b/org/omg/DynamicAny/DynEnum.java new file mode 100644 index 000000000..b37931fa2 --- /dev/null +++ b/org/omg/DynamicAny/DynEnum.java @@ -0,0 +1,56 @@ +/* DynEnum.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 org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the dynamic enumeration. The value of the dynamic enumeration can be + * set by name or by integer code. The valid string values and integer codes are + * taken from the typecode, from which the enumeration was constructed. The + * enumeration is an undividable type without traversable components. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynEnum extends DynEnumOperations, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/org/omg/DynamicAny/DynEnumOperations.java b/org/omg/DynamicAny/DynEnumOperations.java new file mode 100644 index 000000000..0ac4d78cd --- /dev/null +++ b/org/omg/DynamicAny/DynEnumOperations.java @@ -0,0 +1,80 @@ +/* DynEnumOperations.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 org.omg.DynamicAny; + +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; + +/** + * Defines operations, applicable to the dynamic enumeration. The value of the + * dynamic enumeration can be set by name or by integer code. The valid string + * values and integer codes are taken from the typecode, from which the + * enumeration was constructed. The enumeration is an undividable type without + * traversable components. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynEnumOperations +{ + /** + * Get the current enumeration value, as string. + */ + String get_as_string(); + + /** + * Get the current enumeration value, as int. + */ + int get_as_ulong(); + + /** + * Set the current enumeration value, as string. + * + * @throws InvalidValue if the passed string is not one of the allowed values + * for this enumeration. + */ + void set_as_string(String value) throws InvalidValue; + + /** + * Set the current enumeration value, as int. + * + * @throws InvalidValue if the passed string is not one of the allowed values + * for this enumeration. + */ + void set_as_ulong(int value) throws InvalidValue; + +} diff --git a/org/omg/DynamicAny/DynFixed.java b/org/omg/DynamicAny/DynFixed.java new file mode 100644 index 000000000..3561b01df --- /dev/null +++ b/org/omg/DynamicAny/DynFixed.java @@ -0,0 +1,55 @@ +/* DynFixed.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 org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines dynamic any, holding CORBA <code>fixed</code>. The operations on + * <code>fixed</code> (defined in {@link DynFixedOperations}) take and return + * this data type in its string representation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynFixed extends DynFixedOperations, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/org/omg/DynamicAny/DynFixedOperations.java b/org/omg/DynamicAny/DynFixedOperations.java new file mode 100644 index 000000000..1178e7c92 --- /dev/null +++ b/org/omg/DynamicAny/DynFixedOperations.java @@ -0,0 +1,70 @@ +/* DynFixedOperations.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 org.omg.DynamicAny; + +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for DynAny, holding CORBA <code>fixed</code>. + * These operations take and return this data type in its string representation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynFixedOperations +{ + /** + * Get the value of the enclosed DynFixed, as string. + */ + String get_value(); + + /** + * Set the value of the enclosed DynFixed, from string. + * + * @param fixed_value the value to set. + * + * @throws TypeMismatch if the passed string cannot be parsed into CORBA + * <code>fixed</code>. The valid string can only contain digits, decimal + * point and optional leading and trailing whitespace. + * + * @return true if the passed value can be represented without the loss of + * precision, false if some fractional digits were truncated. + */ + boolean set_value(String fixed_value) throws TypeMismatch, InvalidValue; +} diff --git a/org/omg/DynamicAny/DynSequence.java b/org/omg/DynamicAny/DynSequence.java new file mode 100644 index 000000000..bde3a418e --- /dev/null +++ b/org/omg/DynamicAny/DynSequence.java @@ -0,0 +1,54 @@ +/* DynSequence.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 org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a dynamic resizeable array with the optional upper size bound. All + * elements in this structure have the same type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynSequence extends DynSequenceOperations, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/org/omg/DynamicAny/DynSequenceOperations.java b/org/omg/DynamicAny/DynSequenceOperations.java new file mode 100644 index 000000000..8c295dbbb --- /dev/null +++ b/org/omg/DynamicAny/DynSequenceOperations.java @@ -0,0 +1,122 @@ +/* DynSequenceOperations.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 org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable to DynSequence. These are basically the same + * operations as for {@link DynArrayOperations} with additional possibility to + * change the length of the sequence. If the + * {@link org.omg.CORBA.TypeCode#length()} method of the sequence typecode + * returns positive value, it is treated as a sequence bound. An attempt to + * extend the sequence above its bound raises {@link InvalidValue}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynSequenceOperations +{ + /** + * Get the length of the sequence. + * + * @return the current sequence length that was taken from typecode or changed + * with set_length. + */ + int get_length(); + + /** + * Set the length of the sequence. If the sequence is shortened, the tailing + * members are discarded, but the remaining content is not affected. If the + * new length is larger than the previous one, the new members are added to + * the end of the sequence. These new members are initialised to they default + * values. + * + * @param length the new length of the sequence. + * + * @throws InvalidValue if this is a bounded sequence, and the size being set + * exceeds the sequence bound. + */ + public void set_length(int length) throws InvalidValue; + + /** + * Returns the array, containing the sequence elements. + * + * @return the array of elements as an array of DynAny's. + */ + DynAny[] get_elements_as_dyn_any(); + + /** + * Returns the array, containing the sequence elements. + * + * @return the array of elements as an array of Any's. + */ + Any[] get_elements(); + + /** + * Sets the sequence elements from the array. The length of the sequence is + * set to the length of the passed array. + * + * @param value the array of elements an DynAny's. + * + * @throws TypeMismatch if the members of the passed array does not match + * sequence component type. + * + * @throws InvalidValue if this is a bounded sequence and the number of + * elements in the passed array exceeds the sequence bound. + */ + void set_elements_as_dyn_any(DynAny[] value) throws TypeMismatch, + InvalidValue; + + /** + * Sets the sequence elements from the array. The length of the sequence is + * set to the length of the passed array. + * + * @param value the array of elements as Any's. + * + * + * @throws TypeMismatch if the members of the passed array does not match + * sequence component type. + * + * @throws InvalidValue if this is a bounded sequence and the number of + * elements in the passed array exceeds the sequence bound. + */ + void set_elements(Any[] value) throws TypeMismatch, InvalidValue; +} diff --git a/org/omg/DynamicAny/DynStruct.java b/org/omg/DynamicAny/DynStruct.java new file mode 100644 index 000000000..b7b900a0d --- /dev/null +++ b/org/omg/DynamicAny/DynStruct.java @@ -0,0 +1,54 @@ +/* DynStruct.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 org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a fixed size structure with the named fields that may have + * different types. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynStruct extends DynStructOperations, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/org/omg/DynamicAny/DynStructOperations.java b/org/omg/DynamicAny/DynStructOperations.java new file mode 100644 index 000000000..303adae3d --- /dev/null +++ b/org/omg/DynamicAny/DynStructOperations.java @@ -0,0 +1,137 @@ +/* DynStructOperations.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 org.omg.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines the operations, applicable to the DynStructure. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynStructOperations extends DynAnyOperations +{ + /** + * Get the kind of the structure field at the current position. + * + * @return the kind of field. + * + * @throws TypeMismatch for an empty structure (normally exception). + * @throws InvalidValue if the current position does not indicate a memeber. + */ + TCKind current_member_kind() throws TypeMismatch, InvalidValue; + + /** + * Get the name of the structure field at the current position. + * + * @return the name of the field. + * + * @throws TypeMismatch for an empty structure (normally exception). + * @throws InvalidValue if the current position does not indicate a memeber. + */ + String current_member_name() throws TypeMismatch, InvalidValue; + + /** + * Return array, describing describing the name and the value of each member + * in the structure. + * + * @return an array of NameDynAnyPair's, each defining a single field in this + * structure. + */ + NameDynAnyPair[] get_members_as_dyn_any(); + + /** + * Return array, describing describing the name and the value of each member + * in the structure. + * + * @return an array of NameValuePair's, each defining a single field in this + * structure. + */ + NameValuePair[] get_members(); + + /** + * Set the structure contend from the array, where each member defines the + * name and value of the structure field. If the passed array is not empty, + * the current position is set to the first member. + * + * The members of array must follow in the same order as the structure fields, + * how they are defined in the typecode. The name-based value assignment is + * not supported. + * + * @specnote The name-based value assignment is not supported by Sun's jdk + * 1.4. + * + * @param an array of NameDynValuePair's, each defining a single field in the + * structure. + * + * @throws TypeMismatch if the member of the passed array has a different + * type than the corresponding structure field. + * + * @throws InvalidValue if the size of the passed array is not the same as the + * number of fields in this structure. + */ + void set_members_as_dyn_any(NameDynAnyPair[] value) throws TypeMismatch, + InvalidValue; + + /** + * Set the structure contend from the array, where each member defines the + * name and value of the structure field. If the passed array is not empty, + * the current position is set to the first member. + * + * The members of array must follow in the same order as the structure fields, + * how they are defined in the typecode. The name-based value assignment is + * not supported. + * + * @specnote The name-based value assignment is not supported by Sun's jdk + * 1.4. + * + * @param an array of NameValuePair's, each defining a single field in the + * structure. + * + * @throws TypeMismatch if the member of the passed array has a different + * type than the corresponding structure field. + * + * @throws InvalidValue if the size of the passed array is not the same as the + * number of fields in this structure. + */ + void set_members(NameValuePair[] value) throws TypeMismatch, InvalidValue; + +} diff --git a/org/omg/DynamicAny/DynUnion.java b/org/omg/DynamicAny/DynUnion.java new file mode 100644 index 000000000..b75ff613b --- /dev/null +++ b/org/omg/DynamicAny/DynUnion.java @@ -0,0 +1,54 @@ +/* DynUnion.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 org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a fixed size structure with the named fields that may have different + * types. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynUnion extends DynUnionOperations, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/org/omg/DynamicAny/DynUnionOperations.java b/org/omg/DynamicAny/DynUnionOperations.java new file mode 100644 index 000000000..0a35bc9c7 --- /dev/null +++ b/org/omg/DynamicAny/DynUnionOperations.java @@ -0,0 +1,139 @@ +/* DynUnionOperations.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 org.omg.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines the operations, applicable to the DynUnion. The DynUnion has only two + * valid positions: + * <ul> + * <li>0 - contains the discriminator of the union. The discriminator defines, + * which of the union variants is currently active.</li> + * <li>1 - contains the currently active variant of the union content (a union + * member). </li> + * </ul> + * The size of the union is normally 2. If the discriminator value defines no + * valid variant, the union consists of discriminator only, having the size 1. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynUnionOperations +{ + /** + * Get the value of discriminator, defining which content variant (member) is + * active. + */ + DynAny get_discriminator(); + + /** + * 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. + * + * @throws TypeMismatch if the discriminator has a wrong type of this union. + */ + void set_discriminator(DynAny aDiscriminator) throws TypeMismatch; + + /** + * Get the kind of the union descriminator. + * + * @return the TCKind value of the discriminator typecode. + */ + TCKind discriminator_kind(); + + /** + * Get the current variant of the union content. + * + * @return the current member of the union. This reference is only valid as + * long as the current member does not change. + * + * @throws InvalidValue if the union has no active member. + */ + DynAny member() throws InvalidValue; + + /** + * Returns the kind of the currently active union member. + * + * @return the TCKind value of the union member. + * + * @throws InvalidValue if the union has no active member. + */ + TCKind member_kind() throws InvalidValue; + + /** + * Returns the name of the currently active union member. + * + * @return the TCKind value of the union member. + * + * @throws InvalidValue if the union has no active member. + */ + String member_name() throws InvalidValue; + + /** + * Returns true if the union has no active member. This happens if If the + * discriminator value defines no valid variant. Such union consists of + * discriminator only, having the size 1. + */ + boolean has_no_active_member(); + + /** + * Set the discriminator to default value. The current position is set to 0. + * This also sets the content variant to the default variant, and the size of + * the union becomes 2. + * + * @throws TypeMismatch if the default case is not defined for this union. + */ + void set_to_default_member() throws TypeMismatch; + + /** + * Set the discriminator to value that does not correspond any content variant + * (any union <code>case</code> label). The current position is set to 0. + * The size of the union becomes 0. + * + * @throws TypeMismatch if the union has explicit default case. + */ + void set_to_no_active_member() throws TypeMismatch; +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/NameDynAnyPair.java b/org/omg/DynamicAny/NameDynAnyPair.java new file mode 100644 index 000000000..34b27b69c --- /dev/null +++ b/org/omg/DynamicAny/NameDynAnyPair.java @@ -0,0 +1,87 @@ +/* NameDynAnyPair.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 org.omg.DynamicAny; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Stores the named value, representing the name by string and the value by + * {@link DynAny}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameDynAnyPair implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1992533286932908564L; + + /** + * The name of the named value. + */ + public String id; + + /** + * The value of the named value. + */ + public DynAny value; + + /** + * Create unitialised instance with both fields left with default + * <code>null</code> value. + */ + public NameDynAnyPair() + { + } + + /** + * Create an instance with the given initial values. + * + * @param aName the name of the named value. + * @param aValue the value of the named value. + */ + public NameDynAnyPair(String aName, DynAny aValue) + { + id = aName; + value = aValue; + } +} diff --git a/org/omg/DynamicAny/NameValuePair.java b/org/omg/DynamicAny/NameValuePair.java new file mode 100644 index 000000000..eb82cfa26 --- /dev/null +++ b/org/omg/DynamicAny/NameValuePair.java @@ -0,0 +1,90 @@ +/* NameValuePair.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 org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.DynStruct; +import org.omg.CORBA.IDLEntity; + +import java.io.Serializable; + +/** + * Holds the value, having the given name(id). This class is used by with + * {@link DynStruct} to name the fields of the record (structure). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameValuePair implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1289460542874201736L; + + /** + * The value of the structure record. + */ + public Any value; + + /** + * The name of the structure record. + */ + public String id; + + /** + * Cretes an unitialised instance of the name-value pair. + */ + public NameValuePair() + { + } + + /** + * Creates the name-value pair, initialising the fields to the passed values. + * + * @param aName the name (also called id) of the name-value pair, normally the + * name of the structure field. + * + * @param aValue the value of the name-value pair. + */ + public NameValuePair(String aName, Any aValue) + { + id = aName; + value = aValue; + } +}
\ No newline at end of file |