1 7 15 16 package com.sun.corba.se.impl.javax.rmi.CORBA; 17 18 import java.io.IOException ; 19 20 import java.rmi.RemoteException ; 21 22 import javax.rmi.CORBA.Tie ; 23 24 import org.omg.CORBA.ORB ; 25 import org.omg.CORBA.SystemException ; 26 import org.omg.CORBA.BAD_OPERATION ; 27 import org.omg.CORBA.BAD_INV_ORDER ; 28 29 import org.omg.CORBA.portable.Delegate ; 30 import org.omg.CORBA.portable.OutputStream ; 31 import org.omg.CORBA.portable.InputStream ; 32 33 import com.sun.corba.se.spi.presentation.rmi.StubAdapter; 34 35 import com.sun.corba.se.spi.logging.CORBALogDomains ; 36 37 import com.sun.corba.se.impl.util.Utility; 38 39 import com.sun.corba.se.impl.ior.StubIORImpl ; 40 import com.sun.corba.se.impl.presentation.rmi.StubConnectImpl ; 41 42 import com.sun.corba.se.impl.logging.UtilSystemException ; 43 44 47 public class StubDelegateImpl implements javax.rmi.CORBA.StubDelegate 48 { 49 static UtilSystemException wrapper = UtilSystemException.get( 50 CORBALogDomains.RMIIIOP ) ; 51 52 private StubIORImpl ior ; 53 54 public StubIORImpl getIOR() 55 { 56 return ior ; 57 } 58 59 public StubDelegateImpl() 60 { 61 ior = null ; 62 } 63 64 67 private void init (javax.rmi.CORBA.Stub self) 68 { 69 if (ior == null) 72 ior = new StubIORImpl( self ) ; 73 } 74 75 80 public int hashCode(javax.rmi.CORBA.Stub self) 81 { 82 init(self); 83 return ior.hashCode() ; 84 } 85 86 93 public boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object obj) 94 { 95 if (self == obj) { 96 return true; 97 } 98 99 if (!(obj instanceof javax.rmi.CORBA.Stub )) { 100 return false; 101 } 102 103 105 javax.rmi.CORBA.Stub other = (javax.rmi.CORBA.Stub ) obj; 106 if (other.hashCode() != self.hashCode()) { 107 return false; 108 } 109 110 return self.toString().equals( other.toString() ) ; 116 } 117 118 public boolean equals( Object obj ) 119 { 120 if (this == obj) 121 return true ; 122 123 if (!(obj instanceof StubDelegateImpl)) 124 return false ; 125 126 StubDelegateImpl other = (StubDelegateImpl)obj ; 127 128 if (ior == null) 129 return ior == other.ior ; 130 else 131 return ior.equals( other.ior ) ; 132 } 133 134 139 public String toString(javax.rmi.CORBA.Stub self) 140 { 141 if (ior == null) 142 return null ; 143 else 144 return ior.toString() ; 145 } 146 147 158 public void connect(javax.rmi.CORBA.Stub self, ORB orb) 159 throws RemoteException 160 { 161 ior = StubConnectImpl.connect( ior, self, self, orb ) ; 162 } 163 164 167 public void readObject(javax.rmi.CORBA.Stub self, 168 java.io.ObjectInputStream stream) throws IOException , ClassNotFoundException 169 { 170 if (ior == null) 171 ior = new StubIORImpl() ; 172 173 ior.doRead( stream ) ; 174 } 175 176 184 public void writeObject(javax.rmi.CORBA.Stub self, 185 java.io.ObjectOutputStream stream) throws IOException 186 { 187 init(self); 188 ior.doWrite( stream ) ; 189 } 190 } 191 | Popular Tags |