diff options
author | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-11-09 18:40:25 +0000 |
---|---|---|
committer | Audrius Meskauskas <audriusa@Bioinformatics.org> | 2005-11-09 18:40:25 +0000 |
commit | 760fa8fbc92b8fe7ae5be2a0fd287132d8d25d4d (patch) | |
tree | 817b8a4b5c79bc118daf1ee3facdfbc6a3cc79a1 /org | |
parent | 1975983612d9f246e8cf4455b288be3fc2e9659f (diff) | |
download | classpath-760fa8fbc92b8fe7ae5be2a0fd287132d8d25d4d.tar.gz |
2005-11-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/PortableInterceptor/ObjectReferenceTemplate.java,
org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java,
org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java:
New files.
Diffstat (limited to 'org')
3 files changed, 320 insertions, 0 deletions
diff --git a/org/omg/PortableInterceptor/ObjectReferenceTemplate.java b/org/omg/PortableInterceptor/ObjectReferenceTemplate.java new file mode 100644 index 000000000..99160ff44 --- /dev/null +++ b/org/omg/PortableInterceptor/ObjectReferenceTemplate.java @@ -0,0 +1,73 @@ +/* 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.CORBA.portable.IDLEntity; + +/** + * 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. + * + * @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. + * + * @return the server id, represented in the form of string. + */ + String server_id(); +}
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java b/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java new file mode 100644 index 000000000..258a73ae8 --- /dev/null +++ b/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java @@ -0,0 +1,144 @@ +/* ObjectReferenceTemplateHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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 org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +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 +{ + /** + * The cached {@link ObjectReferenceTemplate} typecode, computed once. + */ + private static TypeCode typeCode; + + /** + * Get the type code of the {@link ObjectReferenceTemplate}. + * + * @return value type type code, named ObjectReferenceTemplate, + * no members, abstract. + */ + public static TypeCode type() + { + if (typeCode == null) + typeCode = + ORB.init().create_value_tc(id(), "ObjectReferenceTemplate", + VM_ABSTRACT.value, null, new ValueMember[ 0 ] + ); + return typeCode; + } + + /** + * 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); + } +}
\ No newline at end of file diff --git a/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java b/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java new file mode 100644 index 000000000..9658e1fa7 --- /dev/null +++ b/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java @@ -0,0 +1,103 @@ +/* ObjectReferenceTemplateHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you 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 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(); + } +} |