diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2005-09-23 19:36:46 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2005-09-23 19:36:46 +0000 |
commit | 9b044d19517541c95681d35a92dbc81e6e21d94f (patch) | |
tree | b2c2abf473309eac532cafbad81b20f3270ff45f /libjava/classpath/org | |
parent | acff2da93c917c21aca570e2a41ee613c2b32c2e (diff) | |
download | gcc-9b044d19517541c95681d35a92dbc81e6e21d94f.zip gcc-9b044d19517541c95681d35a92dbc81e6e21d94f.tar.gz gcc-9b044d19517541c95681d35a92dbc81e6e21d94f.tar.bz2 |
Initial revision
From-SVN: r104578
Diffstat (limited to 'libjava/classpath/org')
126 files changed, 15491 insertions, 0 deletions
diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java new file mode 100644 index 0000000..1aa7521 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java @@ -0,0 +1,128 @@ +/* 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 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, 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 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/NamingContextExtPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java new file mode 100644 index 0000000..a6d3346 --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java @@ -0,0 +1,461 @@ +/* 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 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 = (Integer) _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 = (Integer) _NamingContextImplBase.methods.get(method); + if (call_method == null) + throw new BAD_OPERATION(0, 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/NamingContextPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java new file mode 100644 index 0000000..a2db0ad --- /dev/null +++ b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java @@ -0,0 +1,365 @@ +/* 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 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 = (Integer) _NamingContextImplBase.methods.get(method); + if (call_method == null) + throw new BAD_OPERATION(0, 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/DynamicAny/AnySeqHelper.java b/libjava/classpath/org/omg/DynamicAny/AnySeqHelper.java new file mode 100644 index 0000000..60e4e6e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/AnySeqHelper.java @@ -0,0 +1,122 @@ +/* AnySeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the array of {@link Any}. This class shares + * the same {@link AnySeqHolder} as the {@link org.omg.CORBA.AnySeqHelper}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class AnySeqHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#extract}. + */ + public static Any[] extract(Any any) + { + return org.omg.CORBA.AnySeqHelper.extract(any); + } + + /** + * Get the AnySeq repository id. + * + * @return "IDL:omg.org/DynamicAny/AnySeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/AnySeq:1.0"; + } + + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#insert}. + */ + public static void insert(Any any, Any[] those) + { + org.omg.CORBA.AnySeqHelper.insert(any, those); + } + + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#read}. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static Any[] read(InputStream input) + { + return org.omg.CORBA.AnySeqHelper.read(input); + } + + /** + * Get the typecode as officially defined for this helper. + * + * @return alias of unbounded sequence of Any's, named AnySeq, + * with the id, returned by {@link #id()}. + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + TypeCode t = + orb.create_sequence_tc(0, orb.get_primitive_tc(TCKind.tk_any)); + typeCode = orb.create_alias_tc(id(), "AnySeq", t); + } + return typeCode; + } + + /** + * Delegates call to {@link org.omg.CORBA.AnySeqHelper#write}. + */ + public static void write(OutputStream output, Any[] value) + { + org.omg.CORBA.AnySeqHelper.write(output, value); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynAny.java b/libjava/classpath/org/omg/DynamicAny/DynAny.java new file mode 100644 index 0000000..fd23363 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAny.java @@ -0,0 +1,71 @@ +/* DynAny.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The DynAny interface provides possibility to access the components of the + * CORBA object, stored inside the {@link Any}. The DynAny and derived classes + * additionally allows to access the members of the sequence, structure, union + * and get the data about enumeration, value type and CORBA <code>fixed</code> + * without knowing the exact type at the run time. The returned members are also + * wrapped into DynAny objects, allowing them to be the nested structures. + * </p> + * <p> + * The DynAny's are usually produced by {@link DynAnyFactory}. This factory is + * obtained from the ORB: <br> + * <code> + * DynAnyFactory f = DynAnyFactoryHelper.narrow + * (orb.resolve_initial_references("DynAnyFactory")); + * </code> + * </p> + * <p> + * DynAny can also be returned by a method, invoked on another DynAny. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAny + extends DynAnyOperations, IDLEntity, org.omg.CORBA.Object, Serializable +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactory.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactory.java new file mode 100644 index 0000000..5d4cc72 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactory.java @@ -0,0 +1,55 @@ +/* DynAnyFactory.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Produces DynAnys from Anys or typecodes. The produced DynAnys are initialized + * to they agreed default values. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAnyFactory + extends DynAnyFactoryOperations, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java new file mode 100644 index 0000000..0c02916 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java @@ -0,0 +1,173 @@ +/* DynAnyFactoryHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynAnyFactory}. Following the 1.5 JDK + * specifications, DynAnyFactory is always a local object, so the two methods of + * this helper ({@link #read} and {@link #write} are not in use, always + * throwing {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynAnyFactoryHelper +{ + /** + * Cast the passed object into the DynAnyFactory. As DynAnyFactory is a local + * object, the method just uses java final_type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynAnyFactory. + */ + public static DynAnyFactory narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynAnyFactory) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + + " is not a DynAnyFactory"); + } + } + + /** + * Get the final_type code of the {@link DynAnyFactory}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynAnyFactory"); + } + + /** + * Insert the DynAnyFactory into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynAnyFactory to insert. + */ + public static void insert(Any any, DynAnyFactory that) + { + any.insert_Object(that); + } + + /** + * Extract the DynAnyFactory from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynAnyFactory. + */ + public static DynAnyFactory extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynAnyFactory repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAnyFactory:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAnyFactory:1.0"; + } + + /** + * This should read DynAnyFactory from the CDR input stream, but (following + * the JDK 1.5 API) it does not. The factory can only be obtained from the + * ORB. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynAnyFactory read(InputStream input) + { + throw new MARSHAL(not_applicable(id())); + } + + /** + * This should read DynAnyFactory from the CDR input stream, but (following + * the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynAnyFactory value) + { + throw new MARSHAL(not_applicable(id())); + } + + /** + * The package level method for throwing exception, explaining that the + * operation is not applicable. + * + * @param Id the Id for the typecode for that the operations was attempted to + * perform. + */ + static String not_applicable(String Id) + { + try + { + throw new MARSHAL("The read/write are not applicable for " + Id); + } + catch (Exception e) + { + throw new MARSHAL(); + } + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryOperations.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryOperations.java new file mode 100644 index 0000000..058e369 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryOperations.java @@ -0,0 +1,153 @@ +/* DynAnyFactoryOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; + +/** + * Defines the operations, applicable for DynAnyFactory. These operations + * produce new DynAny's either from Any, serving as a template and value + * provider, or from the given typecode. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAnyFactoryOperations +{ + /** + * Create DynAny for holding the data of the given type. The returned DynAny + * is initialised to its agreed default value. The agreed default values are: + * <table border='1'> + * <tr> + * <th>Type</th> + * <th>Value</th> + * <th>Creates</th> + * </tr> + * + * <tr> + * <td>boolean</td> + * <td>false</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>numeric types, octet, fixed</td> + * <td>0</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>char, wchar</td> + * <td>(char) 0</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>string, wstring</td> + * <td>empty string ("", not <code>null<code>)</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>{@link Any}</td> + * <td>{@link Any} with no value and typecode of kind {@link TCKind.tk_null}</td> + * <td>{@link DynAny}</td> + * </tr> + * <tr> + * <td>Sequence</td> + * <td>Empty (zero size) sequence</td> + * <td>{@link DynSequence}</td> + * </tr> + * <tr> + * <td>Array</td> + * <td>All members of array are recursively initialised to default values.</td> + * <td>{@link DynArray}</td> + * </tr> + * <tr> + * <td>Structure, exception</td> + * <td>All fields of the structure (if any) are recursively initialised to + * default values.</td> + * <td>{@link DynStruct}</td> + * </tr> + * <tr> + * <td>Enumeration</td> + * <td>Default value, indicated by typecode.</td> + * <td>{@link DynEnum}</td> + * </tr> + * <tr> + * <td>Union</td> + * <td>Default variant (indicated by typecode), recursively initialised to + * its default value.</td> + * <td>{@link DynUnion}</td> + * </tr> + * <tr> + * <td>Value, ValueBox</td> + * <td>null</td> + * <td>{@link DynValue}, {@link DynValueBox}</td> + * </tr> + * <tr> + * <td>TypeCode</td> + * <td>Typecode of kind <code>TCKind.tk_null</code></td> + * <td>{@link DynValue}, {@link DynValueBox}</td> + * </tr> + * + * </table> + * + * @param type the type of the data being stored. + * + * @return the created DynAny, having the passed type. + * + * @throws InconsistentTypeCode if type.kind() is tk_Principal, tk_native or + * tk_abstract_interface. These types cannot be stored in DynAny. + */ + DynAny create_dyn_any_from_type_code(TypeCode type) + throws InconsistentTypeCode; + + /** + * Create DynAny using the given Any as template. + * + * @param value the Any, providing type and value for the DynAny being + * created. + * + * @return the created DynAny, having the same type and storing the same value + * as the passed Any. + * + * @throws InconsistentTypeCode if value.type().kind() is tk_Principal, + * tk_native or tk_abstract_interface. These types cannot be stored in DynAny. + */ + DynAny create_dyn_any(Any value) + throws InconsistentTypeCode; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java new file mode 100644 index 0000000..ca48cd4 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java @@ -0,0 +1,152 @@ +/* DynAnyHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynAny}. Following the 1.5 JDK + * specifications, DynAny is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynAnyHelper +{ + /** + * Cast the passed object into the DynAny. As DynAny is a local object, the + * method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynAny. + */ + public static DynAny narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynAny) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynAny"); + } + } + + /** + * Get the type code of the {@link DynAny}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynAny"); + } + + /** + * Insert the DynAny into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynAny to insert. + */ + public static void insert(Any any, DynAny that) + { + any.insert_Object(that); + } + + /** + * Extract the DynAny from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynAny. + */ + public static DynAny extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynAny repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAny:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAny:1.0"; + } + + /** + * This should read DynAny from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynAny read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynAny from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynAny value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyOperations.java b/libjava/classpath/org/omg/DynamicAny/DynAnyOperations.java new file mode 100644 index 0000000..0e74313 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnyOperations.java @@ -0,0 +1,540 @@ +/* DynAnyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Defines the operations, applicable to {@link DynAny}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynAnyOperations +{ + /** + * Initialises the value of this DynAny with the value, stored inside the + * passed DynAny, making a shallow copy. + * + * @param from the DynAny to copy from. + * @throws TypeMismatch if the source DynAny is invalid. + */ + void assign(DynAny from) + throws TypeMismatch; + + /** + * Fully clones the content of this Any, returning a deep copy. + */ + DynAny copy(); + + /** + * Returns the focused component of this DynAny. The DynAny has the internal + * pointer (reference) that can point to one of its components. The returned + * DynAny can be used to get or set the value of the focused component. If the + * DynAny holds a primitive type with no components, this implementation + * returns <code>null</code>. + * + * @throws TypeMismatch if called on DynAny that cannot have active + * components, like {@link DynEnum}. + */ + DynAny current_component() + throws TypeMismatch; + + /** + * Destroys this DynAny, freeing the used resources. In java, resources are + * freed by the garbage collectors, so this method typically returns without + * action. + */ + void destroy(); + + /** + * Makes a DynAny from the {@link Any}. The passed {@link Any} becomes the + * enclosed instance of this DynAny, allowing to change/traverse the + * {@link Any} fields by the {@link DynAny} methods. + * + * @throws TypeMismatch if the type of this DynAny differs from the type of + * the passed Any. The DynAny cannot be reused with the enclosed type + * different from that it was initially created. + * @throws InvalidValue if the value, stored in the passed parameter, is + * otherwise invalid. + */ + void from_any(Any an_any) + throws TypeMismatch, InvalidValue; + + /** + * This method is used when the wrapped Any contains an instance of another + * Any itself. The method returns this second enclosed Any. + * + * @throws TypeMismatch if the typecode of the accessed Any is not the same as + * the typecode of this DynAny. + */ + Any get_any() + throws TypeMismatch, InvalidValue; + + /** + * Extract the boolean value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + boolean get_boolean() + throws TypeMismatch, InvalidValue; + + /** + * Extract the char value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + char get_char() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>double</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + double get_double() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>float</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + float get_float() + throws TypeMismatch, InvalidValue; + + /** + * Extract the int (CORBA long) value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + int get_long() + throws TypeMismatch, InvalidValue; + + /** + * Extract the long (CORBA long long) value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + long get_longlong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the byte (CORBA octet) value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + byte get_octet() + throws TypeMismatch, InvalidValue; + + /** + * Extract the CORBA object reference that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue; + + /** + * Extract the <code>short</code> value that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + short get_short() + throws TypeMismatch, InvalidValue; + + /** + * Extract the string value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + String get_string() + throws TypeMismatch, InvalidValue; + + /** + * Extract the {@link TypeCode} value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + TypeCode get_typecode() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsigned int (CORBA ulong) value that is expected to be stored + * in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + int get_ulong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsingel long (CORBA unsigned long long )value that is expected + * to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + long get_ulonglong() + throws TypeMismatch, InvalidValue; + + /** + * Extract the unsigned short value that is expected to be stored in this + * DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + short get_ushort() + throws TypeMismatch, InvalidValue; + + /** + * Extract the value that is expected to be stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + Serializable get_val() + throws TypeMismatch, InvalidValue; + + /** + * Extract the wide (usually UTF-16) character value that is expected to be + * stored in this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + char get_wchar() + throws TypeMismatch, InvalidValue; + + /** + * Extract the wide (usually UFT-16) string that is expected to be stored in + * this DynAny. + * + * @throws TypeMismatch if this DynAny holds the value of the different type. + */ + String get_wstring() + throws TypeMismatch, InvalidValue; + + /** + * Insert the {@link Any} value into the enclosed {@link Any} inside this + * DynAny. + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_any(Any an_any) + throws TypeMismatch, InvalidValue; + + /** + * Insert the boolean value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_boolean(boolean a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the char value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_char(char a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the double value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_double(double a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the float value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_float(float a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the int (CORBA long) value into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_long(int a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the long (CORBA long long) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_longlong(long a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the byte (CORBA octet) value into the enclosed {@link Any} inside + * this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_octet(byte a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the object reference into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_reference(org.omg.CORBA.Object a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the <code>short</code> value into the enclosed {@link Any} inside + * this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_short(short a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the string value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_string(String a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the {@link TypeCode} value into the enclosed {@link Any} inside this + * DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_typecode(TypeCode a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the int (CORBA unsinged long) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ulong(int a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the long (CORBA unsigned long long) value into the enclosed + * {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ulonglong(long a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the short (CORBA unsigned short) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_ushort(short a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the value into the enclosed {@link Any} inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_val(Serializable a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the wide char (usually UTF-16) value into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_wchar(char a_x) + throws InvalidValue, TypeMismatch; + + /** + * Insert the wide string (usually UTF-16) into the enclosed {@link Any} + * inside this DynAny + * + * @param a_x the value being inserted. + * @throws InvalidValue if the value type does not match the typecode of the + * enclosed {@link Any}. + */ + void insert_wstring(String a_x) + throws InvalidValue, TypeMismatch; + + /** + * Advances the internal pointer, described in the {@link current_component}, + * one position forward. + * + * @return true if the pointer now points to the new component, false if there + * are no more components of this DynAny holds a basic type that is not + * divided into components. + */ + boolean next(); + + /** + * Moves the internal pointer, described in the {@link current_component}, to + * the first component. + */ + void rewind(); + + /** + * Moves the internal pointer, described in the {@link current_component}, to + * the given position. + * + * @param p the number of the internal component on that the internal pointer + * must be focused. + * @return true on success or false if there is no component with the given + * number. If the DynAny holds the basic type, this method returs false p + * values other than 0. + */ + boolean seek(int p); + + /** + * Returns a shallow copy of the enclosed {@link Any}, + * + * @return shallow copy of the enclosed {@link Any}. + */ + Any to_any(); + + /** + * Returns the typecode of the object, inserted into this DynAny. + * + * @return the typecode of the inserted {@link Any} or null typecode if no + * {@link Any has been yet inserted}. + */ + TypeCode type(); + + /** + * Insert a value at the current position. + * + * @param insert_it a value to insert. + * @throws TypeMismatch if the component at the current position has a + * different type. + * @throws InvalidValue if the current position points nowhere. + */ + void insert_dyn_any(DynAny insert_it) + throws TypeMismatch, InvalidValue; + + /** + * Checks for equality with another Dynamic Any. + * + * + * @specnote This method is currently only implemented only for case when + * another DynAny was created by the factory of this implementation and is not + * an independent class, just implementing interface. Otherwise, a + * NO_IMPLEMENT minor 8148 will be thrown. General implementation is highly + * ineffective, but we will do if somebody would ever need it. + */ + boolean equal(DynAny other); + + /** + * Get the number number of fields in the enclosed structure or number of + * memebers in the enclosed array, sequence, enumeration, etc. This method + * only counts elements at the top level. For instance, if invoked on a + * DynStruct with a single member, it returns 1, irrespective of the type of + * the member. + * + * @return number of components or 0 if the enclosed Any is not divideable. + */ + int component_count(); + + /** + * Return DynAny, wrapping the second (enclosed any) that is stored in the + * wrapped Any. + * + * @throws TypeMismatch if the wrapped Any does not store another Any. + * @throws InvalidValue if the current position points nowhere. + */ + DynAny get_dyn_any() + throws TypeMismatch, InvalidValue; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java new file mode 100644 index 0000000..87e3445 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java @@ -0,0 +1,152 @@ +/* DynAnySeq.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.DynAnySeqHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the array of {@link DynAny} ({@link DynAnySeq}). + * Following the 1.5 JDK specifications, DynAny (and hence an sequence of + * DynAny's) is always a local object, so the two methods of this helper + * ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynAnySeqHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + TypeCode t = orb.create_sequence_tc(0, DynAnyHelper.type()); + typeCode = orb.create_alias_tc(id(), "DynAnySeq", t); + } + return typeCode; + } + + /** + * Insert the DynAnySeq into the given Any. + * This method uses the DynAnySeqHolder. + * + * @param any the Any to insert into. + * @param those the DynAny[] to insert. + */ + public static void insert(Any any, DynAny[] those) + { + any.insert_Streamable(new DynAnySeqHolder(those)); + } + + /** + * Extract the DynAnySeq from given Any. + * This method uses the DynAnySeqHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain DynAnySeq. + */ + public static DynAny[] extract(Any any) + { + try + { + return ((DynAnySeqHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("DynAnySeq expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the DynAnySeq repository id. + * + * @return "IDL:omg.org/DynamicAny/DynAnySeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynAnySeq:1.0"; + } + + /** + * The method should read this object from the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynAny[] read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * The method should write this object to the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynAny[] value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynArray.java b/libjava/classpath/org/omg/DynamicAny/DynArray.java new file mode 100644 index 0000000..30b556a --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynArray.java @@ -0,0 +1,54 @@ +/* DynArray.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Represents a fixed size array. All components in the array have the same + * type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynArray + extends DynArrayOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java new file mode 100644 index 0000000..0372b58 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java @@ -0,0 +1,151 @@ +/* DynArrayHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynArray}. Following the 1.5 JDK + * specifications, DynArray is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynArrayHelper +{ + /** + * Cast the passed object into the DynArray. As DynArray is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynArray. + */ + public static DynArray narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynArray) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynArray"); + } + } + + /** + * Get the type code of the {@link DynArray}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynArray"); + } + + /** + * Insert the DynArray into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynArray to insert. + */ + public static void insert(Any any, DynArray that) + { + any.insert_Object(that); + } + + /** + * Extract the DynArray from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynArray. + */ + public static DynArray extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynArray repository id. + * + * @return "IDL:omg.org/DynamicAny/DynArray:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynArray:1.0"; + } + + /** + * This should read DynArray from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynArray read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynArray from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynArray value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynArrayOperations.java b/libjava/classpath/org/omg/DynamicAny/DynArrayOperations.java new file mode 100644 index 0000000..1869303 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynArrayOperations.java @@ -0,0 +1,93 @@ +/* DynArrayOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for {@link DynArray}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynArrayOperations + extends DynAnyOperations +{ + /** + * Returns the array. + * + * @return the array of elements as an array of DynAny's. + */ + DynAny[] get_elements_as_dyn_any(); + + /** + * Returns the array. + * + * @return the array of elements as an array of Any's. + */ + Any[] get_elements(); + + /** + * Sets the array. + * + * @param value the array of elements an DynAny's. + * + * @throws TypeMismatch if the members of the passed array does not match + * array component type. + * + * @throws InvalidValue if the number of elements in the passed array is not + * the same as the size of this DynArray. + */ + void set_elements_as_dyn_any(DynAny[] value) + throws TypeMismatch, InvalidValue; + + /** + * Sets the array. + * + * @param value the array of elements as Any's. + * + * @throws TypeMismatch if the members of the passed array does not match + * array component type. + * + * @throws InvalidValue if the number of elements in the passed array is not + * the same as the size of this DynArray. + */ + void set_elements(Any[] value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnum.java b/libjava/classpath/org/omg/DynamicAny/DynEnum.java new file mode 100644 index 0000000..6f71bb8 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynEnum.java @@ -0,0 +1,56 @@ +/* DynEnum.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the dynamic enumeration. The value of the dynamic enumeration can be + * set by name or by integer code. The valid string values and integer codes are + * taken from the typecode, from which the enumeration was constructed. The + * enumeration is an undividable type without traversable components. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynEnum + extends DynEnumOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java new file mode 100644 index 0000000..944d4375 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java @@ -0,0 +1,152 @@ +/* DynEnumHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynEnum}. Following the 1.5 JDK + * specifications, DynEnum is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynEnumHelper +{ + /** + * Cast the passed object into the DynEnum. As DynEnum is a local object, the + * method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynEnum. + */ + public static DynEnum narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynEnum) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynEnum"); + } + } + + /** + * Get the type code of the {@link DynEnum}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynEnum"); + } + + /** + * Insert the DynEnum into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynEnum to insert. + */ + public static void insert(Any any, DynEnum that) + { + any.insert_Object(that); + } + + /** + * Extract the DynEnum from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynEnum. + */ + public static DynEnum extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynEnum repository id. + * + * @return "IDL:omg.org/DynamicAny/DynEnum:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynEnum:1.0"; + } + + /** + * This should read DynEnum from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynEnum read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynEnum from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynEnum value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnumOperations.java b/libjava/classpath/org/omg/DynamicAny/DynEnumOperations.java new file mode 100644 index 0000000..3bc3ae2 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynEnumOperations.java @@ -0,0 +1,82 @@ +/* DynEnumOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; + +/** + * Defines operations, applicable to the dynamic enumeration. The value of the + * dynamic enumeration can be set by name or by integer code. The valid string + * values and integer codes are taken from the typecode, from which the + * enumeration was constructed. The enumeration is an undividable type without + * traversable components. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynEnumOperations + extends DynAnyOperations +{ + /** + * Get the current enumeration value, as string. + */ + String get_as_string(); + + /** + * Get the current enumeration value, as int. + */ + int get_as_ulong(); + + /** + * Set the current enumeration value, as string. + * + * @throws InvalidValue if the passed string is not one of the allowed values + * for this enumeration. + */ + void set_as_string(String value) + throws InvalidValue; + + /** + * Set the current enumeration value, as int. + * + * @throws InvalidValue if the passed string is not one of the allowed values + * for this enumeration. + */ + void set_as_ulong(int value) + throws InvalidValue; + +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixed.java b/libjava/classpath/org/omg/DynamicAny/DynFixed.java new file mode 100644 index 0000000..65aa98f --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynFixed.java @@ -0,0 +1,55 @@ +/* DynFixed.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines dynamic any, holding CORBA <code>fixed</code>. The operations on + * <code>fixed</code> (defined in {@link DynFixedOperations}) take and return + * this data type in its string representation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynFixed + extends DynFixedOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java new file mode 100644 index 0000000..1d818d7 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java @@ -0,0 +1,152 @@ +/* DynFixedHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynFixed}. Following the 1.5 JDK + * specifications, DynFixed is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynFixedHelper +{ + /** + * Cast the passed object into the DynFixed. As DynFixed is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynFixed. + */ + public static DynFixed narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynFixed) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynFixed"); + } + } + + /** + * Get the type code of the {@link DynFixed}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynFixed"); + } + + /** + * Insert the DynFixed into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynFixed to insert. + */ + public static void insert(Any any, DynFixed that) + { + any.insert_Object(that); + } + + /** + * Extract the DynFixed from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynFixed. + */ + public static DynFixed extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynFixed repository id. + * + * @return "IDL:omg.org/DynamicAny/DynFixed:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynFixed:1.0"; + } + + /** + * This should read DynFixed from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynFixed read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynFixed from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynFixed value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixedOperations.java b/libjava/classpath/org/omg/DynamicAny/DynFixedOperations.java new file mode 100644 index 0000000..e8c69a7 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynFixedOperations.java @@ -0,0 +1,71 @@ +/* DynFixedOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for DynAny, holding CORBA <code>fixed</code>. + * These operations take and return this data type in its string representation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynFixedOperations + extends DynAnyOperations +{ + /** + * Get the value of the enclosed DynFixed, as string. + */ + String get_value(); + + /** + * Set the value of the enclosed DynFixed, from string. + * + * @param fixed_value the value to set. + * + * @throws TypeMismatch if the passed string cannot be parsed into CORBA + * <code>fixed</code>. The valid string can only contain digits, decimal + * point and optional leading and trailing whitespace. + * + * @return true if the passed value can be represented without the loss of + * precision, false if some fractional digits were truncated. + */ + boolean set_value(String fixed_value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequence.java b/libjava/classpath/org/omg/DynamicAny/DynSequence.java new file mode 100644 index 0000000..08c7b52 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynSequence.java @@ -0,0 +1,54 @@ +/* DynSequence.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a dynamic resizeable array with the optional upper size bound. All + * elements in this structure have the same type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynSequence + extends DynSequenceOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java new file mode 100644 index 0000000..c38a51f --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java @@ -0,0 +1,151 @@ +/* DynSequenceHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynSequence}. Following the 1.5 JDK + * specifications, DynSequence is always a local object, so the two methods of + * this helper ({@link #read} and {@link #write} are not in use, always + * throwing {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynSequenceHelper +{ + /** + * Cast the passed object into the DynSequence. As DynSequence is a local + * object, the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynSequence. + */ + public static DynSequence narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynSequence) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynSequence"); + } + } + + /** + * Get the type code of the {@link DynSequence}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynSequence"); + } + + /** + * Insert the DynSequence into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynSequence to insert. + */ + public static void insert(Any any, DynSequence that) + { + any.insert_Object(that); + } + + /** + * Extract the DynSequence from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynSequence. + */ + public static DynSequence extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynSequence repository id. + * + * @return "IDL:omg.org/DynamicAny/DynSequence:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynSequence:1.0"; + } + + /** + * This should read DynSequence from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynSequence read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynSequence from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynSequence value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequenceOperations.java b/libjava/classpath/org/omg/DynamicAny/DynSequenceOperations.java new file mode 100644 index 0000000..77cd283 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynSequenceOperations.java @@ -0,0 +1,124 @@ +/* DynSequenceOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable to DynSequence. These are basically the same + * operations as for {@link DynArrayOperations} with additional possibility to + * change the length of the sequence. If the + * {@link org.omg.CORBA.TypeCode#length()} method of the sequence typecode + * returns positive value, it is treated as a sequence bound. An attempt to + * extend the sequence above its bound raises {@link InvalidValue}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynSequenceOperations + extends DynAnyOperations +{ + /** + * Get the length of the sequence. + * + * @return the current sequence length that was taken from typecode or changed + * with set_length. + */ + int get_length(); + + /** + * Set the length of the sequence. If the sequence is shortened, the tailing + * members are discarded, but the remaining content is not affected. If the + * new length is larger than the previous one, the new members are added to + * the end of the sequence. These new members are initialised to they default + * values. + * + * @param length the new length of the sequence. + * + * @throws InvalidValue if this is a bounded sequence, and the size being set + * exceeds the sequence bound. + */ + public void set_length(int length) + throws InvalidValue; + + /** + * Returns the array, containing the sequence elements. + * + * @return the array of elements as an array of DynAny's. + */ + DynAny[] get_elements_as_dyn_any(); + + /** + * Returns the array, containing the sequence elements. + * + * @return the array of elements as an array of Any's. + */ + Any[] get_elements(); + + /** + * Sets the sequence elements from the array. The length of the sequence is + * set to the length of the passed array. + * + * @param value the array of elements an DynAny's. + * + * @throws TypeMismatch if the members of the passed array does not match + * sequence component type. + * + * @throws InvalidValue if this is a bounded sequence and the number of + * elements in the passed array exceeds the sequence bound. + */ + void set_elements_as_dyn_any(DynAny[] value) + throws TypeMismatch, InvalidValue; + + /** + * Sets the sequence elements from the array. The length of the sequence is + * set to the length of the passed array. + * + * @param value the array of elements as Any's. + * + * + * @throws TypeMismatch if the members of the passed array does not match + * sequence component type. + * + * @throws InvalidValue if this is a bounded sequence and the number of + * elements in the passed array exceeds the sequence bound. + */ + void set_elements(Any[] value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynStruct.java b/libjava/classpath/org/omg/DynamicAny/DynStruct.java new file mode 100644 index 0000000..5405375 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynStruct.java @@ -0,0 +1,54 @@ +/* DynStruct.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a fixed size structure with the named fields that may have different + * types. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynStruct + extends DynStructOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java new file mode 100644 index 0000000..e4790b4 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java @@ -0,0 +1,151 @@ +/* DynStructHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynStruct}. Following the 1.5 JDK + * specifications, DynStruct is always a local object, so the two methods of + * this helper ({@link #read} and {@link #write} are not in use, always + * throwing {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynStructHelper +{ + /** + * Cast the passed object into the DynStruct. As DynStruct is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynStruct. + */ + public static DynStruct narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynStruct) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynStruct"); + } + } + + /** + * Get the type code of the {@link DynStruct}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynStruct"); + } + + /** + * Insert the DynStruct into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynStruct to insert. + */ + public static void insert(Any any, DynStruct that) + { + any.insert_Object(that); + } + + /** + * Extract the DynStruct from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynStruct. + */ + public static DynStruct extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynStruct repository id. + * + * @return "IDL:omg.org/DynamicAny/DynStruct:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynStruct:1.0"; + } + + /** + * This should read DynStruct from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynStruct read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynStruct from the CDR input stream, but (following the + * JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynStruct value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynStructOperations.java b/libjava/classpath/org/omg/DynamicAny/DynStructOperations.java new file mode 100644 index 0000000..3b5af17 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynStructOperations.java @@ -0,0 +1,140 @@ +/* DynStructOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines the operations, applicable to the DynStructure. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynStructOperations + extends DynAnyOperations +{ + /** + * Get the kind of the structure field at the current position. + * + * @return the kind of field. + * + * @throws TypeMismatch for an empty structure (normally exception). + * @throws InvalidValue if the current position does not indicate a memeber. + */ + TCKind current_member_kind() + throws TypeMismatch, InvalidValue; + + /** + * Get the name of the structure field at the current position. + * + * @return the name of the field. + * + * @throws TypeMismatch for an empty structure (normally exception). + * @throws InvalidValue if the current position does not indicate a memeber. + */ + String current_member_name() + throws TypeMismatch, InvalidValue; + + /** + * Return array, describing describing the name and the value of each member + * in the structure. + * + * @return an array of NameDynAnyPair's, each defining a single field in this + * structure. + */ + NameDynAnyPair[] get_members_as_dyn_any(); + + /** + * Return array, describing describing the name and the value of each member + * in the structure. + * + * @return an array of NameValuePair's, each defining a single field in this + * structure. + */ + NameValuePair[] get_members(); + + /** + * Set the structure contend from the array, where each member defines the + * name and value of the structure field. If the passed array is not empty, + * the current position is set to the first member. + * + * The members of array must follow in the same order as the structure fields, + * how they are defined in the typecode. The name-based value assignment is + * not supported. + * + * @specnote The name-based value assignment is not supported by Sun's jdk + * 1.4. + * + * @param an array of NameDynValuePair's, each defining a single field in the + * structure. + * + * @throws TypeMismatch if the member of the passed array has a different type + * than the corresponding structure field. + * + * @throws InvalidValue if the size of the passed array is not the same as the + * number of fields in this structure. + */ + void set_members_as_dyn_any(NameDynAnyPair[] value) + throws TypeMismatch, InvalidValue; + + /** + * Set the structure contend from the array, where each member defines the + * name and value of the structure field. If the passed array is not empty, + * the current position is set to the first member. + * + * The members of array must follow in the same order as the structure fields, + * how they are defined in the typecode. The name-based value assignment is + * not supported. + * + * @specnote The name-based value assignment is not supported by Sun's jdk + * 1.4. + * + * @param an array of NameValuePair's, each defining a single field in the + * structure. + * + * @throws TypeMismatch if the member of the passed array has a different type + * than the corresponding structure field. + * + * @throws InvalidValue if the size of the passed array is not the same as the + * number of fields in this structure. + */ + void set_members(NameValuePair[] value) + throws TypeMismatch, InvalidValue; + +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnion.java b/libjava/classpath/org/omg/DynamicAny/DynUnion.java new file mode 100644 index 0000000..8875d15 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynUnion.java @@ -0,0 +1,54 @@ +/* DynUnion.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a fixed size structure with the named fields that may have different + * types. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynUnion + extends DynUnionOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java new file mode 100644 index 0000000..7940983 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java @@ -0,0 +1,151 @@ +/* DynUnionHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynUnion}. Following the 1.5 JDK + * specifications, DynUnion is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynUnionHelper +{ + /** + * Cast the passed object into the DynUnion. As DynUnion is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynUnion. + */ + public static DynUnion narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynUnion) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynUnion"); + } + } + + /** + * Get the type code of the {@link DynUnion}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynUnion"); + } + + /** + * Insert the DynUnion into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynUnion to insert. + */ + public static void insert(Any any, DynUnion that) + { + any.insert_Object(that); + } + + /** + * Extract the DynUnion from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynUnion. + */ + public static DynUnion extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynUnion repository id. + * + * @return "IDL:omg.org/DynamicAny/DynUnion:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynUnion:1.0"; + } + + /** + * This should read DynUnion from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynUnion read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynUnion from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynUnion value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnionOperations.java b/libjava/classpath/org/omg/DynamicAny/DynUnionOperations.java new file mode 100644 index 0000000..c046e69 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynUnionOperations.java @@ -0,0 +1,149 @@ +/* DynUnionOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines the operations, applicable to the DynUnion. The DynUnion has only two + * valid positions: + * <ul> + * <li>0 - contains the discriminator of the union. The discriminator defines, + * which of the union variants is currently active.</li> + * <li>1 - contains the currently active variant of the union content (a union + * member). </li> + * </ul> + * The size of the union is normally 2. If the discriminator value defines no + * valid variant, the union consists of discriminator only, having the size 1. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynUnionOperations + extends DynAnyOperations +{ + /** + * <p>Get the value of discriminator, defining which content variant + * (member) is active. + * </p><p> + * In the current implementation, the later changes on the returned value + * alter the state of the union via implemented internal listener. + * </p> + */ + DynAny get_discriminator(); + + /** + * <p>Set the value of discriminator, activating the member variant that is + * consistent with the discriminator value. If the current member variant + * matches the discriminator being set, it is unchanged. Otherwise, it is + * replaced by the matching member variant with fields, initialised to default + * values. The current position is set to 0 if the discriminator value does + * not match any member variant. Otherwise, the current position is set to 1, + * index of the member variant. + * </p> + * @throws TypeMismatch if the discriminator has a wrong type of this union. + */ + void set_discriminator(DynAny aDiscriminator) + throws TypeMismatch; + + /** + * Get the kind of the union descriminator. + * + * @return the TCKind value of the discriminator typecode. + */ + TCKind discriminator_kind(); + + /** + * Get the current variant of the union content. + * + * @return the current member of the union. This reference is only valid as + * long as the current member does not change. + * + * @throws InvalidValue if the union has no active member. + */ + DynAny member() + throws InvalidValue; + + /** + * Returns the kind of the currently active union member. + * + * @return the TCKind value of the union member. + * + * @throws InvalidValue if the union has no active member. + */ + TCKind member_kind() + throws InvalidValue; + + /** + * Returns the name of the currently active union member. + * + * @return the TCKind value of the union member. + * + * @throws InvalidValue if the union has no active member. + */ + String member_name() + throws InvalidValue; + + /** + * Returns true if the union has no active member. This happens if If the + * discriminator value defines no valid variant. Such union consists of + * discriminator only, having the size 1. + */ + boolean has_no_active_member(); + + /** + * Set the discriminator to default value. The current position is set to 0. + * This also sets the content variant to the default variant, and the size of + * the union becomes 2. + * + * @throws TypeMismatch if the default case is not defined for this union. + */ + void set_to_default_member() + throws TypeMismatch; + + /** + * Set the discriminator to value that does not correspond any content variant + * (any union <code>case</code> label). The current position is set to 0. + * The size of the union becomes 0. + * + * @throws TypeMismatch if the union has explicit default case. + */ + void set_to_no_active_member() + throws TypeMismatch; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynValue.java b/libjava/classpath/org/omg/DynamicAny/DynValue.java new file mode 100644 index 0000000..831ce60 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValue.java @@ -0,0 +1,58 @@ +/* DynValue.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines a non boxed value type. From the view point of DynAny, the Value is + * very much like structure. The access to fields of this structer are supported + * via {@link DynValueOperations} interface.Unlike structure, the value can also + * be equal to <code>null</code> that is supported via + * {@link DynValueCommonOperations} interface. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValue + extends DynValueOperations, DynValueCommon, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueBox.java b/libjava/classpath/org/omg/DynamicAny/DynValueBox.java new file mode 100644 index 0000000..bd758b5 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueBox.java @@ -0,0 +1,55 @@ +/* DynValueBox.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * A "ValueBox" is a Value type container, holding a single instance of the + * other CORBA type. This content can be set to <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueBox + extends DynValueBoxOperations, DynValueCommon, DynAny, IDLEntity, + org.omg.CORBA.Object, Serializable +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueBoxOperations.java b/libjava/classpath/org/omg/DynamicAny/DynValueBoxOperations.java new file mode 100644 index 0000000..d32541b --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueBoxOperations.java @@ -0,0 +1,91 @@ +/* DynValueBoxOperation.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable for the boxed value type. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueBoxOperations + extends DynValueCommonOperations, DynAnyOperations +{ + /** + * Get the return the content of the "box" as the DynAny. + * + * @throws InvalidValue if the object is holding <code>null</code>. + */ + DynAny get_boxed_value_as_dyn_any() + throws InvalidValue; + + /** + * Get the return the content of the "box" as the Any. + * + * @throws InvalidValue if the object is holding <code>null</code>. + */ + Any get_boxed_value() + throws InvalidValue; + + /** + * Set the value of the "box" from DynAny. + * + * @param boxIt a value to box. + * + * @throws TypeMismatch if the type is not matching the current boxed value + * type. + */ + void set_boxed_value_as_dyn_any(DynAny boxIt) + throws TypeMismatch; + + /** + * Set the value of the "box" as Any. + * + * @param boxIt a value to place into the box. + * + * @throws TypeMismatch if the type is not matching the current boxed value + * type. + */ + void set_boxed_value(Any boxIt) + throws TypeMismatch; + +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueCommon.java b/libjava/classpath/org/omg/DynamicAny/DynValueCommon.java new file mode 100644 index 0000000..1b324aa --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueCommon.java @@ -0,0 +1,76 @@ +/* DynValueCommon.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines DynAny that may hold CORBA <code>null</code>. The + * {@link DynValueCommonOperations} provides methods for setting the value to + * <code>null</code> or non-<code>null</code> and checking if the value is + * <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueCommon + extends DynValueCommonOperations, DynAny, IDLEntity, org.omg.CORBA.Object, + Serializable +{ + /** + * Check if this {@link DynAny} is holding the <code>null</code>. + * + * @return true if this {@link DynAny} is holding the <code>null</code>, + * false otherwise. + */ + boolean is_null(); + + /** + * Set the value of this {@link DynAny} to CORBA <code>null</code>. + */ + void set_to_null(); + + /** + * Set the value of this {@link DynAny} to the default non-null value. The + * target {@link DynAny} creates a new data structure, intialised to the + * agreed default values, as defined in {@link DynAnyFactoryOperations}. + */ + void set_to_value(); +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueCommonOperations.java b/libjava/classpath/org/omg/DynamicAny/DynValueCommonOperations.java new file mode 100644 index 0000000..31c3167 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueCommonOperations.java @@ -0,0 +1,69 @@ +/* DynValueCommonOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +/** + * Provides operations, applicable to {@link DynAny}s that may hold CORBA + * <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueCommonOperations + extends DynAnyOperations +{ + /** + * Check if this {@link DynAny} is holding the <code>null</code>. + * + * @return true if this {@link DynAny} is holding the <code>null</code>, + * false otherwise. + */ + boolean is_null(); + + /** + * Set the value of this {@link DynAny} to CORBA <code>null</code>. + */ + void set_to_null(); + + /** + * Set the value of this {@link DynAny} to the default non-null value. The + * target {@link DynAny} creates a new data structure, intialised to the + * agreed default values, as defined in {@link DynAnyFactoryOperations}. + */ + void set_to_value(); +} diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java new file mode 100644 index 0000000..a6d7afa --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java @@ -0,0 +1,151 @@ +/* DynValueHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for {@link DynValue}. Following the 1.5 JDK + * specifications, DynValue is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @specnote always throwing MARSHAL in read and write ensures compatibility + * with other popular implementations like Sun's. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynValueHelper +{ + /** + * Cast the passed object into the DynValue. As DynValue is a local object, + * the method just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a DynValue. + */ + public static DynValue narrow(org.omg.CORBA.Object obj) + { + try + { + return (DynValue) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a DynValue"); + } + } + + /** + * Get the type code of the {@link DynValue}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "DynValue"); + } + + /** + * Insert the DynValue into the given Any. + * + * @param any the Any to insert into. + * + * @param that the DynValue to insert. + */ + public static void insert(Any any, DynValue that) + { + any.insert_Object(that); + } + + /** + * Extract the DynValue from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain DynValue. + */ + public static DynValue extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the DynValue repository id. + * + * @return "IDL:omg.org/DynamicAny/DynValue:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/DynValue:1.0"; + } + + /** + * This should read DynValue from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static DynValue read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * This should read DynValue from the CDR input stream, but (following the JDK + * 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, DynValue value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueOperations.java b/libjava/classpath/org/omg/DynamicAny/DynValueOperations.java new file mode 100644 index 0000000..b986c24 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/DynValueOperations.java @@ -0,0 +1,134 @@ +/* DynValueOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.TCKind; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +/** + * Defines operations, applicable to DynValue. From the view point of DynAny, + * the Value is very much like structure. However, differently from the + * structure, the value type can also have private members. The private members + * of DynValue are also accessible via this interface, but this possibility + * should only be used in applications like in debuggers or inter-orb bridges. + * Unlike structure, the value can also be equal to <code>null</code>. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DynValueOperations + extends DynAnyOperations, DynValueCommonOperations +{ + /** + * Get the kind of the current member. + * + * @return the kind of member at the current position. + * + * @throws TypeMismatch if this DynValue is holding <code>null</code>. + * @thorws InvalidValue if the current position does not indicate the member. + */ + TCKind current_member_kind() + throws TypeMismatch, InvalidValue; + + /** + * Get the name of the current member. + * + * @return the name of the current member as defined by the typecode. May be + * an empty string. + * + * @throws TypeMismatch if this DynValue is holding <code>null</code>. + * @thorws InvalidValue if the current position does not indicate the member. + */ + String current_member_name() + throws TypeMismatch, InvalidValue; + + /** + * Get all members as an array of the named DynAny's. The returned names are + * set as they are defined by typecode. + * + * @return the array, representing the members of this instance of value. + * + * @throws InvalidValue if this DynValue is holding <code>null</code>. + */ + NameDynAnyPair[] get_members_as_dyn_any() + throws InvalidValue; + + /** + * Get all members as an array of the named Any's. The returned names are set + * as they are defined by typecode. + * + * @return the array, representing the members of this instance of value. + * + * @throws InvalidValue if this DynValue is holding <code>null</code>. + */ + NameValuePair[] get_members() + throws InvalidValue; + + /** + * Set all members from the array of the named Any's. + * + * @param value the array, where the data for fields of the structure must + * occur exactly in the same order, as defined by typecode. + * + * @throws TypeMismatch if the type or name of the array member does not match + * the name and type of the corresponding field in the DynValue data + * structure. The empty string is assumed matching any name. + * + * @throws InvalidValue if the size of the array does not match the number of + * fields. + */ + void set_members_as_dyn_any(NameDynAnyPair[] value) + throws TypeMismatch, InvalidValue; + + /** + * Set all members from the array of the named Any's. + * + * @param value the array, where the data for fields of the structure must + * occur exactly in the same order, as defined by typecode. + * + * @throws TypeMismatch if the type or name of the array member does not match + * the name and type of the corresponding field in the DynValue data + * structure. The empty string is assumed matching any name. + * + * @throws InvalidValue if the size of the array does not match the number of + * fields. + */ + void set_members(NameValuePair[] value) + throws TypeMismatch, InvalidValue; +} diff --git a/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java new file mode 100644 index 0000000..7c4cdbf --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java @@ -0,0 +1,120 @@ +/* FieldNameHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.Restricted_ORB; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper for the FieldName. The fields {@link NameValuePair#id}, + * {@link NameDynAnyPair#id} and return values of methods + * <code>current_member_name()</code>, <code>member_name()</code> in several + * interfaces officially have the "FieldName" type. This type is directly + * mapped into java String and needs no helper. The helper + * is included only as a part of the formal standard. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class FieldNameHelper +{ + /** + * Insert the FieldName into Any (uses {@link Any.insert_string}). + * + * @param a the Any to insert into. + * @param that the string to insert. + */ + public static void insert(Any a, String that) + { + a.insert_string(that); + } + + /** + * Extract the FieldName from Any ((uses {@link Any.extract_string}). + * + * @param a the Any to extract from. + */ + public static String extract(Any a) + { + return a.extract_string(); + } + + /** + * Return an alias typecode. + */ + public static TypeCode type() + { + ORB orb = Restricted_ORB.Singleton; + return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0)); + } + + /** + * Return the FieldName repository id. + * @return "IDL:omg.org/DynamicAny/FieldName:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/FieldName:1.0"; + } + + /** + * Calls {@link InputStream#read_string()}. + * + * @param instream the stream to read from. + */ + public static String read(InputStream istream) + { + return istream.read_string(); + } + + /** + * Calls {@link OutputStream#write_string()}. + * + * @param ostream the stream to write into. + * @param value the string (FieldName) value to write. + */ + public static void write(OutputStream ostream, String value) + { + ostream.write_string(value); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPair.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPair.java new file mode 100644 index 0000000..5fe438b --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPair.java @@ -0,0 +1,87 @@ +/* NameDynAnyPair.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Stores the named value, representing the name by string and the value by + * {@link DynAny}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameDynAnyPair + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1992533286932908564L; + + /** + * The name of the named value. + */ + public String id; + + /** + * The value of the named value. + */ + public DynAny value; + + /** + * Create unitialised instance with both fields left with default + * <code>null</code> value. + */ + public NameDynAnyPair() + { + } + + /** + * Create an instance with the given initial values. + * + * @param aName the name of the named value. + * @param aValue the value of the named value. + */ + public NameDynAnyPair(String aName, DynAny aValue) + { + id = aName; + value = aValue; + } +} diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java new file mode 100644 index 0000000..d649800 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java @@ -0,0 +1,170 @@ +/* NameDynAnyPairHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.NameDynAnyPairHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the structure {@link NameDynAnyPair}. + * + * Following the 1.5 JDK specifications, DynAny (and hence any structure, + * containing DynAny) is always a local object, so the two methods of this + * helper ({@link #read} and {@link #write} are not in use, always throwing + * {@link MARSHAL}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameDynAnyPairHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Extract the NameDynAnyPair from given Any. + * This method uses the NameDynAnyPairHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameDynAnyPair. + */ + public static NameDynAnyPair extract(Any any) + { + try + { + return ((NameDynAnyPairHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPair expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the NameDynAnyPair repository id. + * + * @return "IDL:omg.org/DynamicAny/NameDynAnyPair:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameDynAnyPair:1.0"; + } + + /** + * Create the NameDynAnyPair typecode (structure, + * named "NameDynAnyPair"). + * The typecode states that the structure contains the + * following fields: id, value. + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + StructMember[] members = new StructMember[ 2 ]; + + TypeCode field; + + field = + orb.create_alias_tc("IDL:omg.org/DynamicAny/FieldName:1.0", + "FieldName", + orb.get_primitive_tc(TCKind.tk_string) + ); + members [ 0 ] = new StructMember("id", field, null); + + field = DynAnyHelper.type(); + members [ 1 ] = new StructMember("value", field, null); + typeCode = orb.create_struct_tc(id(), "NameDynAnyPair", members); + } + return typeCode; + } + + /** + * Insert the NameDynAnyPair into the given Any. + * This method uses the NameDynAnyPairHolder. + * + * @param any the Any to insert into. + * @param that the NameDynAnyPair to insert. + */ + public static void insert(Any any, NameDynAnyPair that) + { + any.insert_Streamable(new NameDynAnyPairHolder(that)); + } + + /** + * The method should read this object from the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static NameDynAnyPair read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * The method should write this object to the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, NameDynAnyPair value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java new file mode 100644 index 0000000..f110926 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java @@ -0,0 +1,151 @@ +/* NameDynAnyPairSeq.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.NameDynAnyPairSeqHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the array of {@link NameDynAnyPair} + * ({@link NameDynAnyPairSeq}). + * + * Following the 1.5 JDK specifications, DynAny (and hence the sequence + * of structures, containing DynAny) is always a local object. + * Hence the two methods of this helper ({@link #read} and {@link #write} are + * not in use, always throwing {@link MARSHAL}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameDynAnyPairSeqHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + TypeCode t = orb.create_sequence_tc(0, NameDynAnyPairHelper.type()); + typeCode = orb.create_alias_tc(id(), "NameDynAnyPairSeq", t); + } + return typeCode; + } + + /** + * Insert the NameDynAnyPairSeq into the given Any. + * This method uses the NameDynAnyPairSeqHolder. + * + * @param any the Any to insert into. + * @param those the NameDynAnyPair[] to insert. + */ + public static void insert(Any any, NameDynAnyPair[] those) + { + any.insert_Streamable(new NameDynAnyPairSeqHolder(those)); + } + + /** + * Extract the NameDynAnyPairSeq from given Any. + * This method uses the NameDynAnyPairSeqHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameDynAnyPairSeq. + */ + public static NameDynAnyPair[] extract(Any any) + { + try + { + return ((NameDynAnyPairSeqHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPairSeq expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the NameDynAnyPairSeq repository id. + * + * @return "IDL:omg.org/DynamicAny/NameDynAnyPairSeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameDynAnyPairSeq:1.0"; + } + + /** + * The method should read this object from the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static NameDynAnyPair[] read(InputStream input) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } + + /** + * The method should write this object to the CDR input stream, but + * (following the JDK 1.5 API) it does not. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, NameDynAnyPair[] value) + { + throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePair.java b/libjava/classpath/org/omg/DynamicAny/NameValuePair.java new file mode 100644 index 0000000..e0ce752 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameValuePair.java @@ -0,0 +1,90 @@ +/* NameValuePair.java -- + Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.DynStruct; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Holds the value, having the given name(id). This class is used by with + * {@link DynStruct} to name the fields of the record (structure). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class NameValuePair + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1289460542874201736L; + + /** + * The value of the structure record. + */ + public Any value; + + /** + * The name of the structure record. + */ + public String id; + + /** + * Cretes an unitialised instance of the name-value pair. + */ + public NameValuePair() + { + } + + /** + * Creates the name-value pair, initialising the fields to the passed values. + * + * @param aName the name (also called id) of the name-value pair, normally the + * name of the structure field. + * + * @param aValue the value of the name-value pair. + */ + public NameValuePair(String aName, Any aValue) + { + id = aName; + value = aValue; + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java new file mode 100644 index 0000000..a3d5bff --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java @@ -0,0 +1,159 @@ +/* NameValuePairHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.NameValuePairHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the structure {@link NameValuePair}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameValuePairHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the NameValuePair typecode (structure, + * named "NameValuePair"). + * The typecode states that the structure contains the + * following fields: id, value. + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + StructMember[] members = new StructMember[ 2 ]; + + TypeCode field; + + field = + orb.create_alias_tc("IDL:omg.org/DynamicAny/FieldName:1.0", + "FieldName", + orb.get_primitive_tc(TCKind.tk_string) + ); + members [ 0 ] = new StructMember("id", field, null); + + field = orb.get_primitive_tc(TCKind.tk_any); + members [ 1 ] = new StructMember("value", field, null); + typeCode = orb.create_struct_tc(id(), "NameValuePair", members); + } + return typeCode; + } + + /** + * Insert the NameValuePair into the given Any. + * This method uses the NameValuePairHolder. + * + * @param any the Any to insert into. + * @param that the NameValuePair to insert. + */ + public static void insert(Any any, NameValuePair that) + { + any.insert_Streamable(new NameValuePairHolder(that)); + } + + /** + * Extract the NameValuePair from given Any. + * This method uses the NameValuePairHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameValuePair. + */ + public static NameValuePair extract(Any any) + { + try + { + return ((NameValuePairHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the NameValuePair repository id. + * + * @return "IDL:omg.org/DynamicAny/NameValuePair:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameValuePair:1.0"; + } + + /** + * Read the structure from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static NameValuePair read(InputStream input) + { + NameValuePair value = new NameValuePair(); + value.id = input.read_string(); + value.value = input.read_any(); + return value; + } + + /** + * Write the structure to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, NameValuePair value) + { + output.write_string(value.id); + output.write_any(value.value); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java new file mode 100644 index 0000000..400708e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java @@ -0,0 +1,147 @@ +/* NameValuePairSeq.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import gnu.CORBA.NameValuePairSeqHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * A helper operations for the array of {@link NameValuePair}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class NameValuePairSeqHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + TypeCode t = orb.create_sequence_tc(0, NameValuePairHelper.type()); + typeCode = orb.create_alias_tc(id(), "NameValuePairSeq", t); + } + return typeCode; + } + + /** + * Insert the NameValuePairSeq into the given Any. + * This method uses the NameValuePairSeqHolder. + * + * @param any the Any to insert into. + * @param those the NameValuePair[] to insert. + */ + public static void insert(Any any, NameValuePair[] those) + { + any.insert_Streamable(new NameValuePairSeqHolder(those)); + } + + /** + * Extract the NameValuePairSeq from given Any. + * This method uses the NameValuePairSeqHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain NameValuePairSeq. + */ + public static NameValuePair[] extract(Any any) + { + try + { + return ((NameValuePairSeqHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("NameValuePairSeq expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the NameValuePairSeq repository id. + * + * @return "IDL:omg.org/DynamicAny/NameValuePairSeq:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/DynamicAny/NameValuePairSeq:1.0"; + } + + /** + * Read the sequence from the CDR intput stream. + * Expects the array size (as CORBA long), followed by + * the array members (if any). + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static NameValuePair[] read(InputStream input) + { + NameValuePair[] value; + value = new NameValuePair[ input.read_long() ]; + for (int i = 0; i < value.length; i++) + value [ i ] = NameValuePairHelper.read(input); + return value; + } + + /** + * Write the structure to the CDR output stream. + * Writes the array size (as CORBA long), followed by + * the array members (if any). + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value an array to write. + */ + public static void write(OutputStream output, NameValuePair[] value) + { + output.write_long(value.length); + for (int i0 = 0; i0 < value.length; i0++) + { + NameValuePairHelper.write(output, value [ i0 ]); + } + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java new file mode 100644 index 0000000..b0f6d60 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java @@ -0,0 +1,122 @@ +/* _DynAnyFactoryStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on + * DynAnyFactory. As DynAny can never be remote at least till 1.5 inclusive, + * this class is not in use. DynAnyFactory should be obtained from the + * {@link ORB#resolve_initial_references}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynAnyFactoryStub + extends ObjectImpl + implements DynAnyFactory, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -6575269659020082310L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynAnyFactoryOperations.class; + + /** + * Create the DynAnyFactory stub. + */ + public _DynAnyFactoryStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynAnyFactoryStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynAnyFactoryHelper.id() }; + } + + /** + * The remote call of this DynAnyFactory method is not possible + * (the created DynAny would not be transferred to client). + * + * @throws MARSHAL, always. + */ + public DynAny create_dyn_any(Any _0) + throws InconsistentTypeCode + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of this DynAnyFactory method is not possible + * (the created DynAny would not be transferred to client). + * + * @throws MARSHAL, always. + */ + public DynAny create_dyn_any_from_type_code(TypeCode _0) + throws InconsistentTypeCode + { + throw new MARSHAL(NOT_APPLICABLE); + } + + static String NOT_APPLICABLE = + "DynAnyFactory is always local objects. " + + "It is never accessed on remote side via stub."; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynAnyStub.java b/libjava/classpath/org/omg/DynamicAny/_DynAnyStub.java new file mode 100644 index 0000000..af8d4e5 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynAnyStub.java @@ -0,0 +1,636 @@ +/* _DynAnyStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.Delegate; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynAny. As + * DynAny can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynAnyStub + extends ObjectImpl + implements DynAny, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -6521892777941121597L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynAnyOperations.class; + + /** + * Create the DynAny stub. + */ + public _DynAnyStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynAnyStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynAnyHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode type() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean next() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void destroy() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny copy() + { + return this; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void rewind() + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void assign(DynAny _0) + throws TypeMismatch + { + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int component_count() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny current_component() + throws TypeMismatch + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean equal(DynAny _0) + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void from_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any get_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean get_boolean() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_char() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public double get_double() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_dyn_any() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public float get_float() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_long() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_longlong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public byte get_octet() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public org.omg.CORBA.Object get_reference() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_short() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_string() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TypeCode get_typecode() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_ulong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public long get_ulonglong() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public short get_ushort() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Serializable get_val() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public char get_wchar() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_wstring() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_any(Any _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_boolean(boolean _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_char(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_double(double _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_dyn_any(DynAny _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_float(float _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_long(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_longlong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_octet(byte _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_reference(org.omg.CORBA.Object _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_short(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_string(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_typecode(TypeCode _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulong(int _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ulonglong(long _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_ushort(short _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_val(Serializable _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wchar(char _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void insert_wstring(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean seek(int _0) + { + throw new MARSHAL(NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any to_any() + { + throw new MARSHAL(NOT_APPLICABLE); + } + + static String NOT_APPLICABLE = + "DynAnys are always local objects. " + + "They and are never accessed on remote side via stubs."; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynArrayStub.java b/libjava/classpath/org/omg/DynamicAny/_DynArrayStub.java new file mode 100644 index 0000000..4484f16 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynArrayStub.java @@ -0,0 +1,134 @@ +/* _DynArrayStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.Delegate; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynArray. As + * DynArray can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynArrayStub + extends _DynAnyStub + implements DynArray, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -6302474930370950228L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynArrayOperations.class; + + /** + * Create the DynArray stub. + */ + public _DynArrayStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynArrayStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynArrayHelper.id() }; + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any[] get_elements() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny[] get_elements_as_dyn_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements(Any[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynArray methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements_as_dyn_any(DynAny[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynEnumStub.java b/libjava/classpath/org/omg/DynamicAny/_DynEnumStub.java new file mode 100644 index 0000000..ea7879b --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynEnumStub.java @@ -0,0 +1,132 @@ +/* _DynEnumStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.Delegate; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynEnum. As + * DynEnum can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynEnumStub + extends _DynAnyStub + implements DynEnum, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 696844314172031949L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynEnumOperations.class; + + /** + * Create the DynEnum stub. + */ + public _DynEnumStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynEnumStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynEnumHelper.id() }; + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_as_string() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_as_ulong() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_as_string(String _0) + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynEnum methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_as_ulong(int _0) + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynFixedStub.java b/libjava/classpath/org/omg/DynamicAny/_DynFixedStub.java new file mode 100644 index 0000000..8e2747e --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynFixedStub.java @@ -0,0 +1,112 @@ +/* _DynFixedStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.Delegate; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynFixed. As + * DynFixed can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynFixedStub + extends _DynAnyStub + implements DynFixed, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -1932029532964417188L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynFixedOperations.class; + + /** + * Create the DynFixed stub. + */ + public _DynFixedStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynFixedStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynFixedHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String get_value() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean set_value(String _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynSequenceStub.java b/libjava/classpath/org/omg/DynamicAny/_DynSequenceStub.java new file mode 100644 index 0000000..5f1f038 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynSequenceStub.java @@ -0,0 +1,157 @@ +/* _DynSequenceStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.Any; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.Delegate; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynSequence. As + * DynSequence can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynSequenceStub + extends _DynAnyStub + implements DynSequence, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 7191437435669107554L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynSequenceOperations.class; + + /** + * Create the DynSequence stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynSequenceStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynSequenceStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynSequenceHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public Any[] get_elements() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny[] get_elements_as_dyn_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements(Any[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_elements_as_dyn_any(DynAny[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public int get_length() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_length(int _0) + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynStructStub.java b/libjava/classpath/org/omg/DynamicAny/_DynStructStub.java new file mode 100644 index 0000000..0b8231b --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynStructStub.java @@ -0,0 +1,158 @@ +/* _DynStructStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.portable.Delegate; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynStruct. As + * DynStruct can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynStructStub + extends _DynAnyStub + implements DynStruct, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -8415786200783826656L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynStructOperations.class; + + /** + * Create the DynStruct stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynStructStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynStructStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynStructHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind current_member_kind() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String current_member_name() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameValuePair[] get_members() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameDynAnyPair[] get_members_as_dyn_any() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members(NameValuePair[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members_as_dyn_any(NameDynAnyPair[] _0) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynUnionStub.java b/libjava/classpath/org/omg/DynamicAny/_DynUnionStub.java new file mode 100644 index 0000000..7f8eba7 --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynUnionStub.java @@ -0,0 +1,190 @@ +/* _DynUnionStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.portable.Delegate; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynUnion. As + * DynUnion can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynUnionStub + extends _DynAnyStub + implements DynUnion, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -8921031953572009897L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynUnionOperations.class; + + /** + * Create the DynUnion stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynUnionStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynUnionStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynUnionHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny member() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind discriminator_kind() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public DynAny get_discriminator() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean has_no_active_member() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind member_kind() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String member_name() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_discriminator(DynAny _0) + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_default_member() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_no_active_member() + throws TypeMismatch + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/_DynValueStub.java b/libjava/classpath/org/omg/DynamicAny/_DynValueStub.java new file mode 100644 index 0000000..5319a7b --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/_DynValueStub.java @@ -0,0 +1,190 @@ +/* _DynValueStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.DynamicAny; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.portable.Delegate; +import org.omg.DynamicAny.DynAnyPackage.InvalidValue; +import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; + +import java.io.Serializable; + +/** + * Should provide support for remote invocation of methods on DynValue. As + * DynValue can never be remote at least till 1.5 inclusive, this class is + * not in use. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _DynValueStub + extends _DynAnyStub + implements DynValue, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 5815313794012360824L; + + /** + * The purpose and value of this field are not documented. + */ + public static final Class _opsClass = DynValueOperations.class; + + /** + * Create the DynValue stub. To get the stub working, + * you must later set the delegate with + * {@link ObjectImpl#_set_delegate(Delegate)}. + */ + public _DynValueStub() + { + } + + /** + * Create the naming context stub with the given delegate. + */ + public _DynValueStub(Delegate delegate) + { + _set_delegate(delegate); + } + + /** + * Return the array of repository ids for this object. + */ + public String[] _ids() + { + return new String[] { DynValueHelper.id() }; + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public TCKind current_member_kind() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public String current_member_name() + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameValuePair[] get_members() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public NameDynAnyPair[] get_members_as_dyn_any() + throws InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members(NameValuePair[] a_members) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_members_as_dyn_any(NameDynAnyPair[] a_members) + throws TypeMismatch, InvalidValue + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public boolean is_null() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_null() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } + + /** + * The remote call of DynAny methods is not possible. + * + * @throws MARSHAL, always. + */ + public void set_to_value() + { + throw new MARSHAL(_DynAnyStub.NOT_APPLICABLE); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/DynamicAny/package.html b/libjava/classpath/org/omg/DynamicAny/package.html new file mode 100644 index 0000000..997006d --- /dev/null +++ b/libjava/classpath/org/omg/DynamicAny/package.html @@ -0,0 +1,87 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - org.omg.DynamicAny</title></head> + +<body> +<p>DynAny's allow to work with data structures, exact content of those is not +known at the time of compilation. In this way, the conception of DynAny +remebers the java reflection mechanism. DynAny usually obtain the value from +the {@link org.omg.CORBA.Any} that, if needed, can carry highly nested data +structures (like array of sequences of unions). DynAny's allow to see/modify +all parts of such structures. This is especially helpful for writing generic +servers (bridges, event channels supporting, filtering and so on). Similarly, +DynAny's can create an Any at runtime, without having static knowledge of its +type. This is helpful for writing generic clients like browsers, debuggers or + user interface tools. +</p><p> +The API clearly states that DynAny and DynAnyFactory objects are local and +cannot be transferred to remote server or client. While such methods are +formally defined in the corresponding helpers, they simply always throw MARSHAL. +</p><p> +DynAny's are created by {@link DynAnyFactory}. The factory is obtaines by +{@link org.omg.CORBA.ORB#resolve_initial_references): +<code> +ORB orb = ORB.init(new String[0], null); +DynAnyFactory f = DynAnyFactoryHelper.narrow(orb.resolve_initial_references("DynAnyFactory")); +</code> +DynAny's are also returned by some methods, invoked on another DynAny. +</p><p> +The primitive types like string or char are wrapped into an ordinary DynAny. It +has multiple methods for setting/getting the content like +{@link DynAnyOperations#get_string()} or +{@link DynAnyOperations#insert_string(String)}. The more complex types like +sequences or structures are wrapped into specialised DynAny's, providing means +to access the enclosed members. In this case, the DynAny has the +"internal cursor", normally pointing at one of the members in the data +structure. The "internal cursor" can be set to the needed position +{@link DynAnyOperations#seek(int)} or advanced forward +({@link DynAnyOperations#next()}. The member under cursor is returned by +{@link DynAnyOperations#current_component()}. For composite DynAnys the +methods like {@link DynAnyOperations#get_string()} or +{@link DynAnyOperations#insert_string(String)} apply to the selected member, +not to the complex DynAny in general. +</p><p> +DynAnys are created and optimized for traversing values extracted from anys +or constructing values of anys at runtime. OMG does not recommend to use them +for other purposes. +</p><p> +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html>
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfo.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfo.java new file mode 100644 index 0000000..dd3cd58 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfo.java @@ -0,0 +1,54 @@ +/* ClientRequestInfo.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Provides request information, accessible for the + * {@link ClientRequestInterceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInfo extends ClientRequestInfoOperations, + org.omg.CORBA.Object, + IDLEntity, + RequestInfo +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfoOperations.java new file mode 100644 index 0000000..73efa12 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInfoOperations.java @@ -0,0 +1,328 @@ +/* ClientRequestInfoOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.INV_POLICY; +import org.omg.CORBA.Policy; +import org.omg.IOP.ServiceContext; +import org.omg.IOP.TaggedComponent; +import org.omg.IOP.TaggedProfile; + +/** + * Provides request information, accessible for the + * {@linkplain ClientRequestInterceptor}. Some methods of this interface are + * not valid at all interception points. The following table shows the validity + * of each method. If it is not valid, BAD_INV_ORDER minor 14 will be thrown. + * + * <table border="1"> + * <tr> + * <th></th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_request send_request}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_poll send_poll}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_reply receive_reply}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_exception receive_exception}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_other receive_other}</th> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"><i>Inherited from + * {@linkplain RequestInfoOperations}:</i></td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#arguments arguments}</th> + * <td bgcolor="#E0E0E0" title="in and inout only">yes <sub><a href="#1">1</a></sub></td> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#exceptions exceptions}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#contexts contexts}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation_context operation_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#result result}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#sync_scope sync_scope}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#reply_status reply_status}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#forward_reference forward_reference}</th> + * <td>no</td> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">yes <sub><a + * href="#2">2</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_request_service_context get_request_service_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_reply_service_context get_reply_service_context}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#request_id request_id}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation operation}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#response_expected response_expected}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_slot get_slot}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"><i>ClientRequestInfo-specific:</i></td> + * </tr> + * <tr> + * <th>{@linkplain #target target}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #effective_target effective_target}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #effective_profile effective_profile}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #received_exception received_exception}</th> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain #received_exception_id received_exception_id}</th> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain #get_effective_component get_effective_component}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #get_effective_components get_effective_components}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #get_request_policy get_request_policy}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #add_request_service_context add_request_service_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray" colspan="4" align="center">no</td> + * </tr> + * <tr> + * <th></th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_request send_request}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#send_poll send_poll}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_reply receive_reply}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_exception receive_exception}</th> + * <th>{@linkplain ClientRequestInterceptorOperations#receive_other receive_other}</th> + * </tr> + * </table> + * <ol> + * <li><a name="1">When ClientRequestInfo is passed to send_request, there is + * an entry in the list for every argument, but only the in and inout arguments + * will be available.</a></li> + * <li><a name="2">If the reply_status atribute is not LOCATION_FORWARD, + * accessing this attribute will throw BAD_INV_ORDER with a standard minor code + * of 14.</a></li> + * </ol> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInfoOperations extends RequestInfoOperations +{ + /** + * Returns the object on that the client has invoked the the operation. If the + * request was forwarded, it will not be the same object that actually + * processed the request. + * + * @return the initial client invocation target. + * + * @see #effective_target() + */ + org.omg.CORBA.Object target(); + + /** + * Returns the object on that the operation will be invoked after handling the + * possible forwarding. + * + * @return the final invocation target. + * + * @see #target() + */ + org.omg.CORBA.Object effective_target(); + + /** + * Returns the tagged profile (IOR) of the invocation target. If the request + * was forwarded, the method returns the new location, shown by the forwarding + * message. + * + * @return the invocation IOR. + */ + TaggedProfile effective_profile(); + + /** + * Returns the given component of the invocation target profile. If the + * profile contains multiple components with the same Id, it is not defined, + * which one will be returned. + * + * @param id the component id. + * + * @return the profile component with the given Id. + * + * @throws BAD_PARAM minor 28 in there are no any components with the given Id + * in the profile. + */ + TaggedComponent get_effective_component(int id) throws BAD_PARAM; + + /** + * Returns the given components of the invocation target profile. This method + * is uses when the profile may contain multiple components with the same Id. + * + * @param id the component id. + * + * @return the array of all profile components with the given Id. + * + * @throws BAD_PARAM minor 28 in there are no any components with the given Id + * in the profile. + */ + TaggedComponent[] get_effective_components(int id) throws BAD_PARAM; + + /** + * This should return the policy of the given type that applies to this + * operation, but it is not implemented up till JDK 1.5 inclusive. + * + * @param type the type of the policy being requested. + * + * @return should return the policy that applies to this operation. + * + * @throws NO_IMPLEMENT always. + */ + Policy get_request_policy(int type) throws INV_POLICY; + + /** + * Returns the repository id of the remote exception that was thrown on the + * server side. + * + * @return the exception repository id. + * + * @see #received_exception() + */ + String received_exception_id(); + + /** + * Returns the remote exception that was thrown on the server side. + * + * @return the Any, holding this exception. + * + * @see #received_exception_id() + */ + Any received_exception(); + + /** + * Allows the interceptor to add the service contexts to the request. Such + * added contexts can carry arbitrary data and can be later accessed on the + * server side by the server request interceptor, using + * {@link RequestInfoOperations#get_request_service_context}. + * + * @param service_context the context to add. + * @param replace if true, the existing context with the same Id will be + * replaced. If false, the BAD_INV_ORDER will be thrown in that case. + * + * @throws BAD_INV_ORDER minor 15 if the context with the same Id already + * exists and replace=false. + */ + void add_request_service_context(ServiceContext service_context, + boolean replace + ); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptor.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptor.java new file mode 100644 index 0000000..9fdf2f1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptor.java @@ -0,0 +1,54 @@ +/* ClientRequestInterceptor.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * A client side request interceptor that is notified on various request + * processing steps on a client side. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInterceptor extends Interceptor, + ClientRequestInterceptorOperations, + org.omg.CORBA.Object, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java new file mode 100644 index 0000000..4a60b77 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ClientRequestInterceptorOperations.java @@ -0,0 +1,128 @@ +/* ClientRequestInterceptorOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + + +/** + * Defines operations, applicable to the client side request interceptor. The + * operations are called by ORB at the appropriate interception points. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ClientRequestInterceptorOperations + extends InterceptorOperations +{ + /** + * ORB calls this method before sending the request to the server. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_request is not called for the + * subsequent interceptors, calling receive_exception instead. The completion + * status of this exception must be COMPLETED_NO. + * + * @throws ForwardRequest to forward the invocation to another target. The + * send_request is not called for the subsequent interceptors, calling + * receive_other instead. + */ + void send_request(ClientRequestInfo info) throws ForwardRequest; + + /** + * ORB calls this method after the normal reply is received from the server + * and before the control is returned to the calling client code. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the receive_reply is not called for the + * subsequent interceptors, calling receive_exception instead. The completion + * status of this exception must be COMPLETED_YES. + */ + void receive_reply(ClientRequestInfo info); + + /** + * ORB calls this method after the receiving the message that a remote + * exception has been thrown on a server side and before raising this + * exception in the client side. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException has the effect of changing the exception that + * successive interceptors receive on their calls to receive_other. If the + * original exception is a system exception, the completion_status of the new + * exception must match the exception being replaced. If the original + * exception is a user exception, then the completion_status of the new + * exception must be COMPLETED_YES. + * + * @throws ForwardRequest to forward the invocation to another target. The + * receive_exception is not called for the subsequent interceptors, calling + * receive_other instead. If the completion_status of the original exception + * is not a COMPLETED_NO, the ForwardRequest must not be raised. + */ + void receive_exception(ClientRequestInfo info) throws ForwardRequest; + + /** + * /** ORB normally calls this method after receiving the forwarding message. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the receive_other is not called for the + * subsequent interceptors, calling receive_exception instead. + * + * @throws ForwardRequest has the effect of changing the redirection that + * successive interceptors receive on their calls to receive_other. + */ + void receive_other(ClientRequestInfo info) throws ForwardRequest; + + /** + * This method is called by if ORB uses the Time- Independent Invocation (TII) + * polling. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_poll is not called for the + * subsequent interceptors, calling receive_exception instead. The completion + * status of this exception must be COMPLETED_NO. + */ + void send_poll(ClientRequestInfo info); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/Current.java b/libjava/classpath/org/omg/PortableInterceptor/Current.java new file mode 100644 index 0000000..d53d5c3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/Current.java @@ -0,0 +1,85 @@ +/* Current.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The portable interceptor Current (PICurrent) contains multiple slots where an + * interceptor can rememeber the request - specific values between subsequent + * calls of the interceptor methods. In multithreaded environment, it is not + * possible just to store such data in the interceptor object fields. + * </p> + * <p> + * On the client side, it is possible to set the initial slot values by + * modifying slots on the Current, returend by ORB.resolve_initial_references + * ("PICurrent"). The returned value is narrowed with the + * {@link CurrentHelper#narrow}. On the subsequent invocation, made from the + * same thread, the interceptors will see the initial slot values as they were + * set using this approach. + * </p> + * <p> + * There are no way to set the initial values for the server side interceptors, + * the default values (Any with typecode TCKind.tk_null) should be always + * assumed. + * </p> + * <p> + * Since an Interceptor is running in a thread, it is running with a thread + * context and there is a PICurrent on that context. If the Interceptor calls + * ORB.resolve_initial_references ("PICurrent"), it gets the PICurrent within + * its thread scope. This PICurrent is different than the request scope + * PICurrent that the Interceptor obtains via calls to the Client- or Server- + * RequestInfo object. + * </p> + * <p> + * On the client side the PICurrent can be used to detect the recursive + * invocations, performed by interceptors. If one of the interceptors makes call + * via the same ORB, this call is then showed to all interceptors, including the + * interceptor that made it. To avoid infinite recursion, the during each call + * this interceptor can set some "recursion flag" into one of the slots of the + * PICurrent. If the flag is set on the entry point, this indicates a recursive + * call of that request. + * </p> + */ +public interface Current extends CurrentOperations, + org.omg.CORBA.Current, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java new file mode 100644 index 0000000..b7a5a54 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java @@ -0,0 +1,150 @@ +/* CurrentHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.MARSHAL; +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 CORBA object {@link Current}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class CurrentHelper +{ + /** + * The cached {@link Current} typecode, computed once. + */ + private static TypeCode typeCode; + + /** + * Get the type code of the {@link Current}. + */ + public static TypeCode type() + { + if (typeCode == null) + { + typeCode = ORB.init().create_interface_tc(id(), "Current"); + } + return typeCode; + } + + /** + * Insert the Current into the given Any. + * + * @param any the Any to insert into. + * @param that the Current to insert. + */ + public static void insert(Any any, Current that) + { + any.insert_Object(that); + } + + /** + * Extract the Current from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain Current. + */ + public static Current extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the Current repository id. + * + * @return "org.omg.PortableInterceptor.CurrentOperations", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/Current:1.0"; + } + + /** + * Cast the passed object into the Current. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a Current. + */ + public static Current narrow(org.omg.CORBA.Object obj) + { + if (obj == null) + { + return null; + } + else if (obj instanceof Current) + { + return (Current) obj; + } + else + { + throw new BAD_PARAM("Not a Current"); + } + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.5 inclusive. + * + * @throws MARSHAL always. + */ + public static Current read(InputStream input) + { + throw new MARSHAL(); + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.5 inclusive. + * + * @throws MARSHAL always. + */ + public static void write(OutputStream output, Current value) + { + throw new MARSHAL(); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/CurrentOperations.java b/libjava/classpath/org/omg/PortableInterceptor/CurrentOperations.java new file mode 100644 index 0000000..6351567 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/CurrentOperations.java @@ -0,0 +1,87 @@ +/* CurrentOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_INV_ORDER; + +/** + * Defines the operations, applicable to the portable interceptor Current. + * + * Portable Interceptors Current (also known as PICurrent) is a slot table. Each + * slot has an integer identifier, can hold a CORBA {@link Any} and is used by + * some service to transfer data between thread and request contexts. Each + * service which wishes to use PICurrent reserves a slot or slots at + * initialization time and uses those slots during the processing of requests + * and replies. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CurrentOperations + extends org.omg.CORBA.CurrentOperations +{ + /** + * Get data from the slot with the given slot_id. + * + * @param slot_id the slot slot_id. + * + * @return the Any that was stored in the slot. If the given slot has not been + * set, the returned Any contains a type code with a TCKind value of tk_null + * and has no value. + * + * @throws InvalidSlot for the unknown slot. + * @throws BAD_INV_ORDER minor 10 if called from the {@link ORBInitializer} + * methods. + */ + Any get_slot(int slot_id) throws InvalidSlot, BAD_INV_ORDER; + + /** + * Sets data for the slot with the given slot_id. + * + * @param slot_id the slot slot_id. + * + * @param data the Any that will be stored into the slot. + * + * @throws InvalidSlot for the unknown slot. + * @throws BAD_INV_ORDER minor 10 if called from the {@link ORBInitializer} + * methods. + * + */ + void set_slot(int slot_id, Any data) throws InvalidSlot, BAD_INV_ORDER; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequest.java b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequest.java new file mode 100644 index 0000000..7e7d7a3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequest.java @@ -0,0 +1,97 @@ +/* ForwardRequest.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The ForwardRequest is thrown by interceptors to forward the request to + * another target. The field {@link #forward} contains the reference to this + * alternative location. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ForwardRequest extends UserException implements IDLEntity, + Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 2128007517550526397L; + + /** + * The field forward. + */ + public org.omg.CORBA.Object forward; + + /** + * Create ForwardRequest with no explaining + * message and all fields left unitialised with the default initial java values. + */ + public ForwardRequest() + { + } + + /** + * Create the ForwardRequest with explaining + * message and all fields initialised to the given values. + * + * @param why a string, explaining, why this exception has been thrown. + * @param a_forward a value for forward. + */ + public ForwardRequest(String why, org.omg.CORBA.Object a_forward) + { + super(why); + this.forward = a_forward; + } + + /** + * Create the ForwardRequest without explaining + * message and all fields initialised to the given values. + * + * @param a_forward a value for forward. + */ + public ForwardRequest(org.omg.CORBA.Object a_forward) + { + this.forward = a_forward; + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java new file mode 100644 index 0000000..11d6b7f --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java @@ -0,0 +1,152 @@ +/* ForwardRequestHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import gnu.CORBA.Interceptor.ForwardRequestHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the exception {@link ForwardRequest}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ForwardRequestHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the ForwardRequest typecode (structure, named "ForwardRequest"). The + * typecode states that the structure contains the following fields: forward. + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + StructMember[] members = new StructMember[ 1 ]; + + TypeCode field = ObjectHelper.type(); + members [ 0 ] = new StructMember("forward", field, null); + typeCode = orb.create_exception_tc(id(), "ForwardRequest", members); + } + return typeCode; + } + + /** + * Insert the ForwardRequest into the given Any. This method uses the + * ForwardRequestHolder. + * + * @param any the Any to insert into. + * @param that the ForwardRequest to insert. + */ + public static void insert(Any any, ForwardRequest that) + { + any.insert_Streamable(new ForwardRequestHolder(that)); + } + + /** + * Extract the ForwardRequest from given Any. This method uses the + * ForwardRequestHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain ForwardRequest. + */ + public static ForwardRequest extract(Any any) + { + try + { + return ((ForwardRequestHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION(id() + " expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ForwardRequest repository id. + * + * @return "IDL:omg.org/PortableInterceptor/ForwardRequest:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/ForwardRequest:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ForwardRequest read(InputStream input) + { + // Read (and discard) the exception repository id. + input.read_string(); + + ForwardRequest value = new ForwardRequest(); + + value.forward = input.read_Object(); + return value; + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, ForwardRequest value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_Object(value.forward); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInfo.java b/libjava/classpath/org/omg/PortableInterceptor/IORInfo.java new file mode 100644 index 0000000..9495d79 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInfo.java @@ -0,0 +1,58 @@ +/* IORInfo.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Provides the server-side ORB service possibility to add components to the new + * IOR being created. Also, provides access to policies, applicable to the + * object, referenced by that IOR. The ORB passes an instance of IORInfo as a + * parameter to {@link IORInterceptor#establish_components}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInfo extends IORInfoOperations, + IDLEntity, + org.omg.CORBA.Object, + Serializable +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java new file mode 100644 index 0000000..58ef02f --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java @@ -0,0 +1,88 @@ +/* IORInfoOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Policy; +import org.omg.IOP.TaggedComponent; + +/** + * The ORB service uses this interface to add the service specific components to + * the new IOR being constructed. The interface provides also possibility to get + * the POA policies the apply to the IOR being constructed. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInfoOperations +{ + /** + * Adds a service-specific component to the IOR profile being constructed. + * + * @param tagged_component a tagged component being added. + * + * @param profile_id the IOR profile to that the component must be added. + * The 0 value ({@link org.omg.IOP.TAG_INTERNET_IOP#value}) adds to the + * Internet profile where host and port are stored by default. + */ + void add_ior_component_to_profile(TaggedComponent tagged_component, + int profile_id + ); + + /** + * Adds a service-specific component to the IOR profile being constructed. + * The specified component will be included in all profiles, present in the + * IOR being constructed. + * + * @param tagged_component a tagged component being added. + */ + void add_ior_component(TaggedComponent tagged_component); + + /** + * Get the server side policy for an IOR being constructed. The method returns + * policies applying for POA where the object, represented by this IOR, is + * connected. + * + * @param policy_type the type of the policy. + * + * @return the policy of the given type that applies to the IOR being + * constructed. + * + * @see org.omg.PortableServer.POAOperations#create_POA + */ + Policy get_effective_policy(int policy_type); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor.java new file mode 100644 index 0000000..e78fbf2 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor.java @@ -0,0 +1,61 @@ +/* IORInterceptor.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * An ORB service implementation may need to add information describing the + * serverORB service related capabilities to object references + * (IORs). This is supported through the IORInterceptor and {@link IORInfo} + * interfaces. The IOR Interceptor is used to establish tagged components in the + * profiles within a new IOR being created. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptor extends IDLEntity, + Interceptor, + InterceptorOperations, + IORInterceptorOperations, + org.omg.CORBA.Object, + Serializable +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java new file mode 100644 index 0000000..868fcab --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java @@ -0,0 +1,58 @@ +/* IORInterceptorOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + + +/** + * Defines operation, applicable to the IORInterceptor. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IORInterceptorOperations extends InterceptorOperations +{ + /** + * A server side ORB calls this method on all registered IORInterceptor's when + * creating the object reference (IOR). The interceptors have the possibility + * to add additional tags to the IOR being created. + * + * @param info the interface class providing methods to insert additional tags + * into IOR being constructed. The same instan + */ + public void establish_components(IORInfo info); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/Interceptor.java b/libjava/classpath/org/omg/PortableInterceptor/Interceptor.java new file mode 100644 index 0000000..8ec375c --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/Interceptor.java @@ -0,0 +1,58 @@ +/* Interceptor.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Portable Interceptors are hooks into the ORB through which ORB services can + * intercept the normal flow of execution in creation of IOR, sending request, + * receiving request and returning the reply. + * + * See {@link ORBInitializer} for explanation, how the interceptors are + * registered within the ORB. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Interceptor extends InterceptorOperations, + Object, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/InterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/InterceptorOperations.java new file mode 100644 index 0000000..da08c90 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/InterceptorOperations.java @@ -0,0 +1,77 @@ +/* InterceptorOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + + +/** + * Defines operations, applicable for all types of {@link Interceptor}. + * The the derived interfaces define additional operations for they + * specific functionality. + * + * Portable Interceptors are hooks into the ORB through which ORB services can + * intercept the normal flow of execution in creation of IOR, sending request, + * receiving request and returning the reply. + * + * See {@link org.omg.PortableInterceptor} for more details about the possible + * interceptors and how to register them within the ORB. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface InterceptorOperations +{ + /** + * This method is called when orb is being destroyed and destroys + * the interceptor. The ORB calls this method after completing all + * incoming requests. The method body should not invoke methods on other + * object, belonging to ORB being destoryed, as in this stage it is no + * longer capable to act as server. It is still, however, capable + * to act as a client, permitting remote invocations on other objects. + */ + void destroy(); + + /** + * All interceptors of the same type, registered on the single ORB, must + * either have different names or be anonymous. The name of the anonymous + * interceptor is an empty string. The ORB supports multiple anonymous + * interceptors of the same type. + * + * @return the name of the interceptor. + */ + String name(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlot.java b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlot.java new file mode 100644 index 0000000..72805cf --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlot.java @@ -0,0 +1,76 @@ +/* InvalidSlot.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * The InvalidSlot is thrown when the slot identifier, passed in one of the + * methods, related to {@link Current}, does not define a valid slot. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class InvalidSlot extends UserException implements IDLEntity, + Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = 2471643293291821501L; + + /** + * Create InvalidSlot with no explaining message. + */ + public InvalidSlot() + { + } + + /** + * Create the InvalidSlot with explaining message. + * + * @param why a string, explaining, why this exception has been thrown. + */ + public InvalidSlot(String why) + { + super(why); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java new file mode 100644 index 0000000..c0aa0ee --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java @@ -0,0 +1,149 @@ +/* InvalidSlotHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import gnu.CORBA.EmptyExceptionHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the exception {@link InvalidSlot}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class InvalidSlotHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Create the InvalidSlot typecode (structure, named "InvalidSlot"). + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + StructMember[] members = new StructMember[ 0 ]; + typeCode = orb.create_exception_tc(id(), "InvalidSlot", members); + } + return typeCode; + } + + /* + * Every user exception with no user defined fields can use + * EmptyExceptionHolder + */ + + /** + * Insert the InvalidSlot into the given Any. + * + * @param any the Any to insert into. + * @param that the InvalidSlot to insert. + */ + public static void insert(Any any, InvalidSlot that) + { + any.insert_Streamable(new EmptyExceptionHolder(that, type())); + } + + /** + * Extract the InvalidSlot from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain InvalidSlot. + */ + public static InvalidSlot extract(Any any) + { + try + { + EmptyExceptionHolder h = + (EmptyExceptionHolder) any.extract_Streamable(); + return (InvalidSlot) h.value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("InvalidSlot expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the InvalidSlot repository id. + * + * @return "IDL:omg.org/PortableInterceptor/InvalidSlot:1.0", always. + */ + public static String id() + { + return "IDL:omg.org/PortableInterceptor/InvalidSlot:1.0"; + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static InvalidSlot read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + InvalidSlot value = new InvalidSlot(id); + + return value; + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, InvalidSlot value) + { + // Write the exception repository id. + output.write_string(id()); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfo.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfo.java new file mode 100644 index 0000000..d13dacd --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfo.java @@ -0,0 +1,54 @@ +/* ORBInitInfo.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; + +/** + * The instance of this interface is passed to {@link ORBInitializerOperations} + * and is used by {@link ORBInitializer} to register its {@link Interceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ORBInitInfo extends ORBInitInfoOperations, + Object, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java new file mode 100644 index 0000000..9cffbe1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java @@ -0,0 +1,169 @@ +/* ORBInitInfoOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.IOP.CodecFactory; +import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; + +/** + * Defines operations, applicable to {@link ORBInitInfo}. The + * {@link ORBInitInfo} is passed to the {@link ORBInitializer} that is + * reponsible for registering an {@link Interceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ORBInitInfoOperations +{ + /** + * Register the client request interceptor. + * + * @param interceptor the interceptor to register. + * + * @throws DuplicateName if the interceptor name is not an empty string and an + * interceptor with this name is already registered with the ORB being + * created. + */ + void add_client_request_interceptor(ClientRequestInterceptor interceptor) + throws DuplicateName; + + /** + * Register the IOR (object reference) interceptor. + * + * @param interceptor the interceptor to register. + * + * @throws DuplicateName if the interceptor name is not an empty string and an + * interceptor with this name is already registered with the ORB being + * created. + */ + void add_ior_interceptor(IORInterceptor interceptor) + throws DuplicateName; + + /** + * Register the server request interceptor. + * + * @param interceptor the interceptor to register. + * + * @throws DuplicateName if the interceptor name is not an empty string and an + * interceptor with this name is already registered with the ORB being + * created. + */ + void add_server_request_interceptor(ServerRequestInterceptor interceptor) + throws DuplicateName; + + /** + * Allocate a slot on a {@link PortableInterceptor.Current}. While slots can + * be allocated by this method, they cannot be initialized. + * {@link CurrentOperations#get_slot} and {@link CurrentOperations#set_slot} + * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor + * initializer. + * + * @return the index to the slot that has been allocated. + */ + int allocate_slot_id(); + + /** + * Returns the arguments passed to the ORB.init. + * + * @return the first parameter, passed to the method + * {@link org.omg.CORBA.ORB#init}. + */ + String[] arguments(); + + /** + * Get the CodecFactory that may be needed during the interceptor + * initialization. The method ORB.resolve_initial_references ("CodecFactory") + * cannot be used during ORB initialization. + * + * @return the CodecFactory. + */ + CodecFactory codec_factory(); + + /** + * Returns the ID of the ORB being initialized. + * + * @return the ORB id that differs for each new ORB being created during the + * current run of the java virtual machine. + */ + String orb_id(); + + /** + * Register the initial reference. The registered object will be accessible by + * the {@link ORB.resolve_initial_references} under the object_name. + * + * @param object_name the name of the object to register. + * @param object the object to register. + * + * @throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName if the + * name being registered is assumed to be invalid. + */ + void register_initial_reference(String object_name, + org.omg.CORBA.Object object + ) throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName; + + /** + * Identical to {@link org.omg.CORBA.ORB#resolve_initial_references}. + * + * This method can only be called from + * {@link ORBInitializerOperations#post_init} and not during + * {@link ORBInitializerOperations#pre_init}. + * + * @param object_name the name of the object to search. + * + * @return the object, accessible by the given name. + * + * @throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName if the + * given name is not associated with the known object. + * + * @see org.omg.CORBA.ORB#resolve_initial_references + */ + org.omg.CORBA.Object resolve_initial_references(String object_name) + throws org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName; + + /** + * Registers a PolicyFactory for the given PolicyType. + * + * @param policy_type the type of policy for that the factory is being + * registered. + * @param policy_factory the policy factory to register. + * + * @throws BAD_INV_ORDER minor 16 if the policy of the given type already has + * the registered factory in this ORB. + */ + void register_policy_factory(int policy_type, PolicyFactory policy_factory); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitializer.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializer.java new file mode 100644 index 0000000..4719182 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializer.java @@ -0,0 +1,132 @@ +/* ORBInitializer.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Object; +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * Registers the interceptor. + * + * Direct interceptor registration would open a security hole. Hence instead the + * interceptors from the ORB.init(..) method, passing the names of the needed + * initialized classes via properties. + * </p> + * <p> + * These property names are of the form + * </p> + * <p><i>org.omg.PortableInterceptor.ORBInitializerClass.<Service></i></p> + * where <i><Service></i> is the string name of a class, which implements + * {@link ORBInitializer}. During <code>ORB.init(..)</code>, the properties + * begining with <i>org.omg.PortableInterceptor.ORBInitializerClass</i> are + * collected, the <i><Service></i> portion of each property is extracted, + * the initialiser is instantiated with the <i><Service></i> string as its + * class name and then <code>pre_init</code> and <code>post_init</code> + * (defined in {@link ORBInitializerOperations}) are called on that initializer. + * The runtime exceptions, thrown by these two methods, are ignored. + * </p> + * <p> + * <h3>Example</h3> + * A client-side logging service may have the following ORBInitializer + * implementation: + * + * <code><pre> + * package gnu.x.logging; + * + * import org.omg.PortableInterceptor.*; + * import org.omg.CORBA.LocalObject; + * + * public class LoggingService extends LocalObject implements ORBInitializer + * { + * public void pre_init (ORBInitInfo info) + * { + * // More than one interceptor can be registered. + * ServerRequestInterceptor log_requests = new rLoggingInterceptor(); + * info.add_server_request_interceptor(log_requests); + * + * IORInterceptor log_iors = new iLoggingInterceptor(); + * info.add_ior_interceptor(log_iors); + * } + * + * public void post_init (ORBInitInfo info) + * { + * // Unused. + * } + * } + * </code></pre> + * <p> + * Then, one of the used set of properties then must contain the property, named + * <i> + * org.omg.PortableInterceptor.ORBInitializerClass.gnu.x.Logging.LoggingService + * </i>. + * The value of the property is ignored and may empty string. The + * agreed locations, where this property will be searched for, are: + * </p><p> + * 1. The properties parameter in the ORB.init(..), if any.<br> + * 2. The System properties.<br> + * 3. The orb.properties file located in the user.home directory (if any).<br> + * 4. The orb.properties file located in the java.home/lib directory (if any). + * </p> + * <p> + * The applet parameters and command line arguments are <i>not</i> scanned + * for the possible initializers. + * </p> + * <p> + * Interceptors are registered on a per-ORB basis. The virtual per-object + * Interceptors can be simulated by checking the policies on the target from + * within the interception points to determine whether they should work. The + * virtual per-POA Interceptors can be obtained instantiating each POA such with + * a different ORB. + * </p> + * <p> + * The registration code should not call directly any methods on the ORB being + * registered. + * </p> + * <p> + * The new interceptors cannot be registered after the ORB.init(..) returns. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ORBInitializer extends ORBInitializerOperations, + Object, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitializerOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializerOperations.java new file mode 100644 index 0000000..90c2325 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitializerOperations.java @@ -0,0 +1,73 @@ +/* ORBInitializerOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + + +/** + * Defines operations, applicable to the ORBInitializer. These operations are + * invoked on initializer from the ORB.init. + * + * @see ORBInitializer + */ +public interface ORBInitializerOperations +{ + /** + * This method is called during the first step of initialization. It must + * register all initial references that are expected to be used by other + * interceptors. + * + * @param info the object describing ORB being created and containing methods + * to register the interceptor. + * + * @see ORBInitInfoOperations#register_initial_reference + */ + void pre_init(ORBInitInfo info); + + /** + * This method called during the subsequent step of initialization. In this + * method it can be assumed that all required initial references are already + * registered. + * + * @param info the object describing ORB being created and containing methods + * to register the interceptor. + * + * @see ORBInitInfoOperations#register_initial_references + */ + void post_init(ORBInitInfo info); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/PolicyFactory.java b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactory.java new file mode 100644 index 0000000..6478e40 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactory.java @@ -0,0 +1,57 @@ +/* PolicyFactory.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The {@link ORBInitializer} may register the PolicyFactory to create the + * service specific policies later. The factory will be later used by + * {@link org.omg.CORBA.ORB#create_policy}. + * + * @see org.omg.PortableInterceptor.ORBInitInfoOperations#register_policy_factory + * @see org.omg.CORBA.ORB#create_policy + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface PolicyFactory extends PolicyFactoryOperations, + org.omg.CORBA.Object, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/PolicyFactoryOperations.java b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactoryOperations.java new file mode 100644 index 0000000..4e5a54e --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/PolicyFactoryOperations.java @@ -0,0 +1,69 @@ +/* PolicyFactoryOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Policy; +import org.omg.CORBA.PolicyError; + +/** + * A service implementation can register policy factory during ORB initialization + * for creating the service-specific policies. This factory then will be + * invoked form {@link org.omg.CORBA.ORB#create_policy(int, Any)}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + * + * @see org.omg.CORBA.ORB#create_policy + * @see ORBInitInfoOperations#register_policy_factory + */ +public interface PolicyFactoryOperations +{ + /** + * Create and return the policy of the given type, having the given value. + * + * @param policy_type the type of the policy being created + * @param policy_value the value of the policy, wrapped in {@link Any}. + * Depending from the policy, the Any can hold various values, + * including complex data structures. + * + * @return the created policy. + */ + Policy create_policy(int policy_type, Any policy_value) + throws PolicyError; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/RequestInfo.java b/libjava/classpath/org/omg/PortableInterceptor/RequestInfo.java new file mode 100644 index 0000000..0285a80 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/RequestInfo.java @@ -0,0 +1,55 @@ +/* RequestInfo.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Provides access to request information, available to the + * {@link ClientRequestInterceptor} or {@link ServerRequestInterceptor}. The + * additional operations, specific to the server and client are defined in the + * derived interfaces {@link ServerRequestInfo} and {@link ClientRequestInfo}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestInfo extends RequestInfoOperations, + org.omg.CORBA.Object, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/RequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/RequestInfoOperations.java new file mode 100644 index 0000000..f865a14 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/RequestInfoOperations.java @@ -0,0 +1,190 @@ +/* RequestInfoOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.Dynamic.Parameter; +import org.omg.IOP.ServiceContext; + +/** + * Defines operations that are applicable for both server and client request. + * The additional operations, specific to the server and client request are + * defined in the derived interfaces {@link ServerRequestInfoOperations} and + * {@link ClientRequestInfoOperations}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestInfoOperations +{ + /** + * Return the parameters of the operation being invoked. + * + * @return the array, containing parameters of the operations or an empty + * array for the operations with no parameters. + * + * @throws NO_RESOURCES if the parameters are not available. The parameters + * are only available for DII (via {@link org.omg.CORBA.Request} or DSI calls. + * They are not available for calls via IDL - generated stubs. + */ + Parameter[] arguments(); + + /** + * Returns the names of all contexts of the operation being invoked. + * + * @return the array of strings, defining contexts. + * + * @throws NO_RESOURCES if the contexts are not available. The contexts are + * only available for DII (via {@link org.omg.CORBA.Request} or DSI calls. + * They are not available for calls via IDL - generated stubs. + */ + String[] contexts(); + + /** + * Returns the typecodes, defining all exceptions that the operation may + * throw. + * + * @return the array of exception typecodes, empty array if the operation + * should not throw any exceptions. + * + * @throws NO_RESOURCES if the exception list is not available. This list is + * only available for DII (via {@link org.omg.CORBA.Request} or DSI calls and + * only on the client side. It is not available for calls via IDL - generated + * stubs or on the server side. + */ + TypeCode[] exceptions(); + + /** + * If the request contains forwarding information (the reply_status attribute + * being LOCATION_FORWARD), return the forwarding target. + * + * @return the object where the request should be forwarded. + */ + org.omg.CORBA.Object forward_reference(); + + /** + * Get the service context with the given ctx_name that is associated with the + * reply. + * + * @param ctx_name the name of the service context + * + * @return the copy of the corresponding context. + * + * @throws BAD_PARAM minor 26, if the context with the give ctx_name does not + * exist. + */ + ServiceContext get_reply_service_context(int ctx_name) + throws BAD_PARAM; + + /** + * Get the service context with the given ctx_name that is associated with the + * request. + * + * @param ctx_name the name of the service context + * + * @return the copy of the corresponding context. + * + * @throws BAD_PARAM minor 26, if the context with the give ctx_name does not + * exist. + */ + ServiceContext get_request_service_context(int ctx_name) + throws BAD_PARAM; + + /** + * Get the data from the given slot of the PortableInterceptor.Current that is + * in the scope of the request. + */ + Any get_slot(int id) throws InvalidSlot; + + /** + * Get the names of the service contexts being sent on the request. + * + * @return array of strings, naming the contexts. + */ + String[] operation_context(); + + /** + * Get the name of the operation being invoked. + * + * @return the name of the operation, usually the name of method being called. + */ + String operation(); + + /** + * Get the reoly state as result of the operation invocation. + * + * @return the value field of one of the following: {@link SUCCESSFUL}, + * {@link SYSTEM_EXCEPTION}, {@link USER_EXCEPTION}, + * {@link LOCATION_FORWARD} or {@link TRANSPORT_RETRY}. + */ + short reply_status(); + + /** + * Get the request id. + * + * @return an id that uniquely identifies the current request/reply sequence. + */ + int request_id(); + + /** + * Indicates whether request sender expected any response. + * + * @return true if the response was expected, false otherwise. + */ + boolean response_expected(); + + /** + * Get the result of the operation invocation. + * + * @return an Any, containing the value, returned by the performed operation. + */ + Any result(); + + /** + * Determines how far the request shall progress before control is returned to + * the client. However up till JDK 1.5 inclusive this method always returns + * SYNC_WITH_TRANSPORT. + * + * @return {@link org.omg.Messaging.SYNC_WITH_TRANSPORT.value (1), always. + * + * @specnote as defined in the Suns 1.5 JDK API. + */ + short sync_scope(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfo.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfo.java new file mode 100644 index 0000000..2aeba2b --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfo.java @@ -0,0 +1,54 @@ +/* ServerRequestInfo.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Provides request information, accessible for the + * {@link ServerRequestInterceptor}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInfo extends ServerRequestInfoOperations, + org.omg.CORBA.Object, + IDLEntity, + RequestInfo +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java new file mode 100644 index 0000000..7646253 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java @@ -0,0 +1,302 @@ +/* ServerRequestInfoOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.Any; +import org.omg.CORBA.INV_POLICY; +import org.omg.CORBA.Policy; +import org.omg.IOP.ServiceContext; + +/** + * Provides request information, accessible for the + * {@link ClientRequestInterceptor}. Some methods of this interface are not + * valid at all interception points. The following table shows the validity of + * each method. If it is not valid, BAD_INV_ORDER minor 14 will be thrown. + * + * <table border="1"> + * <tr> + * <th></th> + * <th>{@link ServerRequestInterceptorOperations#receive_request_service_contexts receive_request_<br>service_contexts}</th> + * <th>{@link ServerRequestInterceptorOperations#receive_request receive_request}</th> + * <th>{@link ServerRequestInterceptorOperations#send_reply send_reply}</th> + * <th>{@link ServerRequestInterceptorOperations#send_exception send_exception}</th> + * <th>{@link ServerRequestInterceptorOperations#send_other send_other}</th> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"><i>Inherited from + * {@link RequestInfoOperations}:</i></td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#arguments arguments}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="#E0E0E0" title="in and inout only">yes<sub><a href="#1">1</a></sub></td> + * <td>yes</td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">no<sub><a + * href="#2">2</a></sub></td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">no<sub><a + * href="#2">2</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#exceptions exceptions}</th> + * <td bgcolor="lightgray">no </td> + * <td colspan="4" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#contexts contexts}</th> + * <td bgcolor="lightgray">no </td> + * <td colspan="4" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation_context operation_context}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#result result}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#reply_status reply_status}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align="center">yes</td> * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#forward_reference forward_reference}</th> + * <td bgcolor="lightgray" colspan="4" align="center">no</td> + * <td bgcolor="#E0E0E0" title="When reply_status = LOCATION_FORWARD">yes<sub><a + * href="#2">2</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_request_service_context get_request_service_context}</th> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align="center">yes</td> * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_reply_service_context get_reply_service_context}</th> + * <td bgcolor="lightgray">no </td> + * <td bgcolor="lightgray">no </td> + * <td colspan="3" align="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#request_id request_id}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#operation operation}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#response_expected response_expected}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#sync_scope sync_scope}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain RequestInfoOperations#get_slot get_slot}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <td colspan="6" align="center" bgcolor="#E0E0FF"> + * <i>ServerRequestInfo-specific:</i></td> + * </tr> + * <tr> + * <th>{@linkplain #get_server_policy get_server_policy}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #add_reply_service_context add_reply_service_context}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #set_slot set_slot}</th> + * <td colspan="5" align ="center">yes</td> + * </tr> + * <tr> + * <th>{@linkplain #sending_exception sending_exception}</th> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * <td>yes</td> + * <td bgcolor="lightgray">no </td> + * </tr> + * <tr> + * <th>{@linkplain #object_id object_id}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td>yes</td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub></td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain #adapter_id adapter_id}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td>yes</td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub></td> + * <td bgcolor="#E0E0E0" title="Not always (see note)">yes<sub><a + * href="#3">3</a></sub> </td> + * </tr> + * <tr> + * <th>{@linkplain #target_most_derived_interface target_most_derived_interface}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * </tr> + * <tr> + * <th>{@linkplain #target_is_a target_is_a}</th> + * <td bgcolor="lightgray">no </td> + * <td>yes</td> + * <td bgcolor="lightgray" colspan="3" align="center">no</td> + * </tr> + * <tr> + * <th></th> + * <th>{@link ServerRequestInterceptorOperations#receive_request_service_contexts receive_request_<br>service_contexts }</th> + * <th>{@link ServerRequestInterceptorOperations#receive_request receive_request}</th> + * <th>{@link ServerRequestInterceptorOperations#send_reply send_reply}</th> + * <th>{@link ServerRequestInterceptorOperations#send_exception send_exception}</th> + * <th>{@link ServerRequestInterceptorOperations#send_other send_other}</th> + * </tr> + * </table> + * <ol> + * <li><a name="1">When ServerRequestInfo is passed to receive_request, there + * is an entry in the list for every argument. But only the in and inout + * arguments will be available.</a></li> + * <li><a name="2">If the reply_status attribute is not LOCATION_FORWARD, + * accessing this attribute throws BAD_INV_ORDER minor code of 14.</a></li> + * <li><a name="3">If the servant locator caused a location forward, or thrown + * an exception, this attribute/operation may not be available (NO_RESOURCES + * with a standard minor code of 1 will be thrown).</a></li> + * </ol> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInfoOperations extends RequestInfoOperations +{ + /** + * Allows the interceptor to add service contexts to the request. Such added + * contexts can carry arbitrary data and can be later accessed on the client + * side by the client request interceptor using + * {@link RequestInfoOperations#get_reply_service_context}. + * + * @param service_context the context to add. + * @param replace if true, the existing context with the same Id will be + * replaced. If false, the BAD_INV_ORDER will be thrown in that case. + * + * @throws BAD_INV_ORDER minor 15 if the context with the same Id already + * exists and replace=false. + */ + void add_reply_service_context(ServiceContext service_context, + boolean replace + ); + + /** + * Get the identifier for the object adapter (POA). + */ + byte[] adapter_id(); + + /** + * Get the object_id describing the target of the operation invocation. + */ + byte[] object_id(); + + /** + * Return the policy of the given type that applies to this operation. This + * method should only be used with policies, produced by the registered + * {@link PolicyFactory}. + * + * @param type the type of the policy being requested. + * + * @return the policy that applies to this operation. + * + * @throws INV_POLICY minor 2 if no factory was registered to produce this + * type of policy or the policy is otherwise invalid. + */ + Policy get_server_policy(int type) throws INV_POLICY; + + /** + * Get the exception to be returned to the client. If the returned Any cannot + * not support holding of that exception, it holds + * {@link org.omg.CORBA.UNKNOWN} minor 1 instead. + * + * @return an Any, holding exception that has been thrown and will be returned + * to client. + */ + Any sending_exception(); + + /** + * Allows the interceptor to set a slot in the PortableInterceptor.Current + * that is in the scope of the request. + * + * @param id the Id of the slot. + * @param data the value of the slot, replacing the previous value. + * + * @throws InvalidSlot if the slot with the given Id does not exist. + * + * @see RequestInfoOperations#get_slot(int) + * @see org.omg.PortableInterceptor#Current + */ + void set_slot(int id, Any data) throws InvalidSlot; + + /** + * Checks if the servant is the given repository id. + * + * @param the repository id to compare. + * + * @return true if the servant repository id matches the parameter, false + * otherwise. + */ + boolean target_is_a(String id); + + /** + * Get the most derived (most specific) repository Id of the servant. + * + * @return the repository id of the servant. + */ + String target_most_derived_interface(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptor.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptor.java new file mode 100644 index 0000000..e74872f --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptor.java @@ -0,0 +1,54 @@ +/* ServerRequestInterceptor.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * A server side request interceptor that is notified on various request + * processing steps on a server side. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInterceptor extends Interceptor, + ServerRequestInterceptorOperations, + org.omg.CORBA.Object, + IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptorOperations.java new file mode 100644 index 0000000..b57ca28 --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInterceptorOperations.java @@ -0,0 +1,134 @@ +/* ServerRequestInterceptorOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableInterceptor; + + +/** + * Defines operations, applicable to the server side request interceptor. The + * operations are called by ORB at the appropriate interception points. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServerRequestInterceptorOperations + extends InterceptorOperations +{ + /** + * ORB calls this method before invoking the servant manager. Operation + * parameters are not available at this point. The interceptor has possibility + * to forward the request by throwing {@link ForwardRequest}. + * + * @throws SystemException if it does, the receive_request_service_contexts is + * not called for the subsequent interceptors, calling send_exception instead. + * The completion status of such exception must be COMPLETED_NO. + * + * @throws ForwardRequest to forward the invocation to another target. The + * receive_request_service_contexts is not called for the subsequent + * interceptors, calling send_other instead. + */ + void receive_request_service_contexts(ServerRequestInfo info) + throws ForwardRequest; + + /** + * ORB calls this method after all the information, including operation + * parameters, are available. The interceptor has possibility to forward the + * request by throwing {@link ForwardRequest}. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the receive_request is not called for + * the subsequent interceptors, calling send_exception instead. The completion + * status of such exception must be COMPLETED_NO. + * + * @throws ForwardRequest to forward the invocation to another target. The + * receive_request is not called for the subsequent interceptors, calling + * send_other instead. + */ + void receive_request(ServerRequestInfo info) throws ForwardRequest; + + /** + * ORB calls this method after the target operation has been invoked and + * before the reply is returned to the client. This interception point shall + * execute in the same thread as the target invocation. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_reply is not called for the + * subsequent interceptors, calling send_exception instead. The completion + * status of such exception must be COMPLETED_YES. + */ + void send_reply(ServerRequestInfo info); + + /** + * ORB calls this method if the exception has been throw during the request + * processing. The interceptor has possibility to forward the request by + * throwing {@link ForwardRequest}. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException has the effect of changing the exception that + * successive interceptors receive on their calls to send_exception. If the + * original exception is a system exception, the completion_status of the new + * exception must match the exception being replaced. If the original + * exception is a user exception, then the completion_status of the new + * exception must be COMPLETED_YES. + * + * @throws ForwardRequest to forward the invocation to another target. The + * send_exception is not called for the subsequent interceptors, calling + * send_other instead. If the completion_status of the original exception is + * not a COMPLETED_NO, the ForwardRequest must not be raised. + */ + void send_exception(ServerRequestInfo info) throws ForwardRequest; + + /** + * ORB normally calls this method if the request has been forwarded. + * + * @param info the object for accessing and manipulating the request + * information. + * + * @throws SystemException if it does, the send_other is not called for the + * subsequent interceptors, calling send_exception instead. + * + * @throws ForwardRequest has the effect of changing the redirection that + * successive interceptors receive on their calls to send_other. + */ + void send_other(ServerRequestInfo info) throws ForwardRequest; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableInterceptor/package.html b/libjava/classpath/org/omg/PortableInterceptor/package.html new file mode 100644 index 0000000..b29c84f --- /dev/null +++ b/libjava/classpath/org/omg/PortableInterceptor/package.html @@ -0,0 +1,58 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - org.omg.PortableInterceptor</title></head> + +<body> +Interceptors are hooks than can monitor various stages of the CORBA request +processing. The {@link org.omg.PortableInterceptor.IORInterceptor} monitors +all new object refereces (IORs) being created and can add to them additional +information. The {@link org.omg.PortableInterceptor.ClientRequestInterceptor} +monitors request handling on the client side and the +{@link org.omg.PortableInterceptor.ServerRequestInterceptor} monitors request +handling on the server side. The client and server request interceptors can +add additional data to the CORBA message that is accessible on remote side +after the message is transmitted. They can also forward request to another +target. All interceptor functions also work for the local invocations. The +interceptors are registered in ORB.init(...) using +{@link org.omg.PortableInterceptor.ORBInitializer}. + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> diff --git a/libjava/classpath/org/omg/PortableServer/AdapterActivator.java b/libjava/classpath/org/omg/PortableServer/AdapterActivator.java new file mode 100644 index 0000000..9898c43 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/AdapterActivator.java @@ -0,0 +1,62 @@ +/* AdapterActivator.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Adapter activators are associated with POAs and supply the + * the ability to create child POAs on demand. The new POA can be created + * <ul> + * <li>As a side-effect of receiving a request that names the child POA + * (or one of its children).</li> + * <li>When calling + * {@link POAOperations}.find_POA(name, true) if the parameter + * <code>name</code> refers a non existing POA. + * </li></ul> + * An AdapterActivator is always a local object. + * + * @see AdapterActivatorOperations#unknown_adapter + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface AdapterActivator + extends AdapterActivatorOperations, IDLEntity, org.omg.CORBA.Object +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/AdapterActivatorOperations.java b/libjava/classpath/org/omg/PortableServer/AdapterActivatorOperations.java new file mode 100644 index 0000000..dcf7edd --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/AdapterActivatorOperations.java @@ -0,0 +1,66 @@ +/* AdapterActivatorOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + + +/** + * Defines the operations, applicable to the AdapterActivator. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface AdapterActivatorOperations +{ + /** + * This method is invoked when the ORB receives a request for an object + * reference that identifies a non-existing target POA, to create it. + * The ORB invokes this operation once for each POA that must be created + * in order for the target POA to exist. The process remebers creating a + * nested folder structure, starting from the ancestor POA closest to the + * root POA. The operation is invoked on the adapter activator of + * POA that is the parent of the POA that needs to be created. + * + * @param parent the parent POA, for that the child POA must be created. + * @param child_name the name of the child POA that must be created. + * + * @return true if the operation has successfully created the needed POA, + * false that POA cannot be created. In this case, the client will receive + * the remote exception ({@link OBJECT_NOT_EXIST}, minor code 2). + */ + boolean unknown_adapter(POA parent, String child_name); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/Current.java b/libjava/classpath/org/omg/PortableServer/Current.java new file mode 100644 index 0000000..8420867 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/Current.java @@ -0,0 +1,63 @@ +/* Current.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p>Provides the Id of the object currently being served and POA + * to that this object is connected. Both Id and POA can be + * simpler obtained from the servant by {@link Servant#_object_id() } + * and {@link Servant#_poa()} that use POA Current indirectly. + * The operations on Current for obtaining + * these data are defined in {@link CurrentOperations}. + * </p><p> + * As long as the ORB reference is still available, the current information + * is available via {@link Current} that is returned by + * ORB.resolve_initial_references("POACurrent"). To support this call, + * the ORB maintains the thread to invocation data map for all calls that + * are currently being processed. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Current + extends CurrentOperations, org.omg.CORBA.Current, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/CurrentHelper.java b/libjava/classpath/org/omg/PortableServer/CurrentHelper.java new file mode 100644 index 0000000..281cefa --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/CurrentHelper.java @@ -0,0 +1,142 @@ +/* CurrentHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.NO_IMPLEMENT; +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 +* CORBA object {@link Current}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class CurrentHelper +{ + /** + * Get the type code of the POA Current. + * + * @return a type code of the object with POA Current id, named "Current". + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "Current"); + } + + /** + * Insert the POA Current into the given Any. + * + * @param any the Any to insert into. + * @param that the POA Current to insert. + */ + public static void insert(Any any, Current that) + { + any.insert_Object(that); + } + + /** + * Extract the POA Current from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain a POA Current. + */ + public static Current extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the POA Current repository id. + * + * @return "IDL:omg.org/PortableServer/Current:2.3", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/Current:2.3"; + } + + /** + * Cast the passed object into the POA Current. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a Current. + */ + public static Current narrow(org.omg.CORBA.Object obj) + { + try + { + return (Current) obj; + } + catch (ClassCastException ex) + { + BAD_PARAM bad = new BAD_PARAM("Not a POA Current"); + bad.initCause(ex); + throw bad; + } + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.4 inclusive. + * + * @throws NO_IMPLEMENT always. + */ + public static Current read(InputStream input) + { + throw new NO_IMPLEMENT(); + } + + /** + * Not supported for compatibility reasons. + * + * @specnote Not supported by Sun at least till jdk 1.4 inclusive. + * + * @throws NO_IMPLEMENT always. + */ + public static void write(OutputStream output, Current value) + { + throw new NO_IMPLEMENT(); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/CurrentOperations.java b/libjava/classpath/org/omg/PortableServer/CurrentOperations.java new file mode 100644 index 0000000..b2f23f2 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/CurrentOperations.java @@ -0,0 +1,81 @@ +/* CurrentOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.PortableServer.CurrentPackage.NoContext; + +/** + * Provides the Id of the object currently being served and POA + * to that this object is connected. Both Id and POA can be much + * simpler obtained from the servant by {@link Servant#_object_id() } + * and {@link Servant#_poa()} that use the CurrentOperations indirectly. + * + * As long as the ORB reference is still available, the current information + * is available via {@link Current} that is returned by + * ORB.resolve_initial_references("POACurrent"). To support this call, + * the ORB maintains the thread to invocation data map for all calls that + * are currently being processed. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface CurrentOperations + extends org.omg.CORBA.CurrentOperations +{ + /** + * Returns the Id of the object currently being served. The returned + * value is also correct if the calling code is running is several + * paralled threads. + * + * @return the Id of the object that is currently being served by this + * thread. + */ + byte[] get_object_id() + throws NoContext; + + /** + * Returns POA to that the object currently being served is connected. + * The returned value is also correct if the calling code is running is several + * paralled threads. + * + * @return the Id of the object that is currently being served by this + * thread. + */ + POA get_POA() + throws NoContext; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/DynamicImplementation.java b/libjava/classpath/org/omg/PortableServer/DynamicImplementation.java new file mode 100644 index 0000000..6a333e1 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/DynamicImplementation.java @@ -0,0 +1,58 @@ +/* DynamicImplementation.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.ServerRequest; + +/** + * This class is used for servants that support calling via server request. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class DynamicImplementation + extends Servant +{ + /** + * Handle the invocation via passed request. + * + * @param request the data structure, used both to pass parameters + * and return results of the invocation. + */ + public abstract void invoke(ServerRequest request); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ForwardRequest.java b/libjava/classpath/org/omg/PortableServer/ForwardRequest.java new file mode 100644 index 0000000..f0588f4 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ForwardRequest.java @@ -0,0 +1,108 @@ +/* ForwardRequest.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * <p> + * This exception is raised by {@link ServantManager} to indicate that the + * invocation target has moved to another known location. In this case, + * the client will receive a redirection (LOCATION_FORWARD) message and should + * resend the request to the new target. The exception contains the object + * reference, indicating the new location. + * </p><p> + * The exception can be thrown both by servant locators and servant activators. + * If the exception is raised anywhere else than in the ServantManager + * methods, it is handled as an ordinary user excepton. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public class ForwardRequest + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -4159318367582473975L; + + /** + * The object reference, indicating the new location of the invocation target. + */ + public org.omg.CORBA.Object forward_reference; + + /** + * Create ForwardRequest with no explaining message and stating the + * new location is <code>null</code>. + */ + public ForwardRequest() + { + } + + /** + * Create the ForwardRequest with explaining message and + * initialising the object reference to the given value. + * + * @param why a string, explaining, why this exception has been thrown. + * @param a_forward_reference a value for forward_reference. + */ + public ForwardRequest(String why, org.omg.CORBA.Object a_forward_reference) + { + super(why); + this.forward_reference = a_forward_reference; + } + + /** + * Create the ForwardRequest without explaining + * message and initialising the object reference to the given value. + * + * @param a_forward_reference a value for forward_reference. + */ + public ForwardRequest(org.omg.CORBA.Object a_forward_reference) + { + this.forward_reference = a_forward_reference; + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java new file mode 100644 index 0000000..6f8d5ea --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java @@ -0,0 +1,159 @@ +/* ForwardRequestHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import gnu.CORBA.Poa.ForwardRequestHolder; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ORB; +import org.omg.CORBA.ObjectHelper; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the exception {@link ForwardRequest}. + * + * @specnote The helper must be here and not in POA subpackage as it must + * be discovered by the {@link ObjectCreator} when reading this remote + * exception. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ForwardRequestHelper +{ + /** + * The cached typecode value, computed only once. + */ + private static TypeCode typeCode; + + /** + * Extract the ForwardRequest from given Any. + * This method uses the ForwardRequestHolder. + * + * @throws BAD_OPERATION if the passed Any does not contain ForwardRequest. + */ + public static ForwardRequest extract(Any any) + { + try + { + return ((ForwardRequestHolder) any.extract_Streamable()).value; + } + catch (ClassCastException cex) + { + BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected"); + bad.initCause(cex); + throw bad; + } + } + + /** + * Get the ForwardRequest repository id. + * + * @return "ForwardRequest", always. + */ + public static String id() + { + return "ForwardRequest"; + } + + /** + * Insert the ForwardRequest into the given Any. + * This method uses the ForwardRequestHolder. + * + * @param any the Any to insert into. + * @param that the ForwardRequest to insert. + */ + public static void insert(Any any, ForwardRequest that) + { + any.insert_Streamable(new ForwardRequestHolder(that)); + } + + /** + * Read the exception from the CDR intput stream. + * + * @param input a org.omg.CORBA.portable stream to read from. + */ + public static ForwardRequest read(InputStream input) + { + // Read the exception repository id. + String id = input.read_string(); + ForwardRequest value = new ForwardRequest(); + + value.forward_reference = input.read_Object(); + return value; + } + + /** + * Create the ForwardRequest typecode (structure, + * named "ForwardRequest"). + * The typecode states that the structure contains the + * following fields: forward_reference. + */ + public static TypeCode type() + { + if (typeCode == null) + { + ORB orb = ORB.init(); + StructMember[] members = new StructMember[ 1 ]; + + TypeCode field; + + field = ObjectHelper.type(); + members [ 0 ] = new StructMember("forward_reference", field, null); + typeCode = orb.create_exception_tc(id(), "ForwardRequest", members); + } + return typeCode; + } + + /** + * Write the exception to the CDR output stream. + * + * @param output a org.omg.CORBA.portable stream stream to write into. + * @param value a value to write. + */ + public static void write(OutputStream output, ForwardRequest value) + { + // Write the exception repository id. + output.write_string(id()); + output.write_Object(value.forward_reference); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicy.java b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicy.java new file mode 100644 index 0000000..cde9e11 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicy.java @@ -0,0 +1,58 @@ +/* IdAssignmentPolicy.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the Object Id assignment policy. + * + * The policy can return its current value, as defined. + * in {@link IdAssignmentPolicyOperations}. + * + * @see IdAssignmentPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdAssignmentPolicy + extends Policy, IdAssignmentPolicyOperations, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyOperations.java new file mode 100644 index 0000000..993a780 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyOperations.java @@ -0,0 +1,55 @@ +/* IdAssignmentPolicyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the IdAssignmentPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdAssignmentPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + IdAssignmentPolicyValue value(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicy.java b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicy.java new file mode 100644 index 0000000..f78e87e --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicy.java @@ -0,0 +1,57 @@ +/* IdUniquenessPolicy.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specfies the Id uniqueness policy. + * + * The policy can return its current value, as defined. + * in {@link IdUniquenessPolicyOperations}. + * + * @see IdUniquenessPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdUniquenessPolicy + extends Policy, IdUniquenessPolicyOperations, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyOperations.java new file mode 100644 index 0000000..3019396 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyOperations.java @@ -0,0 +1,55 @@ +/* IdUniquenessPolicyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the IdUniquenessPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface IdUniquenessPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + IdUniquenessPolicyValue value(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicy.java b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicy.java new file mode 100644 index 0000000..c3859d2 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicy.java @@ -0,0 +1,57 @@ +/* ImplicitActivationPolicy.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the implicit activation policy. + * + * The policy can return its current value, as defined. + * in {@link ImplicitActivationPolicyOperations}. + * + * @see ImplicitActivationPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ImplicitActivationPolicy + extends Policy, ImplicitActivationPolicyOperations, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyOperations.java new file mode 100644 index 0000000..d855ec8 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyOperations.java @@ -0,0 +1,55 @@ +/* ImplicitActivationPolicyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the ImplicitActivationPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ImplicitActivationPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + ImplicitActivationPolicyValue value(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/LifespanPolicy.java b/libjava/classpath/org/omg/PortableServer/LifespanPolicy.java new file mode 100644 index 0000000..2e77bbe --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/LifespanPolicy.java @@ -0,0 +1,58 @@ +/* LifespanPolicy.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the object life span policy, if they can outlive the POA + * with that they were first created. + * + * The policy can return its current value, as defined. + * in {@link LifespanPolicyOperations}. + * + * @see LifespanPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface LifespanPolicy + extends Policy, LifespanPolicyOperations, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/LifespanPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/LifespanPolicyOperations.java new file mode 100644 index 0000000..20eda70 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/LifespanPolicyOperations.java @@ -0,0 +1,55 @@ +/* LifespanPolicyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the LifespanPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface LifespanPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + LifespanPolicyValue value(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/POA.java b/libjava/classpath/org/omg/PortableServer/POA.java new file mode 100644 index 0000000..863a12b --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POA.java @@ -0,0 +1,66 @@ +/* POA.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * The Portable Object Adapter (POA) provides more control on the request + * processing than it is possible when connecting objects directly to the + * ORB. For details, see the general description of the + * <code>org.omg.PortableServer</code> package. + * </p><p> + * The operations, supported by POA are defined + * separately in {@link POAOperations}. In the simpliest case, the servant + * implementation is connected to POA by + * {@link POAOperations#servant_to_reference}, the returned object being a + * target of remote and local invocations, despite the numerous other + * strategies are possible. + * </p> + * + * @see org.omg.CORBA.ORB.resolve_initial_references + * @see POAOperations.servant_to_reference + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POA + extends POAOperations, IDLEntity, org.omg.CORBA.Object +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/POAHelper.java b/libjava/classpath/org/omg/PortableServer/POAHelper.java new file mode 100644 index 0000000..2928d9f --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAHelper.java @@ -0,0 +1,147 @@ +/* POAHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Any; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the CORBA object {@link POA}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class POAHelper +{ + /** + * Cast the passed object into the POA. As POA is a local object, the method + * just uses java type cast. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a POA. + */ + public static POA narrow(org.omg.CORBA.Object obj) + { + try + { + return (POA) obj; + } + catch (ClassCastException cex) + { + throw new BAD_PARAM(obj.getClass().getName() + " is not a POA"); + } + } + + /** + * Get the type code of the {@link POA}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "POA"); + } + + /** + * Insert the POA into the given Any. + * + * @param any the Any to insert into. + * + * @param that the POA to insert. + */ + public static void insert(Any any, POA that) + { + any.insert_Object(that); + } + + /** + * Extract the POA from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain POA. + */ + public static POA extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the POA repository id. + * + * @return "IDL:omg.org/PortableServer/POA:2.3", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/POA:2.3"; + } + + /** + * This should read POA from the CDR input stream, but, following the specs, + * it doesnot. The jdk 1.5 API specification defines that POA cannot be + * exported. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL, always. + */ + public static POA read(InputStream input) + { + throw new MARSHAL("Not applicable"); + } + + /** + * This should read POA from the CDR input stream, but, following the specs, + * it doesnot. The jdk 1.5 API specification defines that POA cannot be + * exported. + * + * @param input a org.omg.CORBA.portable stream to read from. + * + * @specenote Sun throws the same exception. + * + * @throws MARSHAL, always. + */ + public static void write(OutputStream output, POA value) + { + throw new MARSHAL("Not applicable"); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/POAManager.java b/libjava/classpath/org/omg/PortableServer/POAManager.java new file mode 100644 index 0000000..6d93eb3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManager.java @@ -0,0 +1,63 @@ +/* POAManager.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * <p> + * A POA manager is associated with one or more POAs and provides means + * to regulate they activity. Using manage, it is possible to force + * requests for those POAs to be queued or discarded or have those POAs + * deactivated. The manager can turn POAs to and from holding, + * active and discarding states, but the incative state is irreversible. + * </p> + * <p> + * The manager of the ORBs root POA can be obtained by resolving initial + * reference "RootPOAManager". + * </p> + * + * @see POAManagerOperations + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POAManager + extends POAManagerOperations, IDLEntity, org.omg.CORBA.Object +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerOperations.java b/libjava/classpath/org/omg/PortableServer/POAManagerOperations.java new file mode 100644 index 0000000..90206d4 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAManagerOperations.java @@ -0,0 +1,141 @@ +/* POAManagerOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.PortableServer.POAManagerPackage.AdapterInactive; +import org.omg.PortableServer.POAManagerPackage.State; + +/** + * Defines the operations, applicable to the {@link POAManager}. + * These operations can turn the associated POAs to and from holding, + * active and discarding states, but the incative state is irreversible. + * The inactivated POAs can only be recreated after they were destroyed. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POAManagerOperations +{ + /** + * Turns the associated POAs into active state, allowing them to receive + * and process requests. + * + * @throws AdapterInactive if the POAs are in the inactive state. If + * once inactivated, the POA cannot be activated again. + * This method can only be called to leave the holding or discarding state. + */ + void activate() + throws AdapterInactive; + + /** + * <p> + * Turns the asociated POAs into inactive state. The POAs in the incative + * state will reject new requests. A cliet, trying to invoke an + * object, belonging to the inactivated POA, will receive the remote exception + * ({@link org.omg.CORBA.OBJ_ADAPTER}, minor code 0x535503ea, incomplete). + * </p><p> + * If the POA is once inactivated, it cannot be activated again. + * The operation is used when the associated POAs are to be shut down. + * </p> + * <p> + * Some independent implementations may set the minor code of the + * OBJ_ADAPTER to 1, as recommended by OMG (formal/04-03-12). + * The interoperable systems should expect any of these two values. + * </p> + * + * @param etherealize_objects if true, the servant managers of the + * associated POAs, having RETAIN and USE_SERVANT_MANAGER policies, + * will receive a call of {@link ServantActivatorOperations#etherealize}. + * + * @param wait_for_completion if true, the method call suspends the current + * thread till POAs complete the requests they are currently processing. If + * false, the method returns immediately. + * <p> + * + * @specnote The 0x535503ea is a Sun specific minor exception code 1002, + * used for interoperability reasons. + * + * @throws AdapterInactive if the POAs are already in the inactive state. + * + * @see POAOperations#destroy + */ + void deactivate(boolean etherealize_objects, boolean wait_for_completion) + throws AdapterInactive; + + /** + * <p> + * Turns the associated POAs into discaring state. In this state, the POAs + * discard the incoming requests. This mode is used in situations when + * the server is flooded with requests. The client receives remote exception + * ({@link org.omg.CORBA.TRANSIENT}, minor code 0x535503e9, incomplete). + * </p><p> + * Some independent implementations may set the minor code of the + * TRANSIENT to 1, as recommended by OMG (formal/04-03-12). + * The interoperable systems should expect any of these two values. + * </p> + * + * @param wait_for_completion if true, the method call suspends the current + * thread till POAs complete the requests they are currently processing. If + * false, the method returns immediately. + * + * @specnote The 0x535503e9 is a Sun specific minor exception code 1001, + * used for interoperability reasons. + * + * @throws AdapterInactive if the POAs are in the inactive state. + */ + void discard_requests(boolean wait_for_completion) + throws AdapterInactive; + + /** + * Get the state of the POA manager. + */ + State get_state(); + + /** + * Turns the associated POAs into holding state. In this state, the POAs + * queue incoming requests but do not process them. + * + * @param wait_for_completion if true, the method call suspends the current + * thread till POAs complete the requests they are currently processing. If + * false, the method returns immediately. + + * @throws AdapterInactive if the POAs are in the inactive state. + */ + void hold_requests(boolean wait_for_completion) + throws AdapterInactive; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/POAOperations.java b/libjava/classpath/org/omg/PortableServer/POAOperations.java new file mode 100644 index 0000000..1c22cee --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/POAOperations.java @@ -0,0 +1,525 @@ +/* POAOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.PortableServer.POAPackage.AdapterAlreadyExists; +import org.omg.PortableServer.POAPackage.AdapterNonExistent; +import org.omg.PortableServer.POAPackage.InvalidPolicy; +import org.omg.PortableServer.POAPackage.NoServant; +import org.omg.PortableServer.POAPackage.ObjectAlreadyActive; +import org.omg.PortableServer.POAPackage.ObjectNotActive; +import org.omg.PortableServer.POAPackage.ServantAlreadyActive; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.WrongAdapter; +import org.omg.PortableServer.POAPackage.WrongPolicy; + +/** + * Defines the operations, applicable to the POA. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface POAOperations +{ + /** + * Creates a new POA as a child of the target POA. + * + * @param child_name the name of the child POA being created. + * @param manager the manager that will control the new POA. If this parameter + * is null, a new POA manager is created and associated with the new POA. + * + * @param policies the policies, applicable for the parent POA. Policies + * are <i>not</i> inherited from the parent POA. If some policy type + * is missing in the array (or the zero size array is passed), the missing + * policies obtain the default values from the table, specified + * in the {@link POA} documentation header. + * + * @return an newly created POA. The POA will be intially in the holding + * state and must be activated to start processing requests. + * + * @throws AdapterAlreadyExists if the child with the given child_name + * already exists for the current POA. + * @throws InvalidPolicy if the policies conflict with each other or are + * otherwise inappropriate. + * + * @see POA for the list of required policies. + * @see #the_children() + */ + POA create_POA(String child_name, POAManager manager, Policy[] policies) + throws AdapterAlreadyExists, InvalidPolicy; + + /** + * Find and optionally activate the child POA with the given name. + * + * @param poa_name the name of the POA to find. + * @param activate_it if the child with the specified name is not found + * or inactive and this parameter is true, the target POA activator is + * invoked to activate that child. If this succeeds, that child POA + * is returned. + * + * @throws AdapterNonExistent if no active child with the given name + * is found and one of the following is true: + * a) the target POA has no associated + * {@link AdapterActivator}. b) that activator fails to activate the + * child POA. c) <code>activate_id</code> = false. + */ + POA find_POA(String poa_name, boolean activate_it) + throws AdapterNonExistent; + + /** + * Generate the Object Id for the given servant and add the servant to + * the Active Object Map using this Id a a key. If the servant + * activator is set, its incarnate method will be called. In this case, + * the passed servant in this method can be null; in this case, the servant, + * returned by {@link ServantLocatorOperations#incarnate} will + * be used. + * + * @param a_servant a servant that would serve the object with the + * returned Object Id. + * + * @return the generated objert Id for the given servant. + * + * @throws ServantAlreadyActive if this servant is already in the + * Active Object Map and the UNIQUE_ID policy applies. + * + * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN + * do not apply to this POA. + */ + byte[] activate_object(Servant a_servant) + throws ServantAlreadyActive, WrongPolicy; + + /** + * Add the given servant to the Active Object Map as a servant for the + * object with the provided Object Id. If the servant activator is + * set, its incarnate method will be called. In this case, + * the passed servant in this method can be null; in this case, the servant, + * returned by {@link ServantLocatorOperations#incarnate} will + * be used. + * + * @param an_Object_Id an object id for the given object. + * @param a_servant a servant that will serve the object with the given + * Object Id. + * + * @throws ObjectAlreadyActive if the given object id is already in the + * Active Object Map. + * @throws WrongPolicy if the required RETAIN policy does not apply to + * this POA. + * @throws BAD_PARAM if the passed object id is invalid due any reason. + */ + void activate_object_with_id(byte[] an_Object_Id, Servant a_servant) + throws ServantAlreadyActive, ObjectAlreadyActive, + WrongPolicy; + + /** + * <p>Deactivate object with the given id. Client, trying to call + * method on the deactivated object will either receive the remote + * exception ({@link org.omg.CORBA.OBJECT_NOT_EXIST}, minor 0x535503ec), + * incomplete) or the object will be reactivated and serve the request. + * The object can be reactivated only if the implicit activation + * policy applies and the servant activator is set.</p><p> + * The deactivated object will continue to process requests that arrived + * before decativation. + * If this POA has the associated servant manager, a + * {@link ServantActivatorOperations#etherealize} is <i>immediately</i> + * invoked on the passed id. The deactivated object can be reactivated + * by {@link #activate_object_with_id}.</p> + * <p>The deactivation will not release thread, port or memory resources, + * taken by that object. This is due requirement to make the + * object reactivation possible at any time. To release the resources, + * you must destroy the POA. + * </p> + * + * @throws WrongPolicy if the required RETAIN policy does not apply to + * this POA. + */ + void deactivate_object(byte[] the_Object_Id) + throws ObjectNotActive, WrongPolicy; + + /** + * Create the object reference, encapsulating the given repository Id and + * the Object Id, generated by this POA. The returned object will not be + * activated by default and may be activated on the first invocation by + * the servant manager (if it is set and if policies are applicable). + * The returned object can also be narrowed by helper and used locally. + * In this case, the servant will be activated on the first local call of + * any method. The methods on returned object can also be invoked by + * name, using {@link org.omg.CORBA.Request}. + * + * @param a_repository_id the repository id for the given object. When + * narrowing the returned object with some helper, it will be checked for + * equality with value, returned by the the helper id(). + * + * @throws WrongPolicy if the required SYSTEM_ID policy does not apply to + * this POA. + */ + org.omg.CORBA.Object create_reference(String a_repository_id) + throws WrongPolicy; + + /** + * <p> Create the object reference, encapsulating the given repository Id and + * the given Object Id. The returned object will not be + * activated by default and may be activated on the first invocation by + * the servant manager (if it is set and if policies are applicable). + * </p><p> + * The returned object can also be narrowed by helper and used locally. + * In this case, the servant will be activated on the first local call of + * any method. The methods on returned object can also be invoked by + * name, using {@link org.omg.CORBA.Request}. + * </p> + * + * @param an_object_id the object id for the object being created. + * If the POA uses the SYSTEM_ID policy, the portable application + * must only supply ids, generated by that POA. + * + * @param a_repository_id the repository id for the given object. When + * narrowing the returned object with some helper, it will be checked for + * equality with value, returned by the the helper id(). + */ + org.omg.CORBA.Object create_reference_with_id(byte[] an_object_id, + String a_repository_id + ); + + /** + * Returns a default servant for this POA. + * + * @return a servant that will be used for requests for + * which no servant is found in the Active Object Map. + * + * @throws NoServant if there is no default servant associated with this POA. + * @throws WrongPolicy if the USE_DEFAULT_SERVANT policy is not active. + */ + Servant get_servant() + throws NoServant, WrongPolicy; + + /** + * Sets the default servant for this POA. + * + * @param a_servant a servant that will be used for requests for + * which no servant is found in the Active Object Map. + * + * @throws WrongPolicy if the USE_DEFAULT_SERVANT policy is not active. + */ + void set_servant(Servant a_servant) + throws WrongPolicy; + + /** + * Set a servant manager for this POA. + * + * @param a servant manager being set. If the RETAIN policy applies, the + * manager must implement a {@link ServantActivator}. If the NON_RETAIN + * policy applies, the manager must implement a {@link ServantLocator}. + * + * @throws WrongPolicy if the required USE_SERVANT_MANAGER policy does not + * apply to this POA. + * + * @throws OBJ_ADAPTER minor code 4 if the passed manager does not + * implement the required interface ({@link ServantActivator}, + * {@link ServantLocator}). + * + * @throws BAD_INV_ORDER minor code 6 if the method is called more than once + * on the same POA. The manager can be set only once. + */ + void set_servant_manager(ServantManager a_manager) + throws WrongPolicy; + + /** + * Get the servant manager, associated with this POA. + * + * @return the associated servant manager or null if it has + * been previously set. + * + * @throws WrongPolicy if the required USE_SERVANT_MANAGER policy does not + * apply to this POA. + */ + ServantManager get_servant_manager() + throws WrongPolicy; + + /** + * Get the unique Id of the POA in the process in which it is created. + * This Id is needed by portable interceptors. The id is unique + * for the life span of the POA in the process. For persistent + * POAs, if a POA is created in the same path with the same name as + * another POA, these POAs are identical have the same id. All transient + * POAs are assumed unique. + */ + byte[] id(); + + /** + * Returns the reference to the active object with the given Id. + * + * @param the_Object_Id the object id. + * + * @throws ObjectNotActive if there is no active object with such Id. + * @throws WrongPolicy if the required RETAIN policy does not apply to + * this POA. + */ + org.omg.CORBA.Object id_to_reference(byte[] the_Object_Id) + throws ObjectNotActive, WrongPolicy; + + /** + * Returns the servant that serves the active object with the given Id. + * + * @param the_Object_Id the object id. + * + * @throws ObjectNotActive if there is no active object with such Id. + * @throws WrongPolicy. This method requires either RETAIN or + * USE_DEFAULT_SERVANT policies and reaises the WrongPolicy if none of them + * apply to this POA. + */ + Servant id_to_servant(byte[] the_Object_Id) + throws ObjectNotActive, WrongPolicy; + + /** + * Returns the Object Id, encapsulated in the given object reference. + * + * @param the_Object the object that has been previously created with this + * POA. It need not be active. + * + * @throws WrongAdapter if the passed object has not been previously created + * with this POA. + * @throws WrongPolicy never (declared for the future extensions only). + */ + byte[] reference_to_id(org.omg.CORBA.Object the_Object) + throws WrongAdapter, WrongPolicy; + + /** + * Returns the servant that is serving this object. + * + * @return if the RETAIN policy applies and the object is in the Active + * Object Map, the method returns the servant, associated with this object. + * Otherwise, if the USE_DEFAULT_SERVANT policy applies, the method returns + * the default servant (if one was set). + * + * @throws ObjectNotActive if none of the conditions above are satisfied. + * @throws WrongAdapter if the object reference was not created with this POA. + * @throws WrongPolicy. This method requires either RETAIN or + * USE_DEFAULT_SERVANT policies and reaises the WrongPolicy if none of them + * apply to this POA. + */ + Servant reference_to_servant(org.omg.CORBA.Object the_Object) + throws ObjectNotActive, WrongPolicy, WrongAdapter; + + /** + * Returns the id of the object, served by the given servant. The id is found + * in one of the following ways. + * <ul> + * <li>If the POA has both the RETAIN and the UNIQUE_ID policy and + * the specified servant is active, the method return the Object Id associated + * with that servant. + * </li><li> + * If the POA has both the RETAIN and the IMPLICIT_ACTIVATION policy and + * either the POA has the MULTIPLE_ID policy or the specified servant is + * inactive, the method activates the servant using a POA-generated Object Id + * and the Interface Id associated with the servant, and returns that + * Object Id. + * </li> + * <li>If the POA has the USE_DEFAULT_SERVANT policy, the servant specified + * is the default servant, and the method is being invoked in the context o + * f executing a request on the default servant, the method returns the + * ObjectId associated with the current invocation. + * </li> + * </ul> + * @throws ServantNotActive in all cases, not listed in the list above. + * @throws WrongPolicy The method requres USE_DEFAULT_SERVANT policy or + * a combination of the RETAIN policy and either the UNIQUE_ID or + * IMPLICIT_ACTIVATION policies and throws the WrongPolicy if these conditions + * are not satisfied. + */ + byte[] servant_to_id(Servant the_Servant) + throws ServantNotActive, WrongPolicy; + + /** + * <p>Converts the given servant to the object reference. + * The servant will serve all methods, invoked on the returned object. + * The returned object reference can be passed to the remote client, + * enabling remote invocations. + * </p><p> + * If the specified servant already serves some active object, that + * object is returned. Otherwise, + * if the POA has the IMPLICIT_ACTIVATION policy the method activates + * the servant, creating an new object with the POA-generated Object Id. + * In this case, if the servant activator is set, the + * {@link ServantActivatorOperations#incarnate} method will be called. + * </p> + * + * @throws ServantNotActive if the servant is inactive and no + * IMPLICIT_ACTIVATION policy applies. + * @throws WrongPolicy This method needs the RETAIN policy and either the + * UNIQUE_ID or IMPLICIT_ACTIVATION policies. + * + * @return the object, exposing the given servant in the context of this POA. + */ + org.omg.CORBA.Object servant_to_reference(Servant the_Servant) + throws ServantNotActive, WrongPolicy; + + /** + * Return the POA manager, associated with this POA. + * + * @return the associated POA manager (always available). + */ + POAManager the_POAManager(); + + /** + * Returns the adapter activator, associated with this POA. + * The newly created POA has no activator (null would be + * returned). The ORB root POA also initially has no activator. + * + * @return tha adapter activator or null if this POA has no + * associated adapter activator. + */ + AdapterActivator the_activator(); + + /** + * Set the adapter activator for this POA. + * + * @param the activator being set. + */ + void the_activator(AdapterActivator activator); + + /** + * The children of this POA. + * + * @return the array of all childs for this POA. + */ + POA[] the_children(); + + /** + * Return the name of this POA. + * + * @return the name of POA, relative to its parent. + */ + String the_name(); + + /** + * Return the parent of this POA. + * + * @return the parent POA or <code>null</code> if this is a root POA. + */ + POA the_parent(); + + /** + * <p> Destroy this POA and all descendant POAs. The destroyed POAs can be + * later re-created via {@link AdapterActivator} or by invoking + * {@link #create_POA}. + * This differs from {@link PoaManagerOperations#deactivate} that does + * not allow recreation of the deactivated POAs. After deactivation, + * recreation is only possible if the POAs were later destroyed. + * </p><p> + * The remote invocation on the target, belonging to the POA that is + * currently destroyed return the remote exception ({@link TRANSIENT}, + * minor code 4). + * </p> + * @param etherealize_objects if true, and POA has RETAIN policy, and the + * servant manager is available, the servant manager method + * {@link ServantActivatorOperations#etherealize} is called for each + * <i>active</i> object in the Active Object Map. This method should not + * try to access POA being destroyed. If <code>destroy</code> is called + * multiple times before the destruction completes, + * the etherialization should be invoked only once. + * + * @param wait_for_completion if true, the method waits till the POA being + * destroyed completes all current requests and etherialization. If false, + * the method returns immediately. + */ + void destroy(boolean etherealize_objects, boolean wait_for_completion); + + /** + * Create the IdUniquenessPolicy policy. + * + * @param value states which one Id uniqueness policy will apply. + * + * @return the created policy. + */ + IdUniquenessPolicy create_id_uniqueness_policy(IdUniquenessPolicyValue a_value); + + /** + * Create the ImplicitActivationPolicy policy. + * + * @param value states which one activation policy will apply. + * + * @return the created policy. + */ + ImplicitActivationPolicy create_implicit_activation_policy(ImplicitActivationPolicyValue a_value); + + /** + * Create the LifespanPolicy policy. + * + * @param value states which one object lifespan policy will apply. + * + * @return the created policy. + */ + LifespanPolicy create_lifespan_policy(LifespanPolicyValue a_value); + + /** + * Create the RequestProcessingPolicy policy. + * + * @param value states which one request processing policy will apply. + * + * @return the created policy. + */ + RequestProcessingPolicy create_request_processing_policy(RequestProcessingPolicyValue a_value); + + /** + * Create the ServantRetentionPolicy policy. + * + * @param value states which one servant retention policy will apply. + * + * @return the created policy. + */ + ServantRetentionPolicy create_servant_retention_policy(ServantRetentionPolicyValue a_value); + + /** + * Create the ThreadPolicy policy. + * + * @param value states which one thread policy will apply. + * + * @return the created policy. + */ + ThreadPolicy create_thread_policy(ThreadPolicyValue a_value); + + /** + * Create the ID assignment policy with the given value. + * + * @param value states which one ID assignment policy will apply. + * + * @return the created policy. + */ + IdAssignmentPolicy create_id_assignment_policy(IdAssignmentPolicyValue value); + +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicy.java b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicy.java new file mode 100644 index 0000000..1b37d9f --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicy.java @@ -0,0 +1,59 @@ +/* RequestProcessingPolicy.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies the behaviour in the case when the + * requested object is not found in the Active Object Map or that map + * is not in use. + * + * The policy can return its current value, as defined. + * in {@link RequestProcessingPolicyOperations}. + * + * @see RequestProcessingPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestProcessingPolicy + extends Policy, RequestProcessingPolicyOperations, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyOperations.java new file mode 100644 index 0000000..672ba18 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyOperations.java @@ -0,0 +1,55 @@ +/* RequestProcessingPolicyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the RequestProcessingPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface RequestProcessingPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + RequestProcessingPolicyValue value(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/Servant.java b/libjava/classpath/org/omg/PortableServer/Servant.java new file mode 100644 index 0000000..745fc8a --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/Servant.java @@ -0,0 +1,288 @@ +/* Servant.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.OBJECT_NOT_EXIST; +import org.omg.CORBA.ORB; +import org.omg.PortableServer.POAPackage.ServantNotActive; +import org.omg.PortableServer.POAPackage.WrongPolicy; +import org.omg.PortableServer.portable.Delegate; +import gnu.CORBA.Poa.ORB_1_4; +import gnu.CORBA.Poa.gnuPOA; + +/** + * <p> + * The servant is responsible for handling the method invocation on the + * target object. It can be one servant per object, or the same servant can + * support several (possibly all) objects, associated with the given POA. + * </p> <p> + * Till JDK 1.3 inclusive, a typical IDL to java compiler generates an + * implementation base (name pattern _*ImplBase.java) that is derived from the + * {@link org.omg.CORBA.portable.ObjectImpl}. Since JDK 1.4 the implementation + * base is derived from the Servant, also having a different name pattern + * (*POA.java). This suffix may be confusing, as the servant itself is + * <i>not</i> POA nor it is derived from it. + * </p><p> + * In both cases, the implementation base also inherits an interface, containing + * definitions of the application specific methods. The application programmer + * writes a child of the implementation base, implementing these methods + * for the application-specific functionality. The ObjectImpl is connected + * directly to the ORB. The Servant is connected to POA that can be obtained + * from the ORB. + * </p><p> + * If the servant is connected to more than one object, the exact object + * being currently served can be identified with {@link #_object_id}. + * </p><p> + * The derivativ of Servant, being directly connected to serve requests, + * must inherit either from {@link org.omg.CORBA.portable.InvokeHandler} + * or from {@link org.omg.PortableServer.DynamicImplementation}). + * </p><p> + * The Servant type is a CORBA <code>native</code> type. + * </p> + * + * @see POA.servant_to_reference(Servant) + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class Servant +{ + /** + * The delegate, where calls to some Servant methods are forwarded. + */ + private Delegate delegate; + + /** + * Get the repository ids of all interfaces, supported by the + * CORBA object, identified by the passed Id. In the typical code the + * passed parameters are ignored, returning an array of repository ids, + * supported by the servant implementation. + * + * @param poa a POA of the given object. + * @param object_ID the object Id of the given object. + * + * @return an array, containing the repository ids. + */ + public abstract String[] _all_interfaces(POA poa, byte[] object_ID); + + /** + * Get the delegate, where calls to some Servant methods are forwarded. + */ + public final Delegate _get_delegate() + { + return delegate; + } + + /** + * Get the interface repository definition <code>InterfaceDef</code> for this + * Object. By default, forwards request to the delegate. + * + * @specnote The interface repository is officially not implemented up till + * JDK 1.5 inclusive. The delegate throws NO_IMPLEMENT, always. + */ + public org.omg.CORBA.Object _get_interface_def() + { + throw new NO_IMPLEMENT(); + } + + /** + * Checks if the passed servant is an instance of the given CORBA IDL type. + * By default, forwards the requet to the delegate. + * + * @param a_servant a servant to check. + * @param an_id a repository ID, representing an IDL type for that the + * servant must be checked. + * + * @return true if the servant is an instance of the given type, false + * otherwise. + */ + public boolean _is_a(String repository_id) + { + return delegate.is_a(this, repository_id); + } + + /** + * Determines if the server object for this reference has already + * been destroyed. By default, forwards request to the delegate. + * + * @return true if the object has been destroyed, false otherwise. + */ + public boolean _non_existent() + { + return delegate.non_existent(this); + } + + /** + * Returns the ORB that is directly associated with the given servant. + * In this implementation, the method is overridden to return + */ + public final ORB _orb() + { + return delegate.orb(this); + } + + /** + * Returns the root POA of the ORB instance, associated with this servant. + * It is the same POA that would be returned by resolving the initial + * reference "RootPOA" for that orb. By default, forwards request to the + * delegate. + * + * @see ORB.resolve_initial_references + */ + public POA _default_POA() + { + return delegate == null ? null : delegate.default_POA(this); + } + + /** + * Return the invocation target object identifier as a byte array. + * This is typically used when the same servant serves multiple objects, + * and the object id can encapsulated the whole description of the + * object. + * + * This method returns correct values even when the same + * servant serves several objects in parallel threads. The ORB maintains the + * thread to invocation data map for all calls that are currently being + * processed. + */ + public final byte[] _object_id() + { + if (delegate != null) + return delegate.object_id(this); + else + throw new OBJECT_NOT_EXIST(); + } + + /** + * Get POA that is directly associated with the given servant. + * By default, forwards request to the delegate. + */ + public final POA _poa() + { + return delegate.poa(this); + } + + /** + * Set the delegate for this servant. + */ + public final void _set_delegate(Delegate a_delegate) + { + delegate = a_delegate; + } + + /** + * Obtains the CORBA object reference that is a current invocation target for + * the given servant. This is important when the same servant serves + * multiple objects. If the servant is not yet connected to the passed + * orb, the method will try to connect it to that orb on POA, returned + * by the method {@link _default_POA}. That method can be overridden to + * get poa where the object must be automatically connected when + * calling this method. + * + * @param an_orb the ORB with relate to that the object is requested. + */ + public final org.omg.CORBA.Object _this_object(ORB an_orb) + { + if (delegate != null) + return delegate.this_object(this); + else + { + if (an_orb instanceof ORB_1_4) + { + ORB_1_4 m_orb = (ORB_1_4) an_orb; + + gnuPOA dp = (gnuPOA) _default_POA(); + if (dp == null) + dp = m_orb.rootPOA; + + try + { + return dp.servant_to_reference(this); + } + catch (WrongPolicy unexp) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(unexp); + throw bad; + } + catch (ServantNotActive ex) + { + try + { + return dp.id_to_reference(dp.activate_object(this)); + } + catch (Exception unexp) + { + unexp.initCause(ex); + + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(unexp); + throw bad; + } + } + } + } + throw new OBJECT_NOT_EXIST(); + } + + /** + * Obtains the CORBA object reference that is a current invocation target for + * the given servant. This is important when the same servant serves + * multiple objects. This method required the servant to be connected + * to a single orb, and a delegate set. + * + * This method returns correct values even when the same + * servant serves several objects in parallel threads. The ORB maintains the + * thread to invocation data map for all calls that are currently being + * processed. + */ + public final org.omg.CORBA.Object _this_object() + { + if (delegate != null) + return _this_object(_orb()); + else + { + POA def = _default_POA(); + if (def instanceof gnuPOA) + return _this_object(((gnuPOA) def).orb()); + } + throw new OBJECT_NOT_EXIST(); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivator.java b/libjava/classpath/org/omg/PortableServer/ServantActivator.java new file mode 100644 index 0000000..244fedf --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivator.java @@ -0,0 +1,59 @@ +/* ServantActivator.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * The POA, that has the RETAIN policy uses servant managers that are + * ServantActivators. The operations, that must be supported by these + * managers, are defined separately in {@link ServantActivatorOperations}. + * + * @see ServantLocator + * @see ServantRetentionPolicyValue + * @see ServantManager + * @see POAOperations#set_servant_manager + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantActivator + extends ServantManager, ServantActivatorOperations, IDLEntity, + org.omg.CORBA.Object +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java new file mode 100644 index 0000000..1aab99c --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java @@ -0,0 +1,145 @@ +/* ServantActivatorHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the CORBA object {@link ServantActivator}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServantActivatorHelper +{ + /** + * Get the type code of the {@link ServantActivator}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "ServantActivator"); + } + + /** + * Insert the ServantActivator into the given Any. + * + * @param any the Any to insert into. + * @param that the ServantActivator to insert. + */ + public static void insert(Any any, ServantActivator that) + { + any.insert_Object(that); + } + + /** + * Extract the ServantActivator from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ServantActivator. + */ + public static ServantActivator extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the ServantActivator repository id. + * + * @return "IDL:omg.org/PortableServer/ServantActivator:2.3", always. + */ + public static String id() + { + return "IDL:omg.org/PortableServer/ServantActivator:2.3"; + } + + /** + * Casts the passed object into the ServantActivator. + * + * @param obj the object to cast. + * @return casted instance. + * @throws BAD_PARAM if the passed object is not a ServantActivator. + */ + public static ServantActivator narrow(org.omg.CORBA.Object obj) + { + try + { + return (ServantActivator) obj; + } + catch (ClassCastException ex) + { + BAD_PARAM bad = new BAD_PARAM(); + bad.initCause(ex); + throw bad; + } + } + + /** + * This should read the servant activator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static ServantActivator read(InputStream input) + { + throw new MARSHAL(); + } + + /** + * This should write the servant activator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static void write(OutputStream output, ServantActivator value) + { + throw new MARSHAL(); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorOperations.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorOperations.java new file mode 100644 index 0000000..6437f35 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorOperations.java @@ -0,0 +1,94 @@ +/* ServantActivatorOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + + +/** + * Defines the operations, applicable to the {@link ServantActivator}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantActivatorOperations + extends ServantManagerOperations +{ + /** + * This method is invoked whenever a servant for an object is deactivated, + * assuming the POA has the USE_SERVANT_MANAGER and RETAIN policies. + * + * @param Object_Id the Id of the object being deactivated. + * + * @param poa the POA in those scope the object was active. + * + * @param servant the servant, serving the object being deactivated. + * + * @param cleanup_in_progress if true, this method was called from due + * deactivation or destruction operation. False indicates that the method + * was called due other reasons. + * + * @param remaining_activations if true, at the invocation moment the + * passed servant is also associated with other objects in the active + * object map of the given POA. + */ + void etherealize(byte[] Object_Id, POA poa, Servant servant, + boolean cleanup_in_progress, boolean remaining_activations + ); + + /** + * This method is invoked whenever the POA receives a request for an + * object that is not currently active, assuming the POA has the + * USE_SERVANT_MANAGER and RETAIN policies. The user-supplied servant + * manager is responsible for locating or creating an appropriate servant + * that corresponds to the ObjectId value. The subsequent requests with + * the same ObjectId value will be delivered directly to that servant + * without invoking the servant manager. + * + * @param Object_Id the ObjectId value associated with the incoming request. + * @param poa the POA in which the object is being activated. + * + * @return a servant that will be used to process the incoming request. + * + * @throws ForwardRequest if the activator decides to forward the request + * to another object. The exception contains the object that should + * handle this request. This object is usually remote, but can also + * be local. The throws exception will forward all subsequent requests + * till the new activation. + */ + Servant incarnate(byte[] Object_Id, POA poa) + throws ForwardRequest; +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorPOA.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorPOA.java new file mode 100644 index 0000000..5ea0be4 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorPOA.java @@ -0,0 +1,173 @@ +/* ServantActivatorPOA.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import gnu.CORBA.Poa.gnuServantObject; + +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; + +/** + * <p>This ServantActivator stub is an optional base for the + * servant activators. This stub cannot serve remote invocations, as + * methods in {@link ServantActivatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant activator from this stub, + * it is enough to implement the {@link ServantActivator} interface. + * But you may choose to do this if you need the functional + * {@link #_all_interfaces()} method or want to keep default behavior during + * the incarnation or etherialization. + * </p> + */ +public class ServantActivatorPOA + extends Servant + implements InvokeHandler, ServantActivatorOperations +{ + /** + * Used to access the outer class in the nested delegator class. + */ + final ServantActivatorPOA THIS = this; + + /** + * This class is used to support _this. + */ + class delegator + extends gnuServantObject + implements ServantActivator + { + delegator(Servant s) + { + super(s, new byte[ 0 ], null, null); + } + + public Servant incarnate(byte[] key, POA poa) + throws org.omg.PortableServer.ForwardRequest + { + return THIS.incarnate(key, poa); + } + + public void etherealize(byte[] key, POA poa, Servant servant, + boolean cleanup, boolean remains + ) + { + THIS.etherealize(key, poa, servant, cleanup, remains); + } + } + + /** + * It is your responsibility to handle the incarnation event and + * supply the servant. + * The default method instructs POA that the servant cannot be + * provided by activator. The OBJ_ADAPTER exception will be + * thrown by POA, unless the servant is provided as one of the + * parameters in the activation method, or the default servant is set. + * + * @see ServantActivatorOperations#incarnate + * + * @specnote in GNU Classpath, returning null means that the + * activator does not supply the servant. The servant can still be supplied + * as one of parameters in some POA activation methods or as a default + * servant. + * + * @throws ForwardRequest + */ + public Servant incarnate(byte[] Object_Id, POA poa) + throws ForwardRequest + { + return null; + } + + /** + * It is your responsibility to handle the etherialization event. + * Override this method if using the class. The default method + * does nothing. + * + * @see ServantActivatorOperations#incarnate + */ + public void etherealize(byte[] Object_Id, POA poa, Servant servant, + boolean cleanup, boolean remains + ) + { + } + + /** + * Our implementation will not call this method. After setting your + * manager to POA, it will call incarnate and etherialize directly. + */ + public OutputStream _invoke(String method, InputStream input, + ResponseHandler handler + ) + throws SystemException + { + throw new NO_IMPLEMENT(); + } + + /** + * Returns an array of interfaces, supported by the servant activator. + */ + public String[] _all_interfaces(POA poa, byte[] Object_Id) + { + return new _ServantActivatorStub()._ids(); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantActivator _this() + { + return new delegator(this); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantActivator _this(ORB orb) + { + return new delegator(this); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocator.java b/libjava/classpath/org/omg/PortableServer/ServantLocator.java new file mode 100644 index 0000000..9989fd4 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocator.java @@ -0,0 +1,59 @@ +/* ServantLocator.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * When the POA has the NON_RETAIN policy it uses servant managers that are + * ServantLoacators. The operations, that must be supported by these managers, + * are defined separately in {@link ServantLocatorOperations}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + * + * @see ServantActivator + * @see ServantRetentionPolicyValue + * @see ServantManager + * @see POAOperations#set_servant_manager + */ +public interface ServantLocator + extends ServantManager, ServantLocatorOperations, IDLEntity, + org.omg.CORBA.Object +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java new file mode 100644 index 0000000..984abdf --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java @@ -0,0 +1,145 @@ +/* ServantLocatorHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Any; +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ORB; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** +* The helper operations for the CORBA object {@link ServantLocator}. +* +* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +*/ +public abstract class ServantLocatorHelper +{ + /** + * Get the type code of the {@link ServantLocator}. + */ + public static TypeCode type() + { + return ORB.init().create_interface_tc(id(), "ServantLocator"); + } + + /** + * Insert the ServantLocator into the given Any. + * + * @param any the Any to insert into. + * @param that the ServantLocator to insert. + */ + public static void insert(Any any, ServantLocator that) + { + any.insert_Object(that); + } + + /** + * Extract the ServantLocator from given Any. + * + * @throws BAD_OPERATION if the passed Any does not contain ServantLocator. + */ + public static ServantLocator extract(Any any) + { + return narrow(any.extract_Object()); + } + + /** + * Get the ServantLocator repository id. + * + * @return "org.omg.PortableServer.ServantLocatorOperations", always. + */ + public static String id() + { + return "org.omg.PortableServer.ServantLocatorOperations"; + } + + /** + * Cast the passed object into the ServantLocator. + * + * @param obj the object to narrow. + * @return narrowed instance. + * @throws BAD_PARAM if the passed object is not a ServantLocator. + */ + public static ServantLocator narrow(org.omg.CORBA.Object obj) + { + try + { + return (ServantLocator) obj; + } + catch (ClassCastException ex) + { + BAD_OPERATION bad = new BAD_OPERATION(); + bad.initCause(ex); + throw bad; + } + } + + /** + * This should read the servant locator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static ServantLocator read(InputStream input) + { + throw new MARSHAL(); + } + + /** + * This should write the servant activator, but it cannot be transferred + * this way as its operations cannot be remote. The operations cannot + * be remote because one of the method parameters, POA, is required to be + * always a local object (both by 1.5 API and 3.0.3 OMG). + * + * @throws MARSHAL, always. + * + * @specnote Same as Sun. + */ + public static void write(OutputStream output, ServantLocator value) + { + throw new MARSHAL(); + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorOperations.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorOperations.java new file mode 100644 index 0000000..6ed214e --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorOperations.java @@ -0,0 +1,96 @@ +/* ServantLocatorOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; + +/** + * Defines the operations, applicable to the {@link ServantLocator}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantLocatorOperations + extends ServantManagerOperations +{ + /** + * If the POA has the USE_SERVANT_MANAGER and NON_RETAIN policies, it + * invokes this method whenever the object being requested that is not + * inactive. This method has access to all details of the received + * request and can use them to choose between servaral alternative servants. + * It can also forward the request to another server. + * + * @param Object_Id the id of the object, on which the request was called. + * @param poa the POA in those scope the object is active. + * @param operation the name of the method or operation being invoked. + * @param cookie_holder the holder where the servant manager can store + * an arbitrary java.lang.Object. This object will be later passed as a + * <code>cookie</code> parameter for {@link postinvoke}, to create tie + * between preinvoke and postinvoke. The application should <i>not</i> + * suppose that each call of preinvoke is followed by the subsequent + * postinvoke for the same invocation; under multi threaded policy these + * calls may be intermixed. + * + * @return a servant that will serve the incoming request. + * + * @throws ForwardRequest if the locator decides to forward the request + * to another object. The exception contains the object that should + * handle this request. This object is usually remote, but can also + * be local. As <code>preinvoke</code> is called on each method + * invocation, the thrown exception will forward only this current request. + */ + Servant preinvoke(byte[] Object_Id, POA poa, String operation, + CookieHolder cookie_holder + ) + throws ForwardRequest; + + /** + * If the POA has the USE_SERVANT_MANAGER and NON_RETAIN policies, it + * invokes this method whenever a servant completes a request. + * + * @param Object_Id the id of the object, on which the request was called. + * @param poa the POA in those scope the object is active. + * @param operation the name of the method or operation that was invoked. + * @param cookie the object that has been previously set by preinvoke in + * the <code>cookie_holder</code> parameter. + * @param servant the servant, associated with the object. + */ + void postinvoke(byte[] Object_Id, POA poa, String operation, + java.lang.Object cookie, Servant servant + ); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorPOA.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorPOA.java new file mode 100644 index 0000000..0a0f996 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorPOA.java @@ -0,0 +1,180 @@ +/* ServantLocatorPOA.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import gnu.CORBA.Poa.gnuServantObject; + +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; + +/** + * <p>The ServantLocator stub is an optional base for the + * servant locators. It cannot serve remote invocations, as + * methods in {@link ServantLocatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant locator from this stub, + * it is enough to implement the {@link ServantLocator} interface. + * But you may choose to do this if you need its functional + * {@link #_ids()} method or want to keep default behavior during per- + * or post- invokcations. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ServantLocatorPOA + extends Servant + implements ServantLocatorOperations, InvokeHandler +{ + /** + * Used to access the outer class in the nested classes. + */ + final ServantLocatorPOA THIS = this; + + /** + * It is your responsibility to take the preinvoke actions, if any, + * and also supply an appropriate servant for the current invocation. + * + * The default method instructs POA that the servant cannot be + * provided by locator. The OBJ_ADAPTER exception will be + * thrown by POA, unless it uses the available default servant for all + * invocations. + * + * @specnote in GNU Classpath, returning null means that the + * locator does not supply the servant. + * + * @see ServantLocatorOperations#preinvoke + */ + public Servant preinvoke(byte[] Object_Id, POA poa, String method, + CookieHolder cookie_holder + ) + throws org.omg.PortableServer.ForwardRequest + { + return null; + } + + /** + * It is your responsibility to take the postinvoke actions, if any, + * by overriding this method. The default method does nothing. + * + * @see ServantLocatorOperations#postinvoke + */ + public void postinvoke(byte[] Object_Id, POA poa, String method, + java.lang.Object cookie, Servant servant + ) + { + } + + /** + * Our implementation will not call this method. After setting your + * manager to POA, it will call incarnate and etherialize directly. + */ + public OutputStream _invoke(String method, InputStream input, + ResponseHandler handler + ) + throws SystemException + { + throw new NO_IMPLEMENT(); + } + + /** + * Returns an array of interfaces, supported by the servant locator. + */ + public String[] _all_interfaces(POA poa, byte[] Object_Id) + { + return new _ServantLocatorStub()._ids(); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantLocator _this() + { + return new delegator(this); + } + + /** + * Return the complete instance of the servant activator, based on + * the current class (ServantActivatorPOA or derived). + */ + public ServantLocator _this(ORB orb) + { + return new delegator(this); + } + + /** + * This class is used to support _this. + */ + class delegator + extends gnuServantObject + implements ServantLocator + { + delegator(Servant s) + { + super(s, new byte[ 0 ], null, null); + } + + public Servant preinvoke(byte[] Object_Id, POA poa, String method, + CookieHolder cookie_holder + ) + throws org.omg.PortableServer.ForwardRequest + { + return THIS.preinvoke(Object_Id, poa, method, cookie_holder); + } + + public void postinvoke(byte[] Object_Id, POA poa, String method, + java.lang.Object cookie, Servant servant + ) + { + THIS.postinvoke(Object_Id, poa, method, cookie, servant); + } + + public String[] _ids() + { + return THIS._all_interfaces(null, null); + } + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantManager.java b/libjava/classpath/org/omg/PortableServer/ServantManager.java new file mode 100644 index 0000000..082aea3 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantManager.java @@ -0,0 +1,56 @@ +/* ServantManager.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * A servant manager is associated with POA and provide possibility + * to activate objects on demand. A servant manager interface itself + * is empty, but it is inherited by other two interfaces, + * {@link ServantActivator} and {@link ServantLocator}. + * + * @see POAOperations#set_servant_manager + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantManager + extends ServantManagerOperations, IDLEntity, org.omg.CORBA.Object +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantManagerOperations.java b/libjava/classpath/org/omg/PortableServer/ServantManagerOperations.java new file mode 100644 index 0000000..b7c3b75 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantManagerOperations.java @@ -0,0 +1,54 @@ +/* ServantManagerOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +/** + * This interface would define the operations, applicable to + * the ServantManager. A servant manager interface itself + * is empty, but it is inherited by other two interfaces, + * {@link ServantActivator} and {@link ServantLocator}. + * + * @see ServantActivatorOperations + * @see ServantLocatorOperations + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantManagerOperations +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicy.java b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicy.java new file mode 100644 index 0000000..ee47af5 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicy.java @@ -0,0 +1,58 @@ +/* ServantRetentionPolicy.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Specifies if the active servants should be retained in the + * Active Object Map. + * + * The policy can return its current value, as defined. + * in {@link ServantRetentionPolicyOperations}. + * + * @see ServantRetentionPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantRetentionPolicy + extends Policy, ServantRetentionPolicyOperations, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyOperations.java new file mode 100644 index 0000000..2ef0ab5 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyOperations.java @@ -0,0 +1,55 @@ +/* ServantRetentionPolicyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the ServantRetentionPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ServantRetentionPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + ServantRetentionPolicyValue value(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicy.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicy.java new file mode 100644 index 0000000..b16ac17 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicy.java @@ -0,0 +1,57 @@ +/* ThreadPolicy.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.Policy; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the POA thread policy. + * + * The policy can return its current value, as defined. + * in {@link ThreadPolicyOperations}. + * + * @see ThreadPolicyValue for the possible values of this policy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ThreadPolicy + extends Policy, ThreadPolicyOperations, IDLEntity +{ +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicyOperations.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicyOperations.java new file mode 100644 index 0000000..b366288 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicyOperations.java @@ -0,0 +1,55 @@ +/* ThreadPolicyOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.PolicyOperations; + +/** + * Defines the operations, applicable to the ThreadPolicy. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface ThreadPolicyOperations + extends PolicyOperations +{ + /** + * Return the value of this policy type, stated by the current instance. + */ + ThreadPolicyValue value(); +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java new file mode 100644 index 0000000..c7d4d63 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java @@ -0,0 +1,163 @@ +/* ThreadPolicyValue.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.portable.IDLEntity; + +import java.io.Serializable; + +/** + * Defines the possible values for the POA thread policy. + * + * This enumeration can obtain the following values: + * <ul> + * <li>ORB_CTRL_MODEL Each object in POA has a separate serving thread + * and a separate server socket, listening on the objects individual + * port. Additionally, when the request is accepted, it is also + * served in a separate thread, so several requests to the same + * object can be processed in parallel. The servant can always get + * the Id and POA of the object it is currently serving by + * invoking {@link Servant#_object_id()} and {@link Servant#_poa}. + * These two methods use thread to data map and must work correctly + * even then the servant code is executed in several parallel threads. + * </li> + * <li>SINGLE_THREAD_MODEL All objects in POA share the same server + * socket and are served in the same thread. This model is applicable + * when the number of objects is greater than the number of threads + * and (or) ports, supported by the system.</li> + * </ul> + * OMG also defines a MAIN_THREAD_MODEL, currently not supported by + * the java API. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ThreadPolicyValue + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -8874988828297141512L; + + /** + * The value field for the current instance. + */ + private final int _value; + + /** + * The possible value of this enumeration (ORB_CTRL_MODEL). + */ + public static final int _ORB_CTRL_MODEL = 0; + + /** + * An instance of ThreadPolicyValue, initialized to ORB_CTRL_MODEL. + */ + public static final ThreadPolicyValue ORB_CTRL_MODEL = + new ThreadPolicyValue(_ORB_CTRL_MODEL); + + /** + * The possible value of this enumeration (SINGLE_THREAD_MODEL). + */ + public static final int _SINGLE_THREAD_MODEL = 1; + + /** + * An instance of ThreadPolicyValue, initialized to SINGLE_THREAD_MODEL. + */ + public static final ThreadPolicyValue SINGLE_THREAD_MODEL = + new ThreadPolicyValue(_SINGLE_THREAD_MODEL); + + /** + * The private array that maps integer codes to the enumeration + * values. + */ + private static final ThreadPolicyValue[] enume = + new ThreadPolicyValue[] { ORB_CTRL_MODEL, SINGLE_THREAD_MODEL }; + + /** + * The private array of state names. + */ + private static final String[] state_names = + new String[] { "ORB_CTRL_MODEL", "SINGLE_THREAD_MODEL" }; + + /** + * Normally, no new instances are required, so the constructor is protected. + */ + protected ThreadPolicyValue(int a_value) + { + _value = a_value; + } + + /** + * Returns the ThreadPolicyValue, matching the given integer constant. + * + * @param code one of _ORB_CTRL_MODEL, _SINGLE_THREAD_MODEL. + * @return one of ORB_CTRL_MODEL, SINGLE_THREAD_MODEL. + * @throws BAD_PARAM if the parameter is not one of the valid values. + */ + public static ThreadPolicyValue from_int(int code) + { + try + { + return enume [ code ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + throw new BAD_OPERATION("Invalid enumeration code " + code); + } + } + + /** + * Returns a short string representation. + * @return the name of the current enumeration value. + */ + public String toString() + { + return state_names [ _value ]; + } + + /** + * Returns the integer code of the enumeration value. + * @return one of ORB_CTRL_MODEL, SINGLE_THREAD_MODEL. + */ + public int value() + { + return _value; + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/_ServantActivatorStub.java b/libjava/classpath/org/omg/PortableServer/_ServantActivatorStub.java new file mode 100644 index 0000000..6f90715 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/_ServantActivatorStub.java @@ -0,0 +1,131 @@ +/* _ServantActivatorStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ORB; +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 java.io.Serializable; + +/** + * <p>This ServantActivator stub is an optional base for the + * servant activators. This stub cannot accept remote invocations, as + * methods in {@link ServantActivatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant activator from this stub, + * it is enough to implement the {@link ServantActivator} interface. + * But you may choose to do this if you need the functional + * {@link #_ids()} method or want to keep default behavior during + * the incarnation or etherialization. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _ServantActivatorStub + extends ObjectImpl + implements ServantActivator, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -685959979577281419L; + + /** + * This the purpose of this field is undocumented up till 1.5 java API + * inclusive. + */ + public static final Class _opsClass = ServantActivatorOperations.class; + + /** + * Return the array of repository ids for this object. + * + * @return { "IDL:omg.org/PortableServer/ServantActivator:2.3", + * "IDL:omg.org/PortableServer/ServantManager:1.0" }, always. + */ + public String[] _ids() + { + return new String[] + { + "IDL:omg.org/PortableServer/ServantActivator:2.3", + "IDL:omg.org/PortableServer/ServantManager:1.0" + }; + } + + /** + * It is your responsibility to handle the incarnation event and + * supply the servant. Override this method if using the class. + * The default method instructs POA that the servant cannot be + * provided by activator. The OBJ_ADAPTER exception will be + * thrown by POA, unless the servant is provided as one of the + * parameters in the activation method. + * + * @see ServantActivatorOperations#incarnate + * + * @specnote in GNU Classpath, returning null means that the + * activator does not supply the servant. + * + * @throws ForwardRequest + */ + public Servant incarnate(byte[] Object_id, POA poa) + throws ForwardRequest + { + return null; + } + + /** + * It is your responsibility to handle the etherialization event. + * Override this method if using the class. The default method + * does nothing. + * + * @see ServantActivatorOperations#incarnate + */ + public void etherealize(byte[] Object_id, POA poa, Servant servant, + boolean cleanup, boolean remaining + ) + { + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/_ServantLocatorStub.java b/libjava/classpath/org/omg/PortableServer/_ServantLocatorStub.java new file mode 100644 index 0000000..8234ba2 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/_ServantLocatorStub.java @@ -0,0 +1,132 @@ +/* _ServantLocatorStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer; + +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; + +import java.io.Serializable; + +/** + * <p>The ServantLocator stub is an optional base for the + * servant locators. This stub cannot accept remote invocations, as + * methods in {@link ServantLocatorOperations} take POA as one of parameters. + * Both JDK 1.5 API and OMG specifies that POA is a local object that must not + * be transferred to the remote invocation target. + * </p><p> + * You do not need to derive your servant locator from this stub, + * it is enough to implement the {@link ServantLocator} interface. + * But you may choose to do this if you need its functional + * {@link #_ids()} method or want to keep default behavior during per- + * or post- invokcations. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _ServantLocatorStub + extends ObjectImpl + implements ServantLocator, Serializable +{ + /** + * Use serialVersionUID (v1.4) for interoperability. + */ + private static final long serialVersionUID = -2374963516905770111L; + + /** + * This the purpose of this field is undocumented up till 1.5 java API + * inclusive. + */ + public static final Class _opsClass = ServantLocatorOperations.class; + + /** + * The package private string, used as a parameter for + * the throws NullPointerExceptions in both servant locator and activator + * stubs. + */ + static final String OVERRIDE = "Override this method to get functionality."; + + /** + * Return the array of repository ids for this object, stating that it is + * both Servant locator and Servant manager. + * + * @return { "IDL:omg.org/PortableServer/ServantLocator:1.0", + * "IDL:omg.org/PortableServer/ServantManager:1.0" }, always. + */ + public String[] _ids() + { + return new String[] + { + "IDL:omg.org/PortableServer/ServantLocator:1.0", + "IDL:omg.org/PortableServer/ServantManager:1.0" + }; + } + + /** + * It is your responsibility to take the preinvoke actions, if any, + * and also supply an appropriate servant for the current invocation. + * + * The default method instructs POA that the servant cannot be + * provided by locator. The OBJ_ADAPTER exception will be + * thrown by POA, unless it uses the available default servant for all + * invocations. + * + * @specnote in GNU Classpath, returning null means that the + * locator does not supply the servant. + * + * @see ServantLocatorOperations#preinvoke + */ + public Servant preinvoke(byte[] Object_id, POA poa, String method, + CookieHolder cookie + ) + throws ForwardRequest + { + return null; + } + + /** + * It is your responsibility to take the postinvoke actions, if any, + * by overriding this method. The default method does nothing. + * + * @see ServantLocatorOperations#postinvoke + */ + public void postinvoke(byte[] Object_id, POA poa, String method, + Object cookie, Servant servant + ) + { + } +}
\ No newline at end of file diff --git a/libjava/classpath/org/omg/PortableServer/package.html b/libjava/classpath/org/omg/PortableServer/package.html new file mode 100644 index 0000000..e4a74ef --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/package.html @@ -0,0 +1,231 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in org.omg.PortableServer package + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - The Portable Object Adapter package</title></head> +<body> +<p> +The Portable Object Adapter (POA) provides more control on the request +processing than it is possible when connecting objects directly to the +ORB. The POA model defines a tree structure of POAs, the root POA being +connected directly to the ORB. Any branch of this tree can be temporary or +permanently inactivated using {@link org.omg.PortableServer.POAManager}. +The same manager can control several branches in the POA tree. Also, +any branch in this tree can have different processing options (policies). +</p><p> +The newly created POA is in holding state, just queuing requests. To start +processing requests, it must be turned into the active state by its +{@link org.omg.PortableServer.POAManagerOperations#activate}. +</p><p> +The previously monolite object implementation is now divided into object +(that implements {@link org.omg.CORBA.Object}) +and servant (that implements either {@link org.omg.CORBA.portable.InvokeHandler} +or {@link org.omg.PortableServer.DynamicImplementation}). +Frequently each object has its own servant, but it can also be a single servant +per multiple objects and also default servant for POA +(see {@link org.omg.PortableServer.POAOperations#set_servant}). Each object +has its own Object Id, unique in the scope of the POA, where the object is +connected. These Ids need not be different for objects belonging +to different POAs, even if these POAs are connected to the same ORB. +Under the USER_ID is assignment policy this Id can be a specified by user in +{@link org.omg.PortableServer.POAOperations#activate_object_with_id}, +encapsulating some meaningful information about the object. The Id of the +object being currently served can be identified with +{@link org.omg.PortableServer.Servant#_object_id}. This approach is used in cases +when it is possible to encapsulate all object-related data into the +Object Id. Such system only needs one servant, one server socket and one +socket port per POA that can handle thounsands of objects. +</p><p> +Instead of being connected directly to the ORB, objects are now connected +to one of the ORBs POAs. Since JDK 1.4 the application specific implementation +base is derived from the {@link org.omg.PortableServer.Servant}, having a +different name pattern (<code>*POA.java</code> instead of the previous +<code>_*ImplBase.java</code>). This <code>*POA</code> suffix does <i>not</i> +mean that these servants implement or are derived from POA. They are different +classes that can be connected to one of the POAs, by instance, using +{@link org.omg.PortableServer.POAOperations#servant_to_reference}. +The implementation base also inherits an *Operations interface, containing +definitions of the application specific methods. The application programmer +writes a descendent of the implementation base, implementing these methods +for the application - specific functionality. +</p><p> +The POA objects support the method invocation by name, using +{@link org.omg.CORBA.Request}. This alternative method works without the +service-specific classes that may not be available at run time. +</p><p> +The objects in POA can also be activated and inactivated independently. It +is possible to set a listener ({@link org.omg.PortableServer.ServantActivator}) +that would register the object activations ("incarnations") and deactivations +("etherializations"). The servant need not be specifyed when creating an +object. Under the IMPLICIT_ACTIVATION +{@link org.omg.PortableServer.ImplicitActivationPolicy} +the {@link org.omg.PortableServer.ServantActivator} can provide the servant +in response to the first (local or remote) call of any method on the +previously incative object. +</p><p> +The root POA is obtained by resolving the initial reference "RootPOA" +for the orb. In the simpliest case the objects can be connected directly +to that root POA without creating the POA tree. The policies, used by +the root POA, are defined by OMG as following: +<table border="1"> +<tr><th>Policy type</th><th>Accepted policy</th></tr> +<tr><td>{@link org.omg.PortableServer.IdAssignmentPolicy} </td><td>SYSTEM_ID +(Ids are created by POA)</td></tr> +<tr><td>{@link org.omg.PortableServer.IdUniquenessPolicy}</td><td>UNIQUE_ID + (single object (and Id) per servant) +</td></tr> +<tr><td>{@link org.omg.PortableServer.ImplicitActivationPolicy} </td><td> +IMPLICIT_ACTIVATION (if inactive, activate)</td></tr> +<tr><td>{@link org.omg.PortableServer.LifespanPolicy} </td><td>TRANSIENT +(the POA objects cannot outlive POA)</td></tr> +<tr><td>{@link org.omg.PortableServer.RequestProcessingPolicy} </td><td> +USE_ACTIVE_OBJECT_MAP_ONLY (the servant is provided during activation)</td></tr> +<tr><td>{@link org.omg.PortableServer.ServantRetentionPolicy} </td><td> +RETAIN (retain servants for subsequent invocations)</td></tr> +<tr><td>{@link org.omg.PortableServer.ThreadPolicy} </td><td>ORB_CTRL_MODEL +(single thread per request and single server socket per object)</td></tr> +</table> +These values are also default for the child POAs The policies are +<i>never</i> inherited from the parent POA. +</p><p> +This set of policies means that each object will have a separate serving +thread, separate network socket port and usually a separate servant. It +is appropriate when the expected number of objects is not too large. +If the expected number of objects is larger than the supportable number +of threads and socket ports, the SINGLE_THREAD_MODEL +{@link org.omg.PortableServer.ThreadPolicy} is +used. Then all objects in POA with this policy are served in a single +thread, using the same server socket, connected to a single port. If the +request processing policy is additionally set to USE_DEFAULT_SERVANT, +all objects of this POA share the same (default) servant. +</p><p> +The operations, supported by POA are defined +separately in {@link org.omg.PortableServer.POAOperations}. +</p><p> +<h3>The typical POA usage scenarios</h3> +<h4>POA converts servant to the object reference</h4> +In the simpliest case, the servant implementation is connected to POA by +{@link org.omg.PortableServer.POAOperations#servant_to_reference}, the +returned object being a target of remote and local invocations. +It may be converted into the stringified reference, registered with +the naming service, used locally or, when serving or invoking local or remote +method, passed as a parameter or return value having the CORBA Object type. +The object obtains Id from POA and is activated due default implicit +activation policy. This scenario is supported by the default policy set +and is used in the most of the "hello world" examples. +<h4>Servant provides to the object reference</h4> +The servant can be connected to an ORB by +{@link org.omg.PortableServer.Servant#_this_object(org.omg.CORBA.ORB)}, +obtaining the object reference. The overridable +{@link org.omg.PortableServer.Servant#_default_POA()} +specifies POA to that the servant will be connected. The default method +connects to the root poa. IDL compilers frequently generate the +<code>_this(ORB)</code> metod for servants for getting the object reference +that is already narrowed to the exact object type. +<h4>Explicit activation with POA assigned ids</h4> +The objects are activated by calling the +{@link org.omg.PortableServer.POAOperations#activate_object} on the +POA with the object in question. The POA allocates, assigns, and +returns a unique identity value for the object. This scenario requires the +SYSTEM_ID {@link org.omg.PortableServer.IdAssignmentPolicy}. +<h4>Explicit Activation with User-assigned Ids</h4> +The POA supports an explicit activation operation, +{@link org.omg.PortableServer.POAOperations#activate_object_with_id}, +that associates a servant with the user-defined Object Id. +This scenario requires the USER_ID +{@link org.omg.PortableServer.IdAssignmentPolicy}. The servant manager +may be or may not be used. +<h4>References before activation</h4> +It may be useful to create references for objects before activating them. +Such reference can be created using +{@link org.omg.PortableServer.POAOperations#create_reference} or +{@link org.omg.PortableServer.POAOperations#create_reference_with_id}, both +methods also requiring to give the object repository id. Such object may +be later activated either by +{@link org.omg.PortableServer.POAOperations#activate_object_with_id} or +automatically, if the IMPLICIT_ACTIVATION policy applies. +<h4>Multiple Ids per servant</h4> +If the MULTIPLE_ID policy applies, the servant may be activated many times. +Under this policy, +{@link org.omg.PortableServer.POAOperations#servant_to_reference} +and {@link org.omg.PortableServer.POAOperations#servant_to_id} +during each call create a new object and object reference for the +used servant. +<h4>One servant for all objects</h4> +If the USE_DEFAULT_SERVANT policy applies, that default servant serves all +objects, belonging this POA. This approach is used when there is +very little data associated with each object, so little that the data can be +encoded in the Object Id. Also, it may be needed when a very large +number of objects is expected. If the RETAIN applies, it is possible to +activate an object explicitly setting the servant other than default. +If NO_RETAIN applies, the default servant will serve all known an +unknown objects for that POA. +<h4>Single Servant, Many Objects and Types</h4> +Combining USER_ID, USE_DEFAULT_SERVANT and RETAIN, it is possible to +create and serve objects "on the fly". The servant must determine the +object type (for instance, from the value of the agreed attribute, +shared by all supported types, or from the Object Id) and be able to +handle the method, named in request. If the names and parameter lists +of the object methods are also created "on the fly", the requests +to such object can still be submitted using {@link org.omg.CORBA.Request}. +This method is used when the created object represents some +entity in the complex database. +<h4>The ServantLocator finds a servant for each call</h4> +The {@link org.omg.PortableServer.ServantLocator} is used by POAs that +combinine NON_RETAIN and USE_SERVANT_MANAGER policies. It provides +a new or reused servant every time the invocation is made. The servant +locator must provide a servant in response of calling +{@link org.omg.PortableServer.ServantLocatorOperations#preinvoke}. +This method has access the the Id of the object being served and +the name of the method being called. It must return the appropriate +instance of the servant or throw an exception, forwarding the request +to another object (usually in another server). After the invocation, +a {@link org.omg.PortableServer.ServantLocatorOperations#postinvoke} +is called. It should be not assumed that the call of <code>preinvoke</code> +will be followed by the call of the <code>postinvoke</code>; in +multithreaded environment these calls are not serialized in this way. If +the <code>preinvoke</code> has to tell something this-call-specific to +the <code>postinvoke</code>, it must use the provided cookie holder. +The <code>preinvoke/postinoke</code> are also called to provide a servant +during each local invocation on the objects, belonging to the described POA. +</p><p> +All these scenarios must work with the current GNU Classpath release. + +@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) +</body> +</html> diff --git a/libjava/classpath/org/omg/PortableServer/portable/Delegate.java b/libjava/classpath/org/omg/PortableServer/portable/Delegate.java new file mode 100644 index 0000000..70e05e7 --- /dev/null +++ b/libjava/classpath/org/omg/PortableServer/portable/Delegate.java @@ -0,0 +1,112 @@ +/* DelegateOperations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.PortableServer.portable; + +import org.omg.CORBA.ORB; +import org.omg.PortableServer.POA; +import org.omg.PortableServer.Servant; + +/** + * Each {@link Servant} has an associated delegate, where the most of the calls + * are forwarded. The delegate is responsible for providing the actual + * functionality. This class is required to supports a conceptions of + * the CORBA 2.3.1 Servant. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface Delegate +{ + /** + * Returns the root POA of the ORB instance, associated with this servant. + * It is the same POA that would be returned by resolving the initial + * reference "RootPOA" for that orb. The default {@link Servant#default_POA} + * method forwards call to the delegate can be overridden to + * obtain the alternative default POA. + * + * @see ORB.resolve_initial_references + */ + POA default_POA(Servant a_servant); + + /** + * Get the interface repository defintion + * <code>InterfaceDef</code> for this Object. + */ + org.omg.CORBA.Object get_interface_def(Servant a_servant); + + /** + * Checks if the passed servant is an instance of the given CORBA IDL type. + * + * @param a_servant a servant to check. + * @param an_id a repository ID, representing an IDL type for that the + * servant must be checked. + * + * @return true if the servant is an instance of the given type, false + * otherwise. + */ + boolean is_a(Servant a_servant, String an_id); + + /** + * Determines if the server object for this reference has already + * been destroyed. + * + * @return true if the object has been destroyed, false otherwise. + */ + boolean non_existent(Servant a_servant); + + /** + * Return the invocation target object identifier as a byte array. + */ + byte[] object_id(Servant a_servant); + + /** + * Returns the ORB that is directly associated with the given servant. + */ + ORB orb(Servant a_servant); + + /** + * Get POA that is directly associated with the given servant. + */ + POA poa(Servant a_servant); + + /** + * Obtains the CORBA object reference that is an invocation target for the + * given servant. + */ + org.omg.CORBA.Object this_object(Servant a_servant); +}
\ No newline at end of file |