1 7 8 package com.sun.corba.se.impl.presentation.rmi ; 9 10 import java.io.ObjectInputStream ; 11 import java.io.ObjectOutputStream ; 12 import java.io.IOException ; 13 import java.io.Serializable ; 14 15 import java.rmi.RemoteException ; 16 17 import javax.rmi.CORBA.Tie ; 18 19 import org.omg.CORBA_2_3.portable.ObjectImpl ; 20 21 import org.omg.CORBA.portable.Delegate ; 22 import org.omg.CORBA.portable.OutputStream ; 23 24 import org.omg.CORBA.SystemException ; 25 import org.omg.CORBA.ORB ; 26 27 import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ; 28 import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; 29 import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; 30 import com.sun.corba.se.spi.presentation.rmi.DynamicStub ; 31 import com.sun.corba.se.impl.presentation.rmi.StubConnectImpl ; 32 import com.sun.corba.se.spi.logging.CORBALogDomains ; 33 import com.sun.corba.se.impl.logging.UtilSystemException ; 34 import com.sun.corba.se.impl.ior.StubIORImpl ; 35 import com.sun.corba.se.impl.util.RepositoryId ; 36 import com.sun.corba.se.impl.util.JDKBridge ; 37 import com.sun.corba.se.impl.util.Utility ; 38 39 public class DynamicStubImpl extends ObjectImpl 41 implements DynamicStub, Serializable 42 { 43 private static final long serialVersionUID = 4852612040012087675L; 44 45 private String [] typeIds ; 46 private StubIORImpl ior ; 47 private DynamicStub self = null ; 49 public void setSelf( DynamicStub self ) 50 { 51 this.self = self ; 53 } 54 55 public DynamicStub getSelf() 56 { 57 return self ; 58 } 59 60 public DynamicStubImpl( String [] typeIds ) 61 { 62 this.typeIds = typeIds ; 63 ior = null ; 64 } 65 66 public void setDelegate( Delegate delegate ) 67 { 68 _set_delegate( delegate ) ; 69 } 70 71 public Delegate getDelegate() 72 { 73 return _get_delegate() ; 74 } 75 76 public ORB getORB() 77 { 78 return (ORB )_orb() ; 79 } 80 81 public String [] _ids() 82 { 83 return typeIds ; 84 } 85 86 public String [] getTypeIds() 87 { 88 return _ids() ; 89 } 90 91 public void connect( ORB orb ) throws RemoteException 92 { 93 ior = StubConnectImpl.connect( ior, self, this, orb ) ; 94 } 95 96 public boolean isLocal() 97 { 98 return _is_local() ; 99 } 100 101 public OutputStream request( String operation, 102 boolean responseExpected ) 103 { 104 return _request( operation, responseExpected ) ; 105 } 106 107 private void readObject( ObjectInputStream stream ) throws 108 IOException , ClassNotFoundException 109 { 110 ior = new StubIORImpl() ; 111 ior.doRead( stream ) ; 112 } 113 114 private void writeObject( ObjectOutputStream stream ) throws 115 IOException 116 { 117 if (ior == null) 118 ior = new StubIORImpl( this ) ; 119 ior.doWrite( stream ) ; 120 } 121 122 public Object readResolve() 123 { 124 String repositoryId = ior.getRepositoryId() ; 125 String cname = RepositoryId.cache.getId( repositoryId ).getClassName() ; 126 127 Class cls = null ; 128 129 try { 130 cls = JDKBridge.loadClass( cname, null, null ) ; 131 } catch (ClassNotFoundException exc) { 132 } 134 135 PresentationManager pm = 136 com.sun.corba.se.spi.orb.ORB.getPresentationManager() ; 137 PresentationManager.ClassData classData = pm.getClassData( cls ) ; 138 InvocationHandlerFactoryImpl ihfactory = 139 (InvocationHandlerFactoryImpl)classData.getInvocationHandlerFactory() ; 140 return ihfactory.getInvocationHandler( this ) ; 141 } 142 } 143 | Popular Tags |