gnu.javax.rmi.CORBA

Class StubDelegateImpl

Implemented Interfaces:
StubDelegate

public class StubDelegateImpl
extends Object
implements StubDelegate

The default stub delegate.

Method Summary

void
connect(Stub self, ORB orb)
Finds the suitable Tie for this Stub and connects it to the given ORB.
static void
connect(Stub self, ORB orb, POA poa)
Connect when the POA is specified.
boolean
equals(Stub self, Object obj)
Compare two stubs for equality.
static Tie
getTieFromStub(Object self)
Locate a tie class, appropriate to the given stub class, by the name pattern.
int
hashCode(Stub self)
Get the hash code (from IOR reference).
void
readObject(Stub self, ObjectInputStream input)
This should never be called.
void
readObject(Stub self, ObjectInputStream input, ORB orb)
Read as CORBA object when the ORB is known.
String
toString(Stub self)
Returns the IOR reference of the connected ORB.
void
writeObject(Stub self, ObjectOutputStream output)
Write as CORBA object.
void
writeObject(Stub self, ObjectOutputStream output, ORB orb)
Write as CORBA object.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

connect

public void connect(Stub self,
                    ORB orb)
            throws RemoteException
Finds the suitable 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 org.omg.CORBA.PortableServer.Servant, it is connected to the root POA, also activating it (if not already active).

This method does not allow to specify, to which POA the found Tie must be connected and requires to use the deprecated method ORB.connect(Object). Many useful POA features remain unaccessible. A better alternative it might be to generate a 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 orb.omg.PortableServer package). The obtained CORBA object can be narrowed into stub using PortableRemoteObject.narrow(Object,Class).

Specified by:
connect in interface StubDelegate
Parameters:
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.
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.

connect

public static void connect(Stub self,
                           ORB orb,
                           POA poa)
            throws RemoteException
Connect when the POA is specified.

equals

public boolean equals(Stub self,
                      Object obj)
Compare two stubs for equality.
Specified by:
equals in interface StubDelegate

getTieFromStub

public static Tie getTieFromStub(Object self)
Locate a tie class, appropriate to the given stub class, by the name pattern.

hashCode

public int hashCode(Stub self)
Get the hash code (from IOR reference).
Specified by:
hashCode in interface StubDelegate

readObject

public void readObject(Stub self,
                       ObjectInputStream input)
            throws IOException,
                   ClassNotFoundException
This should never be called. The ORB must be supplied.
Specified by:
readObject in interface StubDelegate
See Also:
connect

readObject

public void readObject(Stub self,
                       ObjectInputStream input,
                       ORB orb)
            throws IOException,
                   ClassNotFoundException
Read as CORBA object when the ORB is known. The ORB must be set under the previous call of Stub.connect. The Stub is automatically registered with this ORB.

toString

public String toString(Stub self)
Returns the IOR reference of the connected ORB.
Specified by:
toString in interface StubDelegate
See Also:
ORB.object_to_string(org.omg.CORBA.Object);

writeObject

public void writeObject(Stub self,
                        ObjectOutputStream output)
            throws IOException
Write as CORBA object. The ORB is taken from the org.omg.CORBA.portable.Delegate. The Stub is automatically registered with this ORB (if not already done).
Specified by:
writeObject in interface StubDelegate

writeObject

public void writeObject(Stub self,
                        ObjectOutputStream output,
                        ORB orb)
            throws IOException
Write as CORBA object. The ORB must be either set under the previous call of Stub.connect or it is taken from the org.omg.CORBA.portable.Delegate. The Stub is automatically registered with this ORB (if not already done).

StubDelegateImpl.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.