diff options
author | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-08-02 08:25:39 +0000 |
---|---|---|
committer | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-08-02 08:25:39 +0000 |
commit | 85ddf928f203f51365829d325f0241dd2b3ccd5a (patch) | |
tree | 1f25739a0618a271596021ab149b4837343735e5 /org | |
parent | 709b9f5873b581bdb7939301eea5b7ae9fbda1d3 (diff) | |
download | classpath-85ddf928f203f51365829d325f0241dd2b3ccd5a.tar.gz |
2005-08-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/DynamicAny/DynValueCommon.java: Inherit from
DynValueOperations, DynAny, IDLEntity, org.omg.CORBA.Object,
Serializable.
* org/omg/DynamicAny/DynValueCommonOperations.java: Inherit from
DynAnyOperations.
* org/omg/DynamicAny/DynAnyHelper.java,
org/omg/DynamicAny/DynStructHelper.java,
org/omg/DynamicAny/DynUnionHelper.java,
org/omg/DynamicAny/DynValueHelper.java,
org/omg/DynamicAny/DynAnyFactoryHelper.java,
org/omg/DynamicAny/DynArrayHelper.java,
org/omg/DynamicAny/DynEnumHelper.java,
org/omg/DynamicAny/DynFixedHelper.java,
org/omg/DynamicAny/DynSequenceHelper.java: New files.
Diffstat (limited to 'org')
-rw-r--r-- | org/omg/DynamicAny/DynAnyFactoryHelper.java | 173 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynAnyHelper.java | 152 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynArrayHelper.java | 151 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynEnumHelper.java | 152 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynFixedHelper.java | 152 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynSequenceHelper.java | 151 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynStructHelper.java | 151 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynUnionHelper.java | 151 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynValueCommon.java | 10 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynValueCommonOperations.java | 5 | ||||
-rw-r--r-- | org/omg/DynamicAny/DynValueHelper.java | 151 |
11 files changed, 1395 insertions, 4 deletions
diff --git a/org/omg/DynamicAny/DynAnyFactoryHelper.java b/org/omg/DynamicAny/DynAnyFactoryHelper.java new file mode 100644 index 000000000..b6fd15151 --- /dev/null +++ b/org/omg/DynamicAny/DynAnyFactoryHelper.java @@ -0,0 +1,173 @@ +/* DynAnyFactoryHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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 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"); + } + } + + /** + * Get the type code of the {@link DynAnyFactory}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @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) + { + try + { + throw new MARSHAL("The read/write are not applicable for " + Id); + } + catch (Exception e) + { + throw new MARSHAL(); + } + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynAnyHelper.java b/org/omg/DynamicAny/DynAnyHelper.java new file mode 100644 index 000000000..ca48cd4c5 --- /dev/null +++ b/org/omg/DynamicAny/DynAnyHelper.java @@ -0,0 +1,152 @@ +/* DynAnyHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynAny}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynAny value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynArrayHelper.java b/org/omg/DynamicAny/DynArrayHelper.java new file mode 100644 index 000000000..0372b5851 --- /dev/null +++ b/org/omg/DynamicAny/DynArrayHelper.java @@ -0,0 +1,151 @@ +/* DynArrayHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynArray}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynArray value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynEnumHelper.java b/org/omg/DynamicAny/DynEnumHelper.java new file mode 100644 index 000000000..944d43757 --- /dev/null +++ b/org/omg/DynamicAny/DynEnumHelper.java @@ -0,0 +1,152 @@ +/* DynEnumHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynEnum}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynEnum value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynFixedHelper.java b/org/omg/DynamicAny/DynFixedHelper.java new file mode 100644 index 000000000..1d818d7b1 --- /dev/null +++ b/org/omg/DynamicAny/DynFixedHelper.java @@ -0,0 +1,152 @@ +/* DynFixedHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynFixed}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynFixed value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynSequenceHelper.java b/org/omg/DynamicAny/DynSequenceHelper.java new file mode 100644 index 000000000..c38a51f09 --- /dev/null +++ b/org/omg/DynamicAny/DynSequenceHelper.java @@ -0,0 +1,151 @@ +/* DynSequenceHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynSequence}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynSequence value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynStructHelper.java b/org/omg/DynamicAny/DynStructHelper.java new file mode 100644 index 000000000..e4790b443 --- /dev/null +++ b/org/omg/DynamicAny/DynStructHelper.java @@ -0,0 +1,151 @@ +/* DynStructHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynStruct}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynStruct value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynUnionHelper.java b/org/omg/DynamicAny/DynUnionHelper.java new file mode 100644 index 000000000..794098333 --- /dev/null +++ b/org/omg/DynamicAny/DynUnionHelper.java @@ -0,0 +1,151 @@ +/* DynUnionHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynUnion}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynUnion value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/org/omg/DynamicAny/DynValueCommon.java b/org/omg/DynamicAny/DynValueCommon.java index 67738d678..0982eee12 100644 --- a/org/omg/DynamicAny/DynValueCommon.java +++ b/org/omg/DynamicAny/DynValueCommon.java @@ -38,19 +38,25 @@ 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 DynValueOperations, 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. */ diff --git a/org/omg/DynamicAny/DynValueCommonOperations.java b/org/omg/DynamicAny/DynValueCommonOperations.java index 22f97e49e..31c31678e 100644 --- a/org/omg/DynamicAny/DynValueCommonOperations.java +++ b/org/omg/DynamicAny/DynValueCommonOperations.java @@ -41,14 +41,15 @@ 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. */ diff --git a/org/omg/DynamicAny/DynValueHelper.java b/org/omg/DynamicAny/DynValueHelper.java new file mode 100644 index 000000000..a6d7afaa9 --- /dev/null +++ b/org/omg/DynamicAny/DynValueHelper.java @@ -0,0 +1,151 @@ +/* DynValueHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +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"); + } + } + + /** + * Get the type code of the {@link DynValue}. + */ + public static TypeCode type() + { + return ORB.init().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 input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynValue value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file |