summaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/rmi
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/javax/rmi
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libjava/classpath/javax/rmi')
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ClassDesc.java66
-rw-r--r--libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java137
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Stub.java203
-rw-r--r--libjava/classpath/javax/rmi/CORBA/StubDelegate.java103
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Tie.java125
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Util.java416
-rw-r--r--libjava/classpath/javax/rmi/CORBA/UtilDelegate.java310
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ValueHandler.java130
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java94
-rw-r--r--libjava/classpath/javax/rmi/CORBA/package.html76
-rw-r--r--libjava/classpath/javax/rmi/PortableRemoteObject.java228
-rw-r--r--libjava/classpath/javax/rmi/package.html76
-rw-r--r--libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java168
-rw-r--r--libjava/classpath/javax/rmi/ssl/SslRMIServerSocketFactory.java213
14 files changed, 2345 insertions, 0 deletions
diff --git a/libjava/classpath/javax/rmi/CORBA/ClassDesc.java b/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
new file mode 100644
index 000000000..831cdbe48
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
@@ -0,0 +1,66 @@
+/* ClassDesc.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * This class is used to marshal java.lang.Class objects over IIOP.
+ * When used as a parameter type, return type, or data member, the Java Class
+ * is mapped to the OMG IDL type ::javax::rmi::CORBA::ClassDesc.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class ClassDesc implements Serializable
+{
+ /**
+ * Use serialVersionUID (V1.4) for interoperability.
+ */
+ private static final long serialVersionUID = -3477057297839810709L;
+
+ /**
+ * The class repository Id.
+ */
+ String repid;
+
+ /**
+ * Space separeted list of URL's from where the code can be downloaded.
+ */
+ String codebase;
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
new file mode 100644
index 000000000..b8f1d06da
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
@@ -0,0 +1,137 @@
+/* PortableRemoteObjectDelegate.java -- Interface supporting PortableRemoteObject
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * A delegate, implementing the functionality, provided by the
+ * {@link PortableRemoteObject}.
+ *
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of the alternative
+ * class that must implement {@link PortableRemoteObjectDelegate}.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface PortableRemoteObjectDelegate
+{
+ /**
+ * <p>
+ * Makes the remote object <code>target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>source</code> parameter. Connection normally happens implicitly
+ * when the object is sent or received as an argument on a remote method call.
+ * </p>
+ * <p>
+ * The target object is connected to the same ORB as source by calling the
+ * {@link Stub#connect} if it is a stub or by associating its tie with an ORB
+ * if it is an implementation object.
+ * </p>
+ *
+ * @param target the target object that may be either an RMI/IDL stub or an
+ * exported RMI/IDL implementation object
+ * @param source the source object may also be either an RMI/IDL stub or an
+ * exported RMI/IDL implementation object.
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
+ void connect(Remote target, Remote source)
+ throws RemoteException;
+
+ /**
+ * Register the passed object with the ORB runtimes, making it remotely
+ * accessible. When called on jre with no objects exported, creates a
+ * non-daemon thread that prevents jre from terminating until all objects are
+ * unexported. Also, such object cannot be collected by garbage collector.
+ * This is usually impemented via {@link Util#unexportObject}
+ *
+ * @param obj the object to export.
+ *
+ * @throws RemoteException
+ */
+ void exportObject(Remote obj)
+ throws RemoteException;
+
+ /**
+ * Narrows the passed object to conform to the given interface or IDL type.
+ * This method may return different instance and cannot be replaced by the
+ * direct cast.
+ *
+ * @param narrowFrom an object to narrow.
+ * @param narrowTo a type to that the object must be narrowed.
+ *
+ * @return On success, an object of type narrowTo or null, if narrowFrom =
+ * null.
+ *
+ * @throws ClassCastException if no narrowing is possible.
+ */
+ Object narrow(Object narrowFrom, Class narrowTo)
+ throws ClassCastException;
+
+ /**
+ * Takes a server implementation object and returns a stub object that can be
+ * used to access that server object (target). If the target is connected, the
+ * returned stub is also connected to the same ORB. If the target is
+ * unconnected, the returned stub is unconnected.
+ *
+ * @param obj a server side object.
+ * @return a stub object that can be used to access that server object.
+ *
+ * @throws NoSuchObjectException if a stub cannot be located for the given
+ * target.
+ */
+ Remote toStub(Remote obj)
+ throws NoSuchObjectException;
+
+ /**
+ * Deregister a currently exported server object from the ORB runtimes. The
+ * object to becomes available for garbage collection. This is usually
+ * impemented via {@link Util#unexportObject}
+ *
+ * @param obj the object to unexport.
+ *
+ * @throws NoSuchObjectException if the passed object is not currently
+ * exported.
+ */
+ void unexportObject(Remote obj)
+ throws NoSuchObjectException;
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/Stub.java b/libjava/classpath/javax/rmi/CORBA/Stub.java
new file mode 100644
index 000000000..d9b45f77b
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/Stub.java
@@ -0,0 +1,203 @@
+/* Stub.java --
+ Copyright (C) 2004, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import gnu.javax.rmi.CORBA.DelegateFactory;
+import gnu.javax.rmi.CORBA.StubDelegateImpl;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.rmi.RemoteException;
+
+import javax.rmi.PortableRemoteObject;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA_2_3.portable.ObjectImpl;
+
+/**
+ * A Stub descendants provide access to the object on the client side. This base
+ * class implements methods, required for remote or local invocation using CORBA
+ * mechanisms. The most of the functionality is forwarded to the stub delegate.
+ * This delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.StubClass" to the name of the alternative class that must
+ * implement {@link StubDelegate}. Hence Stub contains two delegates, one for
+ * Stub-related operations and another inherited from the ObjectImpl.
+ *
+ * @specnote GNU Classpath uses separate delegate per each Stub. The delegate
+ * holds information about the ORB and other data, specific for the each Stub.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public abstract class Stub
+ extends ObjectImpl
+ implements Serializable
+{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = 1087775603798577179L;
+
+ /**
+ * The hashcode, computed once (expensive operation).
+ */
+ transient int m_hash = Integer.MIN_VALUE;
+
+ /**
+ * The stringified reference, computed once (expensive operation).
+ */
+ transient String m_ior;
+
+ /**
+ * The ORB, where the stub is connected on the client side.
+ */
+ transient ORB m_orb;
+
+ /**
+ * The associated delegate, responsible for the major of the functionality of
+ * this stub.
+ */
+ static StubDelegate delegate = (StubDelegate) DelegateFactory.getInstance(DelegateFactory.STUB);
+
+ /**
+ * Returns the same hashcode for all stubs that point to the same remote
+ * object.
+ */
+ public int hashCode()
+ {
+ if (m_hash == Integer.MIN_VALUE)
+ m_hash = delegate.hashCode(this);
+ // This should finally result to the IOR comparison.
+ return m_hash;
+ }
+
+ /**
+ * The stubs are equal if they point to the same remote object.
+ */
+ public boolean equals(java.lang.Object obj)
+ {
+ return delegate.equals(this, obj);
+ }
+
+ /**
+ * Get the string representation of this Stub.
+ *
+ * @return the CORBA IOR reference.
+ */
+ public String toString()
+ {
+ if (m_ior == null)
+ m_ior = delegate.toString(this);
+ return m_ior;
+ }
+
+ /**
+ * <p>
+ * Finds the suitable {@link Tie} for this Stub and connects it to the given
+ * ORB. The tie is found by the name pattern. If the found tie is derived from
+ * {@link org.omg.CORBA.PortableServer.Servant}, it is connected to the root
+ * POA, also activating it (if not already active).
+ * </p>
+ * <p>
+ * This method does not allow to specify, to which POA the found Tie must be
+ * connected and requires to use the deprecated method {@link ORB#connect}.
+ * Many useful POA features remain unaccessible. A better alternative it might
+ * be to generate a {@link org.omg.CORBA.PortableServer.Servant} - derived Tie
+ * (-poa key in rmic) and connect it to POA in one of the many ways, listed in
+ * the description of the {@link orb.omg.PortableServer} package). The
+ * obtained CORBA object can be narrowed into stub using
+ * {@link PortableRemoteObject#narrow}.
+ * </p>
+ * <p>
+ * It is frequently easier to call {@link PortableRemoteObject#connect} rather
+ * than this method.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ *
+ * @throws BAD_PARAM if the name of this stub does not match the stub name
+ * pattern, "_*_Stub" or if the Tie class, "_*Impl_Tie", does not exists or an
+ * instance of this class cannot be instantiated.
+ */
+ public void connect(ORB orb)
+ throws RemoteException
+ {
+ if (m_orb != null && orb != null)
+ {
+ if (m_orb.equals(orb))
+ throw new RemoteException("Stub " + this
+ + " is connected to another ORB, " + orb);
+ else
+ return;
+ }
+ m_orb = orb;
+ delegate.connect(this, orb);
+ }
+
+ /**
+ * Required by serialized form of Java API doc.
+ */
+ private void readObject(ObjectInputStream input)
+ throws IOException, ClassNotFoundException
+ {
+ if (delegate instanceof StubDelegateImpl)
+ ((StubDelegateImpl) delegate).readObject(this, input, m_orb);
+ else
+ delegate.readObject(this, input);
+ }
+
+ /**
+ * Required by serialized form of Java API doc.
+ */
+ private void writeObject(ObjectOutputStream output)
+ throws IOException
+ {
+ // The m_orb in this case may be either known or not.
+ if (delegate instanceof StubDelegateImpl)
+ ((StubDelegateImpl) delegate).writeObject(this, output, m_orb);
+ else
+
+ delegate.writeObject(this, output);
+ }
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/StubDelegate.java b/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
new file mode 100644
index 000000000..a191eb446
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
@@ -0,0 +1,103 @@
+/* StubDelegate.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import org.omg.CORBA.ORB;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import java.rmi.RemoteException;
+
+/**
+ * A delegate, implementing the functionality, provided by the {@link Stub}.
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.StubClass" to the name of the alternative class that must
+ * implement StubDelegate.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface StubDelegate
+{
+ /**
+ * <p>
+ * Makes the stub ready for remote communication using the given ORB.
+ * </p>
+ * <p>
+ * It is frequently easier to call {@link PortableRemoteObject#connect} rather
+ * than this method.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ */
+ void connect(Stub self, ORB orb)
+ throws RemoteException;
+
+ /**
+ * The objects stubs are equal if they refer the same remote object.
+ */
+ boolean equals(Stub self, Object obj);
+
+ /**
+ * Get the hashcode fo this delegate.
+ */
+ int hashCode(Stub self);
+
+ /**
+ * Read this stub from the object input stream.
+ */
+ void readObject(Stub self, ObjectInputStream s)
+ throws IOException, ClassNotFoundException;
+
+ /**
+ * Write this stub to the object output stream.
+ */
+ void writeObject(Stub self, ObjectOutputStream s)
+ throws IOException;
+
+ /**
+ * Get the string representation of this stub.
+ */
+ String toString(Stub self);
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/Tie.java b/libjava/classpath/javax/rmi/CORBA/Tie.java
new file mode 100644
index 000000000..90a82511e
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/Tie.java
@@ -0,0 +1,125 @@
+/* Tie.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.rmi.CORBA;
+
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.InvokeHandler;
+
+/**
+ * <p>
+ * A Tie serves as a CORBA Servant or implementation base. It is connected to
+ * the ORB on a server side, providing the implementation of the required
+ * functionality. ORB access this implementation using {@link InvokeHandler}
+ * ._invoke(..). All such calls are finally delegated to the object, returned by
+ * {@link #getTarget()}.
+ * </p>
+ * <p>
+ * Ties are generated from implementations (name pattern *Impl) and have the
+ * name pattern _*Impl_Tie, for instance:<br>
+ * <code>rmic -keep -iiop -poa -always gnu.testlet.java.rmi.Remote.CalculatorImpl</code>
+ * </p>
+ * <p>
+ * Ties should normally be derived from the
+ * {@link org.omg.PortableServer.Servant}. Such ties are generated by
+ * <code>rmic</code> compiler using <code>-poa</code> key. Ties can be also
+ * derived from {@link org.omg.CORBA_2_3.portable.ObjectImpl}.
+ * </p>
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface Tie
+ extends InvokeHandler
+{
+ /**
+ * Get the invocation target, where all method calls should be delegated.
+ *
+ * @return the object, implementing methods, defined in the interface being
+ * served by this Tie.
+ */
+ Remote getTarget();
+
+ /**
+ * Set the invocation target, where all method calls should be delegated.
+ *
+ * @param target the object, implementing methods, defined in the interface
+ * being served by this Tie. The code, produced by a typical rmic compiler
+ * usually requires the target to be an instance of the implementation from
+ * that the Tie was generated.
+ *
+ * @throws ClassCastException if the passed parameter is not an instance of
+ * the implementation from that the Tie was generated.
+ */
+ void setTarget(Remote target);
+
+ /**
+ * Get the ORB to that this Tie is connected.
+ *
+ * @see org.omg.PortableServer.Servant#_orb
+ */
+ ORB orb();
+
+ /**
+ * Connect this Tie to the given ORB.
+ */
+ void orb(ORB orb);
+
+ /**
+ * Get the object that delegates calls to this tie.
+ *
+ * @see org.omg.PortableServer.Servant#_this_object()
+ */
+ org.omg.CORBA.Object thisObject();
+
+ /**
+ * Deactivate this Tie. The tie is normally deactivated using POA mechanisms.
+ * Depending on the POA policies, it may be possible to activate the Tie
+ * again. The ties that are not derived from
+ * {@link org.omg.PortableServer.Servant} deactivate themselves by
+ * {@link ORB#disconnect}.
+ *
+ * @throws NoSuchObjectException if there are no objects served by this Tie,
+ * or if the these objects are already deactivated.
+ *
+ * @see org.omg.PortableServer.POAOperations#deactivate_object
+ */
+ void deactivate()
+ throws NoSuchObjectException;
+
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/Util.java b/libjava/classpath/javax/rmi/CORBA/Util.java
new file mode 100644
index 000000000..9c6df60a8
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/Util.java
@@ -0,0 +1,416 @@
+/* Util.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import gnu.javax.rmi.CORBA.DelegateFactory;
+
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
+import java.rmi.server.RMIClassLoader;
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+
+/**
+ * Provides utility methods used by stubs and ties to perform common operations.
+ * The functionality is forwarded to the enclosed UtilDelegate. This delegate
+ * can be altered by setting the system property "javax.rmi.CORBA.UtilClass" to
+ * the name of the alternative class that must implement {@link UtilDelegate}.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class Util
+{
+ /**
+ * The delegate, responsible for all functionality.
+ */
+ static UtilDelegate delegate = (UtilDelegate) DelegateFactory.getInstance(DelegateFactory.UTIL);
+
+ /**
+ * Prevents this class from being instantiated.
+ */
+ private Util()
+ {
+ }
+
+ /**
+ * Used by local stubs to create a copy of the object. The object must be
+ * Serializable for this operation to succeed. Strings are not copied and
+ * 1D-3D string arrays are only cloned.
+ */
+ public static java.lang.Object copyObject(java.lang.Object object, ORB orb)
+ throws RemoteException
+ {
+ return delegate.copyObject(object, orb);
+ }
+
+ /**
+ * Used by local stubs to create a multiple copies of the object, preserving
+ * sharing accross the parameters if necessary.
+ */
+ public static java.lang.Object[] copyObjects(java.lang.Object[] object,
+ ORB orb)
+ throws RemoteException
+ {
+ return delegate.copyObjects(object, orb);
+ }
+
+ /**
+ * Get the value handler that Serializes Java objects to and from CDR (GIOP)
+ * streams.
+ *
+ * When using the default Util implementation, the class of the returned
+ * handler can be altered by setting by setting the system property
+ * "javax.rmi.CORBA.ValueHandlerClass" to the name of the alternative class
+ * that must implement {@link ValueHandler}.
+ */
+ public static ValueHandler createValueHandler()
+ {
+ return delegate.createValueHandler();
+ }
+
+ /**
+ * This call is finally delegated to {@link RMIClassLoader#getClassAnnotation};
+ */
+ public static String getCodebase(Class clz)
+ {
+ return delegate.getCodebase(clz);
+ }
+
+ /**
+ * Get the Tie that handles invocations on the given target. If the target/Tie
+ * pair has not been previously registered using {@link #registerTarget},
+ * this method tries to locate a tie class by the name pattern. If this
+ * succeeds, the tie-target pair is also registered.
+ *
+ * @return the Tie.
+ */
+ public static Tie getTie(Remote target)
+ {
+ return delegate.getTie(target);
+ }
+
+ /**
+ * Checks if the given stub is local. The implementation it delegates call to
+ * {@link ObjectImpl#_is_local().
+ *
+ * @param stub a stub to check.
+ * @return true if the stub is local, false otherwise.
+ *
+ * @throws RemoteException if the {@link ObjectImpl#_is_local()} throws a
+ * {@link org.omg.CORBA.SystemException}.
+ */
+ public static boolean isLocal(Stub stub)
+ throws RemoteException
+ {
+ return delegate.isLocal(stub);
+ }
+
+ /**
+ * Load the class. The method uses class loaders from the call stact first. If
+ * this fails, the further behaviour depends on the System Property
+ * "java.rmi.server.useCodebaseOnly" with default value "false".
+ *
+ * <ul>
+ * <li>If remoteCodebase is non-null and useCodebaseOnly is "false" then call
+ * java.rmi.server.RMIClassLoader.loadClass (remoteCodebase, className)</li>
+ * <li> If remoteCodebase is null or useCodebaseOnly is true then call
+ * java.rmi.server.RMIClassLoader.loadClass(className)</li>
+ * <li>If a class is still not successfully loaded and the loader != null
+ * then try Class.forName(className, false, loader). </li>
+ * </ul>
+ *
+ * @param className the name of the class.
+ * @param remoteCodebase the codebase.
+ * @param loader the class loader.
+ * @return the loaded class.
+ *
+ * @throws ClassNotFoundException of the class cannot be loaded.
+ */
+ public static Class loadClass(String className, String remoteCodebase,
+ ClassLoader loader)
+ throws ClassNotFoundException
+ {
+ return delegate.loadClass(className, remoteCodebase, loader);
+ }
+
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * The subsequent content is not part of the official RMI-IIOP standart and is
+ * added for compatibility with Sun's implementation:
+ * <ol>
+ * <li>the phrase "<code>; nested exception is: <i>(line feed)(tab)</i></code>"</li>
+ * <li>the full name of the mapped SystemException, as returned by
+ * Class.getName().</li>
+ * <li>the ": ".
+ * <li>the value, returned by .getMessage() of the passed parameter.</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p><p>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p><p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
+ public static RemoteException mapSystemException(SystemException ex)
+ {
+ return delegate.mapSystemException(ex);
+ }
+
+ /**
+ * Register the Tie-target pair. As the Tie is a Servant, it can potentially
+ * be connected to several objects and hence may be registered with several
+ * targets.
+ */
+ public static void registerTarget(Tie tie, Remote target)
+ {
+ delegate.registerTarget(tie, target);
+ }
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets. Independing from the POA policies, the transparent
+ * reactivation will not be possible.
+ */
+ public static void unexportObject(Remote target)
+ throws NoSuchObjectException
+ {
+ delegate.unexportObject(target);
+ }
+
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param exception an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
+ public static RemoteException wrapException(Throwable exception)
+ {
+ return delegate.wrapException(exception);
+ }
+
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ public static void writeAbstractObject(OutputStream output,
+ java.lang.Object object)
+ {
+ delegate.writeAbstractObject(output, object);
+ }
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ public static void writeAny(OutputStream output, java.lang.Object object)
+ {
+ delegate.writeAny(output, object);
+ }
+
+ /**
+ * Read Any from the input stream.
+ */
+ public static java.lang.Object readAny(InputStream input)
+ {
+ return delegate.readAny(input);
+ }
+
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible (the ORB is started and activated, if required). This method is
+ * used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public static void writeRemoteObject(OutputStream output,
+ java.lang.Object object)
+ {
+ delegate.writeRemoteObject(output, object);
+ }
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
new file mode 100644
index 000000000..2454f5348
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
@@ -0,0 +1,310 @@
+/* UtilDelegate.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+
+/**
+ * A delegate, implementing the functionality, provided by the {@link Util}.
+ *
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.UtilClass" to the name of the alternative class that must
+ * implement this interface.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface UtilDelegate
+{
+ /**
+ * Used by local stubs to create a copy of the object.
+ */
+ Object copyObject(Object obj, ORB orb)
+ throws RemoteException;
+
+ /**
+ * Used by local stubs to create a multiple copies of the object, preserving
+ * sharing accross the parameters if necessary.
+ */
+ Object[] copyObjects(Object[] obj, ORB orb)
+ throws RemoteException;
+
+ /**
+ * Get the value handler that Serializes Java objects to and from CDR (GIOP)
+ * streams.
+ */
+ ValueHandler createValueHandler();
+
+ String getCodebase(Class clz);
+
+ /**
+ * Checks if the given stub is local.
+ */
+ boolean isLocal(Stub stub)
+ throws RemoteException;
+
+ Class loadClass(String className, String remoteCodebase, ClassLoader loader)
+ throws ClassNotFoundException;
+
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * The subsequent content is not part of the official RMI-IIOP standart and is
+ * added for compatibility with Sun's implementation:
+ * <ol>
+ * <li>the phrase "<code>; nested exception is: <i>(line feed)(tab)</i></code>"</li>
+ * <li>the full name of the mapped SystemException, as returned by
+ * Class.getName().</li>
+ * <li>the ": ".
+ * <li>the value, returned by .getMessage() of the passed parameter.</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p><p>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p><p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
+ RemoteException mapSystemException(SystemException ex);
+
+ /**
+ * Get the Tie that handles invocations on the given target. The target/Tie
+ * pair must be previously registered using {@link #registerTarget}.
+ *
+ * @return the Tie, or null if no such is known.
+ */
+ Tie getTie(Remote target);
+
+ /**
+ * Register the Tie-target pair.
+ */
+ void registerTarget(Tie tie, Remote target);
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets.
+ */
+ void unexportObject(Remote target)
+ throws NoSuchObjectException;
+
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param e an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
+ RemoteException wrapException(Throwable orig);
+
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible. This method is used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param obj an object to write.
+ */
+ void writeRemoteObject(OutputStream output, Object obj);
+
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ void writeAbstractObject(OutputStream output, Object object);
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ void writeAny(OutputStream output, Object object);
+
+ /**
+ * Read Any from the input stream.
+ */
+ Object readAny(InputStream input);
+
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/ValueHandler.java b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
new file mode 100644
index 000000000..cc855b808
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
@@ -0,0 +1,130 @@
+/* ValueHandler.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import java.io.Serializable;
+
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.SendingContext.RunTime;
+
+/**
+ * Serializes Java objects to and from CDR (GIOP) streams. The working instance
+ * of the value handler is returned by {@link Util#createValueHandler} and can
+ * be altered by setting the system property "javax.rmi.CORBA.ValueHandlerClass"
+ * to the name of the alternative class that must implement ValueHandler.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface ValueHandler
+{
+ /**
+ * Get CORBA repository Id for the given java class.
+ *
+ * The syntax of the repository ID is the initial ?RMI:?, followed by the Java
+ * class name, followed by name, followed by a hash code string, followed
+ * optionally by a serialization version UID string.
+ *
+ * For Java identifiers that contain illegal OMG IDL identifier characters
+ * such as ?$?, any such illegal characters are replaced by ?\U? followed by
+ * the 4 hexadecimal characters (in upper case) representing the Unicode
+ * value.
+ *
+ * @param clz a class for that the repository Id is required.
+ *
+ * @return the class repository id.
+ */
+ String getRMIRepositoryID(Class clz);
+
+ /**
+ * Returns the CodeBase for this ValueHandler.
+ *
+ * @return the codebase.
+ */
+ RunTime getRunTimeCodeBase();
+
+ /**
+ * Indicates that the given class is responsible itself for writing its
+ * content to the stream. Such classes implement either {@link Streamable}
+ * (default marshalling, generated by IDL-to-java compiler) or
+ * {@link CustomMarshal} (the user-programmed marshalling).
+ *
+ * @param clz the class being checked.
+ * @return true if the class supports custom or default marshalling, false
+ * otherwise.
+ */
+ boolean isCustomMarshaled(Class clz);
+
+ /**
+ * Read value from the CORBA input stream in the case when the value is not
+ * Streamable or CustomMarshall'ed. The fields of the class being written will
+ * be accessed using reflection.
+ *
+ * @param in a CORBA stream to read.
+ * @param offset the current position in the input stream.
+ * @param clz the type of value being read.
+ * @param repositoryID the repository Id of the value being read.
+ * @param sender the sending context that should provide data about the
+ * message originator.
+ *
+ * @return the object, extracted from the stream.
+ */
+ Serializable readValue(InputStream in, int offset, Class clz,
+ String repositoryID, RunTime sender);
+
+ /**
+ * When the value provides the writeReplace method, the result of this method
+ * is written. Otherwise, the value itself is written.
+ *
+ * @param value the value that should be written to the stream.
+ *
+ * @return the value that will be actually written to the stream.
+ */
+ Serializable writeReplace(Serializable value);
+
+ /**
+ * Write value to CORBA output stream using java senmatics.
+ *
+ * @param out a stream to write into.
+ * @param value a java object to write.
+ */
+ void writeValue(OutputStream out, Serializable value);
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java b/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java
new file mode 100644
index 000000000..6bc6ad0af
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java
@@ -0,0 +1,94 @@
+/* ValueHandlerMultiFormat.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+
+/**
+ * This interface extends the previous ValueHandler, supporting various stream
+ * format versions. The {@link ValueHandler} can be casted into this interface
+ * to access additional features.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ValueHandlerMultiFormat
+ extends ValueHandler
+{
+ /**
+ * Get the maximal supported version for the value types, supported by
+ * this value handler. The versions are integer numbers, the currently valid
+ * values being 1 and 2.
+ *
+ * These two versions differ in how the additional data, stored by the
+ * writeObject method, are encoded.
+ * <ul>
+ * <li> For version 1 (GNU Classpath default), that data (if present) are
+ * written "as is". </li>
+ * <li>For version 2, this data fragment is enclosed within a CDR custom
+ * valuetype with no codebase and repository Id "RMI:org.omg.custom.<class>"
+ * where <class> is the fully-qualified name of the class whose writeObject
+ * method is being invoked. If the object does not write any data via
+ * writeObject method, the null valuetype (0x0) must be written.</li>
+ * </ul>
+ * As the version number is part of the value type record, there is no need
+ * to the format control during the reading.
+ *
+ * @return the maximal supported version.
+ */
+ byte getMaximumStreamFormatVersion();
+
+ /**
+ * Write the value type to the output stream using the given format version.
+ * The older method {@link ValueHandler#writeValue} always uses the version 1.
+ *
+ * @param output the stream, where the value should be written, must implement
+ * {@link ValueOutputStream}.
+ * @param value the value that should be written.
+ * @param version the version of the format that must be used to write the
+ * value.
+ *
+ * @throws BAD_PARAM if the version number is less than 1 or greater than the
+ * maximal supported version.
+ */
+ void writeValue(OutputStream output, Serializable value, byte version);
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/package.html b/libjava/classpath/javax/rmi/CORBA/package.html
new file mode 100644
index 000000000..6014c8c85
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/package.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.rmi package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.rmi.CORBA</title></head>
+
+<body>
+<p>
+Java RMI over IIOP combines RMI technology with CORBA technology. Like plain RMI,
+RMI over IIOP allows to work completely in the Java programming language
+(no IDL). When CORBA needs a separate helper class for each structure being
+passed, RMI over IIOP only needs stubs and ties for the objects that are remotely
+accessible. As a result, development with RMI-IIOP is easier. However the
+specialised pure CORBA helpers needs no reflection to transfer they structures
+and hence may be faster than methods, used by both RMI-IIOP and plain RMI.
+</p><p>
+Like RMI, RMI over IIOP provides flexibility by allowing to pass any serializable
+Java object (Objects By Value) between application components. A certain
+"imaginary IDL" is automatically supposed; this IDL can be explicitly generated
+and later used to interoperate with non-java application.
+</p><p>
+Like CORBA, RMI over IIOP is based on open standards defined with the
+participation of hundredsof vendors and users in the OMG. It uses IIOP
+communication protocol that provides much better interoperability with other
+programming languages.
+</p><p>
+With RMI/IIOP you can use advanced CORBA features: multiple objects per servant
+and servants per object, servant activators and locators, servant, client and
+ior interceptors, CORBA naming service, various ORB policies, stringified object
+references and so on. This functionality is based on CORBA value type standard.
+RMI/IIOP supports (and GNU Classpath implements) transferring of the arbitrary
+connected object graphs (graph flattenning).
+</p><p>
+GNU Classpath RMI-IIOP functionality is implemented as described in
+OMG formal/03-09-04 (IDL to Java mapping v1.3). Value types are written as
+described in formal/04-03-12 (CORBA 3.0.3).
+</p>
+@author Wu Gansha (gansha.wu@intel.com), headers.
+@author Audrius Meskauskas (AudriusA@Bioinformatics.org), implementation.
+</body>
+</html>
diff --git a/libjava/classpath/javax/rmi/PortableRemoteObject.java b/libjava/classpath/javax/rmi/PortableRemoteObject.java
new file mode 100644
index 000000000..aa7e530ec
--- /dev/null
+++ b/libjava/classpath/javax/rmi/PortableRemoteObject.java
@@ -0,0 +1,228 @@
+/* PortableRemoteObject.java --
+ Copyright (C) 2004, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi;
+
+import gnu.javax.rmi.CORBA.DelegateFactory;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.rmi.CORBA.PortableRemoteObjectDelegate;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+
+/**
+ * <p>
+ * An utility class for RMI/IDL server side object implementations. Server side
+ * implementation objects may inherit from this class, but this is not
+ * mandatory, as the needed methds are static. Server side implementations may
+ * choose to inherit from {@link ObjectImpl} or {@link Servant} instead.
+ * </p>
+ * <p>
+ * The functionality of methods in this class is forwarded to the enclosed
+ * PortableRemoteObjectDelegate. This delegate can be altered by setting the
+ * system property "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of
+ * the alternative class that must implement
+ * {@link PortableRemoteObjectDelegate}.
+ * </p>
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class PortableRemoteObject
+{
+ /**
+ * A delegate where the functionality is forwarded.
+ */
+ static PortableRemoteObjectDelegate delegate = (PortableRemoteObjectDelegate) DelegateFactory.getInstance(DelegateFactory.PORTABLE_REMOTE_OBJECT);
+
+ /**
+ * The protected constructor calls {@link exportObject} (this).
+ *
+ * @throws RemoteException if the exportObject(this) throws one.
+ */
+ protected PortableRemoteObject()
+ throws RemoteException
+ {
+ exportObject((Remote) this);
+ }
+
+ /**
+ * <p>
+ * Makes the remote object <code>a_target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>a_source</code> parameter. The a_target is connected to the same
+ * ORB (and, if applicable, to the same {@link POA}) as the a_source.
+ *
+ * @param target the target to connect to ORB, must be an instance of either
+ * {@link ObjectImpl} (Stubs and old-style ties) or {@link Tie}.
+ *
+ * @param source the object, providing the connection information, must be
+ * an instance of either {@link ObjectImpl} (Stubs and old-style ties) or
+ * {@link Servant} (the next-generation Ties supporting {@link POA}).
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
+ public static void connect(Remote target, Remote source)
+ throws RemoteException
+ {
+ delegate.connect(target, source);
+ }
+
+ /**
+ * <p>
+ * Makes a server object ready for remote calls. The subclasses of
+ * PortableRemoteObject do not need to call this method, as it is called by
+ * the constructor.
+ * </p>
+ * <p>
+ * This method only creates a tie object and caches it for future usage. The
+ * created tie does not have a delegate or an ORB associated.
+ * </p>
+ *
+ * @param object the object to export.
+ *
+ * @throws RemoteException if export fails due any reason.
+ */
+ public static void exportObject(Remote object)
+ throws RemoteException
+ {
+ delegate.exportObject(object);
+ }
+
+ /**
+ * Narrows the passed object to conform to the given interface or IDL type. In
+ * RMI-IIOP, this method replaces the narrow(org.omg.CORBA.Object) method that
+ * was present in the CORBA Helpers. This method frequently returns different
+ * instance and cannot be replaced by the direct cast. The typical narrowing
+ * cases (all supported by GNU Classpath) are:
+ * <ul>
+ * <li>A CORBA object (for instance, returned by the
+ * {@link ORB#string_to_object} or from the naming service) can be narrowed
+ * into interface, derived from Remote. The method will try to locate an
+ * appropriate {@link Stub} by the name pattern (_*_Stub). If the object being
+ * narrowed is connected to an ORB, the returned instance will inherit that
+ * connection, representing the same remote (or local) object, but now with
+ * the possibility to invoke remote methods. </li>
+ * <li>A CORBA object may be directly narrowed into the appropriate
+ * {@link Stub} class, if it is and passed as a second parameter. This allows
+ * to use non-standard stubs without parameterless constructors.</li>
+ * <li>Any two classes, derived from the {@link ObjectImpl} (may be Stub's)
+ * can be narrowed one into another (a delegate is transferred). </li>
+ * <li>An implementation of Remote can be narrowed into {@link Tie} that can
+ * later connected to an ORB, making the methods accessible remotely. The
+ * Remote being narrowed normally provides a local implementation, but you can
+ * also narrow remote Stub, creating "forwarding Tie".</li>
+ * <li>null is narrowed into null regardless of the second parameter.</li>
+ * <li>A {@link Tie} can be narrowed into Remote, representing the
+ * implementation for this Tie (if one is set).</li>
+ * </ul>
+ *
+ * @param object the object like CORBA Object, Stub or Remote that must be
+ * narrowed to the given interface.
+ *
+ * @param narrowToInstaceOf the class of the interface to that the object must
+ * be narrowed.
+ *
+ * @return On success, an object of type narrowTo or null, if narrowFrom =
+ * null.
+ *
+ * @throws ClassCastException if no narrowing is possible.
+ */
+ public static Object narrow(Object object, Class narrowToInstaceOf)
+ throws ClassCastException
+ {
+ return delegate.narrow(object, narrowToInstaceOf);
+ }
+
+ /**
+ * <p>
+ * Takes a server implementation object (name pattern *imp) and returns a stub
+ * object that can be used to access that server object (target), name
+ * (pattern _*_Stub).
+ *
+ * The returned stub is not connected to any ORB and must be explicitly
+ * connected using {@link #connect}.
+ * </p>
+ * <p>
+ * The method signature prevents it from returning stubs that does not
+ * implement Remote (ClassCastException will be thrown).
+ * </p>
+ *
+ * @param target a server side object implementation.
+ * @return a stub object that can be used to access that server object.
+ *
+ * @throws NoSuchObjectException if a stub class cannot be located by supposed
+ * name pattern, or an instance of stub fails to be instantiated.
+ *
+ * @throws ClassCastException if the stub class can be located, but it does
+ * not inherit from Remote.
+ *
+ * @throws BAD_PARAM if the name of the passed class does not match the
+ * implementation name pattern (does not end by 'Impl').
+ */
+ public static Remote toStub(Remote targetImpl)
+ throws NoSuchObjectException
+ {
+ return delegate.toStub(targetImpl);
+ }
+
+ /**
+ * Deregister a currently exported server object from the ORB runtimes. The
+ * object to becomes available for garbage collection. This is usually
+ * impemented via {@link Util#unexportObject}
+ *
+ * @param object the object to unexport.
+ *
+ * @throws NoSuchObjectException if the passed object is not currently
+ * exported.
+ */
+ public static void unexportObject(Remote object)
+ throws NoSuchObjectException
+ {
+ delegate.unexportObject(object);
+ }
+}
diff --git a/libjava/classpath/javax/rmi/package.html b/libjava/classpath/javax/rmi/package.html
new file mode 100644
index 000000000..6014c8c85
--- /dev/null
+++ b/libjava/classpath/javax/rmi/package.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.rmi package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.rmi.CORBA</title></head>
+
+<body>
+<p>
+Java RMI over IIOP combines RMI technology with CORBA technology. Like plain RMI,
+RMI over IIOP allows to work completely in the Java programming language
+(no IDL). When CORBA needs a separate helper class for each structure being
+passed, RMI over IIOP only needs stubs and ties for the objects that are remotely
+accessible. As a result, development with RMI-IIOP is easier. However the
+specialised pure CORBA helpers needs no reflection to transfer they structures
+and hence may be faster than methods, used by both RMI-IIOP and plain RMI.
+</p><p>
+Like RMI, RMI over IIOP provides flexibility by allowing to pass any serializable
+Java object (Objects By Value) between application components. A certain
+"imaginary IDL" is automatically supposed; this IDL can be explicitly generated
+and later used to interoperate with non-java application.
+</p><p>
+Like CORBA, RMI over IIOP is based on open standards defined with the
+participation of hundredsof vendors and users in the OMG. It uses IIOP
+communication protocol that provides much better interoperability with other
+programming languages.
+</p><p>
+With RMI/IIOP you can use advanced CORBA features: multiple objects per servant
+and servants per object, servant activators and locators, servant, client and
+ior interceptors, CORBA naming service, various ORB policies, stringified object
+references and so on. This functionality is based on CORBA value type standard.
+RMI/IIOP supports (and GNU Classpath implements) transferring of the arbitrary
+connected object graphs (graph flattenning).
+</p><p>
+GNU Classpath RMI-IIOP functionality is implemented as described in
+OMG formal/03-09-04 (IDL to Java mapping v1.3). Value types are written as
+described in formal/04-03-12 (CORBA 3.0.3).
+</p>
+@author Wu Gansha (gansha.wu@intel.com), headers.
+@author Audrius Meskauskas (AudriusA@Bioinformatics.org), implementation.
+</body>
+</html>
diff --git a/libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java b/libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java
new file mode 100644
index 000000000..122264514
--- /dev/null
+++ b/libjava/classpath/javax/rmi/ssl/SslRMIClientSocketFactory.java
@@ -0,0 +1,168 @@
+/* SslRMIClientSocketFactory.java --
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.rmi.ssl;
+
+import java.io.IOException;
+import java.io.Serializable;
+
+import java.util.StringTokenizer;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.SSLSocket;
+import java.net.Socket;
+import java.rmi.server.RMIClientSocketFactory;
+
+/**
+ * SslRMIClientSocketFactory
+ *
+ * This class implements an RMIClientSocketFactory for SSL sockets.
+ * it uses the default SSLClientSocketFactory.
+ *
+ * This class can optionally use the following system properties, if set:
+ * <code>javax.rmi.ssl.client.enabledCipherSuites</code>
+ * <code>javax.rmi.ssl.client.enabledProtocols</code>
+ *
+ * These properties will specify a list of SSL/TLS cipher suites and protocols,
+ * respectively, to enable on the created sockets.
+ *
+ * Both properties should consist of a comma-separated list.
+ *
+ * @author Sven de Marothy
+ * @since 1.5
+ */
+public class SslRMIClientSocketFactory
+ implements RMIClientSocketFactory, Serializable
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = -8310631444933958385L;
+
+ private String[] enabledCipherSuites, enabledProtocols;
+
+ /**
+ * The SSL Socket factory.
+ */
+ private static SSLSocketFactory socketFactory =
+ (SSLSocketFactory)SSLSocketFactory.getDefault();
+
+ /**
+ * Creates a new SslRMIClientSocketFactory
+ */
+ public SslRMIClientSocketFactory()
+ {
+ enabledCipherSuites = getProp("javax.rmi.ssl.client.enabledCipherSuites");
+ enabledProtocols = getProp("javax.rmi.ssl.client.enabledProtocols");
+ }
+
+ private String[] getProp(String p)
+ {
+ String o;
+ try
+ {
+ o = System.getProperty(p);
+ }
+ catch(SecurityException se)
+ {
+ return null;
+ }
+
+ if (o == null)
+ return null;
+ StringTokenizer st = new StringTokenizer( o, "," );
+ int n = st.countTokens();
+ if( n < 1 )
+ return null;
+ String[] strs = new String[ n ];
+ for( int i = 0; i < n; i++ )
+ strs[i] = st.nextToken().trim();
+
+ return strs;
+ }
+
+ /**
+ * Creates an SSLSocket on a given port
+ *
+ * @throws IOException if an error occurs on socket creation.
+ */
+ public Socket createSocket(String host, int port) throws IOException
+ {
+ SSLSocket socket = (SSLSocket)socketFactory.
+ createSocket( host, port );
+ if( enabledCipherSuites != null )
+ socket.setEnabledCipherSuites( enabledCipherSuites );
+ if( enabledProtocols != null )
+ socket.setEnabledProtocols( enabledProtocols );
+ return socket;
+ }
+
+ /**
+ * Compare two SslRMIServerSocketFactor instances
+ */
+ public boolean equals(Object obj)
+ {
+ if( !(obj instanceof SslRMIClientSocketFactory) )
+ return false;
+ SslRMIClientSocketFactory s = (SslRMIClientSocketFactory)obj;
+
+ if(!SslRMIServerSocketFactory.
+ cmpStrArray(enabledCipherSuites, s.enabledCipherSuites))
+ return false;
+
+ if(!SslRMIServerSocketFactory.
+ cmpStrArray(enabledProtocols, s.enabledProtocols))
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Returns the hash code of this object.
+ */
+ public int hashCode()
+ {
+ int hash = 0;
+ if( enabledCipherSuites != null )
+ for(int i = 0; i < enabledCipherSuites.length; i++ )
+ hash = hash ^ enabledCipherSuites[i].hashCode();
+ if( enabledProtocols != null )
+ for(int i = 0; i < enabledProtocols.length; i++ )
+ hash = hash ^ enabledProtocols[i].hashCode();
+ return hash;
+ }
+}
diff --git a/libjava/classpath/javax/rmi/ssl/SslRMIServerSocketFactory.java b/libjava/classpath/javax/rmi/ssl/SslRMIServerSocketFactory.java
new file mode 100644
index 000000000..d5c5398be
--- /dev/null
+++ b/libjava/classpath/javax/rmi/ssl/SslRMIServerSocketFactory.java
@@ -0,0 +1,213 @@
+/* SslRMIServerSocketFactory.java --
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.rmi.ssl;
+
+import java.io.IOException;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLServerSocket;
+import java.net.ServerSocket;
+import java.rmi.server.RMIServerSocketFactory;
+
+/**
+ * SslRMIServerSocketFactory
+ *
+ * This class implements an RMIServerSocketFactory for SSL sockets.
+ * it uses the defeult SSLServerSocketFactory.
+ *
+ * @author Sven de Marothy
+ * @since 1.5
+ */
+public class SslRMIServerSocketFactory implements RMIServerSocketFactory
+{
+ private String[] enabledCipherSuites, enabledProtocols;
+ private boolean needClientAuth;
+
+ /**
+ * The SSL ServerSocket factory.
+ */
+ private static SSLServerSocketFactory socketFactory =
+ (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
+
+ /**
+ * Creates a new SslRMIServerSocketFactory with the default socket
+ * cipher suites and protocols, and without requiring client authorisation.
+ */
+ public SslRMIServerSocketFactory()
+ {
+ enabledCipherSuites = enabledProtocols = null;
+ needClientAuth = false;
+ }
+
+ /**
+ * Creates a new SslRMIServerSocketFactory with a given set of socket
+ * cipher suites and protocols. needClientAuth specifies if client
+ * authorization is required.
+ *
+ * @param enabledCipherSuites - the cypher suites to enable
+ * or <code>null</code> for the defauls.
+ * @param enabledCipherSuites - the protocols to enable,
+ * or <code>null</code> for the defauls.
+ * @param needClientAuth - specify client authorization requirement.
+ * @throws IllegalArgumentException if any of the ciphers or protocols
+ * specified are not available.
+ */
+ public SslRMIServerSocketFactory(String[] enabledCipherSuites,
+ String[] enabledProtocols,
+ boolean needClientAuth)
+ {
+ this.enabledCipherSuites = enabledCipherSuites;
+ this.enabledProtocols = enabledProtocols;
+ this.needClientAuth = needClientAuth;
+ try
+ {
+ if( enabledProtocols != null || enabledCipherSuites != null )
+ createServerSocket( 0 ); // stupid way to test the parameters
+ }
+ catch(IOException e)
+ {
+ // Can this happen? FIXME.
+ throw new IllegalArgumentException();
+ }
+ }
+
+ /**
+ * Creates an SSLServerSocket on a given port
+ *
+ * @throws IOException if an error occurs on socket creation.
+ */
+ public ServerSocket createServerSocket(int port) throws IOException
+ {
+ SSLServerSocket socket = (SSLServerSocket)socketFactory.
+ createServerSocket( port );
+ if( enabledCipherSuites != null )
+ socket.setEnabledCipherSuites( enabledCipherSuites );
+ if( enabledProtocols != null )
+ socket.setEnabledProtocols( enabledProtocols );
+ socket.setNeedClientAuth( needClientAuth );
+ return socket;
+ }
+
+ /**
+ * Compare two SslRMIServerSocketFactor instances
+ */
+ public boolean equals(Object obj)
+ {
+ if( !(obj instanceof SslRMIServerSocketFactory) )
+ return false;
+ SslRMIServerSocketFactory s = (SslRMIServerSocketFactory)obj;
+ if( needClientAuth != s.needClientAuth )
+ return false;
+
+ if(!cmpStrArray(enabledCipherSuites, s.enabledCipherSuites))
+ return false;
+
+ if(!cmpStrArray(enabledProtocols, s.enabledProtocols))
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Compare two string arrays.
+ */
+ static boolean cmpStrArray(String[] a, String[] b)
+ {
+ if( ( a == null || b == null ) && a != b )
+ return false;
+
+ if( a != null )
+ {
+ if( a.length != b.length )
+ return false;
+ for( int i = 0; i < a.length; i++ )
+ if(!a[i].equals(b[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns the enabled cipher suites, or <code>null</code>
+ * if the defaults are to be used.
+ * @returns a string array of cipher suite names
+ */
+ public String[] getEnabledCipherSuites()
+ {
+ if( enabledCipherSuites == null )
+ return null;
+ return (String[])enabledCipherSuites.clone();
+ }
+
+ /**
+ * Returns the enabled protocols, or <code>null</code> if the defaults are
+ * to be used.
+ *
+ * @returns a string array of protocol names
+ */
+ public String[] getEnabledProtocols()
+ {
+ if( enabledProtocols == null )
+ return null;
+ return (String[])enabledProtocols.clone();
+ }
+
+ /**
+ * Returns whether client authorization is needed.
+ */
+ public boolean getNeedClientAuth()
+ {
+ return needClientAuth;
+ }
+
+ /**
+ * Returns the hash code of this object.
+ */
+ public int hashCode()
+ {
+ int hash = 0;
+ if( enabledCipherSuites != null )
+ for(int i = 0; i < enabledCipherSuites.length; i++ )
+ hash = hash ^ enabledCipherSuites[i].hashCode();
+ if( enabledProtocols != null )
+ for(int i = 0; i < enabledProtocols.length; i++ )
+ hash = hash ^ enabledProtocols[i].hashCode();
+ hash = ( needClientAuth ) ? (hash^0xFFFF) : hash;
+ return hash;
+ }
+}