diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/org/omg | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/classpath/org/omg')
554 files changed, 69607 insertions, 0 deletions
diff --git a/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java b/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java new file mode 100644 index 000000000..5fb03533a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java @@ -0,0 +1,102 @@ +/* ACTIVITY_COMPLETED.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.CORBA; + +import java.io.Serializable; + +/** + * The ACTIVITY_COMPLETED indicates that the Activity context in which the + * method call was made has been completed due to a timeout of either the + * Activity itself or a transaction that encompasses the Activity. It also + * may mean that the Activity is completed in a manner other than that + * originally requested. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ACTIVITY_COMPLETED + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = 463786710302308798L; + + /** + * Creates ACTIVITY_COMPLETED with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public ACTIVITY_COMPLETED(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates ACTIVITY_COMPLETED with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public ACTIVITY_COMPLETED() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a ACTIVITY_COMPLETED exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public ACTIVITY_COMPLETED(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created ACTIVITY_COMPLETED exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public ACTIVITY_COMPLETED(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java b/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java new file mode 100644 index 000000000..eeec38254 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java @@ -0,0 +1,100 @@ +/* ACTIVITY_REQUIRED.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.CORBA; + +import java.io.Serializable; + +/** + * The ACTIVITY_REQUIRED system exception indicates that an Activity context was + * necessary to perform the invoked operation, but one was not found + * associated with the calling thread. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ACTIVITY_REQUIRED + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = -5684213471781455027L; + + /** + * Creates ACTIVITY_REQUIRED with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public ACTIVITY_REQUIRED(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates ACTIVITY_REQUIRED with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public ACTIVITY_REQUIRED() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a ACTIVITY_REQUIRED exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public ACTIVITY_REQUIRED(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created ACTIVITY_REQUIRED exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public ACTIVITY_REQUIRED(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ARG_IN.java b/libjava/classpath/org/omg/CORBA/ARG_IN.java new file mode 100644 index 000000000..1c652166a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ARG_IN.java @@ -0,0 +1,55 @@ +/* ARG_IN.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.CORBA; + +/** + * This simple interface defines just one constant, normally used + * to mark the parameter as an "input parameter". + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see NamedValue + */ +public interface ARG_IN +{ + /** + * The flag, specifying that the parameter is used to pass and not to + * return the data. + */ + int value = 1; +} diff --git a/libjava/classpath/org/omg/CORBA/ARG_INOUT.java b/libjava/classpath/org/omg/CORBA/ARG_INOUT.java new file mode 100644 index 000000000..247c61826 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ARG_INOUT.java @@ -0,0 +1,57 @@ +/* ARG_IN.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.CORBA; + +/** + * This simple interface defines just one constant, normally used + * to mark that the the parameter is used both to pass and to + * return some value. It is a similar conception like passing a + * parameter "by reference" in C or Pascal. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see NamedValue + */ +public interface ARG_INOUT +{ + /** + * The constant, specifying that the parameter is used both + * to pass and to return the data. + */ + int value = 3; +} diff --git a/libjava/classpath/org/omg/CORBA/ARG_OUT.java b/libjava/classpath/org/omg/CORBA/ARG_OUT.java new file mode 100644 index 000000000..4f8748829 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ARG_OUT.java @@ -0,0 +1,55 @@ +/* ARG_IN.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.CORBA; + +/** + * This simple interface defines just one constant, normally used + * to mark the parameter as an "output parameter". + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see NamedValue + */ +public interface ARG_OUT +{ + /** + * The flag, indicating that the parameter is used to return, and + * not to pass the data. + */ + int value = 2; +} diff --git a/libjava/classpath/org/omg/CORBA/Any.java b/libjava/classpath/org/omg/CORBA/Any.java new file mode 100644 index 000000000..1e72709d2 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Any.java @@ -0,0 +1,460 @@ +/* Any.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.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * A container that can store a value of either user defined or + * primitive IDL type. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class Any + implements Serializable, IDLEntity +{ + /** + * Using v 1.4 serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1217179597823814463L; + + /** + * Creates an input stream from that this Any object's value can be + * read (unmarshalled). + */ + public abstract org.omg.CORBA.portable.InputStream create_input_stream(); + + /** + * Creates an output stream into which this <code>Any</code> object's + * value can be written (marshalled). + * + * @return the newly created output stream. + */ + public abstract org.omg.CORBA.portable.OutputStream create_output_stream(); + + /** + * Compare this <code>Any</code> with another <code>Any</code>. + * + * @param other the other instance to compare with. + * + * @return true if both values and value typecodes are equal, + * false otherwise. + */ + public abstract boolean equal(Any other); + + /** + * Extract the CORBA <code>Object</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>Object</code> or the value has not been set. + */ + public abstract org.omg.CORBA.Object extract_Object() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>Principal</code> from this <code>Any</code> + * + * @throws NO_IMPLEMENT, always. + * + * @deprecated by CORBA 2.2. + */ + public Principal extract_Principal() + { + throw new NO_IMPLEMENT(); + } + + /** + * Extract an arbitrary {@link org.omg.CORBA.portable.Streamable } from + * this <code>Any</code>. + * + * @throws BAD_INV_ORDER if the caller has invoked operations in the + * wrong order. + * + * @throws NO_IMPLEMENT, always (override to get functionality). + */ + public org.omg.CORBA.portable.Streamable extract_Streamable() + throws org.omg.CORBA.BAD_INV_ORDER + { + throw new NO_IMPLEMENT(); + } + + /** + * Extract the TypeCode from this <code>Any</code> value field. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>TypeCode</code> or the value has not been set. + */ + public abstract TypeCode extract_TypeCode() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>Value</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>Value</code> or the value has not been set. + */ + public abstract java.io.Serializable extract_Value() + throws BAD_OPERATION; + + /** + * Extract another <code>Any</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>any</code> or the value has not been set. + */ + public abstract Any extract_any() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>boolean</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>boolean</code> or the value has not been set. + */ + public abstract boolean extract_boolean() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>char</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>char</code> or the value has not been set. + */ + public abstract char extract_char() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>double</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>double</code> or the value has not been set. + */ + public abstract double extract_double() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>fixed</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>fixed</code> or the value has not been set. + * + * @throws NO_IMPLEMENT, always (override to get functionality). + */ + public java.math.BigDecimal extract_fixed() + throws BAD_OPERATION + { + throw new NO_IMPLEMENT(); + } + + /** + * Extract the CORBA <code>float</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>float</code> or the value has not been set. + */ + public abstract float extract_float() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>long</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>long</code> or the value has not been set. + */ + public abstract int extract_long() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>long long</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>longlong</code> or the value has not been set. + */ + public abstract long extract_longlong() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>octet</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>octet</code> or the value has not been set. + */ + public abstract byte extract_octet() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>short</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>short</code> or the value has not been set. + */ + public abstract short extract_short() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>string</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>string</code> or the value has not been set. + */ + public abstract String extract_string() + throws BAD_OPERATION; + + /** + * Extract the CORBA unsigned <code>long</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than unsigned <code>long</code> or the value has not been set. + */ + public abstract int extract_ulong() + throws BAD_OPERATION; + + /** + * Extract the CORBA unsigned <code>long long</code> from this + * <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than unsigned <code>long long</code> or the value has not been set. + */ + public abstract long extract_ulonglong() + throws BAD_OPERATION; + + /** + * Extract the CORBA unsigned <code>short</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than unsigned <code>short</code> or the value has not been set. + */ + public abstract short extract_ushort() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>wchar</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>wchar</code> or the value has not been set. + */ + public abstract char extract_wchar() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>wstring</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>wstring</code> or the value has not been set. + */ + public abstract String extract_wstring() + throws BAD_OPERATION; + + /** + * Insert the CORBA <code>Object</code> into this <code>Any</code> + */ + public abstract void insert_Object(org.omg.CORBA.Object x, TypeCode typecode); + + /** + * Insert the CORBA <code>Object</code> into this <code>Any</code> + */ + public abstract void insert_Object(org.omg.CORBA.Object x); + + /** + * Insert the CORBA <code>Principal</code> into this <code>Any</code>. + * @deprecated by CORBA 2.2. + */ + public void insert_Principal(Principal x) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>Streamable</code> into this <code>Any</code> + */ + public void insert_Streamable(org.omg.CORBA.portable.Streamable x) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>TypeCode</code> into this <code>Any</code> + * value field. + */ + public abstract void insert_TypeCode(TypeCode typecode); + + /** + * Insert the CORBA <code>Value</code> into this <code>Any</code>. + * + * The type of the Any should be set (by {@link #type(TypeCode)}) + * before inserting the value. + */ + public abstract void insert_Value(Serializable x, TypeCode typecode); + + /** + * Insert the CORBA <code>Value</code> into this <code>Any</code>. + * + * The type of the Any should be set (by {@link #type(TypeCode)}) + * before inserting the value. + */ + public abstract void insert_Value(Serializable x); + + /** + * Insert the CORBA <code>any</code> into this <code>Any</code> + */ + public abstract void insert_any(Any x); + + /** + * Insert the CORBA <code>boolean</code> into this <code>Any</code> + */ + public abstract void insert_boolean(boolean x); + + /** + * Insert the CORBA <code>char</code> into this <code>Any</code> + */ + public abstract void insert_char(char x); + + /** + * Insert the CORBA <code>double</code> into this <code>Any</code> + */ + public abstract void insert_double(double x); + + /** + * Insert the CORBA <code>fixed</code> into this <code>Any</code> + */ + public void insert_fixed(java.math.BigDecimal x, TypeCode typecode) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>fixed</code> into this <code>Any</code> + */ + public void insert_fixed(java.math.BigDecimal x) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>float</code> into this <code>Any</code> + */ + public abstract void insert_float(float x); + + /** + * Insert the CORBA <code>long</code> into this <code>Any</code> + */ + public abstract void insert_long(int x); + + /** + * Insert the CORBA <code>longlong</code> into this <code>Any</code> + */ + public abstract void insert_longlong(long x); + + /** + * Insert the CORBA <code>octet</code> into this <code>Any</code> + */ + public abstract void insert_octet(byte x); + + /** + * Insert the CORBA <code>short</code> into this <code>Any</code> + */ + public abstract void insert_short(short x); + + /** + * Insert the CORBA <code>string</code> into this <code>Any</code> + */ + public abstract void insert_string(String x); + + /** + * Insert the CORBA <code>ulong</code> into this <code>Any</code> + */ + public abstract void insert_ulong(int x); + + /** + * Insert the CORBA <code>ulonglong</code> into this <code>Any</code> + */ + public abstract void insert_ulonglong(long x); + + /** + * Insert the CORBA <code>ushort</code> into this <code>Any</code> + */ + public abstract void insert_ushort(short x); + + /** + * Insert the CORBA <code>wchar</code> into this <code>Any</code> + */ + public abstract void insert_wchar(char x); + + /** + * Insert the CORBA <code>wstring</code> into this <code>Any</code> + */ + public abstract void insert_wstring(String x); + + /** + * Read the value into this <code>Any</code> from the given input stream. + * + * @param input a CORBA stream to read from. + * @param type a TypeCode of the object being read. + * + * @throws org.omg.CORBA.MARSHAL if the given TypeCode does not match + * the TypeCode of the object, found in the stream. + */ + public abstract void read_value(org.omg.CORBA.portable.InputStream input, + TypeCode type + ) + throws MARSHAL; + + /** + * Set the type of the object, stored in this <code>Any</code>, to the + * given TypeCode. Clear the value. + * + * @param valueTypeCode the type of the object that is expected to be stored + * in this <code>any</code>. + */ + public abstract void type(TypeCode valueTypeCode); + + /** + * Returns the TypeCode of the object, stored in this <code>Any</code> + * @return the TypeCode + */ + public abstract TypeCode type(); + + /** + * Writes out the value (without the typecode of the value), stored in + * this <code>Any</code>. + * + * @param output the CORBA stream to write into. + * + * @throws NullPointerException if the value of this <code>Any</code> + * has not been set. + */ + public abstract void write_value(org.omg.CORBA.portable.OutputStream output); +} diff --git a/libjava/classpath/org/omg/CORBA/AnyHolder.java b/libjava/classpath/org/omg/CORBA/AnyHolder.java new file mode 100644 index 000000000..c24855480 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/AnyHolder.java @@ -0,0 +1,119 @@ +/* AnyHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for storing an instance of {@link Any}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class AnyHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_any = new PrimitiveTypeCode(TCKind.tk_any); + + /** + * The instance of {@link Any} (not the "any value"), held by this holder. + */ + public Any value; + + /** + * Constructs an instance of AnyHolder, + * initializing {@link #value} to <code>null</code>. + */ + public AnyHolder() + { + } + + /** + * Constructs an instance of AnyHolder, + * initializing {@link #value} to the passed parameter. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public AnyHolder(Any initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For {@link Any}, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_any}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_any(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_any; + } + + /** + * Write the {@link #value } field to the given stream. + * For {@link Any} the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_any(Any) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_any(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/AnySeqHelper.java b/libjava/classpath/org/omg/CORBA/AnySeqHelper.java new file mode 100644 index 000000000..d06e5b854 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/AnySeqHelper.java @@ -0,0 +1,152 @@ +/* AnySeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * the array of the type {@link Any} (not with the "any array"). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class AnySeqHelper +{ + /** + * Extract the array of {@link Any}'s from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link AnySeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link AnySeqHolder}. + */ + public static Any[] extract(Any a) + { + AnySeqHolder h = (AnySeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given {@link Any}[] into the + * given {@link Any}. This implementation first creates + * a {@link AnySeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, Any[] that) + { + AnySeqHolder holder = new AnySeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the {@link Any}[] from the CORBA input stream. + * This implementation first creates an instance of + * {@link AnySeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static Any[] read(InputStream input) + { + Any[] value = new Any[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + { + value [ i ] = input.read_any(); + } + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the array of {@link Any}'s. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_any); + } + + /** + * Writes the array of {@link Any}'s into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, Any[] value) + { + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + { + output.write_any(value [ i ]); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/AnySeqHolder.java b/libjava/classpath/org/omg/CORBA/AnySeqHolder.java new file mode 100644 index 000000000..294966446 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/AnySeqHolder.java @@ -0,0 +1,128 @@ +/* AnySeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>AnySeq</code> that is mapped into + * java <code>Any[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class AnySeqHolder + implements Streamable +{ + /** + * The <code>Any[]</code> (CORBA <code>AnySeq</code>) value, + * held by this AnySeqHolder. + */ + public Any[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_any); + + /** + * Constructs an instance of AnySeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public AnySeqHolder() + { + } + + /** + * Constructs an instance of AnySeqHolder, + * initializing {@link #value} to the given array + */ + public AnySeqHolder(Any [] a_value) + { + value = a_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>and then all Any's. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new Any[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + { + value [ i ] = input.read_any(); + } + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code> and then all Any's. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + { + output.write_any(value [ i ]); + } + } + +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_CONTEXT.java b/libjava/classpath/org/omg/CORBA/BAD_CONTEXT.java new file mode 100644 index 000000000..b4dae0e8a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_CONTEXT.java @@ -0,0 +1,97 @@ +/* BAD_CONTEXT.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the operation is invoked by a client but the passed + * context has no values required by this operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BAD_CONTEXT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -5025677944847478264L; + + /** + * Creates a BAD_CONTEXT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public BAD_CONTEXT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_CONTEXT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_CONTEXT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_CONTEXT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public BAD_CONTEXT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_CONTEXT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public BAD_CONTEXT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_INV_ORDER.java b/libjava/classpath/org/omg/CORBA/BAD_INV_ORDER.java new file mode 100644 index 000000000..ca907094b --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_INV_ORDER.java @@ -0,0 +1,96 @@ +/* BAD_INV_ORDER.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the caller has invoked operations in the wrong order. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BAD_INV_ORDER + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 7273325995832240406L; + + /** + * Creates a BAD_INV_ORDER with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public BAD_INV_ORDER(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_INV_ORDER with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_INV_ORDER() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_INV_ORDER exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public BAD_INV_ORDER(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_INV_ORDER exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public BAD_INV_ORDER(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java b/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java new file mode 100755 index 000000000..dfa870fe6 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java @@ -0,0 +1,169 @@ +/* BAD_OPERATION.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the object exists but does not support the operation that was + * invoked on it. + * + * In GNU Classpath, this exception may have the following Minor codes: + * + * <table border="1"> + * <tr> + * <th>Hex</th> + * <th>Dec</th> + * <th>Minor</th> + * <th>Name</th> + * <th>Case</th> + * </tr> + * <tr> + * <td>47430000</td> + * <td>1195573248 </td> + * <td>0</td> + * <td>Method</td> + * <td> The remote side requested to invoke the method that is not available on + * that target (client and server probably disagree in the object definition). + * This code is set when the problem arises in the Classpath core; the idlj and + * rmic may generate the user code that sets 0x0 or other value.</td> + * </tr> + * <tr> + * <td>47430009</td> + * <td>1195573257</td> + * <td>9</td> + * <td>Any</td> + * <td> Attempt to extract from the Any value of the different type that was + * stored into that Any. </td> + * </tr> + * <tr> + * <td>4743000a</td> + * <td>1195573258</td> + * <td>10</td> + * <td>Activation</td> + * <td>Failed to activate the inactive object due any reason.</td> + * </tr> + * <tr> + * <td>4743000b</td> + * <td>1195573259</td> + * <td>11</td> + * <td>Policy</td> + * <td> The policies, applying to ORB or POA prevent the requested operation. + * </td> + * </tr> + * <tr> + * <td>4743000c</td> + * <td>1195573260</td> + * <td>12</td> + * <td>Socket</td> + * <td> Socket related errors like failure to open socket on the expected port.</td> + * </tr> + * <tr> + * <td>4743000e</td> + * <td>1195573262</td> + * <td>14</td> + * <td>Enumeration</td> + * <td> The passed value for enumeration is outside the valid range for that + * enumeration. </td> + * </tr> + * <tr> + * <td>4743000f</td> + * <td>1195573263</td> + * <td>15</td> + * <td>PolicyType</td> + * <td> The passed policy code is outside the valid range of the possible + * policies for the given policy type. </td> + * </tr> + * </table> + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BAD_OPERATION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1654621651720499682L; + + /** + * Creates a BAD_OPERATION with the default minor code of 0, completion state + * COMPLETED_NO and the given explaining message. + * + * @param message the explaining message. + */ + public BAD_OPERATION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_OPERATION with the default minor code of 0 and a completion + * state COMPLETED_NO. + */ + public BAD_OPERATION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates a BAD_OPERATION exception with the specified minor code and + * completion status. + * + * @param minor additional error code. + * @param completed the method completion status. + */ + public BAD_OPERATION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_OPERATION exception, providing full information. + * + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public BAD_OPERATION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_PARAM.java b/libjava/classpath/org/omg/CORBA/BAD_PARAM.java new file mode 100644 index 000000000..b3e46db77 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_PARAM.java @@ -0,0 +1,96 @@ +/* BAD_PARAM.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.CORBA; + +import java.io.Serializable; + +/** + * The exception thrown when a parameter passed to a call is considered + * illegal. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BAD_PARAM + extends SystemException + implements Serializable +{ + /** + * Creates BAD_PARAM with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public BAD_PARAM(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1917109334939470379L; + + /** + * Creates BAD_PARAM with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_PARAM() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_PARAM exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public BAD_PARAM(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_PARAM exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public BAD_PARAM(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_POLICY.java b/libjava/classpath/org/omg/CORBA/BAD_POLICY.java new file mode 100644 index 000000000..43724bf4a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_POLICY.java @@ -0,0 +1,55 @@ +/* BAD_POLICY.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.CORBA; + +/** + * Holds a single constant, specifying, that + * the requested {@link Policy} is not valid. One of the PolicyErrorCodes, + * others being {@link UNSUPPORTED_POLICY}, + * {@link UNSUPPORTED_POLICY_VALUE}, + * {@link BAD_POLICY_TYPE}, {@link BAD_POLICY_VALUE}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface BAD_POLICY +{ + /** + * States that the requested {@link Policy} is not valid. + */ + short value = 0; +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_POLICY_TYPE.java b/libjava/classpath/org/omg/CORBA/BAD_POLICY_TYPE.java new file mode 100644 index 000000000..c90832d72 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_POLICY_TYPE.java @@ -0,0 +1,55 @@ +/* BAD_POLICY_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.CORBA; + +/** + * Holds a single constant, specifying, that + * the requested {@link Policy} type is not valid. One of the + * PolicyErrorCodes, others being {@link UNSUPPORTED_POLICY}, + * {@link UNSUPPORTED_POLICY_VALUE}, {@link BAD_POLICY}, + * {@link BAD_POLICY_VALUE}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface BAD_POLICY_TYPE +{ + /** + * States that the requested {@link Policy} type is not valid. + */ + short value = 2; +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_POLICY_VALUE.java b/libjava/classpath/org/omg/CORBA/BAD_POLICY_VALUE.java new file mode 100644 index 000000000..a92c9a8b4 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_POLICY_VALUE.java @@ -0,0 +1,55 @@ +/* BAD_POLICY_VALUE.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.CORBA; + +/** + * Holds a single constant, specifying, that + * the requested {@link Policy} value is not valid. One of the + * PolicyErrorCodes, others being {@link UNSUPPORTED_POLICY}, + * {@link BAD_POLICY}, {@link BAD_POLICY_TYPE}, + * {@link BAD_POLICY_VALUE}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface BAD_POLICY_VALUE +{ + /** + * States that the requested {@link Policy} value is not valid. + */ + short value = 3; +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_QOS.java b/libjava/classpath/org/omg/CORBA/BAD_QOS.java new file mode 100644 index 000000000..c7ceb6924 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_QOS.java @@ -0,0 +1,99 @@ +/* BAD_QOS.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.CORBA; + +import java.io.Serializable; + +/** + * The BAD_QOS is raised when the object cannot support the quality of + * service required by an invocation parameter. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class BAD_QOS + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = 4746597571263117454L; + + /** + * Creates BAD_QOS with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public BAD_QOS(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_QOS with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_QOS() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_QOS exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public BAD_QOS(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_QOS exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public BAD_QOS(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BAD_TYPECODE.java b/libjava/classpath/org/omg/CORBA/BAD_TYPECODE.java new file mode 100644 index 000000000..1336711a8 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BAD_TYPECODE.java @@ -0,0 +1,97 @@ +/* BAD_TYPECODE.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the some TypeCode has been realized to be invalid + * (for example, has an invalid TCKind value). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BAD_TYPECODE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 6193364410915696901L; + + /** + * Creates a BAD_TYPECODE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public BAD_TYPECODE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_TYPECODE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_TYPECODE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_TYPECODE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public BAD_TYPECODE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_TYPECODE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public BAD_TYPECODE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BooleanHolder.java b/libjava/classpath/org/omg/CORBA/BooleanHolder.java new file mode 100644 index 000000000..a5b7bd8bc --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BooleanHolder.java @@ -0,0 +1,127 @@ +/* BooleanHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>boolean</code> that is mapped into + * java <code>boolean</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BooleanHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_boolean = + new PrimitiveTypeCode(TCKind.tk_boolean); + + /** + * The <code>boolean</code> (CORBA <code>boolean</code>) value, + * held by this BooleanHolder. + */ + public boolean value; + + /** + * Constructs an instance of BooleanHolder, + * initializing {@link #value} to <code>false</code>. + */ + public BooleanHolder() + { + } + + /** + * Constructs an instance of BooleanHolder, + * initializing {@link #value} to the given <code>boolean</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public BooleanHolder(boolean initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>boolean</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_boolean}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_boolean(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_boolean; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>boolean</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_boolean(boolean) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_boolean(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java b/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java new file mode 100644 index 000000000..3cb2538c3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java @@ -0,0 +1,143 @@ +/* BooleanSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>boolean</code> + * (<code>BooleanSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class BooleanSeqHelper +{ + /** + * Extract the <code>boolean[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link BooleanSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link BooleanSeqHolder}. + */ + public static boolean[] extract(Any a) + { + BooleanSeqHolder h = (BooleanSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>boolean[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link BooleanSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, boolean[] that) + { + BooleanSeqHolder holder = new BooleanSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>boolean[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static boolean[] read(InputStream input) + { + boolean [] value = new boolean[ input.read_long() ]; + input.read_boolean_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>BooleanSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_boolean); + } + + /** + * Writes the <code>boolean[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, boolean[] value) + { + output.write_long(value.length); + output.write_boolean_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java b/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java new file mode 100644 index 000000000..6144a17d6 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java @@ -0,0 +1,126 @@ +/* BooleanSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>BooleanSeq</code> that is mapped into + * java <code>boolean[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BooleanSeqHolder + implements Streamable +{ + /** + * The <code>boolean[]</code> (CORBA <code>BooleanSeq</code>) value, + * held by this BooleanSeqHolder. + */ + public boolean[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_boolean); + + /** + * Constructs an instance of BooleanSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public BooleanSeqHolder() + { + } + + /** + * Constructs an instance of BooleanSeqHolder, + * initializing {@link #value} to the given <code>boolean[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public BooleanSeqHolder(boolean[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_boolean_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new boolean[ input.read_long() ]; + input.read_boolean_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_boolean_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_boolean_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/Bounds.java b/libjava/classpath/org/omg/CORBA/Bounds.java new file mode 100644 index 000000000..f5a546480 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Bounds.java @@ -0,0 +1,71 @@ +/* Bounds.java -- Exception thrown due to out-of-bounds parameter + 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.CORBA; + +/** + * Thrown when a parameter is outside the bounds for a particular + * object a method is trying to access. + * + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) + */ +public final class Bounds + extends UserException +{ + + /** + * Constructs a default <code>Bounds</code> exception, with + * no detail message. + */ + public Bounds() + { + super(); + } + + /** + * Constructs a <code>Bounds</code> exception using the specified + * message as the reason for throwing it. + * + * @param reason the reason the exception was thrown. + */ + public Bounds(String reason) + { + super(reason); + } + +} diff --git a/libjava/classpath/org/omg/CORBA/ByteHolder.java b/libjava/classpath/org/omg/CORBA/ByteHolder.java new file mode 100644 index 000000000..c590a433e --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ByteHolder.java @@ -0,0 +1,127 @@ +/* ByteHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>octet</code> that is mapped into + * java <code>byte</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ByteHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_octet = + new PrimitiveTypeCode(TCKind.tk_octet); + + /** + * The <code>byte</code> (CORBA <code>octet</code>) value, + * held by this ByteHolder. + */ + public byte value; + + /** + * Constructs an instance of ByteHolder, + * initializing {@link #value} to <code>0x0 </code>. + */ + public ByteHolder() + { + } + + /** + * Constructs an instance of ByteHolder, + * initializing {@link #value} to the given <code>byte</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ByteHolder(byte initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>octet</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_octet}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_octet(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_octet; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>octet</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_octet(byte) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_octet(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java b/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java new file mode 100644 index 000000000..fc285baff --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java @@ -0,0 +1,103 @@ +/* CODESET_INCOMPATIBLE.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.CORBA; + +import java.io.Serializable; + +/** + * Raised when client and server are unable to reach any consensus on which + * code set should be used to represent the characters. This happens when + * neither server nor client can convert from the native code set of the + * corresponding side, there is no shared codeset from that both sides could + * convert and additionally the client and server native code sets are too + * different to communicate anyway without massive data loss. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class CODESET_INCOMPATIBLE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = -8784048396454171789L; + + /** + * Creates CODESET_INCOMPATIBLE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public CODESET_INCOMPATIBLE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates CODESET_INCOMPATIBLE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public CODESET_INCOMPATIBLE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a CODESET_INCOMPATIBLE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public CODESET_INCOMPATIBLE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created CODESET_INCOMPATIBLE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public CODESET_INCOMPATIBLE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/COMM_FAILURE.java b/libjava/classpath/org/omg/CORBA/COMM_FAILURE.java new file mode 100644 index 000000000..eab23eb75 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/COMM_FAILURE.java @@ -0,0 +1,97 @@ +/* COMM_FAILURE.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the communication has been lost while an operation + * was in progress + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class COMM_FAILURE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 294856734784364267L; + + /** + * Creates a COMM_FAILURE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public COMM_FAILURE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates COMM_FAILURE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public COMM_FAILURE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a COMM_FAILURE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public COMM_FAILURE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created COMM_FAILURE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public COMM_FAILURE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/CTX_RESTRICT_SCOPE.java b/libjava/classpath/org/omg/CORBA/CTX_RESTRICT_SCOPE.java new file mode 100644 index 000000000..de00deffd --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CTX_RESTRICT_SCOPE.java @@ -0,0 +1,54 @@ +/* CTX_RESTRICT_SCOPE.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.CORBA; + +/** + * This simple interface defines just one constant, normally used + * to restrict the property search in the {@link Context} by + * the current context. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface CTX_RESTRICT_SCOPE +{ + /** + * The flag, specifying that the search + * is limited to the current context. + */ + int value = 15; +} diff --git a/libjava/classpath/org/omg/CORBA/CharHolder.java b/libjava/classpath/org/omg/CORBA/CharHolder.java new file mode 100644 index 000000000..6ef5210a3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CharHolder.java @@ -0,0 +1,126 @@ +/* CharHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>char</code> that is mapped into + * java <code>char</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class CharHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_char = new PrimitiveTypeCode(TCKind.tk_char); + + /** + * The <code>char</code> (CORBA <code>char</code>) value, + * held by this CharHolder. + */ + public char value; + + /** + * Constructs an instance of CharHolder, + * initializing {@link #value} to <code>0 </code>. + */ + public CharHolder() + { + } + + /** + * Constructs an instance of CharHolder, + * initializing {@link #value} to the given <code>char</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public CharHolder(char initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>char</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_char}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_char(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_char; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>char</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_char(char) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_char(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/CharSeqHelper.java b/libjava/classpath/org/omg/CORBA/CharSeqHelper.java new file mode 100644 index 000000000..4853f3d16 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CharSeqHelper.java @@ -0,0 +1,143 @@ +/* CharSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>char</code> + * (<code>CharSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class CharSeqHelper +{ + /** + * Extract the <code>char[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link CharSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link CharSeqHolder}. + */ + public static char[] extract(Any a) + { + CharSeqHolder h = (CharSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>char[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link CharSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, char[] that) + { + CharSeqHolder holder = new CharSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>char[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static char[] read(InputStream input) + { + char [] value = new char[ input.read_long() ]; + input.read_char_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>CharSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_char); + } + + /** + * Writes the <code>char[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, char[] value) + { + output.write_long(value.length); + output.write_char_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/CharSeqHolder.java b/libjava/classpath/org/omg/CORBA/CharSeqHolder.java new file mode 100644 index 000000000..3fa5475a0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CharSeqHolder.java @@ -0,0 +1,126 @@ +/* CharSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>CharSeq</code> that is mapped into + * java <code>char[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class CharSeqHolder + implements Streamable +{ + /** + * The <code>char[]</code> (CORBA <code>CharSeq</code>) value, + * held by this CharSeqHolder. + */ + public char[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_char); + + /** + * Constructs an instance of CharSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public CharSeqHolder() + { + } + + /** + * Constructs an instance of CharSeqHolder, + * initializing {@link #value} to the given <code>char[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public CharSeqHolder(char[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_char_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new char[ input.read_long() ]; + input.read_char_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_char_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_char_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/CompletionStatus.java b/libjava/classpath/org/omg/CORBA/CompletionStatus.java new file mode 100644 index 000000000..e60b937ce --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CompletionStatus.java @@ -0,0 +1,164 @@ +/* CompletionStatus.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.CORBA; + +import gnu.CORBA.Minor; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the method completion status, usually for the time moment, + * when the exception has been thrown. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class CompletionStatus + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = -9047319660881406859L; + + /** + * The method was completed when the exception was thrown. + */ + public static final int _COMPLETED_YES = 0; + + /** + * The method was running when the exception was thrown. + */ + public static final int _COMPLETED_NO = 1; + + /** + * The method was either running or complete (no exact information availabe) + * when the exception was thrown. + */ + public static final int _COMPLETED_MAYBE = 2; + + /** + * An instance of CompletionStatus, initialized to {@link #COMPLETED_YES } + */ + public static final CompletionStatus COMPLETED_YES = + new CompletionStatus(_COMPLETED_YES); + + /** + * An instance of CompletionStatus, initialized to {@link #COMPLETED_NO } + */ + public static final CompletionStatus COMPLETED_NO = + new CompletionStatus(_COMPLETED_NO); + + /** + * An instance of CompletionStatus, initialized to {@link #COMPLETED_MAYBE } + */ + public static final CompletionStatus COMPLETED_MAYBE = + new CompletionStatus(_COMPLETED_MAYBE); + + /** + * The private array of all states. As long as the states form the uniform + * sequence, from_int can find the needed value directly indexing this array. + */ + private static final CompletionStatus[] states = + new CompletionStatus[] { COMPLETED_YES, COMPLETED_NO, COMPLETED_MAYBE }; + private final int _value; + + /** + * No other instances can be created. + */ + private CompletionStatus(int a_value) + { + _value = a_value; + } + + /** + * Returns the CompletionStatus, matching the given integer constant + * + * @param completion one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE. + * @return one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE. + * @throws BAD_PARAM if the parameter is not one of these three valid values. + */ + public static CompletionStatus from_int(int completion) + { + try + { + return states[completion]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid completion status " + + completion); + bad.minor = Minor.Enumeration; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return a string, defining the completion status. + */ + public String toString() + { + switch (value()) + { + case _COMPLETED_YES : + return "completed"; + + case _COMPLETED_NO : + return "not completed"; + + case _COMPLETED_MAYBE : + return "maybe completed"; + + default : + return "invalid completion status instance"; + } + } + + /** + * Returns the value, representing the completion + * status of this object. + * @return one of COMPLETED_MAYBE, COMPLETED_YES or COMPLETED_NO + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java b/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java new file mode 100644 index 000000000..280a902e5 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java @@ -0,0 +1,131 @@ +/* CompletionStatusHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * {@link CompletionStatus}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class CompletionStatusHelper +{ + /** + * Extract the {@link CompletionStatus} from the + * given {@link Any}. This implementation expects + * the integer (Corba long) value, stating the completion + * status. + * + * @param a an Any to extract the completion status from. + * + * @return completion status + */ + public static CompletionStatus extract(Any a) + { + return CompletionStatus.from_int(a.extract_long()); + } + + /** + * Returns the agreed Id. + * @return <code>IDL:omg.org/CORBA/CompletionStatus:1.0</code>, always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/CompletionStatus:1.0"; + } + + /** + * Insert into the given {@link CompletionStatus} into the + * given {@link Any}. This implementation inserts it as an + * integer (CORBA long). + * + * @param into the target Any. + * @param that the {@link CompletionStatus} to insert. + */ + public static void insert(Any into, CompletionStatus that) + { + into.insert_long(that.value()); + } + + /** + * Reads the {@link CompletionStatus} from the CORBA input stream. + * This implementation reads an an integer (CORBA long). + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static CompletionStatus read(InputStream input) + { + return CompletionStatus.from_int(input.read_long()); + } + + /** + * Writes the {@link CompletionStatus} into the given stream. + * This implementation writes an int (CORBA long), corresponding + * the status of completion. + * + * @param output the CORBA (not java.io) output stream to write. + * @param status the value that must be written. + */ + public static void write(OutputStream output, CompletionStatus status) + { + output.write_long(status.value()); + } + + /** + * Get the parameter mode typecode (enumeration, named "CompletionStatus"). + * The typecode states that the enumeration can obtain one of + * the following values: COMPLETED_YES ,COMPLETED_NO or COMPLETED_MAYBE . + */ + public static TypeCode type() + { + String[] members = + new String[] { "COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE" }; + + return + OrbRestricted.Singleton.create_enum_tc(id(), "CompletionStatus", + members + ); + } +} diff --git a/libjava/classpath/org/omg/CORBA/Context.java b/libjava/classpath/org/omg/CORBA/Context.java new file mode 100644 index 000000000..16a47f84b --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Context.java @@ -0,0 +1,122 @@ +/* Context.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.CORBA; + + +/** + * + * This class holds the list of the named properties. It is normally + * used to represent information about various circumstances of the + * invocation. A Context if first created by + * {@link org.omg.CORBA.ORB#get_default_context() } and then invoking + * {@link #create_child(String)} of the default context. + * + * The contexts are named. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + */ +public abstract class Context +{ + public Context() + { + } + + /** + * Get the context name. + * @return the name of this context. + */ + public abstract String context_name(); + + /** + * Create a child of this Context, giving it a name. + * @param child a name of the child context. + * + * @return the newly created context. + */ + public abstract Context create_child(String child); + + /** + * Delete one or several (identically named) given properties. + * + * @param property the name of the property to delete, may + * end by wildchar character '*'. The search scope is always + * limited to the current context. + */ + public abstract void delete_values(String property); + + /** + * Search the values. + * + * @param start_scope the context at which to initiate the search. + * @param flags the search operation flags. + * The flag {@link CTX_RESTRICT_SCOPE} means + * that search is restricted to the start_scope. + * @param pattern the property being searched, can be + * either name or name with the optional trailing wildchar character + * '*'. + * @return the list of the found properties. + */ + public abstract NVList get_values(String start_scope, int flags, + String pattern + ); + + /** + * Get the parent of this context. + * @return the parent of this context. + */ + public abstract Context parent(); + + /** + * Set a property. + * @param name the property name. + * @param value the property value (the {@link Any} must hold string). + */ + public abstract void set_one_value(String name, Any value); + + /** + * Set multiple properties. + * + * @param values a list of properties, the {@link Any}'s + * in the list components must hold strings. + */ + public abstract void set_values(NVList values); + + +} diff --git a/libjava/classpath/org/omg/CORBA/ContextList.java b/libjava/classpath/org/omg/CORBA/ContextList.java new file mode 100644 index 000000000..d6b8800c9 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ContextList.java @@ -0,0 +1,85 @@ +/* ContextList.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.CORBA; + + +/** + * Stores a modifiable list of String objects representing the property names. + * The property values are normally stored in the {@link Context }. + * + * The context list is created by invoking {@link ORB#create_context_list()}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ContextList +{ + /** + * Add a name object + * @param name a name to add. + */ + public abstract void add(String name); + + /** + * Return the number of stored names + * + * @return a number of names. + */ + public abstract int count(); + + /** + * Return the name at the given index. + * + * @param at the index + * @return the name at the given index + * + * @throws Bounds if the index is out of bounds. + */ + public abstract String item(int at) + throws Bounds; + + /** + * Remove the name at the given index. + * + * @param at the index + * + * @throws Bounds if the index is out of bounds. + */ + public abstract void remove(int at) + throws Bounds; +} diff --git a/libjava/classpath/org/omg/CORBA/Current.java b/libjava/classpath/org/omg/CORBA/Current.java new file mode 100644 index 000000000..fbf5e0c46 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Current.java @@ -0,0 +1,59 @@ +/* Current.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The interfaces, derived from this class, define the objects, providing + * information, associated with a particular thread of execution. The examples + * of such data could be the security information, transaction identifiers + * and so on. + * </p><p> + * The various aspects of this information are provided by subinterfaces, + * derived from the Current. There are no operations defined for + * the "general" Current itself. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Current + extends org.omg.CORBA.Object, IDLEntity, CurrentOperations +{ +} diff --git a/libjava/classpath/org/omg/CORBA/CurrentHelper.java b/libjava/classpath/org/omg/CORBA/CurrentHelper.java new file mode 100644 index 000000000..80c5855ef --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CurrentHelper.java @@ -0,0 +1,173 @@ +/* CurrentHelper.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.CORBA; + +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.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the CORBA object {@link Current}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class CurrentHelper +{ + /** + * The Current stub (proxy), used on the client side. + * The {@link Current} methods should contain the code for remote + * invocaton. As there are no methods defined, this class is only + * used for the formal support of the + * {@link #narrow(org.omg.CORBA.Object)}. + */ + private static class _CurrentStub + extends ObjectImpl + implements Current + { + /** + * Create the naming context stub with the given delegate. + */ + public _CurrentStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { id() }; + } + } + + /** + * Get the type code of the {@link Current}. + */ + public static TypeCode type() + { + return + OrbRestricted.Singleton.create_interface_tc(id(), "Current"); + } + + /** + * Insert the Current into the given Any. + * + * @param any the Any to insert into. + * @param that the Current to insert. + */ + public static void insert(Any any, Current that) + { + any.insert_Object(that); + } + + /** + * Extract the Current from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain Current. + */ + public static Current extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the Current repository id. + * + * @return "IDL:omg.org/CORBA/Current:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/Current:1.0"; + } + + /** + * Cast the passed object into the Current. If the + * object has a different java type, create an instance + * of the _CurrentStub, using the same delegate, as for + * the passed parameter. Hence, unlike java type cast, + * this method may return a different object, than has been passed. + * + * @param obj the object to narrow. + * @return narrowed instance. + * + * @throws BAD_PARAM if the passed object is not a Current. + */ + public static Current narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof Current) + return (Current) obj; + else if (!obj._is_a(id())) + throw new BAD_PARAM("Not a Current"); + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _CurrentStub(delegate); + } + } + + /** + * Read the Current from the CDR intput stream (IOR profile expected). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static Current read(InputStream input) + { + return narrow(input.read_Object()); + } + + /** + * Write the Current to the CDR output stream (as IOR profile). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, Current value) + { + output.write_Object(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/CurrentHolder.java b/libjava/classpath/org/omg/CORBA/CurrentHolder.java new file mode 100644 index 000000000..fa01a41ea --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CurrentHolder.java @@ -0,0 +1,103 @@ +/* CurrentHolder.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.CORBA; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the object {@link Current}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class CurrentHolder + implements Streamable +{ + /** + * The stored Current value. + */ + public Current value; + + /** + * Create the uninitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public CurrentHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public CurrentHolder(Current 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 = CurrentHelper.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) + { + CurrentHelper.write(output, value); + } + + /** + * Get the typecode of the Current. + */ + public org.omg.CORBA.TypeCode _type() + { + return CurrentHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/CurrentOperations.java b/libjava/classpath/org/omg/CORBA/CurrentOperations.java new file mode 100644 index 000000000..a40db85c4 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CurrentOperations.java @@ -0,0 +1,57 @@ +/* CurrentOperations.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.CORBA; + + +/** + * <p> + * The interfaces, derived from this class, define operations that provide + * information, associated with a particular thread of execution. + * </p><p> + * There are no operations for the general "Current". Instead, the operations + * are defined for various subinterfaces that were derived from the + * Current. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + * + * @see Current + */ +public interface CurrentOperations +{ +} diff --git a/libjava/classpath/org/omg/CORBA/CustomMarshal.java b/libjava/classpath/org/omg/CORBA/CustomMarshal.java new file mode 100644 index 000000000..5adbf3197 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CustomMarshal.java @@ -0,0 +1,68 @@ +/* CustomMarshal.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.CORBA; + + +/** + * This interface indicates that the object can provide its own methods + * for reading and writing its content. This interface is typically used + * by the CORBA implementation only. The user application should use the + * {@link CustomValue} that is a descendant of this interface. + * + * @see DataInputStream + * @see DataOutputStream + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CustomMarshal +{ + /** + * Read (unmarshal) the content of this object from the given input stream. + * + * @param into_stream a stream to read from. + */ + public void marshal(DataOutputStream into_stream); + + /** + * Write (marshal) the content of this object to the given input stream. + * + * @param from_stream a stream to write into. + */ + public void unmarshal(DataInputStream from_stream); +} diff --git a/libjava/classpath/org/omg/CORBA/CustomValue.java b/libjava/classpath/org/omg/CORBA/CustomValue.java new file mode 100644 index 000000000..0c080fb84 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/CustomValue.java @@ -0,0 +1,61 @@ +/* CustomValue.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.CORBA; + +import org.omg.CORBA.portable.StreamableValue; +import org.omg.CORBA.portable.ValueBase; + +/** + * A Custom Value is a {@link ValueBase} implementing its own methods for + * reading and writing (unmarshaling and marshaling) the content. These methods + * are defined in superinterface {@link CustomMarshal}. + * + * Custom value types can never be safely truncated to the more general + * base type. They and always require an exact match for their RepositoryId + * in the receiving context. + * + * If the value base does not implement this interface, it normally implements + * {@link StreamableValue} instead. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CustomValue + extends ValueBase, CustomMarshal +{ +} diff --git a/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java b/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java new file mode 100644 index 000000000..a7dd4d728 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java @@ -0,0 +1,117 @@ +/* DATA_CONVERSION.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the ORB cannot convert between the marshalled and + * native data representation. + * + * In GNU Classpath, this exception may have the following minor codes: + * + * <table border="1"> + * <tr> + * <td>Hex</td> + * <td>Dec</td> + * <td>Minor</td> + * <td>Name</td> + * <td>Case</td> + * </tr> + * <td>47430016</td> + * <td>1195573270</td> + * <td>22</td> + * <td>Missing_IOR</td> + * <td>The object URL is such that the IOR string must be read from some + * local or remote resource (file or network), but this resource is not + * reacheable.</td> + * </tr> + * </table> + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class DATA_CONVERSION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1874869932271600956L; + + /** + * Creates a DATA_CONVERSION with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public DATA_CONVERSION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates DATA_CONVERSION with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public DATA_CONVERSION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a DATA_CONVERSION exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public DATA_CONVERSION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created DATA_CONVERSION exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public DATA_CONVERSION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DataInputStream.java b/libjava/classpath/org/omg/CORBA/DataInputStream.java new file mode 100644 index 000000000..70a0b2c47 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DataInputStream.java @@ -0,0 +1,276 @@ +/* DataInputStream.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.CORBA; + +import org.omg.CORBA.portable.ValueBase; + +/** + * An interface for reading the custom value types. A value type, providing + * its own mechanism for reading the content, must implement + * the {@link CustomValue} that uses this interface. + * + * @see CustomValue + * @see CustomMarshal + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DataInputStream + extends ValueBase +{ + /** + * Read {@link Any}. + * @return a value, extracted from the stream. + */ + Any read_any(); + + /** + * Read boolean. + * @return a value, extracted from the stream. + */ + boolean read_boolean(); + + /** + * Read narrow (usually 8 bit) char. + * @return a value, extracted from the stream. + */ + char read_char(); + + /** + * Read wide (usually 16 bit) char. + * @return a value, extracted from the stream. + */ + char read_wchar(); + + /** + * Read octet (byte). + * @return a value, extracted from the stream. + */ + byte read_octet(); + + /** + * Read short (16 bit int). + * @return a value, extracted from the stream. + */ + short read_short(); + + /** + * Read unsigned short. + * @return a value, extracted from the stream. + */ + short read_ushort(); + + /** + * Read CORBA long (java int, 32 bits). + * @return a value, extracted from the stream. + */ + int read_long(); + + /** + * Read CORBA unsigned long (java int). + * @return a value, extracted from the stream. + */ + int read_ulong(); + + /** + * Read CORBA long long (java long, 64 bits). + * @return a value, extracted from the stream. + */ + long read_longlong(); + + /** + * Read unsigned CORBA long long (java long, 64 bits). + * @return a value, extracted from the stream. + */ + long read_ulonglong(); + + /** + * Read float. + * @return a value, extracted from the stream. + */ + float read_float(); + + /** + * Read dobule. + * @return a value, extracted from the stream. + */ + double read_double(); + + /** + * Read narrow string (usually 8 bits per character). + * @return a value, extracted from the stream. + */ + String read_string(); + + /** + * Read wide string (usually 16 bits per character). + * @return a value, extracted from the stream. + */ + String read_wstring(); + + /** + * Read CORBA object. + * + * @return a value, extracted from the stream. May be null + * if the null was previously written by {@link DataOutputStream#write_Object}. + */ + org.omg.CORBA.Object read_Object(); + + /** + * Read abstract interface. + * + * @return a value, extracted from the stream. May be either CORBA Object or + * CORBA value type. + */ + java.lang.Object read_Abstract(); + + /** + * Read the CORBA value type. + * @return a value, extracted from the stream. + */ + java.io.Serializable read_Value(); + + /** + * Read typecode. + * @return a value, extracted from the stream. + */ + TypeCode read_TypeCode(); + + /** + * Read array of Any's. + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_any_array(AnySeqHolder seq, int offset, int length); + + /** + * Read boolean array. + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_boolean_array(BooleanSeqHolder seq, int offset, int length); + + /** + * Read array of narrow (usually 8 bit) chars. + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_char_array(CharSeqHolder seq, int offset, int length); + + /** + * Read array of wide (usually 16 bit) chars. + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_wchar_array(WCharSeqHolder seq, int offset, int length); + + /** + * Read array of bytes. + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_octet_array(OctetSeqHolder seq, int offset, int length); + + /** + * Read array of shorts (16 bit ints). + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_short_array(ShortSeqHolder seq, int offset, int length); + + /** + * Read array of unsigned shorts (16 bit ints). + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_ushort_array(UShortSeqHolder seq, int offset, int length); + + /** + * Read array of CORBA longs (java ints). + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_long_array(LongSeqHolder seq, int offset, int length); + + /** + * Read array of CORBA unsigned longs (java ints). + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_ulong_array(ULongSeqHolder seq, int offset, int length); + + /** + * Read array of CORBA unsigned long longs (java longs). + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_ulonglong_array(ULongLongSeqHolder seq, int offset, int length); + + /** + * Read array of CORBA long longs (java longs). + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_longlong_array(LongLongSeqHolder seq, int offset, int length); + + /** + * Read array of floats. + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_float_array(FloatSeqHolder seq, int offset, int length); + + /** + * Read array of doubles. + * + * The value, extracted from the stream, is returned in the + * .value field of the passed holder. + */ + void read_double_array(DoubleSeqHolder seq, int offset, int length); +} diff --git a/libjava/classpath/org/omg/CORBA/DataOutputStream.java b/libjava/classpath/org/omg/CORBA/DataOutputStream.java new file mode 100644 index 000000000..e1a417fce --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DataOutputStream.java @@ -0,0 +1,281 @@ +/* DataOutputStream.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.CORBA; + +import org.omg.CORBA.portable.ValueBase; + +/** + * An interface for writing the custom value types. A value type, providing + * its own mechanism for writing the content, must implement + * the {@link CustomValue} that uses this interface. + * + * @see CustomValue + * @see CustomMarshal + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DataOutputStream + extends ValueBase +{ + /** + * Write {@link Any} to the output stream. + * + * @param value a value to write. + */ + void write_any(Any value); + + /** + * Write boolean to the output stream. + * + * @param value a value to write. + */ + void write_boolean(boolean value); + + /** + * Write narrow (usually 8 bit) char to the output stream. + * + * @param value a value to write. + */ + void write_char(char value); + + /** + * Write wide (usually 16 bit) char to the output stream. + * + * @param value a value to write. + */ + void write_wchar(char value); + + /** + * Write octet (byte) to the output stream. + * + * @param value a value to write. + */ + void write_octet(byte value); + + /** + * Write short (16 bit signed integer) to the output stream. + * + * @param value a value to write. + */ + void write_short(short value); + + /** + * Write unsigned short to the output stream. + * + * @param value a value to write. + */ + void write_ushort(short value); + + /** + * Write CORBA long (32 bits, java int) to the output stream. + * + * @param value a value to write. + */ + void write_long(int value); + + /** + * Write unsigned CORBA long (32 bits, java int) to the output stream. + * + * @param value a value to write. + */ + void write_ulong(int value); + + /** + * Write CORBA long long (64 bits, java long) to the output stream. + * + * @param value a value to write. + */ + void write_longlong(long value); + + /** + * Write unsigned CORBA long long (64 bits, java long) to the output stream. + * + * @param value a value to write. + */ + void write_ulonglong(long value); + + /** + * Write float to the output stream. + * + * @param value a value to write. + */ + void write_float(float value); + + /** + * Write double to the output stream. + * + * @param value a value to write. + */ + void write_double(double value); + + /** + * Write narrow (usually 8 bits per character) string to the output stream. + * + * @param value a value to write. + */ + void write_string(String value); + + /** + * Write wide (usually 16 bits per character) string to the output stream. + * + * @param value a value to write. + */ + void write_wstring(String value); + + /** + * Write CORBA object reference to the output stream. + * + * @param value a value to write, null should be supported. + */ + void write_Object(org.omg.CORBA.Object value); + + /** + * Write abstract interface to the output stream. + * + * @param value a value to write, can be either CORBA object or + * CORBA value type. + */ + void write_Abstract(java.lang.Object value); + + /** + * Write value type to the output stream. + * + * @param value a value to write. + */ + void write_Value(java.io.Serializable value); + + /** + * Write typecode to the output stream. + * + * @param value a value to write. + */ + void write_TypeCode(TypeCode value); + + /** + * Write array of Any's to the output stream. + * + * @param seq a value to write. + */ + void write_any_array(Any[] seq, int offset, int length); + + /** + * Write array of boolean's to the output stream. + * + * @param seq a value to write. + */ + void write_boolean_array(boolean[] seq, int offset, int length); + + /** + * Write array of narrow chars to the output stream. + * + * @param seq a value to write. + */ + void write_char_array(char[] seq, int offset, int length); + + /** + * Write array of wide chars to the output stream. + * + * @param seq a value to write. + */ + void write_wchar_array(char[] seq, int offset, int length); + + /** + * Write array of octets (bytes) to the output stream. + * + * @param seq a value to write. + */ + void write_octet_array(byte[] seq, int offset, int length); + + /** + * Write array of shorts (16 bit integers) to the output stream. + * + * @param seq a value to write. + */ + void write_short_array(short[] seq, int offset, int length); + + /** + * Write array of unsigned shorts (16 bit integers) to the output stream. + * + * @param seq a value to write. + */ + void write_ushort_array(short[] seq, int offset, int length); + + /** + * Write array of CORBA longs (java ints) to the output stream. + * + * @param seq a value to write. + */ + void write_long_array(int[] seq, int offset, int length); + + /** + * Write array of unsigned CORBA longs (java ints) to the output stream. + * + * @param seq a value to write. + */ + void write_ulong_array(int[] seq, int offset, int length); + + /** + * Write array of unsigned CORBA long longs (java longs) + * to the output stream. + * + * @param seq a value to write. + */ + void write_ulonglong_array(long[] seq, int offset, int length); + + /** + * Write arrayo fo CORBA long longs (java ints) to the output stream. + * + * @param seq a value to write. + */ + void write_longlong_array(long[] seq, int offset, int length); + + /** + * Write array of floats to the output stream. + * + * @param seq a value to write. + */ + void write_float_array(float[] seq, int offset, int length); + + /** + * Write array of doubles to the output stream. + * + * @param seq a value to write. + */ + void write_double_array(double[] seq, int offset, int length); +} diff --git a/libjava/classpath/org/omg/CORBA/DefinitionKind.java b/libjava/classpath/org/omg/CORBA/DefinitionKind.java new file mode 100644 index 000000000..09100b598 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DefinitionKind.java @@ -0,0 +1,425 @@ +/* DefinitionKind.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * This class indicates the kind of the definition, stored in the interface + * repository. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class DefinitionKind + implements IDLEntity, Serializable +{ + /** + * Use v1.4 serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -8601167576704143376L; + + /** + * Indicates that the current definition defines has no definition kind. + */ + public static final int _dk_none = 0; + + /** + * This is a "wildcard '*'", used in cases where any definition kind + * is appropriate . + */ + public static final int _dk_all = 1; + + /** + * Indicates that the current definition defines an attribute. + */ + public static final int _dk_Attribute = 2; + + /** + * Indicates that the current definition defines a constant. + */ + public static final int _dk_Constant = 3; + + /** + * Indicates that the current definition defines an exception. + */ + public static final int _dk_Exception = 4; + + /** + * Indicates that the current definition defines an interface. + * The interface definition can contain constants, types, + * exceptions, operations, and attributes. + */ + public static final int _dk_Interface = 5; + + /** + * Indicates that the current definition defines a Module. + * The Module can contain constants, typedefs, exceptions and also + * interface, component, home, value or event type definitions. + * The module can also enclose other (nested) modules. + */ + public static final int _dk_Module = 6; + + /** + * Indicates that the current definition defines an operation, including + * the lists of parameters and exceptions raised by this operation. + */ + public static final int _dk_Operation = 7; + + /** + * Indicates that the current definition defines a named type that is not + * an interface nor a value definition. Generally, it also cannot be + * a definition of component, home and event, but these three kinds are + * not listed in this class. + */ + public static final int _dk_Typedef = 8; + + /** + * Indicates that the current definition defines an alias. + */ + public static final int _dk_Alias = 9; + + /** + * Indicates that the current definition defines a structure. + */ + public static final int _dk_Struct = 10; + + /** + * Indicates that the current definition defines a union. + */ + public static final int _dk_Union = 11; + + /** + * Indicates that the current definition defines an enumeration. + */ + public static final int _dk_Enum = 12; + + /** + * Indicates that the current definition defines a primitive type. + */ + public static final int _dk_Primitive = 13; + + /** + * Indicates that the current definition defines a string. + */ + public static final int _dk_String = 14; + + /** + * Indicates that the current definition defines a sequence. + */ + public static final int _dk_Sequence = 15; + + /** + * Indicates that the current definition defines an array. + */ + public static final int _dk_Array = 16; + + /** + * Indicates that the current definition defines an another interface + * repository. + */ + public static final int _dk_Repository = 17; + + /** + * Indicates that the current definition defines a wide (usually 16-bit + * per character) string. + */ + public static final int _dk_Wstring = 18; + + /** + * Indicates that the current definition defines a CORBA <code>fixed</code>. + */ + public static final int _dk_Fixed = 19; + + /** + * Indicates that the current definition defines a value. + */ + public static final int _dk_Value = 20; + + /** + * Indicates that the current definition defines a value box. + */ + public static final int _dk_ValueBox = 21; + + /** + * Indicates that the current definition defines value member. + */ + public static final int _dk_ValueMember = 22; + + /** + * Indicates that the current definition defines a Native. + */ + public static final int _dk_Native = 23; + + /** + * Indicates that the current definition defines an abstract interface. + */ + public static final int _dk_AbstractInterface = 24; + + /** + * Indicates that the current definition defines has no definition kind. + */ + public static final DefinitionKind dk_none = new DefinitionKind(_dk_none); + + /** + * This is a "wildcard '*'", used in cases where any definition kind + * is appropriate . + */ + public static final DefinitionKind dk_all = new DefinitionKind(_dk_all); + + /** + * Indicates that the current definition defines an attribute. + */ + public static final DefinitionKind dk_Attribute = new DefinitionKind(_dk_Attribute); + + /** + * Indicates that the current definition defines a constant. + */ + public static final DefinitionKind dk_Constant = new DefinitionKind(_dk_Constant); + + /** + * Indicates that the current definition defines an exception. + */ + public static final DefinitionKind dk_Exception = new DefinitionKind(_dk_Exception); + + /** + * Indicates that the current definition defines an interface. + * The interface definition can contain constants, types, + * exceptions, operations, and attributes. + */ + public static final DefinitionKind dk_Interface = new DefinitionKind(_dk_Interface); + + /** + * Indicates that the current definition defines a Module. + * The Module can contain constants, typedefs, exceptions and also + * interface, component, home, value or event type definitions. + * The module can also enclose other (nested) modules. + */ + public static final DefinitionKind dk_Module = new DefinitionKind(_dk_Module); + + /** + * Indicates that the current definition defines an operation, including + * the lists of parameters and exceptions raised by this operation. + */ + public static final DefinitionKind dk_Operation = new DefinitionKind(_dk_Operation); + + /** + * Indicates that the current definition defines a named type that is not + * an interface nor a value definition. Generally, it also cannot be + * a definition of component, home and event, but these three kinds are + * not listed in this class. + */ + public static final DefinitionKind dk_Typedef = new DefinitionKind(_dk_Typedef); + + /** + * Indicates that the current definition defines an alias. + */ + public static final DefinitionKind dk_Alias = new DefinitionKind(_dk_Alias); + + /** + * Indicates that the current definition defines a structure. + */ + public static final DefinitionKind dk_Struct = new DefinitionKind(_dk_Struct); + + /** + * Indicates that the current definition defines a union. + */ + public static final DefinitionKind dk_Union = new DefinitionKind(_dk_Union); + + /** + * Indicates that the current definition defines an enumeration. + */ + public static final DefinitionKind dk_Enum = new DefinitionKind(_dk_Enum); + + /** + * Indicates that the current definition defines a primitive type. + */ + public static final DefinitionKind dk_Primitive = new DefinitionKind(_dk_Primitive); + + /** + * Indicates that the current definition defines a string. + */ + public static final DefinitionKind dk_String = new DefinitionKind(_dk_String); + + /** + * Indicates that the current definition defines a sequence. + */ + public static final DefinitionKind dk_Sequence = new DefinitionKind(_dk_Sequence); + + /** + * Indicates that the current definition defines an array. + */ + public static final DefinitionKind dk_Array = new DefinitionKind(_dk_Array); + + /** + * Indicates that the current definition defines an another interface + * repository. + */ + public static final DefinitionKind dk_Repository = + new DefinitionKind(_dk_Repository); + + /** + * Indicates that the current definition defines a wide (usually 16-bit + * per character) string. + */ + public static final DefinitionKind dk_Wstring = new DefinitionKind(_dk_Wstring); + + /** + * Indicates that the current definition defines a CORBA <code>fixed</code>. + */ + public static final DefinitionKind dk_Fixed = new DefinitionKind(_dk_Fixed); + + /** + * Indicates that the current definition defines a value. + */ + public static final DefinitionKind dk_Value = new DefinitionKind(_dk_Value); + + /** + * Indicates that the current definition defines a value box. + */ + public static final DefinitionKind dk_ValueBox = new DefinitionKind(_dk_ValueBox); + + /** + * Indicates that the current definition defines value member. + */ + public static final DefinitionKind dk_ValueMember = + new DefinitionKind(_dk_ValueMember); + + /** + * Indicates that the current definition defines a Native. + */ + public static final DefinitionKind dk_Native = new DefinitionKind(_dk_Native); + + /** + * Indicates that the current definition defines . + */ + public static final DefinitionKind dk_AbstractInterface = + new DefinitionKind(_dk_AbstractInterface); + + /** + * The defintion code of the current instance of the definition kind. + */ + private final int kind; + + /** + * The table of the definition kinds + */ + private static DefinitionKind[] table; + + /** + * Creates a definition kind with the given integer definition kind code. + * + * @param a_kind a definition kind code, one of the _dk_.. constants, + * defined in this class. + */ + protected DefinitionKind(int a_kind) + { + kind = a_kind; + } + + /** + * Get the definition code of the current instance of the definition kind. + * + * @return one of the _dk_... constants, defined in this class. + */ + public int value() + { + return kind; + } + + /** + * Get the definition kind, corresponding the given integer code. + * + * @param a_kind the definition kind code, one of the _dk_... constants, + * defined in this class. + * + * @return the corresponding definition kind, one of the dk_... constants, + * defined in this class. + * + * @throws BAD_PARAM if the given integer does not match any definition + * kind. + */ + public static DefinitionKind from_int(int a_kind) + { + if (table == null) + fill_table(); + try + { + return table [ a_kind ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + throw new BAD_PARAM("No def. kind " + a_kind); + } + } + + /** + * Fill the conversion table on demand. + */ + private static void fill_table() + { + table = new DefinitionKind[ 25 ]; + table [ _dk_none ] = dk_none; + table [ _dk_all ] = dk_all; + table [ _dk_Attribute ] = dk_Attribute; + table [ _dk_Constant ] = dk_Constant; + table [ _dk_Exception ] = dk_Exception; + table [ _dk_Interface ] = dk_Interface; + table [ _dk_Module ] = dk_Module; + table [ _dk_Operation ] = dk_Operation; + table [ _dk_Typedef ] = dk_Typedef; + table [ _dk_Alias ] = dk_Alias; + table [ _dk_Struct ] = dk_Struct; + table [ _dk_Union ] = dk_Union; + table [ _dk_Enum ] = dk_Enum; + table [ _dk_Primitive ] = dk_Primitive; + table [ _dk_String ] = dk_String; + table [ _dk_Sequence ] = dk_Sequence; + table [ _dk_Array ] = dk_Array; + table [ _dk_Repository ] = dk_Repository; + table [ _dk_Wstring ] = dk_Wstring; + table [ _dk_Fixed ] = dk_Fixed; + table [ _dk_Value ] = dk_Value; + table [ _dk_ValueBox ] = dk_ValueBox; + table [ _dk_ValueMember ] = dk_ValueMember; + table [ _dk_Native ] = dk_Native; + table [ _dk_AbstractInterface ] = dk_AbstractInterface; + } +} diff --git a/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java b/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java new file mode 100644 index 000000000..2a6c97dc1 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java @@ -0,0 +1,125 @@ +/* DefinitionKindHelper.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.CORBA; + +import gnu.CORBA.DefinitionKindHolder; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the definition kind. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DefinitionKindHelper +{ + /** + * Insert the definition kind into the given Any. + */ + public static void insert(Any a, DefinitionKind that) + { + a.insert_Streamable(new DefinitionKindHolder(that)); + } + + /** + * Extract the definition kind from the given Any. + */ + public static DefinitionKind extract(Any a) + { + return ((DefinitionKindHolder) a.extract_Streamable()).value; + } + + /** + * Get the definition kind typecode (enumeration, named "DefinitionKind"). + * The member names are listed as defined by java 1.4 specification. + * The names, defined in OMG specification only (like dk_Home or + * dk_Event) are not listed. + */ + public static TypeCode type() + { + String[] members = + new String[] + { + "dk_none", "dk_all", "dk_Attribute", "dk_Constant", "dk_Exception", + "dk_Interface", "dk_Module", "dk_Operation", "dk_Typedef", + "dk_Alias", "dk_Struct", "dk_Union", "dk_Enum", "dk_Primitive", + "dk_String", "dk_Sequence", "dk_Array", "dk_Repository", + "dk_Wstring", "dk_Fixed", "dk_Value", "dk_ValueBox", + "dk_ValueMember", "dk_Native" + }; + + return + OrbRestricted.Singleton.create_enum_tc(id(), "DefinitionKind", + members + ); + } + + /** + * Get the definition kind repository id. + * + * @return "IDL:omg.org/CORBA/DefinitionKind:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/DefinitionKind:1.0"; + } + + /** + * Read the definitin kind (as int) from the CDR intput stream. + * + * @param istream a stream to read from. + */ + public static DefinitionKind read(InputStream istream) + { + return DefinitionKind.from_int(istream.read_long()); + } + + /** + * Write the definition kind (as int) to the CDR output stream. + * + * @param ostream a stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream ostream, DefinitionKind value) + { + ostream.write_long(value.value()); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DomainManager.java b/libjava/classpath/org/omg/CORBA/DomainManager.java new file mode 100644 index 000000000..a7a89fd1a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DomainManager.java @@ -0,0 +1,57 @@ +/* DomainManager.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.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Establishes and navigates relationships to superior and subordinate domains, + * and also creates and access policies. + * + * The DomainManager has associated with it the policy objects for a + * particular domain. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface DomainManager + extends IDLEntity, Object, Serializable, DomainManagerOperations +{ +} diff --git a/libjava/classpath/org/omg/CORBA/DomainManagerOperations.java b/libjava/classpath/org/omg/CORBA/DomainManagerOperations.java new file mode 100644 index 000000000..6bda64d76 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DomainManagerOperations.java @@ -0,0 +1,59 @@ +/* DomainManagerOperations.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.CORBA; + + +/** + * Provides the means to access the policies of the domain, with that + * the implementing {@link DomainManager} is associated. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface DomainManagerOperations +{ + /** + * Get the policy of the specified type for the objects, belonging + * to this domain. The policy types are domain specific. + * + * @param policy_type the policy type + * + * @return the policy + */ + Policy get_domain_policy(int policy_type); +} diff --git a/libjava/classpath/org/omg/CORBA/DoubleHolder.java b/libjava/classpath/org/omg/CORBA/DoubleHolder.java new file mode 100644 index 000000000..23ec513f9 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DoubleHolder.java @@ -0,0 +1,127 @@ +/* DoubleHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>double</code> that is mapped into + * java <code>double</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class DoubleHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_double = + new PrimitiveTypeCode(TCKind.tk_double); + + /** + * The <code>double</code> (CORBA <code>double</code>) value, + * held by this DoubleHolder. + */ + public double value; + + /** + * Constructs an instance of DoubleHolder, + * initializing {@link #value} to <code>0.0</code>. + */ + public DoubleHolder() + { + } + + /** + * Constructs an instance of DoubleHolder, + * initializing {@link #value} to the given <code>double</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public DoubleHolder(double initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>double</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_double}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_double(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_double; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>double</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_double(double) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_double(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java b/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java new file mode 100644 index 000000000..6c971b7be --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java @@ -0,0 +1,143 @@ +/* DoubleSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>double</code> + * (<code>DoubleSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class DoubleSeqHelper +{ + /** + * Extract the <code>double[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link DoubleSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link DoubleSeqHolder}. + */ + public static double[] extract(Any a) + { + DoubleSeqHolder h = (DoubleSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>double[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link DoubleSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, double[] that) + { + DoubleSeqHolder holder = new DoubleSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>double[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static double[] read(InputStream input) + { + double[] value = new double[ input.read_long() ]; + input.read_double_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>DoubleSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_double); + } + + /** + * Writes the <code>double[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, double[] value) + { + output.write_long(value.length); + output.write_double_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java b/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java new file mode 100644 index 000000000..5d7fb1aed --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java @@ -0,0 +1,126 @@ +/* DoubleSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>DoubleSeq</code> that is mapped into + * java <code>double[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class DoubleSeqHolder + implements Streamable +{ + /** + * The <code>double[]</code> (CORBA <code>DoubleSeq</code>) value, + * held by this DoubleSeqHolder. + */ + public double[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_double); + + /** + * Constructs an instance of DoubleSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public DoubleSeqHolder() + { + } + + /** + * Constructs an instance of DoubleSeqHolder, + * initializing {@link #value} to the given <code>double[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public DoubleSeqHolder(double[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_double_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new double[ input.read_long() ]; + input.read_double_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_double_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_double_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DynAny.java b/libjava/classpath/org/omg/CORBA/DynAny.java new file mode 100644 index 000000000..a49e6c06d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynAny.java @@ -0,0 +1,507 @@ +/* DynAny.java -- + Copyright (C) 2005, 2006, 2007 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.CORBA; + +import org.omg.CORBA.DynAnyPackage.Invalid; +import org.omg.CORBA.DynAnyPackage.InvalidValue; +import org.omg.CORBA.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * The DynAny interface provides possibility to access the components of + * the CORBA object, stored inside the {@link Any}. The {@link Any} itself + * allows to read, write and pass as parameter the stored value without + * knowning its exact data type. The DynAny and derived classes additionally + * allows to access the members of the sequence, structure, union and get the + * data about enumeration, value type and CORBA <code>fixed</code> without + * knowing the exact type at the run time. The returned members are also + * wrapped into DynAny objects, allowing them to be the nested structures. + * + * @deprecated by {@link org.omg.DynamicAny.DynAny} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAny + extends org.omg.CORBA.Object +{ + /** + * Copy one DynAny into another. + * + * @param from the DynAny to copy from. + * @throws Invalid if the source DynAny is invalid. + */ + void assign(DynAny from) + throws Invalid; + + /** + * Clones this DynAny. + */ + DynAny copy(); + + /** + * Returns the focused component of this DynAny. The DynAny has the internal + * pointer (reference) that can point to one of its components. The returned + * DynAny can be used to get or set the value of the focused component. + * If the DynAny holds a primitive type with no components, this + * implementation returns <code>this</code>. + */ + DynAny current_component(); + + /** + * Destroys this DynAny, freeing the used resources. In java, resources + * are freed by the garbage collectors, so this method typically returns + * without action. + */ + void destroy(); + + /** + * Makes a DynAny from the {@link Any}. The passed {@link Any} becomes the + * enclosed instance of this DynAny, allowing to change/traverse the + * {@link Any} fields by the {@link DynAny} methods. + */ + void from_any(Any an_any) + throws Invalid; + + /** + * Retrieves the {@link Any}, stored inside this DynAny. + * + * @throws TypeMismatch if the typecode of the accessed Any + * is not the same as the typecode of this DynAny. + */ + Any get_any() + throws TypeMismatch; + + /** + * Extract the boolean value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + boolean get_boolean() + throws TypeMismatch; + + /** + * Extract the char value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + char get_char() + throws TypeMismatch; + + /** + * Extract the <code>double</code> value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + double get_double() + throws TypeMismatch; + + /** + * Extract the <code>float</code> value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + float get_float() + throws TypeMismatch; + + /** + * Extract the int (CORBA long) value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + int get_long() + throws TypeMismatch; + + /** + * Extract the long (CORBA long long) value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + long get_longlong() + throws TypeMismatch; + + /** + * Extract the byte (CORBA octet) value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + byte get_octet() + throws TypeMismatch; + + /** + * Extract the CORBA object reference that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + Object get_reference() + throws TypeMismatch; + + /** + * Extract the <code>short</code> value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + short get_short() + throws TypeMismatch; + + /** + * Extract the string value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + String get_string() + throws TypeMismatch; + + /** + * Extract the {@link TypeCode} value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + TypeCode get_typecode() + throws TypeMismatch; + + /** + * Extract the unsigned int (CORBA ulong) value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + int get_ulong() + throws TypeMismatch; + + /** + * Extract the unsingel long (CORBA unsigned long long )value that + * is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + long get_ulonglong() + throws TypeMismatch; + + /** + * Extract the unsigned short value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + short get_ushort() + throws TypeMismatch; + + /** + * Extract the value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + Serializable get_val() + throws TypeMismatch; + + /** + * Extract the wide (usually UTF-16) character value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + char get_wchar() + throws TypeMismatch; + + /** + * Extract the wide (usually UFT-16) string that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the + * different type. + */ + String get_wstring() + throws TypeMismatch; + + /** + * Insert the {@link Any} value into the enclosed + * {@link Any} inside this DynAny. + * + * @param an_any the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_any(Any an_any) + throws InvalidValue; + + /** + * Insert the boolean value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_boolean(boolean a_x) + throws InvalidValue; + + /** + * Insert the char value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_char(char a_x) + throws InvalidValue; + + /** + * Insert the double value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_double(double a_x) + throws InvalidValue; + + /** + * Insert the float value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_float(float a_x) + throws InvalidValue; + + /** + * Insert the int (CORBA long) value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_long(int a_x) + throws InvalidValue; + + /** + * Insert the long (CORBA long long) value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_longlong(long a_x) + throws InvalidValue; + + /** + * Insert the byte (CORBA octet) value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_octet(byte a_x) + throws InvalidValue; + + /** + * Insert the object reference into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_reference(Object a_x) + throws InvalidValue; + + /** + * Insert the <code>short</code> value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_short(short a_x) + throws InvalidValue; + + /** + * Insert the string value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_string(String a_x) + throws InvalidValue; + + /** + * Insert the {@link TypeCode} value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_typecode(TypeCode a_x) + throws InvalidValue; + + /** + * Insert the int (CORBA unsinged long) value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_ulong(int a_x) + throws InvalidValue; + + /** + * Insert the long (CORBA unsigned long long) value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_ulonglong(long a_x) + throws InvalidValue; + + /** + * Insert the short (CORBA unsigned short) value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_ushort(short a_x) + throws InvalidValue; + + /** + * Insert the value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_val(Serializable a_x) + throws InvalidValue; + + /** + * Insert the wide char (usually UTF-16) value into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_wchar(char a_x) + throws InvalidValue; + + /** + * Insert the wide string (usually UTF-16) into the enclosed + * {@link Any} inside this DynAny + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the + * typecode of the enclosed {@link Any}. + */ + void insert_wstring(String a_x) + throws InvalidValue; + + /** + * Advances the internal pointer, described in the {@link #current_component}, + * one position forward. + * + * @return true if the pointer now points to the new component, + * false if there are no more components of this DynAny holds + * a basic type that is not divided into components. + */ + boolean next(); + + /** + * Moves the internal pointer, described in the {@link #current_component}, + * to the first component. + */ + void rewind(); + + /** + * Moves the internal pointer, described in the {@link #current_component}, + * to the given position. + * + * @param p the number of the internal component on that the internal + * pointer must be focused. + * + * @return true on success or false if there is no component with the + * given number. If the DynAny holds the basic type, this method returs + * false p values other than 0. + */ + boolean seek(int p); + + /** + * Returns the enclosed {@link Any}. + * + * @return the enclosed {@link Any}. + */ + Any to_any() + throws Invalid; + + /** + * Returns the typecode of the object, inserted into this + * DynAny. + * + * @return the typecode of the inserted {@link Any} or null typecode + * if no {@link Any has been yet inserted}. + */ + TypeCode type(); +} diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java new file mode 100644 index 000000000..cc232c4ea --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/Invalid.java @@ -0,0 +1,78 @@ +/* Invalid.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.CORBA.DynAnyPackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * This exception is thrown by dynamic any operations when a bad DynAny or Any is passed as a parameter. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class Invalid + extends UserException + implements Serializable, IDLEntity +{ + /** + * Use 1.4 version serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -8258194490767575588L; + + /** + * Creates Invalid without explaining message. + */ + public Invalid() + { + super(); + } + + /** + * Created Invalid exception, providing the explaining message. + * + * @param reason the reason of throwing the exception. + */ + public Invalid(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java new file mode 100644 index 000000000..0904866ca --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidSeq.java @@ -0,0 +1,77 @@ +/* InvalidSeq.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.CORBA.DynAnyPackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * This exception is thrown by by dynamic any operations when a bad <code>sequence</code> is passed as a parameter. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class InvalidSeq + extends UserException + implements Serializable, IDLEntity +{ + /** + * Use 1.4 version serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -5678460771857763522L; + + /** + * Creates InvalidSeq without explaining message. + */ + public InvalidSeq() + { + super(); + } + + /** + * Created InvalidSeq exception, providing the explaining message. + * + * @param reason the reason of throwing the exception. + */ + public InvalidSeq(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java new file mode 100644 index 000000000..c2c4394ad --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/InvalidValue.java @@ -0,0 +1,77 @@ +/* InvalidValue.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.CORBA.DynAnyPackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * This expception in response to insert the inapproriate value into dynamic Any, usually by the DynAny.insert_*(value) method group. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class InvalidValue + extends UserException + implements Serializable, IDLEntity +{ + /** + * Use 1.4 version serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -4741963043279146697L; + + /** + * Creates InvalidValue without explaining message. + */ + public InvalidValue() + { + super(); + } + + /** + * Created InvalidValue exception, providing the explaining message. + * + * @param reason the reason of throwing the exception. + */ + public InvalidValue(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java b/libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java new file mode 100644 index 000000000..f1dfd5d41 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/TypeMismatch.java @@ -0,0 +1,77 @@ +/* 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.CORBA.DynAnyPackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * This exception is thrown by dynamic any accessor methods when type of the actual contents do not match what is trying to be accessed. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class TypeMismatch + extends UserException + implements Serializable, IDLEntity +{ + /** + * Use 1.4 version serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 2763424591181102501L; + + /** + * Creates TypeMismatch without explaining message. + */ + public TypeMismatch() + { + super(); + } + + /** + * Created TypeMismatch exception, providing the explaining message. + * + * @param reason the reason of throwing the exception. + */ + public TypeMismatch(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/DynAnyPackage/package.html b/libjava/classpath/org/omg/CORBA/DynAnyPackage/package.html new file mode 100644 index 000000000..f8c476e6f --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynAnyPackage/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.sql package. + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA.TypeCodePackage</title></head> + +<body> +<p>Provides a couple of exceptions, thrown by methods in the <code>TypeCode</code> class.</p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/CORBA/DynArray.java b/libjava/classpath/org/omg/CORBA/DynArray.java new file mode 100644 index 000000000..59901c23b --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynArray.java @@ -0,0 +1,67 @@ +/* DynArray.java -- + Copyright (C) 2005, 2007 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.CORBA; + +import org.omg.CORBA.DynAnyPackage.InvalidSeq; + + +/** + * Represents the {@link DynAny}, holding an array. + * + * @deprecated by {@link org.omg.DynamicAny.DynArray} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynArray + extends DynAny +{ + /** + * Get the elements of the enclosed array. + */ + Any[] get_elements(); + + /** + * Set the elements from of the enclosed array of Anys. + * + * @throws InvalidSeq if the passed array contains the + * elements of the different type of if the array size mismatch. + */ + void set_elements(Any[] an_array) + throws InvalidSeq; +} diff --git a/libjava/classpath/org/omg/CORBA/DynEnum.java b/libjava/classpath/org/omg/CORBA/DynEnum.java new file mode 100644 index 000000000..e082d3e55 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynEnum.java @@ -0,0 +1,86 @@ +/* DynEnum.java -- + Copyright (C) 2005, 2007 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.CORBA; + + +/** + * Represents the dynamic enumeration, allowing to get/set the value by + * name or by position in the enumeration list. The CORBA enumeration + * can obtain one of the named values from the specified enumeration list. + * + * @deprecated by {@link org.omg.DynamicAny.DynEnum} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynEnum + extends DynAny +{ + /** + * Get the value of this object. + * @return the currently set value, one of the allowed values + * for this enumeration. + */ + String value_as_string(); + + /** + * Set the value of this object. + * + * @param member the value to set, must be one of the allowed values for + * this enumeration. Otherwise the {@link SystemException} may be thrown. + */ + void value_as_string(String member); + + /** + * Set the value of this object as the position inside the list of this + * enumeration. + * + * @param member the position of the enumeration value inside + * the enumeration list. Otherwise the {@link SystemException} may be thrown. + */ + void value_as_ulong(int member); + + /** + * Get the value of this object as the position inside the list of this + * enumeration. + * + * @return member the position of the currently set enumeration value inside + * the enumeration list. + */ + int value_as_ulong(); +} diff --git a/libjava/classpath/org/omg/CORBA/DynFixed.java b/libjava/classpath/org/omg/CORBA/DynFixed.java new file mode 100644 index 000000000..0faded9ed --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynFixed.java @@ -0,0 +1,79 @@ +/* DynFixed.java -- + Copyright (C) 2005, 2007 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.CORBA; + +import org.omg.CORBA.DynAnyPackage.InvalidValue; + +/** + * Represents a CORBA <code>fixed</code>, allowing to get and set its value + * in the form of the binary representation. + * + * The format, described in CORBA specification, requires to store + * data in hexadecimal format, two digits per byte (oceted), most + * significant digit first. The last half-byte in the representation + * stores the sign, being 0xD for negative numbers and 0xC for + * zero and positive numbers. To have the even number of half bytes, + * 0x0 is appended to the beginning, if required. The position of the + * decimal point is not stored. + * + * @see gnu.CORBA.BigDecimalHelper + * + * @deprecated by {@link org.omg.DynamicAny.DynFixed} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynFixed + extends DynAny +{ + /** + * Get the value of this DynFixed in the binary form. + * + * @return the binary representation, defined in the header comment. + */ + byte[] get_value(); + + /** + * Sets the value of this DynFixed from the binary representation. + * + * @param a_value the byte array, representing a CORBA <code>fixed</code>, + * as defined in the header comment. + */ + void set_value(byte[] a_value) + throws InvalidValue; +} diff --git a/libjava/classpath/org/omg/CORBA/DynSequence.java b/libjava/classpath/org/omg/CORBA/DynSequence.java new file mode 100644 index 000000000..addaac856 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynSequence.java @@ -0,0 +1,80 @@ +/* DynSequence.java -- + Copyright (C) 2005, 2006, 2007 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.CORBA; + +import org.omg.CORBA.DynAnyPackage.InvalidSeq; + +/** + * Represents the {@link DynAny}, holding the CORBA sequence + * (an array with the flexible length). + * + * @deprecated by {@link org.omg.DynamicAny.DynSequence} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynSequence + extends DynAny +{ + /** + * Get the elements of the enclosed sequence. + */ + Any[] get_elements(); + + /** + * Returns the number of elements, stored in the sequence. + * @return the length of the sequence + */ + int length(); + + /** + * Sets the length of this sequence to the given value. + * + * @param l the new length of the sequence. + */ + void length(int l); + + /** + * Set the elements from of the enclosed array of Anys. + * + * @throws InvalidSeq if the passed array contains the + * elements of the different type. + */ + void set_elements(Any[] an_array) + throws InvalidSeq; +} diff --git a/libjava/classpath/org/omg/CORBA/DynStruct.java b/libjava/classpath/org/omg/CORBA/DynStruct.java new file mode 100644 index 000000000..e292e99f1 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynStruct.java @@ -0,0 +1,91 @@ +/* DynStruct.java -- + Copyright (C) 2005, 2007 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.CORBA; + +import org.omg.CORBA.DynAnyPackage.InvalidSeq; + +/** + * Represents the {@link DynAny}, holding the CORBA structure (record + * with the named fields). The internal reference, described in + * {@link DynAny#current_component()}, iterates over the fields of the + * structure. + * + * @deprecated by {@link org.omg.DynamicAny.DynStruct} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynStruct + extends DynAny +{ +/** + * Get the kind of the structure field that would be returned by + * {@link DynAny#current_component()}. + * + * @return the kind of the structure field. + */ + TCKind current_member_kind(); + + /** + * Get the name of the structure field that would be returned by + * {@link DynAny#current_component()}. + * + * @return the name of the structure field. + */ + String current_member_name(); + + /** + * Get all fields of the structure in the array of the named values, + * holding name, repository id and value of the associated field. + * + * @return members the array of the named values, + * representing the structure fields. + */ + NameValuePair[] get_members(); + + /** + * Set all fields of this structure by name. + * + * @param members the array of the named values, + * representing the structure fields. + * + * @throws InvalidSeq if the passed argument is invalid. + */ + void set_members(NameValuePair[] members) + throws InvalidSeq; +} diff --git a/libjava/classpath/org/omg/CORBA/DynUnion.java b/libjava/classpath/org/omg/CORBA/DynUnion.java new file mode 100644 index 000000000..2712cc838 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynUnion.java @@ -0,0 +1,101 @@ +/* DynUnion.java -- + Copyright (C) 2005, 2007 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.CORBA; + + +/** + * Represents the {@link DynAny}, holding the CORBA structure (variant record + * with the named fields). The internal reference, described in + * {@link DynAny#current_component()}, iterates over the fields of the + * member, stored in the union. The union always holds only one member; + * which one, depends from the value of the discriminator. + * + * @deprecated by {@link org.omg.DynamicAny.DynUnion} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynUnion + extends DynAny +{ + /** + * Returns the discriminator, defining, which set of fields is stored. + * @return the discriminator. + */ + DynAny discriminator(); + + /** + * Returns the discriminator kind. + */ + TCKind discriminator_kind(); + + /** + * Returns the member, stored in this union. + */ + DynAny member(); + + /** + * Returns the kind of the member, stored in this union. + */ + TCKind member_kind(); + + /** + * Returns the name of the currently focused member. + */ + String member_name(); + + /** + * Renames the currently focused member. + * + * @param new_name the new name of the currently focused member. + */ + void member_name(String new_name); + + /** + * Checks if the discriminator of this union has been assigned a valid + * default value. + */ + boolean set_as_default(); + + /** + * Determines if the discriminator of this union gets assigned a valid + * default value. + * @param assign_default + */ + void set_as_default(boolean assign_default); +} diff --git a/libjava/classpath/org/omg/CORBA/DynValue.java b/libjava/classpath/org/omg/CORBA/DynValue.java new file mode 100644 index 000000000..a23cd1a7f --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynValue.java @@ -0,0 +1,90 @@ +/* DynValue.java -- + Copyright (C) 2005, 2006, 2007 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.CORBA; + +import org.omg.CORBA.DynAnyPackage.InvalidSeq; + +/** + * Represents the {@link DynAny}, holding a value type. + * + * A value type is something between CORBA structure and CORBA object. + * Like CORBA object, it can have methods, supporting some IDL-defined + * interface. However, like structures, they are always local and passed by + * value, not by IOR reference. + * + * The value types can have both public and private members. They support + * inheritance. Value types can also be abstract. + * + * @deprecated by {@link org.omg.DynamicAny.DynValue} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValue + extends DynAny, org.omg.CORBA.Object +{ + /** + * Get the kind of the member, pointed by the internal pointer. + * + * @return the kind of the member. + */ + TCKind current_member_kind(); + + /** + * Get the name of the member, pointed by the internal pointer. + * + * @return the name of the member. + */ + String current_member_name(); + + /** + * Get all members of the enclosed value type object. + * @return members, as an array of the name - value pairs. + */ + NameValuePair[] get_members(); + + /** + * Set all members for the enclosed value type object. + * + * @param value an array of members to set. + * + * @throws InvalidSeq if the passed sequence is not valid. + */ + void set_members(NameValuePair[] value) + throws InvalidSeq; +} diff --git a/libjava/classpath/org/omg/CORBA/DynamicImplementation.java b/libjava/classpath/org/omg/CORBA/DynamicImplementation.java new file mode 100644 index 000000000..40c800798 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/DynamicImplementation.java @@ -0,0 +1,178 @@ +/* DynamicImplementation.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.CORBA; + +import gnu.CORBA.Unexpected; +import gnu.CORBA.gnuAny; +import gnu.CORBA.gnuNVList; + +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** + * This class was probably originally thinked as a base of all CORBA + * object implementations. However the code, generated by IDL to + * java compilers almost never use it, preferring to derive the + * object implementation bases directly from the {@link ObjectImpl}. + * The class has become deprecated since the 1.4 release. + * + * @deprecated since 1.4. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class DynamicImplementation + extends ObjectImpl +{ + /** + * Invoke the method of the CORBA object. After converting the parameters, + * this method delegates call to the {@link ObjectImpl#_invoke}. + * + * @deprecated since 1.4. + * + * @param request the container for both passing and returing the parameters, + * also contains the method name and thrown exceptions. + */ + public void invoke(ServerRequest request) + { + Request r = _request(request.operation()); + + // Copy the parameters. + NVList args = new gnuNVList(); + request.arguments(args); + NamedValue v; + int i = 0; + + try + { + // Set the arguments. + for (i = 0; i < args.count(); i++) + { + v = args.item(i); + Any n; + OutputStream out; + + switch (v.flags()) + { + case ARG_IN.value: + out = v.value().create_output_stream(); + v.value().write_value(out); + n = r.add_named_in_arg(v.name()); + n.read_value(out.create_input_stream(), v.value().type()); + break; + case ARG_INOUT.value: + out = v.value().create_output_stream(); + v.value().write_value(out); + n = r.add_named_inout_arg(v.name()); + n.read_value(out.create_input_stream(), v.value().type()); + break; + case ARG_OUT.value: + r.add_named_out_arg(v.name()); + break; + + default: + throw new InternalError("Invalid flags " + v.flags()); + } + } + } + catch (Bounds b) + { + throw new Unexpected(args.count() + "[" + i + "]", b); + } + + // Set context. + r.ctx(request.ctx()); + + // Set the return type (expects that the ServerRequest will initialise + // the passed Any. + + gnuAny g = new gnuAny(); + request.result(g); + r.set_return_type(g.type()); + + // Invoke the method. + r.invoke(); + + // Transfer the returned values. + NVList r_args = r.arguments(); + + try + { + // API states that the ServerRequest.arguments must be called only + // once. Hence we assume we can just modify the previously returned + // value <code>args</code>, and the ServerRequest will preserve the + // reference. + for (i = 0; i < args.count(); i++) + { + v = args.item(i); + + if (v.flags() == ARG_OUT.value || v.flags() == ARG_INOUT.value) + { + OutputStream out = r_args.item(i).value().create_output_stream(); + r_args.item(i).value().write_value(out); + v.value().read_value(out.create_input_stream(), + v.value().type()); + } + } + } + catch (Bounds b) + { + throw new Unexpected(args.count() + "[" + i + "]", b); + } + + // Set the returned result (if any). + NamedValue returns = r.result(); + if (returns != null) + request.set_result(returns.value()); + } + + /** + * Returns the array of the repository ids, supported by this object. + * In this implementation, the method must be overrridden to return + * a sendible object-specific information. The default method returns + * an empty array. + * + * @deprecated since 1.4. + * + * @return the empty array, always. + */ + public String[] _ids() + { + return new String[ 0 ]; + } +} diff --git a/libjava/classpath/org/omg/CORBA/Environment.java b/libjava/classpath/org/omg/CORBA/Environment.java new file mode 100644 index 000000000..fab77c7ec --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Environment.java @@ -0,0 +1,70 @@ +/* Environment.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.CORBA; + + +/** + * A container for an exception, that has been thrown by the method + * of the CORBA object. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class Environment +{ + /** + * Removes the exception object from this container. + */ + public abstract void clear(); + + /** + * Returns an exception, enclosed in this container. + * + * @return the enclosed exception or null if no any + * exception has been thrown or {@link #clear()} + * has been previously called. + */ + public abstract Exception exception(); + + /** + * Inserts the given exception into this container. + * + * @param except the exception to insert. + */ + public abstract void exception(Exception except); +} diff --git a/libjava/classpath/org/omg/CORBA/ExceptionList.java b/libjava/classpath/org/omg/CORBA/ExceptionList.java new file mode 100644 index 000000000..0a834344d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ExceptionList.java @@ -0,0 +1,73 @@ +/* ExceptionList.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.CORBA; + +/** + * Stores exceptions that can be thrown when invoking a method of an + * CORBA {@link org.omg.CORBA.Object}. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org). + */ +public abstract class ExceptionList +{ + /** + * Add the typecode of the given exception to the list. + */ + public abstract void add(TypeCode an_exception); + + /** + * Get the number of the stored exceptions. + */ + public abstract int count(); + + /** + * Get the item at the given position. + * @param at the index + * @throws Bounds if the index is out of range. + */ + public abstract TypeCode item(int at) + throws Bounds; + + /** + * Remove the item at the given position. + * @param at the index + * @throws Bounds if the index is out of range. + */ + public abstract void remove(int at) + throws Bounds; +} diff --git a/libjava/classpath/org/omg/CORBA/FREE_MEM.java b/libjava/classpath/org/omg/CORBA/FREE_MEM.java new file mode 100644 index 000000000..ac656c0fa --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/FREE_MEM.java @@ -0,0 +1,96 @@ +/* FREE_MEM.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.CORBA; + +import java.io.Serializable; + +/** + * Means errors, related to freeing the allocated memory. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class FREE_MEM + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1333559476995791982L; + + /** + * Creates a FREE_MEM with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public FREE_MEM(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates FREE_MEM with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public FREE_MEM() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a FREE_MEM exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public FREE_MEM(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created FREE_MEM exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public FREE_MEM(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/FieldNameHelper.java b/libjava/classpath/org/omg/CORBA/FieldNameHelper.java new file mode 100644 index 000000000..276105eec --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/FieldNameHelper.java @@ -0,0 +1,116 @@ +/* FieldNameHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A formal helper for the CORBA FieldName that is identical to the + * narrow string. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class FieldNameHelper +{ + /** + * Insert the FieldName into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the FieldName from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an string alias typecode, named "FieldName". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0)); + } + + /** + * Return the FieldName repository id. + * @return "IDL:omg.org/CORBA/FieldName:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/FieldName:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param istream the stream to read from. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param ostream the stream to write into. + * @param value the string (FieldName) value to write. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/FixedHolder.java b/libjava/classpath/org/omg/CORBA/FixedHolder.java new file mode 100644 index 000000000..a44cde52d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/FixedHolder.java @@ -0,0 +1,125 @@ +/* FixedHolder.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.CORBA; + +import gnu.CORBA.typecodes.FixedTypeCode; + +import java.math.BigDecimal; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>fixed</code> that is mapped into + * java <code>BigDecimal</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class FixedHolder + implements Streamable +{ + /** + * The <code>BigDecimal</code> (CORBA <code>fixed</code>) value, + * held by this FixedHolder. + */ + public BigDecimal value; + + /** + * Constructs an instance of FixedHolder, + * initializing {@link #value} to <code>null</code>. + */ + public FixedHolder() + { + } + + /** + * Constructs an instance of FixedHolder, + * initializing {@link #value} to the given <code>BigDecimal</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public FixedHolder(BigDecimal initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>fixed</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_fixed}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_fixed(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. The scale and digits are set corresponding + * the scale and used digits of the value that is currently stored + * or left with default value 0 if the value is not set. + */ + public TypeCode _type() + { + return new FixedTypeCode(value); + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>fixed</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_fixed(BigDecimal) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_fixed(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/FloatHolder.java b/libjava/classpath/org/omg/CORBA/FloatHolder.java new file mode 100644 index 000000000..8d765ced3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/FloatHolder.java @@ -0,0 +1,127 @@ +/* FloatHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>float</code> that is mapped into + * java <code>float</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class FloatHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_float = + new PrimitiveTypeCode(TCKind.tk_float); + + /** + * The <code>float</code> (CORBA <code>float</code>) value, + * held by this FloatHolder. + */ + public float value; + + /** + * Constructs an instance of FloatHolder, + * initializing {@link #value} to <code>0.0</code>. + */ + public FloatHolder() + { + } + + /** + * Constructs an instance of FloatHolder, + * initializing {@link #value} to the given <code>float</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public FloatHolder(float initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>float</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_float}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_float(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_float; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>float</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_float(float) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_float(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java b/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java new file mode 100644 index 000000000..10850e022 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java @@ -0,0 +1,143 @@ +/* FloatSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>float</code> + * (<code>FloatSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class FloatSeqHelper +{ + /** + * Extract the <code>float[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link FloatSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link FloatSeqHolder}. + */ + public static float[] extract(Any a) + { + FloatSeqHolder h = (FloatSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>float[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link FloatSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, float[] that) + { + FloatSeqHolder holder = new FloatSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>float[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static float[] read(InputStream input) + { + float[] value = new float[ input.read_long() ]; + input.read_float_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>FloatSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_float); + } + + /** + * Writes the <code>float[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, float[] value) + { + output.write_long(value.length); + output.write_float_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java b/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java new file mode 100644 index 000000000..b7e8efcc0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java @@ -0,0 +1,126 @@ +/* FloatSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>FloatSeq</code> that is mapped into + * java <code>float[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class FloatSeqHolder + implements Streamable +{ + /** + * The <code>float[]</code> (CORBA <code>FloatSeq</code>) value, + * held by this FloatSeqHolder. + */ + public float[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_float); + + /** + * Constructs an instance of FloatSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public FloatSeqHolder() + { + } + + /** + * Constructs an instance of FloatSeqHolder, + * initializing {@link #value} to the given <code>float[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public FloatSeqHolder(float[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_float_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new float[ input.read_long() ]; + input.read_float_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_float_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_float_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/IDLType.java b/libjava/classpath/org/omg/CORBA/IDLType.java new file mode 100644 index 000000000..74c10549f --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IDLType.java @@ -0,0 +1,55 @@ +/* IDLType.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * An abstract interface + * that represent OMG IDL types. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface IDLType + extends IDLTypeOperations, IRObject, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java b/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java new file mode 100644 index 000000000..fa8d71dd3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java @@ -0,0 +1,128 @@ +/* IDLTypeHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the IDL type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class IDLTypeHelper +{ + /** + * Insert the IDL type into the given Any. + */ + public static void insert(Any a, IDLType that) + { + OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } + + /** + * Extract the IDL type from the given Any. + */ + public static IDLType extract(Any a) + { + return read(a.create_input_stream()); + } + + /** + * Get the typecode of the IDL type (the interface typecode, name "IDLType"). + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(IDLTypeHelper.id(), + "IDLType"); + } + + /** + * Return the IDLType repository id. + * + * @return "IDL:omg.org/CORBA/IDLType:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/IDLType:1.0"; + } + + /** + * Read the IDL type from the given input stream. + * The method reads an object and narrows into IDL type using this + * helper. + */ + public static IDLType read(InputStream istream) + { + return narrow(istream.read_Object()); + } + + /** + * Write the IDL type to the output stream (as CORBA object). + */ + public static void write(OutputStream ostream, IDLType value) + { + ostream.write_Object((org.omg.CORBA.Object) value); + } + + /** + * Narrows the CORBA object into the IDL type. + */ + public static IDLType narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof IDLType) + return (IDLType) obj; + else if (!obj._is_a(id())) + throw new org.omg.CORBA.BAD_PARAM(); + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _IDLTypeStub(delegate); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/IDLTypeOperations.java b/libjava/classpath/org/omg/CORBA/IDLTypeOperations.java new file mode 100644 index 000000000..1389167ed --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IDLTypeOperations.java @@ -0,0 +1,56 @@ +/* IDLTypeOperations.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. */ + + +/** + * Defines operations, applicable for the IDL type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +package org.omg.CORBA; + +public interface IDLTypeOperations + extends IRObjectOperations +{ + /** + * Get the type code of the interface repository object. + * + * @return the data structure, describing the type of the object, stored in + * the repository. + */ + TypeCode type(); +} diff --git a/libjava/classpath/org/omg/CORBA/IMP_LIMIT.java b/libjava/classpath/org/omg/CORBA/IMP_LIMIT.java new file mode 100644 index 000000000..5fda9276d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IMP_LIMIT.java @@ -0,0 +1,97 @@ +/* IMP_LIMIT.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the server has reached some implementation limit + * (too many clients, too many references, too long parameters and so on). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class IMP_LIMIT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -8086463494577448422L; + + /** + * Creates a IMP_LIMIT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public IMP_LIMIT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates IMP_LIMIT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public IMP_LIMIT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a IMP_LIMIT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public IMP_LIMIT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created IMP_LIMIT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public IMP_LIMIT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INITIALIZE.java b/libjava/classpath/org/omg/CORBA/INITIALIZE.java new file mode 100644 index 000000000..ac07b3f5c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INITIALIZE.java @@ -0,0 +1,96 @@ +/* INITIALIZE.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the server cannot be initialized because of the some reason. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INITIALIZE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -3753094599663690309L; + + /** + * Creates a INITIALIZE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INITIALIZE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INITIALIZE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INITIALIZE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INITIALIZE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INITIALIZE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INITIALIZE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INITIALIZE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INTERNAL.java b/libjava/classpath/org/omg/CORBA/INTERNAL.java new file mode 100644 index 000000000..74478e7c6 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INTERNAL.java @@ -0,0 +1,96 @@ +/* INTERNAL.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.CORBA; + +import java.io.Serializable; + +/** + * Means an internal failure in the ORB. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INTERNAL + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 3771336866139357605L; + + /** + * Creates a INTERNAL with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INTERNAL(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INTERNAL with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INTERNAL() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INTERNAL exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INTERNAL(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INTERNAL exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INTERNAL(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INTF_REPOS.java b/libjava/classpath/org/omg/CORBA/INTF_REPOS.java new file mode 100644 index 000000000..7c65dc1f2 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INTF_REPOS.java @@ -0,0 +1,96 @@ +/* INTF_REPOS.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.CORBA; + +import java.io.Serializable; + +/** + * Means errors, related to the interface repository. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INTF_REPOS + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 722572694720671863L; + + /** + * Creates a INTF_REPOS with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INTF_REPOS(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INTF_REPOS with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INTF_REPOS() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INTF_REPOS exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INTF_REPOS(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INTF_REPOS exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INTF_REPOS(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java b/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java new file mode 100644 index 000000000..eb4f69af1 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java @@ -0,0 +1,100 @@ +/* INVALID_ACTIVITY.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.CORBA; + +import java.io.Serializable; + +/** + * Raised when the transaction or Activity is resumed in a different context + * than from which it was suspended. It is also raised when the invocation is + * not incompatible with the Activity's current state. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class INVALID_ACTIVITY + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = 7907846629733712546L; + + /** + * Creates INVALID_ACTIVITY with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INVALID_ACTIVITY(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INVALID_ACTIVITY with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INVALID_ACTIVITY() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INVALID_ACTIVITY exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INVALID_ACTIVITY(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INVALID_ACTIVITY exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INVALID_ACTIVITY(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INVALID_TRANSACTION.java b/libjava/classpath/org/omg/CORBA/INVALID_TRANSACTION.java new file mode 100644 index 000000000..ed39311cf --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INVALID_TRANSACTION.java @@ -0,0 +1,96 @@ +/* INVALID_TRANSACTION.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.CORBA; + +import java.io.Serializable; + +/** + * Means that request carried an invalid transaction context. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INVALID_TRANSACTION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -4265126403821571697L; + + /** + * Creates a INVALID_TRANSACTION with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INVALID_TRANSACTION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INVALID_TRANSACTION with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INVALID_TRANSACTION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INVALID_TRANSACTION exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INVALID_TRANSACTION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INVALID_TRANSACTION exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INVALID_TRANSACTION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INV_FLAG.java b/libjava/classpath/org/omg/CORBA/INV_FLAG.java new file mode 100644 index 000000000..6f6f6333e --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INV_FLAG.java @@ -0,0 +1,96 @@ +/* INV_FLAG.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.CORBA; + +import java.io.Serializable; + +/** + * Means invalid flag, passed during operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INV_FLAG + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -4863924749863817671L; + + /** + * Creates a INV_FLAG with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INV_FLAG(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_FLAG with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_FLAG() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_FLAG exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INV_FLAG(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_FLAG exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INV_FLAG(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INV_IDENT.java b/libjava/classpath/org/omg/CORBA/INV_IDENT.java new file mode 100644 index 000000000..ae1de4fe8 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INV_IDENT.java @@ -0,0 +1,96 @@ +/* INV_IDENT.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.CORBA; + +import java.io.Serializable; + +/** + * Means that some IDL identifier has a wrong syntax. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INV_IDENT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 4399295047946553530L; + + /** + * Creates a INV_IDENT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INV_IDENT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_IDENT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_IDENT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_IDENT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INV_IDENT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_IDENT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INV_IDENT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INV_OBJREF.java b/libjava/classpath/org/omg/CORBA/INV_OBJREF.java new file mode 100644 index 000000000..ef12b3cdc --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INV_OBJREF.java @@ -0,0 +1,96 @@ +/* INV_OBJREF.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.CORBA; + +import java.io.Serializable; + +/** + * Means that some object reference is internally malformed. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INV_OBJREF + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -7238811948257685034L; + + /** + * Creates a INV_OBJREF with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INV_OBJREF(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_OBJREF with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_OBJREF() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_OBJREF exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INV_OBJREF(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_OBJREF exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INV_OBJREF(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/INV_POLICY.java b/libjava/classpath/org/omg/CORBA/INV_POLICY.java new file mode 100644 index 000000000..45ef7ab07 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/INV_POLICY.java @@ -0,0 +1,98 @@ +/* INV_POLICY.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.CORBA; + +import java.io.Serializable; + +/** + * This exception is thrown when an invocation cannot be made because of + * an incompatibility between Policy overrides that apply to the + * particular invocation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class INV_POLICY + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -7823113107689030975L; + + /** + * Creates a INV_POLICY with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public INV_POLICY(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_POLICY with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_POLICY() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_POLICY exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public INV_POLICY(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_POLICY exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public INV_POLICY(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/IRObject.java b/libjava/classpath/org/omg/CORBA/IRObject.java new file mode 100644 index 000000000..b0750089c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IRObject.java @@ -0,0 +1,53 @@ +/* IRObject.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Represents the interface repository object. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IRObject + extends IRObjectOperations, org.omg.CORBA.Object, Serializable, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/CORBA/IRObjectOperations.java b/libjava/classpath/org/omg/CORBA/IRObjectOperations.java new file mode 100644 index 000000000..40e936947 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IRObjectOperations.java @@ -0,0 +1,68 @@ +/* IRObjectOperations.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.CORBA; + + +/** + * Defines the operations, applicable to the interface repository object. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IRObjectOperations { + /** + * Get the definition kind of this interface repository object. + * + * @return the defintion kind (one of the DefinitionKind.dk_... + * constants). + */ + DefinitionKind def_kind(); + + /** + * Destroy this interface repository object. If the object is a container, + * the method applies to all its contents. If the object is part of some + * other object, it is removed. + * + * @throws BAD_INV_ORDER, minor code 1, if destroying this object would + * leave the repository in an incoherent state. + * + * @throws BAD_INV_ORDER, minor code 2, if the method is invoked on the + * Repository or on the definition of the primitive type. + */ + void destroy() throws BAD_INV_ORDER; + +} diff --git a/libjava/classpath/org/omg/CORBA/IdentifierHelper.java b/libjava/classpath/org/omg/CORBA/IdentifierHelper.java new file mode 100644 index 000000000..644a3eb4e --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IdentifierHelper.java @@ -0,0 +1,116 @@ +/* IdentifierHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A formal helper for the CORBA Identifier that is identical to the + * narrow string. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class IdentifierHelper +{ + /** + * Insert the Identifier into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the Identifier from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an string alias typecode, named "Identifier". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "Identifier", orb.create_string_tc(0)); + } + + /** + * Return the Identifier repository id. + * @return "IDL:omg.org/CORBA/Identifier:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/Identifier:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param istream the stream to read from. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param ostream the stream to write into. + * @param value the string (Identifier) value to write. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/IntHolder.java b/libjava/classpath/org/omg/CORBA/IntHolder.java new file mode 100644 index 000000000..a27cf435c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/IntHolder.java @@ -0,0 +1,126 @@ +/* IntHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>long</code> that is mapped into + * java <code>int</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class IntHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_long = new PrimitiveTypeCode(TCKind.tk_long); + + /** + * The <code>int</code> (CORBA <code>long</code>) value, + * held by this IntHolder. + */ + public int value; + + /** + * Constructs an instance of IntHolder, + * initializing {@link #value} to <code>0</code>. + */ + public IntHolder() + { + } + + /** + * Constructs an instance of IntHolder, + * initializing {@link #value} to the given <code>int</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public IntHolder(int initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_long}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_long(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_long; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_long(int) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/LocalObject.java b/libjava/classpath/org/omg/CORBA/LocalObject.java new file mode 100644 index 000000000..60436ee35 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/LocalObject.java @@ -0,0 +1,364 @@ +/* LocalObject.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.CORBA; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.Context; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.DomainManager; +import org.omg.CORBA.ExceptionList; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.NVList; +import org.omg.CORBA.NamedValue; +import org.omg.CORBA.Policy; +import org.omg.CORBA.Request; +import org.omg.CORBA.SetOverrideType; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ServantObject; + +import javax.rmi.CORBA.Util; + +/** + * An object, formally implementing the CORBA {@link Object}, but actually + * handling all invocations locally. + * Various calls to the remote object specific methods throw the + * {@link NO_IMPLEMENT}. The explaining message for this exception is + * specified in java API as <code>"This is a locally constrained object."</code>. + * It is not possible to get a stringified reference of the local object, or + * invoke a method using DII (by name via {@link Request} class). + * + * However narrowing and widening methods will work with local objects. + * + * @since 1.4 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class LocalObject + implements org.omg.CORBA.Object +{ + /** + * The explaining message for the exception, thrown in response to call + * the method, not appropriate for the local object. + */ + private static final String INAPPROPRIATE = + "This is a locally constrained object."; + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public Request _create_request(Context context, String operation, + NVList parameters, NamedValue returns + ) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public Request _create_request(Context context, String operation, + NVList parameters, NamedValue returns, + ExceptionList exceptions, ContextList ctx_list + ) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public org.omg.CORBA.Object _duplicate() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public DomainManager[] _get_domain_managers() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public org.omg.CORBA.Object _get_interface_def() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public org.omg.CORBA.Object _get_interface() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public Policy _get_policy(int a_policy_type) + throws BAD_PARAM + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * {@inheritDoc} + */ + public int _hash(int maximum) + { + return Math.abs(hashCode()) % maximum; + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public boolean _is_a(String repositoryIdentifer) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * Determines if the object is equal to another object, so far as it is + * possible to determine easily. + * + * @param other the other object. + * + * @return true if the pased object is not null and + * java.lang.Object.equals(other) returns true. False otherwise. + */ + public boolean _is_equivalent(org.omg.CORBA.Object other) + { + if (other != null) + if (other.equals(this)) + return true; + + return false; + } + + /** + * Always returs false. + * + * @return false, always. + */ + public boolean _non_existent() + { + return false; + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public void _release() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @specnote it is possible to implement a local handling of the _request(), + * but the API clearly states that NO_IMPLEMENT + * must be thrown instead. + * + * @throws NO_IMPLEMENT, always. + */ + public Request _request(String operation) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public org.omg.CORBA.Object _set_policy_override(Policy[] policies, + SetOverrideType how + ) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is called from <code>rmic</code> generated stubs if the + * {@link Util#isLocal}, called passing <code>this</code> as parameter, + * returns true. If the method returns null, the requested method is then + * invoked on <code>this</code>. Else it is invoked on the returned object, + * casting it into the interface that the local object implements. In this + * case, the generated stub also later calls + * {@link #_servant_postinvoke(ServantObject)}, passing that returned target + * as parameter. + * + * @param operation the name of the method being invoked. + * @param expectedType the interface that the returned servant + * object must implement. + * + * @throws NO_IMPLEMENT always. If used, the method must be overridden. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public ServantObject _servant_preinvoke(String operation, Class expectedType) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + + /** + * This method is called from <code>rmic</code> generated stubs if the + * {@link Util#isLocal}, called passing <code>this</code> as parameter, + * returns true, and the {@link #_servant_preinvoke} return non-null object. + * The stub then invokes the requrested method on that returned object and + * later calls _servant_postinvoke, passing that returned target as parameter. + * + * @param servant the object that has served as the invocation target for the + * current operation. + */ + public void _servant_postinvoke(ServantObject servant) + { + } + + /** + * Invokes the operation. This method takes the OutputStream that was previously + * returned by a {@link #_request(String)} and returns an InputStream which + * contains the reply. Up till jdk 1.5 inclusive this method is marked as + * unimplemented. + * + * @throws NO_IMPLEMENT always. + */ + public InputStream _invoke(OutputStream output) + throws ApplicationException, RemarshalException + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * While it may look that this should return true, the jdk 1.5 API states + * that it must throw NO_IMPLEMENT instead. The rmi stubs do not call this + * method to check if the object is local; they call {@link Util#isLocal} + * instead (passing <code>this</code> as parameter). + * + * @return never. + * + * @throws NO_IMPLEMENT always. + */ + public boolean _is_local() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public ORB _orb() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public void _releaseReply(InputStream input) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public OutputStream _request(String operation, boolean responseExpected) + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } + + /** + * This method is not appropriate for the local objects and just + * throws an exception. + * + * @throws NO_IMPLEMENT, always. + */ + public boolean validate_connection() + { + throw new NO_IMPLEMENT(INAPPROPRIATE); + } +} diff --git a/libjava/classpath/org/omg/CORBA/LongHolder.java b/libjava/classpath/org/omg/CORBA/LongHolder.java new file mode 100644 index 000000000..db412d969 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/LongHolder.java @@ -0,0 +1,127 @@ +/* LongHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>long long</code> that is mapped into + * java <code>long</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class LongHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_longlong = + new PrimitiveTypeCode(TCKind.tk_longlong); + + /** + * The <code>long</code> (CORBA <code>long long</code>) value, + * held by this LongHolder. + */ + public long value; + + /** + * Constructs an instance of LongHolder, + * initializing {@link #value} to <code>0 </code>. + */ + public LongHolder() + { + } + + /** + * Constructs an instance of LongHolder, + * initializing {@link #value} to the given <code>long</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public LongHolder(long initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>long long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_longlong}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_longlong(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_longlong; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>long long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_longlong(long) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_longlong(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java b/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java new file mode 100644 index 000000000..1ba58d5d3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java @@ -0,0 +1,143 @@ +/* LongLongSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>long</code> + * (<code>LongLongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class LongLongSeqHelper +{ + /** + * Extract the <code>long[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link LongLongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link LongLongSeqHolder}. + */ + public static long[] extract(Any a) + { + LongLongSeqHolder h = (LongLongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>long[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link LongLongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, long[] that) + { + LongLongSeqHolder holder = new LongLongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>long long[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static long[] read(InputStream input) + { + long[] value = new long[ input.read_long() ]; + input.read_longlong_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>LongLongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_long); + } + + /** + * Writes the <code>long[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, long[] value) + { + output.write_long(value.length); + output.write_longlong_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java b/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java new file mode 100644 index 000000000..ebb83cfd0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java @@ -0,0 +1,126 @@ +/* LongLongSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>LongLongSeq</code> that is mapped into + * java <code>long[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class LongLongSeqHolder + implements Streamable +{ + /** + * The <code>long[]</code> (CORBA <code>LongLongSeq</code>) value, + * held by this LongLongSeqHolder. + */ + public long[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_longlong); + + /** + * Constructs an instance of LongLongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public LongLongSeqHolder() + { + } + + /** + * Constructs an instance of LongLongSeqHolder, + * initializing {@link #value} to the given <code>long[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public LongLongSeqHolder(long[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_longlong_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new long[ input.read_long() ]; + input.read_longlong_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_longlong_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_longlong_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/LongSeqHelper.java b/libjava/classpath/org/omg/CORBA/LongSeqHelper.java new file mode 100644 index 000000000..c33611da8 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/LongSeqHelper.java @@ -0,0 +1,143 @@ +/* LongSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>int</code> + * (<code>LongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class LongSeqHelper +{ + /** + * Extract the <code>int[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link LongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link LongSeqHolder}. + */ + public static int[] extract(Any a) + { + LongSeqHolder h = (LongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>int[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link LongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, int[] that) + { + LongSeqHolder holder = new LongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>int[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static int[] read(InputStream input) + { + int[] value = new int[ input.read_long() ]; + input.read_long_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>LongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_long); + } + + /** + * Writes the <code>int[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, int[] value) + { + output.write_long(value.length); + output.write_long_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/LongSeqHolder.java b/libjava/classpath/org/omg/CORBA/LongSeqHolder.java new file mode 100644 index 000000000..8ecf96cc6 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/LongSeqHolder.java @@ -0,0 +1,128 @@ +/* LongSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>LongSeq</code> that is mapped into + * java <code>int[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class LongSeqHolder + implements Streamable +{ + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_long); + + /** + * The <code>int[]</code> (CORBA <code>LongSeq</code>) value, + * held by this LongSeqHolder. + */ + public int[] value; + + /** + * Constructs an instance of LongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public LongSeqHolder() + { + } + + /** + * Constructs an instance of LongSeqHolder, + * initializing {@link #value} to the given <code>int</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public LongSeqHolder(int[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_long_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new int[ input.read_long() ]; + input.read_long_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_long_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_long_array(value, 0, value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + +} diff --git a/libjava/classpath/org/omg/CORBA/MARSHAL.java b/libjava/classpath/org/omg/CORBA/MARSHAL.java new file mode 100644 index 000000000..d5d86db4e --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/MARSHAL.java @@ -0,0 +1,323 @@ +/* MARSHAL.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.CORBA; + +import java.io.Serializable; + +/** + * Means that some request or reply from the network has a wrong size or is + * structurally invalid. In GNU Classpath, this exception may have the following + * minor codes (the high 20 bits being Classpath VMCID): + * + * <table border="1"> + * <tr> + * <th>Hex</th> + * <th>Dec</th> + * <th>Minor</th> + * <th>Name</th> + * <th>Case</th> + * </tr> + * <tr> + * <td>47430001</td> + * <td>1195573249</td> + * <td>1</td> + * <td>Giop</td> + * <td>The message being received is not a GIOP message. It does not start from + * the expected magic sequence byte[] { 'G', 'I', 'O', 'P' }.</td> + * </tr> + * <tr> + * <td>47430002</td> + * <td>1195573250</td> + * <td>2</td> + * <td>Header</td> + * <td>The unexpected IOException while reading or writing the GIOP message + * header or the subsequent request or response header</td> + * </tr> + * <tr> + * <td>47430003</td> + * <td>1195573251</td> + * <td>3</td> + * <td>EOF</td> + * <td>The data stream ended before reading all expected values from it. This + * usually means that the CORBA message is corrupted, but may also indicate that + * the server expects the remote method being invoked to have more or different + * parameters</td> + * </tr> + * <tr> + * <td>47430005</td> + * <td>1195573253</td> + * <td>5</td> + * <td>CDR</td> + * <td>The unexpected IOException while reading or writing the data via Commond + * Data Representation stream</td> + * </tr> + * <tr> + * <td>47430006</td> + * <td>1195573254 </td> + * <td>6</td> + * <td>Value</td> + * <td>The unexpected IOException while reading or writing the Value type. + * </td> + * </tr> + * <tr> + * <td>47430007 </td> + * <td>1195573255</td> + * <td>7</td> + * <td>Forwarding</td> + * <td>The unexpected IOException while handling request forwarding.</td> + * </tr> + * <tr> + * <td>47430008</td> + * <td>1195573256</td> + * <td>8</td> + * <td>Encapsulation </td> + * <td>The unexpected IOException while handling data encapsulation, tagged + * components, tagged profiles, etc.</td> + * </tr> + * <tr> + * <td>47430009</td> + * <td>1195573257</td> + * <td>9 </td> + * <td>Any</td> + * <td>The unexpected IOException while inserting or extracting data to/from + * the Any.</td> + * </tr> + * <tr> + * <td>4743000a</td> + * <td>1195573258 </td> + * <td>10</td> + * <td>UserException</td> + * <td>The unexpected UserException in the context where it cannot be handled + * as such and must be converted to the SystemException. </td> + * </tr> + * <tr> + * <td>4743000b</td> + * <td>1195573259</td> + * <td>11</td> + * <td>Inappropriate</td> + * <td>While the operation could formally be applied to the target, the OMG + * standard states that it is actually not applicable. For example, some CORBA + * objects like POA are always local and should not be passed to or returned + * from the remote side.</td> + * </tr> + * <tr> + * <td>4743000c</td> + * <td>1195573260</td> + * <td>12</td> + * <td>Negative</td> + * <td>When reading data, it was discovered that size of the data structure + * like string, sequence or character is written as the negative number.</td> + * </tr> + * <tr> + * <td>4743000e</td> + * <td>1195573262 </td> + * <td>14</td> + * <td>Graph</td> + * <td>Reference to non-existing node in the data grapth while reading the + * value types.</td> + * </tr> + * <tr> + * <td>4743000f</td> + * <td>1195573263</td> + * <td>15</td> + * <td>Boxed</td> + * <td>Unexpected exception was thrown from the IDL type helper while handling + * the object of this type as a boxed value.</td> + * </tr> + * <tr> + * <td>47430010</td> + * <td>1195573264</td> + * <td>16</td> + * <td>Instantiation</td> + * <td>Unable to instantiate an value type object while reading it from the + * stream.</td> + * </tr> + * <tr> + * <td>47430011</td> + * <td>1195573265</td> + * <td>17</td> + * <td>ValueHeaderTag</td> + * <td>The header tag of the value type being read from the CDR stream contains + * an unexpected value outside 0x7fffff00 .. 0x7fffffff and also not null and + * not an indirection.</td> + * </tr> + * <tr> + * <td>47430012</td> + * <td>1195573266</td> + * <td>18</td> + * <td>ValueHeaderFlags</td> + * <td>The header tag flags of the value type being read from the CDR stream + * make the invalid combination (for instance, 0x7fffff04).</td> + * </tr> + * <tr> + * <td>47430013</td> + * <td>1195573267</td> + * <td>19</td> + * <td>ClassCast</td> + * <td>The value type class, written on the wire, is not compatible with the + * expected class, passed as a parameter to the InputStream.read_value.</td> + * </tr> + * <tr> + * <td>47430014</td> + * <td>1195573268</td> + * <td>20</td> + * <td>Offset</td> + * <td>Positive or otherwise invalid indirection offset when reading the data + * graph of the value type.</td> + * </tr> + * <tr> + * <td>47430015</td> + * <td>1195573269</td> + * <td>21</td> + * <td>Chunks</td> + * <td>Errors while reading the chunked value type.</td> + * </tr> + * <tr> + * <td>47430016</td> + * <td>1195573270</td> + * <td>22</td> + * <td>UnsupportedValue</td> + * <td>No means are provided to read or write this value type (not Streamable, + * not CustomMarshal, not Serializable, no factory, no helper.</td> + * </tr> + * <tr> + * <td>47430017</td> + * <td>1195573271</td> + * <td>23</td> + * <td>Factory</td> + * <td>The value factory, required for the operation being invoked, is not + * registered with this ORB.</td> + * </tr> + * <tr> + * <td>47430018</td> + * <td>1195573272</td> + * <td>24</td> + * + * <td>UnsupportedAddressing</td> + * <td>Unsupported object addressing method in GIOP request header.</td> + * </tr> + * <tr> + * <td>47430019</td> + * <td>1195573273</td> + * <td>25</td> + * <td>IOR</td> + * <td>Invalid object reference (IOR).</td> + * </tr> + * <tr> + * <td>4743001a</td> + * <td>1195573274</td> + * <td>26</td> + * <td>TargetConversion</td> + * <td>Problems with converting between stubs, ties, interfaces and + * implementations.</td> + * + * </tr> + * <tr> + * <td>4743001b</td> + * <td>1195573275</td> + * <td>27</td> + * <td>ValueFields</td> + * <td>Problems with reading or writing the fields of the value type object + * </td> + * </tr> + * <tr> + * <td>4743001c</td> + * <td>1195573276</td> + * <td>28</td> + * <td>NonSerializable</td> + * <td>The instance of the value type, passed using RMI over IIOP, is not + * serializable</td> + * </tr> + * </table> + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class MARSHAL + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 7416408250336395546L; + + /** + * Creates a MARSHAL with the default minor code of 0, completion state + * COMPLETED_NO and the given explaining message. + * + * @param message the explaining message. + */ + public MARSHAL(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates MARSHAL with the default minor code of 0 and a completion state + * COMPLETED_NO. + */ + public MARSHAL() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates a MARSHAL exception with the specified minor code and completion + * status. + * + * @param minor_code additional error code. + * @param is_completed the method completion status. + */ + public MARSHAL(int minor_code, CompletionStatus is_completed) + { + super("", minor_code, is_completed); + } + + /** + * Created MARSHAL exception, providing full information. + * + * @param reason explaining message. + * @param minor_code additional error code (the "minor"). + * @param is_completed the method completion status. + */ + public MARSHAL(String reason, int minor_code, CompletionStatus is_completed) + { + super(reason, minor_code, is_completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/NO_IMPLEMENT.java b/libjava/classpath/org/omg/CORBA/NO_IMPLEMENT.java new file mode 100644 index 000000000..97caa1af0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NO_IMPLEMENT.java @@ -0,0 +1,97 @@ +/* NO_IMPLEMENT.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.CORBA; + +import java.io.Serializable; + +/** + * Means that while the operation being invoked does exists, no + * implementation for it exists. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class NO_IMPLEMENT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 3519190655657192112L; + + /** + * Creates a NO_IMPLEMENT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public NO_IMPLEMENT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_IMPLEMENT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_IMPLEMENT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_IMPLEMENT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public NO_IMPLEMENT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_IMPLEMENT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public NO_IMPLEMENT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/NO_MEMORY.java b/libjava/classpath/org/omg/CORBA/NO_MEMORY.java new file mode 100644 index 000000000..04bf3ff61 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NO_MEMORY.java @@ -0,0 +1,96 @@ +/* NO_MEMORY.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the server has runned out of memory. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class NO_MEMORY + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -4591569617929689285L; + + /** + * Creates a NO_MEMORY with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public NO_MEMORY(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_MEMORY with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_MEMORY() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_MEMORY exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public NO_MEMORY(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_MEMORY exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public NO_MEMORY(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/NO_PERMISSION.java b/libjava/classpath/org/omg/CORBA/NO_PERMISSION.java new file mode 100644 index 000000000..cdce9c820 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NO_PERMISSION.java @@ -0,0 +1,96 @@ +/* NO_PERMISSION.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the caller has no rights to invoke the operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class NO_PERMISSION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1533969523582458479L; + + /** + * Creates a NO_PERMISSION with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public NO_PERMISSION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_PERMISSION with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_PERMISSION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_PERMISSION exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public NO_PERMISSION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_PERMISSION exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public NO_PERMISSION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java b/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java new file mode 100644 index 000000000..a58279fbd --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java @@ -0,0 +1,131 @@ +/* NO_RESOURCES.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the ORB has reached some general resource limitation like maximal + * number of the opened connections. + * + * In GNU Classpath, this exception may have the following minor codes: + * + * <table border="1"> + * <tr> + * <td>Hex</td> + * <td>Dec</td> + * <td>Minor</td> + * <td>Name</td> + * <td>Case</td> + * </tr> + * <tr> + * <td>47430014</td> + * <td>1195573268</td> + * <td>20</td> + * <td>Ports</td> + * <td>No more free ports available for the new objects. The port control, if + * turned on, prevents malicios client from knocking the server out by suddenly + * requiring to allocate a very large number of objects.</td> + * </tr> + * <tr> + * <td>47430015</td> + * <td>1195573269</td> + * <td>21</td> + * <td>Threads</td> + * <td> Too many parallel calls (too many parallel threads). The thread control, + * if turned on, prevents malicios client from knocking the server out by + * suddenly submitting a very large number of requests. </td> + * </tr> + * </table> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NO_RESOURCES + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 8129246118235803597L; + + /** + * Creates a NO_RESOURCES with the default minor code of 0, completion state + * COMPLETED_NO and the given explaining message. + * + * @param message the explaining message. + */ + public NO_RESOURCES(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_RESOURCES with the default minor code of 0 and a completion + * state COMPLETED_NO. + */ + public NO_RESOURCES() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates a NO_RESOURCES exception with the specified minor code and + * completion status. + * + * @param a_minor additional error code. + * @param a_completed the method completion status. + */ + public NO_RESOURCES(int a_minor, CompletionStatus a_completed) + { + super("", a_minor, a_completed); + } + + /** + * Created NO_RESOURCES exception, providing full information. + * + * @param a_reason explaining message. + * @param a_minor additional error code (the "minor"). + * @param a_completed the method completion status. + */ + public NO_RESOURCES(String a_reason, int a_minor, CompletionStatus a_completed) + { + super(a_reason, a_minor, a_completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/NO_RESPONSE.java b/libjava/classpath/org/omg/CORBA/NO_RESPONSE.java new file mode 100644 index 000000000..140a39c9a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NO_RESPONSE.java @@ -0,0 +1,97 @@ +/* NO_RESPONSE.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the client attempts to retrieve the result that is not + * yet available. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class NO_RESPONSE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1971973765161647047L; + + /** + * Creates a NO_RESPONSE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public NO_RESPONSE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_RESPONSE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_RESPONSE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_RESPONSE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public NO_RESPONSE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_RESPONSE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public NO_RESPONSE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/NVList.java b/libjava/classpath/org/omg/CORBA/NVList.java new file mode 100644 index 000000000..f446d6007 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NVList.java @@ -0,0 +1,117 @@ +/* NVList.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.CORBA; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Bounds; +import org.omg.CORBA.NamedValue; + +/** + * The named value list, used to define the parameters in the + * {@link org.omg.CORBA.Request}. This class is also + * used to hold the values of {@link Context}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class NVList +{ + /** + * Create and add a new named value object with null name, + * null value and having given flags. + * @param a_flags the flags, the normally expected values are + * {@link org.omg.CORBA.ARG_IN#value}, + * {@link org.omg.CORBA.ARG_OUT#value} and + * {@link org.omg.CORBA.ARG_INOUT#value} or 0. + * + * @return the created and added value. + */ + public abstract NamedValue add(int a_flags); + + /** + * Create and add the new named value object with the given + * names, given flags and the null value. + * @param a_name the name + * @param a_flags the flags, the normally expected values are + * {@link org.omg.CORBA.ARG_IN#value}, + * {@link org.omg.CORBA.ARG_OUT#value} and + * {@link org.omg.CORBA.ARG_INOUT#value} or 0. + * + * @return the created and added value. + */ + public abstract NamedValue add_item(String a_name, int a_flags); + + /** + * Create and add the named value object with the given name, + * value and flags. + * @param a_name the name + * @param a_value the value + * @param a_flags the flags, the normally expected values are + * {@link org.omg.CORBA.ARG_IN#value}, + * {@link org.omg.CORBA.ARG_OUT#value} and + * {@link org.omg.CORBA.ARG_INOUT#value} or 0. + * + * @return the created object. + */ + public abstract NamedValue add_value(String a_name, Any a_value, int a_flags); + + /** + * Get the number of the present named value pairs. + * + * @return the number of objects in the list. + */ + public abstract int count(); + + /** + * Get the item at the given index + * @param at the index. + * + * @return the item at the index + * @throws Bounds if the index is out of bounds. + */ + public abstract NamedValue item(int at) + throws Bounds; + + /** + * Remove the item at the given index + * @param at the index + * @throws Bounds if the index is out of bounds. + */ + public abstract void remove(int at) + throws Bounds; +} diff --git a/libjava/classpath/org/omg/CORBA/NameValuePair.java b/libjava/classpath/org/omg/CORBA/NameValuePair.java new file mode 100644 index 000000000..a447c6f7b --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NameValuePair.java @@ -0,0 +1,90 @@ +/* NameValuePair.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Holds the value, having the given name(id). This class is used by + * with {@link DynStruct} to name the fields of the record (structure). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameValuePair + implements Serializable, IDLEntity +{ + /** + * The value of the structure record. + */ + public Any value; + + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 7000741877654946223L; + + /** + * The name of the structure record. + */ + public String id; + + /** + * Cretes an unitialised instance of the name-value pair. + */ + public NameValuePair() + { + } + + /** + * Creates the name-value pair, initialising the fields to the passed + * values. + * + * @param an_id the name (also called id) of the name-value pair, normally + * the name of the structure field. + * + * @param a_value the value of the name-value pair. + */ + public NameValuePair(String an_id, Any a_value) + { + id = an_id; + value = a_value; + } +} diff --git a/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java b/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java new file mode 100644 index 000000000..f6d933930 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java @@ -0,0 +1,137 @@ +/* NameValuePairHelper.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.CORBA; + +import gnu.CORBA.DynAn.NameValuePairHolder; +import gnu.CORBA.typecodes.AliasTypeCode; +import gnu.CORBA.typecodes.PrimitiveTypeCode; +import gnu.CORBA.typecodes.StringTypeCode; +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link NameValuePair}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameValuePairHelper +{ + /** + * The {@link NameValuePair} repository id, + * 'IDL:omg.org/CORBA/NameValuePair:1.0'. + */ + private static String _id = "IDL:omg.org/CORBA/NameValuePair:1.0"; + + /** + * Extract the NameValuePair from the given {@link Any}. + */ + public static NameValuePair extract(Any a) + { + try + { + return ((NameValuePairHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected"); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the NameValuePair repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the NameValuePair into the given {@link Any}. + */ + public static void insert(Any a, NameValuePair that) + { + a.insert_Streamable(new NameValuePairHolder(that)); + } + + /** + * Read the NameValuePair from the given CDR stream. First reads the + * name (id) as string, then the value as {@link Any}. + */ + public static NameValuePair read(InputStream istream) + { + NameValuePair p = new NameValuePair(); + p.id = istream.read_string(); + p.value = istream.read_any(); + return p; + } + + /** + * Create the type code for the name value pair. + */ + public static TypeCode type() + { + StructMember[] members = new StructMember[2]; + + TypeCode t_id = new AliasTypeCode(new StringTypeCode(TCKind.tk_string), "", + "id"); + + members[0] = new StructMember("id", t_id, null); + + members[1] = new StructMember("value", + new PrimitiveTypeCode(TCKind.tk_any), null); + + return OrbRestricted.Singleton.create_struct_tc(id(), "NameValuePair", + members); + } + + /** + * Write the exception to the CDR output stream. First writes the + * name (id), then the value as {@link Any}. + */ + public static void write(OutputStream ostream, NameValuePair value) + { + ostream.write_string(value.id); + ostream.write_any(value.value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/NamedValue.java b/libjava/classpath/org/omg/CORBA/NamedValue.java new file mode 100644 index 000000000..492c854b7 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/NamedValue.java @@ -0,0 +1,71 @@ +/* NamedValue.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.CORBA; + +/** + * The class is used to describe a call parameter, having name, + * value and the passing mode flags ({@link ARG_IN}, {@link ARG_OUT} or + * {@link ARG_INOUT}. The same class is also used in {@link Context} to + * pass the property names and values. This class is normally created by + * {@link ORB#create_named_value(String, Any, int)}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class NamedValue +{ + /** + * Get the parameter flags. + * @return normally one of ({@link ARG_IN}, {@link ARG_OUT} or + * {@link ARG_INOUT}). + */ + public abstract int flags(); + + /** + * Get the name of this parameter. + * @return the name of this instance. + */ + public abstract String name(); + + /** + * Get the value of this parameter. The parameter value is wrapped into + * the instance of {@link Any}. + * + * @return the value of this parameter. + */ + public abstract Any value(); +} diff --git a/libjava/classpath/org/omg/CORBA/OBJECT_NOT_EXIST.java b/libjava/classpath/org/omg/CORBA/OBJECT_NOT_EXIST.java new file mode 100644 index 000000000..97ca3197e --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/OBJECT_NOT_EXIST.java @@ -0,0 +1,95 @@ +/* OBJECT_NOT_EXIST.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.CORBA; + +import java.io.Serializable; + +/** + * Means an attempt to perform some operation on a deleted object. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class OBJECT_NOT_EXIST + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 7226958015420512389L; + + /** + * Creates a OBJECT_NOT_EXIST with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public OBJECT_NOT_EXIST(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates OBJECT_NOT_EXIST with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public OBJECT_NOT_EXIST() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a OBJECT_NOT_EXIST exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public OBJECT_NOT_EXIST(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created OBJECT_NOT_EXIST exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public OBJECT_NOT_EXIST(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/OBJ_ADAPTER.java b/libjava/classpath/org/omg/CORBA/OBJ_ADAPTER.java new file mode 100644 index 000000000..8ec07fd4d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/OBJ_ADAPTER.java @@ -0,0 +1,96 @@ +/* OBJ_ADAPTER.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.CORBA; + +import java.io.Serializable; + +/** + * This exception typically indicates an administrative mismatch. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class OBJ_ADAPTER + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1516541344234786928L; + + /** + * Creates a OBJ_ADAPTER with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public OBJ_ADAPTER(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates OBJ_ADAPTER with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public OBJ_ADAPTER() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a OBJ_ADAPTER exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public OBJ_ADAPTER(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created OBJ_ADAPTER exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public OBJ_ADAPTER(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/OMGVMCID.java b/libjava/classpath/org/omg/CORBA/OMGVMCID.java new file mode 100644 index 000000000..127706bf0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/OMGVMCID.java @@ -0,0 +1,72 @@ +/* OMGVMCID.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.CORBA; + +/** + * </p> + * The higher 20 bits of any CORBA exception hold "Vendor Minor Codeset ID" + * (VMCID), for instance 0x4F4D0000 (OMG standard), 0x54410000 (TAO), 0x4A430000 + * (JacORB), 0x49540000 (IONA), 0x53550000 (Sun). + * </p> + * <p> + * GNU Classpath official vendor minor code set id is 0x47430000 ("GC\x00\x00"), + * and the reserved space spans till 0x47430FFF, allowing to use up to 4096 + * Classpath specific exceptions. It was assigned 30/09/2005 by OMG Vice President + * Andrew Watson. + * </p> + * <p> + * The standard minor codes for the standard system exceptions are prefaced by + * the VMCID assigned to OMG, defined as 0x4F4D0000 (the code of the minor field + * for the standard exception with minor code 1 is 0x4F4D0001). Within a vendor + * assigned space, the assignment of values to minor codes is left to the + * vendor. + * </p> + * + * <p> + * The VMCID 0 and 0xFFFFF0000 are reserved for experimental use. + * </p> + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface OMGVMCID +{ + /** + * The OMG vendor minor code ID. + */ + int value = 0x4F4D0000; +} diff --git a/libjava/classpath/org/omg/CORBA/ORB.java b/libjava/classpath/org/omg/CORBA/ORB.java new file mode 100644 index 000000000..d40007d2c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ORB.java @@ -0,0 +1,1247 @@ +/* ORB.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.CORBA; + +import gnu.CORBA.OrbFocused; +import gnu.CORBA.ObjectCreator; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.typecodes.FixedTypeCode; +import gnu.CORBA.typecodes.GeneralTypeCode; +import gnu.CORBA.typecodes.RecordTypeCode; +import gnu.CORBA.typecodes.RecursiveTypeCode; + +import org.omg.CORBA.ORBPackage.InconsistentTypeCode; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; + +import java.applet.Applet; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +import java.util.Properties; + +/** + * A central class in CORBA implementation, responsible for sending and handling + * remote invocations. ORB also works as a factory for creating instances of + * certain CORBA classes. + * + * Despite the core library contains the fully working CORBA implementation, it + * also provides a simple way to plug-in the alternative CORBA support. This is + * done by replacing the ORB. The alternative ORB can be specified via + * properties, passed to ORB.Init(...). + * + * When creating an ORB instance, the class name is searched in the following + * locations: + * <p> + * 1. Applet parameter or application string array, if any.<br> + * 2. The properties parameter, if any.<br> + * 3. The System properties.<br> + * 4. The orb.properties file located in the user.home directory (if any).<br> + * 5. The orb.properties file located in the java.home/lib directory (if any). + * </p> + * + * The supported properties are: <table border="1"> + * <tr> + * <td> org.omg.CORBA.ORBClass</td> + * <td>The class, implementing the functional ORB, returned by + * {@link #init(Applet, Properties)} or {@link #init(String[], Properties)} + * </td> + * </tr> + * <tr> + * <td>org.omg.CORBA.ORBSingletonClass</td> + * <td>The class, implementing the restricted ORB, returned by {@link #init()}. + * </td> + * </tr> + * <tr> + * <td>org.omg.CORBA.ORBInitRef</td> + * <td>Specifies the initial reference, accessible by name with the method + * {@link #resolve_initial_references(String)}.</td> + * </tr> + * <tr> + * <td>org.omg.CORBA.ORBid</td> + * <td>Specifies the name (ORB Id) of this ORB. The ORB Id is later accessible + * by {@link ObjectReferenceTemplate#orb_id}. The default value includes the + * hashcode of the ORB instance that is normally different for each ORB. + * </td> + * </tr> + * <tr> + * <td>org.omg.CORBA.ServerId</td> + * <td>Specifies the name (Server Id) of this server. This property assigns + * value to the <i>static</i> field, ensuring that all ORB's on the same jre + * have the same Server Id. It is normally set as the system property. The + * server Id is later accessible as {@link ObjectReferenceTemplate#server_id}. + * </td> + * </tr> + * <tr> + * <td>gnu.CORBA.ListenerPort</td> + * <td>Specifies that this ORB should serve all its objects on a single port + * (for example, "1234") or on a specified port range (for example, + * "1100-1108"). The property is used when working with firewals and serves as a + * replacement for the proprietary properties like com.ibm.CORBA.ListenerPort + * or com.sun.CORBA.POA.ORBPersistentServerPort. The specified port or range + * should not overlap with the values, specified for other ORB's. + * </td> + * </tr> + * <tr> + * <td>gnu.Corba.SocketFactory</td> + * <td>Sets the user-defined server and client socket factory for the ORB being + * currently instantiated. Serves as a replacement of the proprietary + * property com.sun.CORBA.connection.ORBSocketFactoryClass. To have multiple + * types of sockets, instantiate several ORB's with this property each time + * set to the different value. + * The factory must implement gnu.CORBA.interfaces.SocketFactory. + * </td> + * </tr> + * </table> + * <p>The command line accepts the same properties as a keys. When + * specifying in the command line, the prefix org.omg.CORBA can be omitted, for + * instance<code> -ORBInitRef NameService=IOR:aabbccdd....</code> + * </p> + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ORB +{ + /** + * By default, {@link #init(String[], Properties)} and + * {@link #init(Applet, Properties)} return + * the built-in fully functional ORB is returned. If the + * <code>props</code> contains the property org.omg.CORBA.ORBClass, + * the value of this property is used as a class name to instantiate + * a user-defined ORB. + */ + private static final String FUNCTIONAL_ORB = "org.omg.CORBA.ORBClass"; + + /** + * The name of the restricted ORB property. + */ + private static final String RESTRICTED_ORB = + "org.omg.CORBA.ORBSingletonClass"; + + private static final String LISTENER_PORT = + OrbFocused.LISTENER_PORT; + + /** + * The class, implementing the default fully functional ORB. + */ + private static final String DEFAULT_FUNCTIONAL_ORB = + gnu.CORBA.Poa.ORB_1_4.class.getName(); + + private static final String DEFAULT_FOCUSED_ORB = + gnu.CORBA.OrbFocused.class.getName(); + + // There is no need for name of the default restricted ORB as it is + // singleton and it is more effectively referred directly. + + /** + * Connect the given CORBA object to this ORB. After the object is + * connected, it starts receiving remote invocations via this ORB. + * + * The OMG group recommends to use Portable Object Adapter (POA) instead + * of calling this method. + * + * This method is implemented in the derived Gnu Classpah classes, + * returned by ORB.init(..). In this abstract class, the implementation + * just throws {@link NO_IMPLEMENT}. + * + * @param object the org.omg.CORBA.Object to connect. + */ + public void connect(org.omg.CORBA.Object object) + { + throw new NO_IMPLEMENT(); + } + + /** + * Disconnect the given CORBA object from this ORB. The object will be + * no longer receiving the remote invocations. In response to the + * remote invocation on this object, the ORB will send the + * exception {@link OBJECT_NOT_EXIST}. The object, however, is not + * destroyed and can receive the local invocations. + * + * This method is implemented in the derived Gnu Classpah classes, + * returned by ORB.init(..). In this abstract class, the implementation + * just throws {@link NO_IMPLEMENT}. + * + * @param object the object to disconnect. + */ + public void disconnect(org.omg.CORBA.Object object) + { + throw new NO_IMPLEMENT(); + } + + /** + * Create a typecode, representing a tree-like structure. + * This structure contains a member that is a sequence of the same type, + * as the structure itself. You can imagine as if the folder definition + * contains a variable-length array of the enclosed (nested) folder + * definitions. In this way, it is possible to have a tree like + * structure that can be transferred via CORBA CDR stream. + * + * @deprecated It is easier and clearler to use a combination of + * create_recursive_tc and create_sequence_tc instead. + * + * @param bound the maximal expected number of the nested components + * on each node; 0 if not limited. + * + * @param offset the position of the field in the returned structure + * that contains the sequence of the structures of the same field. + * The members before this field are intialised using parameterless + * StructMember constructor. + * + * @return a typecode, defining a stucture, where a member at the + * <code>offset</code> position defines an array of the identical + * structures. + * + * @see #create_recursive_tc(String) + * @see #create_sequence_tc(int, TypeCode) + */ + public abstract TypeCode create_recursive_sequence_tc(int bound, int offset); + + /** + * Create alias typecode for the given typecode. + */ + public abstract TypeCode create_alias_tc(String id, String name, + TypeCode typecode + ); + + /** + * Create an instance of the CORBA {@link Any} with the type, intialised + * to {@link TCKind#tk_null} + */ + public abstract Any create_any(); + + /** + * Create a typecode, defining an array of the given elements. + * + * @param length the size of array + * @param element_type the array component type. + * + * @return the corresponding typecode. + */ + public abstract TypeCode create_array_tc(int length, TypeCode element_type); + + /** + * Creates an empty CORBA <code>ContextList</code>. + * + * @return the newly created context list. + */ + public abstract ContextList create_context_list(); + + /** + * The support for {@link DynAny} and derived interfaces + * has never been implemented in Sun's java releases, + * at least till v1.4 inclusive. + * + * Since v1.4 this stil missing implementation was replaced + * by the new DynamicAny package. + * + * @deprecated Use {@link org.omg.DynamicAny.DynAnyFactory} + * + * @throws NO_IMPLEMENT, always. + */ + public DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode t) + throws InconsistentTypeCode + { + throw new NO_IMPLEMENT(); + } + + /** + * The support for {@link DynAny} and derived interfaces + * has never been implemented in Sun's java releases, + * at least till v1.4 inclusive. + * + * Since v1.4 this stil missing implementation was replaced + * by the new DynamicAny package. + * + * @deprecated Use {@link org.omg.DynamicAny.DynAnyFactory} + * + * @throws NO_IMPLEMENT, always. + */ + public DynAny create_dyn_any(org.omg.CORBA.Any a) + { + throw new NO_IMPLEMENT(); + } + + /** + * The support for {@link DynArray} + * has never been implemented in Sun's java releases, + * at least till v1.4 inclusive. + * + * Since v1.4 this stil missing implementation was replaced + * by the new DynamicAny package. + * + * @deprecated Use {@link org.omg.DynamicAny.DynAnyFactory} + * + * @throws NO_IMPLEMENT, always. + */ + public DynArray create_dyn_array(org.omg.CORBA.TypeCode t) + throws InconsistentTypeCode + { + throw new NO_IMPLEMENT(); + } + + /** + * The support for {@link DynEnum} + * has never been implemented in Sun's java releases, + * at least till v1.4 inclusive. + * + * Since v1.4 this stil missing implementation was replaced + * by the new DynamicAny package. + * + * @deprecated Use {@link org.omg.DynamicAny.DynAnyFactory} + * + * @throws NO_IMPLEMENT, always. + */ + public DynEnum create_dyn_enum(org.omg.CORBA.TypeCode t) + throws InconsistentTypeCode + { + throw new NO_IMPLEMENT(); + } + + /** + * The support for {@link DynSequence} + * has never been implemented in Sun's java releases, + * at least till v1.4 inclusive. + * + * Since v1.4 this stil missing implementation was replaced + * by the new DynamicAny package. + * + * @deprecated Use {@link org.omg.DynamicAny.DynAnyFactory} + * + * @throws NO_IMPLEMENT, always. + */ + public DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode t) + throws InconsistentTypeCode + { + throw new NO_IMPLEMENT(); + } + + /** + * The support for {@link DynStruct} and derived interfaces + * has never been implemented in Sun's java releases, + * at least till v1.4 inclusive. + * + * Since v1.4 this stil missing implementation was replaced + * by the new DynamicAny package. + * + * @deprecated Use {@link org.omg.DynamicAny.DynAnyFactory} + * + * @throws NO_IMPLEMENT, always. + */ + public DynStruct create_dyn_struct(org.omg.CORBA.TypeCode t) + throws InconsistentTypeCode + { + throw new NO_IMPLEMENT(); + } + + /** + * The support for {@link DynUnion} and derived interfaces + * has never been implemented in Sun's java releases, + * at least till v1.4 inclusive. + * + * Since v1.4 this stil missing implementation was replaced + * by the new DynamicAny package. + * + * @deprecated Use {@link org.omg.DynamicAny.DynAnyFactory} + * + * @throws NO_IMPLEMENT, always. + */ + public DynUnion create_dyn_union(org.omg.CORBA.TypeCode t) + throws InconsistentTypeCode + { + throw new NO_IMPLEMENT(); + } + + /** + * Create a typecode, defining the given enumeration. + * + * @param id the id. + * @param name the name. + * @param members the memebers + * @return the created enumeration. + */ + public abstract TypeCode create_enum_tc(String id, String name, + String[] members + ); + + /** + * Create an environment (container for exceptions). + * + * @return the created container. + */ + public abstract Environment create_environment(); + + /** + * Creates an empty exception list. + * + * @return the newly created list. + */ + public abstract ExceptionList create_exception_list(); + + /** + * Create the exception typecode. + * + * @param id the id of exception. + * @param name the name of exception. + * @param members the members of exception. + */ + public abstract TypeCode create_exception_tc(String id, String name, + StructMember[] members + ); + + /** + * Creates a TypeCode object for CORBA <code>fixed</code> that is + * mapped to java {@link java.math.BigDecimal}. + * + * @param digits the number of digits in that <code>fixed</code>. + * @param scale the number of digits after the decimal point. + * + * @return the corresponding TypeCode. + */ + public TypeCode create_fixed_tc(short digits, short scale) + { + FixedTypeCode r = new FixedTypeCode(); + r.setDigits(digits); + r.setScale(scale); + return r; + } + + /** + * Creates a typecode, representing the IDL interface. + * + * @param id the interface repository id. + * @param name the interface name. + * + * @return the created typecode. + */ + public abstract TypeCode create_interface_tc(String id, String name); + + /** + * Create an instance of a new {@link NVList}. + * + * @param count the initial size of the list. If more elements are added, + * the list automatically expands. + * + * @return the created list. + */ + public abstract NVList create_list(int count); + + /** + * Create a new named value. + * + * @param name the name of the named value + * @param any the content of the named value. + * @param flags the flags of the named value + * + * @return the named value. + */ + public abstract NamedValue create_named_value(String name, Any any, int flags); + + /** + * Send multiple prepared requests one way, do not caring about the answer. + * The messages, containing requests, will be marked, indicating that + * the sender is not expecting to get a reply. + * + * @param requests the prepared array of requests. + * + * @see Request#send_oneway() + */ + public abstract void send_multiple_requests_oneway(Request[] requests); + + /** + * Send multiple prepared requests expecting to get a reply. All requests + * are send in parallel, each in its own separate thread. When the + * reply arrives, it is stored in the agreed fields of the corresponing + * request data structure. If this method is called repeatedly, + * the new requests are added to the set of the currently sent requests, + * but the old set is not discarded. + * + * @param requests the prepared array of requests. + * + * @see #poll_next_response() + * @see #get_next_response() + * @see Request#send_deferred() + */ + public abstract void send_multiple_requests_deferred(Request[] requests); + + /** + * Find if any of the requests that have been previously sent with + * {@link #send_multiple_requests_deferred}, have a response yet. + * + * @return true if there is at least one response to the previously + * sent request, false otherwise. + */ + public abstract boolean poll_next_response(); + + /** + * Get the next instance with a response being received. If all currently + * sent responses not yet processed, this method pauses till at least one of + * them is complete. If there are no requests currently sent, the method + * pauses till some request is submitted and the response is received. + * This strategy is identical to the one accepted by Suns 1.4 ORB + * implementation. + * + * @return the previously sent request that now contains the received + * response. + * + * @throws WrongTransaction If the method was called from the transaction + * scope different than the one, used to send the request. The exception + * can be raised only if the request is implicitly associated with some + * particular transaction. + */ + public abstract Request get_next_response() + throws WrongTransaction; + + /** + * Create a new CDR output stream, where the parameter values can be written + * during the method invocation. + * + * @return a stream to write values into. + */ + public abstract org.omg.CORBA.portable.OutputStream create_output_stream(); + + /** + * This should create the list, initialised with the argument descriptions + * for the given operation definition (CORBA <code>OperationDef</code>). + * The information should be obtained from the interface repository. + * However this method is oficially documented as not implemented at least + * till v1.4 inclusive. + * + * @param operation_definition the operation definition, must be + * CORBA <code>OperationDef</code>. + * + * @return never + * + * @throws NO_IMPLEMENT, always. + */ + public NVList create_operation_list(Object operation_definition) + { + throw new NO_IMPLEMENT(); + } + + /** + * <p>Creates the new policy of the specified type, having the given value. + * This method looks for the policy factory that was previously registered + * during ORB initialization by + * {@link org.omg.PortableInterceptor#ORBInitialiser}. + * + * If the suitable factory is found, this factory creates the requested policy, + * otherwise the PolicyError is thrown. + * </p><p> + * The POA policies should be created by POA, not by this method. + * </p> + * @param type the policy type. + * @param value the policy value, wrapped into Any. + * + * @throws PolicyError if the ORB fails to instantiate the policy object. + * + * @throws NO_IMPLEMENT always (in this class). Overridden in derived classes + * returned by ORB.init(..). + * + * @see org.omg.PortableInterceptor.ORBInitInfoOperations#register_policy_factory + * @see org.omg.PortableInterceptor.PolicyFactoryOperations + */ + public Policy create_policy(int type, Any value) + throws PolicyError + { + throw new NO_IMPLEMENT(); + } + + /** + * Create typecode, defining the sequence of the elements, having + * the given type. + * + * @param bound the maximal length of the sequence, 0 if not restricted. + * + * @param element_type the sequence element type. + * + * @return the typecode. + */ + public abstract TypeCode create_sequence_tc(int bound, TypeCode element_type); + + /** + * Create a TypeCode, representing the CORBA <code>string</code>. + * + * @param bound the maximal length of the string, 0 is unlimited. + * + * @return the corresponding string typecode. + */ + public abstract TypeCode create_string_tc(int bound); + + /** + * Create the typecode, defining the given IDL structure. + * + * The TypeCode object is initialized with the given id, name, and members. + * @param id the Id of this type. + * @param name the name of this type. + * @param members the member list. + * + * @return the typecode. + */ + public abstract TypeCode create_struct_tc(String id, String name, + StructMember[] members + ); + + /** + * Create the typecode, defining the given IDL union. + * + * The TypeCode object is initialized with the given id, name, discriminator + * and members. + * + * @param id the Id of this type. + * @param name the name of this type. + * @param discriminator the union discriminator. + * @param members the member list. + * + * @return the typecode. + */ + public abstract TypeCode create_union_tc(String id, String name, + TypeCode discriminator, + UnionMember[] members + ); + + /** + * Create a TypeCode, representing the CORBA <code>wstring</code>. + * + * @param bound the maximal length of the string, 0 is unlimited. + * + * @return the corresponding string typecode. + */ + public abstract TypeCode create_wstring_tc(int bound); + + /** + * Create a typecode for an abstract interface. The abstract interface + * can be either CORBA object or CORBA value type. + * + * @param id the id of the abstract interface. + * @param name the name of the abstract interface. + * + * @return the created typecode. + */ + public TypeCode create_abstract_interface_tc(String id, String name) + { + GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_abstract_interface); + t.setName(name); + t.setId(id); + return t; + } + + /** + * Create a typecode for a native interface. + * + * @param id the id of the native interface. + * @param name the name of the native interface. + * + * @return the created typecode. + */ + public TypeCode create_native_tc(String id, String name) + { + GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_native); + t.setName(name); + t.setId(id); + return t; + } + + + /** + * Create a typecode which serves as a placeholder for typcode, containing + * recursion. + * + * @param id the id of the recursive typecode, for that this typecode + * serves as a placeholder. + */ + public TypeCode create_recursive_tc(String id) + { + return new RecursiveTypeCode(id); + } + + /** + * Create value box typecode. + */ + public TypeCode create_value_box_tc(String id, String name, + TypeCode boxed_type + ) + { + GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_value_box); + t.setName(name); + t.setId(id); + t.setContentType(boxed_type); + return t; + } + + /** + * Create IDL value type code. + */ + public TypeCode create_value_tc(String id, String name, short type_modifier, + TypeCode concrete_base, ValueMember[] members + ) + { + RecordTypeCode r = new RecordTypeCode(TCKind.tk_value); + r.setId(id); + r.setName(name); + r.setTypeModifier(type_modifier); + r.setConcreteBase_type(concrete_base); + + for (int i = 0; i < members.length; i++) + { + r.add(members [ i ]); + } + + return r; + } + + /** + * This should return the information, related to the current thread. + * The information is needed, for instance, to get the current object + * from the code that serves several objects in parallel threads. + * The {@link Current} is very general interface, with no fields and + * operations defined. This method is not implemented in Suns + * releases at least till v1.5 inclusive. To obtain the + * {@link org.omg.PortableServer.Current}, use + * {@link #resolve_initial_references}, passing "POACurrent". + * + * @deprecated since 1.2, use {@link #resolve_initial_references}. + * + * @return never + * + * @throws NO_IMPLEMENT always. + */ + public Current get_current() + { + throw new NO_IMPLEMENT(); + } + + /** + * This should return the information about the CORBA facilities and + * services, available from this ORB. However this method is oficially + * documented as not implemented at least till v1.5 inclusive. + * + * @param service_type a type of the service being requested. The OMG + * specification currently defines only one value, 1, for security + * related services. + * + * @param service_info a holder, where the returned information should + * be stored. + * + * @return should return true if the service information is available + * from the ORB, but this method never returns. + * + * @throws NO_IMPLEMENT always. + */ + public boolean get_service_information(short service_type, + ServiceInformationHolder service_info + ) + { + throw new NO_IMPLEMENT(); + } + + /** + * Get the default context of this ORB. This is an initial root of all + * contexts. + * + * The default method returns a new context with the empty name and + * no parent context. + * + * @return the default context of this ORB. + * + * @throws NO_IMPLEMENT for the Singleton ORB, returned by + * the parameterless {@link #init()}. + */ + public abstract Context get_default_context(); + + /** + * Return thg typecode, representing the given primitive object type. + * + * @param tcKind the kind of the primitive typecode. + * + * @return the typecode of the primitve typecode. + */ + public abstract TypeCode get_primitive_tc(TCKind tcKind); + + /** + * Returns so-called Singleton ORB, a highly restricted version + * that cannot communicate over network. This ORB is provided + * for the potentially malicious applets with heavy security restrictions. + * + * The returned Singleton ORB can only create typecodes, + * {@link Any}, {@link ContextList}, {@link NVList} and + * {@link org.omg.CORBA.portable.OutputStream} that writes to an + * internal buffer. + * + * All other methods throw the {@link NO_IMPLEMENT} exception, additionally + * printing the error message about the potential attempt to violate + * the security rules. + * + * The implementing ORB class, used in this method, is found as described + * in the header. + * + * @return the working derivative of ORB, implementing the methods + * of this abstract class. + */ + public static ORB init() + { + String orb_cn = getCumulatedProperty(null, RESTRICTED_ORB); + if (orb_cn == null) + return OrbRestricted.Singleton; + else + return createORB(null, orb_cn); + } + + /** + * Creates the working instance of ORB for an applet. + * + * By default the built-in fully functional ORB is returned. The ORB class + * is found as described in the header of this class. + * + * @param applet the applet. The property org.omg.CORBA.ORBClass, + * if present, defines the used ORB implementation class. If this + * property is not present, the ORB class is found as described in the + * class header. + * + * @param props the properties, may be <code>null</code>. + * + * @return a newly created functional derivative of this abstract class. + */ + public static ORB init(Applet applet, Properties props) + { + String ocn = applet.getParameter(FUNCTIONAL_ORB); + String lp = applet.getParameter(LISTENER_PORT); + + if (ocn==null && lp!=null) + ocn = DEFAULT_FOCUSED_ORB; + + ORB orb = createORB(props, ocn); + orb.set_parameters(applet, props); + + return orb; + } + + /** + * Creates the working instance of ORB for a standalone application. + * + * By default the built-in fully functional ORB is returned. The ORB class is + * found as described in the header of this class. + * + * @param args the parameters, passed to the applications + * <code>main(String[] args)</code> method, may be <code>null</code>. The + * parameter -org.omg.CORBA.ORBClass <class name> if present, defines the used + * ORB implementation class. If this property is not present, the ORB class is + * found as described in the class header. + * + * @param props application specific properties, may be <code>null</code>. + * + * @return a newly created functional derivative of this abstract class. + */ + public static ORB init(String[] args, Properties props) + { + String ocn = null; + String lp = null; + + String orbKey = "-" + FUNCTIONAL_ORB; + String lpKey = "-" + LISTENER_PORT; + + if (args != null) + if (args.length >= 2) + { + for (int i = 0; i < args.length - 1; i++) + { + if (args[i].equals(orbKey)) + ocn = args[i + 1]; + if (args[i].equals(lpKey)) + lp = args[i + 1]; + } + } + + if (lp != null && ocn == null) + ocn = DEFAULT_FOCUSED_ORB; + + ORB orb = createORB(props, ocn); + + orb.set_parameters(args, props); + return orb; + } + + /** + * List the initially available CORBA objects (services). + * + * @return a list of services. + * + * @see #resolve_initial_references(String) + */ + public abstract String[] list_initial_services(); + + /** + * Find and return the easily accessible CORBA object, addressed + * by name. The returned object is typically casted to the more + * specific reference using the <code>narrow(Object)</code> method + * of its helper. The method resolves the following string values, + * returning the working objects: + * <table border="1"><tr><th>String</th><th>Object class</th> + * <th>Object use</th></tr> + * + * <tr><td>NameService</td><td>{@link org.omg.CosNaming.NamingContextExt}</td> + * <td>Finds (usually remote) object by its name.</td></tr> + * + * <tr><td>RootPOA</td><td>{@link org.omg.PortableServer.POA}</td> + * <td>Holds the POA tree for this ORB, where since 1.4 all servants + * should be connected.</td></tr> + * + * <tr><td>RootPOAManager</td><td>{@link org.omg.PortableServer.POAManager} + * </td><td>Regulates (suspends/resumes) the root POA + * activity</td></tr> + * + * <tr><td>POACurrent</td><td>{@link org.omg.PortableServer.Current} + * </td><td>Informs the current thread about the Id and POA of the + * object being currently served (the methods of + * <code>Current</code> return different values for + * different threads). + * </td></tr> + * + * <tr><td>CodecFactory</td><td>{@link org.omg.IOP.Codec}</td> + * <td>Encodes/decodes IDL data types into/from byte arrays.</td> + * </tr> + * + * <tr><td>DynAnyFactory</td><td>{@link org.omg.DynamicAny.DynAnyFactory}</td> + * <td>Creates DynAny's.</td> + * </tr> + * + * <tr><td>PICurrent</td><td>{@link org.omg.PortableInterceptor.Current}</td> + * <td>Contains multiple slots where an interceptor can rememeber the + * request - specific values between subsequent + * calls of the interceptor methods.</td> + * </tr> + * + * </table> + * + * @param name the object name. + * @return the object + * @throws org.omg.CORBA.ORBPackage.InvalidName if the given name + * is not associated with the known object. + */ + public abstract Object resolve_initial_references(String name) + throws org.omg.CORBA.ORBPackage.InvalidName; + + /** + * Get the IOR reference string for the given object. + * IOR can be compared with the Internet address for a web page, + * it provides means to locate the CORBA service on the web. + * IOR contains the host address, port number, the object identifier + * (key) inside the server, the communication protocol version, + * supported charsets and so on. + * + * @param forObject the CORBA object + * @return the object IOR representation. + * @see #string_to_object(String) + */ + public abstract String object_to_string(Object forObject); + + /** + * This should perform the implementation dependent unit of work in the + * main thread. + * + * This method is part of the support for the distribute use of the + * single execution thread. + * + * Same as in Suns releases at least till 1.4 inclusive, + * the distribute use of the single thread is not implemented. + * Use multiple threads, provided by jre. + * + * The method returns without action. + */ + public void perform_work() + { + } + + /** + * Checks if the ORB needs the main thread to perform some work. + * The method should return true if the ORB needs the main thread, + * and false if it does not. + * + * This method is part of the support for the distribute use of the + * single execution thread. + * + * Same as in Suns releases at least till 1.4 inclusive, + * the distributed use of the single thread is not implemented. + * Use multiple threads, provided by jre. + * + * @return false, always. + */ + public boolean work_pending() + { + return false; + } + + /** + * <p>Find and return the CORBA object, addressed by the given + * string representation. The object can be (an usually is) + * located on a remote computer, possibly running a different + * (not necessary java) CORBA implementation. The returned + * object is typically casted to the more specific reference + * using the <code>narrow(Object)</code> method of its helper. + * </p><p> + * This function supports the following input formats:<br> + * 1. IOR reference (<b>ior:</b>nnnnn ..), usually computer generated.<br> + * 2. <b>corbaloc:</b>[<b>iiop</b>][version.subversion<b>@</b>]<b>:</b>host[<b>:</b>port]<b>/</b><i>key</i> + * defines similar information as IOR reference, but is more human readable. + * This type of reference may also contain multiple addresses (see + * OMG documentation for complete format).<br> + * 3. <b>corbaloc:rir:/</b><i>name</i> defines internal reference on this + * ORB that is resolved using {@link #resolve_initial_references}, passing + * the given <i>name</i> as parameter.<br> + * 4. <b>corbaname:rir:#</b><i>name</i> states that the given <i>name</i> + * must be resolved using the naming service, default for this ORB.<br> + * 5. <b>corbaname:</b>[<b>iiop</b>][version.subversion<b>@</b>]<b>:</b>host[<b>:</b>port]<b>#</b><i>name</i> + * states that the <i>name</i> must be resolved using the naming service + * that runs on the given host at the given port. The ORB expects to find + * there the {@link org.omg.CosNaming.NamingContext} under the key + * "NameService.<br> + * 7. file://[file name] Read the object definition string from the + * file system<br> + * 8. http://[url] Read the object definition string from the provided + * url.<br> + * 9. ftp://[url] Read the object definition string from the provided + * url.<br> + * + * <p>The default port is always 2809. The default iiop version is 1.0 + * that now may not always be supported, so we would recommend to specify + * the version explicitly.</p> + * <p> + * The examples of the corbaloc and corbaname addresses:<br> + * corbaname:rir:#xobj - ask local naming service for "xobj".<br> + * corbaname:rir:/NameService#xobj - same (long form).<br> + * corbaname:iiop:1.2@localhost:900#xobj - same, assuming that the naming + * service runs at port 900 on the local host and supports iiop 1.2.<br> + * corbaname:iiop:localhost#xobj - same, assuming that the naming + * service runs at port 2809 on the local host and supports iiop 1.0.<br> + * corbaloc::gnu.xxx.yy/Prod/TradingService - the object exists on the + * host gnu.xxx.yy, port 2809 having the key "Prod/TradingService". Its ORB + * supports iiop 1.0.<br> + * corbaloc::gnu.xxx.yy/Prod/TradingService:801 - the object exists on the + * host gnu.xxx.yy, port 801 having the key "Prod/TradingService". Its ORB + * supports iiop 1.0 (iiop keyword ommitted).<br> + * corbaloc:iiop:1.1@gnu.xxx.yy/Prod/TradingService - the object exists on the + * host gnu.xxx.yy, port 801 having the key "Prod/TradingService". Its ORB + * supports iiop 1.1.<br> + * corbaloc:rir:/NameService - the default naming service. + * + * @param IOR the object IOR representation string. + * + * @return the found CORBA object. + * + * @throws BAD_PARAM if the string being parsed is invalid. + * @throws DATA_CONVERSION if the string being parsed contains unsupported + * prefix or protocol. + * + * @see #object_to_string(org.omg.CORBA.Object) + */ + public abstract Object string_to_object(String IOR); + + /** + * Start listening on the input socket. This method + * blocks the current thread until {@link #shutdown(boolean)} + * is called and shutdown process is completed. + */ + public void run() + { + } + + /** + * Shutdown the ORB server. + * + * @param wait_for_completion if true, the current thread is + * suspended untile the shutdown process is complete. + */ + public void shutdown(boolean wait_for_completion) + { + } + + /** + * Destroy this server, releasing the occupied resources. + * The default method returns without action. + */ + public void destroy() + { + } + + /** + * Set the ORB parameters. This method is normally called from + * {@link #init(String[], Properties)}. + * + * @param para the parameters, that were passed as the parameters + * to the <code>main(String[] args)</code> method of the current standalone + * application. + * + * @param props application specific properties that were passed + * as a second parameter in {@link #init(String[], Properties)}). + * Can be <code>null</code>. + */ + protected abstract void set_parameters(String[] para, Properties props); + + /** + * Set the ORB parameters. This method is normally called from + * {@link #init(Applet, Properties)}. + * + * @param app the current applet. + * + * @param props application specific properties, passed as the second + * parameter in {@link #init(Applet, Properties)}. + * Can be <code>null</code>. + */ + protected abstract void set_parameters(Applet app, Properties props); + + /** + * Get the property with the given name, searching in the standard + * places for the ORB properties. + */ + private static String getCumulatedProperty(Properties props, String property) + { + String orb_cn = null; + + if (props != null) + orb_cn = props.getProperty(property, null); + + if (orb_cn == null) + orb_cn = System.getProperty(property, null); + + if (orb_cn == null) + orb_cn = checkFile(property, "user.home", null); + + if (orb_cn == null) + orb_cn = checkFile(property, "java.home", "lib"); + + return orb_cn; + } + + /** + * Check if the property is defined in the existsting file orb.properties. + * + * @param property the property + * @param dir the system property, defining the folder where the + * file could be expected. + * @param subdir subfolder where to look for the file. + * + * @return the property value, null if not found or file does not exist. + */ + private static String checkFile(String property, String dir, String subdir) + { + try + { + File f = new File(dir); + if (!f.exists()) + return null; + + if (subdir != null) + f = new File(f, subdir); + + f = new File(f, "orb.properties"); + + if (!f.exists()) + return null; + + Properties p = new Properties(); + p.load(new BufferedInputStream(new FileInputStream(f))); + + return p.getProperty(property, null); + } + catch (IOException ex) + { + return null; + } + } + + /** + * Create ORB when its name is possibly known. + * + * @param props properties, possibly containing the ORB name. + * @param orbClassName the direct ORB class name, overriding other possible + * locations, or null if not specified. + */ + private static ORB createORB(Properties props, String orbClassName) + { + ORB orb = null; + + if (orbClassName == null) + { + orbClassName = getCumulatedProperty(props, FUNCTIONAL_ORB); + + if (orbClassName == null) + { + String lp = getCumulatedProperty(props, LISTENER_PORT); + if (lp != null) + orbClassName = DEFAULT_FOCUSED_ORB; + else + orbClassName = DEFAULT_FUNCTIONAL_ORB; + } + } + + try + { + orb = (ORB) ObjectCreator.forName(orbClassName).newInstance(); + } + catch (ClassNotFoundException ex) + { + noORB(orbClassName, ex); + } + catch (IllegalAccessException ex) + { + noORB(orbClassName, ex); + } + catch (InstantiationException ex) + { + noORB(orbClassName, ex); + } + + return orb; + } + + /** + * Throw the runtime exception. + * + * @param orb_c the ORB class name. + * @param why the explaining chained exception. + */ + private static void noORB(String orb_c, Throwable why) + { + throw new RuntimeException("The ORB " + orb_c + " cannot be instantiated.", + why + ); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java b/libjava/classpath/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java new file mode 100644 index 000000000..7bb6a702a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java @@ -0,0 +1,79 @@ +/* InconsistentTypeCode.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.CORBA.ORBPackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The exception is thrown + * in response of the attempt to create the dynamic + * with an unmatching type code. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class InconsistentTypeCode + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = -4393472660722667060L; + + /** + * Constructs a the exception. + */ + public InconsistentTypeCode() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + public InconsistentTypeCode(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ORBPackage/InvalidName.java b/libjava/classpath/org/omg/CORBA/ORBPackage/InvalidName.java new file mode 100644 index 000000000..5594015cd --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ORBPackage/InvalidName.java @@ -0,0 +1,79 @@ +/* InvalidName.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.CORBA.ORBPackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The exception is thrown by + * {@link org.omg.CORBA.ORB#resolve_initial_references(String)} + * in response of passing a name for + * which there is no initial reference. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class InvalidName + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = 6635923991559230168L; + + /** + * Constructs a the exception. + */ + public InvalidName() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + public InvalidName(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ORBPackage/package.html b/libjava/classpath/org/omg/CORBA/ORBPackage/package.html new file mode 100644 index 000000000..b0711261d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ORBPackage/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.sql package. + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA.ORBPackage</title></head> + +<body> +<p>Provides a couple of exceptions, thrown by methods in the {@link org.omg.CORBA.ORB} class.</p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/CORBA/Object.java b/libjava/classpath/org/omg/CORBA/Object.java new file mode 100644 index 000000000..997fab9e8 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Object.java @@ -0,0 +1,191 @@ +/* Object.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.CORBA; + +/** + * The CORBA object reference. The object can be either local or remote. + * For the local object, the methods of the derived object are called + * like on any other java object. For the remote object, the reference + * points to the stup (proxy), responsible for the remote invocation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface Object +{ + /** + * Create a request to invoke the method of this object. + * + * @param context a list of additional properties. + * @param operation the name of method to be invoked. + * @param parameters the method parameters. + * @param returns the container for tge method returned value. + * + * @return the created reaquest. + */ + Request _create_request(Context context, String operation, NVList parameters, + NamedValue returns + ); + + /** + * Create a request to invoke the method of this object, specifying + * context list and the list of the expected exception. + * + * @param context a list of additional properties. + * @param operation the name of method to be invoked. + * @param parameters the method parameters. + * @param returns the container for tge method returned value. + * @param exceptions the list of the possible exceptions that the method + * can throw. + * @param ctx_list the list of the context strings that need to be + * resolved and send as a context instance. + * + * @return the created reaquest. + */ + Request _create_request(Context context, String operation, NVList parameters, + NamedValue returns, ExceptionList exceptions, + ContextList ctx_list + ); + + /** + * Duplicate the object reference. This does not make much sense for + * java platform and is just included for the sake of compliance with + * CORBA APIs. + * + * The method may return the object reference itself. + * + * @return as a rule, <code>this</code>. + */ + org.omg.CORBA.Object _duplicate(); + + /** + * Retrieve the domain managers for this object. + * + * @return the domain managers. + */ + DomainManager[] _get_domain_managers(); + + /** + * Get the <code>InterfaceDef</code> for this Object. + */ + org.omg.CORBA.Object _get_interface_def(); + + /** + * Returns the {@link Policy}, applying to this object. + * + * @param a_policy_type a type of policy to be obtained. + * @return a corresponding Policy object. + * + * @throws BAD_PARAM if the policy of the given type is not + * associated with this object, or if it is not supported by this ORB. + */ + Policy _get_policy(int a_policy_type) + throws BAD_PARAM; + + /** + * Get the hashcode this object reference. The same hashcode still + * does not means that the references are the same. From the other + * side, two different references may still refer to the same CORBA + * object. The returned value must not change during the object + * lifetime. + * + * @param maximum the maximal value to return. + * + * @return the hashcode. + */ + int _hash(int maximum); + + /** + * Check if this object can be referenced by the given repository id. + * + * @param repositoryIdentifer the repository id. + * + * @return true if the passed parameter is a repository id of this + * CORBA object. + */ + boolean _is_a(String repositoryIdentifer); + + /** + * Return true if the other object references are equivalent, so far as + * it is possible to determine this easily. + * + * @param other the other object reference. + * + * @return true if both references refer the same object, false + * if they probably can refer different objects. + */ + boolean _is_equivalent(org.omg.CORBA.Object other); + + /** + * Determines if the server object for this reference has already + * been destroyed. + * + * @return true if the object has been destroyed, false otherwise. + */ + boolean _non_existent(); + + /** + * Free resoureces, occupied by this reference. The object implementation + * is not notified, and the other references to the same object are not + * affected. + */ + void _release(); + + /** + * Create a request to invoke the method of this CORBA object. + * + * @param operation the name of the method to invoke. + * + * @return the request. + */ + Request _request(String operation); + + /** + * Returns a new object with the new policies either replacing or + * extending the current policies, depending on the second parameter. + * + * @param policies the policy additions or replacements. + * + * @param how either {@link SetOverrideType#SET_OVERRIDE} to override the + * current policies of {@link SetOverrideType#ADD_OVERRIDE} to replace + * them. + * + * @return the new reference with the changed policies. + */ + Object _set_policy_override(Policy[] policies, SetOverrideType how); +} diff --git a/libjava/classpath/org/omg/CORBA/ObjectHelper.java b/libjava/classpath/org/omg/CORBA/ObjectHelper.java new file mode 100644 index 000000000..fd1211ade --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ObjectHelper.java @@ -0,0 +1,111 @@ +/* ObjectHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the binding list. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectHelper +{ + /** + * Extract the array of object from the given {@link Any}. + */ + public static org.omg.CORBA.Object extract(Any a) + { + try + { + return ((ObjectHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("CORBA object expected"); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the object repository id. + * @return the empty string. + */ + public static String id() + { + return ""; + } + + /** + * Insert the object into the given {@link Any}. + */ + public static void insert(Any a, org.omg.CORBA.Object object) + { + a.insert_Streamable(new ObjectHolder(object)); + } + + /** + * Read the object from the given CDR input stream. + */ + public static org.omg.CORBA.Object read(InputStream istream) + { + return istream.read_Object(); + } + + /** + * Return the object type code. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_objref); + } + + /** + * Write the object into the given CDR output stream. + */ + public static void write(OutputStream ostream, org.omg.CORBA.Object value) + { + ostream.write_Object(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ObjectHolder.java b/libjava/classpath/org/omg/CORBA/ObjectHolder.java new file mode 100644 index 000000000..65eaeae9a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ObjectHolder.java @@ -0,0 +1,133 @@ +/* ObjectHolder.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.CORBA; + +import gnu.CORBA.typecodes.RecordTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>Object</code> that is mapped into + * java <code>org.omg.CORBA.Object</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ObjectHolder + implements Streamable +{ + /** + * The default type code for this holder if the object type code with + * the zero length string as id. + */ + private static final RecordTypeCode t_object; + + static + { + t_object = new RecordTypeCode(TCKind.tk_objref); + t_object.setId(""); + } + + /** + * The <code>org.omg.CORBA.Object</code> (CORBA <code>Object</code>) value, + * held by this ObjectHolder. + */ + public org.omg.CORBA.Object value; + + /** + * Constructs an instance of ObjectHolder, + * initializing {@link #value} to <code>0</code>. + */ + public ObjectHolder() + { + } + + /** + * Constructs an instance of ObjectHolder, + * initializing {@link #value} to the given <code>org.omg.CORBA.Object</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ObjectHolder(org.omg.CORBA.Object initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>org.omg.CORBA.Object</code>, the + * functionality is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_Object()}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_Object(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return ObjectHelper.type(); + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>Object</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_Object(Object) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_Object(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java b/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java new file mode 100644 index 000000000..e03dba073 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java @@ -0,0 +1,143 @@ +/* OctetSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>byte</code> + * (<code>OctetSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class OctetSeqHelper +{ + /** + * Extract the <code>byte[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link OctetSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link OctetSeqHolder}. + */ + public static byte[] extract(Any a) + { + OctetSeqHolder h = (OctetSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>byte[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link OctetSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, byte[] that) + { + OctetSeqHolder holder = new OctetSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>byte[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static byte[] read(InputStream input) + { + byte[] value = new byte[ input.read_long() ]; + input.read_octet_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>OctetSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_octet); + } + + /** + * Writes the <code>byte[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, byte[] value) + { + output.write_long(value.length); + output.write_octet_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java b/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java new file mode 100644 index 000000000..8c3e9cb6d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java @@ -0,0 +1,126 @@ +/* OctetSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>OctetSeq</code> that is mapped into + * java <code>byte[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class OctetSeqHolder + implements Streamable +{ + /** + * The <code>byte[]</code> (CORBA <code>OctetSeq</code>) value, + * held by this OctetSeqHolder. + */ + public byte[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_octet); + + /** + * Constructs an instance of OctetSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public OctetSeqHolder() + { + } + + /** + * Constructs an instance of OctetSeqHolder, + * initializing {@link #value} to the given <code>byte[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public OctetSeqHolder(byte[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_octet_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new byte[ input.read_long() ]; + input.read_octet_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_octet_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_octet_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java b/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java new file mode 100644 index 000000000..99acf543b --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java @@ -0,0 +1,96 @@ +/* PERSIST_STORE.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.CORBA; + +import java.io.Serializable; + +/** + * Indicates a persistent storage failure like database crash. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class PERSIST_STORE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -6835478548864681965L; + + /** + * Creates a PERSIST_STORE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public PERSIST_STORE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates PERSIST_STORE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public PERSIST_STORE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a PERSIST_STORE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public PERSIST_STORE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created PERSIST_STORE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public PERSIST_STORE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PRIVATE_MEMBER.java b/libjava/classpath/org/omg/CORBA/PRIVATE_MEMBER.java new file mode 100644 index 000000000..0c055dc46 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PRIVATE_MEMBER.java @@ -0,0 +1,55 @@ +/* PRIVATE_MEMBER.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.CORBA; + +/** + * One of the two constants, defining the visibility scope of + * the {@link ValueMember}. The other constant is + * {@link PUBLIC_MEMBER}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see ValueMember#access + */ +public interface PRIVATE_MEMBER +{ + /** + * The flag, specifying that the value member is private. + */ + short value = 0; +} diff --git a/libjava/classpath/org/omg/CORBA/PUBLIC_MEMBER.java b/libjava/classpath/org/omg/CORBA/PUBLIC_MEMBER.java new file mode 100644 index 000000000..9008f7f7a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PUBLIC_MEMBER.java @@ -0,0 +1,55 @@ +/* PUBLIC_MEMBER.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.CORBA; + +/** + * One of the two constants, defining the visibility scope of + * the {@link ValueMember}. The other constant is + * {@link PRIVATE_MEMBER}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see ValueMember#access + */ +public interface PUBLIC_MEMBER +{ + /** + * The flag, specifying that the value member is public. + */ + short value = 1; +} diff --git a/libjava/classpath/org/omg/CORBA/ParameterMode.java b/libjava/classpath/org/omg/CORBA/ParameterMode.java new file mode 100644 index 000000000..cdda82547 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ParameterMode.java @@ -0,0 +1,142 @@ +/* ParameterMode.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines the parameter modes (the ways in that a method parameter + * is used during invocation). + * + * In CORBA, a method parameter can pass the value (PARAM_IN), + * be used as a placeholder to return the value (PARAM_OUT) or + * both pass the data and be used as a placeholder to return the + * changed value (PARAM_INOUT). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ParameterMode + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 1521598391932998229L; + + /** + * This value means that the parameter is an IN parameter. + */ + public static final int _PARAM_IN = 0; + + /** + * This value means that the parameter is an OUT parameter. + */ + public static final int _PARAM_OUT = 1; + + /** + * This value means that the parameter is an INOUT parameter. + */ + public static final int _PARAM_INOUT = 2; + + /** + * This value means that the parameter is an IN parameter. + */ + public static final ParameterMode PARAM_IN = new ParameterMode(_PARAM_IN); + + /** + * This value means that the parameter is an OUT parameter. + */ + public static final ParameterMode PARAM_OUT = new ParameterMode(_PARAM_OUT); + + /** + * This value means that the parameter is an INOUT parameter. + */ + public static final ParameterMode PARAM_INOUT = new ParameterMode(_PARAM_INOUT); + + /** + * The value of this parameter mode instance. + */ + private final int value; + + /** + * The conversion table. + */ + private static final ParameterMode[] table = + new ParameterMode[] { PARAM_IN, PARAM_OUT, PARAM_INOUT }; + + /** + * Create an instance of the parameter mode with the given value. + */ + protected ParameterMode(int a_value) + { + value = a_value; + } + + /** + * Return the integer value code for the given parameter mode. + * + * @return 0 for PARAM_IN, 1 for PARAM_OUT, 3 for PARAM_INOUT. + */ + public int value() + { + return value; + } + + /** + * Get a parameter mode instance for the integer parameter mode code. + * + * @param p_mode a parameter mode (0..2). + * + * @return a corresponding parameter mode instance. + * + * @throws BAD_PARAM for the invalid parameter mode code. + */ + public static ParameterMode from_int(int p_mode) + { + try + { + return table [ p_mode ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + throw new BAD_PARAM("Invalid parameter mode: " + p_mode); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java b/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java new file mode 100644 index 000000000..c0948d4b7 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java @@ -0,0 +1,116 @@ +/* ParameterModeHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for a method parameter modes. + * A method parameter can pass the value (PARAM_IN), be used as a placeholder + * to return the value (PARAM_OUT) or both pass the data and be used as a + * placeholder to return the changed value (PARAM_INOUT). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ParameterModeHelper +{ + /** + * Insert the parameter mode into the given Any. + */ + public static void insert(Any any, ParameterMode that) + { + any.insert_Streamable(new ParameterModeHolder(that)); + } + + /** + * Extract the parameter mode from the given Any. + */ + public static ParameterMode extract(Any any) + { + return ((ParameterModeHolder) any.extract_Streamable()).value; + } + + /** + * Get the parameter mode typecode (enumeration, named "ParameterMode"). + * The typecode states that the enumeration can obtain one of + * the following values: PARAM_IN ,PARAM_OUT ,PARAM_INOUT . + */ + public static TypeCode type() + { + String[] members = + new String[] { "PARAM_IN", "PARAM_OUT", "PARAM_INOUT" }; + + return + OrbRestricted.Singleton.create_enum_tc(id(), "ParameterMode", members); + } + + /** + * Get the parameter mode repository id. + * + * @return "IDL:omg.org/CORBA/ParameterMode:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/ParameterMode:1.0"; + } + + /** + * Read the enumeration value (as int) from the CDR intput stream. + * + * @param istream a stream to read from. + */ + public static ParameterMode read(InputStream istream) + { + return ParameterMode.from_int(istream.read_long()); + } + + /** + * Write the enumeration value (as int) to the CDR output stream. + * + * @param ostream a stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream ostream, ParameterMode value) + { + ostream.write_long(value.value()); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ParameterModeHolder.java b/libjava/classpath/org/omg/CORBA/ParameterModeHolder.java new file mode 100644 index 000000000..b6dc8fae7 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ParameterModeHolder.java @@ -0,0 +1,93 @@ +/* ParameterModeHolder.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.CORBA; + +/** + * The holder for ParameterMode. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ParameterModeHolder + implements org.omg.CORBA.portable.Streamable +{ + /** + * The stored ParameterMode value. + */ + public ParameterMode value; + + /** + * Create the uninitialised instance. + */ + public ParameterModeHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue + */ + public ParameterModeHolder(ParameterMode initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + */ + public void _read(org.omg.CORBA.portable.InputStream in) + { + value = ParameterModeHelper.read(in); + } + + /** + * Get the typecode of the ParameterMode. + */ + public org.omg.CORBA.TypeCode _type() + { + return ParameterModeHelper.type(); + } + + /** + * Write the stored value into the CDR stream. + */ + public void _write(org.omg.CORBA.portable.OutputStream out) + { + ParameterModeHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/Policy.java b/libjava/classpath/org/omg/CORBA/Policy.java new file mode 100644 index 000000000..b1fae60bf --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Policy.java @@ -0,0 +1,55 @@ +/* Policy.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.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The interfaces derived from the class allow an ORB or CORBA service + * access to certain choices (id assignment, threading model and so on) + * that affect they operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface Policy + extends IDLEntity, Object, Serializable, PolicyOperations +{ +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyError.java b/libjava/classpath/org/omg/CORBA/PolicyError.java new file mode 100644 index 000000000..98d6079d8 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyError.java @@ -0,0 +1,104 @@ +/* PolicyError.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The exception is thrown when a policy error occurs. + * A PolicyError exception may include one of the following error reason codes: + * {@link BAD_POLICY}, {@link BAD_POLICY_TYPE}, + * {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY}, + * {@link UNSUPPORTED_POLICY_VALUE}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class PolicyError + extends UserException + implements IDLEntity, Serializable +{ + /** + * Holds the exception reason code, one of + * {@link BAD_POLICY}, {@link BAD_POLICY_TYPE}, + * {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY}, + * {@link UNSUPPORTED_POLICY_VALUE}. + */ + public short reason; + + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -9196809779974700103L; + + /** + * Constructs an uninitialised instance of the policy error. + */ + public PolicyError() + { + } + + /** + * Constructs the policy error with the given reason code. + * @param a_reason a reason code, one of + * {@link BAD_POLICY}, {@link BAD_POLICY_TYPE}, + * {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY}, + * {@link UNSUPPORTED_POLICY_VALUE}. + */ + public PolicyError(short a_reason) + { + reason = a_reason; + } + + /** + * Constructs the policy error with the given reason code and the + * detailed message. + * @param a_details the detailed message. + * @param a_reason a reason code, one of + * {@link BAD_POLICY}, {@link BAD_POLICY_TYPE}, + * {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY}, + * {@link UNSUPPORTED_POLICY_VALUE}. + */ + public PolicyError(String a_details, short a_reason) + { + super(a_details); + reason = a_reason; + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java b/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java new file mode 100644 index 000000000..75709e801 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java @@ -0,0 +1,115 @@ +/* PolicyErrorCodeHelper.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; +import gnu.CORBA.typecodes.RecordTypeCode; + +import org.omg.CORBA.Any; +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 policy error code as an alias of + * <code>short</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class PolicyErrorCodeHelper + +{ + + /** + * Delegates call to {@link Any#extract_short()}. + */ + public static short extract(Any a) + { + return a.extract_short(); + } + + /** + * Returns policy error code repository id. + * + * @return "IDL:omg.org/CORBA/PolicyErrorCode:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/PolicyErrorCode:1.0"; + } + + /** + * Delegates call to {@link Any#insert_short(short)}. + */ + public static void insert(Any a, short that) + { + a.insert_short(that); + } + + /** + * Delegates call to {@link InputStream#read_short()}. + */ + public static short read(InputStream istream) + { + return istream.read_short(); + } + + /** + * Returns a typecode of the policy error code, stating it is an alias of + * <code>short</code>, named "PolicyErrorCode". + * + * @return a typecode of synchronization scope. + */ + public static TypeCode type() + { + RecordTypeCode r = new RecordTypeCode(TCKind.tk_alias); + r.setName("PolicyErrorCode"); + r.setId(id()); + r.setContentType(new PrimitiveTypeCode(TCKind.tk_short)); + return r; + } + + /** + * Delegates call to {@link OutputStream#write_short(short)}. + */ + public static void write(OutputStream ostream, short value) + { + ostream.write_short(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java b/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java new file mode 100644 index 000000000..4d949fae4 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java @@ -0,0 +1,150 @@ +/* PolicyErrorHelper.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.CORBA; + +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; + +/** +* The helper operations for the exception {@link PolicyError}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class PolicyErrorHelper +{ + /** + * Create the PolicyError typecode. The typecode defines a structure, named + * "PolicyError", containing the PolicyErrorCode (alias int, see + * {@link PolicyErrorCodeHelper}) field, named "reason". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 1 ]; + + TypeCode field; + + field = + orb.create_alias_tc("IDL:omg.org/CORBA/PolicyErrorCode:1.0", + "PolicyErrorCode", orb.get_primitive_tc(TCKind.tk_short) + ); + members [ 0 ] = new StructMember("reason", field, null); + return orb.create_exception_tc(id(), "PolicyError", members); + } + + /** + * Insert the PolicyError into the given Any. + * This method uses the PolicyErrorHolder. + * + * @param any the Any to insert into. + * @param that the PolicyError to insert. + */ + public static void insert(Any any, PolicyError that) + { + any.insert_Streamable(new PolicyErrorHolder(that)); + } + + /** + * Extract the PolicyError from given Any. + * This method uses the PolicyErrorHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain PolicyError. + */ + public static PolicyError extract(Any any) + { + try + { + return ((PolicyErrorHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("PolicyError expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the PolicyError repository id. + * + * @return "IDL:omg.org/CORBA/PolicyError:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/PolicyError:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static PolicyError read(InputStream input) + { + // Read the exception repository id. + input.read_string(); + PolicyError value = new PolicyError(); + + value.reason = input.read_short(); + 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, PolicyError value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_short(value.reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java b/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java new file mode 100644 index 000000000..c3e8e8237 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java @@ -0,0 +1,103 @@ +/* PolicyErrorHolder.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.CORBA; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the exception {@link PolicyError}. + +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class PolicyErrorHolder implements Streamable +{ + /** + * The stored PolicyError value. + */ + public PolicyError value; + + /** + * Create the uninitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public PolicyErrorHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public PolicyErrorHolder(PolicyError 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 = PolicyErrorHelper.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) + { + PolicyErrorHelper.write(output, value); + } + + /** + * Get the typecode of the PolicyError. + */ + public TypeCode _type() + { + return PolicyErrorHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyHelper.java b/libjava/classpath/org/omg/CORBA/PolicyHelper.java new file mode 100644 index 000000000..eb4332f64 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyHelper.java @@ -0,0 +1,159 @@ +/* PolicyHelper.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.CORBA; + +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.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the +* CORBA object {@link Policy}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class PolicyHelper +{ + /** + * Get the type code of the {@link Policy}. + * + * @return interface typecode, named "Policy". + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "Policy"); + } + + /** + * Insert the Policy into the given Any. + * + * @param any the Any to insert into. + * @param that the Policy to insert. + */ + public static void insert(Any any, Policy that) + { + any.insert_Streamable(new PolicyHolder(that)); + } + + /** + * Extract the Policy from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain Policy. + */ + public static Policy extract(Any any) + { + try + { + PolicyHolder h = (PolicyHolder) any.extract_Streamable(); + return h.value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Policy expected"); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the Policy repository id. + * + * @return "IDL:omg.org/CORBA/Policy:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/Policy:1.0"; + } + + /** + * Cast the passed object into the Policy. If the + * object has a different java type, create an instance + * of the _PolicyStub, using the same delegate, as for + * the passed parameter. Hence, unlike java type cast, + * this method may return a different object, than has been passed. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a Policy. + */ + public static Policy narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof Policy) + return (Policy) obj; + else + { + // Check for the policy id cannot be performed because + // this helper must read various subclasses of the Policy, + // and the IOR profile currently supports only one id. + + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _PolicyStub(delegate); + } + } + + /** + * Read the object from the CDR intput stream (IOR profile expected). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static Policy read(InputStream input) + { + return narrow(input.read_Object()); + } + + /** + * Write the object to the CDR output stream (as IOR profile). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, Policy value) + { + output.write_Object(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyHolder.java b/libjava/classpath/org/omg/CORBA/PolicyHolder.java new file mode 100644 index 000000000..cc2cfcfe2 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyHolder.java @@ -0,0 +1,106 @@ +/* PolicyHolder.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.CORBA; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the object {@link Policy}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class PolicyHolder + implements Streamable +{ + /** + * The stored Policy value. + */ + public Policy value; + + /** + * Create the uninitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public PolicyHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public PolicyHolder(Policy initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + * Delegates work to {@link PolicyHelper}. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = PolicyHelper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * Delegates work to {@link PolicyHelper}. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + PolicyHelper.write(output, value); + } + + /** + * Get the typecode of the Policy. + * Delegates work to {@link PolicyHelper}. + */ + public org.omg.CORBA.TypeCode _type() + { + return PolicyHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyListHelper.java b/libjava/classpath/org/omg/CORBA/PolicyListHelper.java new file mode 100644 index 000000000..c3ca36369 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyListHelper.java @@ -0,0 +1,139 @@ +/* PolicyListHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the +* CORBA object {@link Policy}[]. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class PolicyListHelper +{ + /** + * Get the type code of the {@link Policy}[]. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "Policy[]"); + } + + /** + * Insert the Policy[] into the given Any. + * + * @param any the Any to insert into. + * @param that the Policy[] to insert. + */ + public static void insert(Any any, Policy[] that) + { + any.insert_Streamable(new PolicyListHolder(that)); + } + + /** + * Extract the Policy[] from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain Policy[]. + */ + public static Policy[] extract(Any any) + { + try + { + PolicyListHolder holds = (PolicyListHolder) any.extract_Streamable(); + return holds.value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Policy[] expected"); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the Policy[] repository id. + * + * @return "IDL:omg.org/CORBA/PolicyList:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/PolicyList:1.0"; + } + + /** + * Read the sequence of policies from the CDR intput stream. + * The method follows usual CDR standards (an array length as + * CORBA long, followed by the array members, if any). + * The array members are read using {@link PolicyHelper}. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static Policy[] read(InputStream input) + { + Policy[] p = new Policy[ input.read_long() ]; + for (int i = 0; i < p.length; i++) + { + p [ i ] = PolicyHelper.read(input); + } + return p; + } + + /** + * Write the sequence of policies from the CDR intput stream. + * The method follows usual CDR standards (an array length as + * CORBA long, followed by the array members, if any). + * The array members are written using {@link PolicyHelper}. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a policy array to write. + */ + public static void write(OutputStream output, Policy[] value) + { + output.write_long(value.length); + for (int i = 0; i < value.length; i++) + { + PolicyHelper.write(output, value [ i ]); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyListHolder.java b/libjava/classpath/org/omg/CORBA/PolicyListHolder.java new file mode 100644 index 000000000..fd3815afa --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyListHolder.java @@ -0,0 +1,106 @@ +/* PolicyListHolder.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.CORBA; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the object <code>Policy[]</code>. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class PolicyListHolder + implements Streamable +{ + /** + * The stored Policy[] value. + */ + public Policy[] value; + + /** + * Create the uninitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public PolicyListHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public PolicyListHolder(Policy[] initialValue) + { + value = initialValue; + } + + /** + * Fill in the {@link #value} by data from the CDR stream. + * Uses {@link PolicyListHelper}. + * + * @param input the org.omg.CORBA.portable stream to read. + */ + public void _read(InputStream input) + { + value = PolicyListHelper.read(input); + } + + /** + * Write the stored value into the CDR stream. + * Uses {@link PolicyListHelper}. + * + * @param output the org.omg.CORBA.portable stream to write. + */ + public void _write(OutputStream output) + { + PolicyListHelper.write(output, value); + } + + /** + * Get the typecode of the Policy[]. + * Uses {@link PolicyListHelper}. + */ + public org.omg.CORBA.TypeCode _type() + { + return PolicyListHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyOperations.java b/libjava/classpath/org/omg/CORBA/PolicyOperations.java new file mode 100644 index 000000000..141eb1cba --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyOperations.java @@ -0,0 +1,70 @@ +/* PolicyOperation.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.CORBA; + +/** + * Defines the operations that can be applied to the {@link Policy} + * object. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface PolicyOperations +{ + /** + * Return a copy of this Policy. + * + * @return a copy of theis Policy, without any retained relationships + * to the previous domain or object. + */ + Policy copy(); + + /** + * Destroy the policy object. + */ + void destroy(); + + /** + * Return an integer number, corresponding the type of this policy. + * The values, defining the different policy types, are allocated + * by OMG (request AT omg DOT org). + * + * @return the integer policy code. + */ + int policy_type(); +} diff --git a/libjava/classpath/org/omg/CORBA/PolicyTypeHelper.java b/libjava/classpath/org/omg/CORBA/PolicyTypeHelper.java new file mode 100644 index 000000000..dc92d7707 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PolicyTypeHelper.java @@ -0,0 +1,123 @@ +/* PolicyTypeHelper.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.CORBA; + +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 the policy type. A policy type 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 would be {@link ORB}, having the PolicyType type. These parameters +* are declarded as <coe>int</code> in the ORB interface. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class PolicyTypeHelper +{ + /** + * Create the PolicyType typecode (alias of CORBA ulong, named "PolicyType". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "PolicyType", + 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/CORBA/PolicyType:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/PolicyType:1.0"; + } + + /** + * Read the int (policy type) 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 int (policy type) 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/CORBA/Principal.java b/libjava/classpath/org/omg/CORBA/Principal.java new file mode 100644 index 000000000..9832f228d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Principal.java @@ -0,0 +1,89 @@ +/* Principal.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.CORBA; + +/** + * This class was used to store the client identity in the past. + * The client identity is stored in the form of the <code>byte</code> + * array. + * + * @deprecated by CORBA 2.2. + * + * @author Audrius Meskauskas(AudriusA@Bioinformatics.org) + * + */ +public class Principal +{ + /** + * The field, holding the client identity. + */ + private byte[] m_name; + + /** + * @deprecated + */ + public Principal() + { + } + + /** + * Gets the name of the Principal. + * + * @deprecated by CORBA 2.2 + * + * @return a name of the Pricipal. + */ + public byte[] name() + { + /**@todo Override this org.omg.CORBA.Principal method*/ + return m_name; + } + + /** + * Sets the name of the Principal to the given value. + * + * @deprecated by CORBA 2.2 + * + * @param a_name a value to set the name to. + */ + public void name(byte[] a_name) + { + m_name = a_name; + } +} diff --git a/libjava/classpath/org/omg/CORBA/PrincipalHolder.java b/libjava/classpath/org/omg/CORBA/PrincipalHolder.java new file mode 100644 index 000000000..56cd565aa --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/PrincipalHolder.java @@ -0,0 +1,122 @@ +/* PrincipalHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for storing an instance of {@link Principal}. + * + * @deprecated by CORBA 2.2. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class PrincipalHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_any = + new PrimitiveTypeCode(TCKind.tk_Principal); + + /** + * The instance of {@link Principal}, held by this holder. + */ + public Principal value; + + /** + * Constructs an instance of PrincipalHolder, + * initializing {@link #value} to <code>null</code>. + */ + public PrincipalHolder() + { + } + + /** + * Constructs an instance of PrincipalHolder, + * initializing {@link #value} to the passed parameter. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public PrincipalHolder(Principal initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For {@link Principal}, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_Principal}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_Principal(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_any; + } + + /** + * Write the {@link #value } field to the given stream. + * For {@link Principal} the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_Principal(Principal)} + * . + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_Principal(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/REBIND.java b/libjava/classpath/org/omg/CORBA/REBIND.java new file mode 100644 index 000000000..48a3ea42f --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/REBIND.java @@ -0,0 +1,99 @@ +/* REBIND.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.CORBA; + +import java.io.Serializable; + +/** + * Raised on the failure of the requested or implied attempt to + * rebind an object reference. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class REBIND + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = 823920851143467547L; + + /** + * Creates REBIND with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public REBIND(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates REBIND with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public REBIND() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a REBIND exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public REBIND(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created REBIND exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public REBIND(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java b/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java new file mode 100644 index 000000000..843958b22 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java @@ -0,0 +1,116 @@ +/* RepositoryIdHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A formal helper for the CORBA Repository Id that is identical to the + * narrow string. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class RepositoryIdHelper +{ + /** + * Insert the Repository Id into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the Repository Id from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an string alias typecode, named "RepositoryId" + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "RepositoryId", orb.create_string_tc(0)); + } + + /** + * Return the Repository Id repository id. + * @return "IDL:omg.org/CORBA/RepositoryId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/RepositoryId:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param istream the stream to read from. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param ostream the stream to write into. + * @param value the string (Repository Id) value to write. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/Request.java b/libjava/classpath/org/omg/CORBA/Request.java new file mode 100644 index 000000000..cca242d6c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/Request.java @@ -0,0 +1,242 @@ +/* Request.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.CORBA; + + +/** + * An object, containing the information, needed to invoke the method of + * the local or remote CORBA object. The Request is used in + * Dynamic Invocation Interface (DII) which allows dynamic creation of + * requests. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class Request +{ + /** + * Add the named input parameter that passes value to + * the method being invoked. This is similar to the "passing by value" + * conception. + * + * The created parameter is returned allowing to set the value. + * + * @return the created parameter. + */ + public abstract Any add_in_arg(); + + /** + * Add the input/output parameter that passes value both to and from + * the method being invoked. This is similar to the "passing by reference" + * conception. + * + * The created parameter is returned allowing to set the value. + * + * @return the created parameter. + */ + public abstract Any add_inout_arg(); + + /** + * Add the named input parameter that passes value to + * the method being invoked. This is similar to the "passing by value" + * conception. + * + * The created parameter is returned allowing to set the value. + * + * @param name the parameter name. + * + * @return the created parameter. + */ + public abstract Any add_named_in_arg(String name); + + /** + * Add the named input/output parameter that passes value both to and from + * the method being invoked. This is similar to the "passing by reference" + * conception. + * + * The created parameter is returned allowing to set the value. + * + * @param name the parameter name. + * + * @return the created parameter. + */ + public abstract Any add_named_inout_arg(String name); + + /** + * Add the named output parameter that passes value from + * the method being invoked. Differently from the java + * language, the CORBA IDL method can return multiple values. + * + * The created parameter is returned allowing to set the value. + * + * @param name the parameter name. + * + * @return the created parameter. + */ + public abstract Any add_named_out_arg(String name); + + /** + * Add the output parameter that passes value from + * the method being invoked. Differently from the java + * language, the CORBA IDL method can return multiple values. + * + * The created parameter is returned allowing to set the value. + * + * @return the created parameter. + */ + public abstract Any add_out_arg(); + + /** + * Return the list of all previously added parameters. + * + * @return the list of parameters. + */ + public abstract NVList arguments(); + + /** + * Get the context list object for this request. + * + * @return a list of strings that must be resolved and sent with the + * invocation. + */ + public abstract ContextList contexts(); + + /** + * Get the context, previously set using {@link #ctx(Context)}. + * The context contains the details about this request. + */ + public abstract Context ctx(); + + /** + * Set the context that shuld be later returned by {@link #ctx()}. + * This context contains the details about this request. + * + * @param a_context a context to set. + */ + public abstract void ctx(Context a_context); + + /** + * Returns the container, eclosing an exception that the invoked method + * has thrown. + * + * @return the Environment object, containng the exception. + */ + public abstract Environment env(); + + /** + * List the exceptions that may be thrown by the CORBA object method being + * invoked. + * + * @return the list of exceptions. + */ + public abstract ExceptionList exceptions(); + + /** + * Allow to access the response that has been previously sent using + * {@link #send_deferred()}. + * + * @throws WrongTransaction if the transaction scope mismatches. + */ + public abstract void get_response() + throws WrongTransaction; + + /** + * Submit the request, suspending the current thread until the + * answer is received. + */ + public abstract void invoke(); + + /** + * Get the name of the method being invoked. + * + * @return the name of the method being invoked. + */ + public abstract String operation(); + + /** + * Check if the response is received to the request that was + * previously send using {@link #send_deferred()}. + * + * @return true if the response has been already received, false otherwise. + */ + public abstract boolean poll_response(); + + /** + * Get the value, returned by the method, together with its name. + * + * @return the value, returned by the method. + */ + public abstract NamedValue result(); + + /** + * Get the value, returned by the method. + * + * @return the value, returned by the method. + */ + public abstract Any return_value(); + + /** + * Send a request without suspending the current thread. + * + * Allow later check of the request status by {@link #poll_response()} and + * retrieving the results by {@link #get_response()}. + */ + public abstract void send_deferred(); + + /** + * Send a request and forget about it, not waiting for a response. + * This can be done also for methods that normally are expected + * to return some values. + */ + public abstract void send_oneway(); + + /** + * Set the return type. + * + * @param returns the type of the value, returned in response to this + * request. + */ + public abstract void set_return_type(TypeCode returns); + + /** + * Return the CORBA object on that the method would be invoked. + * + * @return the invocation target. + */ + public abstract org.omg.CORBA.Object target(); +} diff --git a/libjava/classpath/org/omg/CORBA/ServerRequest.java b/libjava/classpath/org/omg/CORBA/ServerRequest.java new file mode 100644 index 000000000..38bb9fe90 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ServerRequest.java @@ -0,0 +1,164 @@ +/* ServerRequest.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.CORBA; + +/** + * This class was expected to be part of the dynamic skeleton interface, + * but it is almost never used in the code, generated by IDL to java compiler. + * The recent tendention is to skip the request step, reading the method + * arguments from the CDR input stream directly. The supplementing class + * {@link DynamicImplementation} has already been deprecated in java 1.2 + * version. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ServerRequest +{ + /** + * Get the context information. + */ + public abstract Context ctx(); + + /** + * Should return the name of the operation (method) being invoked. + * Following the 1.4 specification, it does not, and must be overridden to + * get functionality. + * + * @return the name of the operation being invoked. The object attribute + * access operations are called _get_<attribute_name> + * and _set_<attribute_name>. + * + * @throws NO_IMPLEMENT, always. + */ + public String operation() + { + throw new NO_IMPLEMENT(); + } + + /** + * Should specify the method parameter types and retrieve the + * values that must be passed to the method being called. Following + * the 1.4 specification, it does not, and must be overridden to + * get functionality. + * + * @param args the method parameters. + * + * @throws NO_IMPLEMENT, always. + */ + public void arguments(NVList args) + { + throw new NO_IMPLEMENT(); + } + + /** + * Should specify the return value for the call. Following + * the 1.4 specification, it does not, and must be overridden to + * get functionality. + * + * @param result the return value. + * + * @throws NO_IMPLEMENT, always. + */ + public void set_result(Any result) + { + throw new NO_IMPLEMENT(); + } + + /** + * Should set the exception that has been thrown during + * the method invocation. Following the 1.4 specification, it does not, + * and must be overridden to get functionality. + * + * @param exc the Any, holding the exception. + * + * @throws NO_IMPLEMENT, always. + */ + public void set_exception(Any exc) + { + throw new NO_IMPLEMENT(); + } + + /** + * This method is deprecated, {@link #set_result} (same parameter). + * + * @deprecated since 1.2 + * + * @throws NO_IMPLEMENT, always. + */ + public void result(Any r) + { + throw new NO_IMPLEMENT(); + } + + /** + * This method is deprecated, use {@link #set_exception} (same parameter). + * + * @deprecated since 1.2. + * + * @throws NO_IMPLEMENT, always. + */ + public void except(Any exc) + { + throw new NO_IMPLEMENT(); + } + + /** + * This method is deprecated, use {@link #arguments} (same parameter). + * + * @deprecated since 1.2 + * + * @throws NO_IMPLEMENT, always. + */ + public void params(NVList args) + { + throw new NO_IMPLEMENT(); + } + + /** + * This method is deprecated, use {@link #operation} (same parameter). + * + * @deprecated since 1.2 + * + * @throws NO_IMPLEMENT, always. + */ + public String op_name() + { + throw new NO_IMPLEMENT(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ServiceDetail.java b/libjava/classpath/org/omg/CORBA/ServiceDetail.java new file mode 100644 index 000000000..a709f7cf0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ServiceDetail.java @@ -0,0 +1,81 @@ +/* ServiceDetail.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * An object, representing one of the additional details about the + * particular ORB service. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ServiceDetail + implements IDLEntity +{ + /** + * The type of the information, defined by this detail. + */ + public int service_detail_type; + + /** + * The binary data, defining the information. + */ + public byte[] service_detail; + + /** + * Create an unitialised instance. + */ + public ServiceDetail() + { + } + + /** + * Create the instance of the service detail, initialising its fields + * to the given values. + * + * @param _service_detail_type the service detail type. + * @param _service_detail the service detail. + */ + public ServiceDetail(int _service_detail_type, byte[] _service_detail) + { + service_detail_type = _service_detail_type; + service_detail = _service_detail; + } +} diff --git a/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java new file mode 100644 index 000000000..4c17a99ce --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java @@ -0,0 +1,169 @@ +/* ServiceDetailHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.ServiceDetailHolder; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations on the Service Detail. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ServiceDetailHelper +{ + /** + * The service detail repository id. + */ + private static String _id = "IDL:omg.org/CORBA/ServiceDetail:1.0"; + + /** + * Extract the service detail info from the given {@link Any} + * + * @param a the Any to extract from. + * + * @return the extracted detail. + * + * @throws BAD_OPERATION if the parameter holds something different + * from the ServiceDetail. + */ + public static ServiceDetail extract(Any a) + { + try + { + return ((ServiceDetailHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the service detail repository id. + * + * @return the service detail repository id, + * <code>IDL:omg.org/CORBA/ServiceDetail:1.0</code>, always. + */ + public static String id() + { + return _id; + } + + /** + * Insert the service detail into the given {@link Any}. + * + * @param a the Any to insert into. + * + * @param that the detail to insert. + */ + public static void insert(Any a, ServiceDetail that) + { + a.insert_Streamable(new ServiceDetailHolder(that)); + } + + /** + * Read the service detail information from the given CDR + * intput stream. First reads the type, then the flexible + * length byte sequence. + * + * @param istream a stram to read from. + * + * @return the loaded service detail. + */ + public static ServiceDetail read(InputStream istream) + { + ServiceDetail value = new ServiceDetail(); + value.service_detail_type = istream.read_ulong(); + + int l = istream.read_long(); + value.service_detail = new byte[ l ]; + istream.read_octet_array(value.service_detail, 0, l); + return value; + } + + /** + * Get the typecode of the service detail, assuming to be it + * a structure with the two fields. + * + * @return the newly created or cached typecode value. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + + StructMember[] members = new StructMember[ 2 ]; + + TypeCode type = + orb.create_alias_tc(_id, "ServiceDetailType", + orb.get_primitive_tc(TCKind.tk_ulong) + ); + members [ 0 ] = new StructMember("service_detail_type", type, null); + + TypeCode data = + orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_octet)); + members [ 1 ] = new StructMember("service_detail", data, null); + + return orb.create_struct_tc(id(), "ServiceDetail", members); + } + + /** + * Write the service detail data to the given CDR output stream. + * Writes the detail type first, then the detail type data + * as the variable length byte sequence. + * + * @param ostream a stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream ostream, ServiceDetail value) + { + ostream.write_ulong(value.service_detail_type); + ostream.write_long(value.service_detail.length); + ostream.write_octet_array(value.service_detail, 0, + value.service_detail.length + ); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ServiceInformation.java b/libjava/classpath/org/omg/CORBA/ServiceInformation.java new file mode 100644 index 000000000..c4ec7f1da --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ServiceInformation.java @@ -0,0 +1,88 @@ +/* ServiceInformation.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Stores information about the CORBA service, available from some ORB. + * + * This class is part of the service information support, but the + * 1.4 API specification states that this support should be not implemented. + * + * @see ORB#get_service_information + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ServiceInformation + implements IDLEntity +{ + /** + * The array of service details, defining the various aspects of this + * service. + */ + public ServiceDetail[] service_details; + + /** + * The array, defining various options of this service. + */ + public int[] service_options; + + /** + * Create an unitialised instance of the service information. + */ + public ServiceInformation() + { + } + + /** + * Create an instance of the service information, intialised with + * the passed values. + * + * @param _service_options the service options. + * @param _service_details the service details. + */ + public ServiceInformation(int[] _service_options, + ServiceDetail[] _service_details + ) + { + service_options = _service_options; + service_details = _service_details; + } +} diff --git a/libjava/classpath/org/omg/CORBA/ServiceInformationHelper.java b/libjava/classpath/org/omg/CORBA/ServiceInformationHelper.java new file mode 100644 index 000000000..1da4358a6 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ServiceInformationHelper.java @@ -0,0 +1,147 @@ +/* ServiceInformationHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Helper operations for the service information. + * + * This class is part of the service information support, but the + * 1.4 API specification states that this support should be not implemented. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ServiceInformationHelper +{ + /** + * The service information repository id. + */ + private static String _id = "IDL:org/omg/CORBA/ServiceInformation:1.0"; + + /** + * Extract the service information from the given Any. + */ + public static ServiceInformation extract(Any a) + { + return read(a.create_input_stream()); + } + + /** + * Get the service information repositroy id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the service information into the given Any. + */ + public static void insert(Any a, ServiceInformation that) + { + OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } + + /** + * Read the service information from the given CDR input stream. + */ + public static ServiceInformation read(InputStream istream) + { + ServiceInformation value = new ServiceInformation(); + value.service_options = LongSeqHelper.read(istream); + + int n = istream.read_ulong(); + value.service_details = new ServiceDetail[ n ]; + + for (int i = 0; i < n; i++) + value.service_details [ i ] = ServiceDetailHelper.read(istream); + return value; + } + + /** + * Get the service information typecode. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + + StructMember[] members = new StructMember[ 2 ]; + TypeCode member; + + member = + orb.create_alias_tc("IDL:omg.org/CORBA/ServiceOptionSeq:1.0", + "ServiceOptionSeq", LongSeqHelper.type() + ); + + members [ 0 ] = new StructMember("service_options", member, null); + + member = ServiceDetailHelper.type(); + member = orb.create_sequence_tc(0, member); + member = + orb.create_alias_tc("IDL:omg.org/CORBA/ServiceDetailSeq:1.0", + "ServiceDetailSeq", member + ); + members [ 1 ] = new StructMember("service_details", member, null); + + return + orb.create_struct_tc(ServiceInformationHelper.id(), + "ServiceInformation", members + ); + } + + /** + * Write the service information to the given CDR output stream. + */ + public static void write(OutputStream ostream, ServiceInformation value) + { + LongSeqHelper.write(ostream, value.service_options); + + ostream.write_ulong(value.service_details.length); + + for (int i = 0; i < value.service_details.length; i++) + ServiceDetailHelper.write(ostream, value.service_details [ i ]); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ServiceInformationHolder.java b/libjava/classpath/org/omg/CORBA/ServiceInformationHolder.java new file mode 100644 index 000000000..7b15d6f1f --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ServiceInformationHolder.java @@ -0,0 +1,101 @@ +/* ServiceInformationHolder.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.CORBA; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the service information. + * + * This class is part of the service information support, but the + * 1.4 API specification states that this support should be not implemented. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ServiceInformationHolder + implements Streamable +{ + /** + * A wrapped value. + */ + public ServiceInformation value; + + /** + * Create an unitialised instance. + */ + public ServiceInformationHolder() + { + } + + /** + * Create the instance where the stored service information + * s intialised into the given value. + */ + public ServiceInformationHolder(ServiceInformation initialValue) + { + value = initialValue; + } + + /** + * Read the service information from the given CDR input stream. + */ + public void _read(InputStream in) + { + value = ServiceInformationHelper.read(in); + } + + /** + * Get the typecode of the service information. + */ + public TypeCode _type() + { + return ServiceInformationHelper.type(); + } + + /** + * Write the stored service information into the given + * CDR output stream. + */ + public void _write(OutputStream out) + { + ServiceInformationHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/SetOverrideType.java b/libjava/classpath/org/omg/CORBA/SetOverrideType.java new file mode 100644 index 000000000..ebf906cbc --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/SetOverrideType.java @@ -0,0 +1,136 @@ +/* SetOverrideType.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.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the instruction, how the newly specified policies can be + * taken into consideration. The policies can be either + * added to the current policies or replace them. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class SetOverrideType + implements Serializable, IDLEntity +{ + /** + * Use v 1.4 serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -2761857189425106972L; + + /** + * Add the new policies to the existing policies. + */ + public static final int _ADD_OVERRIDE = 1; + + /** + * Replace the new existing policies by the new policies. + */ + public static final int _SET_OVERRIDE = 0; + + /** + * Add the new policies to the existing policies. + * An instance of SetOverrideType, initialized to _ADD_OVERRIDE. + */ + public static final SetOverrideType ADD_OVERRIDE = + new SetOverrideType(_ADD_OVERRIDE); + + /** + * Replace the new existing policies by the new policies. + * An instance of SetOverrideType, initialized to _SET_OVERRIDE. + */ + public static final SetOverrideType SET_OVERRIDE = + new SetOverrideType(_SET_OVERRIDE); + + private final int _value; + + /** + * No other instances can be created. + */ + protected SetOverrideType(int a_value) + { + _value = a_value; + } + + /** + * Returns the SetOverrideType, matching the given integer constant + * @param kind one of _ADD_OVERRIDE or _SET_OVERRIDE. + * + * @return one of ADD_OVERRIDE or SET_OVERRIDE. + * + * @throws BAD_PARAM if the parameter is not one of these two values. + */ + public static SetOverrideType from_int(int kind) + { + switch (kind) + { + case _ADD_OVERRIDE : + return ADD_OVERRIDE; + + case _SET_OVERRIDE : + return SET_OVERRIDE; + + default : + throw new BAD_PARAM("invalid add/override type " + kind); + } + } + + /** + * Returns a short string representation. + * + * @return either "add" or "replace". + */ + public String toString() + { + return (_value == _ADD_OVERRIDE) ? "add" : "replace"; + } + + /** + * Returns the value, representing stored instruction. + * + * @return one of ADD_OVERRIDE or SET_OVERRIDE + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java b/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java new file mode 100644 index 000000000..84c2a016d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java @@ -0,0 +1,119 @@ +/* SetOverrideTypeHelper.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.CORBA; + +import gnu.CORBA.SetOverrideTypeHolder; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the definition kind. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class SetOverrideTypeHelper +{ + /** + * Insert the definition kind into the given Any. + */ + public static void insert(Any any, SetOverrideType that) + { + any.insert_Streamable(new SetOverrideTypeHolder(that)); + } + + /** + * Extract the definition kind from the given Any. + */ + public static SetOverrideType extract(Any any) + { + return ((SetOverrideTypeHolder) any.extract_Streamable()).value; + } + + /** + * Get the definition kind typecode (enumeration, named "SetOverrideType"). + * The typecode states that the enumeration can obtain one of + * the following values: SET_OVERRIDE ,ADD_OVERRIDE . + */ + public static TypeCode type() + { + String[] members = + new String[] + { + "SET_OVERRIDE" ,"ADD_OVERRIDE" + }; + + return + OrbRestricted.Singleton.create_enum_tc(id(), "SetOverrideType", + members + ); + } + + /** + * Get the definition kind repository id. + * + * @return "IDL:omg.org/CORBA/SetOverrideType:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/SetOverrideType:1.0"; + } + + /** + * Read the enumeration value (as int) from the CDR intput stream. + * + * @param istream a stream to read from.* + */ + public static SetOverrideType read(InputStream istream) + { + return SetOverrideType.from_int(istream.read_long()); + } + + /** + * Write the enumeration value (as int) to the CDR output stream. + * + * @param ostream a stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream ostream, SetOverrideType value) + { + ostream.write_long(value.value()); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ShortHolder.java b/libjava/classpath/org/omg/CORBA/ShortHolder.java new file mode 100644 index 000000000..59bd4cf33 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ShortHolder.java @@ -0,0 +1,127 @@ +/* ShortHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>short</code> that is mapped into + * java <code>short</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ShortHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_short = + new PrimitiveTypeCode(TCKind.tk_short); + + /** + * The <code>short</code> (CORBA <code>short</code>) value, + * held by this ShortHolder. + */ + public short value; + + /** + * Constructs an instance of ShortHolder, + * initializing {@link #value} to <code>0</code>. + */ + public ShortHolder() + { + } + + /** + * Constructs an instance of ShortHolder, + * initializing {@link #value} to the given <code>short</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ShortHolder(short initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>short</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_short}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_short(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_short; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>short</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_short(short) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_short(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java b/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java new file mode 100644 index 000000000..5140bb966 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java @@ -0,0 +1,143 @@ +/* ShortSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>short</code> + * (<code>ShortSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ShortSeqHelper +{ + /** + * Extract the <code>short[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link ShortSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link ShortSeqHolder}. + */ + public static short[] extract(Any a) + { + ShortSeqHolder h = (ShortSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>short[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link ShortSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, short[] that) + { + ShortSeqHolder holder = new ShortSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>short[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static short[] read(InputStream input) + { + short[] value = new short[ input.read_long() ]; + input.read_short_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>ShortSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_short); + } + + /** + * Writes the <code>short[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, short[] value) + { + output.write_long(value.length); + output.write_short_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java b/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java new file mode 100644 index 000000000..b25024e98 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java @@ -0,0 +1,126 @@ +/* ShortSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>ShortSeq</code> that is mapped into + * java <code>short[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ShortSeqHolder + implements Streamable +{ + /** + * The <code>short[]</code> (CORBA <code>ShortSeq</code>) value, + * held by this ShortSeqHolder. + */ + public short[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_short); + + /** + * Constructs an instance of ShortSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public ShortSeqHolder() + { + } + + /** + * Constructs an instance of ShortSeqHolder, + * initializing {@link #value} to the given <code>short[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ShortSeqHolder(short[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_short_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new short[ input.read_long() ]; + input.read_short_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_short_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_short_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/StringHolder.java b/libjava/classpath/org/omg/CORBA/StringHolder.java new file mode 100644 index 000000000..ac45c562c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/StringHolder.java @@ -0,0 +1,128 @@ +/* StringHolder.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.CORBA; + +import gnu.CORBA.typecodes.StringTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>string</code> that is mapped into + * java <code>String</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class StringHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final StringTypeCode t_string = + new StringTypeCode(TCKind.tk_string); + + /** + * The <code>String</code> (CORBA <code>string</code>) value, + * held by this StringHolder. + */ + public String value; + + /** + * Constructs an instance of StringHolder, + * initializing {@link #value} to <code>null</code>. + */ + public StringHolder() + { + } + + /** + * Constructs an instance of StringHolder, + * initializing {@link #value} to the given <code>String</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public StringHolder(String initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. For <code>string</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_string}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_string(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. The {@link TypeCode#length()} method of the + * returned typecode always returns 0. + */ + public TypeCode _type() + { + return t_string; + } + + /** + * Write the {@link #value } field to the given stream. + * For <code>string</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_string(String) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/StringSeqHelper.java b/libjava/classpath/org/omg/CORBA/StringSeqHelper.java new file mode 100644 index 000000000..19f27292c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/StringSeqHelper.java @@ -0,0 +1,145 @@ +/* StringSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA <code>string</code> array. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class StringSeqHelper +{ + /** + * Extract the <code>String[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link StringSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link StringSeqHolder}. + */ + public static String[] extract(Any a) + { + StringSeqHolder h = (StringSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>String[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link StringSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, String[] that) + { + StringSeqHolder holder = new StringSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>String[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static String[] read(InputStream input) + { + String[] value = new String[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + value [ i ] = input.read_string(); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>string[]</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_string); + } + + /** + * Writes the <code>String[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, String[] value) + { + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + output.write_string(value [ i ]); + } +} diff --git a/libjava/classpath/org/omg/CORBA/StringSeqHolder.java b/libjava/classpath/org/omg/CORBA/StringSeqHolder.java new file mode 100755 index 000000000..1bc3281d3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/StringSeqHolder.java @@ -0,0 +1,131 @@ +/* StringSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>string[]</code> that is mapped into + * java <code>String[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class StringSeqHolder + implements Streamable +{ + /** + * The <code>String[]</code> (CORBA <code>string[]</code>) value, + * held by this StringSeqHolder. + */ + public String[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_char); + + /** + * Constructs an instance of StringSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public StringSeqHolder() + { + } + + /** + * Constructs an instance of StringSeqHolder, + * initializing {@link #value} to the given <code>String</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public StringSeqHolder(String[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>and then all strings. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new String[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + { + value [ i ] = input.read_string(); + } + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code> and then all strings. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + { + output.write_string(value [ i ]); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/StringValueHelper.java b/libjava/classpath/org/omg/CORBA/StringValueHelper.java new file mode 100644 index 000000000..197957a08 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/StringValueHelper.java @@ -0,0 +1,193 @@ +/* StringValueHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.BoxedValueHelper; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +import java.io.Serializable; + +/** + * Provides helper operations for the String value type, treating a + * String as a CORBA value type rather than as a primitive type. The OMG + * specification states this may be convenient in some specific + * cases. The typecode is different, but the reading/writing format in + * this implementation is the same as for the ordinary string. This is + * that Sun's IDL compiler (v1.4) would generate. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class StringValueHelper + implements BoxedValueHelper +{ + /** + * The String value helper repository Id. + */ + private static final String id = "IDL:omg.org/CORBA/StringValue:1.0"; + + /** + * The String typecode. + */ + private static final TypeCode tString = + OrbRestricted.Singleton.create_string_tc(0); + + /** + * Returns the String Value repository Id. + * @return "IDL:omg.org/CORBA/StringValue:1.0", always. + */ + public String get_id() + { + return id; + } + + /** + * Returns the String Value repository Id. + * @return "IDL:omg.org/CORBA/StringValue:1.0", always. + */ + public static String id() + { + return id; + } + + /** + * Read the string value from the input stream. + * + * @param istream a stream to read from. + * + * @return a string (delegates to read_string()). + */ + public Serializable read_value(InputStream istream) + { + return istream.read_string(); + } + + /** + * Write the given string value into the output stream. + * + * @param ostream a stream to write into. + * @param a_string a string to write. + */ + public void write_value(OutputStream ostream, Serializable a_string) + { + try + { + ostream.write_string((String) a_string); + } + catch (ClassCastException ex) + { + MARSHAL m = new MARSHAL("String expected"); + m.minor = Minor.ClassCast; + throw m; + } + } + + /** + * Extract the string from the given Any. The operation + * requires Any to hold a String value and not a String. + * + * @param an_any an Any to extract from. + * + * @return the extracted string. + */ + public static String extract(Any an_any) + { + if (an_any.type().equal(type())) + { + an_any.type(tString); + return an_any.extract_string(); + } + else + { + BAD_OPERATION bad = new BAD_OPERATION("String value type expected"); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Insert the string into the given Any. After the operation, + * the Any will have a String Value typecode and not a + * String typecode. + * + * @param an_any an Any to insert into. + * + * @param that a string to insert. + */ + public static void insert(Any an_any, String that) + { + an_any.insert_string(that); + an_any.type(type()); + } + + /** + * Reads a string as a value type. + * + * @param in a stream to read value from. + */ + public static String read(InputStream in) + { + return in.read_string(); + } + + /** + * Create and return the value box typecode, named "StringValue", with the + * content typecode being unbounded string. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_value_box_tc(id(), "StringValue", tString); + } + + /** + * Writes a string as a value type. + * + * @param out a stream to write value into. + * + * @param a_string a string to write. + */ + public static void write(OutputStream out, String a_string) + { + out.write_string(a_string); + } +} diff --git a/libjava/classpath/org/omg/CORBA/StructMember.java b/libjava/classpath/org/omg/CORBA/StructMember.java new file mode 100644 index 000000000..09245b404 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/StructMember.java @@ -0,0 +1,94 @@ +/* StructMember.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.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The component, describing the member of CORBA IDL <code>struct</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class StructMember + implements IDLEntity, Serializable +{ + /** + * Use 1.4 version serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 2762280796480753206L; + + /** + * The IDL type of the structure member. + */ + public IDLType type_def; + + /** + * The name of the structure member. + */ + public String name; + + /** + * The typecode of the structure member. + */ + public TypeCode type; + + /** + * Creates a structure member with all fields + * left with the default value <code>null</code>. + */ + public StructMember() + { + } + + /** + * Creates a structure member. + * + * @param a_name member name. + * @param a_type member type code. + * @param a_type_def member IDL type definition. + */ + public StructMember(String a_name, TypeCode a_type, IDLType a_type_def) + { + name = a_name; + type = a_type; + type_def = a_type_def; + } +} diff --git a/libjava/classpath/org/omg/CORBA/StructMemberHelper.java b/libjava/classpath/org/omg/CORBA/StructMemberHelper.java new file mode 100644 index 000000000..9a310cffe --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/StructMemberHelper.java @@ -0,0 +1,180 @@ +/* StructMemberHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.TypeCodeHelper; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Defines a helper operations for StructMember. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class StructMemberHelper +{ + /** + * The cached typecode value, computed once. + */ + private static TypeCode typeCode; + + /** + * This flag is used when creating typecodes for the recursive structures. + */ + private static boolean active; + + /** + * Insert the structure member into the given Any. + */ + public static void insert(Any a, StructMember that) + { + OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } + + /** + * Extract the structure member from the given Any. + */ + public static StructMember extract(Any a) + { + return read(a.create_input_stream()); + } + + /** + * Get a typecode for the StructMember. + */ + public static synchronized TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + + synchronized (TypeCode.class) + { + if (typeCode == null) + { + if (active) + { + return orb.create_recursive_tc(id()); + } + active = true; + + StructMember[] members = new StructMember[ 3 ]; + TypeCode member = null; + + member = orb.create_string_tc(0); + member = + orb.create_alias_tc(IdentifierHelper.id(), "Identifier", + member + ); + members [ 0 ] = new StructMember("name", member, null); + + member = orb.get_primitive_tc(TCKind.tk_TypeCode); + + members [ 1 ] = new StructMember("type", member, null); + members [ 2 ] = + new StructMember("type_def", IDLTypeHelper.type(), null); + typeCode = + orb.create_struct_tc(StructMemberHelper.id(), "StructMember", + members + ); + active = false; + } + } + } + return typeCode; + } + + /** + * Return the StructMember repository id. + * + * @return "IDL:omg.org/CORBA/StructMember:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/StructMember:1.0"; + } + + /** + * Read the StructMember from the input stream. + */ + public static StructMember read(InputStream istream) + { + try + { + StructMember value = new StructMember(); + value.name = istream.read_string(); + value.type = TypeCodeHelper.read(istream); + value.type_def = IDLTypeHelper.read(istream); + return value; + } + catch (UserException ex) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.UserException; + m.initCause(ex); + throw m; + } + } + + /** + * Write the StructMember to the input stream. + */ + public static void write(OutputStream ostream, StructMember value) + { + try + { + ostream.write_string(value.name); + TypeCodeHelper.write(ostream, value.type); + IDLTypeHelper.write(ostream, value.type_def); + } + catch (UserException ex) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.UserException; + m.initCause(ex); + throw m; + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/SystemException.java b/libjava/classpath/org/omg/CORBA/SystemException.java new file mode 100644 index 000000000..6c5c5f968 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/SystemException.java @@ -0,0 +1,95 @@ +/* SystemException.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.CORBA; + +import java.io.Serializable; + +/** + * The root class for all CORBA standard exceptions. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class SystemException + extends RuntimeException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. Using the version 1.4 UID. + */ + private static final long serialVersionUID = -8486391734674855519L; + + /** + * The status of the operation that have thrown this exception. + */ + public CompletionStatus completed; + + /** + * <p> + * Contains more details about the exception. The lower 12 bits contain a + * code, defining the reason why exception has been thrown. The higher 20 bits + * hold "Vendor Minor Codeset ID" (VMCID). + * </p> + * <p> + * The Classpath specifice minor exception codes are documented in the headers + * of the corresponding exceptions (for instance, {@link MARSHAL}). + * </p> + * + * The VMCID 0 and 0xfffff are reserved for experimental use. + * + * @see OMGVMCID + */ + public int minor; + + /** + * Constructs an instance of the CORBA standard exception. + * + * @param a_reason a string, explaining the reason why the exceptions has been + * thrown. + * @param a_minor an additional error code (known as the "minor") + * @param a_completed the task completion status. + */ + protected SystemException(String a_reason, int a_minor, + CompletionStatus a_completed) + { + super(a_reason + " Minor: " + Integer.toHexString(a_minor) + " (" + + (a_minor & 0xFFF) + "). Completed: "+a_completed); + minor = a_minor; + completed = a_completed; + } +} diff --git a/libjava/classpath/org/omg/CORBA/TCKind.java b/libjava/classpath/org/omg/CORBA/TCKind.java new file mode 100644 index 000000000..62b905367 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TCKind.java @@ -0,0 +1,504 @@ +/* TCKind.java -- java to IDL mapping constants. + 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.CORBA; + + +/** + * The basic constants, used in java to IDL mapping. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TCKind +{ + /** + * The integer constant, indicating IDL data type + * <code>null</code>. + */ + public static final int _tk_null = 0; + + /** + * The integer constant, indicating IDL data type + * <code>void</code>. + */ + public static final int _tk_void = 1; + + /** + * The integer constant, indicating IDL data type + * <code>short</code>. + */ + public static final int _tk_short = 2; + + /** + * The integer constant, indicating IDL data type + * <code>long</code>. + */ + public static final int _tk_long = 3; + + /** + * The integer constant, indicating IDL data type + * <code>ushort</code>. + */ + public static final int _tk_ushort = 4; + + /** + * The integer constant, indicating IDL data type + * <code>ulong</code>. + */ + public static final int _tk_ulong = 5; + + /** + * The integer constant, indicating IDL data type + * <code>float</code>. + */ + public static final int _tk_float = 6; + + /** + * The integer constant, indicating IDL data type + * <code>double</code>. + */ + public static final int _tk_double = 7; + + /** + * The integer constant, indicating IDL data type + * <code>boolean</code>. + */ + public static final int _tk_boolean = 8; + + /** + * The integer constant, indicating IDL data type + * <code>char</code>. + */ + public static final int _tk_char = 9; + + /** + * The integer constant, indicating IDL data type + * <code>octet</code>. + */ + public static final int _tk_octet = 10; + + /** + * The integer constant, indicating IDL data type + * <code>any</code>. + */ + public static final int _tk_any = 11; + + /** + * The integer constant, indicating IDL data type + * <code>TypeCode</code>. + */ + public static final int _tk_TypeCode = 12; + + /** + * The integer constant, indicating IDL data type + * <code>Principal</code>. + */ + public static final int _tk_Principal = 13; + + /** + * The integer constant, indicating IDL data type + * <code>objref</code>. + */ + public static final int _tk_objref = 14; + + /** + * The integer constant, indicating IDL data type + * <code>struct</code>. + */ + public static final int _tk_struct = 15; + + /** + * The integer constant, indicating IDL data type + * <code>union</code>. + */ + public static final int _tk_union = 16; + + /** + * The integer constant, indicating IDL data type + * <code>enum</code>. + */ + public static final int _tk_enum = 17; + + /** + * The integer constant, indicating IDL data type + * <code>string</code>. + */ + public static final int _tk_string = 18; + + /** + * The integer constant, indicating IDL data type + * <code>sequence</code>. + */ + public static final int _tk_sequence = 19; + + /** + * The integer constant, indicating IDL data type + * <code>array</code>. + */ + public static final int _tk_array = 20; + + /** + * The integer constant, indicating IDL data type + * <code>alias</code>. + */ + public static final int _tk_alias = 21; + + /** + * The integer constant, indicating IDL data type + * <code>except</code>. + */ + public static final int _tk_except = 22; + + /** + * The integer constant, indicating IDL data type + * <code>longlong</code>. + */ + public static final int _tk_longlong = 23; + + /** + * The integer constant, indicating IDL data type + * <code>ulonglong</code>. + */ + public static final int _tk_ulonglong = 24; + + /** + * The integer constant, indicating IDL data type + * <code>longdouble</code>. + */ + public static final int _tk_longdouble = 25; + + /** + * The integer constant, indicating IDL data type + * <code>wchar</code>. + */ + public static final int _tk_wchar = 26; + + /** + * The integer constant, indicating IDL data type + * <code>wstring</code>. + */ + public static final int _tk_wstring = 27; + + /** + * The integer constant, indicating IDL data type + * <code>fixed</code>. + */ + public static final int _tk_fixed = 28; + + /** + * The integer constant, indicating IDL data type + * <code>value</code>. + */ + public static final int _tk_value = 29; + + /** + * The integer constant, indicating IDL data type + * <code>value_box</code>. + */ + public static final int _tk_value_box = 30; + + /** + * The integer constant, indicating IDL data type + * <code>native</code>. + */ + public static final int _tk_native = 31; + + /** + * The integer constant, indicating IDL data type + * <code>abstract_interface</code>. + */ + public static final int _tk_abstract_interface = 32; + + /** + * The TCKind constant, indicating IDL data type + * <code>null</code> + */ + public static final TCKind tk_null = new TCKind(_tk_null); + + /** + * The TCKind constant, indicating IDL data type + * <code>void</code> + */ + public static final TCKind tk_void = new TCKind(_tk_void); + + /** + * The TCKind constant, indicating IDL data type + * <code>short</code> + */ + public static final TCKind tk_short = new TCKind(_tk_short); + + /** + * The TCKind constant, indicating IDL data type + * <code>long</code> + */ + public static final TCKind tk_long = new TCKind(_tk_long); + + /** + * The TCKind constant, indicating IDL data type + * <code>ushort</code> + */ + public static final TCKind tk_ushort = new TCKind(_tk_ushort); + + /** + * The TCKind constant, indicating IDL data type + * <code>ulong</code> + */ + public static final TCKind tk_ulong = new TCKind(_tk_ulong); + + /** + * The TCKind constant, indicating IDL data type + * <code>float</code> + */ + public static final TCKind tk_float = new TCKind(_tk_float); + + /** + * The TCKind constant, indicating IDL data type + * <code>double</code> + */ + public static final TCKind tk_double = new TCKind(_tk_double); + + /** + * The TCKind constant, indicating IDL data type + * <code>boolean</code> + */ + public static final TCKind tk_boolean = new TCKind(_tk_boolean); + + /** + * The TCKind constant, indicating IDL data type + * <code>char</code> + */ + public static final TCKind tk_char = new TCKind(_tk_char); + + /** + * The TCKind constant, indicating IDL data type + * <code>octet</code> + */ + public static final TCKind tk_octet = new TCKind(_tk_octet); + + /** + * The TCKind constant, indicating IDL data type + * <code>any</code> + */ + public static final TCKind tk_any = new TCKind(_tk_any); + + /** + * The TCKind constant, indicating IDL data type + * <code>TypeCode</code> + */ + public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode); + + /** + * The TCKind constant, indicating IDL data type + * <code>Principal</code> + */ + public static final TCKind tk_Principal = new TCKind(_tk_Principal); + + /** + * The TCKind constant, indicating IDL data type + * <code>objref</code> + */ + public static final TCKind tk_objref = new TCKind(_tk_objref); + + /** + * The TCKind constant, indicating IDL data type + * <code>struct</code> + */ + public static final TCKind tk_struct = new TCKind(_tk_struct); + + /** + * The TCKind constant, indicating IDL data type + * <code>union</code> + */ + public static final TCKind tk_union = new TCKind(_tk_union); + + /** + * The TCKind constant, indicating IDL data type + * <code>enum</code> + */ + public static final TCKind tk_enum = new TCKind(_tk_enum); + + /** + * The TCKind constant, indicating IDL data type + * <code>string</code> + */ + public static final TCKind tk_string = new TCKind(_tk_string); + + /** + * The TCKind constant, indicating IDL data type + * <code>sequence</code> + */ + public static final TCKind tk_sequence = new TCKind(_tk_sequence); + + /** + * The TCKind constant, indicating IDL data type + * <code>array</code> + */ + public static final TCKind tk_array = new TCKind(_tk_array); + + /** + * The TCKind constant, indicating IDL data type + * <code>alias</code> + */ + public static final TCKind tk_alias = new TCKind(_tk_alias); + + /** + * The TCKind constant, indicating IDL data type + * <code>except</code> + */ + public static final TCKind tk_except = new TCKind(_tk_except); + + /** + * The TCKind constant, indicating IDL data type + * <code>longlong</code> + */ + public static final TCKind tk_longlong = new TCKind(_tk_longlong); + + /** + * The TCKind constant, indicating IDL data type + * <code>ulonglong</code> + */ + public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong); + + /** + * The TCKind constant, indicating IDL data type + * <code>longdouble</code> + */ + public static final TCKind tk_longdouble = new TCKind(_tk_longdouble); + + /** + * The TCKind constant, indicating IDL data type + * <code>wchar</code> + */ + public static final TCKind tk_wchar = new TCKind(_tk_wchar); + + /** + * The TCKind constant, indicating IDL data type + * <code>wstring</code> + */ + public static final TCKind tk_wstring = new TCKind(_tk_wstring); + + /** + * The TCKind constant, indicating IDL data type + * <code>fixed</code> + */ + public static final TCKind tk_fixed = new TCKind(_tk_fixed); + + /** + * The TCKind constant, indicating IDL data type + * <code>value</code> + */ + public static final TCKind tk_value = new TCKind(_tk_value); + + /** + * The TCKind constant, indicating IDL data type + * <code>value_box</code> + */ + public static final TCKind tk_value_box = new TCKind(_tk_value_box); + + /** + * The TCKind constant, indicating IDL data type + * <code>native</code> + */ + public static final TCKind tk_native = new TCKind(_tk_native); + + /** + * The TCKind constant, indicating IDL data type + * <code>abstract_interface</code> + */ + public static final TCKind tk_abstract_interface = + new TCKind(_tk_abstract_interface); + + /** + * The kind value for this instance. + */ + private final int _value; + + /** + * The array of all tk_... instances, sorted by the kind number. + * + * As long as the kind numbers make the continuos sequence, starting from 0, + * the members can be found just by direct indexing. + */ + private static final TCKind[] tk = + new TCKind[] + { + tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float, + tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode, + tk_Principal, tk_objref, tk_struct, tk_union, tk_enum, tk_string, + tk_sequence, tk_array, tk_alias, tk_except, tk_longlong, tk_ulonglong, + tk_longdouble, tk_wchar, tk_wstring, tk_fixed, tk_value, tk_value_box, + tk_native, tk_abstract_interface + }; + + /** + * Creates a new TCKind instance with the given integer constant value. + * @deprecated it is recommended to use {@link #from_int(int)} that + * reuses existing TCKind object instead of allocating the new instance. + * @param kind one of the <code>_tk_..</code> constants. + */ + protected TCKind(int kind) + { + _value = kind; + } + + /** + * Returns the integer value, corresponding this instance of TCKind. + * @return the <code>_tk_..</code> value, matching this instance. + */ + public int value() + { + return _value; + } + + /** + * Return a TCKind object, matching the given integer code. + * @param _tk_nnn the TCKind code, one of <code>_tk_..</code> constants. + * @return the matching instance of TCKind, on of tk_.. constants. + * @throws BAD_PARAM if the given integer constant is not one of the + * valid <code>_tk_..</code> constants. + */ + public static TCKind from_int(int _tk_nnn) + { + try { + return tk[_tk_nnn]; + } + catch (ArrayIndexOutOfBoundsException aex) { + throw new BAD_PARAM("Invalid _tk_ code "+_tk_nnn); + } + } + +} diff --git a/libjava/classpath/org/omg/CORBA/TIMEOUT.java b/libjava/classpath/org/omg/CORBA/TIMEOUT.java new file mode 100644 index 000000000..bdeae7b19 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TIMEOUT.java @@ -0,0 +1,98 @@ +/* TIMEOUT.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.CORBA; + +import java.io.Serializable; + +/** + * Raised when no delivery has been made during the specified timeout duration. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class TIMEOUT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = 4674850648191359518L; + + /** + * Creates TIMEOUT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public TIMEOUT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TIMEOUT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TIMEOUT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TIMEOUT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public TIMEOUT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TIMEOUT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public TIMEOUT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java new file mode 100644 index 000000000..fc72d3c67 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java @@ -0,0 +1,99 @@ +/* TRANSACTION_MODE.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.CORBA; + +import java.io.Serializable; + +/** + * Raised when the TransactionPolicy in the IOR is not the same as the current + * transaction mode. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class TRANSACTION_MODE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = 681236728492128745L; + + /** + * Creates TRANSACTION_MODE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public TRANSACTION_MODE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TRANSACTION_MODE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSACTION_MODE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSACTION_MODE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public TRANSACTION_MODE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSACTION_MODE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public TRANSACTION_MODE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_REQUIRED.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_REQUIRED.java new file mode 100644 index 000000000..6cfc6182a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_REQUIRED.java @@ -0,0 +1,96 @@ +/* TRANSACTION_REQUIRED.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.CORBA; + +import java.io.Serializable; + +/** + * Means that request carried a null transaction context, but an + * active transaction is required. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class TRANSACTION_REQUIRED + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1900254548742148576L; + + /** + * Creates a TRANSACTION_REQUIRED with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public TRANSACTION_REQUIRED(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TRANSACTION_REQUIRED with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSACTION_REQUIRED() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSACTION_REQUIRED exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public TRANSACTION_REQUIRED(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSACTION_REQUIRED exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public TRANSACTION_REQUIRED(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java new file mode 100644 index 000000000..14edc2cb7 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java @@ -0,0 +1,97 @@ +/* TRANSACTION_ROLLEDBACK.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.CORBA; + +import java.io.Serializable; + +/** + * Means that transaction associated with the request has already + * been rolled back or marked to roll back. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class TRANSACTION_ROLLEDBACK + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -343903462439281571L; + + /** + * Creates a TRANSACTION_ROLLEDBACK with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public TRANSACTION_ROLLEDBACK(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TRANSACTION_ROLLEDBACK with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSACTION_ROLLEDBACK() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSACTION_ROLLEDBACK exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public TRANSACTION_ROLLEDBACK(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSACTION_ROLLEDBACK exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public TRANSACTION_ROLLEDBACK(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java new file mode 100644 index 000000000..13ce17ebe --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java @@ -0,0 +1,99 @@ +/* TRANSACTION_UNAVAILABLE.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.CORBA; + +import java.io.Serializable; + +/** + * Raised in response to the abnormal termination of the transaction + * service. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class TRANSACTION_UNAVAILABLE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (v1.5) for interoperability. + */ + private static final long serialVersionUID = 6340246200933309385L; + + /** + * Creates TRANSACTION_UNAVAILABLE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public TRANSACTION_UNAVAILABLE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TRANSACTION_UNAVAILABLE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSACTION_UNAVAILABLE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSACTION_UNAVAILABLE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public TRANSACTION_UNAVAILABLE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSACTION_UNAVAILABLE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public TRANSACTION_UNAVAILABLE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TRANSIENT.java b/libjava/classpath/org/omg/CORBA/TRANSIENT.java new file mode 100644 index 000000000..081eabf3a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TRANSIENT.java @@ -0,0 +1,97 @@ +/* TRANSIENT.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the ORB cannot <i>reach</i> the object. It is not an + * indication that this object does not exist. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class TRANSIENT + extends SystemException + implements Serializable +{ + /** + * Creates a TRANSIENT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public TRANSIENT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 8168539547719791425L; + + /** + * Creates TRANSIENT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSIENT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSIENT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public TRANSIENT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSIENT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public TRANSIENT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TypeCode.java b/libjava/classpath/org/omg/CORBA/TypeCode.java new file mode 100644 index 000000000..6a72f5a1d --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TypeCode.java @@ -0,0 +1,271 @@ +/* TypeCode.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.CORBA; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * An information about a CORBA data type. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class TypeCode + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = -6521025782489515676L; + + /** + * For value types that support inheritance this method returns the + * of the ancestor type code. + * + * @return the ancestor TypeCode. + * + * @throws BadKind for all typecodes except the value type typecodes. + */ + public abstract TypeCode concrete_base_type() + throws BadKind; + + /** + * For sequences, arrays, aliases and value boxes, returns the IDL type for + * the members of the object. + * @return a TypeCode of the memebers of this type. + * @throws BadKind for types other than + * sequences, arrays, aliases and value boxes. + */ + public abstract TypeCode content_type() + throws BadKind; + + /** + * For unions, returs the index of the default member. + * @return the index of the default member, -1 if there is + * no default member. + * @throws BadKind if this type is not + * a union. + */ + public abstract int default_index() + throws BadKind; + + /** + * Returs definition of member labels for untions + * @return a TypeCode, describing all non-default member labels. + * @throws BadKind if this type is not a + * union. + */ + public abstract TypeCode discriminator_type() + throws BadKind; + + /** + * Test two types for equality. + * + * @param other the other type to compere with + * @return true if the types are interchangeable. + */ + public abstract boolean equal(TypeCode other); + + /** + * Following the current 1.4 API specifcation, this should just throw + * NO_IMPLEMENT. + * @throws org.omg.CORBA.NO_IMPLEMENT, always. + */ + public abstract boolean equivalent(TypeCode other); + + /** + * For the fixed type, returns the number of digits. + * @return the number of digits for the fixed type + * @throws BadKind if this is not a fixed + * type. + */ + public abstract short fixed_digits() + throws BadKind; + + /** + * Returns the scale for the fixed type. The returned value can be either + * positive (the number of digits to the right of the decimal point) or + * negative (adds zeros to the left of the decimal point). + * @return the scale. + * @throws BadKind if this is not a fixed + * type. + */ + public abstract short fixed_scale() + throws BadKind; + + /** + * Returns a version of this instance without the optional memeber and + * member name fields. + * @return the truncated version. + */ + public abstract TypeCode get_compact_typecode(); + + /** + * Returns the RepositoryId globally identifying the type, defined by + * this TypeCode. + * @return tje RepositoryId. In some cases, it may be an empty string. + * @throws BadKind if the type is other than + * reference, structure, union, enumeration, alias, exception, valuetype, + * boxed valuetype and also native and abstract interfaces. + */ + public abstract String id() + throws BadKind; + + /** + * Return the kind of this type code object. + * @return one of the <code>TCKind.t_..</code> fields. + */ + public abstract TCKind kind(); + + /** + * Returns the number of elements in the type. For arrays, this + * method returns the length of the array. For strings and sequences, + * it returns the bound of the type, zero indicating the unbounded + * type. + * + * @return length or bound + * + * @throws BadKind for types other than + * string, sequence and array. + */ + public abstract int length() + throws BadKind; + + /** + * Returns the number of type memebers. + * + * @return the number of memebers + * @throws BadKind for types other than + * structure, union, enumeration or exception. + */ + public abstract int member_count() + throws BadKind; + + /** + * Retrieves the label of the union member at the given index. + * For the default member, this label is the zero octet. + * + * @param index the index of the union memeber. + * + * @return the label + * + * @throws BadKind if this is not a union + * type. + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract Any member_label(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + /** + * Retrieves the simple name of the member identified by the given index. + * + * @param index the index of the memeber. + * + * @return the member name that in some cases can be an empty string. + * + * @throws BadKind for types other than + * structure, union or enumeration. + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract String member_name(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + /** + * Retrieves the member type of the member identified by the given index. + * + * @param index the index of the memeber. + * + * @return the member type. + * + * @throws BadKind for types other than + * structure, union, enumeration or exception. + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract TypeCode member_type(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + /** + * Returns the visibility scope of the member at the given index. + * This operation can only be invoked on non-boxed value types. + * + * @param index the index of the member + * + * @return either PRIVATE_MEMBER.value or PUBLIC_MEMBER.value + * + * @throws BadKind if this is not a non boxed + * value type. + * + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract short member_visibility(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + /** + * Retrieves the simple name identifying this TypeCode object + * within its enclosing scope. + * @return the name, can be an empty string. + * @throws BadKind for typer other than + * reference, structure, union, enumeration, alias, exception, + * valuetype, boxed valuetype, native, and abstract interface + */ + public abstract String name() + throws BadKind; + + /** + * Returns a constant indicating the modifier of the value type. + * + * @return one of the following constants: + * VM_NONE.value, VM_ABSTRACT.value, VM_CUSTOM.value, or + * VM_TRUNCATABLE.value, + * + * @throws BadKind for all types other than value type. + */ + public abstract short type_modifier() + throws BadKind; +} diff --git a/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java b/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java new file mode 100644 index 000000000..0a3c4e370 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java @@ -0,0 +1,123 @@ +/* TypeCodeHolder.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.CORBA; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>TypeCode</code> that is mapped into + * java <code>TypeCode</code>. + * + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class TypeCodeHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_TypeCode = + new PrimitiveTypeCode(TCKind.tk_TypeCode); + + /** + * The <code>TypeCode</code> (CORBA <code>TypeCode</code>) value, + * held by this TypeCodeHolder. + */ + public TypeCode value; + + /** + * Constructs an instance of TypeCodeHolder, + * initializing {@link #value} to <code>null</code>. + */ + public TypeCodeHolder() + { + } + + /** + * Constructs an instance of TypeCodeHolder, + * initializing {@link #value} to the given <code>TypeCode</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public TypeCodeHolder(TypeCode initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link #value} field by reading the required data + * from the given stream. For <code>TypeCode</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_TypeCode}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_TypeCode(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_TypeCode; + } + + /** + * Write the {@link #value} field to the given stream. + * For <code>TypeCode</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_TypeCode(TypeCode) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_TypeCode(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java b/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java new file mode 100644 index 000000000..2da316e26 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java @@ -0,0 +1,76 @@ +/* BadKind.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.CORBA.TypeCodePackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * This exception is thrown when an inappropriate operation is invoked on + * a {@link org.omg.CORBA.TypeCode} object. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BadKind + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1030443154456771956L; + + /** + * Constructs a the exception. + */ + public BadKind() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + public BadKind(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java b/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java new file mode 100644 index 000000000..fda440f16 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java @@ -0,0 +1,79 @@ +/* Bounds.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.CORBA.TypeCodePackage; + +import java.io.Serializable; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * The {@link org.omg.CORBA.TypeCode#member_name(int) }, + * {@link org.omg.CORBA.TypeCode#member_type(int) } and + * {@link org.omg.CORBA.TypeCode#member_label(int) } raise Bounds when + * the parameter is larger than the index of the last member, + * constituting the type. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class Bounds + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -5418177951071152101L; + + /** + * Constructs a the exception. + */ + public Bounds() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + public Bounds(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/TypeCodePackage/package.html b/libjava/classpath/org/omg/CORBA/TypeCodePackage/package.html new file mode 100644 index 000000000..f8c476e6f --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/TypeCodePackage/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.sql package. + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA.TypeCodePackage</title></head> + +<body> +<p>Provides a couple of exceptions, thrown by methods in the <code>TypeCode</code> class.</p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java b/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java new file mode 100644 index 000000000..b13f33cdf --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java @@ -0,0 +1,143 @@ +/* ULongLongSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>long</code> + * (<code>ULongLongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ULongLongSeqHelper +{ + /** + * Extract the <code>long[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link ULongLongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link ULongLongSeqHolder}. + */ + public static long[] extract(Any a) + { + ULongLongSeqHolder h = (ULongLongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>long[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link ULongLongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, long[] that) + { + ULongLongSeqHolder holder = new ULongLongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>long[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static long[] read(InputStream input) + { + long[] value = new long[ input.read_long() ]; + input.read_ulonglong_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>ULongLongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_ulong); + } + + /** + * Writes the <code>long[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, long[] value) + { + output.write_long(value.length); + output.write_ulonglong_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java b/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java new file mode 100644 index 000000000..cd9c02310 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java @@ -0,0 +1,126 @@ +/* ULongLongSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>ULongLongSeq</code> that is mapped into + * java <code>long[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ULongLongSeqHolder + implements Streamable +{ + /** + * The <code>long[]</code> (CORBA <code>ULongLongSeq</code>) value, + * held by this ULongLongSeqHolder. + */ + public long[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_ulonglong); + + /** + * Constructs an instance of ULongLongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public ULongLongSeqHolder() + { + } + + /** + * Constructs an instance of ULongLongSeqHolder, + * initializing {@link #value} to the given <code>long[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ULongLongSeqHolder(long[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_ulonglong_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new long[ input.read_long() ]; + input.read_ulonglong_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_ulonglong_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_ulonglong_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java b/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java new file mode 100644 index 000000000..186350b2c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java @@ -0,0 +1,143 @@ +/* ULongSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>int</code> + * (<code>ULongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ULongSeqHelper +{ + /** + * Extract the <code>int[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link ULongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link ULongSeqHolder}. + */ + public static int[] extract(Any a) + { + ULongSeqHolder h = (ULongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>int[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link ULongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, int[] that) + { + ULongSeqHolder holder = new ULongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>int[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static int[] read(InputStream input) + { + int[] value = new int[ input.read_long() ]; + input.read_ulong_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>ULongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_long); + } + + /** + * Writes the <code>int[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, int[] value) + { + output.write_long(value.length); + output.write_ulong_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java b/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java new file mode 100644 index 000000000..35d9a4384 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java @@ -0,0 +1,126 @@ +/* ULongSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>ULongSeq</code> that is mapped into + * java <code>int[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ULongSeqHolder + implements Streamable +{ + /** + * The <code>int[]</code> (CORBA <code>ULongSeq</code>) value, + * held by this ULongSeqHolder. + */ + public int[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_ulong); + + /** + * Constructs an instance of ULongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public ULongSeqHolder() + { + } + + /** + * Constructs an instance of ULongSeqHolder, + * initializing {@link #value} to the given <code>int[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ULongSeqHolder(int[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_ulong_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new int[ input.read_long() ]; + input.read_ulong_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_ulong_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_ulong_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/UNKNOWN.java b/libjava/classpath/org/omg/CORBA/UNKNOWN.java new file mode 100644 index 000000000..37b627aa3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UNKNOWN.java @@ -0,0 +1,95 @@ +/* UNKNOWN.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.CORBA; + +import java.io.Serializable; + +/** + * Means that the operation implementation has thrown a non-CORBA exception. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class UNKNOWN + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -3556426185741898205L; + + /** + * Creates a UNKNOWN with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param message the explaining message. + */ + public UNKNOWN(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates UNKNOWN with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public UNKNOWN() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a UNKNOWN exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + public UNKNOWN(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created UNKNOWN exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + public UNKNOWN(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/libjava/classpath/org/omg/CORBA/UNSUPPORTED_POLICY.java b/libjava/classpath/org/omg/CORBA/UNSUPPORTED_POLICY.java new file mode 100644 index 000000000..e07f9e08b --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UNSUPPORTED_POLICY.java @@ -0,0 +1,56 @@ +/* UNSUPPORTED_POLICY.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.CORBA; + +/** + * Holds a single constant, specifying, that + * while the requested {@link Policy} is valid, it is not supported by + * this ORB. One of the PolicyErrorCodes, others being + * {@link UNSUPPORTED_POLICY_VALUE}, {@link BAD_POLICY}, + * {@link BAD_POLICY_TYPE}, {@link BAD_POLICY_VALUE}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface UNSUPPORTED_POLICY +{ + /** + * States that while the requested {@link Policy} is valid, + * it is not supported by this ORB. + */ + short value = 1; +} diff --git a/libjava/classpath/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java b/libjava/classpath/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java new file mode 100644 index 000000000..6da7238b7 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java @@ -0,0 +1,56 @@ +/* UNSUPPORTED_POLICY_VALUE.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.CORBA; + +/** + * Holds a single constant, specifying, that + * while the requested {@link Policy} value is valid, it is not + * supported by this ORB. One of the PolicyErrorCodes, others being + * {@link UNSUPPORTED_POLICY}, {@link BAD_POLICY}, {@link BAD_POLICY_TYPE} , + * {@link BAD_POLICY_VALUE}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface UNSUPPORTED_POLICY_VALUE +{ + /** + * States that while the requested {@link Policy} value is valid, + * it is not supported by this ORB. + */ + short value = 4; +} diff --git a/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java b/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java new file mode 100644 index 000000000..0fcd4739f --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java @@ -0,0 +1,143 @@ +/* UShortSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>short</code> + * (<code>UShortSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class UShortSeqHelper +{ + /** + * Extract the <code>short[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link UShortSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link UShortSeqHolder}. + */ + public static short[] extract(Any a) + { + UShortSeqHolder h = (UShortSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>short[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link UShortSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, short[] that) + { + UShortSeqHolder holder = new UShortSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>short[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static short[] read(InputStream input) + { + short[] value = new short[ input.read_long() ]; + input.read_ushort_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>UShortSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_short); + } + + /** + * Writes the <code>short[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, short[] value) + { + output.write_long(value.length); + output.write_ushort_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java b/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java new file mode 100644 index 000000000..3eb83c524 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java @@ -0,0 +1,126 @@ +/* UShortSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>UShortSeq</code> that is mapped into + * java <code>short[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class UShortSeqHolder + implements Streamable +{ + /** + * The <code>short[]</code> (CORBA <code>UShortSeq</code>) value, + * held by this UShortSeqHolder. + */ + public short[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_ushort); + + /** + * Constructs an instance of UShortSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public UShortSeqHolder() + { + } + + /** + * Constructs an instance of UShortSeqHolder, + * initializing {@link #value} to the given <code>short[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public UShortSeqHolder(short[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_ushort_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new short[ input.read_long() ]; + input.read_ushort_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_ushort_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_ushort_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/UnionMember.java b/libjava/classpath/org/omg/CORBA/UnionMember.java new file mode 100644 index 000000000..69e424cdb --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UnionMember.java @@ -0,0 +1,103 @@ +/* UnionMember.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.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The component, describing the member of CORBA IDL <code>union</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class UnionMember + implements IDLEntity, Serializable +{ + /** + * Use 1.4 version serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 5506049694216071974L; + + /** + * The label of the union member. + */ + public Any label; + + /** + * The IDL type of the union member. + */ + public IDLType type_def; + + /** + * The name of the union member. + */ + public String name; + + /** + * The typecode of the union member. + */ + public TypeCode type; + + /** + * Creates a union member with all fields + * left with the default value <code>null</code>. + */ + public UnionMember() + { + } + + /** + * Creates a union member. + * + * @param a_name member name. + * @param a_label member label. + * @param a_type member type code. + * @param a_type_def member IDL type definition. + */ + public UnionMember(String a_name, Any a_label, TypeCode a_type, + IDLType a_type_def + ) + { + name = a_name; + label = a_label; + type = a_type; + type_def = a_type_def; + } +} diff --git a/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java b/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java new file mode 100644 index 000000000..d0622e8a9 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java @@ -0,0 +1,182 @@ +/* UnionMemberHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.TypeCodeHelper; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the union member. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class UnionMemberHelper +{ + /** + * The cached typecode value (computed once). + */ + private static TypeCode typeCode; + + /** + * Used in creating recursive unions. + */ + private static boolean active; + + /** + * Inset the union member into the given Any. + */ + public static void insert(Any a, UnionMember that) + { + OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } + + /** + * Extract the union member from the given Any. + */ + public static UnionMember extract(Any a) + { + return read(a.create_input_stream()); + } + + /** + * Create and return the typecode for this union member. + */ + public static synchronized TypeCode type() + { + if (typeCode == null) + { + synchronized (TypeCode.class) + { + if (typeCode == null) + { + if (active) + { + return OrbRestricted.Singleton.create_recursive_tc(id()); + } + active = true; + + ORB orb = OrbRestricted.Singleton; + + StructMember[] members = new StructMember[ 4 ]; + TypeCode member; + member = orb.create_string_tc(0); + member = + orb.create_alias_tc(IdentifierHelper.id(), "Identifier", + member + ); + members [ 0 ] = new StructMember("name", member, null); + member = orb.get_primitive_tc(TCKind.tk_any); + members [ 1 ] = new StructMember("label", member, null); + member = orb.create_string_tc(0); + member = orb.get_primitive_tc(TCKind.tk_TypeCode); + members [ 2 ] = new StructMember("type", member, null); + member = IDLTypeHelper.type(); + members [ 3 ] = new StructMember("type_def", member, null); + typeCode = + orb.create_struct_tc(UnionMemberHelper.id(), "UnionMember", + members + ); + active = false; + } + } + } + return typeCode; + } + + /** + * Return the UnionMember repository id. + * + * @return "IDL:omg.org/CORBA/UnionMember:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/UnionMember:1.0"; + } + + /** + * Read the union member from the given stream. + */ + public static UnionMember read(InputStream istream) + { + try + { + UnionMember value = new UnionMember(); + value.name = istream.read_string(); + value.label = istream.read_any(); + value.type = TypeCodeHelper.read(istream); + value.type_def = IDLTypeHelper.read(istream); + return value; + } + catch (UserException ex) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.UserException; + m.initCause(ex); + throw m; + } + } + + /** + * Write the union member to the given stream. + */ + public static void write(OutputStream ostream, UnionMember value) + { + try + { + ostream.write_string(value.name); + ostream.write_any(value.label); + TypeCodeHelper.write(ostream, value.type); + IDLTypeHelper.write(ostream, value.type_def); + } + catch (UserException ex) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.UserException; + m.initCause(ex); + throw m; + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/UnknownUserException.java b/libjava/classpath/org/omg/CORBA/UnknownUserException.java new file mode 100644 index 000000000..170f2d5d2 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UnknownUserException.java @@ -0,0 +1,87 @@ +/* UnknownUserException.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * A wrapper against an unknown user exception that has been thrown + * on remote side and returned by the server. The instance of this + * class is returned by {@link Request#env()}. + * + * @see Environment#exception() + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class UnknownUserException + extends UserException + implements IDLEntity, Serializable +{ + /** + * The Any, holding the actual exception, that has been thrown + * by the server. + */ + public Any except; + + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 3106202258203879281L; + + /** + * Create an unitialised instance of the unknown user exception. + */ + public UnknownUserException() + { + } + + /** + * Create the instance of the unknow user exception, initialised + * to the given value. + * + * @param an_exception the exception, that has actually been thrown + * by the server. + */ + public UnknownUserException(Any an_exception) + { + except = an_exception; + } +} diff --git a/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java new file mode 100644 index 000000000..086641e5c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java @@ -0,0 +1,149 @@ +/* UnknownUserExceptionHelper.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.CORBA; + +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; + +/** +* The helper operations for the exception {@link UnknownUserException}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class UnknownUserExceptionHelper +{ + /** + * Create the UnknownUserException typecode (structure, + * named "UnknownUserException", containing a single field of + * type {@link Any}, named "except". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 1 ]; + + TypeCode field; + + field = orb.get_primitive_tc(TCKind.tk_any); + members [ 0 ] = new StructMember("except", field, null); + return + orb.create_exception_tc(id(), "UnknownUserException", members); + } + + /** + * Insert the UnknownUserException into the given Any. + * This method uses the UnknownUserExceptionHolder. + * + * @param any the Any to insert into. + * @param that the UnknownUserException to insert. + */ + public static void insert(Any any, UnknownUserException that) + { + any.insert_Streamable(new UnknownUserExceptionHolder(that)); + } + + /** + * Extract the UnknownUserException from given Any. + * This method uses the UnknownUserExceptionHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain + * UnknownUserException. + */ + public static UnknownUserException extract(Any any) + { + try + { + return ((UnknownUserExceptionHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("UnknownUserException expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the UnknownUserException repository id. + * + * @return "IDL:omg.org/CORBA/UnknownUserException:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/UnknownUserException:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static UnknownUserException read(InputStream input) + { + // Read the exception repository id. + input.read_string(); + UnknownUserException value = new UnknownUserException(); + + value.except = input.read_any(); + 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, UnknownUserException value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_any(value.except); + } +} diff --git a/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java new file mode 100644 index 000000000..816cdeeba --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java @@ -0,0 +1,103 @@ +/* UnknownUserExceptionHolder.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.CORBA; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* A holder for the exception {@link UnknownUserException}. + +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class UnknownUserExceptionHolder implements Streamable +{ + /** + * The stored UnknownUserException value. + */ + public UnknownUserException value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public UnknownUserExceptionHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public UnknownUserExceptionHolder(UnknownUserException 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 = UnknownUserExceptionHelper.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) + { + UnknownUserExceptionHelper.write(output, value); + } + + /** + * Get the typecode of the UnknownUserException. + */ + public TypeCode _type() + { + return UnknownUserExceptionHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/UserException.java b/libjava/classpath/org/omg/CORBA/UserException.java new file mode 100644 index 000000000..edbd76e86 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/UserException.java @@ -0,0 +1,74 @@ +/* UserException.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.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The root class for CORBA IDL-defined user exceptions. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class UserException + extends Exception + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = -6594940734566091244L; + + /** + * Constructs a the exception. + */ + protected UserException() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + protected UserException(String reason) + { + super(reason); + } +} diff --git a/libjava/classpath/org/omg/CORBA/VM_ABSTRACT.java b/libjava/classpath/org/omg/CORBA/VM_ABSTRACT.java new file mode 100644 index 000000000..ffaeed879 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/VM_ABSTRACT.java @@ -0,0 +1,52 @@ +/* VM_ABSTRACT.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.CORBA; + +/** + * Specifies that the object is an abstract interface. One of the possible + * values, returned by {@link TypeCode#type_modifier()}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface VM_ABSTRACT +{ + /** + * States the abstract interface in a typecode. + */ + short value = 2; +} diff --git a/libjava/classpath/org/omg/CORBA/VM_CUSTOM.java b/libjava/classpath/org/omg/CORBA/VM_CUSTOM.java new file mode 100644 index 000000000..40c64feaf --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/VM_CUSTOM.java @@ -0,0 +1,53 @@ +/* VM_CUSTOM.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.CORBA; + +/** + * Indicates a custom marshalled value type. One of the possible + * values, returned by {@link TypeCode#type_modifier()}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface VM_CUSTOM +{ + /** + * States that the code used to represent a custom + * marshalled value type in a typecode. + */ + short value = 1; +} diff --git a/libjava/classpath/org/omg/CORBA/VM_NONE.java b/libjava/classpath/org/omg/CORBA/VM_NONE.java new file mode 100644 index 000000000..f8ef8b51c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/VM_NONE.java @@ -0,0 +1,52 @@ +/* VM_NONE.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.CORBA; + +/** + * One of the possible values, returned by {@link TypeCode#type_modifier()}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface VM_NONE +{ + /** + * States that the code used to represent the one of + * the values of a value type in a typecode. + */ + short value = 0; +} diff --git a/libjava/classpath/org/omg/CORBA/VM_TRUNCATABLE.java b/libjava/classpath/org/omg/CORBA/VM_TRUNCATABLE.java new file mode 100644 index 000000000..6b70770be --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/VM_TRUNCATABLE.java @@ -0,0 +1,53 @@ +/* VM_TRUNCATABLE.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.CORBA; + +/** + * Indicates a truncatable value type. One of the possible + * values, returned by {@link TypeCode#type_modifier()}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface VM_TRUNCATABLE +{ + /** + * States that the code used to represent a truncatable + * value type in a typecode. + */ + short value = 3; +} diff --git a/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java b/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java new file mode 100644 index 000000000..4fdb452b3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java @@ -0,0 +1,137 @@ +/* ValueBaseHelper.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.CORBA; + +import gnu.CORBA.CDR.Vio; +import gnu.CORBA.typecodes.RecordTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ValueBase; + +import java.io.ObjectOutputStream; +import java.io.Serializable; + +/** + * A helper operations for the value base type ({@link ValueBase}). + * + * @since 1.3 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ValueBaseHelper +{ + /** + * Extract the value type from the given Any. + * + * @param a the Any to extract from. + * + * @return the extracted value type. + */ + public static Serializable extract(Any a) + { + return a.extract_Value(); + } + + /** + * Return the value base helper repository id. + * + * @return IDL:omg.org/CORBA/ValueBase:1.0, always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/ValueBase:1.0"; + } + + /** + * Insert the value base that is Serializable into + * the given Any. + * + * @param a the Any to insert into. + * @param that the value base to insert. + */ + public static void insert(Any a, Serializable that) + { + a.insert_Value(that); + } + + /** + * Read the value base from the given input stream. + * + * @param input a stream to read from. + * + * @return the loaded value. + * + * @throws MARSHAL if the reading has failed due any reason. + */ + public static Serializable read(InputStream input) + { + return Vio.read(input); + } + + /** + * Get the typecode of the value type. + * @return the typecode of the value type + */ + public static TypeCode type() + { + RecordTypeCode r = new RecordTypeCode(TCKind.tk_value); + return r; + } + + /** + * Write the value base into the given stream. + * + * If the passed value implements the {@link CustomMarshal}, + * the helper uses {@link CustomMarshal#marshal} + * to write the content in a user defined way. Otherwise, + * this implementation initialises the {@link ObjectOutputStream} + * and writes through it. + * + * @param output a stream to write to. + * + * @param value a value to write. + * + * @throws MARSHAL if the writing failed due any reason. + */ + public static void write(OutputStream output, Serializable value) + { + Vio.write(output, value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java b/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java new file mode 100644 index 000000000..ed9f1af5c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java @@ -0,0 +1,110 @@ +/* ValueBaseHolder.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.CORBA; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; +import org.omg.CORBA.portable.ValueBase; + +import java.io.Serializable; + +/** + * A holder to store a {@link ValueBase} that is handled as + * {@link Serializable} here. + * + * @since 1.3 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ValueBaseHolder + implements Streamable +{ + /** + * A stored value of the value base type. + */ + public Serializable value; + + /** + * Create an unitialised instance. + */ + public ValueBaseHolder() + { + } + + /** + * Create an instance, initialised into the given value. + * + * @param initial an initial value. + */ + public ValueBaseHolder(Serializable initial) + { + value = initial; + } + + /** + * Read fill in the value field by reading an instance from the + * given input stream. Uses {@link ValueBaseHelper} + * + * @param input a stream to read from. + */ + public void _read(InputStream input) + { + value = ValueBaseHelper.read(input); + } + + /** + * Get the typecode of the stored instance. Uses {@link ValueBaseHelper} + */ + public TypeCode _type() + { + return ValueBaseHelper.type(); + } + + /** + * Write the stored instance to the given output stream. + * Uses {@link ValueBaseHelper} + * + * @param output a stream to write to. + */ + public void _write(OutputStream output) + { + ValueBaseHelper.write(output, value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/ValueMember.java b/libjava/classpath/org/omg/CORBA/ValueMember.java new file mode 100644 index 000000000..9323c86f9 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ValueMember.java @@ -0,0 +1,124 @@ +/* ValueMember.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.CORBA; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The class, defining properties of the value member. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ValueMember + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2507594168537449114L; + + /** + * The typedef that represents the IDL type of the value member. + */ + public IDLType type_def; + + /** + * The repository ID of the value for that this member is defined + */ + public String defined_in; + + /** + * The repository ID of this value member itself. + */ + public String id; + + /** The name of the value member. */ + public String name; + + /** + * The version of the value in which this member is defined. + */ + public String version; + + /** The type of of this value member. */ + public TypeCode type; + + /** + * The type of access (public, private) of this value member. + * This field can be equal to either {@link PUBLIC_MEMBER#value} or + * {@link PRIVATE_MEMBER#value}. + */ + public short access; + + /** + * Create the value member with all fields initialised to default values + * (0 and <code>null</code>). + */ + public ValueMember() + { + } + + /** + * Create the value member, specifying the field values. + * + * @param a_name name. + * @param an_id id . + * @param is_defined_in id of the value where the member is defined. + * @param a_version version. + * @param a_type tye. + * @param a_type_def {@link IDLType} (typeded). + * @param an_access accessibility scope. Can be equal to either + * {@link PUBLIC_MEMBER#value} or {@link PRIVATE_MEMBER#value}. + */ + public ValueMember(String a_name, String an_id, String is_defined_in, + String a_version, TypeCode a_type, IDLType a_type_def, + short an_access + ) + { + name = a_name; + id = an_id; + defined_in = is_defined_in; + version = a_version; + type = a_type; + type_def = a_type_def; + access = an_access; + } +} diff --git a/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java b/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java new file mode 100644 index 000000000..b62f04d3c --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java @@ -0,0 +1,210 @@ +/* ValueMemberHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.TypeCodeHelper; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the value member. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ValueMemberHelper +{ + /** + * The cached typecode value, computed once. + */ + private static TypeCode typeCode = null; + + /** + * Used when creating typecodes with recursive value members. + */ + private static boolean active = false; + + /** + * Insert the value member into the given Any. + */ + public static void insert(Any a, ValueMember that) + { + OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } + + /** + * Extract the value member from the given Any. + */ + public static ValueMember extract(Any a) + { + return read(a.create_input_stream()); + } + + /** + * Create a typecode for this value member. + */ + public static synchronized TypeCode type() + { + if (typeCode == null) + { + synchronized (TypeCode.class) + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + + if (active) + { + return orb.create_recursive_tc(id()); + } + active = true; + + StructMember[] members = new StructMember[ 7 ]; + TypeCode member; + member = orb.create_string_tc(0); + member = + orb.create_alias_tc(IdentifierHelper.id(), "Identifier", + member + ); + members [ 0 ] = new StructMember("name", member, null); + member = orb.create_string_tc(0); + member = + orb.create_alias_tc(RepositoryIdHelper.id(), "RepositoryId", + member + ); + members [ 1 ] = new StructMember("id", member, null); + member = orb.create_string_tc(0); + member = + orb.create_alias_tc(RepositoryIdHelper.id(), "RepositoryId", + member + ); + members [ 2 ] = new StructMember("defined_in", member, null); + member = orb.create_string_tc(0); + member = + orb.create_alias_tc(VersionSpecHelper.id(), "VersionSpec", + member + ); + members [ 3 ] = new StructMember("version", member, null); + member = orb.create_string_tc(0); + member = orb.get_primitive_tc(TCKind.tk_TypeCode); + members [ 4 ] = new StructMember("type", member, null); + member = IDLTypeHelper.type(); + members [ 5 ] = new StructMember("type_def", member, null); + member = orb.get_primitive_tc(TCKind.tk_short); + member = + orb.create_alias_tc(VisibilityHelper.id(), "Visibility", + member + ); + members [ 6 ] = new StructMember("access", member, null); + typeCode = + orb.create_struct_tc(ValueMemberHelper.id(), "ValueMember", + members + ); + active = false; + } + } + } + return typeCode; + } + + /** + * Return the ValueMember repository id. + * + * @return "IDL:omg.org/CORBA/ValueMember:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/ValueMember:1.0"; + } + + /** + * Reads the value member from the given stream. + */ + public static ValueMember read(InputStream istream) + { + try + { + ValueMember value = new ValueMember(); + value.name = istream.read_string(); + value.id = istream.read_string(); + value.defined_in = istream.read_string(); + value.version = istream.read_string(); + value.type = TypeCodeHelper.read(istream); + value.type_def = IDLTypeHelper.read(istream); + value.access = istream.read_short(); + return value; + } + catch (UserException ex) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.UserException; + m.initCause(ex); + throw m; + } + } + + /** + * Writes the value member to the given stream. + */ + public static void write(OutputStream ostream, ValueMember value) + { + try + { + ostream.write_string(value.name); + ostream.write_string(value.id); + ostream.write_string(value.defined_in); + ostream.write_string(value.version); + TypeCodeHelper.write(ostream, value.type); + IDLTypeHelper.write(ostream, value.type_def); + ostream.write_short(value.access); + } + catch (UserException ex) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.UserException; + m.initCause(ex); + throw m; + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java b/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java new file mode 100644 index 000000000..b6e57f1d7 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java @@ -0,0 +1,116 @@ +/* VersionSpecHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A formal helper for the CORBA VersionSpec that is identical to the + * narrow string. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class VersionSpecHelper +{ + /** + * Insert the VersionSpec into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the VersionSpec from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an string alias typecode, named "VersionSpec". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "VersionSpec", orb.create_string_tc(0)); + } + + /** + * Return the VersionSpec repository id. + * @return "IDL:omg.org/CORBA/VersionSpec:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/VersionSpec:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param istream the stream to read from. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param ostream the stream to write into. + * @param value the string (VersionSpec) value to write. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/VisibilityHelper.java b/libjava/classpath/org/omg/CORBA/VisibilityHelper.java new file mode 100644 index 000000000..7fd5d91a7 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/VisibilityHelper.java @@ -0,0 +1,118 @@ +/* VisibilityHelper.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.CORBA; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for a Visibility that is mapped into java and CORBA + * <code>short</code>. The Visibility normally takes one of the two values, + * {@link PUBLIC_MEMBER#value} or {@link PRIVATE_MEMBER#value}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class VisibilityHelper +{ + /** + * Insert the Visibility into the given Any. + * Uses {@link Any#insert_short}. + */ + public static void insert(Any any, short that) + { + any.insert_short(that); + } + + /** + * Extract the Visibility from the given Any. + * Uses {@link Any#extract_short}. + */ + public static short extract(Any any) + { + return any.extract_short(); + } + + /** + * Return an alias of short, named "Visibility". + */ + public static TypeCode type() + { + TypeCode tshort = + OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_short); + return + OrbRestricted.Singleton.create_alias_tc(id(), "Visibility", tshort); + } + + /** + * Get the Visibility repository id. + * + * @return "IDL:omg.org/CORBA/Visibility:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/Visibility:1.0"; + } + + /** + * Read the visibility value (as short) from the CDR intput stream. + * + * Uses {@link InputStream#read_short()}. + * + * @param istream a stream to read from. + */ + public static short read(InputStream istream) + { + return istream.read_short(); + } + + /** + * Write the visibility value (as short) to the CDR output stream. + * + * USes {@link OutputStream#write_short(short)}. + * + * @param ostream a stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream ostream, short value) + { + ostream.write_short(value); + } +} diff --git a/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java b/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java new file mode 100644 index 000000000..fe4d41650 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java @@ -0,0 +1,143 @@ +/* WCharSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>char</code> + * (<code>WCharSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class WCharSeqHelper +{ + /** + * Extract the <code>char[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link WCharSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link WCharSeqHolder}. + */ + public static char[] extract(Any a) + { + WCharSeqHolder h = (WCharSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>char[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link WCharSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, char[] that) + { + WCharSeqHolder holder = new WCharSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>char[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static char[] read(InputStream input) + { + char[] value = new char[ input.read_long() ]; + input.read_wchar_array(value, 0, value.length); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>WCharSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_char); + } + + /** + * Writes the <code>char[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, char[] value) + { + output.write_long(value.length); + output.write_wchar_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java b/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java new file mode 100644 index 000000000..a1b04d1ef --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java @@ -0,0 +1,126 @@ +/* WCharSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>WCharSeq</code> that is mapped into + * java <code>char[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class WCharSeqHolder + implements Streamable +{ + /** + * The <code>char[]</code> (CORBA <code>WCharSeq</code>) value, + * held by this WCharSeqHolder. + */ + public char[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_wchar); + + /** + * Constructs an instance of WCharSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public WCharSeqHolder() + { + } + + /** + * Constructs an instance of WCharSeqHolder, + * initializing {@link #value} to the given <code>char[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public WCharSeqHolder(char[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_wchar_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new char[ input.read_long() ]; + input.read_wchar_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_wchar_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_wchar_array(value, 0, value.length); + } +} diff --git a/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java b/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java new file mode 100644 index 000000000..ea8eac627 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java @@ -0,0 +1,149 @@ +/* WStringSeqHelper.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with + * CORBA <code>wstring</code> array. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class WStringSeqHelper +{ + /** + * Extract the <code>String[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link WStringSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link WStringSeqHolder}. + */ + public static String[] extract(Any a) + { + WStringSeqHolder h = (WStringSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>String[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link WStringSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, String[] that) + { + WStringSeqHolder holder = new WStringSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>String[]</code> from the CORBA input stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static String[] read(InputStream input) + { + String[] value = new String[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + { + value [ i ] = input.read_wstring(); + } + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>wstring[]</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new ArrayTypeCode(TCKind.tk_string); + } + + /** + * Writes the <code>String[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, String[] value) + { + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + { + output.write_wstring(value [ i ]); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java b/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java new file mode 100755 index 000000000..b909210f3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java @@ -0,0 +1,131 @@ +/* WStringSeqHolder.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.CORBA; + +import gnu.CORBA.typecodes.ArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>wstring[]</code> that is mapped into + * java <code>String[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class WStringSeqHolder + implements Streamable +{ + /** + * The <code>String[]</code> (CORBA <code>wstring[]</code>) value, + * held by this WStringSeqHolder. + */ + public String[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final ArrayTypeCode typecode = + new ArrayTypeCode(TCKind.tk_wchar); + + /** + * Constructs an instance of WStringSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public WStringSeqHolder() + { + } + + /** + * Constructs an instance of WStringSeqHolder, + * initializing {@link #value} to the given <code>String</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public WStringSeqHolder(String[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link #value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>and then all strings. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new String[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + { + value [ i ] = input.read_wstring(); + } + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link #value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code> and then all strings. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + { + output.write_wstring(value [ i ]); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/WStringValueHelper.java b/libjava/classpath/org/omg/CORBA/WStringValueHelper.java new file mode 100644 index 000000000..a2b67ffec --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WStringValueHelper.java @@ -0,0 +1,193 @@ +/* WStringValueHelper.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.portable.BoxedValueHelper; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +import java.io.Serializable; + +/** + * Provides helper operations for the Wide String value type, treating a + * Wide String as a CORBA value type rather than as a primitive type. The OMG + * specification states this may be convenient in some specific + * cases. The typecode is different, but the reading/writing format in + * this implementation is the same as for the ordinary wide string. This is + * that Sun's IDL compiler (v1.4) would generate. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class WStringValueHelper + implements BoxedValueHelper +{ + /** + * The Wide String value helper repository Id. + */ + private static final String id = "IDL:omg.org/CORBA/WStringValue:1.0"; + + /** + * The Wide String typecode. + */ + private static final TypeCode twString = + OrbRestricted.Singleton.create_wstring_tc(0); + + /** + * Returns the String Value repository Id. + * @return "IDL:omg.org/CORBA/WStringValue:1.0", always. + */ + public String get_id() + { + return id; + } + + /** + * Returns the String Value repository Id. + * @return "IDL:omg.org/CORBA/WStringValue:1.0", always. + */ + public static String id() + { + return id; + } + + /** + * Read the wide string value from the input stream. + * + * @param istream a stream to read from. + * + * @return a string (delegates to read_wstring()). + */ + public Serializable read_value(InputStream istream) + { + return istream.read_wstring(); + } + + /** + * Write the given wide string value into the output stream. + * + * @param ostream a stream to write into. + * @param a_string a string to write. + */ + public void write_value(OutputStream ostream, Serializable a_string) + { + try + { + ostream.write_wstring((String) a_string); + } + catch (ClassCastException ex) + { + MARSHAL m = new MARSHAL("String expected"); + m.minor = Minor.ClassCast; + throw m; + } + } + + /** + * Extract the wide string from the given Any. The operation + * requires Any to hold a String value and not a String. + * + * @param an_any an Any to extract from. + * + * @return the extracted string. + */ + public static String extract(Any an_any) + { + if (an_any.type().equal(type())) + { + an_any.type(twString); + return an_any.extract_wstring(); + } + else + { + BAD_OPERATION bad = new BAD_OPERATION("WString value type expected"); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Insert the wide string into the given Any. After the operation, + * the Any will have a Wide String Value typecode and not a + * String or WString typecode. + * + * @param an_any an Any to insert into. + * + * @param that a string to insert. + */ + public static void insert(Any an_any, String that) + { + an_any.insert_wstring(that); + an_any.type(type()); + } + + /** + * Reads a wide string as a value type. + * + * @param in a stream to read value from. + */ + public static String read(InputStream in) + { + return in.read_wstring(); + } + + /** + * Create and return the value box typecode, named "WStringValue", with the + * content typecode being unbounded string. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_value_box_tc(id(), "WStringValue", twString); + } + + /** + * Writes a wide string as a value type. + * + * @param out a stream to write value into. + * + * @param a_string a string to write. + */ + public static void write(OutputStream out, String a_string) + { + out.write_wstring(a_string); + } +} diff --git a/libjava/classpath/org/omg/CORBA/WrongTransaction.java b/libjava/classpath/org/omg/CORBA/WrongTransaction.java new file mode 100644 index 000000000..fc869a267 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WrongTransaction.java @@ -0,0 +1,70 @@ +/* WrongTransaction.java -- Exception thrown due to out-of-bounds parameter + 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.CORBA; + +/** + * Thrown when the transaction scope mismatches. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class WrongTransaction + extends UserException +{ + + /** + * Constructs a default <code>WrongTransaction</code> exception, with + * no detail message. + */ + public WrongTransaction() + { + super(); + } + + /** + * Constructs a <code>WrongTransaction</code> exception using the specified + * message as the reason for throwing it. + * + * @param reason the reason, why the exception has been thrown. + */ + public WrongTransaction(String reason) + { + super(reason); + } + +} diff --git a/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java b/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java new file mode 100644 index 000000000..2854faaa0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java @@ -0,0 +1,142 @@ +/* WrongTransactionHelper.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.CORBA; + +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 WrongTransaction}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class WrongTransactionHelper +{ + /** + * Create the WrongTransaction typecode (structure, + * named "WrongTransaction"), no fields. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + return orb.create_exception_tc(id(), "WrongTransaction", members); + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the WrongTransaction into the given Any. + * + * @param any the Any to insert into. + * @param that the WrongTransaction to insert. + */ + public static void insert(Any any, WrongTransaction that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the WrongTransaction from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain WrongTransaction. + */ + public static WrongTransaction extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (WrongTransaction) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("WrongTransaction expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the WrongTransaction repository id. + * + * @return "IDL:omg.org/CORBA/WrongTransaction:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CORBA/WrongTransaction:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static WrongTransaction read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + WrongTransaction value = new WrongTransaction(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, WrongTransaction value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java b/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java new file mode 100644 index 000000000..db47b5dfc --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java @@ -0,0 +1,103 @@ +/* WrongTransactionHolder.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.CORBA; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the exception {@link WrongTransaction}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class WrongTransactionHolder implements Streamable +{ + /** + * The stored WrongTransaction value. + */ + public WrongTransaction value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public WrongTransactionHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public WrongTransactionHolder(WrongTransaction 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 = WrongTransactionHelper.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) + { + WrongTransactionHelper.write(output, value); + } + + /** + * Get the typecode of the WrongTransaction. + */ + public TypeCode _type() + { + return WrongTransactionHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java b/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java new file mode 100644 index 000000000..89f95d3c6 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java @@ -0,0 +1,199 @@ +/* _IDLTypeStub.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.CORBA; + +import gnu.CORBA.Minor; +import gnu.CORBA.TypeCodeHelper; + +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; + +import java.io.Serializable; + +/** + * The stub for the IDL type. This stub can be used to access the + * remote IDL type object, if its IOR is known. To create the + * working instance with the known IOR, pass {@link gnu.CORBA.IorDelegate} + * to the constructor. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _IDLTypeStub + extends ObjectImpl + implements IDLType, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 9150293942452453626L; + + /** + * Create the instance of the IDL type stub without + * the set delegate. The delegate must be set anyway before calling + * any remote method. + */ + public _IDLTypeStub() + { + } + + /** + * Create an instance with the given delegate. + * + * @see gnu.CORBA.IorDelegate + */ + public _IDLTypeStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Get the typecode of the remote IDL type object. The method is + * written following OMG specification, treating the typecode + * as a read only attribute rather than a method. This means, + * the operation name is "_get_type". + * + * @return a typecode, returned by the remote IDL type object. + */ + public TypeCode type() + { + InputStream in = null; + try + { + OutputStream out = _request("_get_type", true); + in = _invoke(out); + return TypeCodeHelper.read(in); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new org.omg.CORBA.MARSHAL(ex.getId()); + } + catch (RemarshalException rex) + { + return type(); + } + catch (UserException ex) + { + MARSHAL m = new MARSHAL(); + m.minor = Minor.UserException; + m.initCause(ex); + throw m; + } + finally + { + _releaseReply(in); + } + } + + /** + * Get the definition kind of the remote IDL type object. The method is + * written following OMG specification, treating the typecode + * as a read only attribute rather than a method. This means, + * the operation name is "_get_def_kind". + * + * @return a definition kind, returned by remote IDL type object. + */ + public DefinitionKind def_kind() + { + InputStream in = null; + try + { + OutputStream out = _request("_get_def_kind", true); + in = _invoke(out); + return DefinitionKindHelper.read(in); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new org.omg.CORBA.MARSHAL(ex.getId()); + } + catch (RemarshalException rex) + { + return def_kind(); + } + finally + { + _releaseReply(in); + } + } + + /** + * Destroy the remote IDL type object. + */ + public void destroy() + { + InputStream in = null; + try + { + OutputStream out = _request("destroy", true); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new org.omg.CORBA.MARSHAL(ex.getId()); + } + catch (RemarshalException rex) + { + destroy(); + } + finally + { + _releaseReply(in); + } + } + + /** + * Return the array of repository ids of the IDL type. + * + * @return "IDL:omg.org/CORBA/IDLType:1.0" and + * "IDL:omg.org/CORBA/IRObject:1.0", always. + */ + public String[] _ids() + { + return new String[] + { + "IDL:omg.org/CORBA/IDLType:1.0", "IDL:omg.org/CORBA/IRObject:1.0" + }; + } +} diff --git a/libjava/classpath/org/omg/CORBA/_PolicyStub.java b/libjava/classpath/org/omg/CORBA/_PolicyStub.java new file mode 100644 index 000000000..ebff735dc --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/_PolicyStub.java @@ -0,0 +1,174 @@ +/* _PolicyStub.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.CORBA; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; + +import java.io.Serializable; + +/** + * The Policy stub (proxy), used on the client side. + * The {@link Policy} methods contain the code for remote + * invocaton. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _PolicyStub + extends ObjectImpl + implements Policy, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 2453656196708903849L; + + /** + * Create the Policy stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _PolicyStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _PolicyStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { PolicyHelper.id() }; + } + + /** {@inheritDoc} */ + public void destroy() + { + InputStream input = null; + try + { + OutputStream output = _request("destroy", true); + input = _invoke(output); + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + destroy(); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public Policy copy() + { + InputStream input = null; + try + { + OutputStream output = _request("copy", true); + input = _invoke(output); + return PolicyHelper.read(input); + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + return copy(); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public int policy_type() + { + InputStream input = null; + try + { + OutputStream output = _request("policy_type", true); + input = _invoke(output); + + int returns = input.read_long(); + + return returns; + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + return policy_type(); + } + finally + { + _releaseReply(input); + } + } +} diff --git a/libjava/classpath/org/omg/CORBA/package.html b/libjava/classpath/org/omg/CORBA/package.html new file mode 100644 index 000000000..3815b19b0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/package.html @@ -0,0 +1,122 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA</title></head> + +<body> +This package provides the support of <a href="http://www.CORBA.org">CORBA</a>; +see <a href="#overview">overview</a> of the implemented functionality. +<p> +CORBA a system that applications use to work over networks. CORBA messages +are binary, not text oriented. They practically cary no "data wrapping" +information like XML <opening> </closing> tags. Hence CORBA +objects easier exchange large amounts of binary data. CORBA can work +in such data-intensive application areas as telecommunications or radio +broadcasting. Java programs connect to CORBA objects without care +about what platform they run on, where they exist in the network, or what +language they were written in. The remote CORBA objects appear to the +programmer as the ordinary Java objects and can be passed as +parameters in both remote or local method invocations. +</p><p> +The CORBA processing unit is divided into {@link org.omg.CORBA.Object} +that is exposed to the client and the servant +({@link org.omg.PortableServer.Servant} where the method, invoked on +object, is finally delegated. It can be multiple objects per servant or +multiple servants per object. The servant for particular object or +even particular call can be dynamically chosen at run time using +{@link org.omg.PortableServer.ServantManager}. +</p><p> +All stages of both local and remote invocations on CORBA objects can be +monitored and modified using {@link org.omg.PortableInterceptor.Interceptor}. +The interceptors can add an extra data to the CORBA message (these data +can be later accessed by other interceptor on remote side). +</p> +<a name="overview"> +<h4>Overview of the currently implemented CORBA functionality</h4> +The CORBA implementation in the Classpath project is now a working +prototype. +<ul> +<li>This prototype is interoperable with Sun's implementation v 1.4, +transferring object references, primitive types, narrow and wide strings, +arrays, structures and trees between these two platforms. +</li> +<li>The prototype provides interoperable support for the Abstract interface + and Value types. Those appear in 1.3, being a feature of CORBA 2.3. +</li> +<li>The remote exceptions are also transferred and handled as expected. +</li> +<li>The support for parsing stringified object references (IORs), both +Big and Little Endian encoded, is implemented. +</li> +<li>The redirection commands works, LOCATION_FORWARD_PERM changing the +target address until the application is restarted and LOCATION_FORWARD +redirecting for the current session only. +</li> +<li>Both Little and Big Endian encoded messages are accepted. The encoding +of the sent messages is the same as used in the stringified IOR reference +of that object or Big Endian, if no such data available. +</li> +<li>You can use both request-oriented (based on {@link org.omg.CORBA.Request} +and stream-oriented (based on {@link org.omg.CORBA.portable.ObjectImpl} +invocation models. The current release includes the working examples, +demonstrating the client-server communication using both methods. +</li> +<li>These examples also show, how to use the Classpath naming service. +</li> +<li>The IDL compiler is not yet written (and not even started), but as a + side effect of the required compatibility, the implementation seems +accepting the output of the Sun's idlj. +</li> +<li>The Portable Object Adapter is already released. For details on POA, +see the {@link org.omg.PortableServer} package.</li> +<li>We provide the implementation of the {@link org.omg.DynamicAny} +package. ORB returns the working DynAnyFactory that produces working +DynAny's as defined in OMG specification.</li> +<li>The Portable Interceptor is also complete. See +{@link org.omg.PortableInterceptor} package for details how to register +and use CORBA interceptors. +<li>All GNU Classpath classes in omg.org namespace are newly written using + the OMG .pdf document (Version 3.0.3, formal/04-03-12). +</li> +</ul> + + @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> + diff --git a/libjava/classpath/org/omg/CORBA/portable/ApplicationException.java b/libjava/classpath/org/omg/CORBA/portable/ApplicationException.java new file mode 100644 index 000000000..83a8aa8d1 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/ApplicationException.java @@ -0,0 +1,97 @@ +/* ApplicationException.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.CORBA.portable; + +import java.io.Serializable; + +/** + * This expection is thrown if the application throws an exception, + * defined as a part of its remote method definition. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class ApplicationException + extends Exception + implements Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2088103024111528125L; + + /** + * The input from where the exception parameters can be read. + */ + private final org.omg.CORBA.portable.InputStream m_input; + + /** + * The CORBA repository Id of the exception. + */ + private final String m_id; + + /** + * Creates an exception. + * + * @param id the CORBA repository Id of the exception. + * @param input the input from where the exception parameters can be read. + */ + public ApplicationException(String id, + org.omg.CORBA.portable.InputStream input + ) + { + m_id = id; + m_input = input; + } + + /** + * Get the CORBA repository Id of the exception. + */ + public String getId() + { + return m_id; + } + + /** + * Get the input stream from where the exception parameters can be read. + */ + public org.omg.CORBA.portable.InputStream getInputStream() + { + return m_input; + } +} diff --git a/libjava/classpath/org/omg/CORBA/portable/ApplicationException.jbx b/libjava/classpath/org/omg/CORBA/portable/ApplicationException.jbx new file mode 100644 index 000000000..0113ff3e0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/ApplicationException.jbx @@ -0,0 +1,6 @@ +[PropertyInfo] +[IconNames] + + + + diff --git a/libjava/classpath/org/omg/CORBA/portable/BoxedValueHelper.java b/libjava/classpath/org/omg/CORBA/portable/BoxedValueHelper.java new file mode 100644 index 000000000..47c2b9106 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/BoxedValueHelper.java @@ -0,0 +1,79 @@ +/* BoxedValueHelper.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.CORBA.portable; + +import java.io.Serializable; + +/** + * Provides a helper operations for the boxed value type. + * A boxed value type is a value type with no inheritance, no methods + * and with a single state member. No additional properties can + * be defined. It is an error to box value types. + * + * The value type may have its own helper, implementing + * this interface. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface BoxedValueHelper +{ + /** + * Get the repository id of this value type. + * + * @return a repository id. + */ + String get_id(); + + /** + * Read this value type from the CDR stream. + * + * @param istream is a stream to read from. + * + * @return a loaded value type. + */ + Serializable read_value(InputStream istream); + + /** + * Write this value type to the CDR stream. + * + * @param ostream a stream to write to. + * @param value a value to write. + */ + void write_value(OutputStream ostream, Serializable value); +} diff --git a/libjava/classpath/org/omg/CORBA/portable/CustomValue.java b/libjava/classpath/org/omg/CORBA/portable/CustomValue.java new file mode 100644 index 000000000..dc46e8e25 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/CustomValue.java @@ -0,0 +1,57 @@ +/* CustomValue.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.CORBA.portable; + +import org.omg.CORBA.CustomMarshal; + +/** + * If the value type provides the user defined methods for reading + * and writing its content, it must implement this interface for reading + * and writing the content in a user-defined default way. This is done by + * implementing the {@link CustomMarshal#marshal} and + * {@link CustomMarshal#unmarshal}. The user must provide the supporting code. + * + * @see StreamableValue for specifying the IDL compiler generated IO methods. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CustomValue + extends ValueBase, CustomMarshal +{ +} diff --git a/libjava/classpath/org/omg/CORBA/portable/Delegate.java b/libjava/classpath/org/omg/CORBA/portable/Delegate.java new file mode 100644 index 000000000..33812abe2 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/Delegate.java @@ -0,0 +1,436 @@ +/* Delegate.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.CORBA.portable; + +import gnu.java.lang.CPStringBuilder; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.Context; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.DomainManager; +import org.omg.CORBA.ExceptionList; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.NVList; +import org.omg.CORBA.NamedValue; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Policy; +import org.omg.CORBA.Request; +import org.omg.CORBA.SetOverrideType; + +/** + * Specifies a vendor specific implementation of the + * {@link org.omg.CORBA.Object} methods. The calls to these + * methods are forwarded to the object delegate that can be + * replaced, if needed. The first parameter is the actual + * CORBA object to that the operation must be applied. + * + * Some methods in this class are not abstract, but no implemented, + * thowing the {@link NO_IMPLEMENT}. This, however, does not mean that + * they are not implemented in the derived classes as well. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class Delegate +{ + /** + * Explains the reason of throwing the NO_IMPLEMENT. + */ + private static final String WHY = + "Following 1.4 API, this Delegate method must not be implemented. Override."; + + /** + * Create a request to invoke the method of this object. + * + * @param target the CORBA object, to that this operation must be applied. + * @param context a list of additional properties. + * @param operation the name of method to be invoked. + * @param parameters the method parameters. + * @param returns the container for tge method returned value. + * + * @return the created reaquest. + */ + public abstract Request create_request(org.omg.CORBA.Object target, + Context context, String operation, + NVList parameters, NamedValue returns + ); + + /** + * Create a request to invoke the method of this object, specifying + * context list and the list of the expected exception. + * + * @param target the CORBA object, to that this operation must be applied. + * @param context a list of additional properties. + * @param operation the name of method to be invoked. + * @param parameters the method parameters. + * @param returns the container for tge method returned value. + * @param exceptions the list of the possible exceptions that the method + * can throw. + * @param ctx_list the list of the context strings that need to be + * resolved and send as a context instance. + * + * @return the created reaquest. + */ + public abstract Request create_request(org.omg.CORBA.Object target, + Context context, String operation, + NVList parameters, NamedValue returns, + ExceptionList exceptions, + ContextList ctx_list + ); + + /** + * Duplicate the object reference. This does not make much sense for + * java platform and is just included for the sake of compliance with + * CORBA APIs. + * + * @param target the CORBA object, to that this operation must be applied. + * + * The method may return the object reference itself. + * + * @return as a rule, <code>this</code>. + */ + public abstract org.omg.CORBA.Object duplicate(org.omg.CORBA.Object target); + + /** + * Retrieve the domain managers for this object. + * + * @param target the CORBA object, to that this operation must be applied. + * + * @return the domain managers. + * + * @throws NO_IMPLEMENT, always (following the 1.4 specification). + */ + public DomainManager[] get_domain_managers(org.omg.CORBA.Object target) + { + throw new NO_IMPLEMENT(WHY); + } + + /** + * + * @param target the CORBA object, to that this operation must be applied. + * + * Get the <code>InterfaceDef</code> for this Object. + */ + public abstract org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object target); + + /** + * Returns the {@link Policy}, applying to this object. + * + * @param target the CORBA object, to that this operation must be applied. + * @param a_policy_type a type of policy to be obtained. + * @return a corresponding Policy object. + * + * @throws NO_IMPLEMENT, always (following the 1.4 specification). + */ + public Policy get_policy(org.omg.CORBA.Object target, int a_policy_type) + throws BAD_PARAM + { + throw new NO_IMPLEMENT(WHY); + } + + /** + * Get the hashcode this object reference. The same hashcode still + * does not means that the references are the same. From the other + * side, two different references may still refer to the same CORBA + * object. The returned value must not change during the object + * lifetime. + * + * @param target the CORBA object, to that this operation must be applied. + * @param maximum the maximal value to return. + * + * @return the hashcode. + */ + public abstract int hash(org.omg.CORBA.Object target, int maximum); + + /** + * Check if this object can be referenced by the given repository id. + * + * @param target the CORBA object, to that this operation must be applied. + * @param repositoryIdentifer the repository id. + * + * @return true if the passed parameter is a repository id of this + * CORBA object. + */ + public abstract boolean is_a(org.omg.CORBA.Object target, + String repositoryIdentifer + ); + + /** + * Return true if the other object references are equivalent, so far as + * it is possible to determine this easily. + * + * @param target the CORBA object, to that this operation must be applied. + * @param other the other object reference. + * + * @return true if both references refer the same object, false + * if they probably can refer different objects. + * + */ + public abstract boolean is_equivalent(org.omg.CORBA.Object target, + org.omg.CORBA.Object other + ); + + /** + * Returns true if the object is local. + * + * @param self the object to check. + * + * @return false, always (following 1.4 specs). Override to get + * functionality. + */ + public boolean is_local(org.omg.CORBA.Object self) + { + return false; + } + + /** + * Determines if the server object for this reference has already + * been destroyed. + * + * @param target the CORBA object, to that this operation must be applied. + * + * @return true if the object has been destroyed, false otherwise. + */ + public abstract boolean non_existent(org.omg.CORBA.Object target); + + /** + * Compares two objects for equality. The default implementations + * delegated call to {@link java.lang.Object#equals(java.lang.Object)}. + * + * @param self this CORBA object. + * @param other the other CORBA object. + * + * @return true if the objects are equal. + */ + public boolean equals(org.omg.CORBA.Object self, java.lang.Object other) + { + return self==other; + } + + /** + * Return the hashcode for this CORBA object. The default implementation + * delegates call to {@link #hash(org.omg.CORBA.Object, int)}, passing Integer.MAX_VALUE as an + * argument. + * + * @param target the object, for that the hash code must be computed. + * + * @return the hashcode. + */ + public int hashCode(org.omg.CORBA.Object target) + { + return hash(target, Integer.MAX_VALUE); + } + + /** + * Invoke the operation. + * + * @param target the invocation target. + * @param output the stream, containing the written arguments. + * + * @return the stream, from where the input parameters could be read. + * + * @throws ApplicationException if the application throws an exception, + * defined as a part of its remote method definition. + * + * @throws RemarshalException if reading(remarshalling) fails. + * + * @throws NO_IMPLEMENT, always (following the 1.4 specification). + */ + public InputStream invoke(org.omg.CORBA.Object target, + org.omg.CORBA.portable.OutputStream output + ) + throws ApplicationException, RemarshalException + { + throw new NO_IMPLEMENT(WHY); + } + + /** + * Provides the reference to ORB. + * + * @param target the object reference. + * + * @return the associated ORB. + * + * @throws NO_IMPLEMENT, always (following the 1.4 specification). + */ + public ORB orb(org.omg.CORBA.Object target) + { + throw new NO_IMPLEMENT(WHY); + } + + /** + * Free resoureces, occupied by this reference. The object implementation + * is not notified, and the other references to the same object are not + * affected. + * + * @param target the CORBA object, to that this operation must be applied. + */ + public abstract void release(org.omg.CORBA.Object target); + + /** + * Release the reply stream back to ORB after finishing reading the data + * from it. + * + * @param target the CORBA object, to that this operation must be applied. + * @param input the stream, normally returned by {@link #invoke} or + * {@link ApplicationException#getInputStream()}, can be null. + * + * The default method returns without action. + */ + public void releaseReply(org.omg.CORBA.Object target, + org.omg.CORBA.portable.InputStream input + ) + { + } + + /** + * Create a request to invoke the method of this CORBA object. + * + * @param target the CORBA object, to that this operation must be applied. + * @param operation the name of the method to invoke. + * + * @return the request. + */ + public abstract Request request(org.omg.CORBA.Object target, String operation); + + /** + * Create a request to invoke the method of this CORBA object. + * + * @param target the CORBA object, to that this operation must be applied. + * @param operation the name of the method to invoke. + * @param response_expected specifies if this is one way message or the + * response to the message is expected. + * + * @return the stream where the method arguments should be written. + */ + public org.omg.CORBA.portable.OutputStream request(org.omg.CORBA.Object target, + String operation, + boolean response_expected + ) + { + throw new NO_IMPLEMENT(WHY); + } + + /** + * This method is always called after invoking the operation on the + * local servant. + * + * The default method returns without action. + * + * @param self the object. + * @param servant the servant. + */ + public void servant_postinvoke(org.omg.CORBA.Object self, + ServantObject servant + ) + { + } + + /** + * Returns a servant that should be used for this request. + * The servant can also be casted to the expected type, calling the + * required method directly. + * + * @param self the object + * @param operation the operation + * @param expectedType the expected type of the servant. + * + * This implementation always returns null; override for different + * behavior. + * + * @return the servant or null if the servant is not an expected type + * of the method is not supported, for example, due security reasons. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public ServantObject servant_preinvoke(org.omg.CORBA.Object self, + String operation, Class expectedType + ) + { + return null; + } + + /** + * Returns a new object with the new policies either replacing or + * extending the current policies, depending on the second parameter. + * + * @param target the CORBA object, to that this operation must be applied. + * @param policies the policy additions or replacements. + * @param how either {@link SetOverrideType#SET_OVERRIDE} to override the + * current policies of {@link SetOverrideType#ADD_OVERRIDE} to replace + * them. + * + * @throws NO_IMPLEMENT, always (following the 1.4 specification). + * + * @return the new reference with the changed policies. + */ + public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object target, + Policy[] policies, + SetOverrideType how + ) + { + throw new NO_IMPLEMENT(WHY); + } + + /** + * Return a string representation of the passed object. + * + * @param self the CORBA object, to that the string representation must be + * returned. By default, the call is delegated to + * {@link java.lang.Object#toString()}. + * + * @return the string representation. + */ + public String toString(org.omg.CORBA.Object self) + { + if (self instanceof ObjectImpl) + { + ObjectImpl x = (ObjectImpl) self; + CPStringBuilder b = new CPStringBuilder(x.getClass().getName()); + b.append(": ["); + for (int i = 0; i < x._ids().length; i++) + { + b.append(x._ids() [ i ]); + b.append(" "); + } + b.append("]"); + return b.toString(); + } + else + return self.getClass().getName(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/portable/IDLEntity.java b/libjava/classpath/org/omg/CORBA/portable/IDLEntity.java new file mode 100644 index 000000000..1e67a8835 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/IDLEntity.java @@ -0,0 +1,50 @@ +/* IDLEntity.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.CORBA.portable; + +import java.io.Serializable; + +/** + * Indicates that this class has a corresponding Helper class. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface IDLEntity + extends Serializable +{ +} diff --git a/libjava/classpath/org/omg/CORBA/portable/IndirectionException.java b/libjava/classpath/org/omg/CORBA/portable/IndirectionException.java new file mode 100644 index 000000000..7fa46a1f6 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/IndirectionException.java @@ -0,0 +1,77 @@ +/* IndirectionException.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.CORBA.portable; + +import java.io.Serializable; + +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.SystemException; + +/** + * This exception is thrown when reading from the ORBs input streams + * certain specific data layouts (object recursive references to itself). + * These layouts are not supported by this CORBA implementation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class IndirectionException + extends SystemException + implements Serializable +{ + /** + * Use v 1.4 serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1923858944380721643L; + + /** + * The stream offset, indicating, where the error has occured. + */ + public int offset; + + /** + * Create the indirection exception. + * + * @param an_offset the stream offset, indicating the error position. + */ + public IndirectionException(int an_offset) + { + super("Indirection exception", 0, CompletionStatus.COMPLETED_NO); + offset = an_offset; + } +} diff --git a/libjava/classpath/org/omg/CORBA/portable/InputStream.java b/libjava/classpath/org/omg/CORBA/portable/InputStream.java new file mode 100644 index 000000000..aee540d01 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/InputStream.java @@ -0,0 +1,287 @@ +/* InputStream.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.CORBA.portable; + +import java.math.BigDecimal; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Context; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Object; +import org.omg.CORBA.Principal; +import org.omg.CORBA.TypeCode; + +/** + * This class is used to read CORBA IDL data types. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class InputStream + extends java.io.InputStream +{ + /** + * Return the Object Request Broker that has created this stream. + * @return the ORB. This must be overridden, as the default + * method always returns null. + */ + public ORB orb() + { + return null; + } + + /** + * This should read the CORBA context, but following the 1.4 API + * specification, it must not be implemented. + * + * @throws NO_IMPLEMENT, always. + */ + public Context read_Context() + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a CORBA (not java) object + * @return an object. + */ + public abstract org.omg.CORBA.Object read_Object(); + + /** + * Read a CORBA <code>char</code>. + * @return a value, corresponding the value of the CORBA <code>char</code>. + */ + public abstract char read_char(); + + /** + * Read a CORBA <code>double</code>. + * @return a value, corresponding the value of the CORBA <code>double</code>. + */ + public abstract double read_double(); + + /** + * Read a CORBA <code>float</code>. + * @return a value, corresponding the value of the CORBA <code>float</code>. + */ + public abstract float read_float(); + + /** + * Read a and array of CORBA float. + */ + public abstract void read_float_array(float[] value, int offset, int length); + + /** + * Read a CORBA <code>long</code> that is mapped into java <code>int</code>. + * @return an integer, corresponding the CORBA <code>long</code>. + */ + public abstract int read_long(); + + /** + * Read a CORBA <code>long long</code> that is mapped into java <code> + * long</code>. + * @return a value, corresponding the CORBA <code>long long</code> + */ + public abstract long read_longlong(); + + /** + * Read an array of CORBA <code>long long</code> + */ + public abstract void read_longlong_array(long[] value, int offset, int length); + + /** + * Read a CORBA <code>octed</code> that is mapped into java <code>byte</code>. + * @return a byte, corresponding the CORBA <code>octet</code>. + */ + public abstract byte read_octet(); + + /** + * Read a and array of CORBA octets that are mapped into java array of + * bytes. + */ + public abstract void read_octet_array(byte[] value, int offset, int length); + + /** + * Read a CORBA <code>short</code>. + * @return a value, corresponding the value of the CORBA <code>short</code>. + */ + public abstract short read_short(); + + public abstract void read_short_array(short[] value, int offset, int length); + + /** + * Read a CORBA unsigned long that is mapped into java <code>int</code>. + * @return an integer, matching the CORBA unsigned <code>long</code>. + */ + public abstract int read_ulong(); + + /** + * Read an array of CORBA unsigned long. + */ + public abstract void read_ulong_array(int[] value, int offset, int length); + + /** + * Should read from the stream, but following specification it does not. + * @throws java.io.IOException + * @throws NO_IMPLEMENT, always. + */ + public int read() + throws java.io.IOException + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a TypeCode. + * @return a TypeCode. + */ + public abstract TypeCode read_TypeCode(); + + /** + * Read a CORBA <code>boolean</code>. + * @return a value, corresponding the value of the CORBA <code>boolean</code>. + */ + public abstract boolean read_boolean(); + + /** + * Read a and array of CORBA boolean values. + */ + public abstract void read_boolean_array(boolean[] value, int offset, + int length + ); + + /** + * Read a and array of CORBA characters. + */ + public abstract void read_char_array(char[] value, int offset, int length); + + /** + * Read a and array of CORBA doubles. + */ + public abstract void read_double_array(double[] value, int offset, int length); + + /** + * Read a and array of CORBA longs. + */ + public abstract void read_long_array(int[] value, int offset, int length); + + /** + * Read a CORBA <code>string</code> that is mapped into java + * <code>String</code>. + * @return a value, corresponding the value of the CORBA + * <code>string</code>. + */ + public abstract String read_string(); + + /** + * Read a and array of CORBA unsigned longs. + */ + public abstract long read_ulonglong(); + + /** + * Read a and array of CORBA unsigned longs. + */ + public abstract void read_ulonglong_array(long[] value, int offset, int length); + + /** + * Read a CORBA unsigned short that is mapped into java <code>short</code>. + * @return a value of the CORBA unsigned <code>short</code>. + */ + public abstract short read_ushort(); + + /** + * Read a and array of CORBA unsigned shorts. + */ + public abstract void read_ushort_array(short[] value, int offset, int length); + + /** + * Read a CORBA object that is an instance of the class, passed + * as an argument. This method is not abstract, but following the + * specifications it must not be implemented. + * + * @param klass a CORBA class + * @throws NO_IMPLEMENT, always. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public Object read_Object(Class klass) + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a CORBA <code>Any</code>. + * @return an <code>Any</code>. + */ + public abstract Any read_any(); + + /** + * Read a CORBA <code>fixed</code>. This method is not abstract, + * but following the specifications it must not be implemented. + * + * @throws NO_IMPLEMENT, always. + */ + public BigDecimal read_fixed() + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a CORBA <code>wchar</code> that is mapped into java <code>char</code>. + * @return a value, corresponding the value of the CORBA <code>wchar</code>. + */ + public abstract char read_wchar(); + + public abstract void read_wchar_array(char[] value, int offset, int length); + + /** + * Read a CORBA <code>wstring</code> that is mapped into + * java <code>String</code>. + * @return a string, corresponding CORBA <code>wstring</code>. + */ + public abstract String read_wstring(); + + /** + * Read a CORBA <code>Principal</code>. + * @deprecated by CORBA 2.2 + * @return a Principal. + */ + public Principal read_Principal() + { + throw new NO_IMPLEMENT(); + } +} diff --git a/libjava/classpath/org/omg/CORBA/portable/InvokeHandler.java b/libjava/classpath/org/omg/CORBA/portable/InvokeHandler.java new file mode 100644 index 000000000..d4381204a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/InvokeHandler.java @@ -0,0 +1,66 @@ +/* InvokeHandler.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.CORBA.portable; + +import org.omg.CORBA.SystemException; + +/** + * Provides the dispatching mechanism for incoming call. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface InvokeHandler +{ + /** + * Invoke the object method. + * + * @param method the name of the method to invoke. + * @param input the input stream to read parameters from. + * @param handler the response handler, used for creating the reply. + * + * @return the output stream, returned by {@link ResponseHandler}. + * The response values are already written to that stream. + * + * @throws SystemException if invocation has failed due CORBA system exception. + */ + OutputStream _invoke(String method, org.omg.CORBA.portable.InputStream input, + ResponseHandler handler + ) + throws SystemException; +} diff --git a/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java new file mode 100644 index 000000000..c7ee707f3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java @@ -0,0 +1,401 @@ +/* ObjectImpl.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.CORBA.portable; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.Context; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.DomainManager; +import org.omg.CORBA.ExceptionList; +import org.omg.CORBA.NVList; +import org.omg.CORBA.NamedValue; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Policy; +import org.omg.CORBA.Request; +import org.omg.CORBA.SetOverrideType; + +/** + * The basic implementation of the CORBA Object. The most of the methods + * delegate the functionality to the {@link Delegate} that can be replaced + * by {@link #_set_delegate(Delegate)}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectImpl + implements org.omg.CORBA.Object +{ + /** + * The delegate, responsible for the method implementations. + */ + transient Delegate delegate; + + /** + * Create a request to invoke the method of this object, specifying + * context list and the list of the expected exception. + * + * @param context a list of additional properties. + * @param operation the name of method to be invoked. + * @param parameters the method parameters. + * @param returns the container for tge method returned value. + * @param exceptions the list of the possible exceptions that the method + * can throw. + * @param ctx_list the list of the context strings that need to be + * resolved and send as a context instance. + * + * @return the created reaquest. + */ + public Request _create_request(Context context, String operation, + NVList parameters, NamedValue returns, + ExceptionList exceptions, ContextList ctx_list + ) + { + return delegate.create_request(this, context, operation, parameters, + returns, exceptions, ctx_list + ); + } + + /** + * Create a request to invoke the method of this object. + * + * @param context a list of additional properties. + * @param operation the name of method to be invoked. + * @param parameters the method parameters. + * @param returns the container for tge method returned value. + * + * @return the created reaquest. + */ + public Request _create_request(Context context, String operation, + NVList parameters, NamedValue returns + ) + { + return delegate.create_request(this, context, operation, parameters, returns); + } + + /** + * Duplicate the object reference. This does not make much sense for + * java platform and is just included for the sake of compliance with + * CORBA APIs. + * + * The method may return the object reference itself. + * + * @return as a rule, <code>this</code>. + */ + public org.omg.CORBA.Object _duplicate() + { + return delegate.duplicate(this); + } + + /** + * Get vendor specific delegate, responsible for the implemented + * functionality. + */ + public Delegate _get_delegate() + { + return delegate; + } + + /** + * Retrieve the domain managers for this object. + * + * @return the domain managers. + */ + public DomainManager[] _get_domain_managers() + { + return delegate.get_domain_managers(this); + } + + /** + * Get the <code>InterfaceDef</code> for this Object. + */ + public org.omg.CORBA.Object _get_interface_def() + { + return delegate.get_interface_def(this); + } + + /** + * Returns the {@link Policy}, applying to this object. + * + * @param a_policy_type a type of policy to be obtained. + * @return a corresponding Policy object. + * + * @throws BAD_PARAM if the policy of the given type is not + * associated with this object, or if it is not supported by this ORB. + */ + public Policy _get_policy(int a_policy_type) + { + return delegate.get_policy(this, a_policy_type); + } + + /** + * Get the array of interface repository ids, defining this object. + */ + public abstract String[] _ids(); + + /** + * Get the hashcode this object reference. The same hashcode still + * does not means that the references are the same. From the other + * side, two different references may still refer to the same CORBA + * object. The returned value must not change during the object + * lifetime. + * + * @param max the maximal value to return. + * + * @return the hashcode. + */ + public int _hash(int max) + { + return delegate.hash(this, max); + } + + /** + * Invoke the operation. + * + * @param output the stream, containing the written arguments. + * + * @return the stream, from where the input parameters could be read. + * + * @throws ApplicationException if the application throws an exception, + * defined as a part of its remote method definition. + * + * @throws RemarshalException if reading(remarshalling) fails. + */ + public InputStream _invoke(OutputStream output) + throws org.omg.CORBA.portable.ApplicationException, + org.omg.CORBA.portable.RemarshalException + { + return delegate.invoke(this, output); + } + + /** + * Check if this object can be referenced by the given repository id. + * + * @param idl_id the repository id. + * + * @return true if the passed parameter is a repository id of this + * CORBA object. + */ + public boolean _is_a(String idl_id) + { + return delegate.is_a(this, idl_id); + } + + /** + * Return true if the other object references are equivalent, so far as + * it is possible to determine this easily. + * + * @param other the other object reference. + * + * @return true if both references refer the same object, false + * if they probably can refer different objects. Uses direct + * comparison if the delegate has not been set. + */ + public boolean _is_equivalent(org.omg.CORBA.Object other) + { + return (delegate == null) ? this == other + : delegate.is_equivalent(this, other); + } + + /** + * Returns true if the object is local. + * + * @return false, always (following 1.4 specs). Override to get + * functionality. + */ + public boolean _is_local() + { + return delegate.is_local(this); + } + + /** + * Determines if the server object for this reference has already + * been destroyed. + * + * @return true if the object has been destroyed, false otherwise. + */ + public boolean _non_existent() + { + return delegate.non_existent(this); + } + + /** + * Provides the reference to ORB. + * + * @return the associated ORB. + */ + public ORB _orb() + { + return delegate.orb(this); + } + + /** + * Free resoureces, occupied by this reference. The object implementation + * is not notified, and the other references to the same object are not + * affected. + */ + public void _release() + { + delegate.release(this); + } + + /** + * Release the reply stream back to ORB after finishing reading the data + * from it. + * + * @param stream the stream, normally returned by {@link #_invoke} or + * {@link ApplicationException#getInputStream()}, can be null. + */ + public void _releaseReply(InputStream stream) + { + if (delegate != null) + delegate.releaseReply(this, stream); + } + + /** + * Create a request to invoke the method of this CORBA object. + * + * @param method the name of the method to invoke. + * + * @return the request. + */ + public Request _request(String method) + { + return delegate.request(this, method); + } + + /** + * Create a request to invoke the method of this CORBA object. + * + * @param method the name of the method to invoke. + * @param response_expected specifies if this is one way message or the + * response to the message is expected. + * + * @return the stream where the method arguments should be written. + */ + public org.omg.CORBA.portable.OutputStream _request(String method, + boolean response_expected + ) + { + return delegate.request(this, method, response_expected); + } + + /** + * This method is always called after invoking the operation on the + * local servant. + * + * The default method returns without action. + * + * @param servant the servant. + */ + public void _servant_postinvoke(ServantObject servant) + { + delegate.servant_postinvoke(this, servant); + } + + /** + * Returns a servant that should be used for this request. + * The servant can also be casted to the expected type, calling the + * required method directly. + * + * @param method the operation + * @param expected_type the expected type of the servant. + * + * This implementation always returns null; override for different + * behavior. + * + * @return the servant or null if the servant is not an expected type + * of the method is not supported, for example, due security reasons. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public ServantObject _servant_preinvoke(String method, Class expected_type) + { + return delegate.servant_preinvoke(this, method, expected_type); + } + + /** + * Set the delegate, responsible for the implemented functionality. + * + * @param a_delegate a delegate, responsible for the implemented + * functionality. + */ + public void _set_delegate(Delegate a_delegate) + { + delegate = a_delegate; + } + + /** + * Returns a new object with the new policies either replacing or + * extending the current policies, depending on the second parameter. + * + * @param policies the policy additions or replacements. + * @param how either {@link SetOverrideType#SET_OVERRIDE} to override the + * current policies of {@link SetOverrideType#ADD_OVERRIDE} to replace + * them. + */ + public org.omg.CORBA.Object _set_policy_override(Policy[] policies, + SetOverrideType how + ) + { + return delegate.set_policy_override(this, policies, how); + } + + /** + * Check if this object is equal to another object. + * + * @param other the other object to compare. + * + * @return true if the objects are equal. + */ + public boolean equals(java.lang.Object other) + { + if (delegate == null) + return this == other; + else + return delegate.equals(this, other); + } + + /** + * Return the string representation of the passed object. + * + * @return the string representation. + */ + public String toString() + { + return delegate.toString(this); + } +} diff --git a/libjava/classpath/org/omg/CORBA/portable/OutputStream.java b/libjava/classpath/org/omg/CORBA/portable/OutputStream.java new file mode 100644 index 000000000..f40be2365 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/OutputStream.java @@ -0,0 +1,283 @@ +/* OutputStream.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.CORBA.portable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Context; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Principal; +import org.omg.CORBA.TypeCode; + +import java.io.IOException; + +import java.math.BigDecimal; + +/** + * This class is used to write CORBA IDL data types. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class OutputStream + extends java.io.OutputStream +{ + /** + * Returns an input stream with the same buffer. + * @return an input stream + */ + public abstract InputStream create_input_stream(); + + /** + * Return the Object Request Broker that has created this stream. + * @return the ORB. This must be overridden, as the default + * method always returns null. + */ + public ORB orb() + { + return null; + } + + /** + * Should write an byte (lower 8 bits) to the output stream, but, + * following specification, it does not and + * must be overridden to get a functionality. + * + * @param n an integer to write. + * + * @throws NO_IMPLEMENT, always. + * @throws IOException in overriden methods. + */ + public void write(int n) + throws IOException + { + throw new NO_IMPLEMENT(); + } + + /** + * Should write a CORBA context to the output stream, but, + * following the 1.4 specification, it does not and + * must be overridden to get a functionality. + * + * @throws NO_IMPLEMENT, always. + */ + public void write_Context(Context context, ContextList contexts) + { + throw new NO_IMPLEMENT(); + } + + /** + * Write CORBA (not java) Object. + */ + public abstract void write_Object(org.omg.CORBA.Object x); + + /** + * Should write a principal to the output stream, but, + * following specification, it does not and + * must be overridden to get a functionality. + * + * @deprecated by CORBA 2.2 + * + * @param principal a Principal to write + * + * @throws NO_IMPLEMENT, always. + */ + public void write_Principal(Principal principal) + { + throw new NO_IMPLEMENT(); + } + + /** + * Write TypeCode. + */ + public abstract void write_TypeCode(TypeCode x); + + /** + * Write CORBA <code>Any</code>. + */ + public abstract void write_any(Any x); + + /** + * Write CORBA <code>boolean</code>. + */ + public abstract void write_boolean(boolean x); + + /** + * Write CORBA <code>booelan[]</code>. + */ + public abstract void write_boolean_array(boolean[] x, int ofs, int len); + + /** + * Write CORBA <code>char</code>. + */ + public abstract void write_char(char x); + + /** + * Write CORBA <code>char[]</code>. + */ + public abstract void write_char_array(char[] chars, int offset, int length); + + /** + * Write CORBA <code>double</code>. + */ + public abstract void write_double(double x); + + /** + * Write CORBA <code>double[]</code>. + */ + public abstract void write_double_array(double[] x, int ofs, int len); + + /** + * Should write a BigDecimal number, but, following specification, + * it does not and must be overridden to get a functionality. + * + * @param fixed a number to write + * @throws NO_IMPLEMENT, always. + */ + public void write_fixed(BigDecimal fixed) + { + throw new NO_IMPLEMENT(); + } + + /** + * Write CORBA <code>float</code>. + */ + public abstract void write_float(float x); + + /** + * Write CORBA <code>float[]</code>. + */ + public abstract void write_float_array(float[] x, int ofs, int len); + + /** + * Write CORBA <code>long</code> that is mapped into java <code>int</code>. + */ + public abstract void write_long(int x); + + /** + * Write CORBA <code>long[]</code>. + */ + public abstract void write_long_array(int[] x, int ofs, int len); + + /** + * Write CORBA <code>long long</code> that is mapped into + * java <code>long</code>. + */ + public abstract void write_longlong(long x); + + /** + * Write CORBA <code>long long []</code>. + */ + public abstract void write_longlong_array(long[] x, int ofs, int len); + + /** + * Write CORBA <code>octed</code> that is mapped into java <code>byte</code> + */ + public abstract void write_octet(byte x); + + /** + * Write CORBA <code>octet[]</code>. + */ + public abstract void write_octet_array(byte[] x, int ofs, int len); + + /** + * Write CORBA <code>short</code>. + */ + public abstract void write_short(short x); + + /** + * Write CORBA <code>short[]</code>. + */ + public abstract void write_short_array(short[] x, int ofs, int len); + + /** + * Write CORBA <code>string</code>. + */ + public abstract void write_string(String x); + + /** + * Write unsigned CORBA <code>long</code> that is mapped into + * java <code>int</code>. + */ + public abstract void write_ulong(int x); + + /** + * Write array of CORBA unsigned longs. + */ + public abstract void write_ulong_array(int[] x, int ofs, int len); + + /** + * Write unsigned CORBA <code>long long </code> that is mapped into + * java <code>long</code>. + */ + public abstract void write_ulonglong(long x); + + /** + * Write array of unsigned CORBA long-longs. + */ + public abstract void write_ulonglong_array(long[] x, int ofs, int len); + + /** + * Write unsigned CORBA <code>short</code> that is mapped into + * java <code>short</code>. + */ + public abstract void write_ushort(short x); + + /** + * Write array of unsigned CORBA shorts. + */ + public abstract void write_ushort_array(short[] x, int ofs, int len); + + /** + * Write CORBA <code>wchar</code> that is mapped into + * java <code>char</code>. + */ + public abstract void write_wchar(char x); + + /** + * Write array of CORBA wchars. + */ + public abstract void write_wchar_array(char[] chars, int offset, int length); + + /** + * Write CORBA <code>wstring</code> that is mapped into + * java <code>string</code>. + */ + public abstract void write_wstring(String x); +} diff --git a/libjava/classpath/org/omg/CORBA/portable/RemarshalException.java b/libjava/classpath/org/omg/CORBA/portable/RemarshalException.java new file mode 100644 index 000000000..14836ea14 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/RemarshalException.java @@ -0,0 +1,59 @@ +/* RemarshalException.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.CORBA.portable; + +import java.io.Serializable; + +/** + * This is exception is potentially thrown by the _invoke() + * method of the object implementation, requiring to write the method + * parameters repeatedly. The parameters must be re-written as long as this + * exception is thrown. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class RemarshalException + extends Exception + implements Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -7025491253080954918L; +} diff --git a/libjava/classpath/org/omg/CORBA/portable/ResponseHandler.java b/libjava/classpath/org/omg/CORBA/portable/ResponseHandler.java new file mode 100644 index 000000000..1715b01b3 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/ResponseHandler.java @@ -0,0 +1,58 @@ +/* ResponseHandler.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.CORBA.portable; + +/** + * The interface, able to return streams, where the reply data can be + * marshalled. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface ResponseHandler +{ + /** + * Create a stream, suitable for writing a user exception. + */ + org.omg.CORBA.portable.OutputStream createExceptionReply(); + + /** + * Create a stream for writing an ordinary reply (not an exception). + */ + org.omg.CORBA.portable.OutputStream createReply(); +} diff --git a/libjava/classpath/org/omg/CORBA/portable/ServantObject.java b/libjava/classpath/org/omg/CORBA/portable/ServantObject.java new file mode 100644 index 000000000..253defc0a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/ServantObject.java @@ -0,0 +1,61 @@ +/* ServantObject.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.CORBA.portable; + + +/** + * Together with supporting methods in {@link ObjectImpl} and {@link Delegate}, + * provides mechanism for direct calls of clients, running on the same + * virtual machine (collocated). + * + * @see ObjectImpl#_servant_preinvoke(String, Class) + * @see ObjectImpl#_servant_postinvoke(ServantObject) + * @see Delegate#servant_preinvoke(org.omg.CORBA.Object, String, Class) + * @see Delegate#servant_postinvoke(org.omg.CORBA.Object, ServantObject) + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class ServantObject +{ + /** + * The real servant, that can be casted to the expected type, later + * invoking the methods directly. + */ + public java.lang.Object servant; +} diff --git a/libjava/classpath/org/omg/CORBA/portable/Streamable.java b/libjava/classpath/org/omg/CORBA/portable/Streamable.java new file mode 100644 index 000000000..c59ee2a02 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/Streamable.java @@ -0,0 +1,70 @@ +/* Streamable.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.CORBA.portable; + +import org.omg.CORBA.TypeCode; + +/** + * The base class for the Holder classess of IDL types. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface Streamable +{ + /** + * Fill in the value field for this holder by reading the required data + * from the given stream. + * + * @param input the input stream to read from. + */ + void _read(InputStream input); + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + TypeCode _type(); + + /** + * Write the value field to the given stream. + * + * @param output the output stream to write into. + */ + void _write(OutputStream output); +} diff --git a/libjava/classpath/org/omg/CORBA/portable/StreamableValue.java b/libjava/classpath/org/omg/CORBA/portable/StreamableValue.java new file mode 100644 index 000000000..13dbad210 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/StreamableValue.java @@ -0,0 +1,57 @@ +/* StreamableValue.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.CORBA.portable; + +import java.io.Serializable; + +/** + * If the value type does not provide the user defined methods for reading + * and writing its content, it must implement this interface for reading + * and writing the content in a default way. This is done by implementing + * the {@link Streamable#_read} and {@link Streamable#_write}. IDL compiler + * should generate the implementation of this interface automatically. + * + * @see CustomValue for specifying the user-defined io methods. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface StreamableValue + extends Streamable, Serializable, ValueBase, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/CORBA/portable/UnknownException.java b/libjava/classpath/org/omg/CORBA/portable/UnknownException.java new file mode 100644 index 000000000..a9b754b21 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/UnknownException.java @@ -0,0 +1,76 @@ +/* UnknownException.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.CORBA.portable; + +import java.io.Serializable; + +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.SystemException; + +/** + * The wrapper of the arbitrary exception into the System exception. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class UnknownException + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID (1.4) for interoperability. + */ + private static final long serialVersionUID = 1725238280802233450L; + + /** + * The original exception. + */ + public Throwable originalEx; + + /** + * Create a new unknown exception, wrapping a reason. + * + * @param reason an exception that has caused this unknown exception. + */ + public UnknownException(Throwable reason) + { + super("" + reason, 0, CompletionStatus.COMPLETED_MAYBE); + + originalEx = reason; + } +} diff --git a/libjava/classpath/org/omg/CORBA/portable/ValueBase.java b/libjava/classpath/org/omg/CORBA/portable/ValueBase.java new file mode 100644 index 000000000..167f532ac --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/ValueBase.java @@ -0,0 +1,74 @@ +/* ValueBase.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.CORBA.portable; + + +/** + * ValueBase is the basic interface for all CORBA value data types. A value + * type is something between CORBA structure and CORBA object. Like CORBA + * object, it can have methods, supporting some IDL-defined interface. + * However, like structures, they are local and passed by value, + * not by IOR reference. + * + * Unlike CORBA objects, values are not connected to any ORB by + * default; they hanlde the implemented functionality locally. The classes, + * required to implement that functionality, should either be pre-defined + * or they can be downloaded from the certain URL, defined as CodeBase. + * + * The value types can have both public and private members. They support + * inheritance. Value types can also be abstract. + * + * For transferring the value type data via stream, it must implement either + * {@link CustomValue} or {@link StreamableValue}. + * + * @since 1.3 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ValueBase + extends IDLEntity +{ + /** + * Get the truncatable repository ids. + * + * @return the array of repository ids, defining the base types, to that + * basic types this value base can be truncated. + */ + String[] _truncatable_ids(); +} diff --git a/libjava/classpath/org/omg/CORBA/portable/ValueFactory.java b/libjava/classpath/org/omg/CORBA/portable/ValueFactory.java new file mode 100644 index 000000000..aaffe8684 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/ValueFactory.java @@ -0,0 +1,62 @@ +/* ValueFactory.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.CORBA.portable; + +import java.io.Serializable; + +/** + * An interface for reading an instance of the value type + * from the input stream. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface ValueFactory +{ + /** + * Read the value type. The method is responsible both + * for creating a new instance of the value type and + * reading the content of this nstance from the stream. + * + * @param from_stream a stream to read from. + * + * @return a created value type, intialised with the data from + * the stream. + */ + Serializable read_value(org.omg.CORBA_2_3.portable.InputStream from_stream); +} diff --git a/libjava/classpath/org/omg/CORBA/portable/package.html b/libjava/classpath/org/omg/CORBA/portable/package.html new file mode 100644 index 000000000..8104136e0 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA/portable/package.html @@ -0,0 +1,50 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in org.omg.CORBA.portable package + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA.portable</title></head> + +<body> +<p>This package defines CDR streams, +used for communications between orbs, normally via network. +It also declares mechanisms, enabling the code, provided by one vendor, to run on the +{@link org.omg.CORBA.ORB}, implemented by another vendor.</p> + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> diff --git a/libjava/classpath/org/omg/CORBA_2_3/ORB.java b/libjava/classpath/org/omg/CORBA_2_3/ORB.java new file mode 100644 index 000000000..e45f03e2e --- /dev/null +++ b/libjava/classpath/org/omg/CORBA_2_3/ORB.java @@ -0,0 +1,129 @@ +/* ORB.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.CORBA_2_3; + +import javax.rmi.CORBA.Tie; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.portable.ValueFactory; + +/** + * This class should provide the {@link org.omg.CORBA.ORB}) ORB extensions, + * defined in the OMG CORBA version 2.3 specification. However in the + * Sun's API specification is written that this functionality is not + * implemented at least at least till 1.4 inclusive. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ORB + extends org.omg.CORBA.ORB +{ + /** + * Should return a defintion of the value type as described + * in the interface repository. + * + * @param repository_id a value type repository id. + * + * @return never + * @throws BAD_PARAM never + * @throws NO_IMPLEMENT, always. + * + * @see org.omg.CORBA.portable.ValueBase + */ + public org.omg.CORBA.Object get_value_def(String repository_id) + throws BAD_PARAM + { + throw new NO_IMPLEMENT(); + } + + /** + * This should register the given value factory under the given + * repository id. + * + * @param repository_id a repository id + * + * @return never + * @throws NO_IMPLEMENT, always. + */ + public ValueFactory register_value_factory(String repository_id, + ValueFactory factory + ) + { + throw new NO_IMPLEMENT(); + } + + /** + * This should unregister the given value factory under the given + * repository id. + * + * @param repository_id a repository id + * + * @throws NO_IMPLEMENT, always. + */ + public void unregister_value_factory(String repository_id) + { + throw new NO_IMPLEMENT(); + } + + /** + * This should find a suitable value factory to create an instance + * of the value type when is being read (unmarshaled) from the + * stream. + * + * @param repository_id a repository id + * + * @return never + * @throws NO_IMPLEMENT, always. + */ + public ValueFactory lookup_value_factory(String repository_id) + { + throw new NO_IMPLEMENT(); + } + + /** + * This method is called by RMI-IIOP {@link Tie#orb(ORB)}, + * passing <code>this</code> as parameter. The ORB will try to connect + * that tie as one of its objects. + */ + public void set_delegate(java.lang.Object wrapper) + { + throw new NO_IMPLEMENT(); + } +} diff --git a/libjava/classpath/org/omg/CORBA_2_3/package.html b/libjava/classpath/org/omg/CORBA_2_3/package.html new file mode 100644 index 000000000..254e6409a --- /dev/null +++ b/libjava/classpath/org/omg/CORBA_2_3/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA_2_3</title></head> + +<body> +<p>This package supports the ORB extendsions that appeared since CORBA 2_3.</p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/Delegate.java b/libjava/classpath/org/omg/CORBA_2_3/portable/Delegate.java new file mode 100644 index 000000000..a3d8ea933 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA_2_3/portable/Delegate.java @@ -0,0 +1,67 @@ +/* Delegate.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA_2_3.portable; + +/** + * Extends the previous version of the Delegate by one additional method, + * defined in CORBA 2_3 . + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class Delegate + extends org.omg.CORBA.portable.Delegate +{ + /** + * Returns the codebase for the provided object reference. + * A codebase is a location information (for instance, URL), specifying, + * where the missing parts of the object code can be downloaded. This + * is important for the value type objects that handle they method calls + * locally and hence must have the local copy of the implementing code. + * + * This method must be overridden to get functionality, the default method + * always returns an empty string. + * + * @return normally, an agreed location information, specifying, where + * the supporting code (like java classes) can be found. + */ + public String get_codebase(org.omg.CORBA.Object self) + { + return ""; + } +} diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java new file mode 100644 index 000000000..b457abe98 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java @@ -0,0 +1,209 @@ +/* InputStream.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.CORBA_2_3.portable; + +import gnu.CORBA.CDR.Vio; + +import org.omg.CORBA.CustomMarshal; +import org.omg.CORBA.portable.BoxedValueHelper; +import org.omg.CORBA.portable.StreamableValue; + +import java.io.Serializable; + +/** + * This class defines a new CDR input stream methods, added since + * CORBA 2.3. + * + * This class is abstract; no direct instances can be instantiated. + * Also, up till v 1.4 inclusive there are no methods that would + * return it, and only one unimplemented interface, + * {@link org.omg.CORBA.portable.ValueFactory }, needs it as a parameter. + * + * However since 1.3 all methods, declared as returning an + * org.omg.CORBA.portable.InputStream actually return the instance of this + * derived class and the new methods are accessible after the casting + * operation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class InputStream + extends org.omg.CORBA.portable.InputStream +{ + /** + * Read the abstract interface. An abstract interface can be either + * CORBA value type or CORBA object and is returned as an abstract + * java.lang.Object. + * + * As specified in OMG specification, this reads a single + * boolean and then delegates either to {@link #read_Object()} (for false) + * or to {@link #read_value()} (for true). + * + * @return an abstract interface, unmarshaled from the stream. + */ + public Object read_abstract_interface() + { + boolean isObject = read_boolean(); + + if (isObject) + return read_Object(); + else + return read_value(); + } + + /** + * Read the abstract interface, corresponding to the passed type. + * An abstract interface can be either CORBA value type or CORBA + * object and is returned as an abstract java.lang.Object. + * + * As specified in OMG specification, this reads a single + * boolean and then delegates either to {@link #read_Object(Class)} (for false) + * or to {@link #read_value(Class)} (for true). + * + * @param clz a base class for the abstract interface. + * + * @return an abstract interface, unmarshaled from the stream + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public Object read_abstract_interface(Class clz) + { + boolean isValue = read_boolean(); + + if (isValue) + return read_value(clz); + else + return read_Object(clz); + } + + /** + * Read a value type structure, extracting the repository id + * from the input stream itself. The repository id is optional + * in the value type record, but it must be present for this + * method to succeed. The {@link OutputStream} of this + * implementation always stores the repository id. + * + * The casts the streams ORB into a CORBA 2.3 ORB and then + * searched for a suitable value factory, where it delegates + * the functionality. + * + * If you know the exact class or can create an unitialised instance + * of the value type, it is recommended (faster) to use + * {@link #read_value(Class)} or {@link #read_value(Serializable)} + * instead. + * + * @return an value type structure, unmarshaled from the stream + */ + public Serializable read_value() + { + return Vio.read(this); + } + + /** + * Read a value type structure, corresponing to the passed type. + * As the type is known, the repository Id in the input stream is + * optional an not required. The codebase, if present, is also ignored. + * + * The passed class must implement either {@link CustomMarshal} + * for the user-defined reading operations or {@link StreamableValue} + * for the standard (generated by IDL compiler) reading operations. + * Also, it must have the parameterless constructor to create a new + * instance. + * + * @param clz a base class for a value type. + * + * @return an value type structure, unmarshaled from the stream + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public Serializable read_value(Class clz) + { + return Vio.read(this, clz); + } + + /** + * Read a value type structure content, when the unitialised + * instance is passed as a parameter. It is a fastest method to read + * a value type. + * + * As the type is known, the repository Id in the input stream is + * optional an not required. The codebase, if present, is also ignored. + * + * The passed instance must implement either {@link CustomMarshal} + * for the user-defined reading operations or {@link StreamableValue} + * for the standard (generated by IDL compiler) reading operations. + * + * @param unitialised_value the unitialised value. + * + * @return same value, filled in by the stream content. + */ + public Serializable read_value(Serializable unitialised_value) + { + return (Serializable) Vio.read(this, unitialised_value, null); + } + + /** + * Read a value type structure, having the given repository id. + * The casts the streams ORB into a CORBA 2.3 ORB and then + * searched for a suitable value factory, where it delegates + * the functionality. + * + * If you know the exact class or can create an unitialised instance + * of the value type, it is recommended (faster) to use + * {@link #read_value(Class)} or {@link #read_value(Serializable)} + * instead. + * + * @param repository_id a repository id of the value type. + * + * @return an value type structure, unmarshaled from the stream + */ + public Serializable read_value(String repository_id) + { + return Vio.read(this, repository_id); + } + + /** + * Use the provided boxed value helper to read the value. + * + * @param helper a helper for reading the value from the stream. + * + * @return an value type structure, unmarshaled from the stream. + */ + public Serializable read_value(BoxedValueHelper helper) + { + return Vio.read(this, helper); + } +} diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/ObjectImpl.java b/libjava/classpath/org/omg/CORBA_2_3/portable/ObjectImpl.java new file mode 100644 index 000000000..552439189 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA_2_3/portable/ObjectImpl.java @@ -0,0 +1,82 @@ +/* ObjectImpl.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.CORBA_2_3.portable; + +import org.omg.CORBA.BAD_OPERATION; + +/** + * Extends the previous version of the CORBA object by one additional method, + * defined in CORBA 2_3 . See ancestor for details about the CORBA object. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectImpl + extends org.omg.CORBA.portable.ObjectImpl +{ + /** + * Returns the codebase for the provided object reference. + * A codebase is a location information (for instance, URL), specifying, + * where the missing parts of the object code can be downloaded. This + * is important for the value type objects that handle they method calls + * locally and hence must have the local copy of the implementing code. + * + * This implementation expects that the object delegate is set and is + * an instance of the org.omg.CORBA_2_3.portable.Delegate. If casts + * the set delegate to the given type and invokes + * {@link org.omg.CORBA_2_3.portable.Delegate#get_codebase}. + * + * @return normally, an agreed location information, specifying, where + * the supporting code (like java classes) can be found. + * + * @throws BAD_OPERATION if the object delegate is not an instance + * of org.omg.CORBA_2_3.portable.Delegate. + */ + public String _get_codebase() + { + Object delegate = _get_delegate(); + if (delegate instanceof org.omg.CORBA_2_3.portable.Delegate) + return ((org.omg.CORBA_2_3.portable.Delegate) delegate).get_codebase(this); + else if (delegate != null) + throw new BAD_OPERATION(delegate.getClass().getName() + + " is not a org.omg.CORBA_2_3.portable.Delegate" + ); + else + throw new BAD_OPERATION("The delegate not set."); + } +} diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java new file mode 100644 index 000000000..e9496ffce --- /dev/null +++ b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java @@ -0,0 +1,161 @@ +/* OutputStream.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.CORBA_2_3.portable; + +import gnu.CORBA.CDR.Vio; + +import org.omg.CORBA.portable.BoxedValueHelper; +import org.omg.CORBA.portable.CustomValue; +import org.omg.CORBA.portable.StreamableValue; +import org.omg.CORBA.portable.ValueBase; + +import java.io.Serializable; + +/** + * This class defines a new CDR input stream methods, added since + * CORBA 2.3. + * + * This class is abstract; no direct instances can be instantiated. + * Also, up till v 1.4 inclusive there are no methods that would + * return it directly. + * + * However since 1.3 all methods, declared as returning an + * org.omg.CORBA.portable.InputStream actually return the instance of this + * derived class and the new methods are accessible after the casting + * operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class OutputStream + extends org.omg.CORBA.portable.OutputStream +{ + /** + * Writes an abstract interface to the stream. An abstract interface can be + * eithe CORBA object or value type and is written as a union with the boolean + * discriminator (false for objects, true for value types). + * + * The object from value is separated by fact that all values implement the + * {@link ValueBase} interface. Also, the passed parameter is treated as value + * it it does not implement CORBA Object. + * + * @param an_interface an abstract interface to write. + */ + public void write_abstract_interface(java.lang.Object an_interface) + { + boolean isObject = !(an_interface instanceof ValueBase) + && an_interface instanceof org.omg.CORBA.Object; + + write_boolean(isObject); + + if (isObject) + write_Object((org.omg.CORBA.Object) an_interface); + else + write_value((Serializable) an_interface); + + } + + /** + * Writes a value type into the output stream. + * + * The value type must implement either {@link CustomValue} (for user-defined + * writing method) or {@link StreamableValue} (for standard writing using code, + * generated by IDL compiler). + * + * The written record will have a repository id, matching the class of the + * passed object. The codebase will not be written. + * + * @param value a value type object to write. + */ + public void write_value(Serializable value) + { + Vio.write(this, value); + } + + /** + * Write value to the stream using the boxed value helper. + * + * The value type must implement either {@link CustomValue} + * (for user-defined writing method) or {@link StreamableValue} + * (for standard writing using code, generated by IDL compiler). + * + * @param value a value to write. + * @param helper a helper, responsible for the writing operation. + */ + public void write_value(Serializable value, BoxedValueHelper helper) + { + Vio.write(this, value, helper); + } + + /** + * Writes a value type into the output stream, stating it is an + * instance of the given class. The written record + * will have a repository id, matching the passed class. + * The codebase will not be written. It the object + * being written is an instance of the different class, this results + * writing two Id inheritance hierarchy. + * + * The value type must implement either {@link CustomValue} + * (for user-defined writing method) or {@link StreamableValue} + * (for standard writing using code, generated by IDL compiler). + * + * @param value a value type object to write. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public void write_value(Serializable value, Class clz) + { + Vio.write(this, value, clz); + } + + /** + * Writes a value type into the output stream, stating it has the given + * repository id. + * + * The value type must implement either {@link CustomValue} (for user-defined + * writing method) or {@link StreamableValue} (for standard writing using code, + * generated by IDL compiler). + * + * @param repository_id a repository id of the value type. + * + * @param value a value type object to write. + */ + public void write_value(Serializable value, String repository_id) + { + Vio.write(this, value, repository_id); + } +} diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/package.html b/libjava/classpath/org/omg/CORBA_2_3/portable/package.html new file mode 100644 index 000000000..edf9eb731 --- /dev/null +++ b/libjava/classpath/org/omg/CORBA_2_3/portable/package.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA_2_3.portable</title></head> + +<body> +<p>This package supports the communication extensions that appeared since CORBA 2_3. +It mainly provides methods for input and output of value types. </p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/CosNaming/Binding.java b/libjava/classpath/org/omg/CosNaming/Binding.java new file mode 100644 index 000000000..8f6e9973b --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/Binding.java @@ -0,0 +1,81 @@ +/* Binding.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.CosNaming; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the binding with the given name and type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class Binding + implements IDLEntity +{ + /** + * The binding type holds value ncontext for bindings, + * created with operations bind_context, rebind_context or + * bind_new_context. It holds value nobject of all other + * possible bindings. + */ + public BindingType binding_type; + + /** + * The binding name, consisting of the number of the name components. + */ + public NameComponent[] binding_name; + + /** + * Create an empty binding. + */ + public Binding() + { + } + + /** + * Create the binding, initialised to the given values. + * @param a_name the binding name. + * @param a_type the binding type. + */ + public Binding(NameComponent[] a_name, BindingType a_type) + { + binding_name = a_name; + binding_type = a_type; + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingHelper.java b/libjava/classpath/org/omg/CosNaming/BindingHelper.java new file mode 100644 index 000000000..ebd9144c8 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingHelper.java @@ -0,0 +1,135 @@ +/* BindingHelper.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.CosNaming; + +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 {@link Binding}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class BindingHelper +{ + /** + * The {@link Binding} repository id. + */ + private static String _id = "IDL:omg.org/CosNaming/Binding:1.0"; + + /** + * Extract the binding from the given {@link Any}. + */ + public static Binding extract(Any a) + { + try + { + return ((BindingHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Binding expected"); + bad.minor = Minor.Any; + bad.initCause(ex); + throw bad; + } + } + + /** + * Return the binding repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the binding into the given {@link Any}. + */ + public static void insert(Any a, Binding that) + { + a.insert_Streamable(new BindingHolder(that)); + } + + /** + * Read the binding from the given CDR stream. + */ + public static Binding read(InputStream istream) + { + Binding value = new Binding(); + value.binding_name = NameHelper.read(istream); + value.binding_type = BindingTypeHelper.read(istream); + return value; + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + + StructMember[] members = new StructMember[ 2 ]; + TypeCode member; + member = NameComponentHelper.type(); + member = orb.create_sequence_tc(0, member); + member = orb.create_alias_tc(NameHelper.id(), "Name", member); + members [ 0 ] = new StructMember("binding_name", member, null); + member = BindingTypeHelper.type(); + members [ 1 ] = new StructMember("binding_type", member, null); + return orb.create_struct_tc(id(), "Binding", members); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, Binding value) + { + NameHelper.write(ostream, value.binding_name); + BindingTypeHelper.write(ostream, value.binding_type); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingHolder.java b/libjava/classpath/org/omg/CosNaming/BindingHolder.java new file mode 100644 index 000000000..d57d9030f --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingHolder.java @@ -0,0 +1,94 @@ +/* BindingHolder.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.CosNaming; + +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the binding type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class BindingHolder + implements Streamable +{ + /** + * The stored binding type. + */ + public Binding value; + + /** + * Create an empty instance. + */ + public BindingHolder() + { + } + + /** + * Create the intialised holder. + */ + public BindingHolder(Binding initialValue) + { + value = initialValue; + } + + /** + * Read the holder value from the CDR stream. + */ + public void _read(org.omg.CORBA.portable.InputStream i) + { + value = BindingHelper.read(i); + } + + /** + * Return the binding type code. + */ + public org.omg.CORBA.TypeCode _type() + { + return BindingHelper.type(); + } + + /** + * Write the holder value to the CDR stream. + */ + public void _write(org.omg.CORBA.portable.OutputStream o) + { + BindingHelper.write(o, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingIterator.java b/libjava/classpath/org/omg/CosNaming/BindingIterator.java new file mode 100644 index 000000000..ef2aca4ab --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingIterator.java @@ -0,0 +1,87 @@ +/* BindingIterator.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.CosNaming; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The iterator for seing the available bindings. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface BindingIterator + extends BindingIteratorOperations, org.omg.CORBA.Object, Serializable, + IDLEntity +{ + /** + * Destroy the iterator on the server side. This must always be + * called, as otherwise the iterator will remain on the server even + * after the client application terminates. + * + * @specnote since 1.3 this method has moved into BindingIteratorOperations. + */ + void destroy(); + + /** + * Return the desired amount of bindings. + * + * @param amount the maximal number of bindings to return. + * @param a_list a holder to store the returned bindings. + * + * @return false if there are no more bindings available, + * true otherwise. + * + * @specnote since 1.3 this method has moved into BindingIteratorOperations. + */ + boolean next_n(int amount, BindingListHolder a_list); + + /** + * Return the next binding. + * + * @param a_binding a holder, where the next binding will be stored. + * + * @return false if there are no more bindings available, true + * otherwise. + * + * @specnote since 1.3 this method has moved into BindingIteratorOperations. + */ + boolean next_one(BindingHolder a_binding); +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java new file mode 100644 index 000000000..676cffea0 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java @@ -0,0 +1,173 @@ +/* BindingIteratorHelper.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.CosNaming; + +import gnu.CORBA.Minor; +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.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link BindingIterator} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class BindingIteratorHelper +{ + /** + * The {@link BindingIterator} repository id. + */ + private static String _id = "IDL:omg.org/CosNaming/BindingIterator:1.0"; + + /** + * Extract the binding iterator from the given {@link Any}. + */ + public static BindingIterator extract(Any a) + { + try + { + return ((BindingIteratorHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Binding iterator expected"); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the binding iterator repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the binding iterator into the given {@link Any}. + */ + public static void insert(Any a, BindingIterator that) + { + a.insert_Streamable(new BindingIteratorHolder(that)); + } + + /** + * Narrow the given object to the BindingIterator. The narrowing + * means either direct casting or re-instantiating with the same + * delegate. + * + * @param obj the object to cast. + * + * @return the casted binding iterator. + */ + public static BindingIterator narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof BindingIterator) + return (BindingIterator) obj; + else if (!obj._is_a(id())) + throw new BAD_PARAM(); + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _BindingIteratorStub(delegate); + } + } + + /** + * Narrow the given object to the BindingIterator. No type-checking is + * performed to verify that the object actually supports the requested type. + * The {@link BAD_OPERATION} will be thrown if unsupported operations are + * invoked on the new returned reference, but no failure is expected at the + * time of the unchecked_narrow. See OMG issue 4158. + * + * @param obj the object to cast. + * + * @return the casted binding iterator. + * + * @since 1.5 + */ + public static BindingIterator unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof BindingIterator) + return (BindingIterator) obj; + else + { + // Do not call the _is_a(..). + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _BindingIteratorStub(delegate); + } + } + + /** + * Read the exception from the given CDR stream. + */ + public static BindingIterator read(InputStream istream) + { + return narrow(istream.read_Object(_BindingIteratorStub.class)); + } + + /** + * Create the type code for the BindingIterator. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "BindingIterator"); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, BindingIterator value) + { + ostream.write_Object((org.omg.CORBA.Object) value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorHolder.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorHolder.java new file mode 100644 index 000000000..195e97e3f --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorHolder.java @@ -0,0 +1,97 @@ +/* BindingIteratorHolder.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.CosNaming; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder to store the binding iterator. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class BindingIteratorHolder + implements Streamable +{ + /** + * The stored binding iterator. + */ + public BindingIterator value; + + /** + * Create an empty instance of this holder. + */ + public BindingIteratorHolder() + { + } + + /** + * Create the intialised instance. + */ + public BindingIteratorHolder(BindingIterator initialValue) + { + value = initialValue; + } + + /** + * Read the holder value from the CDR stream. + */ + public void _read(InputStream in) + { + value = BindingIteratorHelper.read(in); + } + + /** + * Returen the type code of the binding iterator. + */ + public TypeCode _type() + { + return BindingIteratorHelper.type(); + } + + /** + * Write the intialised value to the CDR stream. + */ + public void _write(OutputStream out) + { + BindingIteratorHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorOperations.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorOperations.java new file mode 100644 index 000000000..b9995c210 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorOperations.java @@ -0,0 +1,78 @@ +/* BindingIterator.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.CosNaming; + +/** + * The operations, applicable for an iterator for seing the available + * bindings. + * + * @since 1.3 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface BindingIteratorOperations +{ + /** + * Destroy the iterator on the server side. This must always be + * called, as otherwise the iterator will remain on the server even + * after the client application terminates. + */ + void destroy(); + + /** + * Return the desired amount of bindings. + * + * @param amount the maximal number of bindings to return. + * @param a_list a holder to store the returned bindings. + * + * @return false if there are no more bindings available, + * true otherwise. + */ + boolean next_n(int amount, BindingListHolder a_list); + + /** + * Return the next binding. + * + * @param a_binding a holder, where the next binding will be stored. + * + * @return false if there are no more bindings available, true + * otherwise. + */ + boolean next_one(BindingHolder a_binding); +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java new file mode 100644 index 000000000..9adc884b8 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java @@ -0,0 +1,131 @@ +/* BindingIteratorPOA.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.CosNaming; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; + +/** + * The binding iterator servant, used in POA-based naming service + * implementations. + * + * @since 1.4 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class BindingIteratorPOA + extends Servant + implements BindingIteratorOperations, InvokeHandler +{ + /** @inheritDoc */ + public String[] _all_interfaces(POA poa, byte[] object_ID) + { + return new String[] { BindingIteratorHelper.id() }; + } + + /** + * Call the required method. + */ + public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) + { + OutputStream out = null; + + // We suppose that the next_n should be the most popular. + if (method.equals("next_n")) + { + // The next_n has been invoked. + int amount = in.read_ulong(); + BindingListHolder a_list = new BindingListHolder(); + + boolean result = next_n(amount, a_list); + + out = rh.createReply(); + out.write_boolean(result); + BindingListHelper.write(out, a_list.value); + } + else if (method.equals("next_one")) + { + // The next_one has been invoked. + BindingHolder a_binding = new BindingHolder(); + + boolean result = next_one(a_binding); + + out = rh.createReply(); + out.write_boolean(result); + BindingHelper.write(out, a_binding.value); + } + else if (method.equals("destroy")) + { + // The destroy has been invoked. + destroy(); + out = rh.createReply(); + } + else + throw new BAD_OPERATION(method, Minor.Method, + CompletionStatus.COMPLETED_MAYBE); + + return out; + } + + /** + * Get the CORBA object that delegates calls to this servant. The servant must + * be already connected to an ORB. + */ + public BindingIterator _this() + { + return BindingIteratorHelper.narrow(super._this_object()); + } + + /** + * Get the CORBA object that delegates calls to this servant. Connect to the + * given ORB, if needed. + */ + public BindingIterator _this(org.omg.CORBA.ORB orb) + { + return BindingIteratorHelper.narrow(super._this_object(orb)); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingListHelper.java b/libjava/classpath/org/omg/CosNaming/BindingListHelper.java new file mode 100644 index 000000000..de04989e0 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingListHelper.java @@ -0,0 +1,129 @@ +/* BindingListHelper.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.CosNaming; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the binding list. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class BindingListHelper +{ + /** + * The binding list repository id. + */ + private static String _id = "IDL:omg.org/CosNaming/BindingList:1.0"; + + /** + * Extract the array of bindings from the given {@link Any}. + */ + public static Binding[] extract(Any a) + { + try + { + return ((BindingListHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Binding list expected"); + bad.initCause(ex); + throw bad; + } + } + + /** + * Get the binding list repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the array of bindings into the given {@link Any}. + */ + public static void insert(Any a, Binding[] bindings) + { + a.insert_Streamable(new BindingListHolder(bindings)); + } + + /** + * Read the array of bindings from the given CDR input stream. + */ + public static Binding[] read(InputStream istream) + { + Binding[] value = new Binding[ istream.read_long() ]; + + for (int i = 0; i < value.length; i++) + value [ i ] = BindingHelper.read(istream); + return value; + } + + /** + * Return the binding array type code. + */ + public static TypeCode type() + { + TypeCode typeCode; + ORB orb = OrbRestricted.Singleton; + typeCode = BindingHelper.type(); + typeCode = orb.create_sequence_tc(0, typeCode); + typeCode = orb.create_alias_tc(id(), "BindingList", typeCode); + return typeCode; + } + + /** + * Write the array of bindings into the given CDR output stream. + */ + public static void write(OutputStream ostream, Binding[] value) + { + ostream.write_long(value.length); + for (int i = 0; i < value.length; i++) + org.omg.CosNaming.BindingHelper.write(ostream, value [ i ]); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingListHolder.java b/libjava/classpath/org/omg/CosNaming/BindingListHolder.java new file mode 100644 index 000000000..eb0e8b333 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingListHolder.java @@ -0,0 +1,97 @@ +/* BindingListHolder.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.CosNaming; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A class to hold the binding list. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class BindingListHolder + implements Streamable +{ + /** + * The wrapped binding list. + */ + public Binding[] value = null; + + /** + * Create the unitialised holder. + */ + public BindingListHolder() + { + } + + /** + * Create the holder, intialised to the given value. + */ + public BindingListHolder(Binding[] initialValue) + { + value = initialValue; + } + + /** + * Read the binding list from the given CDR stream. + */ + public void _read(InputStream in) + { + value = BindingListHelper.read(in); + } + + /** + * Get the type code of the binding. + */ + public TypeCode _type() + { + return BindingListHelper.type(); + } + + /** + * Write the binding list into the given CDR stream. + */ + public void _write(OutputStream out) + { + BindingListHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingType.java b/libjava/classpath/org/omg/CosNaming/BindingType.java new file mode 100644 index 000000000..cbcb3cd99 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingType.java @@ -0,0 +1,129 @@ +/* BindingType.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.CosNaming; + +import org.omg.CORBA.BAD_PARAM; + +/** + * Specifies the binding type (how the binding has been created). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class BindingType + implements org.omg.CORBA.portable.IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 3735105633408228513L; + + /** + * This constant means that the binding has been created + * with operations bind_context, rebind_context or + * bind_new_context. + */ + public static final int _ncontext = 1; + + /** + * This constant means that the binding has been created by the + * means, different from the listed in {@link #_ncontext} description. + */ + public static final int _nobject = 0; + + /** + * This constant means that the binding has been created + * with operations bind_context, rebind_context or + * bind_new_context. + */ + public static final BindingType ncontext = new BindingType(_ncontext); + + /** + * This constant means that the binding has been created by the + * means, different from the listed in {@link #_ncontext} description. + */ + public static final BindingType nobject = new BindingType(_nobject); + + /** + * The binding type, defined by this instance. + */ + private final int type; + + /** + * Create the new binding type definition. + * + * @param value the binding type, normally either _nobject or + * _ncontext. + */ + protected BindingType(int value) + { + type = value; + } + + /** + * Get the binding type instance, matching its integer code. + * + * @param value the binding type code. + * @return the matching binding type instance. + * + * @throws BAD_PARAM if there is no matching binding type for + * the passed value. + */ + public static BindingType from_int(int value) + { + switch (value) + { + case _nobject : + return nobject; + + case _ncontext : + return ncontext; + + default : + throw new BAD_PARAM("Unsupported binding type code " + value); + } + } + + /** + * Return the integer code for this binding. + */ + public int value() + { + return type; + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java b/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java new file mode 100644 index 000000000..3bbb683e6 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java @@ -0,0 +1,119 @@ +/* BindingTypeHelper.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.CosNaming; + +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; + +/** + * A helper operations of the {@link BindingType} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class BindingTypeHelper +{ + /** + * The binding type repository id. + */ + private static String id = "IDL:omg.org/CosNaming/BindingType:1.0"; + /** + * Extract the binding type from the given {@link Any}. + */ + public static BindingType extract(Any any) + { + try + { + return ((BindingTypeHolder) any.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Binding type expected"); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the binding type repository id. + */ + public static String id() + { + return id; + } + + /** + * Insert the binding type into the given {@link Any}. + */ + public static void insert(Any any, BindingType that) + { + any.insert_Streamable(new BindingTypeHolder(that)); + } + + /** + * Read the binding type from the CDR input stream. + */ + public static BindingType read(InputStream istream) + { + return BindingType.from_int(istream.read_long()); + } + + /** + * Get the type code of this enumeration. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_enum_tc(id(), "BindingType", + new String[] { "nobject", "ncontext" }); + } + + /** + * Write the binding type to the CDR output stream. + */ + public static void write(OutputStream ostream, BindingType value) + { + ostream.write_long(value.value()); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/BindingTypeHolder.java b/libjava/classpath/org/omg/CosNaming/BindingTypeHolder.java new file mode 100644 index 000000000..72fde5a48 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingTypeHolder.java @@ -0,0 +1,93 @@ +/* BindingTypeHolder.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.CosNaming; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Holds the binding type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class BindingTypeHolder + implements Streamable +{ + /** + * The stored binding type value. + */ + public BindingType value; + + /** + * Create the unitialised holder. + */ + public BindingTypeHolder() + { + } + + /** + * Create the holder, intialised to the given value. + */ + public BindingTypeHolder(BindingType initialValue) + { + value = initialValue; + } + + /** + * Read the holder value from the CDR input stream. + */ + public void _read(InputStream in) + { + value = BindingTypeHelper.read(in); + } + + public org.omg.CORBA.TypeCode _type() + { + return BindingTypeHelper.type(); + } + + /** + * Write the stored value to the CDR output stream. + */ + public void _write(OutputStream out) + { + BindingTypeHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/IstringHelper.java b/libjava/classpath/org/omg/CosNaming/IstringHelper.java new file mode 100644 index 000000000..f0cc43bbe --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/IstringHelper.java @@ -0,0 +1,120 @@ +/* IstringHelper.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.CosNaming; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * "Istring" was a "placeholder for a future IDL internationalized + * string data type" in the original specification. It is maintained + * solely for compatibility reasons. In both java and CORBA, + * Istring is now identical to the narrow (not wide) string and needs + * no helper. This class is implemented just for compatibility + * reasons. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class IstringHelper +{ + /** + * Insert the IString into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the IString from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an alias typecode. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "Istring", orb.create_string_tc(0)); + } + + /** + * Return the IString repository id. + * @return "IDL:omg.org/CosNaming/Istring:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/CosNaming/Istring:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param istream the stream to read from. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param ostream the stream to write into. + * @param value the string (IString) value to write. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NameComponent.java b/libjava/classpath/org/omg/CosNaming/NameComponent.java new file mode 100644 index 000000000..1e06caaef --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NameComponent.java @@ -0,0 +1,130 @@ +/* NameComponent.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.CosNaming; + +import org.omg.CORBA.portable.IDLEntity; + +import java.util.zip.Adler32; + +/** + * The name component, a node in the multi-comonent name. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameComponent + implements IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1052538183391762390L; + + /** + * The name component identifier. + */ + public String id; + + /** + * The name component kind (this conception is similar to + * the file type conception. + */ + public String kind; + + /** + * Create the empty name component. + */ + public NameComponent() + { + } + + /** + * Create the initialised name component. + */ + public NameComponent(String _id, String _kind) + { + id = _id; + kind = _kind; + } + + /** + * Returns true if both name and kind are equal. + */ + public boolean equals(Object other) + { + if (other instanceof NameComponent) + { + NameComponent n = (NameComponent) other; + + boolean ieq; + boolean keq; + + if (id == null || n.id == null) + ieq = id == n.id; + else + ieq = id.equals(n.id); + + if (kind == null || n.kind == null) + keq = kind == n.kind; + else + keq = kind.equals(n.kind); + + return keq && ieq; + } + else + return false; + } + + /** + * Get a string representation (id.kind). + */ + public String toString() + { + return id + "." + kind; + } + + /** + * Return the hashCode of this NameComponent. + */ + public int hashCode() + { + Adler32 adler = new Adler32(); + adler.update(toString().getBytes()); + return (int) adler.getValue() & Integer.MAX_VALUE; + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java b/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java new file mode 100644 index 000000000..c93b451e4 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java @@ -0,0 +1,137 @@ +/* NameComponentHelper.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.CosNaming; + +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; + +/** + * A helper classes for the name component. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameComponentHelper +{ + /** + * A {@link NameComponent} repository id. + */ + private static String _id = "IDL:omg.org/CosNaming/NameComponent:1.0"; + + /** + * Extract the name component from this {@link Any} + */ + public static NameComponent extract(Any a) + { + try + { + return ((NameComponentHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Name component expected"); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the repository Id of the {@link NameComponent}. + * @return "IDL:omg.org/CosNaming/NameComponent:1.0" + */ + public static String id() + { + return _id; + } + + /** + * Insert the name compnent into the given {@link Any}. + */ + public static void insert(Any a, NameComponent that) + { + a.insert_Streamable(new NameComponentHolder(that)); + } + + /** + * Read the name component from the given CDR input stream. + */ + public static NameComponent read(InputStream istream) + { + NameComponent value = new NameComponent(); + value.id = istream.read_string(); + value.kind = istream.read_string(); + return value; + } + + /** + * Get the type code of the named component. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + + StructMember[] members = new StructMember[ 2 ]; + TypeCode member; + member = orb.create_string_tc(0); + members [ 0 ] = new StructMember("id", member, null); + member = orb.create_string_tc(0); + members [ 1 ] = new StructMember("kind", member, null); + return + orb.create_struct_tc(NameComponentHelper.id(), "NameComponent", + members + ); + } + + /** + * Write the named component into the CDR output stream. + */ + public static void write(OutputStream ostream, NameComponent value) + { + ostream.write_string(value.id); + ostream.write_string(value.kind); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NameComponentHolder.java b/libjava/classpath/org/omg/CosNaming/NameComponentHolder.java new file mode 100644 index 000000000..817a43e4c --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NameComponentHolder.java @@ -0,0 +1,97 @@ +/* NameComponentHolder.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.CosNaming; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The name component holder. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameComponentHolder + implements Streamable +{ + /** + * The stored value. + */ + public NameComponent value; + + /** + * Create the unitialised holder. + */ + public NameComponentHolder() + { + } + + /** + * Create the initialised holder. + */ + public NameComponentHolder(NameComponent initialValue) + { + value = initialValue; + } + + /** + * Fill in the value field by reading it from the CDR input stream. + */ + public void _read(InputStream in) + { + value = NameComponentHelper.read(in); + } + + /** + * Get the type code of the {@link NameComponent}. + */ + public TypeCode _type() + { + return NameComponentHelper.type(); + } + + /** + * Write the stored value into the given CDR output stream. + */ + public void _write(OutputStream out) + { + NameComponentHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NameHelper.java b/libjava/classpath/org/omg/CosNaming/NameHelper.java new file mode 100644 index 000000000..aef422de8 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NameHelper.java @@ -0,0 +1,133 @@ +/* NameHelper.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.CosNaming; + +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 name that is defined as an array + * of the name components. There is no java class, directly matching + * the 'Name' IDL type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameHelper +{ + /** + * The repository id of the Name. + */ + private static String _id = "IDL:omg.org/CosNaming/Name:1.0"; + + /** + * Extract the Name the given {@link Any}. + */ + public static NameComponent[] extract(Any a) + { + try + { + return ((NameHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Name expected"); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the Name repository Id. + */ + public static String id() + { + return _id; + } + + /** + * Extract the Name from the given {@link Any}. + */ + public static void insert(Any a, NameComponent[] that) + { + a.insert_Streamable(new NameHolder(that)); + } + + /** + * Read the Name from the given CDR input stream. + */ + public static NameComponent[] read(InputStream istream) + { + NameComponent[] value = null; + int l = istream.read_long(); + value = new NameComponent[ l ]; + for (int i = 0; i < value.length; ++i) + value [ i ] = NameComponentHelper.read(istream); + return value; + } + + /** + * Get the type code of the Name. + */ + public static TypeCode type() + { + TypeCode typeCode; + typeCode = NameComponentHelper.type(); + typeCode = OrbRestricted.Singleton.create_sequence_tc(0, typeCode); + typeCode = + OrbRestricted.Singleton.create_alias_tc(NameHelper.id(), "Name", typeCode); + return typeCode; + } + + /** + * Write the Name into the CDR output stream. + */ + public static void write(OutputStream ostream, NameComponent[] value) + { + ostream.write_long(value.length); + for (int i = 0; i < value.length; ++i) + NameComponentHelper.write(ostream, value [ i ]); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NameHolder.java b/libjava/classpath/org/omg/CosNaming/NameHolder.java new file mode 100644 index 000000000..a4d33e991 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NameHolder.java @@ -0,0 +1,99 @@ +/* NameHolder.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.CosNaming; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder for the name that is defined as an array + * of the name components. There is no java class, directly matching + * the 'Name' IDL type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameHolder + implements Streamable +{ + /** + * The stored Name (array of the name components). + */ + public NameComponent[] value; + + /** + * Create the empty holder. + */ + public NameHolder() + { + } + + /** + * Create the intialised holder. + */ + public NameHolder(NameComponent[] initialValue) + { + value = initialValue; + } + + /** + * Fill in the holder value by reading it from the CDR input stream. + */ + public void _read(InputStream in) + { + value = NameHelper.read(in); + } + + /** + * Get the Name type code. + */ + public TypeCode _type() + { + return NameHelper.type(); + } + + /** + * Write the stored value into CDR output stream. + */ + public void _write(OutputStream out) + { + NameHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContext.java b/libjava/classpath/org/omg/CosNaming/NamingContext.java new file mode 100644 index 000000000..edd298a19 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContext.java @@ -0,0 +1,197 @@ +/* NamingContext.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.CosNaming; + +import org.omg.CORBA.portable.IDLEntity; +import org.omg.CosNaming.NamingContextPackage.AlreadyBound; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.NotEmpty; +import org.omg.CosNaming.NamingContextPackage.NotFound; + +/** + * The interface for the naming context. The naming context can + * store (bound) and retrieve (resolve) the named objects or + * named child contexts. These operations are defined in a separate + * interface. + * + * @see NamingContextExt + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface NamingContext + extends NamingContextOperations, org.omg.CORBA.Object, IDLEntity +{ + /** + * Gives the object a name, valid in this context. + * + * @param a_name the name, being given to the object. + * @param an_object the object, being named. + * + * @throws AlreadyBound if the object is already named in this context. + * @throws InvalidName if the name has zero length or otherwise invalid. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object) + throws NotFound, CannotProceed, InvalidName, AlreadyBound; + + /** + * Gives a child context name, valid in this context. + * + * @param a_name the name, being given to the child context. + * @param a_context the child context being named. + * + * @throws AlreadyBound if the child context is already named in + * the current context. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + void bind_context(NameComponent[] a_name, NamingContext a_context) + throws NotFound, CannotProceed, InvalidName, AlreadyBound; + + /** + * Create a new context and give it a given name (bound it) + * in the current context. + * + * @param a_name the name being given to the new context. + * + * @return the newly created context. + * + * @throws AlreadyBound if the name is already in use. + * @throws InvalidName if the name has zero length or otherwise invalid. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + NamingContext bind_new_context(NameComponent[] a_name) + throws NotFound, AlreadyBound, CannotProceed, + InvalidName; + + /** + * Destroy this context (must be empty). + * @throws NotEmpty if the context being destroyed is not empty. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + void destroy() + throws NotEmpty; + + /** + * Iterate over all bindings, defined in this namind context. + * + * @param amount the maximal number of context to return in the + * holder a_list. The remaining bindings are accessible via iterator + * an_iter. If the parameter amount is zero, all bindings are accessed only + * via this iterator. + * + * @param a_list the holder, where the returned bindigs are stored. + * @param an_iter the iterator that can be used to access the remaining + * bindings. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + void list(int amount, BindingListHolder a_list, BindingIteratorHolder an_iter); + + /** + * Creates a new naming context, not bound to any name. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + NamingContext new_context(); + + /** + * Names or renames the object. + * + * @param a_name the new name, being given to the object. If + * the object is already named in this context, it is renamed. + * + * @param an_object the object, being named. + * + * @throws InvalidName if the name has zero length or otherwise invalid. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + void rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object) + throws NotFound, CannotProceed, InvalidName; + + /** + * Names or renames the child context. + * If the child context is already named in + * the current context, it is renamed. + * + * @param a_name the name, being given to the child context. + * @param a_context the child context being named. + * + * @throws InvalidName if the name has zero length or otherwise invalid. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + void rebind_context(NameComponent[] a_name, NamingContext a_context) + throws NotFound, CannotProceed, InvalidName; + + /** + * Get the object, bound to the specified name in this + * context. + * + * @param a_name the object name. + * + * @return the object, matching this name. The client + * usually casts or narrows (using the helper) the returned value + * to the more specific type. + * + * @throws NotFound + * @throws InvalidName if the name has zero length or otherwise invalid. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + org.omg.CORBA.Object resolve(NameComponent[] a_name) + throws NotFound, CannotProceed, InvalidName; + + /** + * Removes the name from the binding context. + * + * @param a_name a name to remove. + * + * @throws InvalidName if the name has zero length or otherwise invalid. + * + * @specnote since 1.3 this method has moved into NamingContextOperations. + */ + void unbind(NameComponent[] a_name) + throws NotFound, CannotProceed, InvalidName; +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExt.java b/libjava/classpath/org/omg/CosNaming/NamingContextExt.java new file mode 100644 index 000000000..ac77ae90d --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExt.java @@ -0,0 +1,55 @@ +/* NamingContextExt.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.CosNaming; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The extended naming context interface, defined since 1.4. The context + * operations are defined separately from the context interface. + * + * This interface is derived from the previous NamingContex version, + * requiring to implement all previously available functionality. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface NamingContextExt + extends NamingContextExtOperations, NamingContext, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java new file mode 100644 index 000000000..b5b2f7020 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java @@ -0,0 +1,175 @@ +/* NamingContextExtHelper.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.CosNaming; + +import gnu.CORBA.Minor; +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.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the extended naming context. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NamingContextExtHelper +{ + /** + * The naming context repository id. + */ + private static String _id = "IDL:omg.org/CosNaming/NamingContextExt:1.0"; + + /** + * Extract the naming context from the given {@link Any}. + */ + public static NamingContextExt extract(Any a) + { + try + { + return ((NamingContextExtHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("NamingContextExt expected"); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the {@link NamingContextExt} repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the naming context into the given {@link Any} + */ + public static void insert(Any a, NamingContextExt that) + { + a.insert_Streamable(new NamingContextExtHolder(that)); + } + + /** + * Cast the passed object into the NamingContextExt. If the + * object has a different java type, create an instance + * of the NamingContextExt, using the same delegate, as for + * the passed parameter. Hence this method may return + * a different object, than has been passed. + * + * @param obj the object to cast. + * @return casted instance. + */ + public static NamingContextExt narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof NamingContextExt) + return (NamingContextExt) obj; + else if (!obj._is_a(id())) + throw new BAD_PARAM(); + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _NamingContextExtStub(delegate); + } + } + + /** + * Narrow the given object to the NamingContextExt. No type-checking is + * performed to verify that the object actually supports the requested type. + * The {@link BAD_OPERATION} will be thrown if unsupported operations are + * invoked on the new returned reference, but no failure is expected at the + * time of the unchecked_narrow. See OMG issue 4158. + * + * @param obj the object to cast. + * + * @return the casted NamingContextExt + * + * @since 1.5 + */ + public static NamingContextExt unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof NamingContextExt) + return (NamingContextExt) obj; + else + { + // Do not call the _is_a(..). + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _NamingContextExtStub(delegate); + } + } + + /** + * Read the extended naming context from the given CDR input stream. + */ + public static NamingContextExt read(InputStream istream) + { + return narrow(istream.read_Object(_NamingContextExtStub.class)); + } + + /** + * Get the type code of the {@link NamingContextExt}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(NamingContextExtHelper.id(), + "NamingContextExt"); + } + + /** + * Write the given extended naming context into the given CDR output stream. + */ + public static void write(OutputStream ostream, NamingContextExt value) + { + ostream.write_Object(value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtHolder.java new file mode 100644 index 000000000..923edcd7b --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtHolder.java @@ -0,0 +1,97 @@ +/* NamingContextExtHolder.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.CosNaming; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the extended naming context, added since 1.4. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NamingContextExtHolder + implements Streamable +{ + /** + * A stored value. + */ + public NamingContextExt value; + + /** + * Create the unitialised naming context holder. + */ + public NamingContextExtHolder() + { + } + + /** + * Create the naming context holder, intialised to the given value. + */ + public NamingContextExtHolder(NamingContextExt initialValue) + { + value = initialValue; + } + + /** + * Read the naming context from the given CDR input stream. + */ + public void _read(InputStream i) + { + value = NamingContextExtHelper.read(i); + } + + /** + * Get the typecode of the naming context. + */ + public TypeCode _type() + { + return NamingContextExtHelper.type(); + } + + /** + * Write the naming context to the given CDR output stream. + */ + public void _write(OutputStream o) + { + NamingContextExtHelper.write(o, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtOperations.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtOperations.java new file mode 100644 index 000000000..ec0af0fcd --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtOperations.java @@ -0,0 +1,97 @@ +/* NamingContextExtOperations.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.CosNaming; + +import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.NotFound; + +/** + * The extended naming context operations, defined since 1.4. + * The extensions are focused on providing the simplier way + * to use naming service with the string-based names and + * addresses. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface NamingContextExtOperations + extends NamingContextOperations +{ + /** + * Resolve the name, represented in the form of the string. + * The components of the composite name are separated by + * slash ('/'). + * + * @param a_name_string the name to resolve. + * @return the object, referenced by the name. + */ + org.omg.CORBA.Object resolve_str(String a_name_string) + throws NotFound, CannotProceed, InvalidName; + + /** + * Converts the name, represented in the form of the string, + * into the older name representation (array of the name + * components). + * + * @param a_name_string the stringified form of the name. + * + * @return the component array form of the name. + * + * @throws InvalidName if the name is invalid. + */ + NameComponent[] to_name(String a_name_string) + throws InvalidName; + + /** + * Converts the older representation for the name (array + * of the name components) into the string form of the name. + * + * @param a_name the name, as an array of components. + * + * @return the same name as a string. + * + * @throws InvalidName if the name is invalid. + */ + String to_string(NameComponent[] a_name) + throws InvalidName; + + String to_url(String an_address, String a_name_string) + throws InvalidAddress, InvalidName; +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java new file mode 100644 index 000000000..c6e7eaf81 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java @@ -0,0 +1,463 @@ +/* NamingContextExtPOA.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.CosNaming; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; +import org.omg.CosNaming.NamingContextExtPackage.InvalidAddressHelper; +import org.omg.CosNaming.NamingContextPackage.AlreadyBound; +import org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.CannotProceedHelper; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.InvalidNameHelper; +import org.omg.CosNaming.NamingContextPackage.NotEmpty; +import org.omg.CosNaming.NamingContextPackage.NotEmptyHelper; +import org.omg.CosNaming.NamingContextPackage.NotFound; +import org.omg.CosNaming.NamingContextPackage.NotFoundHelper; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; + +/** + * The extended naming service servant. After implementing the abstract methods the + * instance of this class can be connected to an ORB using POA. + * + * @since 1.4 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NamingContextExtPOA + extends Servant + implements NamingContextExtOperations, InvokeHandler + +{ + /** @inheritDoc */ + public String[] _all_interfaces(POA poa, byte[] object_ID) + { + return new String[] { NamingContextExtHelper.id(), NamingContextHelper.id() }; + } + + /** @inheritDoc */ + public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) + { + Integer call_method = _NamingContextExtImplBase._methods.get(method); + + if (call_method == null) + // The older methods are handled separately. + return super_invoke(method, in, rh); + + OutputStream out = null; + + switch (call_method.intValue()) + { + case 0: // to_string + { + try + { + NameComponent[] a_name = NameHelper.read(in); + String result = null; + result = this.to_string(a_name); + out = rh.createReply(); + out.write_string(result); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 1: // to_name + { + try + { + String a_name_string = in.read_string(); + NameComponent[] result = to_name(a_name_string); + out = rh.createReply(); + NameHelper.write(out, result); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 2: // to_url + { + try + { + String an_address = in.read_string(); + String a_name_string = in.read_string(); + String result = to_url(an_address, a_name_string); + out = rh.createReply(); + out.write_string(result); + } + catch (InvalidAddress ex) + { + out = rh.createExceptionReply(); + InvalidAddressHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 3: // resolve_str + { + try + { + String a_name_string = in.read_string(); + org.omg.CORBA.Object result = resolve_str(a_name_string); + out = rh.createReply(); + org.omg.CORBA.ObjectHelper.write(out, result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + } + return out; + } + + /** + * Handles calls to the methods from the NamingContext. The classes cannot be + * directly derived from each other; new public methods would appear. + */ + OutputStream super_invoke(String method, InputStream in, ResponseHandler rh) + { + OutputStream out = null; + Integer call_method = _NamingContextImplBase.methods.get(method); + if (call_method == null) + throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE); + + switch (call_method.intValue()) + { + case 0: // bind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object an_object = ObjectHelper.read(in); + bind(a_name, an_object); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + break; + } + + case 1: // rebind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object an_object = ObjectHelper.read(in); + rebind(a_name, an_object); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 2: // bind_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext a_context = NamingContextHelper.read(in); + bind_context(a_name, a_context); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + break; + } + + case 3: // rebind_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext a_context = NamingContextHelper.read(in); + rebind_context(a_name, a_context); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 4: // resolve + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object __result = null; + __result = resolve(a_name); + out = rh.createReply(); + ObjectHelper.write(out, __result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 5: // unbind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + unbind(a_name); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 6: // new_context + { + NamingContext __result = null; + __result = new_context(); + out = rh.createReply(); + NamingContextHelper.write(out, __result); + break; + } + + case 7: // bind_new_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext __result = null; + __result = bind_new_context(a_name); + out = rh.createReply(); + NamingContextHelper.write(out, __result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 8: // destroy + { + try + { + destroy(); + out = rh.createReply(); + } + catch (NotEmpty ex) + { + out = rh.createExceptionReply(); + NotEmptyHelper.write(out, ex); + } + break; + } + + case 9: // list + { + int amount = in.read_ulong(); + BindingListHolder a_list = new BindingListHolder(); + BindingIteratorHolder an_iter = new BindingIteratorHolder(); + list(amount, a_list, an_iter); + out = rh.createReply(); + BindingListHelper.write(out, a_list.value); + BindingIteratorHelper.write(out, an_iter.value); + break; + } + + default: + throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE); + } + + return out; + } + + /** + * Get the CORBA object that delegates calls to this servant. The servant must + * be already connected to an ORB. + */ + public NamingContextExt _this() + { + return NamingContextExtHelper.narrow(super._this_object()); + } + + /** + * Get the CORBA object that delegates calls to this servant. Connect to the + * given ORB, if needed. + */ + public NamingContextExt _this(org.omg.CORBA.ORB orb) + { + return NamingContextExtHelper.narrow(super._this_object(orb)); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/AddressHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/AddressHelper.java new file mode 100644 index 000000000..8333ff826 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/AddressHelper.java @@ -0,0 +1,114 @@ +/* AddressHelper.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.CosNaming.NamingContextExtPackage; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Helper operations for address. Address is directly mapped into + * java String. There is no separate Address class in the implementation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AddressHelper +{ + /** + * The address repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContextExt/Address:1.0"; + + /** + * Just extracts string from this {@link Any}. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Get repository id. + */ + public static String id() + { + return _id; + } + + /** + * Just inserts string into this {@link Any}. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Delegates functionality to {@link InputStream#read_string()}. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Return the "Address", alias of String, typecode. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + TypeCode typeCode; + typeCode = orb.create_string_tc(0); + typeCode = orb.create_alias_tc(id(), "Address", typeCode); + return typeCode; + } + + /** + * Delegates functionality to {@link OutputStream#write_string}. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddress.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddress.java new file mode 100644 index 000000000..e68d8a483 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddress.java @@ -0,0 +1,76 @@ +/* InvalidAddress.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.CosNaming.NamingContextExtPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The exception is thrown if the passed address is empty or otherwise invalid. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class InvalidAddress + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -3775583235364760385L; + + /** + * Create an exception with no message. + */ + public InvalidAddress() + { + } + + /** + * Create an exception with explaining message. + * + * @since 1.4 + */ + public InvalidAddress(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddressHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddressHelper.java new file mode 100644 index 000000000..ea17473e3 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddressHelper.java @@ -0,0 +1,112 @@ +/* InvalidAddressHelper.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.CosNaming.NamingContextExtPackage; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The holder for exception {@link InvalidAddress}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class InvalidAddressHelper +{ + /** + * The {@link InvalidAddress} repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContextExt/InvalidAddress:1.0"; + + /** + * Extract the exception from the given {@link Any}. + */ + public static InvalidAddress extract(Any a) + { + return read(a.create_input_stream()); + } + + /** + * Return the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the exception into the given {@link Any}. + */ + public static void insert(Any a, InvalidAddress that) + { + a.insert_Streamable(new InvalidAddressHolder(that)); + } + + /** + * Read the exception from the given CDR stream. + */ + public static InvalidAddress read(InputStream istream) + { + InvalidAddress value = new InvalidAddress(); + + // Read and discard the repository ID. + istream.read_string(); + return value; + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_struct_tc(InvalidAddressHelper.id(), + "InvalidAddress", new StructMember[0]); + } + + public static void write(OutputStream ostream, InvalidAddress value) + { + // Write the repository ID. + ostream.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddressHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddressHolder.java new file mode 100644 index 000000000..5ded186a6 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/InvalidAddressHolder.java @@ -0,0 +1,98 @@ +/* InvalidAddressHolder.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.CosNaming.NamingContextExtPackage; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; +import org.omg.CosNaming.NamingContextPackage.NotEmpty; + +/** + * The holder for the exception {@link InvalidAddress}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class InvalidAddressHolder + implements Streamable +{ + /** + * The stored value. + */ + public InvalidAddress value; + + /** + * Create the holder with unitialised value. + */ + public InvalidAddressHolder() + { + } + + /** + * Create the holder, storing the given value. + */ + public InvalidAddressHolder(InvalidAddress initialValue) + { + value = initialValue; + } + + /** + * Fill in the stored value, reading it from the given CDR stream. + */ + public void _read(InputStream in) + { + value = InvalidAddressHelper.read(in); + } + + /** + * Get the type code of the {@link NotEmpty} exception. + */ + public TypeCode _type() + { + return InvalidAddressHelper.type(); + } + + /** + * Write the stored value to the given CDR stream. + */ + public void _write(OutputStream out) + { + InvalidAddressHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/StringNameHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/StringNameHelper.java new file mode 100644 index 000000000..f020cef82 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/StringNameHelper.java @@ -0,0 +1,113 @@ +/* StringNameHelper.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.CosNaming.NamingContextExtPackage; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Helper operations for the string name. + * The string name is directly mapped into java String. + * There is no separate "String name" class in the implementation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class StringNameHelper +{ + /** + * The string name repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContextExt/StringName:1.0"; + + /** + * Just extracts string from this {@link Any}. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Get repository id. + */ + public static String id() + { + return _id; + } + + /** + * Just inserts string into this {@link Any}. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Delegates functionality to {@link InputStream#read_string()}. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Return the "StringName", alias of String, typecode. + */ + public static TypeCode type() + { + TypeCode typeCode; + typeCode = OrbRestricted.Singleton.create_string_tc(0); + typeCode = OrbRestricted.Singleton.create_alias_tc(id(), "StringName", typeCode); + return typeCode; + } + + /** + * Delegates functionality to {@link OutputStream#write_string}. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/URLStringHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/URLStringHelper.java new file mode 100644 index 000000000..b565530e5 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/URLStringHelper.java @@ -0,0 +1,113 @@ +/* URLStringHelper.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.CosNaming.NamingContextExtPackage; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Helper operations for the URL string name. + * The URL string is directly mapped into java String. + * There is no separate "URL string" class in the implementation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class URLStringHelper +{ + /** + * The URL string repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContextExt/URLString:1.0"; + + /** + * Just extracts string from this {@link Any}. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Get repository id. + */ + public static String id() + { + return _id; + } + + /** + * Just inserts string into this {@link Any}. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Delegates functionality to {@link InputStream#read_string()}. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Return the "URLString", alias of String, typecode. + */ + public static TypeCode type() + { + TypeCode typeCode; + typeCode = OrbRestricted.Singleton.create_string_tc(0); + typeCode = OrbRestricted.Singleton.create_alias_tc(id(), "URLString", typeCode); + return typeCode; + } + + /** + * Delegates functionality to {@link OutputStream#write_string}. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/package.html b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/package.html new file mode 100644 index 000000000..a082f1c6d --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPackage/package.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in org.omg.CosNaming.NamingContextExtPackage + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CosNaming.NamingContextExtPackage</title></head> + +<body> +<p>Provides several satelitte classes, needed by the naming service +extensions, added from the version 1.4</p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java new file mode 100644 index 000000000..61cc4c79e --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java @@ -0,0 +1,180 @@ +/* NamingContextHelper.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.CosNaming; + +import gnu.CORBA.Minor; +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.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the naming context. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NamingContextHelper +{ + /** + * The naming context repository id. + */ + private static String _id = "IDL:omg.org/CosNaming/NamingContext:1.0"; + + /** + * Extract the naming context from the given {@link Any}. + */ + public static NamingContext extract(Any a) + { + try + { + return ((NamingContextHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Naming context expected"); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the {@link NamingContext} repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the naming context into the given {@link Any} + */ + public static void insert(Any a, NamingContext that) + { + a.insert_Streamable(new NamingContextHolder(that)); + } + + /** + * Cast the passed object into the NamingContext. If the + * object has a different java type, create an instance + * of the NamingContext, using the same delegate, as for + * the passed parameter. + * + * If the object repository Id indicates that it is an instance of + * {@link NamingContextExt} that is a subclass of the NamingContext, + * the functionality is delegated to {@link NamingContextHelper#narrow}. + * + * @param obj the object to cast. + * @return casted instance. + * + * @throws BAD_PARAM if the passed object is not an instance of + * {@link NamingContext} or {@link NamingContextExt}. + */ + public static NamingContext narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof NamingContext) + return (NamingContext) obj; + else if (obj._is_a(id())) + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _NamingContextStub(delegate); + } + else if (obj._is_a(NamingContextExtHelper.id())) + return NamingContextExtHelper.narrow(obj); + else + throw new BAD_PARAM(); + } + + /** + * Narrow the given object to the NamingContext. No type-checking is performed + * to verify that the object actually supports the requested type. The + * {@link BAD_OPERATION} will be thrown if unsupported operations are invoked + * on the new returned reference, but no failure is expected at the time of + * the unchecked_narrow. See OMG issue 4158. + * + * @param obj the object to cast. + * + * @return the casted NamingContext. + */ + public static NamingContext unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof NamingContext) + return (NamingContext) obj; + else + { + // Do not call the _is_a(..). + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _NamingContextStub(delegate); + } + } + + /** + * Read the naming context from the given CDR input stream. + */ + public static NamingContext read(InputStream istream) + { + return narrow(istream.read_Object(_NamingContextStub.class)); + } + + /** + * Get the type code of the {@link NamingContext}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "NamingContext"); + } + + /** + * Write the given naming context into the given CDR output stream. + */ + public static void write(OutputStream ostream, NamingContext value) + { + ostream.write_Object(value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextHolder.java new file mode 100644 index 000000000..099697aa4 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextHolder.java @@ -0,0 +1,97 @@ +/* NamingContextHolder.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.CosNaming; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the naming context. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NamingContextHolder + implements Streamable +{ + /** + * A stored value. + */ + public NamingContext value; + + /** + * Create the unitialised naming context holder. + */ + public NamingContextHolder() + { + } + + /** + * Create the naming context holder, intialised to the given value. + */ + public NamingContextHolder(NamingContext initialValue) + { + value = initialValue; + } + + /** + * Read the naming context from the given CDR input stream. + */ + public void _read(InputStream in) + { + value = NamingContextHelper.read(in); + } + + /** + * Get the typecode of the naming context. + */ + public TypeCode _type() + { + return NamingContextHelper.type(); + } + + /** + * Write the naming context to the given CDR output stream. + */ + public void _write(OutputStream out) + { + NamingContextHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextOperations.java b/libjava/classpath/org/omg/CosNaming/NamingContextOperations.java new file mode 100644 index 000000000..cc93cb7ba --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextOperations.java @@ -0,0 +1,174 @@ +/* NamingContext.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.CosNaming; + +import org.omg.CosNaming.NamingContextPackage.AlreadyBound; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.NotEmpty; +import org.omg.CosNaming.NamingContextPackage.NotFound; + +/** + * The naming context operations. The naming context can + * store (bound) and retrieve (resolve) the named objects or + * named child contexts. + * + * @see NamingContextExtOperations + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface NamingContextOperations +{ + /** + * Gives the object a name, valid in this context. + * + * @param a_name the name, being given to the object. + * @param an_object the object, being named. + * + * @throws AlreadyBound if the object is already named in this context. + * @throws InvalidName if the name has zero length or otherwise invalid. + */ + void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object) + throws NotFound, CannotProceed, InvalidName, AlreadyBound; + + /** + * Gives a child context name, valid in this context. + * + * @param a_name the name, being given to the child context. + * @param a_context the child context being named. + * + * @throws AlreadyBound if the child context is already named in + * the current context. + */ + void bind_context(NameComponent[] a_name, NamingContext a_context) + throws NotFound, CannotProceed, InvalidName, AlreadyBound; + + /** + * Create a new context and give it a given name (bound it) + * in the current context. + * + * @param a_name the name being given to the new context. + * + * @return the newly created context. + * + * @throws AlreadyBound if the name is already in use. + * @throws InvalidName if the name has zero length or otherwise invalid. + */ + NamingContext bind_new_context(NameComponent[] a_name) + throws NotFound, AlreadyBound, CannotProceed, + InvalidName; + + /** + * Destroy this context (must be empty). + * @throws NotEmpty if the context being destroyed is not empty. + */ + void destroy() + throws NotEmpty; + + /** + * Iterate over all bindings, defined in this namind context. + * + * @param amount the maximal number of context to return in the + * holder a_list. The remaining bindings are accessible via iterator + * an_iter. If the parameter amount is zero, all bindings are accessed only + * via this iterator. + * + * @param a_list the holder, where the returned bindigs are stored. + * @param an_iter the iterator that can be used to access the remaining + * bindings. + */ + void list(int amount, BindingListHolder a_list, BindingIteratorHolder an_iter); + + /** + * Creates a new naming context, not bound to any name. + */ + NamingContext new_context(); + + /** + * Names or renames the object. + * + * @param a_name the new name, being given to the object. If + * the object is already named in this context, it is renamed. + * + * @param an_object the object, being named. + * + * @throws InvalidName if the name has zero length or otherwise invalid. + */ + void rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object) + throws NotFound, CannotProceed, InvalidName; + + /** + * Names or renames the child context. + * If the child context is already named in + * the current context, it is renamed. + * + * @param a_name the name, being given to the child context. + * @param a_context the child context being named. + * + * @throws InvalidName if the name has zero length or otherwise invalid. + */ + void rebind_context(NameComponent[] a_name, NamingContext a_context) + throws NotFound, CannotProceed, InvalidName; + + /** + * Get the object, bound to the specified name in this + * context. + * + * @param a_name the object name. + * + * @return the object, matching this name. The client + * usually casts or narrows (using the helper) the returned value + * to the more specific type. + * + * @throws NotFound + * @throws InvalidName if the name has zero length or otherwise invalid. + */ + org.omg.CORBA.Object resolve(NameComponent[] a_name) + throws NotFound, CannotProceed, InvalidName; + + /** + * Removes the name from the binding context. + * + * @param a_name a name to remove. + * + * @throws InvalidName if the name has zero length or otherwise invalid. + */ + void unbind(NameComponent[] a_name) + throws NotFound, CannotProceed, InvalidName; +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java new file mode 100644 index 000000000..ea38b1e74 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java @@ -0,0 +1,367 @@ +/* NamingContextPOA.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.CosNaming; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CosNaming.NamingContextPackage.AlreadyBound; +import org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.CannotProceedHelper; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.InvalidNameHelper; +import org.omg.CosNaming.NamingContextPackage.NotEmpty; +import org.omg.CosNaming.NamingContextPackage.NotEmptyHelper; +import org.omg.CosNaming.NamingContextPackage.NotFound; +import org.omg.CosNaming.NamingContextPackage.NotFoundHelper; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; + +/** + * The naming service servant. After implementing the abstract methods the + * instance of this class can be connected to an ORB using POA. + * + * @since 1.4 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NamingContextPOA + extends Servant + implements NamingContextOperations, InvokeHandler +{ + /** @inheritDoc */ + public String[] _all_interfaces(POA poa, byte[] object_ID) + { + return new String[] { NamingContextHelper.id() }; + } + + /** + * The server calls this method after receiving the request message from + * client. The implementation base calls one of its abstract methods to + * perform the requested operation. + * + * @param method the method being invoked. + * @param in the stream to read parameters from. + * @param rh the handler to get a stream for writing a response. + * + * @return the stream, returned by the handler. + */ + public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) + { + OutputStream out = null; + Integer call_method = _NamingContextImplBase.methods.get(method); + if (call_method == null) + throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE); + + switch (call_method.intValue()) + { + case 0: // bind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object an_object = ObjectHelper.read(in); + bind(a_name, an_object); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + break; + } + + case 1: // rebind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object an_object = ObjectHelper.read(in); + rebind(a_name, an_object); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 2: // bind_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext a_context = NamingContextHelper.read(in); + bind_context(a_name, a_context); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + break; + } + + case 3: // rebind_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext a_context = NamingContextHelper.read(in); + rebind_context(a_name, a_context); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 4: // resolve + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object __result = null; + __result = resolve(a_name); + out = rh.createReply(); + ObjectHelper.write(out, __result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 5: // unbind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + unbind(a_name); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 6: // new_context + { + NamingContext __result = null; + __result = new_context(); + out = rh.createReply(); + NamingContextHelper.write(out, __result); + break; + } + + case 7: // bind_new_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext __result = null; + __result = bind_new_context(a_name); + out = rh.createReply(); + NamingContextHelper.write(out, __result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 8: // destroy + { + try + { + destroy(); + out = rh.createReply(); + } + catch (NotEmpty ex) + { + out = rh.createExceptionReply(); + NotEmptyHelper.write(out, ex); + } + break; + } + + case 9: // list + { + int amount = in.read_ulong(); + BindingListHolder a_list = new BindingListHolder(); + BindingIteratorHolder an_iter = new BindingIteratorHolder(); + list(amount, a_list, an_iter); + out = rh.createReply(); + BindingListHelper.write(out, a_list.value); + BindingIteratorHelper.write(out, an_iter.value); + break; + } + + default: + throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE); + } + + return out; + } + + /** + * Get the CORBA object that delegates calls to this servant. The servant must + * be already connected to an ORB. + */ + public NamingContext _this() + { + return NamingContextHelper.narrow(super._this_object()); + } + + /** + * Get the CORBA object that delegates calls to this servant. Connect to the + * given ORB, if needed. + */ + public NamingContext _this(org.omg.CORBA.ORB orb) + { + return NamingContextHelper.narrow(super._this_object(orb)); + } + +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBound.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBound.java new file mode 100644 index 000000000..de1546840 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBound.java @@ -0,0 +1,75 @@ +/* AlreadyBound.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * The exception is thrown in response to bind the same object + * into the same context repeatedly under the different name. + * The object can have only one name in the context. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class AlreadyBound + extends UserException + implements IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -5456929050527586560L; + + /** + * Creates the expection with no details. + */ + public AlreadyBound() + { + } + + /** + * Creates the exception, explaining the reason. + * @param why + */ + public AlreadyBound(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java new file mode 100644 index 000000000..1eaf50d12 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java @@ -0,0 +1,126 @@ +/* AlreadyBoundHelper.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.CosNaming.NamingContextPackage; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +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 {@link AlreadyBound} user exception. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AlreadyBoundHelper +{ + /** + * The {@link AlreadyBound} repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContext/AlreadyBound:1.0"; + + /** + * Extract the exception from the given {@link Any}. + */ + public static AlreadyBound extract(Any a) + { + try + { + return ((AlreadyBoundHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the exception into the given {@link Any}. + */ + public static void insert(Any a, AlreadyBound that) + { + a.insert_Streamable(new AlreadyBoundHolder(that)); + } + + /** + * Read the exception from the given CDR stream. + */ + public static AlreadyBound read(InputStream istream) + { + AlreadyBound value = new AlreadyBound(); + + // Read and discard the repository ID. + istream.read_string(); + return value; + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + return + OrbRestricted.Singleton.create_struct_tc(id(), "AlreadyBound", new StructMember[ 0 ]); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, AlreadyBound value) + { + ostream.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHolder.java new file mode 100644 index 000000000..853700fed --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHolder.java @@ -0,0 +1,97 @@ +/* AlreadyBoundHolder.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder for class {@link AlreadyBound} exception. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class AlreadyBoundHolder + implements Streamable +{ + /** + * The stored value. + */ + public AlreadyBound value; + + /** + * Create the holder with unitialised value. + */ + public AlreadyBoundHolder() + { + } + + /** + * Create the holder, storing the given value. + */ + public AlreadyBoundHolder(AlreadyBound initialValue) + { + value = initialValue; + } + + /** + * Fill in the stored value, reading it from the given CDR stream. + */ + public void _read(InputStream in) + { + value = AlreadyBoundHelper.read(in); + } + + /** + * Get the type code of the {@link NotEmpty} exception. + */ + public TypeCode _type() + { + return AlreadyBoundHelper.type(); + } + + /** + * Write the stored value to the given CDR stream. + */ + public void _write(OutputStream out) + { + AlreadyBoundHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceed.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceed.java new file mode 100644 index 000000000..8239c621c --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceed.java @@ -0,0 +1,102 @@ +/* CannotProceed.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; +import org.omg.CosNaming.NameComponent; +import org.omg.CosNaming.NamingContext; + +/** + * The exception is raised when the naming service has + * given up for some reason. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class CannotProceed + extends UserException + implements IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -8627405252527310782L; + + /** + * The relevant naming contex. + */ + public NamingContext cxt; + + /** + * Contains the remainder of the non working name. + */ + public NameComponent[] rest_of_name; + + /** + * Creates the unitialised exception. + */ + public CannotProceed() + { + } + + /** + * Creates an exception with the fields, intialised to the + * given values. + */ + public CannotProceed(NamingContext _cxt, NameComponent[] _rest_of_name) + { + cxt = _cxt; + rest_of_name = _rest_of_name; + } + + /** + * Create an exception with the initialised fields and explaining + * message. + * + * @since 1.4 + */ + public CannotProceed(String why, NamingContext _cxt, + NameComponent[] _rest_of_name + ) + { + super(why); + cxt = _cxt; + rest_of_name = _rest_of_name; + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java new file mode 100644 index 000000000..34fc6ae98 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java @@ -0,0 +1,144 @@ +/* CannotProceedHelper.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.CosNaming.NamingContextPackage; + +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; +import org.omg.CosNaming.NameComponentHelper; +import org.omg.CosNaming.NameHelper; +import org.omg.CosNaming.NamingContextHelper; + +/** + * The helper operations for {@link CannotProceed}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class CannotProceedHelper +{ + /** + * The {@link CannotProceed} repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0"; + + /** + * Extract the exception from the given {@link Any}. + */ + public static CannotProceed extract(Any a) + { + try + { + return ((CannotProceedHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the exception into the given {@link Any}. + */ + public static void insert(Any a, CannotProceed that) + { + a.insert_Streamable(new CannotProceedHolder(that)); + } + + /** + * Read the exception from the given CDR stream. + */ + public static CannotProceed read(InputStream istream) + { + CannotProceed value = new CannotProceed(); + + // read and discard the repository ID + istream.read_string(); + value.cxt = NamingContextHelper.read(istream); + value.rest_of_name = NameHelper.read(istream); + return value; + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + + StructMember[] members = new StructMember[ 2 ]; + TypeCode member; + member = NamingContextHelper.type(); + members [ 0 ] = new StructMember("cxt", member, null); + member = NameComponentHelper.type(); + member = orb.create_sequence_tc(0, member); + member = orb.create_alias_tc(NameHelper.id(), "Name", member); + members [ 1 ] = new StructMember("rest_of_name", member, null); + return orb.create_struct_tc(id(), "CannotProceed", members); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, CannotProceed value) + { + // write the repository ID + ostream.write_string(id()); + NamingContextHelper.write(ostream, value.cxt); + NameHelper.write(ostream, value.rest_of_name); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHolder.java new file mode 100644 index 000000000..48a4fad06 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHolder.java @@ -0,0 +1,97 @@ +/* CannotProceedHolder.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder for exception {@link CannotProceed}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class CannotProceedHolder + implements Streamable +{ + /** + * The stored value. + */ + public CannotProceed value; + + /** + * Create the holder with unitialised value. + */ + public CannotProceedHolder() + { + } + + /** + * Create the holder, storing the given value. + */ + public CannotProceedHolder(CannotProceed initialValue) + { + value = initialValue; + } + + /** + * Fill in the stored value, reading it from the given CDR stream. + */ + public void _read(InputStream i) + { + value = CannotProceedHelper.read(i); + } + + /** + * Get the type code of the {@link NotEmpty} exception. + */ + public TypeCode _type() + { + return CannotProceedHelper.type(); + } + + /** + * Write the stored value to the given CDR stream. + */ + public void _write(OutputStream o) + { + CannotProceedHelper.write(o, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidName.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidName.java new file mode 100644 index 000000000..7ca488ac5 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidName.java @@ -0,0 +1,75 @@ +/* InvalidName.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * The exception is thrown if the name has the zero length or is otherwise + * invalid. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class InvalidName + extends UserException + implements IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 786404864997961704L; + + /** + * The default constructor. + */ + public InvalidName() + { + } + + /** + * Creates an exception with explanation, why the name is invalid. + * + * @param why the string, explaining why the name is invalid. + */ + public InvalidName(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java new file mode 100644 index 000000000..f1fb608d8 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java @@ -0,0 +1,126 @@ +/* InvalidNameHelper.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.CosNaming.NamingContextPackage; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +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 {@link InvalidName} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class InvalidNameHelper +{ + /** + * The {@link InvalidName} repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContext/InvalidName:1.0"; + + /** + * Extract the exception from the given {@link Any}. + */ + public static InvalidName extract(Any a) + { + try + { + return ((InvalidNameHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the exception into the given {@link Any}. + */ + public static void insert(Any a, InvalidName that) + { + a.insert_Streamable(new InvalidNameHolder(that)); + } + + /** + * Read the exception from the given CDR stream. + */ + public static InvalidName read(InputStream istream) + { + InvalidName value = new InvalidName(); + + // Read and discard the repository ID. + istream.read_string(); + return value; + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_struct_tc(id(), + "InvalidName", new StructMember[0]); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, InvalidName value) + { + ostream.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHolder.java new file mode 100644 index 000000000..180a09363 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHolder.java @@ -0,0 +1,97 @@ +/* InvalidNameHolder.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder for exception {@link InvalidName}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class InvalidNameHolder + implements Streamable +{ + /** + * The stored value. + */ + public InvalidName value; + + /** + * Create the holder with unitialised value. + */ + public InvalidNameHolder() + { + } + + /** + * Create the holder, storing the given value. + */ + public InvalidNameHolder(InvalidName initialValue) + { + value = initialValue; + } + + /** + * Fill in the stored value, reading it from the given CDR stream. + */ + public void _read(InputStream in) + { + value = InvalidNameHelper.read(in); + } + + /** + * Get the type code of the {@link NotEmpty} exception. + */ + public TypeCode _type() + { + return InvalidNameHelper.type(); + } + + /** + * Write the stored value to the given CDR stream. + */ + public void _write(OutputStream out) + { + InvalidNameHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmpty.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmpty.java new file mode 100644 index 000000000..c80cfcc7a --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmpty.java @@ -0,0 +1,74 @@ +/* NotEmpty.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * This exception is thrown in response to the attemt to destroy + * the non tempty context. Only the empty context can be destroyed. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NotEmpty + extends UserException + implements IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 7120362687417045881L; + + /** + * Create an exception with no message. + */ + public NotEmpty() + { + } + + /** + * Create an exception with explaining message. + * + * @since 1.4 + */ + public NotEmpty(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java new file mode 100644 index 000000000..c235205cd --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java @@ -0,0 +1,126 @@ +/* NotEmptyHelper.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.CosNaming.NamingContextPackage; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +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 {@link NotEmpty}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NotEmptyHelper +{ + /** + * The {@link NotEmpty} repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContext/NotEmpty:1.0"; + + /** + * Extract the exception from the given {@link Any}. + */ + public static NotEmpty extract(Any a) + { + try + { + return ((NotEmptyHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the exception into the given {@link Any}. + */ + public static void insert(Any a, NotEmpty that) + { + a.insert_Streamable(new NotEmptyHolder(that)); + } + + /** + * Read the exception from the given CDR stream. + */ + public static NotEmpty read(InputStream istream) + { + NotEmpty value = new NotEmpty(); + + // Read and discard the repository ID. + istream.read_string(); + return value; + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_struct_tc(id(), + "NotEmpty", new StructMember[0]); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, NotEmpty value) + { + ostream.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHolder.java new file mode 100644 index 000000000..63a7f1bba --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHolder.java @@ -0,0 +1,97 @@ +/* NotEmptyHolder.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder for exception {@link NotEmpty}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NotEmptyHolder + implements Streamable +{ + /** + * The stored value. + */ + public NotEmpty value; + + /** + * Create the holder with unitialised value. + */ + public NotEmptyHolder() + { + } + + /** + * Create the holder, storing the given value. + */ + public NotEmptyHolder(NotEmpty initialValue) + { + value = initialValue; + } + + /** + * Fill in the stored value, reading it from the given CDR stream. + */ + public void _read(InputStream i) + { + value = NotEmptyHelper.read(i); + } + + /** + * Get the type code of the {@link NotEmpty} exception. + */ + public TypeCode _type() + { + return NotEmptyHelper.type(); + } + + /** + * Write the stored value to the given CDR stream. + */ + public void _write(OutputStream o) + { + NotEmptyHelper.write(o, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFound.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFound.java new file mode 100644 index 000000000..4cbe7097d --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFound.java @@ -0,0 +1,101 @@ +/* NotFound.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; +import org.omg.CosNaming.NameComponent; + +/** +* The exception is thrown when the binding being searched does not exist +* or has the wrong type +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class NotFound + extends UserException + implements IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -7539098836265502514L; + + /** + * The reason, explaining, why the binding cannot be found. + * This might be either the missing node or the wrong binding type. + */ + public NotFoundReason why; + + /** + * Contains the remainder of the non working name. + */ + public NameComponent[] rest_of_name; + + /** + * Creates the exception with unitialised fields. + */ + public NotFound() + { + } + + /** + * Creates the exception, intialising the fields to the given values. + */ + public NotFound(NotFoundReason _why, NameComponent[] _rest_of_name) + { + why = _why; + rest_of_name = _rest_of_name; + } + + /** + * Creates the exception, intialising the fields to the given values and + * also providing the explaining string. + * + * @since 1.4 + */ + public NotFound(String explanation, NotFoundReason _why, + NameComponent[] _rest_of_name + ) + { + super(explanation); + why = _why; + rest_of_name = _rest_of_name; + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java new file mode 100644 index 000000000..034534a28 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java @@ -0,0 +1,142 @@ +/* NotFoundHelper.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.CosNaming.NamingContextPackage; + +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; +import org.omg.CosNaming.NameComponentHelper; +import org.omg.CosNaming.NameHelper; + +/** + * The helper operations for {@link NotFound}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NotFoundHelper +{ + /** + * The {@link NotFound} repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0"; + + /** + * Extract the exception from the given {@link Any}. + */ + public static NotFound extract(Any a) + { + try + { + return ((NotFoundHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the exception into the given {@link Any}. + */ + public static void insert(Any a, NotFound that) + { + a.insert_Streamable(new NotFoundHolder(that)); + } + + /** + * Read the exception from the given CDR stream. + */ + public static NotFound read(InputStream istream) + { + NotFound value = new NotFound(); + + // Read and discard the repository ID. + istream.read_string(); + value.why = NotFoundReasonHelper.read(istream); + value.rest_of_name = NameHelper.read(istream); + return value; + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + + StructMember[] members = new StructMember[ 2 ]; + TypeCode member = null; + member = NotFoundReasonHelper.type(); + members [ 0 ] = new StructMember("why", member, null); + member = NameComponentHelper.type(); + member = orb.create_sequence_tc(0, member); + member = orb.create_alias_tc(NameHelper.id(), "Name", member); + members [ 1 ] = new StructMember("rest_of_name", member, null); + return orb.create_struct_tc(id(), "NotFound", members); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, NotFound value) + { + ostream.write_string(id()); + NotFoundReasonHelper.write(ostream, value.why); + NameHelper.write(ostream, value.rest_of_name); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHolder.java new file mode 100644 index 000000000..c9ec7b02f --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHolder.java @@ -0,0 +1,97 @@ +/* NotFoundHolder.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder for the {@link NotFound} exception. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NotFoundHolder + implements Streamable +{ + /** + * The stored value. + */ + public NotFound value; + + /** + * Create the holder with unitialised value. + */ + public NotFoundHolder() + { + } + + /** + * Create the holder, storing the given value. + */ + public NotFoundHolder(NotFound initialValue) + { + value = initialValue; + } + + /** + * Fill in the stored value, reading it from the given CDR stream. + */ + public void _read(InputStream in) + { + value = NotFoundHelper.read(in); + } + + /** + * Get the type code of the {@link NotFound} exception. + */ + public TypeCode _type() + { + return NotFoundHelper.type(); + } + + /** + * Write the stored value to the given CDR stream. + */ + public void _write(OutputStream out) + { + NotFoundHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReason.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReason.java new file mode 100644 index 000000000..4bb5bdbf3 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReason.java @@ -0,0 +1,134 @@ +/* NotFoundReason.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Represents the reason (explanation), why the binding cannot be found. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class NotFoundReason + implements IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -5689237060527596081L; + + /** + * The code for reason, when the node is missing. + */ + public static final int _missing_node = 0; + + /** + * The code for reason, when the binding type is object when + * it should be a context. + */ + public static final int _not_context = 1; + + /** + * The code for reason, when the binding type is context when + * it should be an object. + */ + public static final int _not_object = 2; + + /** + * The reason, when the node is missing. + */ + public static final NotFoundReason missing_node = + new NotFoundReason(_missing_node); + + /** + * The reason, when the binding type is object when it should be + * a context. + */ + public static final NotFoundReason not_context = + new NotFoundReason(_not_context); + + /** + * The reason, when the binding type is context when it should be + * and object. + */ + public static final NotFoundReason not_object = + new NotFoundReason(_not_object); + + /** + * The reason code for this instance. + */ + private int value; + + protected NotFoundReason(int a_value) + { + value = a_value; + } + + /** + * Get the reason object from the reason code. + * + * @throws BAD_PARAM for unsupported code. + */ + public static NotFoundReason from_int(int value) + { + switch (value) + { + case _missing_node : + return missing_node; + + case _not_context : + return not_context; + + case _not_object : + return not_object; + + default : + throw new BAD_PARAM("Unsupported not found reason: " + value); + } + } + + /** + * Get the reason code for this reason of not finding. + */ + public int value() + { + return value; + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java new file mode 100644 index 000000000..2648ae4a9 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java @@ -0,0 +1,128 @@ +/* NotFoundReasonHelper.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.CosNaming.NamingContextPackage; + +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 {@link NotFoundReason} + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NotFoundReasonHelper +{ + /** + * The {@link AlreadyBound} repository id. + */ + private static String _id = + "IDL:omg.org/CosNaming/NamingContext/NotFoundReason:1.0"; + + /** + * Extract the exception from the given {@link Any}. + */ + public static NotFoundReason extract(Any a) + { + try + { + return ((NotFoundReasonHolder) a.extract_Streamable()).value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Return the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Insert the exception into the given {@link Any}. + */ + public static void insert(Any a, NotFoundReason that) + { + a.insert_Streamable(new NotFoundReasonHolder(that)); + } + + /** + * Read the exception from the given CDR stream. + */ + public static NotFoundReason read(InputStream istream) + { + return NotFoundReason.from_int(istream.read_long()); + } + + /** + * Create the type code for this exception. + */ + public static TypeCode type() + { + return + OrbRestricted.Singleton.create_enum_tc(id(), "NotFoundReason", + new String[] + { + "missing_node", + "not_context", + "not_object" + } + ); + } + + /** + * Write the exception to the CDR output stream. + */ + public static void write(OutputStream ostream, NotFoundReason value) + { + ostream.write_long(value.value()); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHolder.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHolder.java new file mode 100644 index 000000000..b4958499e --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHolder.java @@ -0,0 +1,100 @@ +/* NotFoundReasonHolder.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.CosNaming.NamingContextPackage; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** +* The holder for class {@link NotFoundReason}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class NotFoundReasonHolder + implements Streamable +{ + /** + * The stored value. + */ + public NotFoundReason value; + + /** + * Create the holder with unitialized value. + */ + public NotFoundReasonHolder() + { + } + + /** + * Create the holder, storing the given intial value. + */ + public NotFoundReasonHolder(NotFoundReason initialValue) + { + value = initialValue; + } + + /** + * Read the holder from the CDR input stream. + */ + public void _read(InputStream in) + { + value = NotFoundReasonHelper.read(in); + } + + /** + * Get the type code of {@link NotFoundReason}. + * + * @return the typecode of enumeration, allowed value names being + * "missing_node", "not_context" and "not_object" + */ + public TypeCode _type() + { + return NotFoundReasonHelper.type(); + } + + /** + * Write the holder to the CDR output stream. + */ + public void _write(OutputStream out) + { + NotFoundReasonHelper.write(out, value); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/package.html b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/package.html new file mode 100644 index 000000000..37c56e255 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in org.omg.CosNaming.NamingContextPackage + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CosNaming.NamingContextExtPackage</title></head> + +<body> +<p>Provides exceptions and several other satelitte classes, needed by the naming service.</p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java b/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java new file mode 100644 index 000000000..3e7f7356c --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java @@ -0,0 +1,139 @@ +/* _BindingIteratorImplBase.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.CosNaming; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BooleanHolder; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.DynamicImplementation; +import org.omg.CORBA.ServerRequest; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CORBA.portable.Streamable; + +/** + * The binding iterator implementation base. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class _BindingIteratorImplBase + extends DynamicImplementation + implements BindingIterator, InvokeHandler +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 3472591176635005503L; + + /** + * The binding interator repository id. + */ + private static String[] ids = { BindingIteratorHelper.id() }; + + /** + * Return the list of repository ids. + */ + public String[] _ids() + { + return ids; + } + + /** + * Call the required method. + */ + public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) + { + OutputStream out = null; + + // We suppose that the next_n should be the most popular. + if (method.equals("next_n")) + { + // The next_n has been invoked. + int amount = in.read_ulong(); + BindingListHolder a_list = new BindingListHolder(); + + boolean result = next_n(amount, a_list); + + out = rh.createReply(); + out.write_boolean(result); + BindingListHelper.write(out, a_list.value); + } + else if (method.equals("next_one")) + { + // The next_one has been invoked. + BindingHolder a_binding = new BindingHolder(); + + boolean result = next_one(a_binding); + + out = rh.createReply(); + out.write_boolean(result); + BindingHelper.write(out, a_binding.value); + } + else if (method.equals("destroy")) + { + // The destroy has been invoked. + destroy(); + out = rh.createReply(); + } + else + throw new BAD_OPERATION(method, Minor.Method, + CompletionStatus.COMPLETED_MAYBE); + + return out; + } + + /** + * The obsolete invocation using server request. Implemented for + * compatibility reasons, but is it more effectinve to use + * {@link #_invoke}. + * + * @param request a server request. + */ + public void invoke(ServerRequest request) + { + // "destroy" has a void return type, the two other methods - boolean. + Streamable result = + request.operation().equals("destroy") ? null : new BooleanHolder(); + gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/_BindingIteratorStub.java b/libjava/classpath/org/omg/CosNaming/_BindingIteratorStub.java new file mode 100644 index 000000000..593a0cd68 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/_BindingIteratorStub.java @@ -0,0 +1,203 @@ +/* _BindingIteratorStub.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.CosNaming; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; + +/** + * The binding interator stub (proxy), used on the client side. + * The BindingIterator methods contains the code for remote invocaton. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _BindingIteratorStub + extends ObjectImpl + implements BindingIterator +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 8969257760771186704L; + + /** + * The object can be destroyed only once. + */ + private boolean destroyed; + + /** + * Create the stub. + */ + public _BindingIteratorStub() + { + super(); + } + + /** + * Create the stub that used the given delegate. + */ + _BindingIteratorStub(Delegate delegate) + { + super(); + _set_delegate(delegate); + } + + /** + * Get an array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { BindingIteratorHelper.id() }; + } + + /** + * Returns true if the object has been destroyed. + */ + public boolean _non_existent() + { + return destroyed; + } + + /** + * Destroys the object on the server side. + * The destruction message is sent only once, even if the method is + * called repeatedly. + */ + public void destroy() + { + if (destroyed) + return; + + InputStream _in = null; + try + { + OutputStream _out = _request("destroy", true); + _in = _invoke(_out); + destroyed = true; + } + catch (ApplicationException _ex) + { + _in = _ex.getInputStream(); + throw new MARSHAL(_ex.getId()); + } + catch (RemarshalException _rm) + { + destroy(); + } + finally + { + _releaseReply(_in); + } + } + + /** {@inheritDoc} */ + public boolean next_n(int amount, BindingListHolder a_list) + { + InputStream _in = null; + try + { + OutputStream _out = _request("next_n", true); + _out.write_ulong(amount); + _in = _invoke(_out); + + boolean result = _in.read_boolean(); + a_list.value = BindingListHelper.read(_in); + return result; + } + catch (ApplicationException _ex) + { + _in = _ex.getInputStream(); + throw new MARSHAL(_ex.getId()); + } + catch (RemarshalException _rm) + { + return next_n(amount, a_list); + } + finally + { + _releaseReply(_in); + } + } + + /** {@inheritDoc} */ + public boolean next_one(BindingHolder a_binding) + { + InputStream _in = null; + try + { + OutputStream _out = _request("next_one", true); + _in = _invoke(_out); + + boolean result = _in.read_boolean(); + a_binding.value = BindingHelper.read(_in); + return result; + } + catch (ApplicationException _ex) + { + _in = _ex.getInputStream(); + throw new MARSHAL(_ex.getId()); + } + catch (RemarshalException _rm) + { + return next_one(a_binding); + } + finally + { + _releaseReply(_in); + } + } + + /** + * Destroys the iterator instance on the server side, calling + * {@link #destroy()}. + * + * @throws java.lang.Throwable + */ + protected void finalize() + throws java.lang.Throwable + { + destroy(); + super.finalize(); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java b/libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java new file mode 100644 index 000000000..387e27e68 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/_NamingContextExtImplBase.java @@ -0,0 +1,237 @@ +/* _NamingContextExtImplBase.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.CosNaming; + +import org.omg.CORBA.ObjectHolder; +import org.omg.CORBA.ServerRequest; +import org.omg.CORBA.StringHolder; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CORBA.portable.Streamable; +import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; +import org.omg.CosNaming.NamingContextExtPackage.InvalidAddressHelper; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.CannotProceedHelper; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.InvalidNameHelper; +import org.omg.CosNaming.NamingContextPackage.NotFound; +import org.omg.CosNaming.NamingContextPackage.NotFoundHelper; + +import java.util.Hashtable; + +/** + * The extended naming context implementation base. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class _NamingContextExtImplBase + extends _NamingContextImplBase + implements NamingContextExt, InvokeHandler +{ + static Hashtable<String,Integer> _methods = new Hashtable<String,Integer>(); + + static + { + _methods.put("to_string", new java.lang.Integer(0)); + _methods.put("to_name", new java.lang.Integer(1)); + _methods.put("to_url", new java.lang.Integer(2)); + _methods.put("resolve_str", new java.lang.Integer(3)); + } + + /** + * This stub can be the base of the two CORBA objects, so it + * has two repository ids. + */ + private static String[] __ids = + { NamingContextExtHelper.id(), NamingContextHelper.id() }; + + /** + * Return the array of repository ids for this object. + * This stub can be the base of the two CORBA objects, so it + * has two repository ids, for {@link NamingContext} and + * for {@link NamingContextExt}. + */ + public String[] _ids() + { + return __ids; + } + + public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) + { + Integer call_method = _methods.get(method); + + if (call_method == null) + + // The older methods are handled by the parent class. + return super._invoke(method, in, rh); + + OutputStream out = null; + + switch (call_method.intValue()) + { + case 0 : // to_string + { + try + { + NameComponent[] a_name = NameHelper.read(in); + String result = null; + result = this.to_string(a_name); + out = rh.createReply(); + out.write_string(result); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 1 : // to_name + { + try + { + String a_name_string = in.read_string(); + NameComponent[] result = to_name(a_name_string); + out = rh.createReply(); + NameHelper.write(out, result); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 2 : // to_url + { + try + { + String an_address = in.read_string(); + String a_name_string = in.read_string(); + String result = to_url(an_address, a_name_string); + out = rh.createReply(); + out.write_string(result); + } + catch (InvalidAddress ex) + { + out = rh.createExceptionReply(); + InvalidAddressHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 3 : // resolve_str + { + try + { + String a_name_string = in.read_string(); + org.omg.CORBA.Object result = resolve_str(a_name_string); + out = rh.createReply(); + org.omg.CORBA.ObjectHelper.write(out, result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + } + return out; + } + + /** + * The obsolete invocation using server request. Implemented for + * compatibility reasons, but is it more effectinve to use + * {@link #_invoke}. + * + * @param request a server request. + */ + public void invoke(ServerRequest request) + { + Streamable result = null; + + Integer call_method = _methods.get(request.operation()); + + if (call_method == null) + { + super.invoke(request); + return; + } + + switch (call_method.intValue()) + { + case 0 : // to_string, String + result = new StringHolder(); + break; + + case 1 : // to_name, Name + result = new NameHolder(); + break; + + case 2 : // to_url, String + result = new StringHolder(); + break; + + case 3 : // resolve_str, Object + result = new ObjectHolder(); + break; + } + gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java b/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java new file mode 100644 index 000000000..620c06b0b --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java @@ -0,0 +1,210 @@ +/* _NamingContextExtStub.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.CosNaming; + +import gnu.CORBA.NamingService.NameTransformer; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CosNaming.NamingContextExtPackage.AddressHelper; +import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress; +import org.omg.CosNaming.NamingContextExtPackage.InvalidAddressHelper; +import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper; +import org.omg.CosNaming.NamingContextExtPackage.URLStringHelper; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.InvalidNameHelper; +import org.omg.CosNaming.NamingContextPackage.NotFound; + +/** + * The extended naming context stub (proxy), used on the client side. + * The most of the {@link NamingContextExt} methods contain the code + * for remote invocaton. However as remote invocation is potencially an + * expensive step, some trivial methods, not requiring access to the + * naming database, are handled locally (see the method descriptions for + * details). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _NamingContextExtStub + extends _NamingContextStub + implements NamingContextExt +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 6333293895664182866L; + + /** + * This stub can be the base of the two CORBA objects, so it + * has two repository ids. + */ + private static String[] __ids = + { NamingContextExtHelper.id(), NamingContextHelper.id() }; + + /** + * The local name form converter. + */ + private NameTransformer converter = new NameTransformer(); + + /** + * Create the naming context stub. + */ + public _NamingContextExtStub() + { + super(); + } + + /** + * Create the naming context stub with the given delegate. + */ + _NamingContextExtStub(Delegate delegate) + { + super(delegate); + } + + /** + * Return the array of repository ids for this object. + * This stub can be the base of the two CORBA objects, so it + * has two repository ids, for {@link NamingContext} and + * for {@link NamingContextExt}. + */ + public String[] _ids() + { + return (String[]) __ids.clone(); + } + + /** {@inheritDoc} */ + public org.omg.CORBA.Object resolve_str(String a_name_string) + throws NotFound, CannotProceed, InvalidName + { + InputStream in = null; + try + { + OutputStream _out = _request("resolve_str", true); + StringNameHelper.write(_out, a_name_string); + in = _invoke(_out); + + return ObjectHelper.read(in); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + throw4(in, id); + + // Should never happen. + throw new InternalError(); + } + catch (RemarshalException _rm) + { + return resolve_str(a_name_string); + } + finally + { + _releaseReply(in); + } + } + + /** + * Converts the string name representation into the array + * name representation. + * + * This method is handled locally. + */ + public NameComponent[] to_name(String a_name_string) + throws InvalidName + { + return converter.toName(a_name_string); + } + + /** + * Convert the name array representation to the name string + * representation. + * + * This method is handled locally. + */ + public String to_string(NameComponent[] a_name) + throws InvalidName + { + return converter.toString(a_name); + } + + /** {@inheritDoc} */ + public String to_url(String an_address, String a_name_string) + throws InvalidAddress, InvalidName + { + InputStream in = null; + try + { + OutputStream _out = _request("to_url", true); + AddressHelper.write(_out, an_address); + StringNameHelper.write(_out, a_name_string); + in = _invoke(_out); + + return URLStringHelper.read(in); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + if (id.equals(InvalidAddressHelper.id())) + throw InvalidAddressHelper.read(in); + else if (id.equals(InvalidNameHelper.id())) + throw InvalidNameHelper.read(in); + else + throw new MARSHAL(id); + } + catch (RemarshalException _rm) + { + return to_url(an_address, a_name_string); + } + finally + { + _releaseReply(in); + } + } +} diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java new file mode 100644 index 000000000..115ef74c3 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java @@ -0,0 +1,415 @@ +/* _NamingContextImplBase.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.CosNaming; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.DynamicImplementation; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.ObjectHolder; +import org.omg.CORBA.ServerRequest; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.CORBA.portable.Streamable; +import org.omg.CosNaming.NamingContextPackage.AlreadyBound; +import org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.CannotProceedHelper; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.InvalidNameHelper; +import org.omg.CosNaming.NamingContextPackage.NotEmpty; +import org.omg.CosNaming.NamingContextPackage.NotEmptyHelper; +import org.omg.CosNaming.NamingContextPackage.NotFound; +import org.omg.CosNaming.NamingContextPackage.NotFoundHelper; + +import java.util.Hashtable; + +/** + * The naming context implementation base. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class _NamingContextImplBase + extends DynamicImplementation + implements NamingContext, InvokeHandler +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -114280294134561035L; + + /** + * As there are quite many methods, it may be sensible to use the hashtable. + * This field is also reused in NamingContextPOA. + */ + static Hashtable<String,Integer> methods = new Hashtable<String,Integer>(); + + /** + * Put all methods into the table. + */ + static + { + methods.put("bind", new Integer(0)); + methods.put("rebind", new Integer(1)); + methods.put("bind_context", new Integer(2)); + methods.put("rebind_context", new Integer(3)); + methods.put("resolve", new Integer(4)); + methods.put("unbind", new Integer(5)); + methods.put("new_context", new Integer(6)); + methods.put("bind_new_context", new Integer(7)); + methods.put("destroy", new Integer(8)); + methods.put("list", new Integer(9)); + } + + /** + * Return the array of repository ids. + */ + public String[] _ids() + { + return new String[] { NamingContextHelper.id() }; + } + + /** + * The server calls this method after receiving the request message + * from client. The implementation base calls one of its abstract + * methods to perform the requested operation. + * + * @param method the method being invoked. + * @param in the stream to read parameters from. + * @param rh the handler to get a stream for writing a response. + * + * @return the stream, returned by the handler. + */ + public OutputStream _invoke(String method, InputStream in, ResponseHandler rh) + { + OutputStream out = null; + Integer call_method = methods.get(method); + if (call_method == null) + throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE); + + switch (call_method.intValue()) + { + case 0 : // bind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object an_object = ObjectHelper.read(in); + bind(a_name, an_object); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + break; + } + + case 1 : // rebind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object an_object = ObjectHelper.read(in); + rebind(a_name, an_object); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 2 : // bind_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext a_context = NamingContextHelper.read(in); + bind_context(a_name, a_context); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + break; + } + + case 3 : // rebind_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext a_context = NamingContextHelper.read(in); + rebind_context(a_name, a_context); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 4 : // resolve + { + try + { + NameComponent[] a_name = NameHelper.read(in); + org.omg.CORBA.Object __result = null; + __result = resolve(a_name); + out = rh.createReply(); + ObjectHelper.write(out, __result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 5 : // unbind + { + try + { + NameComponent[] a_name = NameHelper.read(in); + unbind(a_name); + out = rh.createReply(); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 6 : // new_context + { + NamingContext __result = null; + __result = new_context(); + out = rh.createReply(); + NamingContextHelper.write(out, __result); + break; + } + + case 7 : // bind_new_context + { + try + { + NameComponent[] a_name = NameHelper.read(in); + NamingContext __result = null; + __result = bind_new_context(a_name); + out = rh.createReply(); + NamingContextHelper.write(out, __result); + } + catch (NotFound ex) + { + out = rh.createExceptionReply(); + NotFoundHelper.write(out, ex); + } + catch (AlreadyBound ex) + { + out = rh.createExceptionReply(); + AlreadyBoundHelper.write(out, ex); + } + catch (CannotProceed ex) + { + out = rh.createExceptionReply(); + CannotProceedHelper.write(out, ex); + } + catch (InvalidName ex) + { + out = rh.createExceptionReply(); + InvalidNameHelper.write(out, ex); + } + break; + } + + case 8 : // destroy + { + try + { + destroy(); + out = rh.createReply(); + } + catch (NotEmpty ex) + { + out = rh.createExceptionReply(); + NotEmptyHelper.write(out, ex); + } + break; + } + + case 9 : // list + { + int amount = in.read_ulong(); + BindingListHolder a_list = new BindingListHolder(); + BindingIteratorHolder an_iter = new BindingIteratorHolder(); + list(amount, a_list, an_iter); + out = rh.createReply(); + BindingListHelper.write(out, a_list.value); + BindingIteratorHelper.write(out, an_iter.value); + break; + } + + default : + throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE); + } + + return out; + } + + /** + * The obsolete invocation using server request. Implemented for + * compatibility reasons, but is it more effectinve to use + * {@link #_invoke}. + * + * @param request a server request. + */ + public void invoke(ServerRequest request) + { + Streamable result = null; + + // The server request contains no required result type. + Integer call_method = methods.get(request.operation()); + if (call_method == null) + throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE); + + switch (call_method.intValue()) + { + case 4 : // resolve, object + result = new ObjectHolder(); + break; + + case 6 : // new_context, NamingContext + case 7 : // bind_new_context, NamingContext + { + result = new NamingContextHolder(); + break; + } + + default : // void for others. + result = null; + } + + gnu.CORBA.ServiceRequestAdapter.invoke(request, this, result); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextStub.java b/libjava/classpath/org/omg/CosNaming/_NamingContextStub.java new file mode 100644 index 000000000..d348c81ab --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/_NamingContextStub.java @@ -0,0 +1,454 @@ +/* _NamingContextStub.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.CosNaming; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CosNaming.NamingContextPackage.AlreadyBound; +import org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper; +import org.omg.CosNaming.NamingContextPackage.CannotProceed; +import org.omg.CosNaming.NamingContextPackage.CannotProceedHelper; +import org.omg.CosNaming.NamingContextPackage.InvalidName; +import org.omg.CosNaming.NamingContextPackage.InvalidNameHelper; +import org.omg.CosNaming.NamingContextPackage.NotEmpty; +import org.omg.CosNaming.NamingContextPackage.NotEmptyHelper; +import org.omg.CosNaming.NamingContextPackage.NotFound; +import org.omg.CosNaming.NamingContextPackage.NotFoundHelper; + +/** + * The naming context stub (proxy), used on the client side. + * The {@link NamingContext} methods contain the code for remote + * invocaton. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _NamingContextStub + extends ObjectImpl + implements NamingContext +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 6835430958405349379L; + + /** + * Create the naming context stub. + */ + public _NamingContextStub() + { + super(); + } + + /** + * Create the naming context stub with the given delegate. + */ + _NamingContextStub(Delegate delegate) + { + super(); + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { NamingContextHelper.id() }; + } + + /** {@inheritDoc} */ + public void bind(NameComponent[] a_name, org.omg.CORBA.Object an_object) + throws NotFound, CannotProceed, InvalidName, AlreadyBound + { + InputStream in = null; + try + { + OutputStream out = _request("bind", true); + NameHelper.write(out, a_name); + ObjectHelper.write(out, an_object); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + throw5(in, id); + } + catch (RemarshalException remarsh) + { + bind(a_name, an_object); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public void bind_context(NameComponent[] a_name, NamingContext a_context) + throws NotFound, CannotProceed, InvalidName, AlreadyBound + { + InputStream in = null; + try + { + OutputStream out = _request("bind_context", true); + NameHelper.write(out, a_name); + NamingContextHelper.write(out, a_context); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + throw5(in, id); + } + catch (RemarshalException remarsh) + { + bind_context(a_name, a_context); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public NamingContext bind_new_context(NameComponent[] a_name) + throws NotFound, AlreadyBound, CannotProceed, + InvalidName + { + InputStream in = null; + try + { + OutputStream out = _request("bind_new_context", true); + NameHelper.write(out, a_name); + in = _invoke(out); + + NamingContext __result = NamingContextHelper.read(in); + return __result; + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + throw5(in, id); + throw new InternalError(); + } + catch (RemarshalException remarsh) + { + return bind_new_context(a_name); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public void destroy() + throws NotEmpty + { + InputStream in = null; + try + { + OutputStream out = _request("destroy", true); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + if (id.equals(NotEmptyHelper.id())) + throw NotEmptyHelper.read(in); + else + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + destroy(); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public void list(int amount, BindingListHolder a_list, + BindingIteratorHolder an_iter + ) + { + InputStream in = null; + try + { + OutputStream out = _request("list", true); + out.write_ulong(amount); + in = _invoke(out); + a_list.value = BindingListHelper.read(in); + an_iter.value = BindingIteratorHelper.read(in); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException remarsh) + { + list(amount, a_list, an_iter); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public NamingContext new_context() + { + InputStream in = null; + try + { + OutputStream out = _request("new_context", true); + in = _invoke(out); + + NamingContext __result = NamingContextHelper.read(in); + return __result; + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException remarsh) + { + return new_context(); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public void rebind(NameComponent[] a_name, org.omg.CORBA.Object an_object) + throws NotFound, CannotProceed, InvalidName + { + InputStream in = null; + try + { + OutputStream out = _request("rebind", true); + NameHelper.write(out, a_name); + ObjectHelper.write(out, an_object); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + throw4(in, id); + } + catch (RemarshalException remarsh) + { + rebind(a_name, an_object); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public void rebind_context(NameComponent[] a_name, NamingContext a_context) + throws NotFound, CannotProceed, InvalidName + { + InputStream in = null; + try + { + OutputStream out = _request("rebind_context", true); + NameHelper.write(out, a_name); + NamingContextHelper.write(out, a_context); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + throw4(in, id); + } + catch (RemarshalException remarsh) + { + rebind_context(a_name, a_context); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public org.omg.CORBA.Object resolve(NameComponent[] a_name) + throws NotFound, CannotProceed, InvalidName + { + InputStream in = null; + try + { + OutputStream out = _request("resolve", true); + NameHelper.write(out, a_name); + in = _invoke(out); + + org.omg.CORBA.Object __result = ObjectHelper.read(in); + return __result; + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + throw4(in, id); + throw new InternalError(); + } + catch (RemarshalException remarsh) + { + return resolve(a_name); + } + finally + { + _releaseReply(in); + } + } + + /** {@inheritDoc} */ + public void unbind(NameComponent[] a_name) + throws NotFound, CannotProceed, InvalidName + { + InputStream in = null; + try + { + OutputStream out = _request("unbind", true); + NameHelper.write(out, a_name); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + String id = ex.getId(); + if (id.equals(NotFoundHelper.id())) + throw NotFoundHelper.read(in); + else if (id.equals(CannotProceedHelper.id())) + throw CannotProceedHelper.read(in); + else if (id.equals(InvalidNameHelper.id())) + throw InvalidNameHelper.read(in); + else + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + unbind(a_name); + } + finally + { + _releaseReply(in); + } + } + + /** + * Throw one of the three possible exceptions, as specified in + * the passed exception repository id. + * + * This method should never return normally. + * + * @param in the stream to read the exception from. + * @param id the exception id. + * + * @throws InvalidName if the id matches. + * @throws CannotProceed if the id matches. + * @throws NotFound if the id matches. + * @throws MARSHAL if the id does not match any of the previous 4 exceptions. + */ + void throw4(InputStream in, String id) + throws MARSHAL, InvalidName, CannotProceed, NotFound + { + if (id.equals(NotFoundHelper.id())) + throw NotFoundHelper.read(in); + else if (id.equals(CannotProceedHelper.id())) + throw CannotProceedHelper.read(in); + else if (id.equals(InvalidNameHelper.id())) + throw InvalidNameHelper.read(in); + else + throw new MARSHAL(id); + } + + /** + * Throw one of the five possible exceptions, as specified in + * the passed exception repository id. + * + * This method should never return normally. + * + * @param in the stream to read the exception from. + * @param id the exception id. + * + * @throws AlreadyBound if the id matches. + * @throws InvalidName if the id matches. + * @throws CannotProceed if the id matches. + * @throws NotFound if the id matches. + * @throws MARSHAL if the id does not match any of the previous 4 exceptions. + */ + void throw5(InputStream in, String id) + throws MARSHAL, AlreadyBound, InvalidName, CannotProceed, + NotFound + { + if (id.equals(AlreadyBoundHelper.id())) + throw AlreadyBoundHelper.read(in); + else + throw4(in, id); + } +} diff --git a/libjava/classpath/org/omg/CosNaming/package.html b/libjava/classpath/org/omg/CosNaming/package.html new file mode 100644 index 000000000..69dc0bf8e --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/package.html @@ -0,0 +1,50 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - the naming service description. + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - javax.swing.text.html.parser</title></head> + +<body> +<p> +The COS (Common Object Service) Naming Service allows an object to be found from its symbolic name. The client obtains the object reference invoking the naming service as any other CORBA service. The naming service itself can be located from the stringified object reference (see {@link org.omg.CORBA.ORB#string_to_object(String)} or from the ORB pre-configured data by passing "NameService" to {@link org.omg.CORBA.ORB.Object#resolve_initial_references(String)}. The returned object is casted to the NamingContextExt using {@link org.omg.CosNaming.NamingContextExtHelper#narrow}. The Naming Service can reside on any host accessible within the network. +</p><p> +The default pre-configured location method uses two parameters (properties, applet parameters or command line parameters): org.omg.CORBA.ORBInitialHost and org.omg.CORBA.ORBInitialPort. If these parameters are missing, the naming service is supposed to be running at port 900 on the local host. +</p> +@author Audrius Meskauskas, Lithuania +</body> +</html> diff --git a/libjava/classpath/org/omg/Dynamic/Parameter.java b/libjava/classpath/org/omg/Dynamic/Parameter.java new file mode 100644 index 000000000..a1a5c8374 --- /dev/null +++ b/libjava/classpath/org/omg/Dynamic/Parameter.java @@ -0,0 +1,90 @@ +/* Parameter.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.Dynamic; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ParameterMode; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * When representing the information about a request, + * defines a one of the arguments for the operation being invoked. + * + * @see org.omg.PortableInterceptor.RequestInfoOperations#arguments() + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class Parameter + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 892191606993734699L; + + /** + * The {@link Any}, holding the value of the parameter. + */ + public Any argument; + + /** + * The mode of the parameter. Specifies if the parameter is used + * to pass the value to the method, to return the value from the + * method or for both of these purposes. + */ + public ParameterMode mode; + + /** + * Create the uninitialised instance. + */ + public Parameter() + { + } + + /** + * Create an instance, initialising field to the passed values. + */ + public Parameter(Any an_argument, ParameterMode a_mode) + { + argument = an_argument; + mode = a_mode; + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/AnySeqHelper.java b/libjava/classpath/org/omg/DynamicAny/AnySeqHelper.java new file mode 100644 index 000000000..5dd08096d --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/AnySeqHelper.java @@ -0,0 +1,116 @@ +/* AnySeqHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.AnySeqHolder; +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 the array of {@link Any}. This class shares + * the same {@link AnySeqHolder} as the {@link org.omg.CORBA.AnySeqHelper}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AnySeqHelper +{ + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#extract}. + */ + public static Any[] extract(Any any) + { + return org.omg.CORBA.AnySeqHelper.extract(any); + } + + /** + * Get the AnySeq repository id. + * + * @return "IDL:omg.org/DynamicAny/AnySeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/AnySeq:1.0"; + } + + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#insert}. + */ + public static void insert(Any any, Any[] those) + { + org.omg.CORBA.AnySeqHelper.insert(any, those); + } + + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#read}. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static Any[] read(InputStream input) + { + return org.omg.CORBA.AnySeqHelper.read(input); + } + + /** + * Get the typecode as officially defined for this helper. + * + * @return alias of unbounded sequence of Any's, named AnySeq, + * with the id, returned by {@link #id()}. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + TypeCode t = + orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_any)); + return orb.create_alias_tc(id(), "AnySeq", t); + } + + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#write}. + */ + public static void write(OutputStream output, Any[] value) + { + org.omg.CORBA.AnySeqHelper.write(output, value); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAny.java b/libjava/classpath/org/omg/DynamicAny/DynAny.java new file mode 100644 index 000000000..cdb7a4285 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAny.java @@ -0,0 +1,71 @@ +/* DynAny.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The DynAny interface provides possibility to access the components of the + * CORBA object, stored inside the {@link Any}. The DynAny and derived classes + * additionally allows to access the members of the sequence, structure, union + * and get the data about enumeration, value type and CORBA <code>fixed</code> + * without knowing the exact type at the run time. The returned members are also + * wrapped into DynAny objects, allowing them to be the nested structures. + * </p> + * <p> + * The DynAny's are usually produced by {@link DynAnyFactory}. This factory is + * obtained from the ORB: <br> + * <code> + * DynAnyFactory f = DynAnyFactoryHelper.narrow + * (orb.resolve_initial_references("DynAnyFactory")); + * </code> + * </p> + * <p> + * DynAny can also be returned by a method, invoked on another DynAny. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAny + extends DynAnyOperations, IDLEntity, org.omg.CORBA.Object, Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactory.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactory.java new file mode 100644 index 000000000..5d4cc7249 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactory.java @@ -0,0 +1,55 @@ +/* DynAnyFactory.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Produces DynAnys from Anys or typecodes. The produced DynAnys are initialized + * to they agreed default values. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAnyFactory + extends DynAnyFactoryOperations, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java new file mode 100644 index 000000000..2720656cc --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java @@ -0,0 +1,188 @@ +/* DynAnyFactoryHelper.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.DynamicAny; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynAnyFactory}. Following the 1.5 JDK + * specifications, DynAnyFactory is always a local object, so the two methods of + * this helper ({@link #read} and {@link #write} are not in use, always + * throwing {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynAnyFactoryHelper +{ + /** + * Cast the passed object into the DynAnyFactory. As DynAnyFactory is a local + * object, the method just uses java final_type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynAnyFactory. + */ + public static DynAnyFactory narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynAnyFactory) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + + " is not a DynAnyFactory"); + } + } + + /** + * Narrow the given object to the DynAnyFactory. 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 also OMG issue 4158. + * + * @param obj the object to cast. + * + * @return the casted DynAnyFactory. + * + * @since 1.5 + */ + public static DynAnyFactory unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the final_type code of the {@link DynAnyFactory}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynAnyFactory"); + } + + /** + * Insert the DynAnyFactory into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynAnyFactory to insert. + */ + public static void insert(Any any, DynAnyFactory that) + { + any.insert_Object(that); + } + + /** + * Extract the DynAnyFactory from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynAnyFactory. + */ + public static DynAnyFactory extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynAnyFactory repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAnyFactory:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAnyFactory:1.0"; + } + + /** + * This should read DynAnyFactory from the CDR input stream, but (following + * the JDK 1.5 API) it does not. The factory can only be obtained from the + * ORB. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynAnyFactory read(InputStream input) + { + throw new MARSHAL(not_applicable(id())); + } + + /** + * This should read DynAnyFactory from the CDR input stream, but (following + * the JDK 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynAnyFactory value) + { + throw new MARSHAL(not_applicable(id())); + } + + /** + * The package level method for throwing exception, explaining that the + * operation is not applicable. + * + * @param Id the Id for the typecode for that the operations was attempted to + * perform. + */ + static String not_applicable(String Id) + { + MARSHAL m = new MARSHAL("The read/write are not applicable for " + Id); + m.minor = Minor.Inappropriate; + throw m; + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryOperations.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryOperations.java new file mode 100644 index 000000000..c3cd919ad --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryOperations.java @@ -0,0 +1,154 @@ +/* DynAnyFactoryOperations.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.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; + +/** + * Defines the operations, applicable for DynAnyFactory. These operations + * produce new DynAny's either from Any, serving as a template and value + * provider, or from the given typecode. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAnyFactoryOperations +{ + /** + * Create DynAny for holding the data of the given type. The returned DynAny + * is initialised to its agreed default value. The agreed default values are: + * <table border='1'> + * <tr> + * <th>Type</th> + * <th>Value</th> + * <th>Creates</th> + * </tr> + * + * <tr> + * <td>boolean</td> + * <td>false</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>numeric types, octet, fixed</td> + * <td>0</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>char, wchar</td> + * <td>(char) 0</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>string, wstring</td> + * <td>empty string ("", not <code>null<code>)</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>{@link Any}</td> + * <td>{@link Any} with no value and typecode of kind {@link TCKind#tk_null}</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>Sequence</td> + * <td>Empty (zero size) sequence</td> + * <td>{@link DynSequence}</td> + * </tr> + * <tr> + * <td>Array</td> + * <td>All members of array are recursively initialised to default values.</td> + * <td>{@link DynArray}</td> + * </tr> + * <tr> + * <td>Structure, exception</td> + * <td>All fields of the structure (if any) are recursively initialised to + * default values.</td> + * <td>{@link DynStruct}</td> + * </tr> + * <tr> + * <td>Enumeration</td> + * <td>Default value, indicated by typecode.</td> + * <td>{@link DynEnum}</td> + * </tr> + * <tr> + * <td>Union</td> + * <td>Default variant (indicated by typecode), recursively initialised to + * its default value.</td> + * <td>{@link DynUnion}</td> + * </tr> + * <tr> + * <td>Value, ValueBox</td> + * <td>null</td> + * <td>{@link DynValue}, {@link DynValueBox}</td> + * </tr> + * <tr> + * <td>TypeCode</td> + * <td>Typecode of kind <code>TCKind.tk_null</code></td> + * <td>{@link DynValue}, {@link DynValueBox}</td> + * </tr> + * + * </table> + * + * @param type the type of the data being stored. + * + * @return the created DynAny, having the passed type. + * + * @throws InconsistentTypeCode if type.kind() is tk_Principal, tk_native or + * tk_abstract_interface. These types cannot be stored in DynAny. + */ + DynAny create_dyn_any_from_type_code(TypeCode type) + throws InconsistentTypeCode; + + /** + * Create DynAny using the given Any as template. + * + * @param value the Any, providing type and value for the DynAny being + * created. + * + * @return the created DynAny, having the same type and storing the same value + * as the passed Any. + * + * @throws InconsistentTypeCode if value.type().kind() is tk_Principal, + * tk_native or tk_abstract_interface. These types cannot be stored in DynAny. + */ + DynAny create_dyn_any(Any value) + throws InconsistentTypeCode; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCode.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCode.java new file mode 100644 index 000000000..bf1d2e97c --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCode.java @@ -0,0 +1,82 @@ +/* InconsistentTypeCode.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.DynamicAny.DynAnyFactoryPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* The InconsistentTypeCode is thrown on the attempt to create +* an {@link org.omg.DynamicAny.DynAny} for <code>Principal</code> +* or <code>native</code> data types. The OMG documentation states +* that these two types should not be suported by org.omg.DynamicAny +* package. +* +* @see org.omg.DynamicAny.DynAnyOperations +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public final class InconsistentTypeCode + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 3679785322052655944L; + + /** + * Create InconsistentTypeCode with no explaining message. + */ + public InconsistentTypeCode() + { + } + + /** + * Create the InconsistentTypeCode with explaining message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public InconsistentTypeCode(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java new file mode 100644 index 000000000..70313004f --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java @@ -0,0 +1,140 @@ +/* InconsistentTypeCodeHelper.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.DynamicAny.DynAnyFactoryPackage; + +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 InconsistentTypeCode}. +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public abstract class InconsistentTypeCodeHelper +{ + /** + * Create the InconsistentTypeCode typecode (structure, named + * "InconsistentTypeCode"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[0]; + return orb.create_exception_tc(id(), "InconsistentTypeCode", members); + } + + /** + * Insert the InconsistentTypeCode into the given Any. + * + * @param any the Any to insert into. + * @param that the InconsistentTypeCode to insert. + */ + public static void insert(Any any, InconsistentTypeCode that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the InconsistentTypeCode from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain + * InconsistentTypeCode. + */ + public static InconsistentTypeCode extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (InconsistentTypeCode) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("InconsistentTypeCode expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the InconsistentTypeCode repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAnyFactory/InconsistentTypeCode:1.0". + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAnyFactory/InconsistentTypeCode:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static InconsistentTypeCode read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + InconsistentTypeCode value = new InconsistentTypeCode(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, InconsistentTypeCode value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java new file mode 100644 index 000000000..e376367ef --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java @@ -0,0 +1,171 @@ +/* DynAnyHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynAny}. Following the 1.5 JDK + * specifications, DynAny is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynAnyHelper +{ + /** + * Cast the passed object into the DynAny. As DynAny is a local object, the + * method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynAny. + */ + public static DynAny narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynAny) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynAny"); + } + } + + /** + * Narrow the given object to the DynAny. 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 also OMG issue 4158. + * + * @param obj the object to cast. + * + * @return the casted DynAny. + * + * @since 1.5 + */ + public static DynAny unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynAny}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynAny"); + } + + /** + * Insert the DynAny into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynAny to insert. + */ + public static void insert(Any any, DynAny that) + { + any.insert_Object(that); + } + + /** + * Extract the DynAny from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynAny. + */ + public static DynAny extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynAny repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAny:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAny:1.0"; + } + + /** + * This should read DynAny from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynAny read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynAny from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynAny value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyOperations.java b/libjava/classpath/org/omg/DynamicAny/DynAnyOperations.java new file mode 100644 index 000000000..a009f4c88 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyOperations.java @@ -0,0 +1,540 @@ +/* DynAnyOperations.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.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Defines the operations, applicable to {@link DynAny}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAnyOperations +{ + /** + * Initialises the value of this DynAny with the value, stored inside the + * passed DynAny, making a shallow copy. + * + * @param from the DynAny to copy from. + * @throws TypeMismatch if the source DynAny is invalid. + */ + void assign(DynAny from) + throws TypeMismatch; + + /** + * Fully clones the content of this Any, returning a deep copy. + */ + DynAny copy(); + + /** + * Returns the focused component of this DynAny. The DynAny has the internal + * pointer (reference) that can point to one of its components. The returned + * DynAny can be used to get or set the value of the focused component. If the + * DynAny holds a primitive type with no components, this implementation + * returns <code>null</code>. + * + * @throws TypeMismatch if called on DynAny that cannot have active + * components, like {@link DynEnum}. + */ + DynAny current_component() + throws TypeMismatch; + + /** + * Destroys this DynAny, freeing the used resources. In java, resources are + * freed by the garbage collectors, so this method typically returns without + * action. + */ + void destroy(); + + /** + * Makes a DynAny from the {@link Any}. The passed {@link Any} becomes the + * enclosed instance of this DynAny, allowing to change/traverse the + * {@link Any} fields by the {@link DynAny} methods. + * + * @throws TypeMismatch if the type of this DynAny differs from the type of + * the passed Any. The DynAny cannot be reused with the enclosed type + * different from that it was initially created. + * @throws InvalidValue if the value, stored in the passed parameter, is + * otherwise invalid. + */ + void from_any(Any an_any) + throws TypeMismatch, InvalidValue; + + /** + * This method is used when the wrapped Any contains an instance of another + * Any itself. The method returns this second enclosed Any. + * + * @throws TypeMismatch if the typecode of the accessed Any is not the same as + * the typecode of this DynAny. + */ + Any get_any() + throws TypeMismatch, InvalidValue; + + /** + * Extract the boolean value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + boolean get_boolean() + throws TypeMismatch, InvalidValue; + + /** + * Extract the char value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + char get_char() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>double</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + double get_double() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>float</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + float get_float() + throws TypeMismatch, InvalidValue; + + /** + * Extract the int (CORBA long) value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + int get_long() + throws TypeMismatch, InvalidValue; + + /** + * Extract the long (CORBA long long) value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + long get_longlong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the byte (CORBA octet) value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + byte get_octet() + throws TypeMismatch, InvalidValue; + + /** + * Extract the CORBA object reference that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>short</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + short get_short() + throws TypeMismatch, InvalidValue; + + /** + * Extract the string value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + String get_string() + throws TypeMismatch, InvalidValue; + + /** + * Extract the {@link TypeCode} value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + TypeCode get_typecode() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsigned int (CORBA ulong) value that is expected to be stored + * in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + int get_ulong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsingel long (CORBA unsigned long long )value that is expected + * to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + long get_ulonglong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsigned short value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + short get_ushort() + throws TypeMismatch, InvalidValue; + + /** + * Extract the value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + Serializable get_val() + throws TypeMismatch, InvalidValue; + + /** + * Extract the wide (usually UTF-16) character value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + char get_wchar() + throws TypeMismatch, InvalidValue; + + /** + * Extract the wide (usually UFT-16) string that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + String get_wstring() + throws TypeMismatch, InvalidValue; + + /** + * Insert the {@link Any} value into the enclosed {@link Any} inside this + * DynAny. + * + * @param an_any the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_any(Any an_any) + throws TypeMismatch, InvalidValue; + + /** + * Insert the boolean value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_boolean(boolean a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the char value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_char(char a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the double value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_double(double a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the float value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_float(float a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the int (CORBA long) value into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_long(int a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the long (CORBA long long) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_longlong(long a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the byte (CORBA octet) value into the enclosed {@link Any} inside + * this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_octet(byte a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the object reference into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_reference(org.omg.CORBA.Object a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the <code>short</code> value into the enclosed {@link Any} inside + * this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_short(short a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the string value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_string(String a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the {@link TypeCode} value into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_typecode(TypeCode a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the int (CORBA unsinged long) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ulong(int a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the long (CORBA unsigned long long) value into the enclosed + * {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ulonglong(long a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the short (CORBA unsigned short) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ushort(short a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_val(Serializable a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the wide char (usually UTF-16) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_wchar(char a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the wide string (usually UTF-16) into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_wstring(String a_x) + throws InvalidValue, TypeMismatch; + + /** + * Advances the internal pointer, described in the {@link #current_component}, + * one position forward. + * + * @return true if the pointer now points to the new component, false if there + * are no more components of this DynAny holds a basic type that is not + * divided into components. + */ + boolean next(); + + /** + * Moves the internal pointer, described in the {@link #current_component}, to + * the first component. + */ + void rewind(); + + /** + * Moves the internal pointer, described in the {@link #current_component}, to + * the given position. + * + * @param p the number of the internal component on that the internal pointer + * must be focused. + * @return true on success or false if there is no component with the given + * number. If the DynAny holds the basic type, this method returs false p + * values other than 0. + */ + boolean seek(int p); + + /** + * Returns a shallow copy of the enclosed {@link Any}, + * + * @return shallow copy of the enclosed {@link Any}. + */ + Any to_any(); + + /** + * Returns the typecode of the object, inserted into this DynAny. + * + * @return the typecode of the inserted {@link Any} or null typecode if no + * {@link Any has been yet inserted}. + */ + TypeCode type(); + + /** + * Insert a value at the current position. + * + * @param insert_it a value to insert. + * @throws TypeMismatch if the component at the current position has a + * different type. + * @throws InvalidValue if the current position points nowhere. + */ + void insert_dyn_any(DynAny insert_it) + throws TypeMismatch, InvalidValue; + + /** + * Checks for equality with another Dynamic Any. + * + * + * @specnote This method is currently only implemented only for case when + * another DynAny was created by the factory of this implementation and is not + * an independent class, just implementing interface. Otherwise, a + * NO_IMPLEMENT minor 8148 will be thrown. General implementation is highly + * ineffective, but we will do if somebody would ever need it. + */ + boolean equal(DynAny other); + + /** + * Get the number number of fields in the enclosed structure or number of + * memebers in the enclosed array, sequence, enumeration, etc. This method + * only counts elements at the top level. For instance, if invoked on a + * DynStruct with a single member, it returns 1, irrespective of the type of + * the member. + * + * @return number of components or 0 if the enclosed Any is not divideable. + */ + int component_count(); + + /** + * Return DynAny, wrapping the second (enclosed any) that is stored in the + * wrapped Any. + * + * @throws TypeMismatch if the wrapped Any does not store another Any. + * @throws InvalidValue if the current position points nowhere. + */ + DynAny get_dyn_any() + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValue.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValue.java new file mode 100644 index 000000000..7bae38c55 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValue.java @@ -0,0 +1,81 @@ +/* InvalidValue.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.DynamicAny.DynAnyPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised when the operation on DynAny cannot be performed because one of + * the parameters, while having the correct type, has the invalid value. + * For instance, it is raised in response to the set the array content, + * when number of the provided elements mismatch the size of array. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class InvalidValue + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 4928947584617628504L; + + /** + * Create InvalidValue with no explaining + * message. + */ + public InvalidValue() + { + } + + /** + * Create the InvalidValue with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public InvalidValue(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java new file mode 100644 index 000000000..cc880ba34 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java @@ -0,0 +1,141 @@ +/* InvalidValueHelper.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.DynamicAny.DynAnyPackage; + +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 InvalidValue}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class InvalidValueHelper +{ + /** + * Create the InvalidValue typecode (structure, named "InvalidValue"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[0]; + return orb.create_exception_tc(id(), "InvalidValue", members); + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the InvalidValue into the given Any. + * + * @param any the Any to insert into. + * @param that the InvalidValue to insert. + */ + public static void insert(Any any, InvalidValue that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the InvalidValue from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain InvalidValue. + */ + public static InvalidValue extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (InvalidValue) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("InvalidValue expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the InvalidValue repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAny/InvalidValue:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAny/InvalidValue:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static InvalidValue read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + InvalidValue value = new InvalidValue(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, InvalidValue value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatch.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatch.java new file mode 100644 index 000000000..810d92058 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatch.java @@ -0,0 +1,81 @@ +/* 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.DynamicAny.DynAnyPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised when the operation cannot be performed because the involved + * data structure has the mismatching typecode. For instance, it is + * raised on the attempt to set the array content, when the value being set + * has a different type than the array element. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class TypeMismatch + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -6393641830493471034L; + + /** + * 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/DynamicAny/DynAnyPackage/TypeMismatchHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java new file mode 100644 index 000000000..92644515c --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java @@ -0,0 +1,141 @@ +/* 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.DynamicAny.DynAnyPackage; + +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, Lithuania (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); + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * 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.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the TypeMismatch repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAny/TypeMismatch:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAny/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/DynamicAny/DynAnyPackage/package.html b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/package.html new file mode 100644 index 000000000..d31469fe3 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/package.html @@ -0,0 +1,49 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html -- + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - org.omg.DynamicAny.DynAnyPackage</title></head> + +<body> + +Contains several exceptions that may be thrown during the operations on +{@link org.omg.DynamicAny.DynAny } and derived classes. Includes helpers, +providing helper operations for these exceptions. + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)</body> +</html> diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java new file mode 100644 index 000000000..468083afe --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java @@ -0,0 +1,146 @@ +/* DynAnySeq.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.DynamicAny; + +import gnu.CORBA.DynAnySeqHolder; +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +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.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the array of {@link DynAny} (DynAny[]). + * Following the 1.5 JDK specifications, DynAny (and hence an sequence of + * DynAny's) is always a local object, so the two methods of this helper + * ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynAnySeqHelper +{ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + TypeCode t = orb.create_sequence_tc(0, DynAnyHelper.type()); + return orb.create_alias_tc(id(), "DynAnySeq", t); + } + + /** + * Insert the DynAnySeq into the given Any. + * This method uses the DynAnySeqHolder. + * + * @param any the Any to insert into. + * @param those the DynAny[] to insert. + */ + public static void insert(Any any, DynAny[] those) + { + any.insert_Streamable(new DynAnySeqHolder(those)); + } + + /** + * Extract the DynAnySeq from given Any. + * This method uses the DynAnySeqHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain DynAnySeq. + */ + public static DynAny[] extract(Any any) + { + try + { + return ((DynAnySeqHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("DynAnySeq expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the DynAnySeq repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAnySeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAnySeq:1.0"; + } + + /** + * The method should read this object from the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynAny[] read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * The method should write this object to the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynAny[] value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynArray.java b/libjava/classpath/org/omg/DynamicAny/DynArray.java new file mode 100644 index 000000000..30b556acf --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynArray.java @@ -0,0 +1,54 @@ +/* DynArray.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Represents a fixed size array. All components in the array have the same + * type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynArray + extends DynArrayOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java new file mode 100644 index 000000000..d9e76eb06 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java @@ -0,0 +1,170 @@ +/* DynArrayHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynArray}. Following the 1.5 JDK + * specifications, DynArray is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynArrayHelper +{ + /** + * Cast the passed object into the DynArray. As DynArray is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynArray. + */ + public static DynArray narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynArray) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynArray"); + } + } + + /** + * Narrow the given object to the DynArray. 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 DynArray. + * + * @since 1.5 + */ + public static DynArray unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynArray}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynArray"); + } + + /** + * Insert the DynArray into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynArray to insert. + */ + public static void insert(Any any, DynArray that) + { + any.insert_Object(that); + } + + /** + * Extract the DynArray from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynArray. + */ + public static DynArray extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynArray repository id. + * + * @return "IDL:omg.org/DynamicAny/DynArray:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynArray:1.0"; + } + + /** + * This should read DynArray from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynArray read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynArray from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynArray value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynArrayOperations.java b/libjava/classpath/org/omg/DynamicAny/DynArrayOperations.java new file mode 100644 index 000000000..18693039b --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynArrayOperations.java @@ -0,0 +1,93 @@ +/* DynArrayOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for {@link DynArray}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynArrayOperations + extends DynAnyOperations +{ + /** + * Returns the array. + * + * @return the array of elements as an array of DynAny's. + */ + DynAny[] get_elements_as_dyn_any(); + + /** + * Returns the array. + * + * @return the array of elements as an array of Any's. + */ + Any[] get_elements(); + + /** + * Sets the array. + * + * @param value the array of elements an DynAny's. + * + * @throws TypeMismatch if the members of the passed array does not match + * array component type. + * + * @throws InvalidValue if the number of elements in the passed array is not + * the same as the size of this DynArray. + */ + void set_elements_as_dyn_any(DynAny[] value) + throws TypeMismatch, InvalidValue; + + /** + * Sets the array. + * + * @param value the array of elements as Any's. + * + * @throws TypeMismatch if the members of the passed array does not match + * array component type. + * + * @throws InvalidValue if the number of elements in the passed array is not + * the same as the size of this DynArray. + */ + void set_elements(Any[] value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnum.java b/libjava/classpath/org/omg/DynamicAny/DynEnum.java new file mode 100644 index 000000000..6f71bb8f8 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynEnum.java @@ -0,0 +1,56 @@ +/* DynEnum.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the dynamic enumeration. The value of the dynamic enumeration can be + * set by name or by integer code. The valid string values and integer codes are + * taken from the typecode, from which the enumeration was constructed. The + * enumeration is an undividable type without traversable components. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynEnum + extends DynEnumOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java new file mode 100644 index 000000000..9599d72b5 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java @@ -0,0 +1,171 @@ +/* DynEnumHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynEnum}. Following the 1.5 JDK + * specifications, DynEnum is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynEnumHelper +{ + /** + * Cast the passed object into the DynEnum. As DynEnum is a local object, the + * method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynEnum. + */ + public static DynEnum narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynEnum) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynEnum"); + } + } + + /** + * Narrow the given object to the DynEnum. 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 DynEnum. + * + * @since 1.5 + */ + public static DynEnum unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynEnum}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynEnum"); + } + + /** + * Insert the DynEnum into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynEnum to insert. + */ + public static void insert(Any any, DynEnum that) + { + any.insert_Object(that); + } + + /** + * Extract the DynEnum from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynEnum. + */ + public static DynEnum extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynEnum repository id. + * + * @return "IDL:omg.org/DynamicAny/DynEnum:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynEnum:1.0"; + } + + /** + * This should read DynEnum from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynEnum read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynEnum from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynEnum value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnumOperations.java b/libjava/classpath/org/omg/DynamicAny/DynEnumOperations.java new file mode 100644 index 000000000..3bc3ae208 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynEnumOperations.java @@ -0,0 +1,82 @@ +/* DynEnumOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; + +/** + * Defines operations, applicable to the dynamic enumeration. The value of the + * dynamic enumeration can be set by name or by integer code. The valid string + * values and integer codes are taken from the typecode, from which the + * enumeration was constructed. The enumeration is an undividable type without + * traversable components. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynEnumOperations + extends DynAnyOperations +{ + /** + * Get the current enumeration value, as string. + */ + String get_as_string(); + + /** + * Get the current enumeration value, as int. + */ + int get_as_ulong(); + + /** + * Set the current enumeration value, as string. + * + * @throws InvalidValue if the passed string is not one of the allowed values + * for this enumeration. + */ + void set_as_string(String value) + throws InvalidValue; + + /** + * Set the current enumeration value, as int. + * + * @throws InvalidValue if the passed string is not one of the allowed values + * for this enumeration. + */ + void set_as_ulong(int value) + throws InvalidValue; + +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixed.java b/libjava/classpath/org/omg/DynamicAny/DynFixed.java new file mode 100644 index 000000000..65aa98f15 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynFixed.java @@ -0,0 +1,55 @@ +/* DynFixed.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines dynamic any, holding CORBA <code>fixed</code>. The operations on + * <code>fixed</code> (defined in {@link DynFixedOperations}) take and return + * this data type in its string representation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynFixed + extends DynFixedOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java new file mode 100644 index 000000000..213eb0318 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java @@ -0,0 +1,171 @@ +/* DynFixedHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynFixed}. Following the 1.5 JDK + * specifications, DynFixed is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynFixedHelper +{ + /** + * Cast the passed object into the DynFixed. As DynFixed is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynFixed. + */ + public static DynFixed narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynFixed) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynFixed"); + } + } + + /** + * Narrow the given object to the DynFixed. 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 DynFixed. + * + * @since 1.5 + */ + public static DynFixed unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynFixed}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynFixed"); + } + + /** + * Insert the DynFixed into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynFixed to insert. + */ + public static void insert(Any any, DynFixed that) + { + any.insert_Object(that); + } + + /** + * Extract the DynFixed from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynFixed. + */ + public static DynFixed extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynFixed repository id. + * + * @return "IDL:omg.org/DynamicAny/DynFixed:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynFixed:1.0"; + } + + /** + * This should read DynFixed from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynFixed read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynFixed from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynFixed value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixedOperations.java b/libjava/classpath/org/omg/DynamicAny/DynFixedOperations.java new file mode 100644 index 000000000..e8c69a768 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynFixedOperations.java @@ -0,0 +1,71 @@ +/* DynFixedOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for DynAny, holding CORBA <code>fixed</code>. + * These operations take and return this data type in its string representation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynFixedOperations + extends DynAnyOperations +{ + /** + * Get the value of the enclosed DynFixed, as string. + */ + String get_value(); + + /** + * Set the value of the enclosed DynFixed, from string. + * + * @param fixed_value the value to set. + * + * @throws TypeMismatch if the passed string cannot be parsed into CORBA + * <code>fixed</code>. The valid string can only contain digits, decimal + * point and optional leading and trailing whitespace. + * + * @return true if the passed value can be represented without the loss of + * precision, false if some fractional digits were truncated. + */ + boolean set_value(String fixed_value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequence.java b/libjava/classpath/org/omg/DynamicAny/DynSequence.java new file mode 100644 index 000000000..08c7b527e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynSequence.java @@ -0,0 +1,54 @@ +/* DynSequence.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a dynamic resizeable array with the optional upper size bound. All + * elements in this structure have the same type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynSequence + extends DynSequenceOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java new file mode 100644 index 000000000..e2a859b63 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java @@ -0,0 +1,170 @@ +/* DynSequenceHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynSequence}. Following the 1.5 JDK + * specifications, DynSequence is always a local object, so the two methods of + * this helper ({@link #read} and {@link #write} are not in use, always + * throwing {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynSequenceHelper +{ + /** + * Cast the passed object into the DynSequence. As DynSequence is a local + * object, the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynSequence. + */ + public static DynSequence narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynSequence) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynSequence"); + } + } + + /** + * Narrow the given object to the DynSequence. 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 DynSequence. + * + * @since 1.5 + */ + public static DynSequence unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynSequence}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynSequence"); + } + + /** + * Insert the DynSequence into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynSequence to insert. + */ + public static void insert(Any any, DynSequence that) + { + any.insert_Object(that); + } + + /** + * Extract the DynSequence from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynSequence. + */ + public static DynSequence extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynSequence repository id. + * + * @return "IDL:omg.org/DynamicAny/DynSequence:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynSequence:1.0"; + } + + /** + * This should read DynSequence from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynSequence read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynSequence from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynSequence value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequenceOperations.java b/libjava/classpath/org/omg/DynamicAny/DynSequenceOperations.java new file mode 100644 index 000000000..77cd28383 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynSequenceOperations.java @@ -0,0 +1,124 @@ +/* DynSequenceOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable to DynSequence. These are basically the same + * operations as for {@link DynArrayOperations} with additional possibility to + * change the length of the sequence. If the + * {@link org.omg.CORBA.TypeCode#length()} method of the sequence typecode + * returns positive value, it is treated as a sequence bound. An attempt to + * extend the sequence above its bound raises {@link InvalidValue}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynSequenceOperations + extends DynAnyOperations +{ + /** + * Get the length of the sequence. + * + * @return the current sequence length that was taken from typecode or changed + * with set_length. + */ + int get_length(); + + /** + * Set the length of the sequence. If the sequence is shortened, the tailing + * members are discarded, but the remaining content is not affected. If the + * new length is larger than the previous one, the new members are added to + * the end of the sequence. These new members are initialised to they default + * values. + * + * @param length the new length of the sequence. + * + * @throws InvalidValue if this is a bounded sequence, and the size being set + * exceeds the sequence bound. + */ + public void set_length(int length) + throws InvalidValue; + + /** + * Returns the array, containing the sequence elements. + * + * @return the array of elements as an array of DynAny's. + */ + DynAny[] get_elements_as_dyn_any(); + + /** + * Returns the array, containing the sequence elements. + * + * @return the array of elements as an array of Any's. + */ + Any[] get_elements(); + + /** + * Sets the sequence elements from the array. The length of the sequence is + * set to the length of the passed array. + * + * @param value the array of elements an DynAny's. + * + * @throws TypeMismatch if the members of the passed array does not match + * sequence component type. + * + * @throws InvalidValue if this is a bounded sequence and the number of + * elements in the passed array exceeds the sequence bound. + */ + void set_elements_as_dyn_any(DynAny[] value) + throws TypeMismatch, InvalidValue; + + /** + * Sets the sequence elements from the array. The length of the sequence is + * set to the length of the passed array. + * + * @param value the array of elements as Any's. + * + * + * @throws TypeMismatch if the members of the passed array does not match + * sequence component type. + * + * @throws InvalidValue if this is a bounded sequence and the number of + * elements in the passed array exceeds the sequence bound. + */ + void set_elements(Any[] value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynStruct.java b/libjava/classpath/org/omg/DynamicAny/DynStruct.java new file mode 100644 index 000000000..540537547 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynStruct.java @@ -0,0 +1,54 @@ +/* DynStruct.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a fixed size structure with the named fields that may have different + * types. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynStruct + extends DynStructOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java new file mode 100644 index 000000000..ed049a105 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java @@ -0,0 +1,170 @@ +/* DynStructHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynStruct}. Following the 1.5 JDK + * specifications, DynStruct is always a local object, so the two methods of + * this helper ({@link #read} and {@link #write} are not in use, always + * throwing {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynStructHelper +{ + /** + * Cast the passed object into the DynStruct. As DynStruct is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynStruct. + */ + public static DynStruct narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynStruct) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynStruct"); + } + } + + /** + * Narrow the given object to the DynStruct. 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 DynStruct. + * + * @since 1.5 + */ + public static DynStruct unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynStruct}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynStruct"); + } + + /** + * Insert the DynStruct into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynStruct to insert. + */ + public static void insert(Any any, DynStruct that) + { + any.insert_Object(that); + } + + /** + * Extract the DynStruct from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynStruct. + */ + public static DynStruct extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynStruct repository id. + * + * @return "IDL:omg.org/DynamicAny/DynStruct:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynStruct:1.0"; + } + + /** + * This should read DynStruct from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynStruct read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynStruct from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynStruct value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynStructOperations.java b/libjava/classpath/org/omg/DynamicAny/DynStructOperations.java new file mode 100644 index 000000000..03524b2f9 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynStructOperations.java @@ -0,0 +1,140 @@ +/* DynStructOperations.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.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines the operations, applicable to the DynStructure. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynStructOperations + extends DynAnyOperations +{ + /** + * Get the kind of the structure field at the current position. + * + * @return the kind of field. + * + * @throws TypeMismatch for an empty structure (normally exception). + * @throws InvalidValue if the current position does not indicate a memeber. + */ + TCKind current_member_kind() + throws TypeMismatch, InvalidValue; + + /** + * Get the name of the structure field at the current position. + * + * @return the name of the field. + * + * @throws TypeMismatch for an empty structure (normally exception). + * @throws InvalidValue if the current position does not indicate a memeber. + */ + String current_member_name() + throws TypeMismatch, InvalidValue; + + /** + * Return array, describing describing the name and the value of each member + * in the structure. + * + * @return an array of NameDynAnyPair's, each defining a single field in this + * structure. + */ + NameDynAnyPair[] get_members_as_dyn_any(); + + /** + * Return array, describing describing the name and the value of each member + * in the structure. + * + * @return an array of NameValuePair's, each defining a single field in this + * structure. + */ + NameValuePair[] get_members(); + + /** + * Set the structure contend from the array, where each member defines the + * name and value of the structure field. If the passed array is not empty, + * the current position is set to the first member. + * + * The members of array must follow in the same order as the structure fields, + * how they are defined in the typecode. The name-based value assignment is + * not supported. + * + * @specnote The name-based value assignment is not supported by Sun's jdk + * 1.4. + * + * @param value an array of NameDynValuePair's, each defining a single field in the + * structure. + * + * @throws TypeMismatch if the member of the passed array has a different type + * than the corresponding structure field. + * + * @throws InvalidValue if the size of the passed array is not the same as the + * number of fields in this structure. + */ + void set_members_as_dyn_any(NameDynAnyPair[] value) + throws TypeMismatch, InvalidValue; + + /** + * Set the structure contend from the array, where each member defines the + * name and value of the structure field. If the passed array is not empty, + * the current position is set to the first member. + * + * The members of array must follow in the same order as the structure fields, + * how they are defined in the typecode. The name-based value assignment is + * not supported. + * + * @specnote The name-based value assignment is not supported by Sun's jdk + * 1.4. + * + * @param value an array of NameValuePair's, each defining a single field in the + * structure. + * + * @throws TypeMismatch if the member of the passed array has a different type + * than the corresponding structure field. + * + * @throws InvalidValue if the size of the passed array is not the same as the + * number of fields in this structure. + */ + void set_members(NameValuePair[] value) + throws TypeMismatch, InvalidValue; + +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnion.java b/libjava/classpath/org/omg/DynamicAny/DynUnion.java new file mode 100644 index 000000000..8875d15fa --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynUnion.java @@ -0,0 +1,54 @@ +/* DynUnion.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a fixed size structure with the named fields that may have different + * types. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynUnion + extends DynUnionOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java new file mode 100644 index 000000000..f39ff6641 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java @@ -0,0 +1,170 @@ +/* DynUnionHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynUnion}. Following the 1.5 JDK + * specifications, DynUnion is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynUnionHelper +{ + /** + * Cast the passed object into the DynUnion. As DynUnion is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynUnion. + */ + public static DynUnion narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynUnion) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynUnion"); + } + } + + /** + * Narrow the given object to the DynUnion. 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 DynUnion. + * + * @since 1.5 + */ + public static DynUnion unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynUnion}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynUnion"); + } + + /** + * Insert the DynUnion into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynUnion to insert. + */ + public static void insert(Any any, DynUnion that) + { + any.insert_Object(that); + } + + /** + * Extract the DynUnion from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynUnion. + */ + public static DynUnion extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynUnion repository id. + * + * @return "IDL:omg.org/DynamicAny/DynUnion:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynUnion:1.0"; + } + + /** + * This should read DynUnion from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynUnion read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynUnion from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynUnion value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnionOperations.java b/libjava/classpath/org/omg/DynamicAny/DynUnionOperations.java new file mode 100644 index 000000000..30b891a2d --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynUnionOperations.java @@ -0,0 +1,149 @@ +/* DynUnionOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines the operations, applicable to the DynUnion. The DynUnion has only two + * valid positions: + * <ul> + * <li>0 - contains the discriminator of the union. The discriminator defines, + * which of the union variants is currently active.</li> + * <li>1 - contains the currently active variant of the union content (a union + * member). </li> + * </ul> + * The size of the union is normally 2. If the discriminator value defines no + * valid variant, the union consists of discriminator only, having the size 1. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynUnionOperations + extends DynAnyOperations +{ + /** + * <p>Get the value of discriminator, defining which content variant + * (member) is active. + * </p><p> + * In the current implementation, the later changes on the returned value + * alter the state of the union via implemented internal listener. + * </p> + */ + DynAny get_discriminator(); + + /** + * <p>Set the value of discriminator, activating the member variant that is + * consistent with the discriminator value. If the current member variant + * matches the discriminator being set, it is unchanged. Otherwise, it is + * replaced by the matching member variant with fields, initialised to default + * values. The current position is set to 0 if the discriminator value does + * not match any member variant. Otherwise, the current position is set to 1, + * index of the member variant. + * </p> + * @throws TypeMismatch if the discriminator has a wrong type of this union. + */ + void set_discriminator(DynAny aDiscriminator) + throws TypeMismatch; + + /** + * Get the kind of the union descriminator. + * + * @return the TCKind value of the discriminator typecode. + */ + TCKind discriminator_kind(); + + /** + * Get the current variant of the union content. + * + * @return the current member of the union. This reference is only valid as + * long as the current member does not change. + * + * @throws InvalidValue if the union has no active member. + */ + DynAny member() + throws InvalidValue; + + /** + * Returns the kind of the currently active union member. + * + * @return the TCKind value of the union member. + * + * @throws InvalidValue if the union has no active member. + */ + TCKind member_kind() + throws InvalidValue; + + /** + * Returns the name of the currently active union member. + * + * @return the TCKind value of the union member. + * + * @throws InvalidValue if the union has no active member. + */ + String member_name() + throws InvalidValue; + + /** + * Returns true if the union has no active member. This happens if If the + * discriminator value defines no valid variant. Such union consists of + * discriminator only, having the size 1. + */ + boolean has_no_active_member(); + + /** + * Set the discriminator to default value. The current position is set to 0. + * This also sets the content variant to the default variant, and the size of + * the union becomes 2. + * + * @throws TypeMismatch if the default case is not defined for this union. + */ + void set_to_default_member() + throws TypeMismatch; + + /** + * Set the discriminator to value that does not correspond any content variant + * (any union <code>case</code> label). The current position is set to 0. + * The size of the union becomes 0. + * + * @throws TypeMismatch if the union has explicit default case. + */ + void set_to_no_active_member() + throws TypeMismatch; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValue.java b/libjava/classpath/org/omg/DynamicAny/DynValue.java new file mode 100644 index 000000000..831ce60b4 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValue.java @@ -0,0 +1,58 @@ +/* DynValue.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a non boxed value type. From the view point of DynAny, the Value is + * very much like structure. The access to fields of this structer are supported + * via {@link DynValueOperations} interface.Unlike structure, the value can also + * be equal to <code>null</code> that is supported via + * {@link DynValueCommonOperations} interface. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValue + extends DynValueOperations, DynValueCommon, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueBox.java b/libjava/classpath/org/omg/DynamicAny/DynValueBox.java new file mode 100644 index 000000000..15ff131a9 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueBox.java @@ -0,0 +1,55 @@ +/* DynValueBox.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * A "ValueBox" is a Value type container, holding a single instance of the + * other CORBA type. This content can be set to <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueBox + extends DynValueBoxOperations, DynValueCommon, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueBoxOperations.java b/libjava/classpath/org/omg/DynamicAny/DynValueBoxOperations.java new file mode 100644 index 000000000..d32541bbb --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueBoxOperations.java @@ -0,0 +1,91 @@ +/* DynValueBoxOperation.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for the boxed value type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueBoxOperations + extends DynValueCommonOperations, DynAnyOperations +{ + /** + * Get the return the content of the "box" as the DynAny. + * + * @throws InvalidValue if the object is holding <code>null</code>. + */ + DynAny get_boxed_value_as_dyn_any() + throws InvalidValue; + + /** + * Get the return the content of the "box" as the Any. + * + * @throws InvalidValue if the object is holding <code>null</code>. + */ + Any get_boxed_value() + throws InvalidValue; + + /** + * Set the value of the "box" from DynAny. + * + * @param boxIt a value to box. + * + * @throws TypeMismatch if the type is not matching the current boxed value + * type. + */ + void set_boxed_value_as_dyn_any(DynAny boxIt) + throws TypeMismatch; + + /** + * Set the value of the "box" as Any. + * + * @param boxIt a value to place into the box. + * + * @throws TypeMismatch if the type is not matching the current boxed value + * type. + */ + void set_boxed_value(Any boxIt) + throws TypeMismatch; + +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueCommon.java b/libjava/classpath/org/omg/DynamicAny/DynValueCommon.java new file mode 100644 index 000000000..1b324aa7d --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueCommon.java @@ -0,0 +1,76 @@ +/* DynValueCommon.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines DynAny that may hold CORBA <code>null</code>. The + * {@link DynValueCommonOperations} provides methods for setting the value to + * <code>null</code> or non-<code>null</code> and checking if the value is + * <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueCommon + extends DynValueCommonOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ + /** + * Check if this {@link DynAny} is holding the <code>null</code>. + * + * @return true if this {@link DynAny} is holding the <code>null</code>, + * false otherwise. + */ + boolean is_null(); + + /** + * Set the value of this {@link DynAny} to CORBA <code>null</code>. + */ + void set_to_null(); + + /** + * Set the value of this {@link DynAny} to the default non-null value. The + * target {@link DynAny} creates a new data structure, intialised to the + * agreed default values, as defined in {@link DynAnyFactoryOperations}. + */ + void set_to_value(); +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueCommonOperations.java b/libjava/classpath/org/omg/DynamicAny/DynValueCommonOperations.java new file mode 100644 index 000000000..e16e42888 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueCommonOperations.java @@ -0,0 +1,69 @@ +/* DynValueCommonOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +/** + * Provides operations, applicable to {@link DynAny}s that may hold CORBA + * <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueCommonOperations + extends DynAnyOperations +{ + /** + * Check if this {@link DynAny} is holding the <code>null</code>. + * + * @return true if this {@link DynAny} is holding the <code>null</code>, + * false otherwise. + */ + boolean is_null(); + + /** + * Set the value of this {@link DynAny} to CORBA <code>null</code>. + */ + void set_to_null(); + + /** + * Set the value of this {@link DynAny} to the default non-null value. The + * target {@link DynAny} creates a new data structure, intialised to the + * agreed default values, as defined in {@link DynAnyFactoryOperations}. + */ + void set_to_value(); +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java new file mode 100644 index 000000000..b8debb15f --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java @@ -0,0 +1,170 @@ +/* DynValueHelper.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.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynValue}. Following the 1.5 JDK + * specifications, DynValue is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynValueHelper +{ + /** + * Cast the passed object into the DynValue. As DynValue is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynValue. + */ + public static DynValue narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynValue) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynValue"); + } + } + + /** + * Narrow the given object to the DynValue. 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 DynValue. + * + * @since 1.5 + */ + public static DynValue unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Get the type code of the {@link DynValue}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "DynValue"); + } + + /** + * Insert the DynValue into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynValue to insert. + */ + public static void insert(Any any, DynValue that) + { + any.insert_Object(that); + } + + /** + * Extract the DynValue from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynValue. + */ + public static DynValue extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynValue repository id. + * + * @return "IDL:omg.org/DynamicAny/DynValue:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynValue:1.0"; + } + + /** + * This should read DynValue from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynValue read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynValue from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynValue value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueOperations.java b/libjava/classpath/org/omg/DynamicAny/DynValueOperations.java new file mode 100644 index 000000000..b986c24dd --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueOperations.java @@ -0,0 +1,134 @@ +/* DynValueOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable to DynValue. From the view point of DynAny, + * the Value is very much like structure. However, differently from the + * structure, the value type can also have private members. The private members + * of DynValue are also accessible via this interface, but this possibility + * should only be used in applications like in debuggers or inter-orb bridges. + * Unlike structure, the value can also be equal to <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueOperations + extends DynAnyOperations, DynValueCommonOperations +{ + /** + * Get the kind of the current member. + * + * @return the kind of member at the current position. + * + * @throws TypeMismatch if this DynValue is holding <code>null</code>. + * @thorws InvalidValue if the current position does not indicate the member. + */ + TCKind current_member_kind() + throws TypeMismatch, InvalidValue; + + /** + * Get the name of the current member. + * + * @return the name of the current member as defined by the typecode. May be + * an empty string. + * + * @throws TypeMismatch if this DynValue is holding <code>null</code>. + * @thorws InvalidValue if the current position does not indicate the member. + */ + String current_member_name() + throws TypeMismatch, InvalidValue; + + /** + * Get all members as an array of the named DynAny's. The returned names are + * set as they are defined by typecode. + * + * @return the array, representing the members of this instance of value. + * + * @throws InvalidValue if this DynValue is holding <code>null</code>. + */ + NameDynAnyPair[] get_members_as_dyn_any() + throws InvalidValue; + + /** + * Get all members as an array of the named Any's. The returned names are set + * as they are defined by typecode. + * + * @return the array, representing the members of this instance of value. + * + * @throws InvalidValue if this DynValue is holding <code>null</code>. + */ + NameValuePair[] get_members() + throws InvalidValue; + + /** + * Set all members from the array of the named Any's. + * + * @param value the array, where the data for fields of the structure must + * occur exactly in the same order, as defined by typecode. + * + * @throws TypeMismatch if the type or name of the array member does not match + * the name and type of the corresponding field in the DynValue data + * structure. The empty string is assumed matching any name. + * + * @throws InvalidValue if the size of the array does not match the number of + * fields. + */ + void set_members_as_dyn_any(NameDynAnyPair[] value) + throws TypeMismatch, InvalidValue; + + /** + * Set all members from the array of the named Any's. + * + * @param value the array, where the data for fields of the structure must + * occur exactly in the same order, as defined by typecode. + * + * @throws TypeMismatch if the type or name of the array member does not match + * the name and type of the corresponding field in the DynValue data + * structure. The empty string is assumed matching any name. + * + * @throws InvalidValue if the size of the array does not match the number of + * fields. + */ + void set_members(NameValuePair[] value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java new file mode 100644 index 000000000..dcc667b42 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java @@ -0,0 +1,120 @@ +/* FieldNameHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper for the FieldName. The fields {@link NameValuePair#id}, + * {@link NameDynAnyPair#id} and return values of methods + * <code>current_member_name()</code>, <code>member_name()</code> in several + * interfaces officially have the "FieldName" type. This type is directly + * mapped into java String and needs no helper. The helper + * is included only as a part of the formal standard. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class FieldNameHelper +{ + /** + * Insert the FieldName into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the FieldName from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an alias typecode. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0)); + } + + /** + * Return the FieldName repository id. + * @return "IDL:omg.org/DynamicAny/FieldName:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/FieldName:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param istream the stream to read from. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param ostream the stream to write into. + * @param value the string (FieldName) value to write. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPair.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPair.java new file mode 100644 index 000000000..5fe438b5e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPair.java @@ -0,0 +1,87 @@ +/* NameDynAnyPair.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Stores the named value, representing the name by string and the value by + * {@link DynAny}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameDynAnyPair + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1992533286932908564L; + + /** + * The name of the named value. + */ + public String id; + + /** + * The value of the named value. + */ + public DynAny value; + + /** + * Create unitialised instance with both fields left with default + * <code>null</code> value. + */ + public NameDynAnyPair() + { + } + + /** + * Create an instance with the given initial values. + * + * @param aName the name of the named value. + * @param aValue the value of the named value. + */ + public NameDynAnyPair(String aName, DynAny aValue) + { + id = aName; + value = aValue; + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java new file mode 100644 index 000000000..edf51fa5e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java @@ -0,0 +1,164 @@ +/* NameDynAnyPairHelper.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.DynamicAny; + +import gnu.CORBA.Minor; +import gnu.CORBA.NameDynAnyPairHolder; +import gnu.CORBA.OrbRestricted; + +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; + +/** + * A helper operations for the structure {@link NameDynAnyPair}. + * + * Following the 1.5 JDK specifications, DynAny (and hence any structure, + * containing DynAny) is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameDynAnyPairHelper +{ + /** + * Extract the NameDynAnyPair from given Any. + * This method uses the NameDynAnyPairHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameDynAnyPair. + */ + public static NameDynAnyPair extract(Any any) + { + try + { + return ((NameDynAnyPairHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPair expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the NameDynAnyPair repository id. + * + * @return "IDL:omg.org/DynamicAny/NameDynAnyPair:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameDynAnyPair:1.0"; + } + + /** + * Create the NameDynAnyPair typecode (structure, + * named "NameDynAnyPair"). + * The typecode states that the structure contains the + * following fields: id, value. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 2 ]; + + TypeCode field; + + field = + orb.create_alias_tc("IDL:omg.org/DynamicAny/FieldName:1.0", + "FieldName", + orb.get_primitive_tc(TCKind.tk_string) + ); + members [ 0 ] = new StructMember("id", field, null); + + field = DynAnyHelper.type(); + members [ 1 ] = new StructMember("value", field, null); + return orb.create_struct_tc(id(), "NameDynAnyPair", members); + } + + /** + * Insert the NameDynAnyPair into the given Any. + * This method uses the NameDynAnyPairHolder. + * + * @param any the Any to insert into. + * @param that the NameDynAnyPair to insert. + */ + public static void insert(Any any, NameDynAnyPair that) + { + any.insert_Streamable(new NameDynAnyPairHolder(that)); + } + + /** + * The method should read this object from the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static NameDynAnyPair read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * The method should write this object to the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, NameDynAnyPair value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java new file mode 100644 index 000000000..067d01a3c --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java @@ -0,0 +1,145 @@ +/* NameDynAnyPairSeq.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.DynamicAny; + +import gnu.CORBA.Minor; +import gnu.CORBA.NameDynAnyPairSeqHolder; +import gnu.CORBA.OrbRestricted; + +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.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the array of {@link NameDynAnyPair} + * (NameDynAnyPair[]). + * + * Following the 1.5 JDK specifications, DynAny (and hence the sequence + * of structures, containing DynAny) is always a local object. + * Hence the two methods of this helper ({@link #read} and {@link #write} are + * not in use, always throwing {@link MARSHAL}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameDynAnyPairSeqHelper +{ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + TypeCode t = orb.create_sequence_tc(0, NameDynAnyPairHelper.type()); + return orb.create_alias_tc(id(), "NameDynAnyPairSeq", t); + } + + /** + * Insert the NameDynAnyPairSeq into the given Any. + * This method uses the NameDynAnyPairSeqHolder. + * + * @param any the Any to insert into. + * @param those the NameDynAnyPair[] to insert. + */ + public static void insert(Any any, NameDynAnyPair[] those) + { + any.insert_Streamable(new NameDynAnyPairSeqHolder(those)); + } + + /** + * Extract the NameDynAnyPairSeq from given Any. + * This method uses the NameDynAnyPairSeqHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameDynAnyPairSeq. + */ + public static NameDynAnyPair[] extract(Any any) + { + try + { + return ((NameDynAnyPairSeqHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPairSeq expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the NameDynAnyPairSeq repository id. + * + * @return "IDL:omg.org/DynamicAny/NameDynAnyPairSeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameDynAnyPairSeq:1.0"; + } + + /** + * The method should read this object from the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static NameDynAnyPair[] read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * The method should write this object to the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, NameDynAnyPair[] value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePair.java b/libjava/classpath/org/omg/DynamicAny/NameValuePair.java new file mode 100644 index 000000000..359fac384 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameValuePair.java @@ -0,0 +1,90 @@ +/* NameValuePair.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.DynStruct; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Holds the value, having the given name(id). This class is used by with + * {@link DynStruct} to name the fields of the record (structure). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameValuePair + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1289460542874201736L; + + /** + * The value of the structure record. + */ + public Any value; + + /** + * The name of the structure record. + */ + public String id; + + /** + * Cretes an unitialised instance of the name-value pair. + */ + public NameValuePair() + { + } + + /** + * Creates the name-value pair, initialising the fields to the passed values. + * + * @param aName the name (also called id) of the name-value pair, normally the + * name of the structure field. + * + * @param aValue the value of the name-value pair. + */ + public NameValuePair(String aName, Any aValue) + { + id = aName; + value = aValue; + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java new file mode 100644 index 000000000..e62074d83 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java @@ -0,0 +1,153 @@ +/* NameValuePairHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.Minor; +import gnu.CORBA.NameValuePairHolder; +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 NameValuePair}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameValuePairHelper +{ + /** + * Create the NameValuePair typecode (structure, + * named "NameValuePair"). + * The typecode states that the structure contains the + * following fields: id, value. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 2 ]; + + TypeCode field; + + field = + orb.create_alias_tc("IDL:omg.org/DynamicAny/FieldName:1.0", + "FieldName", + orb.get_primitive_tc(TCKind.tk_string) + ); + members [ 0 ] = new StructMember("id", field, null); + + field = orb.get_primitive_tc(TCKind.tk_any); + members [ 1 ] = new StructMember("value", field, null); + return orb.create_struct_tc(id(), "NameValuePair", members); + } + + /** + * Insert the NameValuePair into the given Any. + * This method uses the NameValuePairHolder. + * + * @param any the Any to insert into. + * @param that the NameValuePair to insert. + */ + public static void insert(Any any, NameValuePair that) + { + any.insert_Streamable(new NameValuePairHolder(that)); + } + + /** + * Extract the NameValuePair from given Any. + * This method uses the NameValuePairHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameValuePair. + */ + public static NameValuePair extract(Any any) + { + try + { + return ((NameValuePairHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the NameValuePair repository id. + * + * @return "IDL:omg.org/DynamicAny/NameValuePair:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameValuePair:1.0"; + } + + /** + * Read the structure from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static NameValuePair read(InputStream input) + { + NameValuePair value = new NameValuePair(); + value.id = input.read_string(); + value.value = input.read_any(); + 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, NameValuePair value) + { + output.write_string(value.id); + output.write_any(value.value); + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java new file mode 100644 index 000000000..4bcd7f8b5 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java @@ -0,0 +1,141 @@ +/* NameValuePairSeq.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.Minor; +import gnu.CORBA.NameValuePairSeqHolder; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the array of {@link NameValuePair}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameValuePairSeqHelper +{ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + TypeCode t = orb.create_sequence_tc(0, NameValuePairHelper.type()); + return orb.create_alias_tc(id(), "NameValuePairSeq", t); + } + + /** + * Insert the NameValuePairSeq into the given Any. + * This method uses the NameValuePairSeqHolder. + * + * @param any the Any to insert into. + * @param those the NameValuePair[] to insert. + */ + public static void insert(Any any, NameValuePair[] those) + { + any.insert_Streamable(new NameValuePairSeqHolder(those)); + } + + /** + * Extract the NameValuePairSeq from given Any. + * This method uses the NameValuePairSeqHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameValuePairSeq. + */ + public static NameValuePair[] extract(Any any) + { + try + { + return ((NameValuePairSeqHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameValuePairSeq expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Get the NameValuePairSeq repository id. + * + * @return "IDL:omg.org/DynamicAny/NameValuePairSeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameValuePairSeq: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 NameValuePair[] read(InputStream input) + { + NameValuePair[] value; + value = new NameValuePair[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + value [ i ] = NameValuePairHelper.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, NameValuePair[] value) + { + output.write_long(value.length); + for (int i0 = 0; i0 < value.length; i0++) + { + NameValuePairHelper.write(output, value [ i0 ]); + } + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java new file mode 100644 index 000000000..dcfb9b59e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java @@ -0,0 +1,120 @@ +/* _DynAnyFactoryStub.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.DynamicAny; + +import gnu.CORBA.Minor; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; + +/** + * Should provide support for remote invocation of methods on + * DynAnyFactory. As DynAny can never be remote at least till 1.5 inclusive, + * this class is not in use. DynAnyFactory should be obtained from the + * {@link org.omg.CORBA.ORB#resolve_initial_references}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynAnyFactoryStub + extends ObjectImpl + implements DynAnyFactory, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -6575269659020082310L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynAnyFactoryOperations.class; + + /** + * Create the DynAnyFactory stub. + */ + public _DynAnyFactoryStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynAnyFactoryHelper.id() }; + } + + /** + * The remote call of this DynAnyFactory method is not possible + * (the created DynAny would not be transferred to client). + * + * @throws MARSHAL, always. + */ + public DynAny create_dyn_any(Any _0) + throws InconsistentTypeCode + { + MARSHAL m = new MARSHAL(NOT_APPLICABLE); + m.minor = Minor.Inappropriate; + throw m; + } + + /** + * The remote call of this DynAnyFactory method is not possible + * (the created DynAny would not be transferred to client). + * + * @throws MARSHAL, always. + */ + public DynAny create_dyn_any_from_type_code(TypeCode _0) + throws InconsistentTypeCode + { + MARSHAL m = new MARSHAL(NOT_APPLICABLE); + m.minor = Minor.Inappropriate; + throw m; + } + + static String NOT_APPLICABLE = + "DynAnyFactory is always local objects. " + + "It is never accessed on remote side via stub."; +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynAnyStub.java b/libjava/classpath/org/omg/DynamicAny/_DynAnyStub.java new file mode 100644 index 000000000..1a81be306 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynAnyStub.java @@ -0,0 +1,628 @@ +/* _DynAnyStub.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.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Should provide support for remote invocation of methods on DynAny. As + * DynAny can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynAnyStub + extends ObjectImpl + implements DynAny, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -6521892777941121597L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynAnyOperations.class; + + /** + * Create the DynAny stub. + */ + public _DynAnyStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynAnyHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + static String NOT_APPLICABLE = + "DynAnys are always local objects. " + + "They and are never accessed on remote side via stubs."; +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynArrayStub.java b/libjava/classpath/org/omg/DynamicAny/_DynArrayStub.java new file mode 100644 index 000000000..74e763b37 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynArrayStub.java @@ -0,0 +1,667 @@ +/* _DynArrayStub.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.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Should provide support for remote invocation of methods on DynArray. As + * DynArray can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynArrayStub + extends ObjectImpl + implements DynArray, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -6302474930370950228L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynArrayOperations.class; + + /** + * Create the DynArray stub. + */ + public _DynArrayStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynArrayHelper.id() }; + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any[] get_elements() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny[] get_elements_as_dyn_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements(Any[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements_as_dyn_any(DynAny[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynEnumStub.java b/libjava/classpath/org/omg/DynamicAny/_DynEnumStub.java new file mode 100644 index 000000000..e56ed7517 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynEnumStub.java @@ -0,0 +1,667 @@ +/* _DynEnumStub.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.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Should provide support for remote invocation of methods on DynEnum. As + * DynEnum can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynEnumStub + extends ObjectImpl + implements DynEnum, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 696844314172031949L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynEnumOperations.class; + + /** + * Create the DynEnum stub. + */ + public _DynEnumStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynEnumHelper.id() }; + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_as_string() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_as_ulong() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_as_string(String _0) + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_as_ulong(int _0) + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynFixedStub.java b/libjava/classpath/org/omg/DynamicAny/_DynFixedStub.java new file mode 100644 index 000000000..759b48a4e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynFixedStub.java @@ -0,0 +1,646 @@ +/* _DynFixedStub.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.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Should provide support for remote invocation of methods on DynFixed. As + * DynFixed can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynFixedStub + extends ObjectImpl + implements DynFixed, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1932029532964417188L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynFixedOperations.class; + + /** + * Create the DynFixed stub. + */ + public _DynFixedStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynFixedHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_value() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean set_value(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynSequenceStub.java b/libjava/classpath/org/omg/DynamicAny/_DynSequenceStub.java new file mode 100644 index 000000000..488a7de9c --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynSequenceStub.java @@ -0,0 +1,691 @@ +/* _DynSequenceStub.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.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Should provide support for remote invocation of methods on DynSequence. As + * DynSequence can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynSequenceStub + extends ObjectImpl + implements DynSequence, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 7191437435669107554L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynSequenceOperations.class; + + /** + * Create the DynSequence stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynSequenceStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynSequenceHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any[] get_elements() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny[] get_elements_as_dyn_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements(Any[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements_as_dyn_any(DynAny[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_length() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_length(int _0) + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynStructStub.java b/libjava/classpath/org/omg/DynamicAny/_DynStructStub.java new file mode 100644 index 000000000..907f3c834 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynStructStub.java @@ -0,0 +1,693 @@ +/* _DynStructStub.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.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Should provide support for remote invocation of methods on DynStruct. As + * DynStruct can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynStructStub + extends ObjectImpl + implements DynStruct, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -8415786200783826656L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynStructOperations.class; + + /** + * Create the DynStruct stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynStructStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynStructHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind current_member_kind() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String current_member_name() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameValuePair[] get_members() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameDynAnyPair[] get_members_as_dyn_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members(NameValuePair[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members_as_dyn_any(NameDynAnyPair[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynUnionStub.java b/libjava/classpath/org/omg/DynamicAny/_DynUnionStub.java new file mode 100644 index 000000000..6789a34e8 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynUnionStub.java @@ -0,0 +1,725 @@ +/* _DynUnionStub.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.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Should provide support for remote invocation of methods on DynUnion. As + * DynUnion can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynUnionStub + extends ObjectImpl + implements DynUnion, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -8921031953572009897L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynUnionOperations.class; + + /** + * Create the DynUnion stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynUnionStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynUnionHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny member() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind discriminator_kind() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_discriminator() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean has_no_active_member() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind member_kind() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String member_name() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_discriminator(DynAny _0) + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_default_member() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_no_active_member() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + +} diff --git a/libjava/classpath/org/omg/DynamicAny/_DynValueStub.java b/libjava/classpath/org/omg/DynamicAny/_DynValueStub.java new file mode 100644 index 000000000..fffccfe0e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynValueStub.java @@ -0,0 +1,725 @@ +/* _DynValueStub.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.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynValue. As + * DynValue can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynValueStub + extends ObjectImpl + implements DynValue, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 5815313794012360824L; + + /** + * The purpose and value of this field are not documented. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = DynValueOperations.class; + + /** + * Create the DynValue stub. To get the stub working, + * you must later set the delegate with + * {@link org.omg.CORBA.portable.ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynValueStub() + { + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynValueHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind current_member_kind() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String current_member_name() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameValuePair[] get_members() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameDynAnyPair[] get_members_as_dyn_any() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members(NameValuePair[] a_members) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members_as_dyn_any(NameDynAnyPair[] a_members) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean is_null() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_null() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_value() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + +} diff --git a/libjava/classpath/org/omg/DynamicAny/package.html b/libjava/classpath/org/omg/DynamicAny/package.html new file mode 100644 index 000000000..997006d2c --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/package.html @@ -0,0 +1,87 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.DynamicAny</title></head> + +<body> +<p>DynAny's allow to work with data structures, exact content of those is not +known at the time of compilation. In this way, the conception of DynAny +remebers the java reflection mechanism. DynAny usually obtain the value from +the {@link org.omg.CORBA.Any} that, if needed, can carry highly nested data +structures (like array of sequences of unions). DynAny's allow to see/modify +all parts of such structures. This is especially helpful for writing generic +servers (bridges, event channels supporting, filtering and so on). Similarly, +DynAny's can create an Any at runtime, without having static knowledge of its +type. This is helpful for writing generic clients like browsers, debuggers or + user interface tools. +</p><p> +The API clearly states that DynAny and DynAnyFactory objects are local and +cannot be transferred to remote server or client. While such methods are +formally defined in the corresponding helpers, they simply always throw MARSHAL. +</p><p> +DynAny's are created by {@link DynAnyFactory}. The factory is obtaines by +{@link org.omg.CORBA.ORB#resolve_initial_references): +<code> +ORB orb = ORB.init(new String[0], null); +DynAnyFactory f = DynAnyFactoryHelper.narrow(orb.resolve_initial_references("DynAnyFactory")); +</code> +DynAny's are also returned by some methods, invoked on another DynAny. +</p><p> +The primitive types like string or char are wrapped into an ordinary DynAny. It +has multiple methods for setting/getting the content like +{@link DynAnyOperations#get_string()} or +{@link DynAnyOperations#insert_string(String)}. The more complex types like +sequences or structures are wrapped into specialised DynAny's, providing means +to access the enclosed members. In this case, the DynAny has the +"internal cursor", normally pointing at one of the members in the data +structure. The "internal cursor" can be set to the needed position +{@link DynAnyOperations#seek(int)} or advanced forward +({@link DynAnyOperations#next()}. The member under cursor is returned by +{@link DynAnyOperations#current_component()}. For composite DynAnys the +methods like {@link DynAnyOperations#get_string()} or +{@link DynAnyOperations#insert_string(String)} apply to the selected member, +not to the complex DynAny in general. +</p><p> +DynAnys are created and optimized for traversing values extracted from anys +or constructing values of anys at runtime. OMG does not recommend to use them +for other purposes. +</p><p> +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html>
\ No newline at end of file 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; +} diff --git a/libjava/classpath/org/omg/Messaging/SYNC_WITH_TRANSPORT.java b/libjava/classpath/org/omg/Messaging/SYNC_WITH_TRANSPORT.java new file mode 100644 index 000000000..7a0a5df0e --- /dev/null +++ b/libjava/classpath/org/omg/Messaging/SYNC_WITH_TRANSPORT.java @@ -0,0 +1,74 @@ +/* SYNC_WITH_TRANSPORT.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.Messaging; + + +/** + * A CORBA synchronization mode, defining how far the request shall + * progress before control is returned to the client for one way + * operations (when no response is required). OMG specification + * defines the following modes: + * <ul> + * <li> + * SYNC_NONE (0) - The ORB returns control before sending the request message. + * </li><li> + * SYNC_WITH_TRANSPORT (1) - The ORB returns control to the client only after the + * transport has accepted the request message. + * </li><li> + * SYNC_WITH_SERVER (2) - The ORB waits for the reply message from the + * server side ORB. + * </li><li> + * SYNC_WITH_TARGET (3) is equivalent for the synchronous, no one + * way operations. It is the most realiable, also the slowest one. + * </ul> + * The java API specification up till 1.4 inclusive defines only one + * constant, SYNC_WITH_TRANSPORT. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface SYNC_WITH_TRANSPORT +{ + /** + * The mode, indicating, that the ORB returns control to the client only + * after the transport has accepted the request message. There is stil no + * guarantee that the request will be delivered, but the server should + * send a reply message. + */ + short value = 1; +} diff --git a/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java b/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java new file mode 100644 index 000000000..a71b6f36f --- /dev/null +++ b/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java @@ -0,0 +1,117 @@ +/* SyncScopeHelper.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.Messaging; + +import gnu.CORBA.typecodes.PrimitiveTypeCode; +import gnu.CORBA.typecodes.RecordTypeCode; + +import org.omg.CORBA.Any; +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 synchronization scope as an alias of + * <code>short</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + * + * @see SYNC_WITH_TRANSPORT + */ +public abstract class SyncScopeHelper +{ + + /** + * Delegates call to {@link Any#extract_short()}. + */ + public static short extract(Any a) + { + return a.extract_short(); + } + + /** + * Returns synchronization scope repository id. + * + * @return "IDL:omg.org/Messaging/SyncScope:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/Messaging/SyncScope:1.0"; + } + + /** + * Delegates call to {@link Any#insert_short(short)}. + */ + public static void insert(Any a, short that) + { + a.insert_short(that); + } + + /** + * Delegates call to {@link InputStream#read_short()}. + */ + public static short read(InputStream istream) + { + return istream.read_short(); + } + + /** + * Returns a typecode of the synchronization scope, stating it + * is an alias of <code>short</code>, named "SyncScope". + * + * @return a typecode of synchronization scope. + */ + public static TypeCode type() + { + RecordTypeCode r = new RecordTypeCode(TCKind.tk_alias); + r.setName("SyncScope"); + r.setId(id()); + r.setContentType(new PrimitiveTypeCode(TCKind.tk_short)); + return r; + } + + /** + * Delegates call to {@link OutputStream#write_short(short)}. + */ + public static void write(OutputStream ostream, short value) + { + ostream.write_short(value); + } +} diff --git a/libjava/classpath/org/omg/Messaging/package.html b/libjava/classpath/org/omg/Messaging/package.html new file mode 100644 index 000000000..925f68469 --- /dev/null +++ b/libjava/classpath/org/omg/Messaging/package.html @@ -0,0 +1,64 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html -- + Copyright (C) 2002 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. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA.Messaging</title></head> + +<body> +Contains CORBA synchronization modes, specifying how far the request shall +progress before control is returned to the client for one way operations. +The one way operation is an operation when no response is required. +OMG specification defines the following modes: +<ul> +<li> +SYNC_NONE (0) - The ORB returns control before sending the request message. +</li><li> +SYNC_WITH_TRANSPORT (1) - The ORB returns control to the client only after the +transport has accepted the request message. There is stil no guarantee that the +request will be delivered. +</li><li> +SYNC_WITH_SERVER (2) - The ORB waits for the reply message from the server side ORB. +</li><li> +SYNC_WITH_TARGET (3) is equivalent for the synchronous, no one way operations. +It is the most realiable, also the slowest one. +</ul> +The java API specification up till 1.4 inclusive defines only one +constant, SYNC_WITH_TRANSPORT. Others may appear in the future versions. + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)</body> +</html> diff --git a/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java b/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java new file mode 100644 index 000000000..d7e7e1487 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java @@ -0,0 +1,55 @@ +/* ACTIVE.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.PortableInterceptor; + +/** + * A single constant interface, defining the adapter state (ACTIVE) = 1. + * Used with IOR interceptors. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ACTIVE +{ + /** + * Specifies the ACTIVE value, 1. + */ + short value = 1; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java new file mode 100644 index 000000000..df4bd3e72 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java @@ -0,0 +1,120 @@ +/* AdapterManagerIdHelper.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.PortableInterceptor; + +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 the adapter manager id. An adapter manager id is an + * integer constant and needs no helper, but the one is included anyway. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AdapterManagerIdHelper +{ + /** + * Create the AdapterManagerId typecode (alias of CORBA long (java int), named + * "AdapterManagerId"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "AdapterManagerId", + orb.get_primitive_tc(TCKind.tk_long)); + } + + /** + * Insert the int into the given Any. + */ + public static void insert(Any any, int that) + { + any.insert_long(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_long(); + } + + /** + * Get the adapter manager id repository id. + * + * @return "IDL:omg.org/PortableInterceptor/AdapterManagerId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/AdapterManagerId:1.0"; + } + + /** + * Read the int (adapter manager id) 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_long(); + } + + /** + * Write the int (adapter manager id) 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_long(value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java new file mode 100644 index 000000000..0f37a6a30 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java @@ -0,0 +1,135 @@ +/* AdapterNameHelper.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.PortableInterceptor; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StringSeqHelper; +import org.omg.CORBA.StringSeqHolder; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with the adapter name helper. + * The adapter name helper is an array of strings, so {@link StringSeqHelper} + * could be used for io operations. The separate helper is provided anyway. + * + * @since 1.5 + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class AdapterNameHelper +{ + + /** + * Extract the adapter name (<code>String[]</code>) from the given {@link Any}. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + */ + public static String[] extract(Any a) + { + StringSeqHolder h = (StringSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id. + * + * @return "IDL:omg.org/PortableInterceptor/AdapterName:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/AdapterName:1.0"; + } + + /** + * Insert into the given adapter name (<code>String[]</code>) into the + * given {@link Any}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, String[] that) + { + StringSeqHolder holder = new StringSeqHolder(that); + into.insert_Streamable(holder); + into.type(type()); + } + + /** + * Reads the <code>String[]</code> from the CORBA input stream. + * + * @param input the CORBA stream to read from. + * @return the value from the stream. + */ + public static String[] read(InputStream input) + { + return StringSeqHelper.read(input); + } + + /** + * Creates and returns a new instance of the TypeCode, corresponding the + * adapter name. + * + * @return the alias of the string sequence, named "AdapterName". + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + + TypeCode component = orb.create_string_tc(0); + return orb.create_alias_tc(id(), "AdapterName", component); + } + + /** + * Writes the <code>String[]</code> into the given stream. + * + * @param output the CORBA output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, String[] value) + { + StringSeqHelper.write(output, value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java new file mode 100644 index 000000000..ea208474b --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java @@ -0,0 +1,121 @@ +/* AdapterStateHelper.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.PortableInterceptor; + +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 the adapter state. An adapter state is an + * short integer constant and needs no helper, but the one is included anyway. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AdapterStateHelper +{ + /** + * Create the AdapterState typecode (alias of <code>short</code>, + * named "AdapterState"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "AdapterState", + orb.get_primitive_tc(TCKind.tk_short) + ); + } + + /** + * Insert the <code>short</code> into the given Any. + */ + public static void insert(Any any, short that) + { + any.insert_short(that); + } + + /** + * Extract the <code>short</code> from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain int. + */ + public static short extract(Any any) + { + return any.extract_short(); + } + + /** + * Get the adapter state repository id. + * + * @return "IDL:omg.org/PortableInterceptor/AdapterState:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/AdapterState:1.0"; + } + + /** + * Read the <code>short</code> (adapter state) from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static short read(InputStream input) + { + return input.read_short(); + } + + /** + * Write the <code>short</code> (adapter state) 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, short value) + { + output.write_short(value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfo.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfo.java new file mode 100644 index 000000000..d25fe6163 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfo.java @@ -0,0 +1,54 @@ +/* ClientRequestInfo.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Provides request information, accessible for the + * {@link ClientRequestInterceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInfo extends ClientRequestInfoOperations, + org.omg.CORBA.Object, + IDLEntity, + RequestInfo +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfoOperations.java new file mode 100644 index 000000000..3b7ed24f3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfoOperations.java @@ -0,0 +1,327 @@ +/* ClientRequestInfoOperations.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.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_INV_ORDER; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.INV_POLICY; +import org.omg.CORBA.Policy; +import org.omg.IOP.ServiceContext; +import org.omg.IOP.TaggedComponent; +import org.omg.IOP.TaggedProfile; + +/** + * Provides request information, accessible for the + * {@linkplain ClientRequestInterceptor}. Some methods of this interface are + * not valid at all interception points. The following table shows the validity + * of each method. If it is not valid, BAD_INV_ORDER minor 14 will be thrown. + * + * <table border="1"> + * <tr> + * <th></th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_request send_request}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_poll send_poll}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_reply receive_reply}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_exception receive_exception}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_other receive_other}</th> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"><i>Inherited from + * {@linkplain RequestInfoOperations}:</i></td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#arguments arguments}</th> + * <td bgcolor="#E0E0E0" title="in and inout only">yes <sub><a href="#1">1</a></sub></td> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#exceptions exceptions}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#contexts contexts}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation_context operation_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#result result}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#sync_scope sync_scope}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#reply_status reply_status}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#forward_reference forward_reference}</th> + * <td>no</td> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">yes <sub><a + * href="#2">2</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_request_service_context get_request_service_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_reply_service_context get_reply_service_context}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#request_id request_id}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation operation}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#response_expected response_expected}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_slot get_slot}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"><i>ClientRequestInfo-specific:</i></td> + * </tr> + * <tr> + * <th>{@linkplain #target target}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #effective_target effective_target}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #effective_profile effective_profile}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #received_exception received_exception}</th> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain #received_exception_id received_exception_id}</th> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain #get_effective_component get_effective_component}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #get_effective_components get_effective_components}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #get_request_policy get_request_policy}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #add_request_service_context add_request_service_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray" colspan="4" align="center">no</td> + * </tr> + * <tr> + * <th></th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_request send_request}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_poll send_poll}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_reply receive_reply}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_exception receive_exception}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_other receive_other}</th> + * </tr> + * </table> + * <ol> + * <li><a name="1">When ClientRequestInfo is passed to send_request, there is + * an entry in the list for every argument, but only the in and inout arguments + * will be available.</a></li> + * <li><a name="2">If the reply_status atribute is not LOCATION_FORWARD, + * accessing this attribute will throw BAD_INV_ORDER with a standard minor code + * of 14.</a></li> + * </ol> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInfoOperations extends RequestInfoOperations +{ + /** + * Returns the object on that the client has invoked the the operation. If the + * request was forwarded, it will not be the same object that actually + * processed the request. + * + * @return the initial client invocation target. + * + * @see #effective_target() + */ + org.omg.CORBA.Object target(); + + /** + * Returns the object on that the operation will be invoked after handling the + * possible forwarding. + * + * @return the final invocation target. + * + * @see #target() + */ + org.omg.CORBA.Object effective_target(); + + /** + * Returns the tagged profile (IOR) of the invocation target. If the request + * was forwarded, the method returns the new location, shown by the forwarding + * message. + * + * @return the invocation IOR. + */ + TaggedProfile effective_profile(); + + /** + * Returns the given component of the invocation target profile. If the + * profile contains multiple components with the same Id, it is not defined, + * which one will be returned. + * + * @param id the component id. + * + * @return the profile component with the given Id. + * + * @throws BAD_PARAM minor 28 in there are no any components with the given Id + * in the profile. + */ + TaggedComponent get_effective_component(int id) throws BAD_PARAM; + + /** + * Returns the given components of the invocation target profile. This method + * is uses when the profile may contain multiple components with the same Id. + * + * @param id the component id. + * + * @return the array of all profile components with the given Id. + * + * @throws BAD_PARAM minor 28 in there are no any components with the given Id + * in the profile. + */ + TaggedComponent[] get_effective_components(int id) throws BAD_PARAM; + + /** + * This should return the policy of the given type that applies to this + * operation, but it is not implemented up till JDK 1.5 inclusive. + * + * @param type the type of the policy being requested. + * + * @return should return the policy that applies to this operation. + */ + Policy get_request_policy(int type) throws INV_POLICY; + + /** + * Returns the repository id of the remote exception that was thrown on the + * server side. + * + * @return the exception repository id. + * + * @see #received_exception() + */ + String received_exception_id(); + + /** + * Returns the remote exception that was thrown on the server side. + * + * @return the Any, holding this exception. + * + * @see #received_exception_id() + */ + Any received_exception(); + + /** + * Allows the interceptor to add the service contexts to the request. Such + * added contexts can carry arbitrary data and can be later accessed on the + * server side by the server request interceptor, using + * {@link RequestInfoOperations#get_request_service_context}. + * + * @param service_context the context to add. + * @param replace if true, the existing context with the same Id will be + * replaced. If false, the BAD_INV_ORDER will be thrown in that case. + * + * @throws BAD_INV_ORDER minor 15 if the context with the same Id already + * exists and replace=false. + */ + void add_request_service_context(ServiceContext service_context, + boolean replace + ); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptor.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptor.java new file mode 100644 index 000000000..210ac7b02 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptor.java @@ -0,0 +1,54 @@ +/* ClientRequestInterceptor.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * A client side request interceptor that is notified on various request + * processing steps on a client side. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInterceptor extends Interceptor, + ClientRequestInterceptorOperations, + org.omg.CORBA.Object, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java new file mode 100644 index 000000000..5b1ab84c5 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java @@ -0,0 +1,130 @@ +/* ClientRequestInterceptorOperations.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.PortableInterceptor; + +import org.omg.CORBA.SystemException; + + +/** + * Defines operations, applicable to the client side request interceptor. The + * operations are called by ORB at the appropriate interception points. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInterceptorOperations + extends InterceptorOperations +{ + /** + * ORB calls this method before sending the request to the server. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_request is not called for the + * subsequent interceptors, calling receive_exception instead. The completion + * status of this exception must be COMPLETED_NO. + * + * @throws ForwardRequest to forward the invocation to another target. The + * send_request is not called for the subsequent interceptors, calling + * receive_other instead. + */ + void send_request(ClientRequestInfo info) throws ForwardRequest; + + /** + * ORB calls this method after the normal reply is received from the server + * and before the control is returned to the calling client code. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the receive_reply is not called for the + * subsequent interceptors, calling receive_exception instead. The completion + * status of this exception must be COMPLETED_YES. + */ + void receive_reply(ClientRequestInfo info); + + /** + * ORB calls this method after the receiving the message that a remote + * exception has been thrown on a server side and before raising this + * exception in the client side. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException has the effect of changing the exception that + * successive interceptors receive on their calls to receive_other. If the + * original exception is a system exception, the completion_status of the new + * exception must match the exception being replaced. If the original + * exception is a user exception, then the completion_status of the new + * exception must be COMPLETED_YES. + * + * @throws ForwardRequest to forward the invocation to another target. The + * receive_exception is not called for the subsequent interceptors, calling + * receive_other instead. If the completion_status of the original exception + * is not a COMPLETED_NO, the ForwardRequest must not be raised. + */ + void receive_exception(ClientRequestInfo info) throws ForwardRequest; + + /** + * /** ORB normally calls this method after receiving the forwarding message. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the receive_other is not called for the + * subsequent interceptors, calling receive_exception instead. + * + * @throws ForwardRequest has the effect of changing the redirection that + * successive interceptors receive on their calls to receive_other. + */ + void receive_other(ClientRequestInfo info) throws ForwardRequest; + + /** + * This method is called by if ORB uses the Time- Independent Invocation (TII) + * polling. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_poll is not called for the + * subsequent interceptors, calling receive_exception instead. The completion + * status of this exception must be COMPLETED_NO. + */ + void send_poll(ClientRequestInfo info); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/Current.java b/libjava/classpath/org/omg/PortableInterceptor/Current.java new file mode 100644 index 000000000..5f609b61e --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/Current.java @@ -0,0 +1,85 @@ +/* Current.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The portable interceptor Current (PICurrent) contains multiple slots where an + * interceptor can rememeber the request - specific values between subsequent + * calls of the interceptor methods. In multithreaded environment, it is not + * possible just to store such data in the interceptor object fields. + * </p> + * <p> + * On the client side, it is possible to set the initial slot values by + * modifying slots on the Current, returend by ORB.resolve_initial_references + * ("PICurrent"). The returned value is narrowed with the + * {@link CurrentHelper#narrow}. On the subsequent invocation, made from the + * same thread, the interceptors will see the initial slot values as they were + * set using this approach. + * </p> + * <p> + * There are no way to set the initial values for the server side interceptors, + * the default values (Any with typecode TCKind.tk_null) should be always + * assumed. + * </p> + * <p> + * Since an Interceptor is running in a thread, it is running with a thread + * context and there is a PICurrent on that context. If the Interceptor calls + * ORB.resolve_initial_references ("PICurrent"), it gets the PICurrent within + * its thread scope. This PICurrent is different than the request scope + * PICurrent that the Interceptor obtains via calls to the Client- or Server- + * RequestInfo object. + * </p> + * <p> + * On the client side the PICurrent can be used to detect the recursive + * invocations, performed by interceptors. If one of the interceptors makes call + * via the same ORB, this call is then showed to all interceptors, including the + * interceptor that made it. To avoid infinite recursion, the during each call + * this interceptor can set some "recursion flag" into one of the slots of the + * PICurrent. If the flag is set on the entry point, this indicates a recursive + * call of that request. + * </p> + */ +public interface Current extends CurrentOperations, + org.omg.CORBA.Current, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java new file mode 100644 index 000000000..881c592a8 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java @@ -0,0 +1,165 @@ +/* CurrentHelper.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.PortableInterceptor; + +import gnu.CORBA.Minor; +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.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 Current}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class CurrentHelper +{ + /** + * Get the type code of the {@link Current}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "Current"); + } + + /** + * Insert the Current into the given Any. + * + * @param any the Any to insert into. + * @param that the Current to insert. + */ + public static void insert(Any any, Current that) + { + any.insert_Object(that); + } + + /** + * Extract the Current from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain Current. + */ + public static Current extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the Current repository id. + * + * @return "org.omg.PortableInterceptor.CurrentOperations", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/Current:1.0"; + } + + /** + * Cast the passed object into the Current. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a Current. + */ + public static Current narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + { + return null; + } + else if (obj instanceof Current) + { + return (Current) obj; + } + else + { + throw new BAD_PARAM("Not a Current"); + } + } + + /** + * Narrow the given object to the Current. 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 also OMG issue 4158. + * + * @param obj the object to cast. + * + * @return the casted Current. + * + * @since 1.5 + */ + public static Current unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.5 inclusive. + * + * @throws MARSHAL always. + */ + public static Current read(InputStream input) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.5 inclusive. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, Current value) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/CurrentOperations.java b/libjava/classpath/org/omg/PortableInterceptor/CurrentOperations.java new file mode 100644 index 000000000..347b040d0 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/CurrentOperations.java @@ -0,0 +1,87 @@ +/* CurrentOperations.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.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_INV_ORDER; + +/** + * Defines the operations, applicable to the portable interceptor Current. + * + * Portable Interceptors Current (also known as PICurrent) is a slot table. Each + * slot has an integer identifier, can hold a CORBA {@link Any} and is used by + * some service to transfer data between thread and request contexts. Each + * service which wishes to use PICurrent reserves a slot or slots at + * initialization time and uses those slots during the processing of requests + * and replies. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CurrentOperations + extends org.omg.CORBA.CurrentOperations +{ + /** + * Get data from the slot with the given slot_id. + * + * @param slot_id the slot slot_id. + * + * @return the Any that was stored in the slot. If the given slot has not been + * set, the returned Any contains a type code with a TCKind value of tk_null + * and has no value. + * + * @throws InvalidSlot for the unknown slot. + * @throws BAD_INV_ORDER minor 10 if called from the {@link ORBInitializer} + * methods. + */ + Any get_slot(int slot_id) throws InvalidSlot, BAD_INV_ORDER; + + /** + * Sets data for the slot with the given slot_id. + * + * @param slot_id the slot slot_id. + * + * @param data the Any that will be stored into the slot. + * + * @throws InvalidSlot for the unknown slot. + * @throws BAD_INV_ORDER minor 10 if called from the {@link ORBInitializer} + * methods. + * + */ + void set_slot(int slot_id, Any data) throws InvalidSlot, BAD_INV_ORDER; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java b/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java new file mode 100644 index 000000000..bec0c25e0 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java @@ -0,0 +1,55 @@ +/* DISCARDING.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.PortableInterceptor; + +/** + * A single constant interface, defining the adapter state (DISCARDING) = 2. + * Used with IOR interceptors. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DISCARDING +{ + /** + * Specifies the DISCARDING value, 2. + */ + short value = 2; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequest.java b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequest.java new file mode 100644 index 000000000..1018b2722 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequest.java @@ -0,0 +1,97 @@ +/* ForwardRequest.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.PortableInterceptor; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The ForwardRequest is thrown by interceptors to forward the request to + * another target. The field {@link #forward} contains the reference to this + * alternative location. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ForwardRequest extends UserException implements IDLEntity, + Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 2128007517550526397L; + + /** + * The field forward. + */ + public org.omg.CORBA.Object forward; + + /** + * Create ForwardRequest with no explaining + * message and all fields left unitialised with the default initial java values. + */ + public ForwardRequest() + { + } + + /** + * Create the ForwardRequest with explaining + * message and all fields initialised to the given values. + * + * @param why a string, explaining, why this exception has been thrown. + * @param a_forward a value for forward. + */ + public ForwardRequest(String why, org.omg.CORBA.Object a_forward) + { + super(why); + this.forward = a_forward; + } + + /** + * Create the ForwardRequest without explaining + * message and all fields initialised to the given values. + * + * @param a_forward a value for forward. + */ + public ForwardRequest(org.omg.CORBA.Object a_forward) + { + this.forward = a_forward; + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java new file mode 100644 index 000000000..1d44e9c0f --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java @@ -0,0 +1,146 @@ +/* ForwardRequestHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.Interceptor.ForwardRequestHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the exception {@link ForwardRequest}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ForwardRequestHelper +{ + /** + * Create the ForwardRequest typecode (structure, named "ForwardRequest"). The + * typecode states that the structure contains the following fields: forward. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[1]; + + TypeCode field = ObjectHelper.type(); + members[0] = new StructMember("forward", field, null); + return orb.create_exception_tc(id(), "ForwardRequest", members); + } + + /** + * Insert the ForwardRequest into the given Any. This method uses the + * ForwardRequestHolder. + * + * @param any the Any to insert into. + * @param that the ForwardRequest to insert. + */ + public static void insert(Any any, ForwardRequest that) + { + any.insert_Streamable(new ForwardRequestHolder(that)); + } + + /** + * Extract the ForwardRequest from given Any. This method uses the + * ForwardRequestHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain ForwardRequest. + */ + public static ForwardRequest extract(Any any) + { + try + { + return ((ForwardRequestHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION(id() + " expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ForwardRequest repository id. + * + * @return "IDL:omg.org/PortableInterceptor/ForwardRequest:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ForwardRequest:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ForwardRequest read(InputStream input) + { + // Read (and discard) the exception repository id. + input.read_string(); + + ForwardRequest value = new ForwardRequest(); + + value.forward = input.read_Object(); + 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, ForwardRequest value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_Object(value.forward); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java b/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java new file mode 100644 index 000000000..ce22a1f68 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java @@ -0,0 +1,55 @@ +/* HOLDING.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.PortableInterceptor; + +/** + * A single constant interface, defining the adapter state (HOLDING) = 0. + * Used with IOR interceptors. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface HOLDING +{ + /** + * Specifies the HOLDING value, 0. + */ + short value = 0; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java b/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java new file mode 100644 index 000000000..8a5cad1e1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java @@ -0,0 +1,57 @@ +/* INACTIVE.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.PortableInterceptor; + +/** + * A single constant interface, defining the adapter state (INACTIVE) = 3. + * The adapter is shutting down, and will eventually end up in the + * NON_EXISTENT state. + * Used with IOR interceptors. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface INACTIVE +{ + /** + * Specifies the INACTIVE value, 3. + */ + short value = 3; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInfo.java b/libjava/classpath/org/omg/PortableInterceptor/IORInfo.java new file mode 100644 index 000000000..489818456 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInfo.java @@ -0,0 +1,58 @@ +/* IORInfo.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Provides the server-side ORB service possibility to add components to the new + * IOR being created. Also, provides access to policies, applicable to the + * object, referenced by that IOR. The ORB passes an instance of IORInfo as a + * parameter to {@link IORInterceptorOperations#establish_components}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInfo extends IORInfoOperations, + IDLEntity, + org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java new file mode 100644 index 000000000..9ff8d0e27 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java @@ -0,0 +1,138 @@ +/* IORInfoOperations.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.PortableInterceptor; + +import org.omg.CORBA.Policy; +import org.omg.IOP.TaggedComponent; + +/** + * The ORB service uses this interface to add the service specific components to + * the new IOR being constructed. The interface provides also possibility to get + * the POA policies the apply to the IOR being constructed. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInfoOperations +{ + /** + * Adds a service-specific component to the IOR profile being constructed. + * + * @param tagged_component a tagged component being added. + * + * @param profile_id the IOR profile to that the component must be added. + * The 0 value ({@link org.omg.IOP.TAG_INTERNET_IOP#value}) adds to the + * Internet profile where host and port are stored by default. + */ + void add_ior_component_to_profile(TaggedComponent tagged_component, + int profile_id + ); + + /** + * Adds a service-specific component to the IOR profile being constructed. + * The specified component will be included in all profiles, present in the + * IOR being constructed. + * + * @param tagged_component a tagged component being added. + */ + void add_ior_component(TaggedComponent tagged_component); + + /** + * Get the server side policy for an IOR being constructed. The method returns + * policies applying for POA where the object, represented by this IOR, is + * connected. + * + * @param policy_type the type of the policy. + * + * @return the policy of the given type that applies to the IOR being + * constructed. + * + * @see org.omg.PortableServer.POAOperations#create_POA + */ + Policy get_effective_policy(int policy_type); + + /** + * Get the adapter template that is associated with the object POA. + * The template is also a reference factory and can produce the new object + * references. + * + * @since 1.5 + */ + public ObjectReferenceTemplate adapter_template(); + + /** + * The current_factory is the factory, used by the adapter to create + * object references. This factory is initially the same as the + * adapter_template. + * + * @since 1.5 + */ + public ObjectReferenceFactory current_factory(); + + /** + * Set the current object reference factory, used to produce the new objects. + * + * The current factory can only be set during the call to the + * {@link IORInterceptor_3_0Operations#components_established(IORInfo)}. + * + * @since 1.5 + */ + public void current_factory(ObjectReferenceFactory factory); + + /** + * Get the POA manager Id. + * + * @return Id that uniquely refers to the poa manager, used by this POA. + * + * @since 1.5 + * + * @see IORInterceptor_3_0Operations#adapter_manager_state_changed + */ + public int manager_id(); + + /** + * Get the state of the adapter manager. + * + * @since 1.5 + * + * @return the state of the adapters to that the IOR being created belongs. + * One of the {@link HOLDING#value}, {@link DISCARDING#value}, + * {@link INACTIVE#value} or {@link NON_EXISTENT#value}. + */ + short state(); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor.java new file mode 100644 index 000000000..d654f3998 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor.java @@ -0,0 +1,61 @@ +/* IORInterceptor.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * An ORB service implementation may need to add information describing the + * serverORB service related capabilities to object references + * (IORs). This is supported through the IORInterceptor and {@link IORInfo} + * interfaces. The IOR Interceptor is used to establish tagged components in the + * profiles within a new IOR being created. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptor extends IDLEntity, + Interceptor, + InterceptorOperations, + IORInterceptorOperations, + org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java new file mode 100644 index 000000000..f955576b5 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java @@ -0,0 +1,58 @@ +/* IORInterceptorOperations.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.PortableInterceptor; + + +/** + * Defines operation, applicable to the IORInterceptor. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptorOperations extends InterceptorOperations +{ + /** + * A server side ORB calls this method on all registered IORInterceptor's when + * creating the object reference (IOR). The interceptors have the possibility + * to add additional tags to the IOR being created. + * + * @param info the interface class providing methods to insert additional tags + * into IOR being constructed. + */ + public void establish_components(IORInfo info); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java new file mode 100644 index 000000000..e77d34694 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java @@ -0,0 +1,59 @@ +/* IORInterceptor_3_0.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The IORInterceptor_3_0 adds to {@link Interceptor} functionality, available + * since CORBA 3.0. These new operations are defined separately in + * {@link IORInterceptor_3_0Operations}. + * + * IORInterceptor_3_0 is registered exactly in the same way as the + * {@link IORInterceptor}. The ORB calls the additional methods to all + * IOR interceptors that implement this extended interface. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptor_3_0 + extends IORInterceptor_3_0Operations, IDLEntity, IORInterceptor +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java new file mode 100644 index 000000000..97875deb2 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java @@ -0,0 +1,189 @@ +/* IORInterceptor_3_0Helper.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.PortableInterceptor; + +import gnu.CORBA.Minor; +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.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the CORBA object {@link IORInterceptor_3_0}. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class IORInterceptor_3_0Helper +{ + /** + * Get the type code of the {@link IORInterceptor_3_0}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), + "IORInterceptor_3_0"); + } + + /** + * Insert the IORInterceptor_3_0 into the given Any. + * + * @param any the Any to insert into. + * @param that the IORInterceptor_3_0 to insert. + */ + public static void insert(Any any, IORInterceptor_3_0 that) + { + any.insert_Streamable(new IORInterceptor_3_0Holder(that)); + } + + /** + * Extract the IORInterceptor_3_0 from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain + * IORInterceptor_3_0. + */ + public static IORInterceptor_3_0 extract(Any any) + { + try + { + IORInterceptor_3_0Holder holder = (IORInterceptor_3_0Holder) + any.extract_Streamable(); + return holder.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("IORInterceptor_3_0 expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the IORInterceptor_3_0 repository id. + * + * @return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0"; + } + + /** + * Narrow the passed object into the IORInterceptor_3_0. If the object has a + * different java type, create an instance of the _IORInterceptor_3_0Stub, + * using the same delegate, as for the passed parameter. Hence, unlike java + * type cast, this method may return a different object, than has been passed. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0. + */ + public static IORInterceptor_3_0 narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof IORInterceptor_3_0) + return (IORInterceptor_3_0) obj; + else if (!obj._is_a(id())) + throw new BAD_PARAM("Not a IORInterceptor_3_0"); + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _IORInterceptor_3_0Stub(delegate); + } + } + + /** + * Narrow the passed object into the IORInterceptor_3_0. No type-checking is + * performed to verify that the object actually supports the requested type. + * The {@link BAD_OPERATION} will be thrown if unsupported operations are + * invoked on the new returned reference, but no failure is expected at the + * time of the unchecked_narrow. For instance, the narrowing of the + * remote instance of the {@link IORInterceptor} will work as long as only the + * methods, inherited from this parent, are invoked. + * + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0. + */ + public static IORInterceptor_3_0 unchecked_narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof IORInterceptor_3_0) + return (IORInterceptor_3_0) obj; + else + { + Delegate delegate = ((ObjectImpl) obj)._get_delegate(); + return new _IORInterceptor_3_0Stub(delegate); + } + } + + + /** + * Read the IORInterceptor_3_0 from the CDR intput stream (IOR profile + * expected). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static IORInterceptor_3_0 read(InputStream input) + { + return unchecked_narrow(input.read_Object()); + } + + /** + * Write the IORInterceptor_3_0 to the CDR output stream (as IOR profile). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, IORInterceptor_3_0 value) + { + output.write_Object(value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java new file mode 100644 index 000000000..42462eab9 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java @@ -0,0 +1,106 @@ +/* IORInterceptor_3_0Holder.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.PortableInterceptor; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the object {@link IORInterceptor_3_0}. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class IORInterceptor_3_0Holder + implements Streamable +{ + /** + * The stored IORInterceptor_3_0 value. + */ + public IORInterceptor_3_0 value; + + /** + * Create the unitialised instance, leaving the value field with default + * <code>null</code> value. + */ + public IORInterceptor_3_0Holder() + { + } + + /** + * Create the initialised instance. + * + * @param initialValue the value that will be assigned to the + * <code>value</code> field. + */ + public IORInterceptor_3_0Holder(IORInterceptor_3_0 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 = IORInterceptor_3_0Helper.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) + { + IORInterceptor_3_0Helper.write(output, value); + } + + /** + * Get the typecode of the IORInterceptor_3_0. + */ + public org.omg.CORBA.TypeCode _type() + { + return IORInterceptor_3_0Helper.type(); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java new file mode 100644 index 000000000..56e19a5be --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java @@ -0,0 +1,90 @@ +/* IORInterceptor_3_0Operations.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.PortableInterceptor; + +/** + * Defines the operations, applicable to the IORInterceptor_3_0. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptor_3_0Operations + extends IORInterceptorOperations +{ + /** + * This method is invoked on all registered IORInterceptor_3_0 instances when + * the state of the adapter manager changes. + * + * @param adapterManagerId the Id of the adapter manager that has changed the + * state. The same value is returned by + * {@link IORInfoOperations#manager_id()}. + * + * @param adapterState the new state of the adapter manager, one of the + * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value} + * or {@link NON_EXISTENT#value}. + */ + void adapter_manager_state_changed(int adapterManagerId, short adapterState); + + /** + * Notifies the interceptor about the adapter state changes that are unrelated + * to adapter manager state changes. This method is invoked on all registered + * IORInterceptor_3_0 instances. The only currently possible change of state + * is when POA is destroyed. In this case, the method is invoked passing the + * single element array witn the reference template of the POA being destroyed + * and the {@link NON_EXISTENT#value} state. + * + * @param adapters identifies the object adapters that have changed they + * state. + * @param adaptersState the new state of the adapters, one of the + * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value} + * or {@link NON_EXISTENT#value}. + */ + void adapter_state_changed(ObjectReferenceTemplate[] adapters, + short adaptersState); + + /** + * This metod is invoked after the + * {@link IORInterceptorOperations#establish_components} have been called on + * all registered interceptor instances. At this stage, it is possible to set + * the object reference factory using + * {@link IORInfo#current_factory(ObjectReferenceFactory )}. + */ + void components_established(IORInfo info); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/Interceptor.java b/libjava/classpath/org/omg/PortableInterceptor/Interceptor.java new file mode 100644 index 000000000..4dcb2162a --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/Interceptor.java @@ -0,0 +1,58 @@ +/* Interceptor.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.PortableInterceptor; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Portable Interceptors are hooks into the ORB through which ORB services can + * intercept the normal flow of execution in creation of IOR, sending request, + * receiving request and returning the reply. + * + * See {@link ORBInitializer} for explanation, how the interceptors are + * registered within the ORB. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Interceptor extends InterceptorOperations, + Object, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/InterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/InterceptorOperations.java new file mode 100644 index 000000000..3758ab01a --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/InterceptorOperations.java @@ -0,0 +1,77 @@ +/* InterceptorOperations.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.PortableInterceptor; + + +/** + * Defines operations, applicable for all types of {@link Interceptor}. + * The the derived interfaces define additional operations for they + * specific functionality. + * + * Portable Interceptors are hooks into the ORB through which ORB services can + * intercept the normal flow of execution in creation of IOR, sending request, + * receiving request and returning the reply. + * + * See {@link org.omg.PortableInterceptor} for more details about the possible + * interceptors and how to register them within the ORB. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface InterceptorOperations +{ + /** + * This method is called when orb is being destroyed and destroys + * the interceptor. The ORB calls this method after completing all + * incoming requests. The method body should not invoke methods on other + * object, belonging to ORB being destoryed, as in this stage it is no + * longer capable to act as server. It is still, however, capable + * to act as a client, permitting remote invocations on other objects. + */ + void destroy(); + + /** + * All interceptors of the same type, registered on the single ORB, must + * either have different names or be anonymous. The name of the anonymous + * interceptor is an empty string. The ORB supports multiple anonymous + * interceptors of the same type. + * + * @return the name of the interceptor. + */ + String name(); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlot.java b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlot.java new file mode 100644 index 000000000..e166e0631 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlot.java @@ -0,0 +1,76 @@ +/* InvalidSlot.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.PortableInterceptor; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The InvalidSlot is thrown when the slot identifier, passed in one of the + * methods, related to {@link Current}, does not define a valid slot. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class InvalidSlot extends UserException implements IDLEntity, + Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 2471643293291821501L; + + /** + * Create InvalidSlot with no explaining message. + */ + public InvalidSlot() + { + } + + /** + * Create the InvalidSlot with explaining message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public InvalidSlot(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java new file mode 100644 index 000000000..36e23a90c --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java @@ -0,0 +1,143 @@ +/* InvalidSlotHelper.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.PortableInterceptor; + +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 InvalidSlot}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class InvalidSlotHelper +{ + /** + * Create the InvalidSlot typecode (structure, named "InvalidSlot"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[0]; + return orb.create_exception_tc(id(), "InvalidSlot", members); + } + + /* + * Every user exception with no user defined fields can use + * EmptyExceptionHolder + */ + + /** + * Insert the InvalidSlot into the given Any. + * + * @param any the Any to insert into. + * @param that the InvalidSlot to insert. + */ + public static void insert(Any any, InvalidSlot that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the InvalidSlot from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain InvalidSlot. + */ + public static InvalidSlot extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (InvalidSlot) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("InvalidSlot expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the InvalidSlot repository id. + * + * @return "IDL:omg.org/PortableInterceptor/InvalidSlot:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/InvalidSlot:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static InvalidSlot read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + InvalidSlot value = new InvalidSlot(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, InvalidSlot value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java b/libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java new file mode 100644 index 000000000..f0d90788e --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/LOCATION_FORWARD.java @@ -0,0 +1,54 @@ +/* LOCATION_FORWARD.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.PortableInterceptor; + + +/** + * A reply status flag, indicating, that the object has + * moved (temporary or permanently) to another location. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface LOCATION_FORWARD +{ + /** + * Specifies the LOCATION_FORWARD value, 3. + */ + short value = 3; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java b/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java new file mode 100644 index 000000000..136b64fb0 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java @@ -0,0 +1,57 @@ +/* NON_EXISTENT.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.PortableInterceptor; + +/** + * A single constant interface, defining the adapter state (NON_EXISTENT) = 4. + * NON_EXISTENT does not map directly to a particular POAManager state, but + * indicates that a POA has been destroyed. Used with IOR interceptors. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ + +public interface NON_EXISTENT +{ + /** + * Specifies the NON_EXISTENT value, 4. + */ + short value = 4; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java new file mode 100644 index 000000000..f80e71a9a --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java @@ -0,0 +1,119 @@ +/* ORBIdHelper.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.PortableInterceptor; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The ORB Id is defined in OMG specification just as a narrow (not wide) + * string. As such, the ORB Id needs no helper, but one is included in + * the API anyway. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ORBIdHelper +{ + /** + * Insert the ORB Id into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the ORB Id from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an alias typecode. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "ORBId", orb.create_string_tc(0)); + } + + /** + * Return the ORB Id repository id. + * @return "IDL:omg.org/PortableInterceptor/ORBId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ORBId:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param input the stream to read from. + */ + public static String read(InputStream input) + { + return input.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param output the stream to write into. + * @param value the string (ORB Id) value to write. + */ + public static void write(OutputStream output, String value) + { + output.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfo.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfo.java new file mode 100644 index 000000000..a74b1e79d --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfo.java @@ -0,0 +1,54 @@ +/* ORBInitInfo.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.PortableInterceptor; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; + +/** + * The instance of this interface is passed to {@link ORBInitializerOperations} + * and is used by {@link ORBInitializer} to register its {@link Interceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ORBInitInfo extends ORBInitInfoOperations, + Object, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java new file mode 100644 index 000000000..cacae3dce --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java @@ -0,0 +1,174 @@ +/* ORBInitInfoOperations.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.PortableInterceptor; + +import org.omg.CORBA.BAD_INV_ORDER; +import org.omg.CORBA.ORB; +import org.omg.IOP.CodecFactory; +import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; + +/** + * Defines operations, applicable to {@link ORBInitInfo}. The + * {@link ORBInitInfo} is passed to the {@link ORBInitializer} that is + * reponsible for registering an {@link Interceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ORBInitInfoOperations +{ + /** + * Register the client request interceptor. + * + * @param interceptor the interceptor to register. + * + * @throws DuplicateName if the interceptor name is not an empty string and an + * interceptor with this name is already registered with the ORB being + * created. + */ + void add_client_request_interceptor(ClientRequestInterceptor interceptor) + throws DuplicateName; + + /** + * Register the IOR (object reference) interceptor. If the registered + * interceptor implements the extended {@link IORInterceptor_3_0} interface, + * ORB will call its additional methods, defined in the + * {@link IORInterceptor_3_0Operations}. + * + * @param interceptor the interceptor to register. + * + * @throws DuplicateName if the interceptor name is not an empty string and an + * interceptor with this name is already registered with the ORB being + * created. + */ + void add_ior_interceptor(IORInterceptor interceptor) + throws DuplicateName; + + /** + * Register the server request interceptor. + * + * @param interceptor the interceptor to register. + * + * @throws DuplicateName if the interceptor name is not an empty string and an + * interceptor with this name is already registered with the ORB being + * created. + */ + void add_server_request_interceptor(ServerRequestInterceptor interceptor) + throws DuplicateName; + + /** + * Allocate a slot on a {@link Current} of this interceptor. While slots can + * be allocated by this method, they cannot be initialized. + * {@link CurrentOperations#get_slot} and {@link CurrentOperations#set_slot} + * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor + * initializer. + * + * @return the index to the slot that has been allocated. + */ + int allocate_slot_id(); + + /** + * Returns the arguments passed to the ORB.init. + * + * @return the first parameter, passed to the methods from the group + * org.omg.CORBA.ORB#init(String[], ...). + */ + String[] arguments(); + + /** + * Get the CodecFactory that may be needed during the interceptor + * initialization. The method ORB.resolve_initial_references ("CodecFactory") + * cannot be used during ORB initialization. + * + * @return the CodecFactory. + */ + CodecFactory codec_factory(); + + /** + * Returns the ID of the ORB being initialized. + * + * @return the ORB id that differs for each new ORB being created during the + * current run of the java virtual machine. + */ + String orb_id(); + + /** + * Register the initial reference. The registered object will be accessible by + * the {@link ORB#resolve_initial_references} under the object_name. + * + * @param object_name the name of the object to register. + * @param object the object to register. + * + * @throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName if the + * name being registered is assumed to be invalid. + */ + void register_initial_reference(String object_name, + org.omg.CORBA.Object object + ) throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName; + + /** + * Identical to {@link org.omg.CORBA.ORB#resolve_initial_references}. + * + * This method can only be called from + * {@link ORBInitializerOperations#post_init} and not during + * {@link ORBInitializerOperations#pre_init}. + * + * @param object_name the name of the object to search. + * + * @return the object, accessible by the given name. + * + * @throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName if the + * given name is not associated with the known object. + * + * @see org.omg.CORBA.ORB#resolve_initial_references + */ + org.omg.CORBA.Object resolve_initial_references(String object_name) + throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName; + + /** + * Registers a PolicyFactory for the given PolicyType. + * + * @param policy_type the type of policy for that the factory is being + * registered. + * @param policy_factory the policy factory to register. + * + * @throws BAD_INV_ORDER minor 16 if the policy of the given type already has + * the registered factory in this ORB. + */ + void register_policy_factory(int policy_type, PolicyFactory policy_factory); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java new file mode 100644 index 000000000..bad7f8baa --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateName.java @@ -0,0 +1,101 @@ +/* DuplicateName.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.PortableInterceptor.ORBInitInfoPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * This exception is raised on an attempt to register a second + * {@link org.omg.PortableInterceptor#Interceptor} with the same name. + * For each {@link org.omg.PortableInterceptor#Interceptor} type, only + * one {@link org.omg.PortableInterceptor#Interceptor} of a given name can + * be registered with the {@link org.omg.CORBA.ORB}. + * + * @see org.omg.PortableInterceptor.ORBInitInfoOperations + * + * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) + */ +public final class DuplicateName extends UserException implements IDLEntity, + Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 7748239257677851130L; + + /** + * The name that appears to be duplicate. + */ + public String name; + + /** + * Create DuplicateName with no explaining message field {@link #name} + * initialised to null. + */ + public DuplicateName() + { + } + + /** + * Create the DuplicateName with explaining message and field {@link #name} + * initialised to the given value. + * + * @param why a string, explaining, why this exception has been thrown. + * @param a_name a value for name. + */ + public DuplicateName(String why, String a_name) + { + super(why); + this.name = a_name; + } + + /** + * Create the DuplicateName without explaining message and and field + * {@link #name} initialised to the given value. + * + * @param a_name a value for name. + */ + public DuplicateName(String a_name) + { + this.name = a_name; + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java new file mode 100644 index 000000000..962da93c8 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java @@ -0,0 +1,145 @@ +/* DuplicateNameHelper.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.PortableInterceptor.ORBInitInfoPackage; + +import gnu.CORBA.*; + +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; + +/** + * The helper operations for the exception {@link DuplicateName}. + * + * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) + */ +public abstract class DuplicateNameHelper +{ + /** + * Create the DuplicateName typecode (structure, named "DuplicateName"). The + * typecode states that the structure contains the following fields: name. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[1]; + + TypeCode field; + + field = orb.get_primitive_tc(TCKind.tk_string); + members[0] = new StructMember("name", field, null); + return orb.create_exception_tc(id(), "DuplicateName", members); + } + + /** + * Insert the DuplicateName into the given Any. This method uses the + * DuplicateNameHolder. + * + * @param any the Any to insert into. + * @param that the DuplicateName to insert. + */ + public static void insert(Any any, DuplicateName that) + { + any.insert_Streamable(new DuplicateNameHolder(that)); + } + + /** + * Extract the DuplicateName from given Any. + * This method uses the DuplicateNameHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain DuplicateName. + */ + public static DuplicateName extract(Any any) + { + try + { + return ((DuplicateNameHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("DuplicateName expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the DuplicateName repository id. + * + * @return "IDL:omg.org/PortableInterceptor/ORBInitInfo/DuplicateName:1.0". + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ORBInitInfo/DuplicateName:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static DuplicateName read(InputStream input) + { + // Read the exception repository id. + input.read_string(); + DuplicateName value = new DuplicateName(); + + value.name = input.read_string(); + 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, DuplicateName value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_string(value.name); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java new file mode 100644 index 000000000..7a7e23cc0 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidName.java @@ -0,0 +1,79 @@ +/* InvalidName.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.PortableInterceptor.ORBInitInfoPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * This exception is raised by methods in + * {@link org.omg.PortableInterceptor.ORBInitInfoOperations} on the attempt to + * register or resolve an invalid name like empty string. The already + * registered names (including the default names, defined by OMG) are also + * invalid for registration. + * + * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) + */ +public final class InvalidName extends UserException implements IDLEntity, + Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -4599417794753377115L; + + /** + * Create InvalidName with no explaining message. + */ + public InvalidName() + { + } + + /** + * Create the InvalidName with explaining message. + * + * @param why a string, explaining, why the name is invalid. + */ + public InvalidName(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java new file mode 100644 index 000000000..c7daf46b9 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java @@ -0,0 +1,138 @@ +/* InvalidNameHelper.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.PortableInterceptor.ORBInitInfoPackage; + +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 InvalidName}. + * + * @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) + */ +public abstract class InvalidNameHelper +{ + /** + * Create the InvalidName typecode (structure, named "InvalidName"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[0]; + return orb.create_exception_tc(id(), "InvalidName", members); + } + + /** + * Insert the InvalidName into the given Any. + * + * @param any the Any to insert into. + * @param that the InvalidName to insert. + */ + public static void insert(Any any, InvalidName that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the InvalidName from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain InvalidName. + */ + public static InvalidName extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (InvalidName) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("InvalidName expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the InvalidName repository id. + * + * @return "IDL:omg.org/PortableInterceptor/ORBInitInfo/InvalidName:1.0". + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ORBInitInfo/InvalidName:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static InvalidName read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + InvalidName value = new InvalidName(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, InvalidName value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java new file mode 100644 index 000000000..b61720c56 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java @@ -0,0 +1,117 @@ +/* ObjectIdHelper.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.PortableInterceptor.ORBInitInfoPackage; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The Object Id is defined in OMG specification just as a narrow (not wide) + * string. As such, the Object Id needs no helper, but one is included in + * the API anyway. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectIdHelper +{ + /** + * Insert the Object Id into Any (uses {@link Any#insert_string(String)}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the Object Id from Any (uses {@link Any#extract_string()}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an alias typecode. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "ObjectId", orb.create_string_tc(0)); + } + + /** + * Return the Object Id repository id. + * @return "IDL:omg.org/PortableInterceptor/ORBInitInfo/ObjectId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ORBInitInfo/ObjectId:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param input the stream to read from. + */ + public static String read(InputStream input) + { + return input.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param output the stream to write into. + * @param value the string (Object Id) value to write. + */ + public static void write(OutputStream output, String value) + { + output.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitializer.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializer.java new file mode 100644 index 000000000..84ddfd9fe --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializer.java @@ -0,0 +1,132 @@ +/* ORBInitializer.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.PortableInterceptor; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * Registers the interceptor. + * + * Direct interceptor registration would open a security hole. Hence instead the + * interceptors from the ORB.init(..) method, passing the names of the needed + * initialized classes via properties. + * </p> + * <p> + * These property names are of the form + * </p> + * <p><i>org.omg.PortableInterceptor.ORBInitializerClass.<Service></i></p> + * where <i><Service></i> is the string name of a class, which implements + * {@link ORBInitializer}. During <code>ORB.init(..)</code>, the properties + * begining with <i>org.omg.PortableInterceptor.ORBInitializerClass</i> are + * collected, the <i><Service></i> portion of each property is extracted, + * the initialiser is instantiated with the <i><Service></i> string as its + * class name and then <code>pre_init</code> and <code>post_init</code> + * (defined in {@link ORBInitializerOperations}) are called on that initializer. + * The runtime exceptions, thrown by these two methods, are ignored. + * </p> + * <p> + * <h3>Example</h3> + * A client-side logging service may have the following ORBInitializer + * implementation: + * + * <code><pre> + * package gnu.x.logging; + * + * import org.omg.PortableInterceptor.*; + * import org.omg.CORBA.LocalObject; + * + * public class LoggingService extends LocalObject implements ORBInitializer + * { + * public void pre_init (ORBInitInfo info) + * { + * // More than one interceptor can be registered. + * ServerRequestInterceptor log_requests = new rLoggingInterceptor(); + * info.add_server_request_interceptor(log_requests); + * + * IORInterceptor log_iors = new iLoggingInterceptor(); + * info.add_ior_interceptor(log_iors); + * } + * + * public void post_init (ORBInitInfo info) + * { + * // Unused. + * } + * } + * </code></pre> + * <p> + * Then, one of the used set of properties then must contain the property, named + * <i> + * org.omg.PortableInterceptor.ORBInitializerClass.gnu.x.Logging.LoggingService + * </i>. + * The value of the property is ignored and may empty string. The + * agreed locations, where this property will be searched for, are: + * </p><p> + * 1. The properties parameter in the ORB.init(..), if any.<br> + * 2. The System properties.<br> + * 3. The orb.properties file located in the user.home directory (if any).<br> + * 4. The orb.properties file located in the java.home/lib directory (if any). + * </p> + * <p> + * The applet parameters and command line arguments are <i>not</i> scanned + * for the possible initializers. + * </p> + * <p> + * Interceptors are registered on a per-ORB basis. The virtual per-object + * Interceptors can be simulated by checking the policies on the target from + * within the interception points to determine whether they should work. The + * virtual per-POA Interceptors can be obtained instantiating each POA such with + * a different ORB. + * </p> + * <p> + * The registration code should not call directly any methods on the ORB being + * registered. + * </p> + * <p> + * The new interceptors cannot be registered after the ORB.init(..) returns. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ORBInitializer extends ORBInitializerOperations, + Object, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitializerOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializerOperations.java new file mode 100644 index 000000000..04bc387d1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializerOperations.java @@ -0,0 +1,73 @@ +/* ORBInitializerOperations.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.PortableInterceptor; + + +/** + * Defines operations, applicable to the ORBInitializer. These operations are + * invoked on initializer from the ORB.init. + * + * @see ORBInitializer + */ +public interface ORBInitializerOperations +{ + /** + * This method is called during the first step of initialization. It must + * register all initial references that are expected to be used by other + * interceptors. + * + * @param info the object describing ORB being created and containing methods + * to register the interceptor. + * + * @see ORBInitInfoOperations#register_initial_reference + */ + void pre_init(ORBInitInfo info); + + /** + * This method called during the subsequent step of initialization. In this + * method it can be assumed that all required initial references are already + * registered. + * + * @param info the object describing ORB being created and containing methods + * to register the interceptor. + * + * @see ORBInitInfoOperations#register_initial_reference + */ + void post_init(ORBInitInfo info); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java new file mode 100644 index 000000000..19fc05daf --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java @@ -0,0 +1,121 @@ +/* ObjectIdHelper.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.PortableInterceptor; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.OctetSeqHelper; +import org.omg.CORBA.OctetSeqHolder; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The Object Id of this package is defined in OMG specification as a byte array. + * As such, the Object Id needs no helper, but one is included in the API anyway. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectIdHelper +{ + /** + * Insert the Object Id into Any. + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, byte[] that) + { + a.insert_Streamable(new OctetSeqHolder(that)); + a.type(type()); + } + + /** + * Extract the Object Id from Any. + * + * @param a the Any to extract from. + */ + public static byte[] extract(Any a) + { + return ((OctetSeqHolder) a.extract_Streamable()).value; + } + + /** + * Return an alias typecode (an alias of the octet sequence). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "ObjectId", OctetSeqHelper.type()); + } + + /** + * Return the Object Id repository id. + * @return "IDL:omg.org/PortableInterceptor/ObjectId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ObjectId:1.0"; + } + + /** + * Read the Object Id as a byte array. + * + * @param input the stream to read from. + */ + public static byte[] read(InputStream input) + { + return OctetSeqHelper.read(input); + } + + /** + * Write the Object Id as a byte array. + * + * @param output the stream to write into. + * @param value the Object Id value to write. + */ + public static void write(OutputStream output, byte[] value) + { + OctetSeqHelper.write(output, value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java new file mode 100644 index 000000000..7b669799a --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java @@ -0,0 +1,75 @@ +/* ObjectReferenceFactory.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.PortableInterceptor; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; +import org.omg.CORBA.portable.ValueBase; + +/** + * Provides the possibility to create the CORBA object reference. + * The reference is created from repository id (defining the type of the + * object) and the object id (defining the identity of the object). + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ObjectReferenceFactory + extends ValueBase, IDLEntity +{ + /** + * Create an object with the given repository and object ids. This interface + * does not specify where and how the returned object must be connected and + * activated. The derived {@link ObjectReferenceTemplate} interface assumes + * the object must be connected to the POA that is specific to that + * template (name can be obtained). + * + * If the object with this objectId already exists in the given context, it + * is found and returned; a new object is <i>not</i> created. + * + * @param repositoryId the repository id of the object being created, defines + * the type of the object. + * + * @param objectId the byte array, defining the identity of the object. + * + * @return The created corba object. + */ + Object make_object(String repositoryId, byte[] objectId); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java new file mode 100644 index 000000000..8f5af656e --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java @@ -0,0 +1,142 @@ +/* ObjectReferenceFactoryHelper.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.PortableInterceptor; + +import gnu.CORBA.CDR.Vio; +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.ValueMember; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.VM_ABSTRACT; + +/** + * The helper operations for the CORBA object {@link ObjectReferenceFactory}. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectReferenceFactoryHelper +{ + /** + * Get the type code of the {@link ObjectReferenceFactory}. + * + * @return value type code with the agreed id, named "ObjectReferenceFactory", + * abstract, no members, no base type. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_value_tc(id(), "ObjectReferenceFactory", + VM_ABSTRACT.value, null, + new ValueMember[0]); + } + + /** + * Insert the ObjectReferenceFactory into the given Any. + * + * @param any the Any to insert into. + * @param that the ObjectReferenceFactory to insert. + */ + public static void insert(Any any, ObjectReferenceFactory that) + { + ObjectReferenceFactoryHolder h = new ObjectReferenceFactoryHolder(that); + any.insert_Streamable(h); + } + + /** + * Extract the ObjectReferenceFactory from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ObjectReferenceFactory. + */ + public static ObjectReferenceFactory extract(Any any) + { + try + { + ObjectReferenceFactoryHolder h = + (ObjectReferenceFactoryHolder) (any.extract_Streamable()); + return h.value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = + new BAD_OPERATION("ObjectReferenceFactory expected"); + bad.minor = Minor.Any; + bad.initCause(ex); + throw bad; + } + } + + /** + * Get the ObjectReferenceFactory repository id. + * + * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceFactory:1.0", + * always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ObjectReferenceFactory:1.0"; + } + + /** + * Read the ObjectReferenceFactory from the CDR intput stream + * (ValueBase type expected). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ObjectReferenceFactory read(InputStream input) + { + return (ObjectReferenceFactory) Vio.read(input); + } + + /** + * Write the ObjectReferenceFactory to the CDR output stream (as a ValueBase). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, ObjectReferenceFactory value) + { + Vio.write(output, value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java new file mode 100644 index 000000000..07be73a1d --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java @@ -0,0 +1,105 @@ +/* ObjectReferenceFactoryHolder.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.PortableInterceptor; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for the object {@link ObjectReferenceFactory}. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ObjectReferenceFactoryHolder + implements Streamable +{ + /** + * The stored ObjectReferenceFactory value. + */ + public ObjectReferenceFactory value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public ObjectReferenceFactoryHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public ObjectReferenceFactoryHolder(ObjectReferenceFactory 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 = ObjectReferenceFactoryHelper.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) + { + ObjectReferenceFactoryHelper.write(output, value); + } + + /** + * Get the typecode of the ObjectReferenceFactory. + */ + public org.omg.CORBA.TypeCode _type() + { + return ObjectReferenceFactoryHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java new file mode 100644 index 000000000..42ffdfd7e --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java @@ -0,0 +1,78 @@ +/* ObjectReferenceTemplate.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.PortableInterceptor; + +import org.omg.PortableServer.POA; + +/** + * Defines the identity of the portable object adapter ({@link POA}}. The + * adapter name, orb id and server id together uniquely define the identity + * of this adapter. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ObjectReferenceTemplate + extends ObjectReferenceFactory +{ + /** + * Get the name of this adapter. This name can be set by specifying + * the org.omg.CORBA.ORBid property in the ORB.Init(.., Properties). + * The default value includes the hashcode of the ORB instance and hence + * should normally differ for each ORB. + * + * @return the name of adapter, represented in the form of the string array. + */ + String[] adapter_name(); + + /** + * The id of the {@link org.omg.CORBA.ORB} of this adapter. + * + * @return the ORB id, represented in the form of string. + */ + String orb_id(); + + /** + * Get the server id of of this adapter. This name can be set by specifying + * the org.omg.CORBA.ServerId property in the ORB.Init(.., Properties) or + * in the system property. All ORB's on the same jre share the same value. + * + * @return the server id, represented in the form of string. + */ + String server_id(); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java new file mode 100644 index 000000000..86b00c50a --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java @@ -0,0 +1,136 @@ +/* ObjectReferenceTemplateHelper.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.PortableInterceptor; + +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.VM_ABSTRACT; +import org.omg.CORBA.ValueMember; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the CORBA object + * {@link ObjectReferenceTemplate}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectReferenceTemplateHelper +{ + /** + * Get the type code of the {@link ObjectReferenceTemplate}. + * + * @return value type type code, named ObjectReferenceTemplate, no members, + * abstract. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_value_tc(id(), "ObjectReferenceTemplate", + VM_ABSTRACT.value, null, + new ValueMember[0]); + } + + /** + * Insert the ObjectReferenceTemplate into the given Any. + * + * @param any the Any to insert into. + * @param that the ObjectReferenceTemplate to insert. + */ + public static void insert(Any any, ObjectReferenceTemplate that) + { + any.insert_Streamable(new ObjectReferenceTemplateHolder(that)); + } + + /** + * Extract the ObjectReferenceTemplate from given Any. + * + * @throws BAD_OPERATION if the passed Any does not + * contain ObjectReferenceTemplate. + */ + public static ObjectReferenceTemplate extract(Any any) + { + try + { + ObjectReferenceTemplateHolder h = + (ObjectReferenceTemplateHolder) any.extract_Streamable(); + return h.value; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = + new BAD_OPERATION("ObjectReferenceTemplate expected"); + bad.minor = Minor.Any; + bad.initCause(ex); + throw bad; + } + } + + /** + * Get the ObjectReferenceTemplate repository id. + * + * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplate:1.0", + * always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplate:1.0"; + } + + /** + * Read the object reference template (as the value type). + */ + public static ObjectReferenceTemplate read(InputStream input) + { + return (ObjectReferenceTemplate) + ((org.omg.CORBA_2_3.portable.InputStream) input).read_value(); + } + + /** + * Write the object reference template (as the value type). + */ + public static void write(OutputStream output, ObjectReferenceTemplate value) + { + ((org.omg.CORBA_2_3.portable.OutputStream) output). + write_value(value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java new file mode 100644 index 000000000..32b769eb6 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java @@ -0,0 +1,103 @@ +/* ObjectReferenceTemplateHolder.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.PortableInterceptor; + +import org.omg.CORBA.portable.Streamable; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + + /** + * A holder for the object {@link ObjectReferenceTemplate}. + * +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ObjectReferenceTemplateHolder + implements Streamable +{ + /** + * The stored ObjectReferenceTemplate value. + */ + public ObjectReferenceTemplate value; + + /** + * Create the unitialised instance, leaving the value field + * with default <code>null</code> value. + */ + public ObjectReferenceTemplateHolder() + { + } + + /** + * Create the initialised instance. + * @param initialValue the value that will be assigned to + * the <code>value</code> field. + */ + public ObjectReferenceTemplateHolder(ObjectReferenceTemplate 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 = ObjectReferenceTemplateHelper .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) + { + ObjectReferenceTemplateHelper .write(output, value); + } + + /** + * Get the typecode of the ObjectReferenceTemplate. + */ + public org.omg.CORBA.TypeCode _type() + { + return ObjectReferenceTemplateHelper .type(); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java new file mode 100644 index 000000000..c16638fdf --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java @@ -0,0 +1,160 @@ +/* ObjectReferenceTemplateSeqHelper.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.PortableInterceptor; + +import gnu.CORBA.Minor; +import gnu.CORBA.typecodes.GeneralTypeCode; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * Provides static helper methods for working with the array of object reference + * templates. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectReferenceTemplateSeqHelper +{ + /** + * Extract the <code>ObjectReferenceTemplate[]</code> from the given + * {@link Any}. This implementation expects the {@link Any} to hold the + * instance of {@link ObjectReferenceTemplateSeqHolder} that is returned by + * {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws BAD_OPERATION if the Any contains something other than the the + * {@link ObjectReferenceTemplateSeqHolder}. + */ + public static ObjectReferenceTemplate[] extract(Any a) + { + try + { + ObjectReferenceTemplateSeqHolder h = (ObjectReferenceTemplateSeqHolder) + a.extract_Streamable(); + return h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION( + "ObjectReferenceTemplate[] expected"); + bad.initCause(cex); + bad.minor = Minor.Any; + throw bad; + } + } + + /** + * Returns the object reference template sequence repository Id. + * + * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplateSeq:1.0", + * always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplateSeq:1.0"; + } + + /** + * Insert into the given <code>ObjectReferenceTemplate[]</code> into the + * given {@link Any}. This implementation first creates a + * {@link ObjectReferenceTemplateSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, ObjectReferenceTemplate[] that) + { + ObjectReferenceTemplateSeqHolder holder = + new ObjectReferenceTemplateSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>ObjectReferenceTemplate[]</code> from the CORBA input + * stream. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static ObjectReferenceTemplate[] read(InputStream input) + { + ObjectReferenceTemplate[] value = + new ObjectReferenceTemplate[input.read_long()]; + for (int i = 0; i < value.length; i++) + value[i] = ObjectReferenceTemplateHelper.read(input); + return value; + } + + /** + * Creates and returns a new instance of the TypeCode, corresponding the CORBA + * <code>ObjectReferenceTemplate[]</code>. The length of the sequence is + * left with the initial value 0. + */ + public static TypeCode type() + { + GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_sequence); + t.setId(id()); + t.setLength(0); + t.setContentType(ObjectReferenceTemplateHelper.type()); + return t; + } + + /** + * Writes the <code>ObjectReferenceTemplate[]</code> into the given stream. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, ObjectReferenceTemplate[] value) + { + output.write_long(value.length); + + for (int i = 0; i < value.length; i++) + ObjectReferenceTemplateHelper.write(output, value[i]); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java new file mode 100644 index 000000000..5f175d429 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java @@ -0,0 +1,104 @@ +/* ObjectReferenceTemplateSeqHolder.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.PortableInterceptor; + +import org.omg.CORBA.portable.Streamable; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A holder for the array of {@link ObjectReferenceTemplate}s. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ObjectReferenceTemplateSeqHolder + implements Streamable +{ + /** + * The stored ObjectReferenceTemplate value. + */ + public ObjectReferenceTemplate[] value; + + /** + * Create the unitialised instance, leaving the value field with default + * <code>null</code> value. + */ + public ObjectReferenceTemplateSeqHolder() + { + } + + /** + * Create the initialised instance. + * + * @param initialValue the value that will be assigned to the + * <code>value</code> field. + */ + public ObjectReferenceTemplateSeqHolder(ObjectReferenceTemplate[] 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 = ObjectReferenceTemplateSeqHelper.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) + { + ObjectReferenceTemplateSeqHelper.write(output, value); + } + + /** + * Get the typecode of the ObjectReferenceTemplate. + */ + public org.omg.CORBA.TypeCode _type() + { + return ObjectReferenceTemplateSeqHelper.type(); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/PolicyFactory.java b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactory.java new file mode 100644 index 000000000..dcb110185 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactory.java @@ -0,0 +1,57 @@ +/* PolicyFactory.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The {@link ORBInitializer} may register the PolicyFactory to create the + * service specific policies later. The factory will be later used by + * {@link org.omg.CORBA.ORB#create_policy}. + * + * @see org.omg.PortableInterceptor.ORBInitInfoOperations#register_policy_factory + * @see org.omg.CORBA.ORB#create_policy + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface PolicyFactory extends PolicyFactoryOperations, + org.omg.CORBA.Object, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/PolicyFactoryOperations.java b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactoryOperations.java new file mode 100644 index 000000000..49940e83d --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactoryOperations.java @@ -0,0 +1,69 @@ +/* PolicyFactoryOperations.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.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Policy; +import org.omg.CORBA.PolicyError; + +/** + * A service implementation can register policy factory during ORB initialization + * for creating the service-specific policies. This factory then will be + * invoked form {@link org.omg.CORBA.ORB#create_policy(int, Any)}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + * + * @see org.omg.CORBA.ORB#create_policy + * @see ORBInitInfoOperations#register_policy_factory + */ +public interface PolicyFactoryOperations +{ + /** + * Create and return the policy of the given type, having the given value. + * + * @param policy_type the type of the policy being created + * @param policy_value the value of the policy, wrapped in {@link Any}. + * Depending from the policy, the Any can hold various values, + * including complex data structures. + * + * @return the created policy. + */ + Policy create_policy(int policy_type, Any policy_value) + throws PolicyError; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/RequestInfo.java b/libjava/classpath/org/omg/PortableInterceptor/RequestInfo.java new file mode 100644 index 000000000..22f108a48 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/RequestInfo.java @@ -0,0 +1,55 @@ +/* RequestInfo.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Provides access to request information, available to the + * {@link ClientRequestInterceptor} or {@link ServerRequestInterceptor}. The + * additional operations, specific to the server and client are defined in the + * derived interfaces {@link ServerRequestInfo} and {@link ClientRequestInfo}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestInfo extends RequestInfoOperations, + org.omg.CORBA.Object, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/RequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/RequestInfoOperations.java new file mode 100644 index 000000000..851f46602 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/RequestInfoOperations.java @@ -0,0 +1,191 @@ +/* RequestInfoOperations.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.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.NO_RESOURCES; +import org.omg.CORBA.TypeCode; +import org.omg.Dynamic.Parameter; +import org.omg.IOP.ServiceContext; + +/** + * Defines operations that are applicable for both server and client request. + * The additional operations, specific to the server and client request are + * defined in the derived interfaces {@link ServerRequestInfoOperations} and + * {@link ClientRequestInfoOperations}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestInfoOperations +{ + /** + * Return the parameters of the operation being invoked. + * + * @return the array, containing parameters of the operations or an empty + * array for the operations with no parameters. + * + * @throws NO_RESOURCES if the parameters are not available. The parameters + * are only available for DII (via {@link org.omg.CORBA.Request} or DSI calls. + * They are not available for calls via IDL - generated stubs. + */ + Parameter[] arguments(); + + /** + * Returns the names of all contexts of the operation being invoked. + * + * @return the array of strings, defining contexts. + * + * @throws NO_RESOURCES if the contexts are not available. The contexts are + * only available for DII (via {@link org.omg.CORBA.Request} or DSI calls. + * They are not available for calls via IDL - generated stubs. + */ + String[] contexts(); + + /** + * Returns the typecodes, defining all exceptions that the operation may + * throw. + * + * @return the array of exception typecodes, empty array if the operation + * should not throw any exceptions. + * + * @throws NO_RESOURCES if the exception list is not available. This list is + * only available for DII (via {@link org.omg.CORBA.Request} or DSI calls and + * only on the client side. It is not available for calls via IDL - generated + * stubs or on the server side. + */ + TypeCode[] exceptions(); + + /** + * If the request contains forwarding information (the reply_status attribute + * being LOCATION_FORWARD), return the forwarding target. + * + * @return the object where the request should be forwarded. + */ + org.omg.CORBA.Object forward_reference(); + + /** + * Get the service context with the given ctx_name that is associated with the + * reply. + * + * @param ctx_name the name of the service context + * + * @return the copy of the corresponding context. + * + * @throws BAD_PARAM minor 26, if the context with the give ctx_name does not + * exist. + */ + ServiceContext get_reply_service_context(int ctx_name) + throws BAD_PARAM; + + /** + * Get the service context with the given ctx_name that is associated with the + * request. + * + * @param ctx_name the name of the service context + * + * @return the copy of the corresponding context. + * + * @throws BAD_PARAM minor 26, if the context with the give ctx_name does not + * exist. + */ + ServiceContext get_request_service_context(int ctx_name) + throws BAD_PARAM; + + /** + * Get the data from the given slot of the PortableInterceptor.Current that is + * in the scope of the request. + */ + Any get_slot(int id) throws InvalidSlot; + + /** + * Get the names of the service contexts being sent on the request. + * + * @return array of strings, naming the contexts. + */ + String[] operation_context(); + + /** + * Get the name of the operation being invoked. + * + * @return the name of the operation, usually the name of method being called. + */ + String operation(); + + /** + * Get the reoly state as result of the operation invocation. + * + * @return the value field of one of the following: {@link SUCCESSFUL}, + * {@link SYSTEM_EXCEPTION}, {@link USER_EXCEPTION}, + * {@link LOCATION_FORWARD} or {@link TRANSPORT_RETRY}. + */ + short reply_status(); + + /** + * Get the request id. + * + * @return an id that uniquely identifies the current request/reply sequence. + */ + int request_id(); + + /** + * Indicates whether request sender expected any response. + * + * @return true if the response was expected, false otherwise. + */ + boolean response_expected(); + + /** + * Get the result of the operation invocation. + * + * @return an Any, containing the value, returned by the performed operation. + */ + Any result(); + + /** + * Determines how far the request shall progress before control is returned to + * the client. However up till JDK 1.5 inclusive this method always returns + * SYNC_WITH_TRANSPORT. + * + * @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT#value} (1), always. + * + * @specnote as defined in the Suns 1.5 JDK API. + */ + short sync_scope(); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java b/libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java new file mode 100644 index 000000000..64ff72ab3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/SUCCESSFUL.java @@ -0,0 +1,54 @@ +/* SUCCESSFUL.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.PortableInterceptor; + + +/** + * A reply status flag, indicating, that the remote method + * has been called and returned without exception. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface SUCCESSFUL +{ + /** + * Specifies the SUCCESSFUL value, 0. + */ + short value = 0; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java b/libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java new file mode 100644 index 000000000..10f8dcea0 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/SYSTEM_EXCEPTION.java @@ -0,0 +1,55 @@ +/* SYSTEM_EXCEPTION.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.PortableInterceptor; + + +/** + * A reply status flag, indicating, that the + * {@link org.omg.CORBA.SystemException} + * has been thrown while calling or from inside the remote method. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface SYSTEM_EXCEPTION +{ + /** + * Specifies the SYSTEM_EXCEPTION value, 1. + */ + short value = 1; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java new file mode 100644 index 000000000..34240e81a --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java @@ -0,0 +1,119 @@ +/* ServerIdHelper.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.PortableInterceptor; + +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The Server Id is defined in OMG specification just as a narrow (not wide) + * string. As such, the Server Id needs no helper, but one is included in + * the API anyway. + * + * @since 1.5 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ServerIdHelper +{ + /** + * Insert the Server Id into Any (uses {@link Any#insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the Server Id from Any ((uses {@link Any#extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an alias typecode. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + return orb.create_alias_tc(id(), "ServerId", orb.create_string_tc(0)); + } + + /** + * Return the Server Id repository id. + * @return "IDL:omg.org/PortableInterceptor/ServerId:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ServerId:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param input the stream to read from. + */ + public static String read(InputStream input) + { + return input.read_string(); + } + + /** + * Calls {@link OutputStream#write_string(String)}. + * + * @param output the stream to write into. + * @param value the string (Server Id) value to write. + */ + public static void write(OutputStream output, String value) + { + output.write_string(value); + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfo.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfo.java new file mode 100644 index 000000000..9136ca7e0 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfo.java @@ -0,0 +1,54 @@ +/* ServerRequestInfo.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Provides request information, accessible for the + * {@link ServerRequestInterceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInfo extends ServerRequestInfoOperations, + org.omg.CORBA.Object, + IDLEntity, + RequestInfo +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java new file mode 100644 index 000000000..e03145e86 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java @@ -0,0 +1,327 @@ +/* ServerRequestInfoOperations.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.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_INV_ORDER; +import org.omg.CORBA.INV_POLICY; +import org.omg.CORBA.Policy; +import org.omg.IOP.ServiceContext; + +/** + * Provides request information, accessible for the + * {@link ClientRequestInterceptor}. Some methods of this interface are not + * valid at all interception points. The following table shows the validity of + * each method. If it is not valid, BAD_INV_ORDER minor 14 will be thrown. + * + * <table border="1"> + * <tr> + * <th></th> + * <th>{@link ServerRequestInterceptorOperations#receive_request_service_contexts receive_request_<br>service_contexts}</th> + * <th>{@link ServerRequestInterceptorOperations#receive_request receive_request}</th> + * <th>{@link ServerRequestInterceptorOperations#send_reply send_reply}</th> + * <th>{@link ServerRequestInterceptorOperations#send_exception send_exception}</th> + * <th>{@link ServerRequestInterceptorOperations#send_other send_other}</th> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"><i>Inherited from + * {@link RequestInfoOperations}:</i></td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#arguments arguments}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="#E0E0E0" title="in and inout only">yes<sub><a href="#1">1</a></sub></td> + * <td>yes</td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">no<sub><a + * href="#2">2</a></sub></td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">no<sub><a + * href="#2">2</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#exceptions exceptions}</th> + * <td bgcolor="lightgray">no </td> + * <td colspan="4" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#contexts contexts}</th> + * <td bgcolor="lightgray">no </td> + * <td colspan="4" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation_context operation_context}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#result result}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#reply_status reply_status}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align="center">yes</td> * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#forward_reference forward_reference}</th> + * <td bgcolor="lightgray" colspan="4" align="center">no</td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">yes<sub><a + * href="#2">2</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_request_service_context get_request_service_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align="center">yes</td> * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_reply_service_context get_reply_service_context}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#request_id request_id}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation operation}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#response_expected response_expected}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#sync_scope sync_scope}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_slot get_slot}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"> + * <i>ServerRequestInfo-specific:</i></td> + * </tr> + * <tr> + * <th>{@linkplain #get_server_policy get_server_policy}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #add_reply_service_context add_reply_service_context}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #set_slot set_slot}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #sending_exception sending_exception}</th> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain #object_id object_id}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td>yes</td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub></td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain #adapter_id adapter_id}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td>yes</td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub></td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain #target_most_derived_interface target_most_derived_interface}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * </tr> + * <tr> + * <th>{@linkplain #target_is_a target_is_a}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * </tr> + * <tr> + * <th></th> + * <th>{@link ServerRequestInterceptorOperations#receive_request_service_contexts receive_request_<br>service_contexts }</th> + * <th>{@link ServerRequestInterceptorOperations#receive_request receive_request}</th> + * <th>{@link ServerRequestInterceptorOperations#send_reply send_reply}</th> + * <th>{@link ServerRequestInterceptorOperations#send_exception send_exception}</th> + * <th>{@link ServerRequestInterceptorOperations#send_other send_other}</th> + * </tr> + * </table> + * <ol> + * <li><a name="1">When ServerRequestInfo is passed to receive_request, there + * is an entry in the list for every argument. But only the in and inout + * arguments will be available.</a></li> + * <li><a name="2">If the reply_status attribute is not LOCATION_FORWARD, + * accessing this attribute throws BAD_INV_ORDER minor code of 14.</a></li> + * <li><a name="3">If the servant locator caused a location forward, or thrown + * an exception, this attribute/operation may not be available (NO_RESOURCES + * with a standard minor code of 1 will be thrown).</a></li> + * </ol> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInfoOperations + extends RequestInfoOperations +{ + /** + * Allows the interceptor to add service contexts to the request. Such added + * contexts can carry arbitrary data and can be later accessed on the client + * side by the client request interceptor using + * {@link RequestInfoOperations#get_reply_service_context}. + * + * @param service_context the context to add. + * @param replace if true, the existing context with the same Id will be + * replaced. If false, the BAD_INV_ORDER will be thrown in that case. + * + * @throws BAD_INV_ORDER minor 15 if the context with the same Id already + * exists and replace=false. + */ + void add_reply_service_context(ServiceContext service_context, boolean replace); + + /** + * Get the identifier for the object adapter (POA). + */ + byte[] adapter_id(); + + /** + * Get the object_id describing the target of the operation invocation. + */ + byte[] object_id(); + + /** + * Return the policy of the given type that applies to this operation. This + * method should only be used with policies, produced by the registered + * {@link PolicyFactory}. + * + * @param type the type of the policy being requested. + * + * @return the policy that applies to this operation. + * + * @throws INV_POLICY minor 2 if no factory was registered to produce this + * type of policy or the policy is otherwise invalid. + */ + Policy get_server_policy(int type) + throws INV_POLICY; + + /** + * Get the exception to be returned to the client. If the returned Any cannot + * not support holding of that exception, it holds + * {@link org.omg.CORBA.UNKNOWN} minor 1 instead. + * + * @return an Any, holding exception that has been thrown and will be returned + * to client. + */ + Any sending_exception(); + + /** + * Allows the interceptor to set a slot in the PortableInterceptor.Current + * that is in the scope of the request. + * + * @param id the Id of the slot. + * @param data the value of the slot, replacing the previous value. + * + * @throws InvalidSlot if the slot with the given Id does not exist. + * + * @see RequestInfoOperations#get_slot(int) + * @see org.omg.PortableInterceptor#Current + */ + void set_slot(int id, Any data) + throws InvalidSlot; + + /** + * Checks if the servant is the given repository id. + * + * @param id the repository id to compare. + * + * @return true if the servant repository id matches the parameter, false + * otherwise. + */ + boolean target_is_a(String id); + + /** + * Get the most derived (most specific) repository Id of the servant. + * + * @return the repository id of the servant. + */ + String target_most_derived_interface(); + + /** + * Returns the name of the adapter that is handling the current request. + * The name is returned as a string array, representing full path from + * the root poa till the current poa, for instance + * {"RootPOA", "childPOA","grandchildPOA"}. + */ + public String[] adapter_name(); + + /** + * Returns the id of the ORB that is handling the current request. The ORB + * id can be specified as the property org.omg.CORBA.ORBid when creating + * the ORB. + */ + public String orb_id(); + + /** + * Returs the id of the server that is handling the current request. The server + * id is the same for all POAs and ORBs in the current virtual machine and + * can be set as the property org.omg.CORBA.ServerId when creating one of the + * ORBs. + */ + public String server_id(); +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptor.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptor.java new file mode 100644 index 000000000..db6c7a7d6 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptor.java @@ -0,0 +1,54 @@ +/* ServerRequestInterceptor.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.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * A server side request interceptor that is notified on various request + * processing steps on a server side. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInterceptor extends Interceptor, + ServerRequestInterceptorOperations, + org.omg.CORBA.Object, + IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptorOperations.java new file mode 100644 index 000000000..e6af9503d --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptorOperations.java @@ -0,0 +1,136 @@ +/* ServerRequestInterceptorOperations.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.PortableInterceptor; + +import org.omg.CORBA.SystemException; + + +/** + * Defines operations, applicable to the server side request interceptor. The + * operations are called by ORB at the appropriate interception points. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInterceptorOperations + extends InterceptorOperations +{ + /** + * ORB calls this method before invoking the servant manager. Operation + * parameters are not available at this point. The interceptor has possibility + * to forward the request by throwing {@link ForwardRequest}. + * + * @throws SystemException if it does, the receive_request_service_contexts is + * not called for the subsequent interceptors, calling + * send_exception instead. The completion status of such exception + * must be COMPLETED_NO. + * @throws ForwardRequest to forward the invocation to another target. The + * receive_request_service_contexts is not called for the subsequent + * interceptors, calling send_other instead. + */ + void receive_request_service_contexts(ServerRequestInfo info) + throws ForwardRequest; + + /** + * ORB calls this method after all the information, including operation + * parameters, are available. The interceptor has possibility to forward the + * request by throwing {@link ForwardRequest}. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the receive_request is not called for + * the subsequent interceptors, calling send_exception instead. The completion + * status of such exception must be COMPLETED_NO. + * + * @throws ForwardRequest to forward the invocation to another target. The + * receive_request is not called for the subsequent interceptors, calling + * send_other instead. + */ + void receive_request(ServerRequestInfo info) throws ForwardRequest; + + /** + * ORB calls this method after the target operation has been invoked and + * before the reply is returned to the client. This interception point shall + * execute in the same thread as the target invocation. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_reply is not called for the + * subsequent interceptors, calling send_exception instead. The completion + * status of such exception must be COMPLETED_YES. + */ + void send_reply(ServerRequestInfo info); + + /** + * ORB calls this method if the exception has been throw during the request + * processing. The interceptor has possibility to forward the request by + * throwing {@link ForwardRequest}. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException has the effect of changing the exception that + * successive interceptors receive on their calls to send_exception. If the + * original exception is a system exception, the completion_status of the new + * exception must match the exception being replaced. If the original + * exception is a user exception, then the completion_status of the new + * exception must be COMPLETED_YES. + * + * @throws ForwardRequest to forward the invocation to another target. The + * send_exception is not called for the subsequent interceptors, calling + * send_other instead. If the completion_status of the original exception is + * not a COMPLETED_NO, the ForwardRequest must not be raised. + */ + void send_exception(ServerRequestInfo info) throws ForwardRequest; + + /** + * ORB normally calls this method if the request has been forwarded. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_other is not called for the + * subsequent interceptors, calling send_exception instead. + * + * @throws ForwardRequest has the effect of changing the redirection that + * successive interceptors receive on their calls to send_other. + */ + void send_other(ServerRequestInfo info) throws ForwardRequest; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java b/libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java new file mode 100644 index 000000000..047ed20e9 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/TRANSPORT_RETRY.java @@ -0,0 +1,55 @@ +/* TRANSPORT_RETRY.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.PortableInterceptor; + + +/** + * A reply status, indicating the necessity of the transport retry. + * This may happen, for example, if the GIOP message status flag + * is equal to NEEDS_ADDRESSING_MODE. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface TRANSPORT_RETRY +{ + /** + * Specifies the TRANSPORT_RETRY value, 4. + */ + short value = 4; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java b/libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java new file mode 100644 index 000000000..44c3018a9 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/USER_EXCEPTION.java @@ -0,0 +1,55 @@ +/* USER_EXCEPTION.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.PortableInterceptor; + + +/** + * A reply status flag, indicating, that the + * {@link org.omg.CORBA.UserException} + * has been thrown from inside the remote method. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface USER_EXCEPTION +{ + /** + * Specifies the USER_EXCEPTION value, 2. + */ + short value = 2; +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java b/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java new file mode 100644 index 000000000..9e8fa0399 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java @@ -0,0 +1,272 @@ +/* _IORInterceptor_3_0Stub.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.PortableInterceptor; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; + +import java.io.Serializable; + +/** + * The IORInterceptor_3_0 stub (proxy), used on the client side. The + * {@link IORInterceptor_3_0} methods contain the code for remote invocaton. The + * stub is required by {@link IORInterceptor_3_0Helper} .read, .narrow and + * .unchecked_narrow methods. + * + * @specnote Being not specified in 1.5 API, this class is package private. + * From that happened to some other stubs, it will likely to appear in the 1.6 + * or later. Because of this, it is placed here. + * + * @specnote The stub and the helper support the existence of the interceptor + * on the remote side only. To support the corresponding support on the side + * where the ORB is registered with this interceptor, you also need + * _IORInfoStub, IORInfoHelper and either servants or implementation bases + * for both POA and IORInfo. These classes are not defined in the 1.5 API, + * hence they are not included. You may need to generate the manually from + * the IDL descriptions, available from + * http://www.omg.org/docs/formal/04-03-12.pdf. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +class _IORInterceptor_3_0Stub + extends ObjectImpl + implements IORInterceptor_3_0, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + + /** + * Create the IORInterceptor_3_0 stub. To get the stub working, you must later + * set the delegate with {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _IORInterceptor_3_0Stub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _IORInterceptor_3_0Stub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { IORInterceptor_3_0Helper.id() }; + } + + /** {@inheritDoc} */ + public void adapter_manager_state_changed(int adapterManagerId, + short adapterState) + { + InputStream input = null; + try + { + OutputStream output = _request("adapter_manager_state_changed", true); + output.write_long(adapterManagerId); + output.write_short(adapterState); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + adapter_manager_state_changed(adapterManagerId, adapterState); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void adapter_state_changed(ObjectReferenceTemplate[] adapters, + short adaptersState) + { + InputStream input = null; + try + { + OutputStream output = _request("adapter_state_changed", true); + output.write_long(adapters.length); + for (int i0 = 0; i0 < adapters.length; i0++) + ObjectReferenceTemplateHelper.write(output, adapters[i0]); + output.write_short(adaptersState); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + adapter_state_changed(adapters, adaptersState); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void components_established(IORInfo info) + { + InputStream input = null; + try + { + OutputStream output = _request("components_established", true); + output.write_Object(info); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + components_established(info); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void establish_components(IORInfo info) + { + InputStream input = null; + try + { + OutputStream output = _request("establish_components", true); + output.write_Object(info); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + establish_components(info); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public String name() + { + InputStream input = null; + try + { + OutputStream output = _request("name", true); + input = _invoke(output); + String returns = input.read_string(); + + return returns; + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + return name(); + } + finally + { + _releaseReply(input); + } + } + + /** {@inheritDoc} */ + public void destroy() + { + InputStream input = null; + try + { + OutputStream output = _request("destroy", true); + input = _invoke(output); + + } + catch (ApplicationException ex) + { + input = ex.getInputStream(); + String id = ex.getId(); + throw new MARSHAL(id); + } + catch (RemarshalException remarsh) + { + destroy(); + } + finally + { + _releaseReply(input); + } + } +} diff --git a/libjava/classpath/org/omg/PortableInterceptor/package.html b/libjava/classpath/org/omg/PortableInterceptor/package.html new file mode 100644 index 000000000..b29c84fbf --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/package.html @@ -0,0 +1,58 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.PortableInterceptor</title></head> + +<body> +Interceptors are hooks than can monitor various stages of the CORBA request +processing. The {@link org.omg.PortableInterceptor.IORInterceptor} monitors +all new object refereces (IORs) being created and can add to them additional +information. The {@link org.omg.PortableInterceptor.ClientRequestInterceptor} +monitors request handling on the client side and the +{@link org.omg.PortableInterceptor.ServerRequestInterceptor} monitors request +handling on the server side. The client and server request interceptors can +add additional data to the CORBA message that is accessible on remote side +after the message is transmitted. They can also forward request to another +target. All interceptor functions also work for the local invocations. The +interceptors are registered in ORB.init(...) using +{@link org.omg.PortableInterceptor.ORBInitializer}. + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> diff --git a/libjava/classpath/org/omg/PortableServer/AdapterActivator.java b/libjava/classpath/org/omg/PortableServer/AdapterActivator.java new file mode 100644 index 000000000..278f39207 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/AdapterActivator.java @@ -0,0 +1,62 @@ +/* AdapterActivator.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.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Adapter activators are associated with POAs and supply the + * the ability to create child POAs on demand. The new POA can be created + * <ul> + * <li>As a side-effect of receiving a request that names the child POA + * (or one of its children).</li> + * <li>When calling + * {@link POAOperations}.find_POA(name, true) if the parameter + * <code>name</code> refers a non existing POA. + * </li></ul> + * An AdapterActivator is always a local object. + * + * @see AdapterActivatorOperations#unknown_adapter + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface AdapterActivator + extends AdapterActivatorOperations, IDLEntity, org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/AdapterActivatorOperations.java b/libjava/classpath/org/omg/PortableServer/AdapterActivatorOperations.java new file mode 100644 index 000000000..f2065252d --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/AdapterActivatorOperations.java @@ -0,0 +1,68 @@ +/* AdapterActivatorOperations.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.PortableServer; + +import org.omg.CORBA.OBJECT_NOT_EXIST; + + +/** + * Defines the operations, applicable to the AdapterActivator. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface AdapterActivatorOperations +{ + /** + * This method is invoked when the ORB receives a request for an object + * reference that identifies a non-existing target POA, to create it. + * The ORB invokes this operation once for each POA that must be created + * in order for the target POA to exist. The process remebers creating a + * nested folder structure, starting from the ancestor POA closest to the + * root POA. The operation is invoked on the adapter activator of + * POA that is the parent of the POA that needs to be created. + * + * @param parent the parent POA, for that the child POA must be created. + * @param child_name the name of the child POA that must be created. + * + * @return true if the operation has successfully created the needed POA, + * false that POA cannot be created. In this case, the client will receive + * the remote exception ({@link OBJECT_NOT_EXIST}, minor code 2). + */ + boolean unknown_adapter(POA parent, String child_name); +} diff --git a/libjava/classpath/org/omg/PortableServer/Current.java b/libjava/classpath/org/omg/PortableServer/Current.java new file mode 100644 index 000000000..7bce10e04 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/Current.java @@ -0,0 +1,63 @@ +/* Current.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.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p>Provides the Id of the object currently being served and POA + * to that this object is connected. Both Id and POA can be + * simpler obtained from the servant by {@link Servant#_object_id() } + * and {@link Servant#_poa()} that use POA Current indirectly. + * The operations on Current for obtaining + * these data are defined in {@link CurrentOperations}. + * </p><p> + * As long as the ORB reference is still available, the current information + * is available via {@link Current} that is returned by + * ORB.resolve_initial_references("POACurrent"). To support this call, + * the ORB maintains the thread to invocation data map for all calls that + * are currently being processed. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Current + extends CurrentOperations, org.omg.CORBA.Current, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/CurrentHelper.java b/libjava/classpath/org/omg/PortableServer/CurrentHelper.java new file mode 100644 index 000000000..a81e839d0 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/CurrentHelper.java @@ -0,0 +1,144 @@ +/* CurrentHelper.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.PortableServer; + +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.NO_IMPLEMENT; +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 Current}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class CurrentHelper +{ + /** + * Get the type code of the POA Current. + * + * @return a type code of the object with POA Current id, named "Current". + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "Current"); + } + + /** + * Insert the POA Current into the given Any. + * + * @param any the Any to insert into. + * @param that the POA Current to insert. + */ + public static void insert(Any any, Current that) + { + any.insert_Object(that); + } + + /** + * Extract the POA Current from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain a POA Current. + */ + public static Current extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the POA Current repository id. + * + * @return "IDL:omg.org/PortableServer/Current:2.3", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/Current:2.3"; + } + + /** + * Cast the passed object into the POA Current. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a Current. + */ + public static Current narrow(org.omg.CORBA.Object obj) + { + try + { + return (Current) obj; + } + catch (ClassCastException ex) + { + BAD_PARAM bad = new BAD_PARAM("Not a POA Current"); + bad.initCause(ex); + throw bad; + } + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.4 inclusive. + * + * @throws NO_IMPLEMENT always. + */ + public static Current read(InputStream input) + { + throw new NO_IMPLEMENT(); + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.4 inclusive. + * + * @throws NO_IMPLEMENT always. + */ + public static void write(OutputStream output, Current value) + { + throw new NO_IMPLEMENT(); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/CurrentOperations.java b/libjava/classpath/org/omg/PortableServer/CurrentOperations.java new file mode 100644 index 000000000..58bc3141d --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/CurrentOperations.java @@ -0,0 +1,81 @@ +/* CurrentOperations.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.PortableServer; + +import org.omg.PortableServer.CurrentPackage.NoContext; + +/** + * Provides the Id of the object currently being served and POA + * to that this object is connected. Both Id and POA can be much + * simpler obtained from the servant by {@link Servant#_object_id() } + * and {@link Servant#_poa()} that use the CurrentOperations indirectly. + * + * As long as the ORB reference is still available, the current information + * is available via {@link Current} that is returned by + * ORB.resolve_initial_references("POACurrent"). To support this call, + * the ORB maintains the thread to invocation data map for all calls that + * are currently being processed. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CurrentOperations + extends org.omg.CORBA.CurrentOperations +{ + /** + * Returns the Id of the object currently being served. The returned + * value is also correct if the calling code is running is several + * paralled threads. + * + * @return the Id of the object that is currently being served by this + * thread. + */ + byte[] get_object_id() + throws NoContext; + + /** + * Returns POA to that the object currently being served is connected. + * The returned value is also correct if the calling code is running is several + * paralled threads. + * + * @return the Id of the object that is currently being served by this + * thread. + */ + POA get_POA() + throws NoContext; +} diff --git a/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContext.java b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContext.java new file mode 100644 index 000000000..9d42174bf --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContext.java @@ -0,0 +1,82 @@ +/* NoContext.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.PortableServer.CurrentPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* This exception may be thrown by methods in +* {@link org.omg.PortableServer.CurrentOperations} +* if they are invoked outside the context of a POA-dispatched operation. +* +* @see org.omg.PortableServer.CurrentOperations#get_POA() +* @see org.omg.PortableServer.CurrentOperations#get_object_id() +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public final class NoContext + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 4345975812295650198L; + + /** + * Create NoContext with no explaining message and all fields initialised to + * default values. + */ + public NoContext() + { + } + + /** + * Create the NoContext with explaining message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public NoContext(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java new file mode 100644 index 000000000..2aa9268ae --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java @@ -0,0 +1,143 @@ +/* NoContextHelper.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.PortableServer.CurrentPackage; + +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 NoContext}. +* +* @author Audrius Meskauskas, Lithiania (AudriusA@Bioinformatics.org) +*/ +public abstract class NoContextHelper +{ + /** + * Create the NoContext typecode (structure, named "NoContext"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[0]; + return orb.create_exception_tc(id(), "NoContext", members); + } + + /* + * Every user exception with no user defined fields can use + * EmptyExceptionHolder + */ + + /** + * Insert the NoContext into the given Any. + * + * @param any the Any to insert into. + * @param that the NoContext to insert. + */ + public static void insert(Any any, NoContext that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the NoContext from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain NoContext. + */ + public static NoContext extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (NoContext) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NoContext expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the NoContext repository id. + * + * @return "IDL:omg.org/PortableServer/Current/NoContext:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/Current/NoContext:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static NoContext read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + NoContext value = new NoContext(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, NoContext value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/DynamicImplementation.java b/libjava/classpath/org/omg/PortableServer/DynamicImplementation.java new file mode 100644 index 000000000..f43fbf921 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/DynamicImplementation.java @@ -0,0 +1,58 @@ +/* DynamicImplementation.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.PortableServer; + +import org.omg.CORBA.ServerRequest; + +/** + * This class is used for servants that support calling via server request. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynamicImplementation + extends Servant +{ + /** + * Handle the invocation via passed request. + * + * @param request the data structure, used both to pass parameters + * and return results of the invocation. + */ + public abstract void invoke(ServerRequest request); +} diff --git a/libjava/classpath/org/omg/PortableServer/ForwardRequest.java b/libjava/classpath/org/omg/PortableServer/ForwardRequest.java new file mode 100644 index 000000000..c9d20b345 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ForwardRequest.java @@ -0,0 +1,108 @@ +/* ForwardRequest.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 +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.PortableServer; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * <p> + * This exception is raised by {@link ServantManager} to indicate that the + * invocation target has moved to another known location. In this case, + * the client will receive a redirection (LOCATION_FORWARD) message and should + * resend the request to the new target. The exception contains the object + * reference, indicating the new location. + * </p><p> + * The exception can be thrown both by servant locators and servant activators. + * If the exception is raised anywhere else than in the ServantManager + * methods, it is handled as an ordinary user excepton. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public final class ForwardRequest + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -4159318367582473975L; + + /** + * The object reference, indicating the new location of the invocation target. + */ + public org.omg.CORBA.Object forward_reference; + + /** + * Create ForwardRequest with no explaining message and stating the + * new location is <code>null</code>. + */ + public ForwardRequest() + { + } + + /** + * Create the ForwardRequest with explaining message and + * initialising the object reference to the given value. + * + * @param why a string, explaining, why this exception has been thrown. + * @param a_forward_reference a value for forward_reference. + */ + public ForwardRequest(String why, org.omg.CORBA.Object a_forward_reference) + { + super(why); + this.forward_reference = a_forward_reference; + } + + /** + * Create the ForwardRequest without explaining + * message and initialising the object reference to the given value. + * + * @param a_forward_reference a value for forward_reference. + */ + public ForwardRequest(org.omg.CORBA.Object a_forward_reference) + { + this.forward_reference = a_forward_reference; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java new file mode 100644 index 000000000..83e5707c6 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java @@ -0,0 +1,154 @@ +/* ForwardRequestHelper.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.PortableServer; + +import gnu.CORBA.Minor; +import gnu.CORBA.ObjectCreator; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.Poa.ForwardRequestHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the exception {@link ForwardRequest}. + * + * @specnote The helper must be here and not in POA subpackage as it must + * be discovered by the {@link ObjectCreator} when reading this remote + * exception. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ForwardRequestHelper +{ + /** + * Extract the ForwardRequest from given Any. + * This method uses the ForwardRequestHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain ForwardRequest. + */ + public static ForwardRequest extract(Any any) + { + try + { + return ((ForwardRequestHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ForwardRequest repository id. + * + * @return "ForwardRequest", always. + */ + public static String id() + { + return "ForwardRequest"; + } + + /** + * Insert the ForwardRequest into the given Any. + * This method uses the ForwardRequestHolder. + * + * @param any the Any to insert into. + * @param that the ForwardRequest to insert. + */ + public static void insert(Any any, ForwardRequest that) + { + any.insert_Streamable(new ForwardRequestHolder(that)); + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ForwardRequest read(InputStream input) + { + // Read the exception repository id. + input.read_string(); + ForwardRequest value = new ForwardRequest(); + + value.forward_reference = input.read_Object(); + return value; + } + + /** + * Create the ForwardRequest typecode (structure, + * named "ForwardRequest"). + * The typecode states that the structure contains the + * following fields: forward_reference. + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 1 ]; + + TypeCode field; + + field = ObjectHelper.type(); + members [ 0 ] = new StructMember("forward_reference", field, null); + return orb.create_exception_tc(id(), "ForwardRequest", members); + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, ForwardRequest value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_Object(value.forward_reference); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ID_ASSIGNMENT_POLICY_ID.java b/libjava/classpath/org/omg/PortableServer/ID_ASSIGNMENT_POLICY_ID.java new file mode 100644 index 000000000..f70660d76 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ID_ASSIGNMENT_POLICY_ID.java @@ -0,0 +1,53 @@ +/* ID_ASSIGNMENT_POLICY_ID.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.PortableServer; + + +/** +* Holds an integer {@link IdAssignmentPolicy } identifier. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public interface ID_ASSIGNMENT_POLICY_ID +{ + /** + * Specifies the ID_ASSIGNMENT_POLICY_ID value, 19. + */ + int value = 19; +} diff --git a/libjava/classpath/org/omg/PortableServer/ID_UNIQUENESS_POLICY_ID.java b/libjava/classpath/org/omg/PortableServer/ID_UNIQUENESS_POLICY_ID.java new file mode 100644 index 000000000..f69defcaa --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ID_UNIQUENESS_POLICY_ID.java @@ -0,0 +1,53 @@ +/* ID_UNIQUENESS_POLICY_ID.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.PortableServer; + + +/** +* Holds an integer {@link IdUniquenessPolicy} identifier. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public interface ID_UNIQUENESS_POLICY_ID +{ + /** + * Specifies the ID_UNIQUENESS_POLICY_ID value, 18. + */ + int value = 18; +} diff --git a/libjava/classpath/org/omg/PortableServer/IMPLICIT_ACTIVATION_POLICY_ID.java b/libjava/classpath/org/omg/PortableServer/IMPLICIT_ACTIVATION_POLICY_ID.java new file mode 100644 index 000000000..c76e1801c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IMPLICIT_ACTIVATION_POLICY_ID.java @@ -0,0 +1,53 @@ +/* IMPLICIT_ACTIVATION_POLICY_ID.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.PortableServer; + + +/** +* Holds an integer {@link ImplicitActivationPolicy} identifier. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public interface IMPLICIT_ACTIVATION_POLICY_ID +{ + /** + * Specifies the IMPLICIT_ACTIVATION_POLICY_ID value, 20. + */ + int value = 20; +} diff --git a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicy.java b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicy.java new file mode 100644 index 000000000..15ccf4f6e --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicy.java @@ -0,0 +1,58 @@ +/* IdAssignmentPolicy.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.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the Object Id assignment policy. + * + * The policy can return its current value, as defined. + * in {@link IdAssignmentPolicyOperations}. + * + * @see IdAssignmentPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdAssignmentPolicy + extends Policy, IdAssignmentPolicyOperations, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyOperations.java new file mode 100644 index 000000000..88c39d73d --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyOperations.java @@ -0,0 +1,55 @@ +/* IdAssignmentPolicyOperations.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.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the IdAssignmentPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdAssignmentPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + IdAssignmentPolicyValue value(); +} diff --git a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java new file mode 100644 index 000000000..9e52b9889 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java @@ -0,0 +1,158 @@ +/* IdAssignmentPolicyValue.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.PortableServer; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* Specifies the Object Id assignment policy. +* <ul> +* <li>USER_ID Objects created with that POA obtain they Object Ids from the +* application. +* </li> +* <li>SYSTEM_ID Objects created with that POA obtain they Object Ids from POA. +* If the POA also has the PERSISTENT policy, these Object Ids must be +* unique across all instantiations of the same POA. +* </li> +* </ul> +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public class IdAssignmentPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (V1.4) for interoperability. + */ + private static final long serialVersionUID = 2024380631469554382L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (USER_ID). + */ + public static final int _USER_ID = 0; + + /** + * An instance of IdAssignmentPolicyValue, initialized to USER_ID. + */ + public static final IdAssignmentPolicyValue USER_ID = + new IdAssignmentPolicyValue(_USER_ID); + + /** + * The possible value of this enumeration (SYSTEM_ID),. + */ + public static final int _SYSTEM_ID = 1; + + /** + * An instance of IdAssignmentPolicyValue, initialized to SYSTEM_ID, + * indicating, that the objects created with that POA obtain they + * Object Ids from POA. + */ + public static final IdAssignmentPolicyValue SYSTEM_ID = + new IdAssignmentPolicyValue(_SYSTEM_ID); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final IdAssignmentPolicyValue[] enume = + new IdAssignmentPolicyValue[] { USER_ID, SYSTEM_ID }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "USER_ID", "SYSTEM_ID" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected IdAssignmentPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the IdAssignmentPolicyValue, matching the given integer constant. + * + * @param code one of _USER_ID, _SYSTEM_ID. + * @return one of USER_ID, SYSTEM_ID. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static IdAssignmentPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); + bad.minor = Minor.PolicyType; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the policy value. + * @return _USER_ID or _SYSTEM_ID. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicy.java b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicy.java new file mode 100644 index 000000000..ba2894c7c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicy.java @@ -0,0 +1,57 @@ +/* IdUniquenessPolicy.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.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specfies the Id uniqueness policy. + * + * The policy can return its current value, as defined. + * in {@link IdUniquenessPolicyOperations}. + * + * @see IdUniquenessPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdUniquenessPolicy + extends Policy, IdUniquenessPolicyOperations, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyOperations.java new file mode 100644 index 000000000..1295f88f3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyOperations.java @@ -0,0 +1,55 @@ +/* IdUniquenessPolicyOperations.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.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the IdUniquenessPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdUniquenessPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + IdUniquenessPolicyValue value(); +} diff --git a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java new file mode 100644 index 000000000..848671d1d --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java @@ -0,0 +1,158 @@ +/* IdUniquenessPolicyValue.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.PortableServer; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* Specifies the Object Id uniqueness policy. +* +* This enumeration can obtain the following values: +* <ul> +* <li>UNIQUE_ID a servant activated with that POA supports exactly one Object Id. +* </li> +* <li>MULTIPLE_ID a servant activated with that POA supports +* multiple Object Ids. +* </li> +* </ul> +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public class IdUniquenessPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (V1.4) for interoperability. + */ + private static final long serialVersionUID = 2698951826884611346L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (UNIQUE_ID). + */ + public static final int _UNIQUE_ID = 0; + + /** + * Indicates that a servant activated with that POA, supports one and only + * one OBject Id. + */ + public static final IdUniquenessPolicyValue UNIQUE_ID = + new IdUniquenessPolicyValue(_UNIQUE_ID); + + /** + * The possible value of this enumeration (MULTIPLE_ID). + */ + public static final int _MULTIPLE_ID = 1; + + /** + * Indicates that a servant activated with that POA is able to support the + * multiple Object Ids. + */ + public static final IdUniquenessPolicyValue MULTIPLE_ID = + new IdUniquenessPolicyValue(_MULTIPLE_ID); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final IdUniquenessPolicyValue[] enume = + new IdUniquenessPolicyValue[] { UNIQUE_ID, MULTIPLE_ID }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "UNIQUE_ID", "MULTIPLE_ID" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected IdUniquenessPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the IdUniquenessPolicyValue, matching the given integer constant. + * + * @param code one of _UNIQUE_ID, _MULTIPLE_ID. + * @return one of UNIQUE_ID, MULTIPLE_ID. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static IdUniquenessPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); + bad.minor = Minor.PolicyType; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the policy value. + * @return _UNIQUE_ID or _MULTIPLE_ID. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicy.java b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicy.java new file mode 100644 index 000000000..786e5fa72 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicy.java @@ -0,0 +1,57 @@ +/* ImplicitActivationPolicy.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.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the implicit activation policy. + * + * The policy can return its current value, as defined. + * in {@link ImplicitActivationPolicyOperations}. + * + * @see ImplicitActivationPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ImplicitActivationPolicy + extends Policy, ImplicitActivationPolicyOperations, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyOperations.java new file mode 100644 index 000000000..9b6136a1c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyOperations.java @@ -0,0 +1,55 @@ +/* ImplicitActivationPolicyOperations.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.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the ImplicitActivationPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ImplicitActivationPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + ImplicitActivationPolicyValue value(); +} diff --git a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java new file mode 100644 index 000000000..3e4049bb3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java @@ -0,0 +1,158 @@ +/* ImplicitActivationPolicyValue.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.PortableServer; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* Specifies the implicit activation policy. +* +* This enumeration can obtain the following values: +* <ul> +* <li>IMPLICIT_ACTIVATION The POA supports implicit activation of servants. +* ({@link IdAssignmentPolicyValue#SYSTEM_ID} and +* {@link ServantRetentionPolicyValue#RETAIN} policies required).</li> +* <li>NO_IMPLICIT_ACTIVATION The POA does not support implicit activation.</li> +* </ul> +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public class ImplicitActivationPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (V1.4) for interoperability. + */ + private static final long serialVersionUID = 3826572456602949295L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (IMPLICIT_ACTIVATION). + */ + public static final int _IMPLICIT_ACTIVATION = 0; + + /** + * An instance of ImplicitActivationPolicyValue, initialized to IMPLICIT_ACTIVATION. + */ + public static final ImplicitActivationPolicyValue IMPLICIT_ACTIVATION = + new ImplicitActivationPolicyValue(_IMPLICIT_ACTIVATION); + + /** + * The possible value of this enumeration (NO_IMPLICIT_ACTIVATION). + */ + public static final int _NO_IMPLICIT_ACTIVATION = 1; + + /** + * An instance of ImplicitActivationPolicyValue, initialized to NO_IMPLICIT_ACTIVATION. + */ + public static final ImplicitActivationPolicyValue NO_IMPLICIT_ACTIVATION = + new ImplicitActivationPolicyValue(_NO_IMPLICIT_ACTIVATION); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final ImplicitActivationPolicyValue[] enume = + new ImplicitActivationPolicyValue[] + { + IMPLICIT_ACTIVATION, NO_IMPLICIT_ACTIVATION + }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "IMPLICIT_ACTIVATION", "NO_IMPLICIT_ACTIVATION" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected ImplicitActivationPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the ImplicitActivationPolicyValue, matching the given integer constant. + * + * @param code one of _IMPLICIT_ACTIVATION, _NO_IMPLICIT_ACTIVATION. + * @return one of IMPLICIT_ACTIVATION, NO_IMPLICIT_ACTIVATION. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static ImplicitActivationPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); + bad.minor = Minor.PolicyType; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the policy value. + * @return _IMPLICIT_ACTIVATION or _NO_IMPLICIT_ACTIVATION. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/LIFESPAN_POLICY_ID.java b/libjava/classpath/org/omg/PortableServer/LIFESPAN_POLICY_ID.java new file mode 100644 index 000000000..87b93af02 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/LIFESPAN_POLICY_ID.java @@ -0,0 +1,52 @@ +/* LIFESPAN_POLICY_ID.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.PortableServer; + + /** + * Holds an integer {@link LifespanPolicy} identifier. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface LIFESPAN_POLICY_ID +{ + /** + * Specifies the LIFESPAN_POLICY_ID value, 17. + */ + int value = 17; +} diff --git a/libjava/classpath/org/omg/PortableServer/LifespanPolicy.java b/libjava/classpath/org/omg/PortableServer/LifespanPolicy.java new file mode 100644 index 000000000..2b96bf185 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/LifespanPolicy.java @@ -0,0 +1,58 @@ +/* LifespanPolicy.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.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the object life span policy, if they can outlive the POA + * with that they were first created. + * + * The policy can return its current value, as defined. + * in {@link LifespanPolicyOperations}. + * + * @see LifespanPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface LifespanPolicy + extends Policy, LifespanPolicyOperations, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/LifespanPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/LifespanPolicyOperations.java new file mode 100644 index 000000000..5eac1599e --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/LifespanPolicyOperations.java @@ -0,0 +1,55 @@ +/* LifespanPolicyOperations.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.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the LifespanPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface LifespanPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + LifespanPolicyValue value(); +} diff --git a/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java b/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java new file mode 100644 index 000000000..2be37fb37 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java @@ -0,0 +1,155 @@ +/* LifespanPolicyValue.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.PortableServer; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* Specifies the object life span policy. +* +* This enumeration can obtain the following values: +* <ul> +* <li>TRANSIENT The objects implemented in the POA never outlive +* the POA instance in which they are first created.</li> +* <li>PERSISTENT The mentioned objects can outlive the process in +* which they are first created.</li> +* </ul> +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public class LifespanPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (V1.4) for interoperability. + */ + private static final long serialVersionUID = 6604562925399671611L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (TRANSIENT). + */ + public static final int _TRANSIENT = 0; + + /** + * An instance of LifespanPolicyValue, initialized to TRANSIENT. + */ + public static final LifespanPolicyValue TRANSIENT = + new LifespanPolicyValue(_TRANSIENT); + + /** + * The possible value of this enumeration (PERSISTENT). + */ + public static final int _PERSISTENT = 1; + + /** + * An instance of LifespanPolicyValue, initialized to PERSISTENT. + */ + public static final LifespanPolicyValue PERSISTENT = + new LifespanPolicyValue(_PERSISTENT); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final LifespanPolicyValue[] enume = + new LifespanPolicyValue[] { TRANSIENT, PERSISTENT }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "TRANSIENT", "PERSISTENT" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected LifespanPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the LifespanPolicyValue, matching the given integer constant. + * + * @param code one of _TRANSIENT, _PERSISTENT. + * @return one of TRANSIENT, PERSISTENT. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static LifespanPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); + bad.minor = Minor.PolicyType; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the policy value. + * @return _TRANSIENT or _PERSISTENT. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POA.java b/libjava/classpath/org/omg/PortableServer/POA.java new file mode 100644 index 000000000..cddeac63f --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POA.java @@ -0,0 +1,66 @@ +/* POA.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.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The Portable Object Adapter (POA) provides more control on the request + * processing than it is possible when connecting objects directly to the + * ORB. For details, see the general description of the + * <code>org.omg.PortableServer</code> package. + * </p><p> + * The operations, supported by POA are defined + * separately in {@link POAOperations}. In the simpliest case, the servant + * implementation is connected to POA by + * {@link POAOperations#servant_to_reference}, the returned object being a + * target of remote and local invocations, despite the numerous other + * strategies are possible. + * </p> + * + * @see org.omg.CORBA.ORB#resolve_initial_references + * @see POAOperations#servant_to_reference + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POA + extends POAOperations, IDLEntity, org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/POAHelper.java b/libjava/classpath/org/omg/PortableServer/POAHelper.java new file mode 100644 index 000000000..6eb5ab542 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAHelper.java @@ -0,0 +1,154 @@ +/* POAHelper.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.PortableServer; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the CORBA object {@link POA}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class POAHelper +{ + /** + * Cast the passed object into the POA. As POA is a local object, the method + * just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a POA. + */ + public static POA narrow(org.omg.CORBA.Object obj) + { + try + { + return (POA) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a POA"); + } + } + + /** + * Get the type code of the {@link POA}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "POA"); + } + + /** + * Insert the POA into the given Any. + * + * @param any the Any to insert into. + * + * @param that the POA to insert. + */ + public static void insert(Any any, POA that) + { + any.insert_Object(that); + } + + /** + * Extract the POA from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain POA. + */ + public static POA extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the POA repository id. + * + * @return "IDL:omg.org/PortableServer/POA:2.3", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA:2.3"; + } + + /** + * This should read POA from the CDR input stream, but, following the specs, + * it doesnot. The jdk 1.5 API specification defines that POA cannot be + * exported. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL, always. + */ + public static POA read(InputStream input) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } + + /** + * This should read POA from the CDR input stream, but, following the specs, + * it doesnot. The jdk 1.5 API specification defines that POA cannot be + * exported. + * + * @param output a org.omg.CORBA.portable stream to write into. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL, always. + */ + public static void write(OutputStream output, POA value) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAManager.java b/libjava/classpath/org/omg/PortableServer/POAManager.java new file mode 100644 index 000000000..72aa22f9d --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManager.java @@ -0,0 +1,63 @@ +/* POAManager.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.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * A POA manager is associated with one or more POAs and provides means + * to regulate they activity. Using manage, it is possible to force + * requests for those POAs to be queued or discarded or have those POAs + * deactivated. The manager can turn POAs to and from holding, + * active and discarding states, but the incative state is irreversible. + * </p> + * <p> + * The manager of the ORBs root POA can be obtained by resolving initial + * reference "RootPOAManager". + * </p> + * + * @see POAManagerOperations + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POAManager + extends POAManagerOperations, IDLEntity, org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerOperations.java b/libjava/classpath/org/omg/PortableServer/POAManagerOperations.java new file mode 100644 index 000000000..251bbe4b1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManagerOperations.java @@ -0,0 +1,141 @@ +/* POAManagerOperations.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.PortableServer; + +import org.omg.PortableServer.POAManagerPackage.AdapterInactive; +import org.omg.PortableServer.POAManagerPackage.State; + +/** + * Defines the operations, applicable to the {@link POAManager}. + * These operations can turn the associated POAs to and from holding, + * active and discarding states, but the incative state is irreversible. + * The inactivated POAs can only be recreated after they were destroyed. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POAManagerOperations +{ + /** + * Turns the associated POAs into active state, allowing them to receive + * and process requests. + * + * @throws AdapterInactive if the POAs are in the inactive state. If + * once inactivated, the POA cannot be activated again. + * This method can only be called to leave the holding or discarding state. + */ + void activate() + throws AdapterInactive; + + /** + * <p> + * Turns the asociated POAs into inactive state. The POAs in the incative + * state will reject new requests. A cliet, trying to invoke an + * object, belonging to the inactivated POA, will receive the remote exception + * ({@link org.omg.CORBA.OBJ_ADAPTER}, minor code 0x535503ea, incomplete). + * </p><p> + * If the POA is once inactivated, it cannot be activated again. + * The operation is used when the associated POAs are to be shut down. + * </p> + * <p> + * Some independent implementations may set the minor code of the + * OBJ_ADAPTER to 1, as recommended by OMG (formal/04-03-12). + * The interoperable systems should expect any of these two values. + * </p> + * + * @param etherealize_objects if true, the servant managers of the + * associated POAs, having RETAIN and USE_SERVANT_MANAGER policies, + * will receive a call of {@link ServantActivatorOperations#etherealize}. + * + * @param wait_for_completion if true, the method call suspends the current + * thread till POAs complete the requests they are currently processing. If + * false, the method returns immediately. + * <p> + * + * @specnote The 0x535503ea is a Sun specific minor exception code 1002, + * used for interoperability reasons. + * + * @throws AdapterInactive if the POAs are already in the inactive state. + * + * @see POAOperations#destroy + */ + void deactivate(boolean etherealize_objects, boolean wait_for_completion) + throws AdapterInactive; + + /** + * <p> + * Turns the associated POAs into discaring state. In this state, the POAs + * discard the incoming requests. This mode is used in situations when + * the server is flooded with requests. The client receives remote exception + * ({@link org.omg.CORBA.TRANSIENT}, minor code 0x535503e9, incomplete). + * </p><p> + * Some independent implementations may set the minor code of the + * TRANSIENT to 1, as recommended by OMG (formal/04-03-12). + * The interoperable systems should expect any of these two values. + * </p> + * + * @param wait_for_completion if true, the method call suspends the current + * thread till POAs complete the requests they are currently processing. If + * false, the method returns immediately. + * + * @specnote The 0x535503e9 is a Sun specific minor exception code 1001, + * used for interoperability reasons. + * + * @throws AdapterInactive if the POAs are in the inactive state. + */ + void discard_requests(boolean wait_for_completion) + throws AdapterInactive; + + /** + * Get the state of the POA manager. + */ + State get_state(); + + /** + * Turns the associated POAs into holding state. In this state, the POAs + * queue incoming requests but do not process them. + * + * @param wait_for_completion if true, the method call suspends the current + * thread till POAs complete the requests they are currently processing. If + * false, the method returns immediately. + + * @throws AdapterInactive if the POAs are in the inactive state. + */ + void hold_requests(boolean wait_for_completion) + throws AdapterInactive; +} diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactive.java b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactive.java new file mode 100644 index 000000000..f0f729920 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactive.java @@ -0,0 +1,79 @@ +/* AdapterInactive.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.PortableServer.POAManagerPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised when the current operation is not applicable for the system + * because the POA manager is in an inactive {@link State}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class AdapterInactive + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 6945182851085567131L; + + /** + * Create AdapterInactive with no explaining + * message. + */ + public AdapterInactive() + { + } + + /** + * Create the AdapterInactive with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public AdapterInactive(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java new file mode 100644 index 000000000..d7d0336b7 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java @@ -0,0 +1,142 @@ +/* AdapterInactiveHelper.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.PortableServer.POAManagerPackage; + +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 AdapterInactive}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class AdapterInactiveHelper +{ + /** + * Create the AdapterInactive typecode (structure, + * named "AdapterInactive"). + */ + public static TypeCode type() + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + return orb.create_exception_tc(id(), "AdapterInactive", members); + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the AdapterInactive into the given Any. + * + * @param any the Any to insert into. + * @param that the AdapterInactive to insert. + */ + public static void insert(Any any, AdapterInactive that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the AdapterInactive from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain AdapterInactive. + */ + public static AdapterInactive extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (AdapterInactive) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("AdapterInactive expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the AdapterInactive repository id. + * + * @return "IDL:omg.org/PortableServer/POAManager/AdapterInactive:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POAManager/AdapterInactive:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static AdapterInactive read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + AdapterInactive value = new AdapterInactive(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, AdapterInactive value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java new file mode 100644 index 000000000..72a097038 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java @@ -0,0 +1,184 @@ +/* State.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.PortableServer.POAManagerPackage; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TRANSIENT; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines the possible states of the POA manager. + * + * This enumeration can obtain the following values: + * <ul> + * <li>ACTIVE When the manager is in the active state, the associated POAs + * receive and process requests.</li> + * <li>DISCARDING When the manager is in the discarding state, + * the associated POAs discard all incoming requests. The sending clients + * receive the {@link TRANSIENT} system exception, with standard + * minor code 1. This mode is needed for flow control, when the system is + * flooded with requests. + * </li> + * <li>HOLDING When the manager is in the holding state, the associated POAs + * queue incoming requests.</li> + * <li>INACTIVE This state is entered when the associated POAs are to be + * shut down.</li> + * </ul> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class State + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2451866258678193271L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (HOLDING). + */ + public static final int _HOLDING = 0; + + /** + * An instance of State, initialized to HOLDING. + */ + public static final State HOLDING = new State(_HOLDING); + + /** + * The possible value of this enumeration (ACTIVE). + */ + public static final int _ACTIVE = 1; + + /** + * An instance of State, initialized to ACTIVE. + */ + public static final State ACTIVE = new State(_ACTIVE); + + /** + * The possible value of this enumeration (DISCARDING). + */ + public static final int _DISCARDING = 2; + + /** + * An instance of State, initialized to DISCARDING. + */ + public static final State DISCARDING = new State(_DISCARDING); + + /** + * The possible value of this enumeration (INACTIVE). + */ + public static final int _INACTIVE = 3; + + /** + * An instance of State, initialized to INACTIVE. + */ + public static final State INACTIVE = new State(_INACTIVE); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final State[] enume = + new State[] { HOLDING, ACTIVE, DISCARDING, INACTIVE }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "HOLDING", "ACTIVE", "DISCARDING", "INACTIVE" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected State(int a_value) + { + _value = a_value; + } + + /** + * Returns the State, matching the given integer constant. + * + * @param code one of _HOLDING, _ACTIVE, _DISCARDING, _INACTIVE. + * @return one of HOLDING, ACTIVE, DISCARDING, INACTIVE. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static State from_int(int code) + { + try + { + return enume[code]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid state " + code); + bad.minor = Minor.Enumeration; + throw bad; + } + } + + /** + * Returns a short string representation. + * + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the enumeration value. + * @return one of HOLDING, ACTIVE, DISCARDING, INACTIVE. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/package.html b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/package.html new file mode 100644 index 000000000..fb6ae58d5 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.PortableServer.POAManagerPackage</title></head> + +<body> +<p>Contains additional classes, needed by POA Manager</p> + +</body> +</html> diff --git a/libjava/classpath/org/omg/PortableServer/POAOperations.java b/libjava/classpath/org/omg/PortableServer/POAOperations.java new file mode 100644 index 000000000..f989d2681 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAOperations.java @@ -0,0 +1,529 @@ +/* POAOperations.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.PortableServer; + +import org.omg.CORBA.BAD_INV_ORDER; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.OBJ_ADAPTER; +import org.omg.CORBA.Policy; +import org.omg.CORBA.TRANSIENT; +import org.omg.PortableServer.POAPackage.AdapterAlreadyExists; +import org.omg.PortableServer.POAPackage.AdapterNonExistent; +import org.omg.PortableServer.POAPackage.InvalidPolicy; +import org.omg.PortableServer.POAPackage.NoServant; +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.ServantAlreadyActive; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.WrongAdapter; +import org.omg.PortableServer.POAPackage.WrongPolicy; + +/** + * Defines the operations, applicable to the POA. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POAOperations +{ + /** + * Creates a new POA as a child of the target POA. + * + * @param child_name the name of the child POA being created. + * @param manager the manager that will control the new POA. If this parameter + * is null, a new POA manager is created and associated with the new POA. + * + * @param policies the policies, applicable for the parent POA. Policies + * are <i>not</i> inherited from the parent POA. If some policy type + * is missing in the array (or the zero size array is passed), the missing + * policies obtain the default values from the table, specified + * in the {@link POA} documentation header. + * + * @return an newly created POA. The POA will be intially in the holding + * state and must be activated to start processing requests. + * + * @throws AdapterAlreadyExists if the child with the given child_name + * already exists for the current POA. + * @throws InvalidPolicy if the policies conflict with each other or are + * otherwise inappropriate. + * + * @see POA for the list of required policies. + * @see #the_children() + */ + POA create_POA(String child_name, POAManager manager, Policy[] policies) + throws AdapterAlreadyExists, InvalidPolicy; + + /** + * Find and optionally activate the child POA with the given name. + * + * @param poa_name the name of the POA to find. + * @param activate_it if the child with the specified name is not found + * or inactive and this parameter is true, the target POA activator is + * invoked to activate that child. If this succeeds, that child POA + * is returned. + * + * @throws AdapterNonExistent if no active child with the given name + * is found and one of the following is true: + * a) the target POA has no associated + * {@link AdapterActivator}. b) that activator fails to activate the + * child POA. c) <code>activate_id</code> = false. + */ + POA find_POA(String poa_name, boolean activate_it) + throws AdapterNonExistent; + + /** + * Generate the Object Id for the given servant and add the servant to + * the Active Object Map using this Id a a key. If the servant + * activator is set, its incarnate method will be called. In this case, + * the passed servant in this method can be null; in this case, the servant, + * returned by {@link ServantActivatorOperations#incarnate} will + * be used. + * + * @param a_servant a servant that would serve the object with the + * returned Object Id. + * + * @return the generated objert Id for the given servant. + * + * @throws ServantAlreadyActive if this servant is already in the + * Active Object Map and the UNIQUE_ID policy applies. + * + * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN + * do not apply to this POA. + */ + byte[] activate_object(Servant a_servant) + throws ServantAlreadyActive, WrongPolicy; + + /** + * Add the given servant to the Active Object Map as a servant for the + * object with the provided Object Id. If the servant activator is + * set, its incarnate method will be called. In this case, + * the passed servant in this method can be null; in this case, the servant, + * returned by {@link ServantActivatorOperations#incarnate} will + * be used. + * + * @param an_Object_Id an object id for the given object. + * @param a_servant a servant that will serve the object with the given + * Object Id. + * + * @throws ObjectAlreadyActive if the given object id is already in the + * Active Object Map. + * @throws WrongPolicy if the required RETAIN policy does not apply to + * this POA. + * @throws BAD_PARAM if the passed object id is invalid due any reason. + */ + void activate_object_with_id(byte[] an_Object_Id, Servant a_servant) + throws ServantAlreadyActive, ObjectAlreadyActive, + WrongPolicy; + + /** + * <p>Deactivate object with the given id. Client, trying to call + * method on the deactivated object will either receive the remote + * exception ({@link org.omg.CORBA.OBJECT_NOT_EXIST}, minor 0x535503ec), + * incomplete) or the object will be reactivated and serve the request. + * The object can be reactivated only if the implicit activation + * policy applies and the servant activator is set.</p><p> + * The deactivated object will continue to process requests that arrived + * before decativation. + * If this POA has the associated servant manager, a + * {@link ServantActivatorOperations#etherealize} is <i>immediately</i> + * invoked on the passed id. The deactivated object can be reactivated + * by {@link #activate_object_with_id}.</p> + * <p>The deactivation will not release thread, port or memory resources, + * taken by that object. This is due requirement to make the + * object reactivation possible at any time. To release the resources, + * you must destroy the POA. + * </p> + * + * @throws WrongPolicy if the required RETAIN policy does not apply to + * this POA. + */ + void deactivate_object(byte[] the_Object_Id) + throws ObjectNotActive, WrongPolicy; + + /** + * Create the object reference, encapsulating the given repository Id and + * the Object Id, generated by this POA. The returned object will not be + * activated by default and may be activated on the first invocation by + * the servant manager (if it is set and if policies are applicable). + * The returned object can also be narrowed by helper and used locally. + * In this case, the servant will be activated on the first local call of + * any method. The methods on returned object can also be invoked by + * name, using {@link org.omg.CORBA.Request}. + * + * @param a_repository_id the repository id for the given object. When + * narrowing the returned object with some helper, it will be checked for + * equality with value, returned by the the helper id(). + * + * @throws WrongPolicy if the required SYSTEM_ID policy does not apply to + * this POA. + */ + org.omg.CORBA.Object create_reference(String a_repository_id) + throws WrongPolicy; + + /** + * <p> Create the object reference, encapsulating the given repository Id and + * the given Object Id. The returned object will not be + * activated by default and may be activated on the first invocation by + * the servant manager (if it is set and if policies are applicable). + * </p><p> + * The returned object can also be narrowed by helper and used locally. + * In this case, the servant will be activated on the first local call of + * any method. The methods on returned object can also be invoked by + * name, using {@link org.omg.CORBA.Request}. + * </p> + * + * @param an_object_id the object id for the object being created. + * If the POA uses the SYSTEM_ID policy, the portable application + * must only supply ids, generated by that POA. + * + * @param a_repository_id the repository id for the given object. When + * narrowing the returned object with some helper, it will be checked for + * equality with value, returned by the the helper id(). + */ + org.omg.CORBA.Object create_reference_with_id(byte[] an_object_id, + String a_repository_id + ); + + /** + * Returns a default servant for this POA. + * + * @return a servant that will be used for requests for + * which no servant is found in the Active Object Map. + * + * @throws NoServant if there is no default servant associated with this POA. + * @throws WrongPolicy if the USE_DEFAULT_SERVANT policy is not active. + */ + Servant get_servant() + throws NoServant, WrongPolicy; + + /** + * Sets the default servant for this POA. + * + * @param a_servant a servant that will be used for requests for + * which no servant is found in the Active Object Map. + * + * @throws WrongPolicy if the USE_DEFAULT_SERVANT policy is not active. + */ + void set_servant(Servant a_servant) + throws WrongPolicy; + + /** + * Set a servant manager for this POA. + * + * @param a_manager servant manager being set. If the RETAIN policy applies, the + * manager must implement a {@link ServantActivator}. If the NON_RETAIN + * policy applies, the manager must implement a {@link ServantLocator}. + * + * @throws WrongPolicy if the required USE_SERVANT_MANAGER policy does not + * apply to this POA. + * + * @throws OBJ_ADAPTER minor code 4 if the passed manager does not + * implement the required interface ({@link ServantActivator}, + * {@link ServantLocator}). + * + * @throws BAD_INV_ORDER minor code 6 if the method is called more than once + * on the same POA. The manager can be set only once. + */ + void set_servant_manager(ServantManager a_manager) + throws WrongPolicy; + + /** + * Get the servant manager, associated with this POA. + * + * @return the associated servant manager or null if it has + * been previously set. + * + * @throws WrongPolicy if the required USE_SERVANT_MANAGER policy does not + * apply to this POA. + */ + ServantManager get_servant_manager() + throws WrongPolicy; + + /** + * Get the unique Id of the POA in the process in which it is created. + * This Id is needed by portable interceptors. The id is unique + * for the life span of the POA in the process. For persistent + * POAs, if a POA is created in the same path with the same name as + * another POA, these POAs are identical have the same id. All transient + * POAs are assumed unique. + */ + byte[] id(); + + /** + * Returns the reference to the active object with the given Id. + * + * @param the_Object_Id the object id. + * + * @throws ObjectNotActive if there is no active object with such Id. + * @throws WrongPolicy if the required RETAIN policy does not apply to + * this POA. + */ + org.omg.CORBA.Object id_to_reference(byte[] the_Object_Id) + throws ObjectNotActive, WrongPolicy; + + /** + * Returns the servant that serves the active object with the given Id. + * + * @param the_Object_Id the object id. + * + * @throws ObjectNotActive if there is no active object with such Id. + * @throws WrongPolicy This method requires either RETAIN or + * USE_DEFAULT_SERVANT policies and reaises the WrongPolicy if none of them + * apply to this POA. + */ + Servant id_to_servant(byte[] the_Object_Id) + throws ObjectNotActive, WrongPolicy; + + /** + * Returns the Object Id, encapsulated in the given object reference. + * + * @param the_Object the object that has been previously created with this + * POA. It need not be active. + * + * @throws WrongAdapter if the passed object has not been previously created + * with this POA. + * @throws WrongPolicy never (declared for the future extensions only). + */ + byte[] reference_to_id(org.omg.CORBA.Object the_Object) + throws WrongAdapter, WrongPolicy; + + /** + * Returns the servant that is serving this object. + * + * @return if the RETAIN policy applies and the object is in the Active + * Object Map, the method returns the servant, associated with this object. + * Otherwise, if the USE_DEFAULT_SERVANT policy applies, the method returns + * the default servant (if one was set). + * + * @throws ObjectNotActive if none of the conditions above are satisfied. + * @throws WrongAdapter if the object reference was not created with this POA. + * @throws WrongPolicy This method requires either RETAIN or + * USE_DEFAULT_SERVANT policies and reaises the WrongPolicy if none of them + * apply to this POA. + */ + Servant reference_to_servant(org.omg.CORBA.Object the_Object) + throws ObjectNotActive, WrongPolicy, WrongAdapter; + + /** + * Returns the id of the object, served by the given servant. The id is found + * in one of the following ways. + * <ul> + * <li>If the POA has both the RETAIN and the UNIQUE_ID policy and + * the specified servant is active, the method return the Object Id associated + * with that servant. + * </li><li> + * If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and + * either the POA has the MULTIPLE_ID policy or the specified servant is + * inactive, the method activates the servant using a POA-generated Object Id + * and the Interface Id associated with the servant, and returns that + * Object Id. + * </li> + * <li>If the POA has the USE_DEFAULT_SERVANT policy, the servant specified + * is the default servant, and the method is being invoked in the context o + * f executing a request on the default servant, the method returns the + * ObjectId associated with the current invocation. + * </li> + * </ul> + * @throws ServantNotActive in all cases, not listed in the list above. + * @throws WrongPolicy The method requres USE_DEFAULT_SERVANT policy or + * a combination of the RETAIN policy and either the UNIQUE_ID or + * IMPLICIT_ACTIVATION policies and throws the WrongPolicy if these conditions + * are not satisfied. + */ + byte[] servant_to_id(Servant the_Servant) + throws ServantNotActive, WrongPolicy; + + /** + * <p>Converts the given servant to the object reference. + * The servant will serve all methods, invoked on the returned object. + * The returned object reference can be passed to the remote client, + * enabling remote invocations. + * </p><p> + * If the specified servant already serves some active object, that + * object is returned. Otherwise, + * if the POA has the IMPLICIT_ACTIVATION policy the method activates + * the servant, creating an new object with the POA-generated Object Id. + * In this case, if the servant activator is set, the + * {@link ServantActivatorOperations#incarnate} method will be called. + * </p> + * + * @throws ServantNotActive if the servant is inactive and no + * IMPLICIT_ACTIVATION policy applies. + * @throws WrongPolicy This method needs the RETAIN policy and either the + * UNIQUE_ID or IMPLICIT_ACTIVATION policies. + * + * @return the object, exposing the given servant in the context of this POA. + */ + org.omg.CORBA.Object servant_to_reference(Servant the_Servant) + throws ServantNotActive, WrongPolicy; + + /** + * Return the POA manager, associated with this POA. + * + * @return the associated POA manager (always available). + */ + POAManager the_POAManager(); + + /** + * Returns the adapter activator, associated with this POA. + * The newly created POA has no activator (null would be + * returned). The ORB root POA also initially has no activator. + * + * @return tha adapter activator or null if this POA has no + * associated adapter activator. + */ + AdapterActivator the_activator(); + + /** + * Set the adapter activator for this POA. + * + * @param activator the activator being set. + */ + void the_activator(AdapterActivator activator); + + /** + * The children of this POA. + * + * @return the array of all childs for this POA. + */ + POA[] the_children(); + + /** + * Return the name of this POA. + * + * @return the name of POA, relative to its parent. + */ + String the_name(); + + /** + * Return the parent of this POA. + * + * @return the parent POA or <code>null</code> if this is a root POA. + */ + POA the_parent(); + + /** + * <p> Destroy this POA and all descendant POAs. The destroyed POAs can be + * later re-created via {@link AdapterActivator} or by invoking + * {@link #create_POA}. + * This differs from {@link POAManagerOperations#deactivate} that does + * not allow recreation of the deactivated POAs. After deactivation, + * recreation is only possible if the POAs were later destroyed. + * </p><p> + * The remote invocation on the target, belonging to the POA that is + * currently destroyed return the remote exception ({@link TRANSIENT}, + * minor code 4). + * </p> + * @param etherealize_objects if true, and POA has RETAIN policy, and the + * servant manager is available, the servant manager method + * {@link ServantActivatorOperations#etherealize} is called for each + * <i>active</i> object in the Active Object Map. This method should not + * try to access POA being destroyed. If <code>destroy</code> is called + * multiple times before the destruction completes, + * the etherialization should be invoked only once. + * + * @param wait_for_completion if true, the method waits till the POA being + * destroyed completes all current requests and etherialization. If false, + * the method returns immediately. + */ + void destroy(boolean etherealize_objects, boolean wait_for_completion); + + /** + * Create the IdUniquenessPolicy policy. + * + * @param a_value states which one Id uniqueness policy will apply. + * + * @return the created policy. + */ + IdUniquenessPolicy create_id_uniqueness_policy(IdUniquenessPolicyValue a_value); + + /** + * Create the ImplicitActivationPolicy policy. + * + * @param a_value states which one activation policy will apply. + * + * @return the created policy. + */ + ImplicitActivationPolicy create_implicit_activation_policy(ImplicitActivationPolicyValue a_value); + + /** + * Create the LifespanPolicy policy. + * + * @param a_value states which one object lifespan policy will apply. + * + * @return the created policy. + */ + LifespanPolicy create_lifespan_policy(LifespanPolicyValue a_value); + + /** + * Create the RequestProcessingPolicy policy. + * + * @param a_value states which one request processing policy will apply. + * + * @return the created policy. + */ + RequestProcessingPolicy create_request_processing_policy(RequestProcessingPolicyValue a_value); + + /** + * Create the ServantRetentionPolicy policy. + * + * @param a_value states which one servant retention policy will apply. + * + * @return the created policy. + */ + ServantRetentionPolicy create_servant_retention_policy(ServantRetentionPolicyValue a_value); + + /** + * Create the ThreadPolicy policy. + * + * @param a_value states which one thread policy will apply. + * + * @return the created policy. + */ + ThreadPolicy create_thread_policy(ThreadPolicyValue a_value); + + /** + * Create the ID assignment policy with the given value. + * + * @param value states which one ID assignment policy will apply. + * + * @return the created policy. + */ + IdAssignmentPolicy create_id_assignment_policy(IdAssignmentPolicyValue value); + +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExists.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExists.java new file mode 100644 index 000000000..602ce1dba --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExists.java @@ -0,0 +1,79 @@ +/* AdapterAlreadyExists.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised if the target POA already has a child POA with the specified name + * (during creation of the new POA as a child of the target POA). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class AdapterAlreadyExists + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2678288222917790041L; + + /** + * Create AdapterAlreadyExists with no explaining + * message. + */ + public AdapterAlreadyExists() + { + } + + /** + * Create the AdapterAlreadyExists with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public AdapterAlreadyExists(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java new file mode 100644 index 000000000..ccb3fa584 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java @@ -0,0 +1,152 @@ +/* AdapterAlreadyExistsHelper.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.PortableServer.POAPackage; + +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 AdapterAlreadyExists}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AdapterAlreadyExistsHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the AdapterAlreadyExists typecode (emtpy structure, + * named "AdapterAlreadyExists"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = + orb.create_exception_tc(id(), "AdapterAlreadyExists", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the AdapterAlreadyExists into the given Any. + * + * @param any the Any to insert into. + * @param that the AdapterAlreadyExists to insert. + */ + public static void insert(Any any, AdapterAlreadyExists that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the AdapterAlreadyExists from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain AdapterAlreadyExists. + */ + public static AdapterAlreadyExists extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (AdapterAlreadyExists) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("AdapterAlreadyExists expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the AdapterAlreadyExists repository id. + * + * @return "IDL:omg.org/PortableServer/POA/AdapterAlreadyExists:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/AdapterAlreadyExists:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static AdapterAlreadyExists read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + AdapterAlreadyExists value = new AdapterAlreadyExists(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, AdapterAlreadyExists value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistent.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistent.java new file mode 100644 index 000000000..c7f87bccf --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistent.java @@ -0,0 +1,79 @@ +/* AdapterNonExistent.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The AdapterNonExistent is thrown if the parent POA cannot locate + * the required child POA. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class AdapterNonExistent + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -9166706041988650696L; + + /** + * Create AdapterNonExistent with no explaining + * message. + */ + public AdapterNonExistent() + { + } + + /** + * Create the AdapterNonExistent with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public AdapterNonExistent(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java new file mode 100644 index 000000000..65842b756 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java @@ -0,0 +1,151 @@ +/* AdapterNonExistentHelper.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.PortableServer.POAPackage; + +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 AdapterNonExistent}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AdapterNonExistentHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the AdapterNonExistent typecode (empty structure, + * named "AdapterNonExistent"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = orb.create_exception_tc(id(), "AdapterNonExistent", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the AdapterNonExistent into the given Any. + * + * @param any the Any to insert into. + * @param that the AdapterNonExistent to insert. + */ + public static void insert(Any any, AdapterNonExistent that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the AdapterNonExistent from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain AdapterNonExistent. + */ + public static AdapterNonExistent extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (AdapterNonExistent) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("AdapterNonExistent expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the AdapterNonExistent repository id. + * + * @return "IDL:omg.org/PortableServer/POA/AdapterNonExistent:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/AdapterNonExistent:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static AdapterNonExistent read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + AdapterNonExistent value = new AdapterNonExistent(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, AdapterNonExistent value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicy.java b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicy.java new file mode 100644 index 000000000..43ea544d3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicy.java @@ -0,0 +1,109 @@ +/* InvalidPolicy.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised if any of the policy objects specified is not supported by this + * ORB implementation, if conflicting policy objects are specified, + * or if any of the specified policy objects require prior administrative + * action that has not been performed. + * + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class InvalidPolicy + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 3204212102282117205L; + + /** + * The index in the policies parameter value of the first offending + * policy object. + */ + public short index; + + /** + * Create InvalidPolicy with no explaining + * message and leaving {@link #index} with default 0 value. + */ + public InvalidPolicy() + { + } + + /** + * Create the InvalidPolicy with explaining + * message and initialisintg {@link #index} to the passed value. + * + * @param why a string, explaining, why this exception has been thrown. + * @param a_index a value for index. + */ + public InvalidPolicy(String why, short a_index) + { + super(why); + this.index = a_index; + } + + /** + * Create the InvalidPolicy without explaining + * message and initialisintg {@link #index} to the passed value. + * + * @param a_index a value for index. + */ + public InvalidPolicy(short a_index) + { + this.index = a_index; + } + + /** + * Adds {@link #index} to the super.getMessage(). + */ + public String getMessage() + { + return super.getMessage() + " at index " + index; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java new file mode 100644 index 000000000..64cdaadbf --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java @@ -0,0 +1,158 @@ +/* InvalidPolicyHelper.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.PortableServer.POAPackage; + +import gnu.CORBA.Minor; +import gnu.CORBA.OrbRestricted; +import gnu.CORBA.Poa.InvalidPolicyHolder; + +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; + +/** + * The helper operations for the exception {@link InvalidPolicy}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class InvalidPolicyHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the InvalidPolicy typecode (emtpy structure, + * named "InvalidPolicy"). + * The typecode states that the structure contains the + * single field, named "index". + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 1 ]; + + TypeCode field; + + field = orb.get_primitive_tc(TCKind.tk_ushort); + members [ 0 ] = new StructMember("index", field, null); + typeCode = orb.create_exception_tc(id(), "InvalidPolicy", members); + } + return typeCode; + } + + /** + * Insert the InvalidPolicy into the given Any. + * This method uses the InvalidPolicyHolder. + * + * @param any the Any to insert into. + * @param that the InvalidPolicy to insert. + */ + public static void insert(Any any, InvalidPolicy that) + { + any.insert_Streamable(new InvalidPolicyHolder(that)); + } + + /** + * Extract the InvalidPolicy from given Any. + * This method uses the InvalidPolicyHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain InvalidPolicy. + */ + public static InvalidPolicy extract(Any any) + { + try + { + return ((InvalidPolicyHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("InvalidPolicy expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the InvalidPolicy repository id. + * + * @return "IDL:omg.org/PortableServer/POA/InvalidPolicy:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/InvalidPolicy:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static InvalidPolicy read(InputStream input) + { + // Read the exception repository id. + input.read_string(); + InvalidPolicy value = new InvalidPolicy(); + + value.index = input.read_short(); + 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, InvalidPolicy value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_short(value.index); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/NoServant.java b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServant.java new file mode 100644 index 000000000..a3d7b0437 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServant.java @@ -0,0 +1,79 @@ +/* NoServant.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised when trying to get the default servant, when no default servant + * has been associated with POA. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NoServant + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -5893773687270266061L; + + /** + * Create NoServant with no explaining + * message. + */ + public NoServant() + { + } + + /** + * Create the NoServant with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public NoServant(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java new file mode 100644 index 000000000..cfb63ed26 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java @@ -0,0 +1,151 @@ +/* NoServantHelper.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.PortableServer.POAPackage; + +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 NoServant}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NoServantHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the NoServant typecode (empty structure, + * named "NoServant"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = orb.create_exception_tc(id(), "NoServant", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the NoServant into the given Any. + * + * @param any the Any to insert into. + * @param that the NoServant to insert. + */ + public static void insert(Any any, NoServant that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the NoServant from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain NoServant. + */ + public static NoServant extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (NoServant) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NoServant expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the NoServant repository id. + * + * @return "IDL:omg.org/PortableServer/POA/NoServant:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/NoServant:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static NoServant read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + NoServant value = new NoServant(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, NoServant value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActive.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActive.java new file mode 100644 index 000000000..9a80b95f8 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActive.java @@ -0,0 +1,78 @@ +/* ObjectAlreadyActive.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised in response to activate the already active object. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ObjectAlreadyActive + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2919308871345098101L; + + /** + * Create ObjectAlreadyActive with no explaining + * message. + */ + public ObjectAlreadyActive() + { + } + + /** + * Create the ObjectAlreadyActive with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public ObjectAlreadyActive(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java new file mode 100644 index 000000000..48070eade --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java @@ -0,0 +1,152 @@ +/* ObjectAlreadyActiveHelper.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.PortableServer.POAPackage; + +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 ObjectAlreadyActive}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectAlreadyActiveHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the ObjectAlreadyActive typecode (empty structure, + * named "ObjectAlreadyActive"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = + orb.create_exception_tc(id(), "ObjectAlreadyActive", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the ObjectAlreadyActive into the given Any. + * + * @param any the Any to insert into. + * @param that the ObjectAlreadyActive to insert. + */ + public static void insert(Any any, ObjectAlreadyActive that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the ObjectAlreadyActive from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ObjectAlreadyActive. + */ + public static ObjectAlreadyActive extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (ObjectAlreadyActive) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("ObjectAlreadyActive expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ObjectAlreadyActive repository id. + * + * @return "IDL:omg.org/PortableServer/POA/ObjectAlreadyActive:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/ObjectAlreadyActive:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ObjectAlreadyActive read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + ObjectAlreadyActive value = new ObjectAlreadyActive(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, ObjectAlreadyActive value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActive.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActive.java new file mode 100644 index 000000000..e8f0bc6bb --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActive.java @@ -0,0 +1,79 @@ +/* ObjectNotActive.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised in several cases when the operation would be applicable to the + * activated object, but the current object is not active. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ObjectNotActive + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 2269559915073532416L; + + /** + * Create ObjectNotActive with no explaining + * message. + */ + public ObjectNotActive() + { + } + + /** + * Create the ObjectNotActive with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public ObjectNotActive(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java new file mode 100644 index 000000000..492040dd2 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java @@ -0,0 +1,151 @@ +/* ObjectNotActiveHelper.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.PortableServer.POAPackage; + +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 ObjectNotActive}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ObjectNotActiveHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the ObjectNotActive typecode (empty structure, + * named "ObjectNotActive"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = orb.create_exception_tc(id(), "ObjectNotActive", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the ObjectNotActive into the given Any. + * + * @param any the Any to insert into. + * @param that the ObjectNotActive to insert. + */ + public static void insert(Any any, ObjectNotActive that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the ObjectNotActive from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ObjectNotActive. + */ + public static ObjectNotActive extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (ObjectNotActive) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("ObjectNotActive expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ObjectNotActive repository id. + * + * @return "IDL:omg.org/PortableServer/POA/ObjectNotActive:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/ObjectNotActive:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ObjectNotActive read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + ObjectNotActive value = new ObjectNotActive(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, ObjectNotActive value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActive.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActive.java new file mode 100644 index 000000000..a6fd5da24 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActive.java @@ -0,0 +1,83 @@ +/* ServantAlreadyActive.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised in response to activate the already active object when + * the UNIQUE_ID (single ID per object, default) policy is active. If the + * UNIQUE_ID policy is inactive, the object can be activated several + * times, each time obtaining a newly generated Id to the same object. + * + * @see org.omg.PortableServer.IdUniquenessPolicyValue + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ServantAlreadyActive + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 780130793809887260L; + + /** + * Create ServantAlreadyActive with no explaining + * message. + */ + public ServantAlreadyActive() + { + } + + /** + * Create the ServantAlreadyActive with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public ServantAlreadyActive(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java new file mode 100644 index 000000000..8fdb1ec15 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java @@ -0,0 +1,152 @@ +/* ServantAlreadyActiveHelper.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.PortableServer.POAPackage; + +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 ServantAlreadyActive}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServantAlreadyActiveHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the ServantAlreadyActive typecode (structure, + * named "ServantAlreadyActive"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = + orb.create_exception_tc(id(), "ServantAlreadyActive", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the ServantAlreadyActive into the given Any. + * + * @param any the Any to insert into. + * @param that the ServantAlreadyActive to insert. + */ + public static void insert(Any any, ServantAlreadyActive that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the ServantAlreadyActive from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ServantAlreadyActive. + */ + public static ServantAlreadyActive extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (ServantAlreadyActive) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("ServantAlreadyActive expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ServantAlreadyActive repository id. + * + * @return "IDL:omg.org/PortableServer/POA/ServantAlreadyActive:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/ServantAlreadyActive:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ServantAlreadyActive read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + ServantAlreadyActive value = new ServantAlreadyActive(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, ServantAlreadyActive value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActive.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActive.java new file mode 100644 index 000000000..584459939 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActive.java @@ -0,0 +1,79 @@ +/* ServantNotActive.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised in several cases when the operation would be applicable to the + * activated servant, but the current object is not active. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ServantNotActive + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -7806868032412803953L; + + /** + * Create ServantNotActive with no explaining + * message. + */ + public ServantNotActive() + { + } + + /** + * Create the ServantNotActive with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public ServantNotActive(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java new file mode 100644 index 000000000..99110e511 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java @@ -0,0 +1,151 @@ +/* ServantNotActiveHelper.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.PortableServer.POAPackage; + +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 ServantNotActive}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ServantNotActiveHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the ServantNotActive typecode (empty structure, + * named "ServantNotActive"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = orb.create_exception_tc(id(), "ServantNotActive", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the ServantNotActive into the given Any. + * + * @param any the Any to insert into. + * @param that the ServantNotActive to insert. + */ + public static void insert(Any any, ServantNotActive that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the ServantNotActive from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ServantNotActive. + */ + public static ServantNotActive extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (ServantNotActive) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("ServantNotActive expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ServantNotActive repository id. + * + * @return "IDL:omg.org/PortableServer/POA/ServantNotActive:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/ServantNotActive:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ServantNotActive read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + ServantNotActive value = new ServantNotActive(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, ServantNotActive value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapter.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapter.java new file mode 100644 index 000000000..8e28e8430 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapter.java @@ -0,0 +1,80 @@ +/* WrongAdapter.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised when invoking POA operations, requiring that the target + * object would be created by this POA, if this condition is not + * satisfied. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class WrongAdapter + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 7505320179916389200L; + + /** + * Create WrongAdapter with no explaining + * message. + */ + public WrongAdapter() + { + } + + /** + * Create the WrongAdapter with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public WrongAdapter(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java new file mode 100644 index 000000000..69ffda747 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java @@ -0,0 +1,151 @@ +/* WrongAdapterHelper.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.PortableServer.POAPackage; + +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 WrongAdapter}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class WrongAdapterHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the WrongAdapter typecode (empty structure, + * named "WrongAdapter"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = orb.create_exception_tc(id(), "WrongAdapter", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the WrongAdapter into the given Any. + * + * @param any the Any to insert into. + * @param that the WrongAdapter to insert. + */ + public static void insert(Any any, WrongAdapter that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the WrongAdapter from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain WrongAdapter. + */ + public static WrongAdapter extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (WrongAdapter) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("WrongAdapter expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the WrongAdapter repository id. + * + * @return "IDL:omg.org/PortableServer/POA/WrongAdapter:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/WrongAdapter:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static WrongAdapter read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + WrongAdapter value = new WrongAdapter(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, WrongAdapter value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicy.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicy.java new file mode 100644 index 000000000..e0dbc9902 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicy.java @@ -0,0 +1,79 @@ +/* WrongPolicy.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.PortableServer.POAPackage; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Raised when invoking the operation that is not allowed by the current + * combination of the used policies. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class WrongPolicy + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 1949765652955335195L; + + /** + * Create WrongPolicy with no explaining + * message. + */ + public WrongPolicy() + { + } + + /** + * Create the WrongPolicy with explaining + * message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public WrongPolicy(String why) + { + super(why); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java new file mode 100644 index 000000000..9122b06e4 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java @@ -0,0 +1,151 @@ +/* WrongPolicyHelper.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.PortableServer.POAPackage; + +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 WrongPolicy}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class WrongPolicyHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the WrongPolicy typecode (empty structure, + * named "WrongPolicy"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = OrbRestricted.Singleton; + StructMember[] members = new StructMember[ 0 ]; + typeCode = orb.create_exception_tc(id(), "WrongPolicy", members); + } + return typeCode; + } + + /* Every user exception with no user defined + fields can use EmptyExceptionHolder */ + + /** + * Insert the WrongPolicy into the given Any. + * + * @param any the Any to insert into. + * @param that the WrongPolicy to insert. + */ + public static void insert(Any any, WrongPolicy that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the WrongPolicy from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain WrongPolicy. + */ + public static WrongPolicy extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (WrongPolicy) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("WrongPolicy expected"); + bad.minor = Minor.Any; + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the WrongPolicy repository id. + * + * @return "IDL:omg.org/PortableServer/POA/WrongPolicy:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA/WrongPolicy:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static WrongPolicy read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + WrongPolicy value = new WrongPolicy(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, WrongPolicy value) + { + // Write the exception repository id. + output.write_string(id()); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/package.html b/libjava/classpath/org/omg/PortableServer/POAPackage/package.html new file mode 100644 index 000000000..e95dd68ec --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAPackage/package.html @@ -0,0 +1,49 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in org.omg.PortableServer.POAPackage package + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.PortableServer.POAPackage</title></head> + +<body> +<p>Contains exceptions that may be thrown by various POA operations. +Also provides helpers that are used to transfer these exceptions if they +are thrown on remote side.</p> + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> diff --git a/libjava/classpath/org/omg/PortableServer/REQUEST_PROCESSING_POLICY_ID.java b/libjava/classpath/org/omg/PortableServer/REQUEST_PROCESSING_POLICY_ID.java new file mode 100644 index 000000000..f71f101cd --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/REQUEST_PROCESSING_POLICY_ID.java @@ -0,0 +1,52 @@ +/* REQUEST_PROCESSING_POLICY_ID.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.PortableServer; + + /** + * Holds an integer {@link RequestProcessingPolicy} identifier. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface REQUEST_PROCESSING_POLICY_ID +{ + /** + * Specifies the REQUEST_PROCESSING_POLICY_ID value, 22. + */ + int value = 22; +} diff --git a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicy.java b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicy.java new file mode 100644 index 000000000..9d3237d7d --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicy.java @@ -0,0 +1,59 @@ +/* RequestProcessingPolicy.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.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the behaviour in the case when the + * requested object is not found in the Active Object Map or that map + * is not in use. + * + * The policy can return its current value, as defined. + * in {@link RequestProcessingPolicyOperations}. + * + * @see RequestProcessingPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestProcessingPolicy + extends Policy, RequestProcessingPolicyOperations, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyOperations.java new file mode 100644 index 000000000..5a8963b30 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyOperations.java @@ -0,0 +1,55 @@ +/* RequestProcessingPolicyOperations.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.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the RequestProcessingPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestProcessingPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + RequestProcessingPolicyValue value(); +} diff --git a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java new file mode 100644 index 000000000..e946d5cf6 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java @@ -0,0 +1,181 @@ +/* RequestProcessingPolicyValue.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.PortableServer; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* Specifies the behaviour in the case when the +* requested object is not found in the Active Object Map or that map +* is not in use. The map is not in use when the +* {@link ServantRetentionPolicyValue#NON_RETAIN} policy is active. +* <ul> +* <li>USE_ACTIVE_OBJECT_MAP_ONLY Raise an {@link org.omg.CORBA.OBJECT_NOT_EXIST} +* with the minor code 2. {@link ServantRetentionPolicyValue#RETAIN} policy is +* also required. +* </li> +* <li>USE_DEFAULT_SERVANT Dispatch request to the default servant. If no such +* exists, raise {@link org.omg.CORBA.OBJ_ADAPTER} with minor code 3. +* {@link IdUniquenessPolicyValue#MULTIPLE_ID} is also required. +* </li> +* <li>USE_SERVANT_MANAGER Dispatch request to the servant manager. If no such +* exists, raise {@link org.omg.CORBA.OBJ_ADAPTER} with the minor code 4.</li> +* </ul> +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public class RequestProcessingPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (V1.4) for interoperability. + */ + private static final long serialVersionUID = 7646563512329907695L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (USE_ACTIVE_OBJECT_MAP_ONLY). + */ + public static final int _USE_ACTIVE_OBJECT_MAP_ONLY = 0; + + /** + * An instance of RequestProcessingPolicyValue, initialized to USE_ACTIVE_OBJECT_MAP_ONLY. + */ + public static final RequestProcessingPolicyValue USE_ACTIVE_OBJECT_MAP_ONLY = + new RequestProcessingPolicyValue(_USE_ACTIVE_OBJECT_MAP_ONLY); + + /** + * The possible value of this enumeration (USE_DEFAULT_SERVANT). + */ + public static final int _USE_DEFAULT_SERVANT = 1; + + /** + * An instance of RequestProcessingPolicyValue, initialized to USE_DEFAULT_SERVANT. + */ + public static final RequestProcessingPolicyValue USE_DEFAULT_SERVANT = + new RequestProcessingPolicyValue(_USE_DEFAULT_SERVANT); + + /** + * The possible value of this enumeration (USE_SERVANT_MANAGER). + */ + public static final int _USE_SERVANT_MANAGER = 2; + + /** + * An instance of RequestProcessingPolicyValue, initialized to USE_SERVANT_MANAGER. + */ + public static final RequestProcessingPolicyValue USE_SERVANT_MANAGER = + new RequestProcessingPolicyValue(_USE_SERVANT_MANAGER); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final RequestProcessingPolicyValue[] enume = + new RequestProcessingPolicyValue[] + { + USE_ACTIVE_OBJECT_MAP_ONLY, USE_DEFAULT_SERVANT, USE_SERVANT_MANAGER + }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] + { + "USE_ACTIVE_OBJECT_MAP_ONLY", "USE_DEFAULT_SERVANT", "USE_SERVANT_MANAGER" + }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected RequestProcessingPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the RequestProcessingPolicyValue, matching the given integer constant. + * + * @param code one of _USE_ACTIVE_OBJECT_MAP_ONLY, _USE_DEFAULT_SERVANT, _USE_SERVANT_MANAGER. + * @return one of USE_ACTIVE_OBJECT_MAP_ONLY, USE_DEFAULT_SERVANT, USE_SERVANT_MANAGER. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static RequestProcessingPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); + bad.minor = Minor.PolicyType; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the policy value. + * @return one of _USE_ACTIVE_OBJECT_MAP_ONLY, + * _USE_DEFAULT_SERVANT, _USE_SERVANT_MANAGER. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/SERVANT_RETENTION_POLICY_ID.java b/libjava/classpath/org/omg/PortableServer/SERVANT_RETENTION_POLICY_ID.java new file mode 100644 index 000000000..89813b921 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/SERVANT_RETENTION_POLICY_ID.java @@ -0,0 +1,52 @@ +/* SERVANT_RETENTION_POLICY_ID.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.PortableServer; + + /** + * Holds an integer {@link ServantRetentionPolicy} identifier. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface SERVANT_RETENTION_POLICY_ID +{ + /** + * Specifies the SERVANT_RETENTION_POLICY_ID value, 21. + */ + int value = 21; +} diff --git a/libjava/classpath/org/omg/PortableServer/Servant.java b/libjava/classpath/org/omg/PortableServer/Servant.java new file mode 100644 index 000000000..53b05f1e5 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/Servant.java @@ -0,0 +1,296 @@ +/* Servant.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.PortableServer; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_INV_ORDER; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.OBJECT_NOT_EXIST; +import org.omg.CORBA.ORB; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.portable.Delegate; + +import gnu.CORBA.Minor; +import gnu.CORBA.Poa.ORB_1_4; +import gnu.CORBA.Poa.gnuPOA; + +/** + * <p> + * The servant is responsible for handling the method invocation on the + * target object. It can be one servant per object, or the same servant can + * support several (possibly all) objects, associated with the given POA. + * </p> <p> + * Till JDK 1.3 inclusive, a typical IDL to java compiler generates an + * implementation base (name pattern _*ImplBase.java) that is derived from the + * {@link org.omg.CORBA.portable.ObjectImpl}. Since JDK 1.4 the implementation + * base is derived from the Servant, also having a different name pattern + * (*POA.java). This suffix may be confusing, as the servant itself is + * <i>not</i> POA nor it is derived from it. + * </p><p> + * In both cases, the implementation base also inherits an interface, containing + * definitions of the application specific methods. The application programmer + * writes a child of the implementation base, implementing these methods + * for the application-specific functionality. The ObjectImpl is connected + * directly to the ORB. The Servant is connected to POA that can be obtained + * from the ORB. + * </p><p> + * If the servant is connected to more than one object, the exact object + * being currently served can be identified with {@link #_object_id}. + * </p><p> + * The derivativ of Servant, being directly connected to serve requests, + * must inherit either from {@link org.omg.CORBA.portable.InvokeHandler} + * or from {@link org.omg.PortableServer.DynamicImplementation}). + * </p><p> + * The Servant type is a CORBA <code>native</code> type. + * </p> + * + * @see POA#servant_to_reference(Servant) + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class Servant +{ + /** + * The delegate, where calls to some Servant methods are forwarded. + */ + private Delegate delegate; + + /** + * Get the repository ids of all interfaces, supported by the + * CORBA object, identified by the passed Id. In the typical code the + * passed parameters are ignored, returning an array of repository ids, + * supported by the servant implementation. + * + * @param poa a POA of the given object. + * @param object_ID the object Id of the given object. + * + * @return an array, containing the repository ids. + */ + public abstract String[] _all_interfaces(POA poa, byte[] object_ID); + + /** + * Get the delegate, where calls to some Servant methods are forwarded. + */ + public final Delegate _get_delegate() + { + if (delegate == null) { + throw new BAD_INV_ORDER + ("The Servant has not been associated with an ORBinstance"); + } + return delegate; + } + + /** + * Get the interface repository definition <code>InterfaceDef</code> for this + * Object. By default, forwards request to the delegate. + * + * @specnote The interface repository is officially not implemented up till + * JDK 1.5 inclusive. The delegate throws NO_IMPLEMENT, always. + */ + public org.omg.CORBA.Object _get_interface_def() + { + throw new NO_IMPLEMENT(); + } + + /** + * Checks if the passed servant is an instance of the given CORBA IDL type. + * By default, forwards the requet to the delegate. + * + * @param repository_id a repository ID, representing an IDL type for that the + * servant must be checked. + * + * @return true if the servant is an instance of the given type, false + * otherwise. + */ + public boolean _is_a(String repository_id) + { + return delegate.is_a(this, repository_id); + } + + /** + * Determines if the server object for this reference has already + * been destroyed. By default, forwards request to the delegate. + * + * @return true if the object has been destroyed, false otherwise. + */ + public boolean _non_existent() + { + return delegate.non_existent(this); + } + + /** + * Returns the ORB that is directly associated with the given servant. + * In this implementation, the method is overridden to return + */ + public final ORB _orb() + { + return delegate.orb(this); + } + + /** + * Returns the root POA of the ORB instance, associated with this servant. + * It is the same POA that would be returned by resolving the initial + * reference "RootPOA" for that orb. By default, forwards request to the + * delegate. + * + * @see ORB#resolve_initial_references + */ + public POA _default_POA() + { + return delegate == null ? null : delegate.default_POA(this); + } + + /** + * Return the invocation target object identifier as a byte array. + * This is typically used when the same servant serves multiple objects, + * and the object id can encapsulated the whole description of the + * object. + * + * This method returns correct values even when the same + * servant serves several objects in parallel threads. The ORB maintains the + * thread to invocation data map for all calls that are currently being + * processed. + */ + public final byte[] _object_id() + { + if (delegate != null) + return delegate.object_id(this); + else + throw new OBJECT_NOT_EXIST(); + } + + /** + * Get POA that is directly associated with the given servant. + * By default, forwards request to the delegate. + */ + public final POA _poa() + { + return delegate.poa(this); + } + + /** + * Set the delegate for this servant. + */ + public final void _set_delegate(Delegate a_delegate) + { + delegate = a_delegate; + } + + /** + * Obtains the CORBA object reference that is a current invocation target for + * the given servant. This is important when the same servant serves + * multiple objects. If the servant is not yet connected to the passed + * orb, the method will try to connect it to that orb on POA, returned + * by the method {@link #_default_POA}. That method can be overridden to + * get poa where the object must be automatically connected when + * calling this method. + * + * @param an_orb the ORB with relate to that the object is requested. + */ + public final org.omg.CORBA.Object _this_object(ORB an_orb) + { + if (delegate != null) + return delegate.this_object(this); + else + { + if (an_orb instanceof ORB_1_4) + { + ORB_1_4 m_orb = (ORB_1_4) an_orb; + + gnuPOA dp = (gnuPOA) _default_POA(); + if (dp == null) + dp = m_orb.rootPOA; + + try + { + return dp.servant_to_reference(this); + } + catch (WrongPolicy unexp) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.minor = Minor.Policy; + bad.initCause(unexp); + throw bad; + } + catch (ServantNotActive ex) + { + try + { + return dp.id_to_reference(dp.activate_object(this)); + } + catch (Exception unexp) + { + unexp.initCause(ex); + + BAD_OPERATION bad = new BAD_OPERATION(); + bad.minor = Minor.Activation; + bad.initCause(unexp); + throw bad; + } + } + } + } + throw new OBJECT_NOT_EXIST(); + } + + /** + * Obtains the CORBA object reference that is a current invocation target for + * the given servant. This is important when the same servant serves + * multiple objects. This method required the servant to be connected + * to a single orb, and a delegate set. + * + * This method returns correct values even when the same + * servant serves several objects in parallel threads. The ORB maintains the + * thread to invocation data map for all calls that are currently being + * processed. + */ + public final org.omg.CORBA.Object _this_object() + { + if (delegate != null) + return _this_object(_orb()); + else + { + POA def = _default_POA(); + if (def instanceof gnuPOA) + return _this_object(((gnuPOA) def).orb()); + } + throw new OBJECT_NOT_EXIST(); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivator.java b/libjava/classpath/org/omg/PortableServer/ServantActivator.java new file mode 100644 index 000000000..82cfbda0d --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivator.java @@ -0,0 +1,59 @@ +/* ServantActivator.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.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The POA, that has the RETAIN policy uses servant managers that are + * ServantActivators. The operations, that must be supported by these + * managers, are defined separately in {@link ServantActivatorOperations}. + * + * @see ServantLocator + * @see ServantRetentionPolicyValue + * @see ServantManager + * @see POAOperations#set_servant_manager + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantActivator + extends ServantManager, ServantActivatorOperations, IDLEntity, + org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java new file mode 100644 index 000000000..d0fe8732c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java @@ -0,0 +1,170 @@ +/* ServantActivatorHelper.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.PortableServer; + +import gnu.CORBA.Minor; +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.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 ServantActivator}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServantActivatorHelper +{ + /** + * Get the type code of the {@link ServantActivator}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "ServantActivator"); + } + + /** + * Insert the ServantActivator into the given Any. + * + * @param any the Any to insert into. + * @param that the ServantActivator to insert. + */ + public static void insert(Any any, ServantActivator that) + { + any.insert_Object(that); + } + + /** + * Extract the ServantActivator from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ServantActivator. + */ + public static ServantActivator extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the ServantActivator repository id. + * + * @return "IDL:omg.org/PortableServer/ServantActivator:2.3", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/ServantActivator:2.3"; + } + + /** + * Casts the passed object into the ServantActivator. + * + * @param obj the object to cast. + * @return casted instance. + * @throws BAD_PARAM if the passed object is not a ServantActivator. + */ + public static ServantActivator narrow(org.omg.CORBA.Object obj) + { + try + { + return (ServantActivator) obj; + } + catch (ClassCastException ex) + { + BAD_PARAM bad = new BAD_PARAM(); + bad.initCause(ex); + throw bad; + } + } + + /** + * Narrow the given object to the ServantActivator. 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 ServantActivator. + * + * @since 1.5 + */ + public static ServantActivator unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + + /** + * This should read the servant activator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static ServantActivator read(InputStream input) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } + + /** + * This should write the servant activator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static void write(OutputStream output, ServantActivator value) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorOperations.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorOperations.java new file mode 100644 index 000000000..22fba9d9e --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorOperations.java @@ -0,0 +1,94 @@ +/* ServantActivatorOperations.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.PortableServer; + + +/** + * Defines the operations, applicable to the {@link ServantActivator}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantActivatorOperations + extends ServantManagerOperations +{ + /** + * This method is invoked whenever a servant for an object is deactivated, + * assuming the POA has the USE_SERVANT_MANAGER and RETAIN policies. + * + * @param Object_Id the Id of the object being deactivated. + * + * @param poa the POA in those scope the object was active. + * + * @param servant the servant, serving the object being deactivated. + * + * @param cleanup_in_progress if true, this method was called from due + * deactivation or destruction operation. False indicates that the method + * was called due other reasons. + * + * @param remaining_activations if true, at the invocation moment the + * passed servant is also associated with other objects in the active + * object map of the given POA. + */ + void etherealize(byte[] Object_Id, POA poa, Servant servant, + boolean cleanup_in_progress, boolean remaining_activations + ); + + /** + * This method is invoked whenever the POA receives a request for an + * object that is not currently active, assuming the POA has the + * USE_SERVANT_MANAGER and RETAIN policies. The user-supplied servant + * manager is responsible for locating or creating an appropriate servant + * that corresponds to the ObjectId value. The subsequent requests with + * the same ObjectId value will be delivered directly to that servant + * without invoking the servant manager. + * + * @param Object_Id the ObjectId value associated with the incoming request. + * @param poa the POA in which the object is being activated. + * + * @return a servant that will be used to process the incoming request. + * + * @throws ForwardRequest if the activator decides to forward the request + * to another object. The exception contains the object that should + * handle this request. This object is usually remote, but can also + * be local. The throws exception will forward all subsequent requests + * till the new activation. + */ + Servant incarnate(byte[] Object_Id, POA poa) + throws ForwardRequest; +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorPOA.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorPOA.java new file mode 100644 index 000000000..a6460fa14 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorPOA.java @@ -0,0 +1,137 @@ +/* ServantActivatorPOA.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.PortableServer; + +import gnu.CORBA.Poa.gnuServantObject; + +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; + +/** + * <p>This ServantActivator stub is an optional base for the + * servant activators. This stub cannot serve remote invocations, as + * methods in {@link ServantActivatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant activator from this stub, + * it is enough to implement the {@link ServantActivator} interface. + * But you may choose to do this if you need the functional + * {@link #_all_interfaces(POA, byte[])} method or want to keep default + * behavior during the incarnation or etherialization. + * </p> + */ +public abstract class ServantActivatorPOA + extends Servant + implements InvokeHandler, ServantActivatorOperations +{ + /** + * Used to access the outer class in the nested delegator class. + */ + final ServantActivatorPOA THIS = this; + + /** + * This class is used to support _this. + */ + class delegator + extends gnuServantObject + implements ServantActivator + { + delegator(Servant s) + { + super(s, new byte[ 0 ], null, null); + } + + public Servant incarnate(byte[] key, POA poa) + throws org.omg.PortableServer.ForwardRequest + { + return THIS.incarnate(key, poa); + } + + public void etherealize(byte[] key, POA poa, Servant servant, + boolean cleanup, boolean remains + ) + { + THIS.etherealize(key, poa, servant, cleanup, remains); + } + } + + /** + * Our implementation will not call this method. After setting your + * manager to POA, it will call incarnate and etherialize directly. + */ + public OutputStream _invoke(String method, InputStream input, + ResponseHandler handler + ) + throws SystemException + { + throw new NO_IMPLEMENT(); + } + + /** + * Returns an array of interfaces, supported by the servant activator. + */ + public String[] _all_interfaces(POA poa, byte[] Object_Id) + { + return new _ServantActivatorStub()._ids(); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantActivator _this() + { + return new delegator(this); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantActivator _this(ORB orb) + { + return new delegator(this); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocator.java b/libjava/classpath/org/omg/PortableServer/ServantLocator.java new file mode 100644 index 000000000..564048d45 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocator.java @@ -0,0 +1,59 @@ +/* ServantLocator.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.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * When the POA has the NON_RETAIN policy it uses servant managers that are + * ServantLoacators. The operations, that must be supported by these managers, + * are defined separately in {@link ServantLocatorOperations}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + * + * @see ServantActivator + * @see ServantRetentionPolicyValue + * @see ServantManager + * @see POAOperations#set_servant_manager + */ +public interface ServantLocator + extends ServantManager, ServantLocatorOperations, IDLEntity, + org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java new file mode 100644 index 000000000..f22fff9eb --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java @@ -0,0 +1,170 @@ +/* ServantLocatorHelper.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.PortableServer; + +import gnu.CORBA.Minor; +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.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 ServantLocator}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServantLocatorHelper +{ + /** + * Get the type code of the {@link ServantLocator}. + */ + public static TypeCode type() + { + return OrbRestricted.Singleton.create_interface_tc(id(), "ServantLocator"); + } + + /** + * Insert the ServantLocator into the given Any. + * + * @param any the Any to insert into. + * @param that the ServantLocator to insert. + */ + public static void insert(Any any, ServantLocator that) + { + any.insert_Object(that); + } + + /** + * Extract the ServantLocator from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ServantLocator. + */ + public static ServantLocator extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the ServantLocator repository id. + * + * @return "org.omg.PortableServer.ServantLocatorOperations", always. + */ + public static String id() + { + return "org.omg.PortableServer.ServantLocatorOperations"; + } + + /** + * Cast the passed object into the ServantLocator. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a ServantLocator. + */ + public static ServantLocator narrow(org.omg.CORBA.Object obj) + { + try + { + return (ServantLocator) obj; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.minor = Minor.ClassCast; + bad.initCause(ex); + throw bad; + } + } + + /** + * Narrow the given object to the ServantLocator. 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 ServantLocator. + * + * @since 1.5 + */ + public static ServantLocator unchecked_narrow(org.omg.CORBA.Object obj) + { + return narrow(obj); + } + + /** + * This should read the servant locator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static ServantLocator read(InputStream input) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } + + /** + * This should write the servant activator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static void write(OutputStream output, ServantLocator value) + { + MARSHAL m = new MARSHAL("Inappropriate"); + m.minor = Minor.Inappropriate; + throw m; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorOperations.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorOperations.java new file mode 100644 index 000000000..4f357576a --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorOperations.java @@ -0,0 +1,96 @@ +/* ServantLocatorOperations.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.PortableServer; + +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; + +/** + * Defines the operations, applicable to the {@link ServantLocator}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantLocatorOperations + extends ServantManagerOperations +{ + /** + * If the POA has the USE_SERVANT_MANAGER and NON_RETAIN policies, it + * invokes this method whenever the object being requested that is not + * inactive. This method has access to all details of the received + * request and can use them to choose between servaral alternative servants. + * It can also forward the request to another server. + * + * @param Object_Id the id of the object, on which the request was called. + * @param poa the POA in those scope the object is active. + * @param operation the name of the method or operation being invoked. + * @param cookie_holder the holder where the servant manager can store + * an arbitrary java.lang.Object. This object will be later passed as a + * <code>cookie</code> parameter for {@link #postinvoke}, to create tie + * between preinvoke and postinvoke. The application should <i>not</i> + * suppose that each call of preinvoke is followed by the subsequent + * postinvoke for the same invocation; under multi threaded policy these + * calls may be intermixed. + * + * @return a servant that will serve the incoming request. + * + * @throws ForwardRequest if the locator decides to forward the request + * to another object. The exception contains the object that should + * handle this request. This object is usually remote, but can also + * be local. As <code>preinvoke</code> is called on each method + * invocation, the thrown exception will forward only this current request. + */ + Servant preinvoke(byte[] Object_Id, POA poa, String operation, + CookieHolder cookie_holder + ) + throws ForwardRequest; + + /** + * If the POA has the USE_SERVANT_MANAGER and NON_RETAIN policies, it + * invokes this method whenever a servant completes a request. + * + * @param Object_Id the id of the object, on which the request was called. + * @param poa the POA in those scope the object is active. + * @param operation the name of the method or operation that was invoked. + * @param cookie the object that has been previously set by preinvoke in + * the <code>cookie_holder</code> parameter. + * @param servant the servant, associated with the object. + */ + void postinvoke(byte[] Object_Id, POA poa, String operation, + java.lang.Object cookie, Servant servant + ); +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorPOA.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorPOA.java new file mode 100644 index 000000000..c598aa8bd --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorPOA.java @@ -0,0 +1,146 @@ +/* ServantLocatorPOA.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.PortableServer; + +import gnu.CORBA.Poa.gnuServantObject; + +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; + +/** + * <p>The ServantLocator stub is an optional base for the + * servant locators. It cannot serve remote invocations, as + * methods in {@link ServantLocatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant locator from this stub, + * it is enough to implement the {@link ServantLocator} interface. + * But you may choose to do this if you need its functional + * {@link org.omg.PortableServer.ServantActivatorPOA.delegator#_ids()} + * method or want to keep default behaviour during pre- or post- invokcations. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ServantLocatorPOA + extends Servant + implements ServantLocatorOperations, InvokeHandler +{ + /** + * Used to access the outer class in the nested classes. + */ + final ServantLocatorPOA THIS = this; + + /** + * Our implementation will not call this method. After setting your + * manager to POA, it will call incarnate and etherialize directly. + */ + public OutputStream _invoke(String method, InputStream input, + ResponseHandler handler + ) + throws SystemException + { + throw new NO_IMPLEMENT(); + } + + /** + * Returns an array of interfaces, supported by the servant locator. + */ + public String[] _all_interfaces(POA poa, byte[] Object_Id) + { + return new _ServantLocatorStub()._ids(); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantLocator _this() + { + return new delegator(this); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantLocator _this(ORB orb) + { + return new delegator(this); + } + + /** + * This class is used to support _this. + */ + class delegator + extends gnuServantObject + implements ServantLocator + { + delegator(Servant s) + { + super(s, new byte[ 0 ], null, null); + } + + public Servant preinvoke(byte[] Object_Id, POA poa, String method, + CookieHolder cookie_holder + ) + throws org.omg.PortableServer.ForwardRequest + { + return THIS.preinvoke(Object_Id, poa, method, cookie_holder); + } + + public void postinvoke(byte[] Object_Id, POA poa, String method, + java.lang.Object cookie, Servant servant + ) + { + THIS.postinvoke(Object_Id, poa, method, cookie, servant); + } + + public String[] _ids() + { + return THIS._all_interfaces(null, null); + } + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java new file mode 100644 index 000000000..ff23e7fd1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java @@ -0,0 +1,114 @@ +/* CookieHolder.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.PortableServer.ServantLocatorPackage; + +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The CookieHolder is used together with the + * {@link org.omg.PortableServer.ServantLocator}, allowing the + * {@link org.omg.PortableServer.ServantLocatorOperations#preinvoke} + * to return an arbitrary java.lang.Object that will be later passed to + * {@link org.omg.PortableServer.ServantLocatorOperations#postinvoke}. + * + * @see org.omg.PortableServer.ServantLocatorOperations + * @see org.omg.PortableServer.ServantManager + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class CookieHolder + implements Streamable +{ + /** + * The wrapped java.lang.Object. + */ + public java.lang.Object value; + + /** + * Create the unitialised instance of this holder. + */ + public CookieHolder() + { + } + + /** + * Create the instance, intialising the {@link #value} field to the passed + * value. + */ + public CookieHolder(java.lang.Object initial) + { + value = initial; + } + + /** + * java.lang.Object is outside the scope of the CORBA standards and the read + * operation cannot be supported in a language-neutral way. + * + * @throws NO_IMPLEMENT always. + */ + public void _read(InputStream input) + { + throw new NO_IMPLEMENT(); + } + + /** + * There is no CORBA typecode that would specifically match a java.lang.Object. + * + * @throws NO_IMPLEMENT always. + */ + public TypeCode _type() + { + throw new NO_IMPLEMENT(); + } + + /** + * java.lang.Object is outside the scope of the CORBA standards and the write + * operation cannot be supported in a language-neutral way. + * + * @throws NO_IMPLEMENT always. + */ + public void _write(OutputStream output) + { + throw new NO_IMPLEMENT(); + } +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorPackage/package.html b/libjava/classpath/org/omg/PortableServer/ServantLocatorPackage/package.html new file mode 100644 index 000000000..58106e25f --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorPackage/package.html @@ -0,0 +1,49 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.PortableServer.ServantLocatorPackage</title> +</head> + +<body> +<p>Contains a holder, transferring the data between subsequent + calls of the Servant Manager methods.</p> + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> diff --git a/libjava/classpath/org/omg/PortableServer/ServantManager.java b/libjava/classpath/org/omg/PortableServer/ServantManager.java new file mode 100644 index 000000000..f361f0430 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantManager.java @@ -0,0 +1,56 @@ +/* ServantManager.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.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * A servant manager is associated with POA and provide possibility + * to activate objects on demand. A servant manager interface itself + * is empty, but it is inherited by other two interfaces, + * {@link ServantActivator} and {@link ServantLocator}. + * + * @see POAOperations#set_servant_manager + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantManager + extends ServantManagerOperations, IDLEntity, org.omg.CORBA.Object +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantManagerOperations.java b/libjava/classpath/org/omg/PortableServer/ServantManagerOperations.java new file mode 100644 index 000000000..374b791a1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantManagerOperations.java @@ -0,0 +1,54 @@ +/* ServantManagerOperations.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.PortableServer; + +/** + * This interface would define the operations, applicable to + * the ServantManager. A servant manager interface itself + * is empty, but it is inherited by other two interfaces, + * {@link ServantActivator} and {@link ServantLocator}. + * + * @see ServantActivatorOperations + * @see ServantLocatorOperations + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantManagerOperations +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicy.java b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicy.java new file mode 100644 index 000000000..3da47d3d8 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicy.java @@ -0,0 +1,58 @@ +/* ServantRetentionPolicy.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.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies if the active servants should be retained in the + * Active Object Map. + * + * The policy can return its current value, as defined. + * in {@link ServantRetentionPolicyOperations}. + * + * @see ServantRetentionPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantRetentionPolicy + extends Policy, ServantRetentionPolicyOperations, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyOperations.java new file mode 100644 index 000000000..3a9ee0a7c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyOperations.java @@ -0,0 +1,55 @@ +/* ServantRetentionPolicyOperations.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.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the ServantRetentionPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantRetentionPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + ServantRetentionPolicyValue value(); +} diff --git a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java new file mode 100644 index 000000000..4dffe7d7f --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java @@ -0,0 +1,155 @@ +/* ServantRetentionPolicyValue.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.PortableServer; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** +* Specifies the servant retention policy. +* +* This enumeration can obtain the following values: +* <ul> +* <li>RETAIN The POA retains active servants in its Active Object Map.</li> +* <li>NON_RETAIN The servants are not retained.</li> +* </ul> +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public class ServantRetentionPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (V1.4) for interoperability. + */ + private static final long serialVersionUID = -7476100336036943822L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (RETAIN). + */ + public static final int _RETAIN = 0; + + /** + * An instance of ServantRetentionPolicyValue, indicating that + * the POA retains active servants in its Active Object Map. + */ + public static final ServantRetentionPolicyValue RETAIN = + new ServantRetentionPolicyValue(_RETAIN); + + /** + * The possible value of this enumeration (NON_RETAIN). + */ + public static final int _NON_RETAIN = 1; + + /** + * An instance of ServantRetentionPolicyValue, indicating that + * the POA does not use the Active Object Map. + */ + public static final ServantRetentionPolicyValue NON_RETAIN = + new ServantRetentionPolicyValue(_NON_RETAIN); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final ServantRetentionPolicyValue[] enume = + new ServantRetentionPolicyValue[] { RETAIN, NON_RETAIN }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "RETAIN", "NON_RETAIN" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected ServantRetentionPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the ServantRetentionPolicyValue, matching the given integer constant. + * + * @param code one of _RETAIN, _NON_RETAIN. + * @return one of RETAIN, NON_RETAIN. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static ServantRetentionPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); + bad.minor = Minor.PolicyType; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the policy value. + * @return _RETAIN or _NON_RETAIN. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/THREAD_POLICY_ID.java b/libjava/classpath/org/omg/PortableServer/THREAD_POLICY_ID.java new file mode 100644 index 000000000..ef0427dde --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/THREAD_POLICY_ID.java @@ -0,0 +1,52 @@ +/* THREAD_POLICY_ID.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.PortableServer; + + /** + * Holds an integer {@link ThreadPolicy} identifier. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface THREAD_POLICY_ID +{ + /** + * Specifies the THREAD_POLICY_ID value, 16. + */ + int value = 16; +} diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicy.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicy.java new file mode 100644 index 000000000..77fe0a67c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicy.java @@ -0,0 +1,57 @@ +/* ThreadPolicy.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.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the POA thread policy. + * + * The policy can return its current value, as defined. + * in {@link ThreadPolicyOperations}. + * + * @see ThreadPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ThreadPolicy + extends Policy, ThreadPolicyOperations, IDLEntity +{ +} diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicyOperations.java new file mode 100644 index 000000000..09835614f --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicyOperations.java @@ -0,0 +1,55 @@ +/* ThreadPolicyOperations.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.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the ThreadPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ThreadPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + ThreadPolicyValue value(); +} diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java new file mode 100644 index 000000000..4e1422dcd --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java @@ -0,0 +1,168 @@ +/* ThreadPolicyValue.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.PortableServer; + +import gnu.CORBA.Minor; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines the possible values for the POA thread policy. + * + * This enumeration can obtain the following values: + * <ul> + * <li>ORB_CTRL_MODEL Each object in POA has a separate serving thread + * and a separate server socket, listening on the objects individual + * port. Additionally, when the request is accepted, it is also + * served in a separate thread, so several requests to the same + * object can be processed in parallel. The servant can always get + * the Id and POA of the object it is currently serving by + * invoking {@link Servant#_object_id()} and {@link Servant#_poa}. + * These two methods use thread to data map and must work correctly + * even then the servant code is executed in several parallel threads. + * </li> + * <li>SINGLE_THREAD_MODEL All objects in POA share the same server + * socket and are served in the same thread. This model is applicable + * when the number of objects is greater than the number of threads + * and (or) ports, supported by the system.</li> + * </ul> + * OMG also defines a MAIN_THREAD_MODEL, currently not supported by + * the java API. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ThreadPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -8874988828297141512L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (ORB_CTRL_MODEL). + */ + public static final int _ORB_CTRL_MODEL = 0; + + /** + * An instance of ThreadPolicyValue, initialized to ORB_CTRL_MODEL. + */ + public static final ThreadPolicyValue ORB_CTRL_MODEL = + new ThreadPolicyValue(_ORB_CTRL_MODEL); + + /** + * The possible value of this enumeration (SINGLE_THREAD_MODEL). + */ + public static final int _SINGLE_THREAD_MODEL = 1; + + /** + * An instance of ThreadPolicyValue, initialized to SINGLE_THREAD_MODEL. + */ + public static final ThreadPolicyValue SINGLE_THREAD_MODEL = + new ThreadPolicyValue(_SINGLE_THREAD_MODEL); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final ThreadPolicyValue[] enume = + new ThreadPolicyValue[] { ORB_CTRL_MODEL, SINGLE_THREAD_MODEL }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "ORB_CTRL_MODEL", "SINGLE_THREAD_MODEL" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected ThreadPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the ThreadPolicyValue, matching the given integer constant. + * + * @param code one of _ORB_CTRL_MODEL, _SINGLE_THREAD_MODEL. + * @return one of ORB_CTRL_MODEL, SINGLE_THREAD_MODEL. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static ThreadPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code); + bad.minor = Minor.PolicyType; + throw bad; + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the enumeration value. + * @return one of ORB_CTRL_MODEL, SINGLE_THREAD_MODEL. + */ + public int value() + { + return _value; + } +} diff --git a/libjava/classpath/org/omg/PortableServer/_ServantActivatorStub.java b/libjava/classpath/org/omg/PortableServer/_ServantActivatorStub.java new file mode 100644 index 000000000..658ac683c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/_ServantActivatorStub.java @@ -0,0 +1,124 @@ +/* _ServantActivatorStub.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.PortableServer; + +import java.io.Serializable; + +import org.omg.CORBA.portable.ObjectImpl; + +/** + * <p>This ServantActivator stub is an optional base for the + * servant activators. This stub cannot accept remote invocations, as + * methods in {@link ServantActivatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant activator from this stub, + * it is enough to implement the {@link ServantActivator} interface. + * But you may choose to do this if you need the functional + * {@link #_ids()} method or want to keep default behavior during + * the incarnation or etherialization. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _ServantActivatorStub + extends ObjectImpl + implements ServantActivator, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -685959979577281419L; + + /** + * This the purpose of this field is undocumented up till 1.5 java API + * inclusive. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = ServantActivatorOperations.class; + + /** + * Return the array of repository ids for this object. + * + * @return { "IDL:omg.org/PortableServer/ServantActivator:2.3", + * "IDL:omg.org/PortableServer/ServantManager:1.0" }, always. + */ + public String[] _ids() + { + return new String[] + { + "IDL:omg.org/PortableServer/ServantActivator:2.3", + "IDL:omg.org/PortableServer/ServantManager:1.0" + }; + } + + /** + * It is your responsibility to handle the incarnation event and + * supply the servant. Override this method if using the class. + * The default method instructs POA that the servant cannot be + * provided by activator. The OBJ_ADAPTER exception will be + * thrown by POA, unless the servant is provided as one of the + * parameters in the activation method. + * + * @see ServantActivatorOperations#incarnate + * + * @specnote in GNU Classpath, returning null means that the + * activator does not supply the servant. + * + * @throws ForwardRequest + */ + public Servant incarnate(byte[] Object_id, POA poa) + throws ForwardRequest + { + return null; + } + + /** + * It is your responsibility to handle the etherialization event. + * Override this method if using the class. The default method + * does nothing. + * + * @see ServantActivatorOperations#incarnate + */ + public void etherealize(byte[] Object_id, POA poa, Servant servant, + boolean cleanup, boolean remaining + ) + { + } +} diff --git a/libjava/classpath/org/omg/PortableServer/_ServantLocatorStub.java b/libjava/classpath/org/omg/PortableServer/_ServantLocatorStub.java new file mode 100644 index 000000000..039140ebc --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/_ServantLocatorStub.java @@ -0,0 +1,133 @@ +/* _ServantLocatorStub.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.PortableServer; + +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; + +import java.io.Serializable; + +/** + * <p>The ServantLocator stub is an optional base for the + * servant locators. This stub cannot accept remote invocations, as + * methods in {@link ServantLocatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant locator from this stub, + * it is enough to implement the {@link ServantLocator} interface. + * But you may choose to do this if you need its functional + * {@link #_ids()} method or want to keep default behavior during per- + * or post- invokcations. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _ServantLocatorStub + extends ObjectImpl + implements ServantLocator, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2374963516905770111L; + + /** + * This the purpose of this field is undocumented up till 1.5 java API + * inclusive. + */ + @SuppressWarnings("unchecked") // Needed for API compatibility + public static final Class _opsClass = ServantLocatorOperations.class; + + /** + * The package private string, used as a parameter for + * the throws NullPointerExceptions in both servant locator and activator + * stubs. + */ + static final String OVERRIDE = "Override this method to get functionality."; + + /** + * Return the array of repository ids for this object, stating that it is + * both Servant locator and Servant manager. + * + * @return { "IDL:omg.org/PortableServer/ServantLocator:1.0", + * "IDL:omg.org/PortableServer/ServantManager:1.0" }, always. + */ + public String[] _ids() + { + return new String[] + { + "IDL:omg.org/PortableServer/ServantLocator:1.0", + "IDL:omg.org/PortableServer/ServantManager:1.0" + }; + } + + /** + * It is your responsibility to take the preinvoke actions, if any, + * and also supply an appropriate servant for the current invocation. + * + * The default method instructs POA that the servant cannot be + * provided by locator. The OBJ_ADAPTER exception will be + * thrown by POA, unless it uses the available default servant for all + * invocations. + * + * @specnote in GNU Classpath, returning null means that the + * locator does not supply the servant. + * + * @see ServantLocatorOperations#preinvoke + */ + public Servant preinvoke(byte[] Object_id, POA poa, String method, + CookieHolder cookie + ) + throws ForwardRequest + { + return null; + } + + /** + * It is your responsibility to take the postinvoke actions, if any, + * by overriding this method. The default method does nothing. + * + * @see ServantLocatorOperations#postinvoke + */ + public void postinvoke(byte[] Object_id, POA poa, String method, + Object cookie, Servant servant + ) + { + } +} diff --git a/libjava/classpath/org/omg/PortableServer/package.html b/libjava/classpath/org/omg/PortableServer/package.html new file mode 100644 index 000000000..e4a74ef1a --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/package.html @@ -0,0 +1,231 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in org.omg.PortableServer package + 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. --> + +<html> +<head><title>GNU Classpath - The Portable Object Adapter package</title></head> +<body> +<p> +The Portable Object Adapter (POA) provides more control on the request +processing than it is possible when connecting objects directly to the +ORB. The POA model defines a tree structure of POAs, the root POA being +connected directly to the ORB. Any branch of this tree can be temporary or +permanently inactivated using {@link org.omg.PortableServer.POAManager}. +The same manager can control several branches in the POA tree. Also, +any branch in this tree can have different processing options (policies). +</p><p> +The newly created POA is in holding state, just queuing requests. To start +processing requests, it must be turned into the active state by its +{@link org.omg.PortableServer.POAManagerOperations#activate}. +</p><p> +The previously monolite object implementation is now divided into object +(that implements {@link org.omg.CORBA.Object}) +and servant (that implements either {@link org.omg.CORBA.portable.InvokeHandler} +or {@link org.omg.PortableServer.DynamicImplementation}). +Frequently each object has its own servant, but it can also be a single servant +per multiple objects and also default servant for POA +(see {@link org.omg.PortableServer.POAOperations#set_servant}). Each object +has its own Object Id, unique in the scope of the POA, where the object is +connected. These Ids need not be different for objects belonging +to different POAs, even if these POAs are connected to the same ORB. +Under the USER_ID is assignment policy this Id can be a specified by user in +{@link org.omg.PortableServer.POAOperations#activate_object_with_id}, +encapsulating some meaningful information about the object. The Id of the +object being currently served can be identified with +{@link org.omg.PortableServer.Servant#_object_id}. This approach is used in cases +when it is possible to encapsulate all object-related data into the +Object Id. Such system only needs one servant, one server socket and one +socket port per POA that can handle thounsands of objects. +</p><p> +Instead of being connected directly to the ORB, objects are now connected +to one of the ORBs POAs. Since JDK 1.4 the application specific implementation +base is derived from the {@link org.omg.PortableServer.Servant}, having a +different name pattern (<code>*POA.java</code> instead of the previous +<code>_*ImplBase.java</code>). This <code>*POA</code> suffix does <i>not</i> +mean that these servants implement or are derived from POA. They are different +classes that can be connected to one of the POAs, by instance, using +{@link org.omg.PortableServer.POAOperations#servant_to_reference}. +The implementation base also inherits an *Operations interface, containing +definitions of the application specific methods. The application programmer +writes a descendent of the implementation base, implementing these methods +for the application - specific functionality. +</p><p> +The POA objects support the method invocation by name, using +{@link org.omg.CORBA.Request}. This alternative method works without the +service-specific classes that may not be available at run time. +</p><p> +The objects in POA can also be activated and inactivated independently. It +is possible to set a listener ({@link org.omg.PortableServer.ServantActivator}) +that would register the object activations ("incarnations") and deactivations +("etherializations"). The servant need not be specifyed when creating an +object. Under the IMPLICIT_ACTIVATION +{@link org.omg.PortableServer.ImplicitActivationPolicy} +the {@link org.omg.PortableServer.ServantActivator} can provide the servant +in response to the first (local or remote) call of any method on the +previously incative object. +</p><p> +The root POA is obtained by resolving the initial reference "RootPOA" +for the orb. In the simpliest case the objects can be connected directly +to that root POA without creating the POA tree. The policies, used by +the root POA, are defined by OMG as following: +<table border="1"> +<tr><th>Policy type</th><th>Accepted policy</th></tr> +<tr><td>{@link org.omg.PortableServer.IdAssignmentPolicy} </td><td>SYSTEM_ID +(Ids are created by POA)</td></tr> +<tr><td>{@link org.omg.PortableServer.IdUniquenessPolicy}</td><td>UNIQUE_ID + (single object (and Id) per servant) +</td></tr> +<tr><td>{@link org.omg.PortableServer.ImplicitActivationPolicy} </td><td> +IMPLICIT_ACTIVATION (if inactive, activate)</td></tr> +<tr><td>{@link org.omg.PortableServer.LifespanPolicy} </td><td>TRANSIENT +(the POA objects cannot outlive POA)</td></tr> +<tr><td>{@link org.omg.PortableServer.RequestProcessingPolicy} </td><td> +USE_ACTIVE_OBJECT_MAP_ONLY (the servant is provided during activation)</td></tr> +<tr><td>{@link org.omg.PortableServer.ServantRetentionPolicy} </td><td> +RETAIN (retain servants for subsequent invocations)</td></tr> +<tr><td>{@link org.omg.PortableServer.ThreadPolicy} </td><td>ORB_CTRL_MODEL +(single thread per request and single server socket per object)</td></tr> +</table> +These values are also default for the child POAs The policies are +<i>never</i> inherited from the parent POA. +</p><p> +This set of policies means that each object will have a separate serving +thread, separate network socket port and usually a separate servant. It +is appropriate when the expected number of objects is not too large. +If the expected number of objects is larger than the supportable number +of threads and socket ports, the SINGLE_THREAD_MODEL +{@link org.omg.PortableServer.ThreadPolicy} is +used. Then all objects in POA with this policy are served in a single +thread, using the same server socket, connected to a single port. If the +request processing policy is additionally set to USE_DEFAULT_SERVANT, +all objects of this POA share the same (default) servant. +</p><p> +The operations, supported by POA are defined +separately in {@link org.omg.PortableServer.POAOperations}. +</p><p> +<h3>The typical POA usage scenarios</h3> +<h4>POA converts servant to the object reference</h4> +In the simpliest case, the servant implementation is connected to POA by +{@link org.omg.PortableServer.POAOperations#servant_to_reference}, the +returned object being a target of remote and local invocations. +It may be converted into the stringified reference, registered with +the naming service, used locally or, when serving or invoking local or remote +method, passed as a parameter or return value having the CORBA Object type. +The object obtains Id from POA and is activated due default implicit +activation policy. This scenario is supported by the default policy set +and is used in the most of the "hello world" examples. +<h4>Servant provides to the object reference</h4> +The servant can be connected to an ORB by +{@link org.omg.PortableServer.Servant#_this_object(org.omg.CORBA.ORB)}, +obtaining the object reference. The overridable +{@link org.omg.PortableServer.Servant#_default_POA()} +specifies POA to that the servant will be connected. The default method +connects to the root poa. IDL compilers frequently generate the +<code>_this(ORB)</code> metod for servants for getting the object reference +that is already narrowed to the exact object type. +<h4>Explicit activation with POA assigned ids</h4> +The objects are activated by calling the +{@link org.omg.PortableServer.POAOperations#activate_object} on the +POA with the object in question. The POA allocates, assigns, and +returns a unique identity value for the object. This scenario requires the +SYSTEM_ID {@link org.omg.PortableServer.IdAssignmentPolicy}. +<h4>Explicit Activation with User-assigned Ids</h4> +The POA supports an explicit activation operation, +{@link org.omg.PortableServer.POAOperations#activate_object_with_id}, +that associates a servant with the user-defined Object Id. +This scenario requires the USER_ID +{@link org.omg.PortableServer.IdAssignmentPolicy}. The servant manager +may be or may not be used. +<h4>References before activation</h4> +It may be useful to create references for objects before activating them. +Such reference can be created using +{@link org.omg.PortableServer.POAOperations#create_reference} or +{@link org.omg.PortableServer.POAOperations#create_reference_with_id}, both +methods also requiring to give the object repository id. Such object may +be later activated either by +{@link org.omg.PortableServer.POAOperations#activate_object_with_id} or +automatically, if the IMPLICIT_ACTIVATION policy applies. +<h4>Multiple Ids per servant</h4> +If the MULTIPLE_ID policy applies, the servant may be activated many times. +Under this policy, +{@link org.omg.PortableServer.POAOperations#servant_to_reference} +and {@link org.omg.PortableServer.POAOperations#servant_to_id} +during each call create a new object and object reference for the +used servant. +<h4>One servant for all objects</h4> +If the USE_DEFAULT_SERVANT policy applies, that default servant serves all +objects, belonging this POA. This approach is used when there is +very little data associated with each object, so little that the data can be +encoded in the Object Id. Also, it may be needed when a very large +number of objects is expected. If the RETAIN applies, it is possible to +activate an object explicitly setting the servant other than default. +If NO_RETAIN applies, the default servant will serve all known an +unknown objects for that POA. +<h4>Single Servant, Many Objects and Types</h4> +Combining USER_ID, USE_DEFAULT_SERVANT and RETAIN, it is possible to +create and serve objects "on the fly". The servant must determine the +object type (for instance, from the value of the agreed attribute, +shared by all supported types, or from the Object Id) and be able to +handle the method, named in request. If the names and parameter lists +of the object methods are also created "on the fly", the requests +to such object can still be submitted using {@link org.omg.CORBA.Request}. +This method is used when the created object represents some +entity in the complex database. +<h4>The ServantLocator finds a servant for each call</h4> +The {@link org.omg.PortableServer.ServantLocator} is used by POAs that +combinine NON_RETAIN and USE_SERVANT_MANAGER policies. It provides +a new or reused servant every time the invocation is made. The servant +locator must provide a servant in response of calling +{@link org.omg.PortableServer.ServantLocatorOperations#preinvoke}. +This method has access the the Id of the object being served and +the name of the method being called. It must return the appropriate +instance of the servant or throw an exception, forwarding the request +to another object (usually in another server). After the invocation, +a {@link org.omg.PortableServer.ServantLocatorOperations#postinvoke} +is called. It should be not assumed that the call of <code>preinvoke</code> +will be followed by the call of the <code>postinvoke</code>; in +multithreaded environment these calls are not serialized in this way. If +the <code>preinvoke</code> has to tell something this-call-specific to +the <code>postinvoke</code>, it must use the provided cookie holder. +The <code>preinvoke/postinoke</code> are also called to provide a servant +during each local invocation on the objects, belonging to the described POA. +</p><p> +All these scenarios must work with the current GNU Classpath release. + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> diff --git a/libjava/classpath/org/omg/PortableServer/portable/Delegate.java b/libjava/classpath/org/omg/PortableServer/portable/Delegate.java new file mode 100644 index 000000000..32697fdfb --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/portable/Delegate.java @@ -0,0 +1,112 @@ +/* DelegateOperations.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.PortableServer.portable; + +import org.omg.CORBA.ORB; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; + +/** + * Each {@link Servant} has an associated delegate, where the most of the calls + * are forwarded. The delegate is responsible for providing the actual + * functionality. This class is required to supports a conceptions of + * the CORBA 2.3.1 Servant. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Delegate +{ + /** + * Returns the root POA of the ORB instance, associated with this servant. + * It is the same POA that would be returned by resolving the initial + * reference "RootPOA" for that orb. The default {@link Servant#_default_POA()} + * method forwards call to the delegate can be overridden to + * obtain the alternative default POA. + * + * @see ORB#resolve_initial_references + */ + POA default_POA(Servant a_servant); + + /** + * Get the interface repository defintion + * <code>InterfaceDef</code> for this Object. + */ + org.omg.CORBA.Object get_interface_def(Servant a_servant); + + /** + * Checks if the passed servant is an instance of the given CORBA IDL type. + * + * @param a_servant a servant to check. + * @param an_id a repository ID, representing an IDL type for that the + * servant must be checked. + * + * @return true if the servant is an instance of the given type, false + * otherwise. + */ + boolean is_a(Servant a_servant, String an_id); + + /** + * Determines if the server object for this reference has already + * been destroyed. + * + * @return true if the object has been destroyed, false otherwise. + */ + boolean non_existent(Servant a_servant); + + /** + * Return the invocation target object identifier as a byte array. + */ + byte[] object_id(Servant a_servant); + + /** + * Returns the ORB that is directly associated with the given servant. + */ + ORB orb(Servant a_servant); + + /** + * Get POA that is directly associated with the given servant. + */ + POA poa(Servant a_servant); + + /** + * Obtains the CORBA object reference that is an invocation target for the + * given servant. + */ + org.omg.CORBA.Object this_object(Servant a_servant); +} diff --git a/libjava/classpath/org/omg/SendingContext/RunTime.java b/libjava/classpath/org/omg/SendingContext/RunTime.java new file mode 100644 index 000000000..ac0b888b2 --- /dev/null +++ b/libjava/classpath/org/omg/SendingContext/RunTime.java @@ -0,0 +1,60 @@ +/* RunTime.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.SendingContext; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines the base class that represents the Sending Context. The sending + * context provides access to information about the originator of a + * GIOP message. For example, when a value type is sent in a GIOP + * Request, the receiver may need to ask the sender about + * the CodeBase for the implementation of the value type. + * + * @since 1.3 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RunTime + extends IDLEntity, Object, RunTimeOperations, Serializable +{ +} diff --git a/libjava/classpath/org/omg/SendingContext/RunTimeOperations.java b/libjava/classpath/org/omg/SendingContext/RunTimeOperations.java new file mode 100644 index 000000000..413364575 --- /dev/null +++ b/libjava/classpath/org/omg/SendingContext/RunTimeOperations.java @@ -0,0 +1,57 @@ +/* RunTimeOperations.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.SendingContext; + + +/** + * Defines the operations, applicable for Sending Context. The sending + * context provides access to information about the originator of a + * GIOP message. For example, when a value type is sent in a GIOP + * Request, the receiver may need to ask the sender about + * the CodeBase for the implementation of the value type. + * + * Unfortunately, no public operations are defined up till 1.4 inclusive. + * + * @since 1.3 + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RunTimeOperations +{ +} diff --git a/libjava/classpath/org/omg/SendingContext/package.html b/libjava/classpath/org/omg/SendingContext/package.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/libjava/classpath/org/omg/SendingContext/package.html diff --git a/libjava/classpath/org/omg/stub/java/rmi/_Remote_Stub.java b/libjava/classpath/org/omg/stub/java/rmi/_Remote_Stub.java new file mode 100644 index 000000000..0d0bac661 --- /dev/null +++ b/libjava/classpath/org/omg/stub/java/rmi/_Remote_Stub.java @@ -0,0 +1,78 @@ +/* _Remote_Stub.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.stub.java.rmi; + +import java.io.Serializable; + +import java.rmi.Remote; + +import javax.rmi.CORBA.Stub; + +/** + * Provides a stub for Remote type. + * + * Despite this class has appeared since v 1.3, it is oficially marked + * as incomplete at least till v 1.5 inclusive. Hence significant alterations + * are expected in the future. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class _Remote_Stub + extends Stub + implements Remote, Serializable +{ + + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1967190271952680697L; + + + /** + * Returs the array of repository ids, implemented by this object. + * The method must be overridden to return the meaningful information. + * + * @return a single member array, containing empty string (if not overridden). + */ + public String[] _ids() + { + return new String[] { "" }; + } + +} diff --git a/libjava/classpath/org/omg/stub/java/rmi/package.html b/libjava/classpath/org/omg/stub/java/rmi/package.html new file mode 100644 index 000000000..f8ab89a33 --- /dev/null +++ b/libjava/classpath/org/omg/stub/java/rmi/package.html @@ -0,0 +1,48 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - + 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. --> + +<html> +<head><title>GNU Classpath - org.omg.stub.java.rmi</title></head> + +<body> +<p>Contains RMI-IIOP Stubs for the Remote types from java.rmi package. +The RMI-IIOP system provides means to use the standard CORBA protocol +for RMI.</p> + +</body> +</html> |