public java.lang.Object | getStateToBind(java.lang.Object orig, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable env)Returns the CORBA object for a Remote object.
If input is not a Remote object, or if Remote object uses JRMP, return null.
If the RMI-IIOP library is not available, throw ConfigurationException.
if (orig instanceof org.omg.CORBA.Object)
return orig ;
if (!(orig instanceof Remote))
// Not for this StateFactory
return null ;
ORB orb = getORB( ctx ) ;
if (orb == null)
// Wrong kind of context, so just give up and let another StateFactory
// try to satisfy getStateToBind.
return null ;
Remote stub = null;
try {
stub = PortableRemoteObject.toStub( (Remote)orig ) ;
} catch (Exception exc) {
// XXX log at FINE level?
// Wrong sort of object: just return null to allow another StateFactory
// to handle this. This can happen easily because this StateFactory
// is specified for the application, not the service context provider.
return null ;
}
if (StubAdapter.isStub( stub )) {
try {
StubAdapter.connect( stub, orb ) ;
} catch (Exception exc) {
if (!(exc instanceof java.rmi.RemoteException)) {
// XXX log at FINE level?
// Wrong sort of object: just return null to allow another StateFactory
// to handle this call.
return null ;
}
// ignore RemoteException because stub might have already
// been connected
}
}
return stub ;
|