diff options
Diffstat (limited to 'libjava/classpath/org/omg/IOP')
46 files changed, 4569 insertions, 0 deletions
diff --git a/libjava/classpath/org/omg/IOP/CodeSets.java b/libjava/classpath/org/omg/IOP/CodeSets.java new file mode 100644 index 000000000..8ba228f69 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodeSets.java @@ -0,0 +1,62 @@ +/* CodeSets.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.IOP; + + /** + * Holds the integer identifier of the CodeSets context. This context + * consist of this identifier, followed by two standard codes, first for + * narrow and second for wide character sets. The charset codes are + * integer (CORBA long) constants. Usually "narrow" means 8 bit and + * "wide" means 16 bit, but under specific circumstances these two + * charsets may be identical. The context is optional for "narrow" + * characters (assuming the charset code 0x00010001 = ISO 8859-1). + * It is required if the "wide" characters are transferred. + * + * They standard charset values are managed in + * {@link gnu.CORBA.GIOP.CharSets_OSF}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CodeSets +{ + /** + * Specifies the CodeSets value, 1. + */ + int value = 1; +} diff --git a/libjava/classpath/org/omg/IOP/Codec.java b/libjava/classpath/org/omg/IOP/Codec.java new file mode 100644 index 000000000..580485804 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/Codec.java @@ -0,0 +1,71 @@ +/* Codec.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.IOP; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * Codec provides means to encode IDL data types into the byte arrays. + * Some parts of the CORBA message may contain such abstracted (encapsulated) + * byte arrays, holding arbitrary information. The encoding and decoding + * operations are defined separately in {@link CodecOperations}. + * The Codec for {@link ENCODING_CDR_ENCAPS} v 1.0 - 1.2 is required by OMG. + * Vendors can implement additional Codec's, driven by alternative algorithms. + * </p> + * <p> + * The {@link ENCODING_CDR_ENCAPS} Codec, returned by the {@link CodecFactory}, + * is a local object. It is not possible to get its stringified reference, + * to send it over CDR streams or invoke the methods remotely. + * </p> + * <p> + * Codec is obtained from {@link CodecFactory}. CodecFactory is returned by + * <code>ORB.resolve_initial_references("CodecFactory")</code>. + * </p> + * @specnote The ENCODING_CDR_ENCAPS Codec is local in both Suns + * (at least till 1.4 inclusive) an this implementation. + * + * + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Codec + extends CodecOperations, IDLEntity, org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/IOP/CodecFactory.java b/libjava/classpath/org/omg/IOP/CodecFactory.java new file mode 100644 index 000000000..a1ac84a8b --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecFactory.java @@ -0,0 +1,67 @@ +/* CodecFactory.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.IOP; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The CodecFactory is used to obtaind {@link Codec} for the given encoding. + * The obtaining operations are defined separately in + * {@link CodecFactoryOperations}. + * </p> + * <p> + * The CodecFactory is a local object. It is not possible to get its + * stringified reference, to send it over CDR streams or invoke the + * methods remotely. + * </p> + * <p> + * CodecFactory is returned by + * <code>ORB.resolve_initial_references("CodecFactory")</code>. + * </p> + * + * @specnote The CodecFactory is local in both Suns (up till 1.4 inclusive) + * an this implementation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CodecFactory + extends CodecFactoryOperations, IDLEntity, org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java b/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java new file mode 100644 index 000000000..3b1cf43ab --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java @@ -0,0 +1,164 @@ +/* CodecFactoryHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the +* CORBA object {@link CodecFactory}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class CodecFactoryHelper +{ + /** + * Get the type code of the {@link CodecFactory}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "CodecFactory"); + } + + /** + * Insert the CodecFactory into the given Any. + * + * @param any the Any to insert into. + * @param that the CodecFactory to insert. + */ + public static void insert(Any any, CodecFactory that) + { + any.insert_Object(that); + } + + /** + * Extract the CodecFactory from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain CodecFactory. + */ + public static CodecFactory extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the CodecFactory repository id. + * + * @return "IDL:omg.org/IOP/CodecFactory:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/CodecFactory:1.0"; + } + + /** + * Cast the passed object into the CodecFactory. As the CodecFactory + * is a local object, this is not different from the java type cast. + * + * @throws BAD_PARAM if the passed object is not a CodecFactory. + */ + public static CodecFactory narrow(org.omg.CORBA.Object obj) + { + try + { + return (CodecFactory) obj; + } + catch (ClassCastException ex) + { + BAD_PARAM bad = new BAD_PARAM("CodecFactory expected"); + bad.initCause(ex); + throw bad; + } + } + + /** + * Narrow the given object to the CodecFactory. For the objects that are + * always local, this operation does not differ from the ordinary + * {@link #narrow} (ClassCastException will be thrown if narrowing something + * different). See OMG issue 4158. + * + * @param obj the object to cast. + * + * @return the casted CodecFactory. + * + * @since 1.5 + */ + public static CodecFactory unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * This should read the CodecFactory from the CDR intput stream, + * but this is not possible as CodecFactory is a local object. + * + * @specnote Suns implementation (1.4) throws this exception either. + * + * @throws MARSHAL, minor code 0 and incomplete, always. + */ + public static CodecFactory read(InputStream input) + { + throw new MARSHAL(UNSUPPORTED, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * This should write the CodecFactory from the CDR intput stream, + * but this is not possible as CodecFactory is a local object. + * + * @specnote Suns implementation (1.4) throws this exception either. + * + * @throws MARSHAL, minor code 0 and incomplete, always. + */ + public static void write(OutputStream output, CodecFactory value) + { + throw new MARSHAL(UNSUPPORTED, 0, CompletionStatus.COMPLETED_NO); + } + + private static String UNSUPPORTED = + "The operation is unsupported for CodecFactory because it is a local object"; +} diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryOperations.java b/libjava/classpath/org/omg/IOP/CodecFactoryOperations.java new file mode 100644 index 000000000..022cac447 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecFactoryOperations.java @@ -0,0 +1,63 @@ +/* CodecFactoryOperations.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.IOP; + +import org.omg.IOP.CodecFactoryPackage.UnknownEncoding; + +/** + * Defines the operations, applicable to + * the CodecFactory. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CodecFactoryOperations +{ + /** + * Create Codec for the given encoding. + * + * @param for_encoding the encoding, for that the codec must be created. + * + * @return the appropriate Codec. + * + * @throws UnknownEncoding if there are not Codec that would support the + * required encoding. + */ + Codec create_codec(Encoding for_encoding) + throws UnknownEncoding; +} diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncoding.java b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncoding.java new file mode 100644 index 000000000..e79b3bcd5 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncoding.java @@ -0,0 +1,78 @@ +/* UnknownEncoding.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecFactoryPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* The {@link org.omg.IOP.CodecFactoryOperations#create_codec} raises +* UnknownEncoding if that factory cannot create a +* {@link org.omg.IOP.Codec} of the given encoding. +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public final class UnknownEncoding + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 1613955753212049966L; + + /** + * Create UnknownEncoding with no explaining message. + */ + public UnknownEncoding() + { + } + + /** + * Create the UnknownEncoding with explaining message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public UnknownEncoding(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java new file mode 100644 index 000000000..f518bc278 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java @@ -0,0 +1,143 @@ +/* UnknownEncodingHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecFactoryPackage; + +import gnu.CORBA.EmptyExceptionHolder; +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.StructMember; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.BAD_OPERATION; + + /** + * The helper operations for the exception {@link UnknownEncoding}. + * + * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) + */ +public abstract class UnknownEncodingHelper +{ + /** + * Create the UnknownEncoding typecode (structure, + * named "UnknownEncoding"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[0]; + return + orb.create_exception_tc (id(), "UnknownEncoding", members); + + } + + /* Every user exception with no user defined fields can use EmptyExceptionHolder */ + + /** + * Insert the UnknownEncoding into the given Any. + * + * @param any the Any to insert into. + * @param that the UnknownEncoding to insert. + */ + public static void insert(Any any, UnknownEncoding that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the UnknownEncoding from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain UnknownEncoding. + */ + public static UnknownEncoding extract(Any any) + { + try + { + EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); + return (UnknownEncoding) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("UnknownEncoding expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the UnknownEncoding repository id. + * + * @return "IDL:omg.org/IOP/CodecFactory/UnknownEncoding:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/CodecFactory/UnknownEncoding:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static UnknownEncoding read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + UnknownEncoding value = new UnknownEncoding(id); + + return value; + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, UnknownEncoding value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/IOP/CodecOperations.java b/libjava/classpath/org/omg/IOP/CodecOperations.java new file mode 100644 index 000000000..a9ff9539d --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecOperations.java @@ -0,0 +1,126 @@ +/* CodecOperations.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.IOP.CodecPackage.FormatMismatch; +import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; +import org.omg.IOP.CodecPackage.TypeMismatch; + +/** + * Defines the operations, applicable to + * the Codec. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CodecOperations +{ + /** + * Encode the value, stored inside the given {@link Any}, into array of + * bytes. The returned byte array contains the data structure typecode, + * followed by the data structure itself. + * + * @param that the {@link Any}, containing the data structure, required to + * encode. + * + * @return the array of bytes, containing the encoded data structure. + * + * @throws InvalidTypeForEncoding if the data structure is not supported + * by this {@link Codec} (wide char and wide string are not supported + * by ENCODING_CDR_ENCAPS v 1.0). + * + * @see #decode(byte[]) + */ + byte[] encode(Any that) + throws InvalidTypeForEncoding; + + /** + * Decode the given array of bytes and return the decoded value, inserted + * into {@link Any}. This methods expects that the byte array contains + * the CDR-encoded data structure {@link TypeCode}, followed by the data + * structure itself. + * + * @param them an array of bytes to decode. + * @return the {@link Any}, containing the decoded structure. The structure + * can be extracted from the Any with the appropriate helper. + * + * @throws FormatMismatch on the invalid structure of the byte array. + * + * @see #encode(Any) + */ + Any decode(byte[] them) + throws FormatMismatch; + + /** + * Encode the value (without the typecode), stored in the passed {@link Any}, + * into the given byte array. + * + * @param that_value the {@link Any}, holding the value to encode. + * @return the array, containing the encoded value alone (no preceeding + * typecode). + * + * @see #decode_value(byte[], TypeCode) + */ + byte[] encode_value(Any that_value) + throws InvalidTypeForEncoding; + + /** + * Decode the given array of bytes, supposing that they contain the + * given data structure, and return the decoded value. + * + * @param them the array of bytes to decode. Should contain the data type, + * matching the structure, defined in the <code>type</code> parameter. + * Does not contain the typecode itself. + * + * @param type the typecode of the data structure, stored in the byte + * array. + * + * @return the {@link Any}, containing the decoded structure. The + * structure can be extracted from the Any with the appropriate helper. + * + * @throws FormatMismatch on the invalid structure of the byte array. + * @throws TypeMismatch if discovered that the the byte array defines a + * different structure. + * + * @see #encode_value(Any) + */ + Any decode_value(byte[] them, TypeCode type) + throws FormatMismatch, TypeMismatch; +} diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatch.java b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatch.java new file mode 100644 index 000000000..7e2fc1a1f --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatch.java @@ -0,0 +1,81 @@ +/* FormatMismatch.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* This exception is raised by {@link org.omg.IOP.CodecOperations#decode} +* or {@link org.omg.IOP.CodecOperations#decode_value} when the data in the +* octet sequence cannot be decoded into {@link org.omg.CORBA.Any}. +* +* @see org.omg.IOP.CodecOperations +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public final class FormatMismatch + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 5818121867618342320L; + + /** + * Create FormatMismatch with no explaining message. + */ + public FormatMismatch() + { + } + + /** + * Create the FormatMismatch with explaining message and all fields + * initialised to the given values. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public FormatMismatch(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java new file mode 100644 index 000000000..5d5f154d7 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java @@ -0,0 +1,139 @@ +/* FormatMismatchHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecPackage; + +import gnu.CORBA.EmptyExceptionHolder; +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the exception {@link FormatMismatch}. +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public abstract class FormatMismatchHelper +{ + /** + * Create the FormatMismatch typecode (structure, + * named "FormatMismatch"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + return orb.create_exception_tc(id(), "FormatMismatch", members); + } + + /** + * Insert the FormatMismatch into the given Any. + * + * @param any the Any to insert into. + * @param that the FormatMismatch to insert. + */ + public static void insert(Any any, FormatMismatch that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the FormatMismatch from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain FormatMismatch. + */ + public static FormatMismatch extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (FormatMismatch) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("FormatMismatch expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the FormatMismatch repository id. + * + * @return "IDL:omg.org/IOP/Codec/FormatMismatch:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/Codec/FormatMismatch:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static FormatMismatch read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + FormatMismatch value = new FormatMismatch(id); + + return value; + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, FormatMismatch value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncoding.java b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncoding.java new file mode 100644 index 000000000..4df69d476 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncoding.java @@ -0,0 +1,81 @@ +/* InvalidTypeForEncoding.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* This exception is raised by {@link org.omg.IOP.CodecOperations#encode} or +* {@link org.omg.IOP.CodecOperations#encode_value} when the type is not +* valid for the encoding. For instance, the "wide" character string is +* not a valid type for GIOP version 1.0. +* +* @see org.omg.IOP.CodecOperations +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public final class InvalidTypeForEncoding + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 7951932210684443970L; + + /** + * Create InvalidTypeForEncoding with no explaining message. + */ + public InvalidTypeForEncoding() + { + } + + /** + * Create the InvalidTypeForEncoding with explaining message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public InvalidTypeForEncoding(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java new file mode 100644 index 000000000..96dcbd817 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java @@ -0,0 +1,141 @@ +/* InvalidTypeForEncodingHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecPackage; + +import gnu.CORBA.EmptyExceptionHolder; +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the exception {@link InvalidTypeForEncoding}. +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public abstract class InvalidTypeForEncodingHelper +{ + /** + * Create the InvalidTypeForEncoding typecode (structure, named + * "InvalidTypeForEncoding"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[0]; + return orb.create_exception_tc(id(), "InvalidTypeForEncoding", members); + } + + /** + * Insert the InvalidTypeForEncoding into the given Any. + * + * @param any the Any to insert into. + * @param that the InvalidTypeForEncoding to insert. + */ + public static void insert(Any any, InvalidTypeForEncoding that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the InvalidTypeForEncoding from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain + * InvalidTypeForEncoding. + */ + public static InvalidTypeForEncoding extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (InvalidTypeForEncoding) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = + new BAD_OPERATION("InvalidTypeForEncoding expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the InvalidTypeForEncoding repository id. + * + * @return "IDL:omg.org/IOP/Codec/InvalidTypeForEncoding:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/Codec/InvalidTypeForEncoding:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static InvalidTypeForEncoding read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + InvalidTypeForEncoding value = new InvalidTypeForEncoding(id); + + return value; + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, InvalidTypeForEncoding value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatch.java b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatch.java new file mode 100644 index 000000000..d388588b8 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatch.java @@ -0,0 +1,79 @@ +/* TypeMismatch.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* The TypeMismatch may be thrown by various methods in org.omg.DynamicAny +* package when the operation is not applicable due unexpected +* {@link org.omg.CORBA.TypeCode}. +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public final class TypeMismatch + extends UserException + implements IDLEntity, Serializable +{ + + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -3544092104480759035L; + + /** + * Create TypeMismatch with no explaining message. + */ + public TypeMismatch() + { + } + + /** + * Create the TypeMismatch with explaining message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public TypeMismatch(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java new file mode 100644 index 000000000..ed65c9bf5 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java @@ -0,0 +1,139 @@ +/* TypeMismatchHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP.CodecPackage; + +import gnu.CORBA.EmptyExceptionHolder; +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the exception {@link TypeMismatch}. +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public abstract class TypeMismatchHelper +{ + /** + * Create the TypeMismatch typecode (structure, + * named "TypeMismatch"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + return orb.create_exception_tc(id(), "TypeMismatch", members); + } + + /** + * Insert the TypeMismatch into the given Any. + * + * @param any the Any to insert into. + * @param that the TypeMismatch to insert. + */ + public static void insert(Any any, TypeMismatch that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the TypeMismatch from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain TypeMismatch. + */ + public static TypeMismatch extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (TypeMismatch) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the TypeMismatch repository id. + * + * @return "IDL:omg.org/IOP/Codec/TypeMismatch:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/Codec/TypeMismatch:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static TypeMismatch read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + TypeMismatch value = new TypeMismatch(id); + + return value; + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, TypeMismatch value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/IOP/ComponentIdHelper.java b/libjava/classpath/org/omg/IOP/ComponentIdHelper.java new file mode 100644 index 000000000..5ceb6d46e --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ComponentIdHelper.java @@ -0,0 +1,123 @@ +/* ComponentIdHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* A helper operations for th Component id. A Component Id is an integer +* constant and needs no helper, but the one is included to +* to facilitate the automated code handling. +* +* @specnote In this implementation, this class is not in use. Its "logical" +* place is the read/write methods of the TaggedComponentHelper, to handle the +* first member (int) of the record of the Tagged Component. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ComponentIdHelper +{ + /** + * Create the ComponentId typecode (alias of CORBA ulong, named "ComponentId". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc("IDL:omg.org/IOP/ComponentId:1.0", + "ComponentId", + orb.get_primitive_tc(TCKind.tk_ulong)); + } + + /** + * Insert the int into the given Any. + */ + public static void insert(Any any, int that) + { + any.insert_ulong(that); + } + + /** + * Extract the int from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain int. + */ + public static int extract(Any any) + { + return any.extract_ulong(); + } + + /** + * Get the int repository id. + * + * @return "IDL:omg.org/IOP/ComponentId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/ComponentId:1.0"; + } + + /** + * Read the ComponentId from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static int read(InputStream input) + { + return input.read_ulong(); + } + + /** + * Write the ComponentId to the CDR output stream (as int). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, int value) + { + output.write_ulong(value); + } +} diff --git a/libjava/classpath/org/omg/IOP/ENCODING_CDR_ENCAPS.java b/libjava/classpath/org/omg/IOP/ENCODING_CDR_ENCAPS.java new file mode 100644 index 000000000..49cfe5d4c --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ENCODING_CDR_ENCAPS.java @@ -0,0 +1,58 @@ +/* ENCODING_CDR_ENCAPS.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.IOP; + + /** + * <p> + * Holds an integer identifier of the ENCODING_CDR_ENCAPS encoding. + * This is the only encoding, required by OMG specification. + * </p><p> + * Apart the encoding format integer identifier, the encoding record + * contains the GIOP version number. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ENCODING_CDR_ENCAPS +{ + /** + * Specifies the ENCODING_CDR_ENCAPS encoding, value 0. + */ + short value = 0; +} diff --git a/libjava/classpath/org/omg/IOP/Encoding.java b/libjava/classpath/org/omg/IOP/Encoding.java new file mode 100644 index 000000000..90debf980 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/Encoding.java @@ -0,0 +1,98 @@ +/* Encoding.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines the encoding format of the {@link Codec}, including the major + * and minor version numbers. The only currently supported encodings are + * ENCODING_CDR_ENCAPS versions 1.1 - 1.2. Vendors can implement additional + * encodings. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class Encoding + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1489257079856841992L; + + /** + * The format of encoding. For instance, {@link ENCODING_CDR_ENCAPS#value}. + */ + public short format; + + /** + * The major version number of this encoding format. + */ + public byte major_version; + + /** + * The minor version number of this encoding format. + */ + public byte minor_version; + + /** + * Create the unitialised instance. + */ + public Encoding() + { + } + + /** + * Create the instance, initialising field to the passed values. + * + * @param _format the format of encoding, like + * {@link ENCODING_CDR_ENCAPS#value}. + * + * @param _major_version the major format version. + * @param _minor_version the minor format version. + */ + public Encoding(short _format, byte _major_version, byte _minor_version) + { + format = _format; + major_version = _major_version; + minor_version = _minor_version; + } +} diff --git a/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java b/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java new file mode 100644 index 000000000..92a068cba --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java @@ -0,0 +1,60 @@ +/* ExceptionDetailMessage.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +/** + * <p>Defines the ExceptionDetailMessage (= 14) service context. This context + * may be included into reply message, having the SYSTEM_EXCEPTION or + * USER_EXCEPTION reply status, as the alternative to the stack trace + * that might contain sensitive or unwanted information. The service + * context contains the CDR-encapsulated wide string, usually + * returned by {@link Exception#getMessage()}. + * </p><p> + * The applications may also send the more comprehensive UnknownExceptionInfo + * ( = 9 ) service context that contains the thrown exception, written + * as the Value type. + * </p> + */ +public interface ExceptionDetailMessage +{ + /** + * Specifies the ExceptionDetailMessage value, 14. + */ + int value = 14; +} diff --git a/libjava/classpath/org/omg/IOP/IOR.java b/libjava/classpath/org/omg/IOP/IOR.java new file mode 100644 index 000000000..47245acef --- /dev/null +++ b/libjava/classpath/org/omg/IOP/IOR.java @@ -0,0 +1,113 @@ +/* IOR.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * <p> + * The object IOR contains sufficient information for finding local or + * remote CORBA object. It also contains additional data like the object + * native and supported char sets, URLs to download the required additional + * java classes and so on. IOR can define multiple alternative addresses + * for the same object or indicate that the object is equal to null. + * </p><p> + * The IOR is a standard structure, transferred when sending an object with + * {@link org.omg.CORBA.portable.OutputStream#write_Object(org.omg.CORBA.Object)} + * and receiving with {@link org.omg.CORBA.portable.InputStream#read_Object()}. + * The stringified object references, managed by + * {@link org.omg.CORBA.ORB#string_to_object} + * and {@link org.omg.CORBA.ORB#object_to_string} are also IORs, where the + * initially binary data are encoded as strings using hexadecimal notation. + * </p><p> + * The IOR is represented as the object repository id, followed + * by the sequence of the abstract profiles, each having the integer type + * identifier and the followed array of binary data. The empty sequence of + * profiles represents a null object, written, for instance, in response + * to the call of write_Object(null). + * + * @specnote GNU Classpath has its own implementation of IOR machinery at + * gnu.CORBA.IOR. The reason is that IORs are required from 1.2, but only + * in 1.4 the associated classes appear in the public API. + */ +public final class IOR + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 1901439890645554948L; + + /** + * The profiles, associated with this IOR reference. The possible + * profiles are listed in {@link TaggedProfile} description. + */ + public TaggedProfile[] profiles; + + /** + * The object repository Id. + */ + public String type_id; + + /** + * Create an unitialised instance of IOR profile. + * + * @specnote The profile will be intialised to the IOR, representing + * a null object. + */ + public IOR() + { + type_id = ""; + profiles = new TaggedProfile[ 0 ]; + } + + /** + * Create the IOR, initialised with the passed data. + * + * @param _type_id the repository id for this IOR object. + * @param _profiles the array of profiles for this IOR. + */ + public IOR(String _type_id, TaggedProfile[] _profiles) + { + type_id = _type_id; + profiles = _profiles; + } +} diff --git a/libjava/classpath/org/omg/IOP/IORHelper.java b/libjava/classpath/org/omg/IOP/IORHelper.java new file mode 100644 index 000000000..b4cd3a3d9 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/IORHelper.java @@ -0,0 +1,155 @@ +/* IORHelper.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.IOP; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* A helper operations for the structure {@link IOR}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class IORHelper +{ + /** + * Create the IOR typecode (structure, named "IOR"). The typecode states that + * the structure contains the following fields: type_id, profiles. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[2]; + + TypeCode field; + + field = orb.get_primitive_tc(TCKind.tk_string); + members[0] = new StructMember("type_id", field, null); + + field = orb.create_sequence_tc(0, TaggedProfileHelper.type()); + members[1] = new StructMember("profiles", field, null); + return orb.create_struct_tc(id(), "IOR", members); + } + + /** + * Insert the IOR into the given Any. This method uses the IORHolder. + * + * @param any the Any to insert into. + * @param that the IOR to insert. + */ + public static void insert(Any any, IOR that) + { + any.insert_Streamable(new IORHolder(that)); + } + + /** + * Extract the IOR from given Any. + * This method uses the IORHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain IOR. + */ + public static IOR extract(Any any) + { + try + { + return ((IORHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("IOR expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the IOR repository id. + * + * @return "IDL:omg.org/IOP/IOR:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/IOR:1.0"; + } + + /** + * Read the structure from the CDR intput stream. Expects repository + * it, then number of the tagged profiles and then the tagged profiles. + * Does not expect the endian indicator, present in the beginning of the + * stringified IOR references. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static IOR read(InputStream input) + { + IOR value = new IOR(); + value.type_id = input.read_string(); + value.profiles = new TaggedProfile[ input.read_long() ]; + for (int i0 = 0; i0 < value.profiles.length; i0++) + value.profiles [ i0 ] = TaggedProfileHelper.read(input); + return value; + } + + /** + * Write the structure to the CDR output stream. Writes + * Expects repository it, then number of the tagged profiles and then + * the tagged profiles. Will not write the endian indicator, present + * in the beginning of the stringified IOR references. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, IOR value) + { + output.write_string(value.type_id); + output.write_long(value.profiles.length); + for (int i0 = 0; i0 < value.profiles.length; i0++) + TaggedProfileHelper.write(output, value.profiles [ i0 ]); + } +} diff --git a/libjava/classpath/org/omg/IOP/IORHolder.java b/libjava/classpath/org/omg/IOP/IORHolder.java new file mode 100644 index 000000000..f490c77c5 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/IORHolder.java @@ -0,0 +1,103 @@ +/* IORHolder.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the {@link IOR}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class IORHolder + implements Streamable +{ + /** + * The stored IOR value. + */ + public IOR value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public IORHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public IORHolder(IOR initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = IORHelper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + IORHelper.write(output, value); + } + + /** + * Get the typecode of the IOR. + */ + public org.omg.CORBA.TypeCode _type() + { + return IORHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java new file mode 100644 index 000000000..887e4e5bc --- /dev/null +++ b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java @@ -0,0 +1,138 @@ +/* MultipleComponentProfileHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.BAD_OPERATION; + +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.InputStream; + + /** + * A helper operations for the array of {@link TaggedComponent} + * (MultipleComponentProfile). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class MultipleComponentProfileHelper +{ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_sequence_tc(0, TaggedComponentHelper.type()); + } + /** + * Insert the MultipleComponentProfile into the given Any. This method uses + * the MultipleComponentProfileHolder. + * + * @param any the Any to insert into. + * @param those the TaggedComponent[] to insert. + */ + public static void insert(Any any, TaggedComponent[] those) + { + any.insert_Streamable(new MultipleComponentProfileHolder(those)); + } + + /** + * Extract the MultipleComponentProfile from given Any. + * This method uses the MultipleComponentProfileHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain MultipleComponentProfile. + */ + public static TaggedComponent[] extract(Any any) + { + try + { + return ((MultipleComponentProfileHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("MultipleComponentProfile expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the MultipleComponentProfile repository id. + * + * @return "IDL:omg.org/IOP/MultipleComponentProfile:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/MultipleComponentProfile:1.0"; + } + + /** + * Read the sequence from the CDR intput stream. + * Expects the array size (as CORBA long), followed by + * the array members (if any). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static TaggedComponent[] read(InputStream input) + { + TaggedComponent[] value; + value = new TaggedComponent[ input.read_long() ]; + for (int i0 = 0; i0 < value.length; i0++) + value[i0] = TaggedComponentHelper.read(input); + return value; + } + + /** + * Write the structure to the CDR output stream. + * Writes the array size (as CORBA long), followed by + * the array members (if any). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value an array to write. + */ + public static void write(OutputStream output, TaggedComponent[] value) + { + output.write_long(value.length); + for (int i0 = 0; i0 < value.length; i0++) + TaggedComponentHelper.write(output, value[i0]); + } +} diff --git a/libjava/classpath/org/omg/IOP/MultipleComponentProfileHolder.java b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHolder.java new file mode 100644 index 000000000..1fe69ba03 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHolder.java @@ -0,0 +1,105 @@ +/* MultipleComponentProfileHolder.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.Streamable; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + + +/** + * A holder for the sequence of {@link TaggedComponent} + * ({@link org.omg.IOP.MultipleComponentProfileHelper}). + * +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class MultipleComponentProfileHolder + implements Streamable +{ + /** + * The stored array of <code>TaggedComponent</code>. + */ + public TaggedComponent[] value; + + /** + * Create the unitialised instance, leaving the value array + * with default <code>null</code> value. + */ + public MultipleComponentProfileHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the array that will be assigned to + * the <code>value</code> array. + */ + public MultipleComponentProfileHolder(TaggedComponent[] initialValue) + { + value = initialValue; + } + + /** + * Read the {@link #value} array from the CDR stream. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = MultipleComponentProfileHelper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + MultipleComponentProfileHelper.write(output, value); + } + + /** + * Get the typecode of the TaggedComponent. + */ + public org.omg.CORBA.TypeCode _type() + { + return MultipleComponentProfileHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/IOP/ProfileIdHelper.java b/libjava/classpath/org/omg/IOP/ProfileIdHelper.java new file mode 100644 index 000000000..2e546f463 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ProfileIdHelper.java @@ -0,0 +1,123 @@ +/* ProfileIdHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* A helper operations for th Profile id. A Profile Id is an integer +* constant and needs no helper, but the one is included to +* to facilitate the automated code handling. +* +* @specnote In this implementation, this class is not in use. Its "logical" +* place is the read/write methods of the TaggedProfileHelper, to handle the +* first member (int) of the record of the tagged profile. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ProfileIdHelper +{ + /** + * Create the ProfileId typecode (alias of CORBA ulong, named "ProfileId". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc("IDL:omg.org/IOP/ProfileId:1.0", "ProfileId", + orb.get_primitive_tc(TCKind.tk_ulong)); + } + + /** + * Insert the int into the given Any. + */ + public static void insert(Any any, int that) + { + any.insert_ulong(that); + } + + /** + * Extract the int from given Any. + * This method uses the ProfileContextHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain int. + */ + public static int extract(Any any) + { + return any.extract_ulong(); + } + + /** + * Get the int repository id. + * + * @return "IDL:omg.org/IOP/ProfileId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/ProfileId:1.0"; + } + + /** + * Read the ProfileId from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static int read(InputStream input) + { + return input.read_ulong(); + } + + /** + * Write the ProfileId to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, int value) + { + output.write_ulong(value); + } +} diff --git a/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java b/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java new file mode 100644 index 000000000..a071c8488 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java @@ -0,0 +1,56 @@ +/* RMICustomMaxStreamFormat.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.IOP; + + /** + * A single constant interface, defining the RMICustomMaxStreamFormat (= 17) + * service context. This constant is used in the service contexts + * inside the message when the {@link TAG_RMI_CUSTOM_MAX_STREAM_FORMAT} + * are used in IOR references. Please note that these two constants have + * different values. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RMICustomMaxStreamFormat +{ + /** + * Specifies the RMICustomMaxStreamFormat value, 17. + */ + int value = 17; +} diff --git a/libjava/classpath/org/omg/IOP/ServiceContext.java b/libjava/classpath/org/omg/IOP/ServiceContext.java new file mode 100644 index 000000000..a2b7119ce --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ServiceContext.java @@ -0,0 +1,95 @@ +/* ServiceContext.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The ServiceContext structure contains the service data, being passed in the + * CORBA message. For instance, then passing the wide characters, it is + * mandatory to include the service context, defining the used encoding. + * The contexts are recognised by they integer indentifier. + * In this class, the content of the context is represented as an abstract + * array of bytes. + * + * @see ServiceContextHolder + * @see ServiceContextHelper + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ServiceContext + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2232391417465261379L; + + /** + * The context id (for instance, 0x1 for code sets context). + * At the moment of writing, the OMG defines 16 standard values and + * provides rules to register the vendor specific context ids. + * The range 0-4095 is reserved for the future standard OMG contexts. + */ + public int context_id; + + /** + * The context_data. + */ + public byte[] context_data; + + /** + * Create the unitialised instance, assigning to + * the all fields java default values. + */ + public ServiceContext() + { + } + + /** + * Create the instance, initialising the fields to the given values. + */ + public ServiceContext(int a_context_id, byte[] a_context_data) + { + this.context_id = a_context_id; + this.context_data = a_context_data; + } +} diff --git a/libjava/classpath/org/omg/IOP/ServiceContextHelper.java b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java new file mode 100644 index 000000000..6eab887ca --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java @@ -0,0 +1,154 @@ +/* ServiceContextHelper.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.IOP; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* A helper operations for the structure {@link ServiceContext}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServiceContextHelper +{ + /** + * Create the ServiceContext typecode (structure, named "ServiceContext"). The + * typecode states that the structure contains the following fields: + * context_id, context_data. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[2]; + + TypeCode field; + + field = orb.create_alias_tc("IDL:omg.org/IOP/ServiceId:1.0", "ServiceId", + orb.get_primitive_tc(TCKind.tk_ulong)); + members[0] = new StructMember("context_id", field, null); + + field = orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet)); + members[1] = new StructMember("context_data", field, null); + return orb.create_struct_tc(id(), "ServiceContext", members); + } + + /** + * Insert the ServiceContext into the given Any. This method uses the + * ServiceContextHolder. + * + * @param any the Any to insert into. + * @param that the ServiceContext to insert. + */ + public static void insert(Any any, ServiceContext that) + { + any.insert_Streamable(new ServiceContextHolder(that)); + } + + /** + * Extract the ServiceContext from given Any. + * This method uses the ServiceContextHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain ServiceContext. + */ + public static ServiceContext extract(Any any) + { + try + { + return ((ServiceContextHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("ServiceContext expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ServiceContext repository id. + * + * @return "IDL:omg.org/IOP/ServiceContext:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/ServiceContext:1.0"; + } + + /** + * Read the context from the CDR intput stream (first id, then + * data as a flexible length byte sequence). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ServiceContext read(InputStream input) + { + ServiceContext value = new ServiceContext(); + value.context_id = input.read_long(); + value.context_data = new byte[ input.read_long() ]; + for (int i0 = 0; i0 < value.context_data.length; i0++) + value.context_data [ i0 ] = input.read_octet(); + return value; + } + + /** + * Write the context to the CDR output stream (first id, then + * data as a flexible length byte sequence). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, ServiceContext value) + { + output.write_long(value.context_id); + output.write_long(value.context_data.length); + for (int i0 = 0; i0 < value.context_data.length; i0++) + output.write_octet(value.context_data [ i0 ]); + } +} diff --git a/libjava/classpath/org/omg/IOP/ServiceContextHolder.java b/libjava/classpath/org/omg/IOP/ServiceContextHolder.java new file mode 100644 index 000000000..d6a95b313 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ServiceContextHolder.java @@ -0,0 +1,103 @@ +/* ServiceContextHolder.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the structure {@link ServiceContext}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class ServiceContextHolder + implements Streamable +{ + /** + * The stored ServiceContext value. + */ + public ServiceContext value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public ServiceContextHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public ServiceContextHolder(ServiceContext initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = ServiceContextHelper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + ServiceContextHelper.write(output, value); + } + + /** + * Get the typecode of the ServiceContext. + */ + public org.omg.CORBA.TypeCode _type() + { + return ServiceContextHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java b/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java new file mode 100644 index 000000000..7072ac079 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java @@ -0,0 +1,141 @@ +/* ServiceContextListHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the +* CORBA object {@link ServiceContext}[]. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServiceContextListHelper +{ + /** + * Get the type code of the {@link ServiceContext}[]. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), + "ServiceContextList"); + } + + /** + * Insert the ServiceContext[] into the given Any. + * + * @param any the Any to insert into. + * @param that the ServiceContext[] to insert. + */ + public static void insert(Any any, ServiceContext[] that) + { + any.insert_Streamable(new ServiceContextListHolder(that)); + } + + /** + * Extract the ServiceContext[] from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ServiceContext[]. + */ + public static ServiceContext[] extract(Any any) + { + try + { + ServiceContextListHolder holder = + (ServiceContextListHolder) any.extract_Streamable(); + return holder.value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("ServiceContext[] expected"); + bad.minor = Minor.Any; + bad.initCause(ex); + throw bad; + } + } + + /** + * Get the ServiceContext[] repository id. + * + * @return "IDL:omg.org/IOP/ServiceContextList:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/ServiceContextList:1.0"; + } + + /** + * Read the ServiceContext[] from the CDR intput stream as a flexible lenth + * sequence. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ServiceContext[] read(InputStream input) + { + ServiceContext[] value = new ServiceContext[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + { + value [ i ] = ServiceContextHelper.read(input); + } + return value; + } + + /** + * Write the ServiceContext[] to the CDR output stream as a flexible length + * sequence. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, ServiceContext[] value) + { + output.write_long(value.length); + for (int i = 0; i < value.length; i++) + { + ServiceContextHelper.write(output, value [ i ]); + } + } +} diff --git a/libjava/classpath/org/omg/IOP/ServiceContextListHolder.java b/libjava/classpath/org/omg/IOP/ServiceContextListHolder.java new file mode 100644 index 000000000..b4266777e --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ServiceContextListHolder.java @@ -0,0 +1,103 @@ +/* ServiceContextListHolder.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the sequence of the {@link ServiceContext}s. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class ServiceContextListHolder + implements Streamable +{ + /** + * The stored ServiceContext[] value. + */ + public ServiceContext[] value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public ServiceContextListHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public ServiceContextListHolder(ServiceContext[] initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = ServiceContextListHelper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + ServiceContextListHelper.write(output, value); + } + + /** + * Get the typecode of the ServiceContext[]. + */ + public org.omg.CORBA.TypeCode _type() + { + return ServiceContextListHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/IOP/ServiceIdHelper.java b/libjava/classpath/org/omg/IOP/ServiceIdHelper.java new file mode 100644 index 000000000..ab9789e22 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/ServiceIdHelper.java @@ -0,0 +1,124 @@ +/* ServiceIdHelper.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* A helper operations for a context service id. A service Id is an integer +* constant and needs no helper, but the one is included to +* to facilitate the automated code handling. +* +* @specnote In this implementation, this class is not in use. Its "logical" +* place is the read/write methods of the ServiceContextHelper, to handle the +* first member (int) of the context record. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServiceIdHelper +{ + /** + * Create the ServiceId typecode (alias of CORBA ulong, named "ServiceId". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc("IDL:omg.org/IOP/ServiceId:1.0", "ServiceId", + orb.get_primitive_tc(TCKind.tk_ulong) + ); + } + + /** + * Insert the int into the given Any. + */ + public static void insert(Any any, int that) + { + any.insert_ulong(that); + } + + /** + * Extract the int from given Any. + * This method uses the ServiceContextHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain int. + */ + public static int extract(Any any) + { + return any.extract_ulong(); + } + + /** + * Get the int repository id. + * + * @return "IDL:omg.org/IOP/ServiceId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/ServiceId:1.0"; + } + + /** + * Read the ServiceId from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static int read(InputStream input) + { + return input.read_ulong(); + } + + /** + * Write the ServiceId to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, int value) + { + output.write_ulong(value); + } +} diff --git a/libjava/classpath/org/omg/IOP/TAG_ALTERNATE_IIOP_ADDRESS.java b/libjava/classpath/org/omg/IOP/TAG_ALTERNATE_IIOP_ADDRESS.java new file mode 100644 index 000000000..13cb1c689 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_ALTERNATE_IIOP_ADDRESS.java @@ -0,0 +1,59 @@ +/* TAG_ALTERNATE_IIOP_ADDRESS.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.IOP; + + /** + * Holds an integer constant of the TAG_ALTERNATE_IIOP_ADDRESS Component that + * may occur zero or more times in the Internet of Multiple components profile. + * The tag contains the possible alternative address (host and port) of + * the object being defined by IOR profile. + * This tag is supported since GIOP 1.2. + * + * @see TAG_INTERNET_IOP + * @see TAG_MULTIPLE_COMPONENTS + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_ALTERNATE_IIOP_ADDRESS +{ + /** + * Specifies the TAG_ALTERNATE_IIOP_ADDRESS value, 3. + */ + int value = 3; +} diff --git a/libjava/classpath/org/omg/IOP/TAG_CODE_SETS.java b/libjava/classpath/org/omg/IOP/TAG_CODE_SETS.java new file mode 100644 index 000000000..07c5c9c32 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_CODE_SETS.java @@ -0,0 +1,69 @@ +/* TAG_CODE_SETS.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + + /** + * <p> + * Holds the integer identifier of the code sets profile. The code sets + * profile provides information about the native and supported encodings + * for the "narrow" (usually 8 bit) and "wide" (usually 16 bit) characters. + * In Gnu Classpath implementation the class, responsible for providing + * this information is {@link gnu.CORBA.GIOP.CharSets_OSF}. + * </p> + * <p> + * If this profile is missing, it is assumed, that the "narrow" characters + * are encoded in ISO 8859-1. However there is no default encoding for the + * "wide" characters, and, if this profile is missing, the INV_OBJREF + * minor code 1 is thrown. + * </p> + * <p> + * The "narrow" characters are used in char and string. + * The "wide" characters are used in wchar and wstring and are not + * supported by GIOP 1.0. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_CODE_SETS +{ + /** + * Specifies the TAG_CODE_SETS value, 1. + */ + int value = 1; +} diff --git a/libjava/classpath/org/omg/IOP/TAG_INTERNET_IOP.java b/libjava/classpath/org/omg/IOP/TAG_INTERNET_IOP.java new file mode 100644 index 000000000..59eed9d9f --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_INTERNET_IOP.java @@ -0,0 +1,55 @@ +/* TAG_INTERNET_IOP.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.IOP; + + /** + * Holds the integer identifier of the internet profile. The internet + * profile contains (in the given order) a supported GIOP + * version, an address of the remote host, a port of the remote host + * and an object key as the byte array. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_INTERNET_IOP +{ + /** + * Specifies the TAG_INTERNET_IOP value, 0. + */ + int value = 0; +} diff --git a/libjava/classpath/org/omg/IOP/TAG_JAVA_CODEBASE.java b/libjava/classpath/org/omg/IOP/TAG_JAVA_CODEBASE.java new file mode 100644 index 000000000..df5a171fa --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_JAVA_CODEBASE.java @@ -0,0 +1,59 @@ +/* TAG_JAVA_CODEBASE.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.IOP; + + /** + * <p> + * Holds an integer identifier of the TAG_JAVA_CODEBASE profile. This profile + * provides a space separated list of URLs, from where the required + * stubs and ties can be downloaded. + * </p><p> + * The this IOR profile component is used to provide the code source for + * stubs and ties. The code source for values and value helpers is + * transmitted when transferring the value itself. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_JAVA_CODEBASE +{ + /** + * Specifies the TAG_JAVA_CODEBASE value, 25. + */ + int value = 25; +} diff --git a/libjava/classpath/org/omg/IOP/TAG_MULTIPLE_COMPONENTS.java b/libjava/classpath/org/omg/IOP/TAG_MULTIPLE_COMPONENTS.java new file mode 100644 index 000000000..5cb3cc007 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_MULTIPLE_COMPONENTS.java @@ -0,0 +1,52 @@ +/* TAG_MULTIPLE_COMPONENTS.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.IOP; + + /** + * Holds the integer identifier of the multiple components profile. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_MULTIPLE_COMPONENTS +{ + /** + * Specifies the TAG_MULTIPLE_COMPONENTS value, 1. + */ + int value = 1; +} diff --git a/libjava/classpath/org/omg/IOP/TAG_ORB_TYPE.java b/libjava/classpath/org/omg/IOP/TAG_ORB_TYPE.java new file mode 100644 index 000000000..2fe7714f3 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_ORB_TYPE.java @@ -0,0 +1,67 @@ +/* TAG_ORB_TYPE.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.IOP; + +/** + * <p> + * Holds an integer constant of the TAG_ORB_TYPE Component that defines + * the kind or CORBA implementation of ORB the reference is comming from. + * This information may be useful to work around problems with that + * particular ORB, or exploit shared efficiencies. This tag contains + * a single unsigned long value; these values are managed by OMG group. + * </p><p> + * Anyone may register any ORB types by submitting a one-paragraph + * description of the ORB type to the OMG, and will receive a new ORB + * type ID in return. A list of all ORB type descriptions should be + * available on the OMG web server. + * </p><p> + * TODO Register the GNU Classpath kind of ORB. Not registered at the moment. + * <p> + * @see TAG_INTERNET_IOP + * @see TAG_MULTIPLE_COMPONENTS + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_ORB_TYPE +{ + /** + * Specifies the TAG_ORB_TYPE value, 0. + */ + int value = 0; +} diff --git a/libjava/classpath/org/omg/IOP/TAG_POLICIES.java b/libjava/classpath/org/omg/IOP/TAG_POLICIES.java new file mode 100644 index 000000000..65ccff88c --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_POLICIES.java @@ -0,0 +1,54 @@ +/* TAG_POLICIES.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.IOP; + + /** + * An integer identifier for the TAG_POLICIES component. This component + * contains the sequence of QoS (Quality of Service) policies exported + * with the object reference by an object adapter. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_POLICIES +{ + /** + * Specifies the TAG_POLICIES value, 2. + */ + int value = 2; +} diff --git a/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java b/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java new file mode 100644 index 000000000..e13c759c9 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java @@ -0,0 +1,61 @@ +/* TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.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.IOP; + +/** + * A single constant interface, defining the + * TAG_RMI_CUSTOM_MAX_STREAM_FORMAT (= 38) tagged component. + * + * This component defines the format that has been used to write the RMI-IIOP + * value type objects in the message. It consists of the single byte, + * having the value of the used version. If this component is missing, + * the default value is assumed to be 1 for GIOP 1.2 and 2 for GIOP 1.3. + * The component can occur only once in the same IOR profile. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TAG_RMI_CUSTOM_MAX_STREAM_FORMAT +{ + /** + * Specifies the TAG_RMI_CUSTOM_MAX_STREAM_FORMAT value, 38. + */ + int value = 38; +} diff --git a/libjava/classpath/org/omg/IOP/TaggedComponent.java b/libjava/classpath/org/omg/IOP/TaggedComponent.java new file mode 100644 index 000000000..038fcd844 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TaggedComponent.java @@ -0,0 +1,93 @@ +/* TaggedComponent.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* The tagged component in a part of the {@link TaggedProfile}. +* The examples of the possible components inside the tag are +* {@link TAG_CODE_SETS}, {@link TAG_ALTERNATE_IIOP_ADDRESS}, +* {@link TAG_JAVA_CODEBASE}, {@link TAG_ORB_TYPE} and {@link TAG_POLICIES}. +* The complete list (over 20 possible components) can be found +* in OMG specification. Some of these components occur only once +* (in the same TaggedProfile), others can be repeated. +* +* @see TaggedComponentHolder +* @see TaggedComponentHelper +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class TaggedComponent + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2084695346022761692L; + + /** + * The integer tag identifier, for instance, TAG_CODE_SETS.value. + */ + public int tag; + + /** + * The tag component data. + */ + public byte[] component_data; + + /** + * Create the unitialised instance, assigning to + * the all fields java default values. + */ + public TaggedComponent() + { + } + + /** + * Create the instance, initialising the fields to the given values. + */ + public TaggedComponent(int a_tag, byte[] a_component_data) + { + this.tag = a_tag; + this.component_data = a_component_data; + } +} diff --git a/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java new file mode 100644 index 000000000..e35849a70 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java @@ -0,0 +1,156 @@ +/* TaggedComponentHelper.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.IOP; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the {@link TaggedComponent}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class TaggedComponentHelper +{ + /** + * Create the TaggedComponent typecode (structure, named "TaggedComponent"). + * The typecode states that the structure contains the following fields: tag, + * component_data. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[2]; + + TypeCode field; + + field = orb.create_alias_tc("IDL:omg.org/IOP/ComponentId:1.0", + "ComponentId", + orb.get_primitive_tc(TCKind.tk_ulong)); + members[0] = new StructMember("tag", field, null); + + field = orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet)); + members[1] = new StructMember("component_data", field, null); + return orb.create_struct_tc(id(), "TaggedComponent", members); + } + + /** + * Insert the TaggedComponent into the given Any. This method uses the + * TaggedComponentHolder. + * + * @param any the Any to insert into. + * @param that the TaggedComponent to insert. + */ + public static void insert(Any any, TaggedComponent that) + { + any.insert_Streamable(new TaggedComponentHolder(that)); + } + + /** + * Extract the TaggedComponent from given Any. This method uses the + * TaggedComponentHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain TaggedComponent. + */ + public static TaggedComponent extract(Any any) + { + try + { + return ((TaggedComponentHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("TaggedComponent expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the TaggedComponent repository id. + * + * @return "IDL:omg.org/IOP/TaggedComponent:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/TaggedComponent:1.0"; + } + + /** + * Read the structure from the CDR intput stream. Expects the integer + * identifier of the tag, then the size of the tag data and then the specified + * number of bytes, representing the data of the tag. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static TaggedComponent read(InputStream input) + { + TaggedComponent value = new TaggedComponent(); + value.tag = input.read_long(); + int length = input.read_long(); + value.component_data = new byte[length]; + input.read_octet_array(value.component_data, 0, length); + return value; + } + + /** + * Write the structure to the CDR output stream. Writes the integer identifier + * of the tag, then the size of the tag data and then the specified number of + * bytes, representing the data of the tag. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, TaggedComponent value) + { + output.write_long(value.tag); + output.write_long(value.component_data.length); + output.write_octet_array(value.component_data, 0, value.component_data.length); + } +} diff --git a/libjava/classpath/org/omg/IOP/TaggedComponentHolder.java b/libjava/classpath/org/omg/IOP/TaggedComponentHolder.java new file mode 100644 index 000000000..1b19be608 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TaggedComponentHolder.java @@ -0,0 +1,103 @@ +/* TaggedComponentHolder.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.Streamable; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + + /** + * A holder for the structure {@link TaggedComponent}. + * +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class TaggedComponentHolder + implements Streamable +{ + /** + * The stored TaggedComponent value. + */ + public TaggedComponent value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public TaggedComponentHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public TaggedComponentHolder(TaggedComponent initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = TaggedComponentHelper .read(input); + } + + /** + * Write the stored value into the CDR stream. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + TaggedComponentHelper .write(output, value); + } + + /** + * Get the typecode of the TaggedComponent. + */ + public org.omg.CORBA.TypeCode _type() + { + return TaggedComponentHelper. type(); + } +} diff --git a/libjava/classpath/org/omg/IOP/TaggedProfile.java b/libjava/classpath/org/omg/IOP/TaggedProfile.java new file mode 100644 index 000000000..564066a3b --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TaggedProfile.java @@ -0,0 +1,110 @@ +/* TaggedProfile.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* The TaggedProfile if part of the {@link IOR}, defining a single specific +* aspect of the object related information. The content of profile depends +* on this information. It is represented here just as an array of +* bytes. The OMG currently defines three types of the tagged profile: +* <ul> +* <li>The Internet profile, identified by {@link TAG_INTERNET_IOP}, +* supports the Internet Inter-ORB Protocol. +* </li> +* <li>The Multiple Components profile, identified by +* {@link TAG_MULTIPLE_COMPONENTS}, may be used to carry various IOR +* tagged components. +* <li> +* </li> +* <li>The SCCP IOP profile (described in OMG CORBA/IN Interworking +* specification).</li> +* </ul> +* +* The tagged profile may have its internal tagged components. The examples +* of the possible components inside the tag are {@link TAG_CODE_SETS}, +* {@link TAG_ALTERNATE_IIOP_ADDRESS}, {@link TAG_JAVA_CODEBASE}, +* {@link TAG_ORB_TYPE} and {@link TAG_POLICIES}. The complete list can only +* be found in OMG specification. Some of them occur only once +* (in the same TaggedProfile), others can be repeated. +* +* @see TaggedProfileHolder +* @see TaggedProfileHelper +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class TaggedProfile + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -461232684387903343L; + + /** + * The integer tag identifier, typically one of TAG_INTERNET_IOP.value or + * TAG_MULTIPLE_COMPONENTS.value. + */ + public int tag; + + /** + * The profile_data, represented here in the form of the array of bytes. + */ + public byte[] profile_data; + + /** + * Create the unitialised instance, assigning to + * the all fields java default values. + */ + public TaggedProfile() + { + } + + /** + * Create the instance, initialising the fields to the given values. + */ + public TaggedProfile(int a_tag, byte[] a_profile_data) + { + tag = a_tag; + profile_data = a_profile_data; + } +} diff --git a/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java new file mode 100644 index 000000000..95e404c2b --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java @@ -0,0 +1,186 @@ +/* TaggedProfileHelper.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.IOP; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.CDR.BufferredCdrInput; +import gnu.CORBA.CDR.BufferedCdrOutput; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +import java.io.IOException; + +/** + * A helper operations for the structure {@link TaggedProfile}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class TaggedProfileHelper +{ + /** + * Create the TaggedProfile typecode (structure, named "TaggedProfile"). The + * typecode states that the structure contains the following fields: tag, + * profile_data. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[2]; + + TypeCode field; + + field = orb.create_alias_tc("IDL:omg.org/IOP/ProfileId:1.0", "ProfileId", + orb.get_primitive_tc(TCKind.tk_ulong)); + members[0] = new StructMember("tag", field, null); + + field = orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet)); + members[1] = new StructMember("profile_data", field, null); + return orb.create_struct_tc(id(), "TaggedProfile", members); + } + + /** + * Insert the TaggedProfile into the given Any. This method uses the + * TaggedProfileHolder. + * + * @param any the Any to insert into. + * @param that the TaggedProfile to insert. + */ + public static void insert(Any any, TaggedProfile that) + { + any.insert_Streamable(new TaggedProfileHolder(that)); + } + + /** + * Extract the TaggedProfile from given Any. This method uses the + * TaggedProfileHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain TaggedProfile. + */ + public static TaggedProfile extract(Any any) + { + try + { + return ((TaggedProfileHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("TaggedProfile expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the TaggedProfile repository id. + * + * @return "IDL:omg.org/IOP/TaggedProfile:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/IOP/TaggedProfile:1.0"; + } + + /** + * Read the structure from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static TaggedProfile read(InputStream input) + { + TaggedProfile value = new TaggedProfile(); + value.tag = input.read_long(); + + if (input instanceof BufferredCdrInput) + { + // Highly probable. + value.profile_data = ((BufferredCdrInput) input).read_sequence(); + } + else + { + value.profile_data = new byte[input.read_long()]; + for (int i0 = 0; i0 < value.profile_data.length; i0++) + value.profile_data[i0] = input.read_octet(); + } + return value; + } + + /** + * Write the structure to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, TaggedProfile value) + { + output.write_long(value.tag); + + if (output instanceof BufferedCdrOutput) + { + // Highly probable. + output.write_long(value.profile_data.length); + try + { + output.write(value.profile_data); + } + catch (IOException e) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.Encapsulation; + m.initCause(e); + throw m; + } + } + else + { + output.write_long(value.profile_data.length); + for (int i0 = 0; i0 < value.profile_data.length; i0++) + output.write_octet(value.profile_data[i0]); + } + } +} diff --git a/libjava/classpath/org/omg/IOP/TaggedProfileHolder.java b/libjava/classpath/org/omg/IOP/TaggedProfileHolder.java new file mode 100644 index 000000000..9ee3aab2d --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TaggedProfileHolder.java @@ -0,0 +1,103 @@ +/* TaggedProfileHolder.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.IOP; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the structure {@link TaggedProfile}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class TaggedProfileHolder + implements Streamable +{ + /** + * The stored TaggedProfile value. + */ + public TaggedProfile value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public TaggedProfileHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public TaggedProfileHolder(TaggedProfile initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = TaggedProfileHelper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + TaggedProfileHelper.write(output, value); + } + + /** + * Get the typecode of the TaggedProfile. + */ + public org.omg.CORBA.TypeCode _type() + { + return TaggedProfileHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/IOP/TransactionService.java b/libjava/classpath/org/omg/IOP/TransactionService.java new file mode 100644 index 000000000..ce7f7bfa3 --- /dev/null +++ b/libjava/classpath/org/omg/IOP/TransactionService.java @@ -0,0 +1,56 @@ +/* TransactionService.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.IOP; + + +/** +* Holds the integer identifier of the TransactionService context. +* The content of that data structure is defined by OMG as +* CosTransactions::PropogationContext in the Object Transaction +* Service specification (formal/00-06-28). +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public interface TransactionService +{ + /** + * Specifies the TransactionService value, 0. + */ + int value = 0; +} |