diff options
Diffstat (limited to 'libjava/classpath/org/omg/CosNaming')
62 files changed, 8426 insertions, 0 deletions
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> |