public static com.sun.corba.se.impl.ior.StubIORImpl | connect(com.sun.corba.se.impl.ior.StubIORImpl ior, org.omg.CORBA.Object proxy, org.omg.CORBA.portable.ObjectImpl stub, org.omg.CORBA.ORB orb)Connect the stub to the orb if necessary.
Delegate del = null ;
try {
try {
del = StubAdapter.getDelegate( stub );
if (del.orb(stub) != orb)
throw wrapper.connectWrongOrb() ;
} catch (org.omg.CORBA.BAD_OPERATION err) {
if (ior == null) {
// No IOR, can we get a Tie for this stub?
Tie tie = (javax.rmi.CORBA.Tie) Utility.getAndForgetTie(proxy);
if (tie == null)
throw wrapper.connectNoTie() ;
// Is the tie already connected? If it is, check that it's
// connected to the same ORB, otherwise connect it.
ORB existingOrb = orb ;
try {
existingOrb = tie.orb();
} catch (BAD_OPERATION exc) {
// Thrown when tie is an ObjectImpl and its delegate is not set.
tie.orb(orb);
} catch (BAD_INV_ORDER exc) {
// Thrown when tie is a Servant and its delegate is not set.
tie.orb(orb);
}
if (existingOrb != orb)
throw wrapper.connectTieWrongOrb() ;
// Get the delegate for the stub from the tie.
del = StubAdapter.getDelegate( tie ) ;
ObjectImpl objref = new CORBAObjectImpl() ;
objref._set_delegate( del ) ;
ior = new StubIORImpl( objref ) ;
} else {
// ior is initialized, so convert ior to an object, extract
// the delegate, and set it on ourself
del = ior.getDelegate( orb ) ;
}
StubAdapter.setDelegate( stub, del ) ;
}
} catch (SystemException exc) {
throw new RemoteException("CORBA SystemException", exc );
}
return ior ;
|