FileDocCategorySizeDatePackage
StubDelegateImpl.javaAPI DocJava SE 5 API5789Fri Aug 26 14:54:24 BST 2005com.sun.corba.se.impl.javax.rmi.CORBA

StubDelegateImpl

public class StubDelegateImpl extends Object implements javax.rmi.CORBA.StubDelegate
Base class from which all static RMI-IIOP stubs must inherit.

Fields Summary
static com.sun.corba.se.impl.logging.UtilSystemException
wrapper
private com.sun.corba.se.impl.ior.StubIORImpl
ior
Constructors Summary
public StubDelegateImpl()

	ior = null ;
    
Methods Summary
public voidconnect(javax.rmi.CORBA.Stub self, org.omg.CORBA.ORB orb)
Connects this stub to an ORB. Required after the stub is deserialized but not after it is demarshalled by an ORB stream. If an unconnected stub is passed to an ORB stream for marshalling, it is implicitly connected to that ORB. Application code should not call this method directly, but should call the portable wrapper method {@link javax.rmi.PortableRemoteObject#connect}.

param
orb the ORB to connect to.
exception
RemoteException if the stub is already connected to a different ORB, or if the stub does not represent an exported remote or local object.

	ior = StubConnectImpl.connect( ior, self, self, orb ) ;
    
public booleanequals(javax.rmi.CORBA.Stub self, java.lang.Object obj)
Compares two stubs for equality. Returns true when used to compare stubs that represent the same remote object, and false otherwise.

param
obj the reference object with which to compare.
return
true if this object is the same as the obj argument; false otherwise.

        if (self == obj) {
            return true;    
        }
        
        if (!(obj instanceof javax.rmi.CORBA.Stub)) {
            return false;            
        }
        
	// no need to call init() because of calls to hashCode() below

        javax.rmi.CORBA.Stub other = (javax.rmi.CORBA.Stub) obj;
        if (other.hashCode() != self.hashCode()) {
            return false;
        }

        // hashCodes being the same does not mean equality. The stubs still
        // could be pointing to different IORs. So, do a literal comparison.
	// Apparently the ONLY way to do this (other than using private 
	// reflection)  toString, because it is not possible to directly
	// access the StubDelegateImpl from the Stub.
	return self.toString().equals( other.toString() ) ;
    
public booleanequals(java.lang.Object obj)

	if (this == obj)
	    return true ;

	if (!(obj instanceof StubDelegateImpl))
	    return false ;

	StubDelegateImpl other = (StubDelegateImpl)obj ;

	if (ior == null)
	    return ior == other.ior ;
	else 
	    return ior.equals( other.ior ) ;
    
public com.sun.corba.se.impl.ior.StubIORImplgetIOR()


       
    
	return ior ;
    
public inthashCode(javax.rmi.CORBA.Stub self)
Returns a hash code value for the object which is the same for all stubs that represent the same remote object.

return
the hash code value.

        init(self);
	return ior.hashCode() ;
    
private voidinit(javax.rmi.CORBA.Stub self)
Sets the IOR components if not already set.

        // If the Stub is not connected to an ORB, BAD_OPERATION exception
        // will be raised by the code below.
	if (ior == null)
	    ior = new StubIORImpl( self ) ;
    
public voidreadObject(javax.rmi.CORBA.Stub self, java.io.ObjectInputStream stream)
Serialization method to restore the IOR state.

	if (ior == null)
	    ior = new StubIORImpl() ;

	ior.doRead( stream ) ;
    
public java.lang.StringtoString(javax.rmi.CORBA.Stub self)
Returns a string representation of this stub. Returns the same string for all stubs that represent the same remote object.

return
a string representation of this stub.

	if (ior == null)
	    return null ;
	else
	    return ior.toString() ;
    
public voidwriteObject(javax.rmi.CORBA.Stub self, java.io.ObjectOutputStream stream)
Serialization method to save the IOR state.

serialData
The length of the IOR type ID (int), followed by the IOR type ID (byte array encoded using ISO8859-1), followed by the number of IOR profiles (int), followed by the IOR profiles. Each IOR profile is written as a profile tag (int), followed by the length of the profile data (int), followed by the profile data (byte array).

        init(self);
	ior.doWrite( stream ) ;