1 23 24 package com.sun.ejb.containers; 25 26 import java.rmi.Remote ; 27 28 import java.io.ObjectInputStream ; 29 import java.io.WriteAbortedException ; 30 import java.io.ObjectStreamException ; 31 import java.io.IOException ; 32 33 import com.sun.ejb.EJBUtils; 34 35 public class RemoteBusinessWrapperBase 36 implements java.io.Serializable { 37 38 private String businessInterface_; 40 41 private Remote stub_; 42 43 private transient int hashCode_; 44 45 public RemoteBusinessWrapperBase(Remote stub, String busIntf) { 46 stub_ = stub; 47 businessInterface_ = busIntf; 48 this.hashCode_ = busIntf.hashCode(); 49 } 50 51 public Remote getStub() { 52 return stub_; 53 } 54 55 public int hashCode() { 56 return hashCode_; 57 } 58 59 public boolean equals(Object obj) { 60 61 boolean result = (obj == this); if ((result == false) && (obj != null)) { if (obj instanceof RemoteBusinessWrapperBase) { 64 RemoteBusinessWrapperBase remoteBWB = 65 (RemoteBusinessWrapperBase) obj; 66 boolean hasSameBusinessInterface = 67 (remoteBWB.hashCode_ == hashCode_) && 68 remoteBWB.businessInterface_.equals(businessInterface_); 69 if (hasSameBusinessInterface) { 70 org.omg.CORBA.Object other = (org.omg.CORBA.Object ) remoteBWB.stub_; 71 org.omg.CORBA.Object me = (org.omg.CORBA.Object ) stub_; 72 result = me._is_equivalent(other); 73 } 74 } 75 } 76 77 return result; 78 } 79 80 public String getBusinessInterfaceName() { 81 return businessInterface_; 82 } 83 84 public Object writeReplace() throws ObjectStreamException { 85 return new RemoteBusinessWrapperBase(stub_, businessInterface_); 86 } 87 88 private void writeObject(java.io.ObjectOutputStream oos) 89 throws java.io.IOException 90 { 91 92 oos.writeObject(businessInterface_); 93 oos.writeObject(stub_); 94 95 } 96 97 private void readObject(ObjectInputStream ois) 98 throws IOException , ClassNotFoundException { 99 100 try { 101 102 businessInterface_ = (String ) ois.readObject(); 103 hashCode_ = businessInterface_.hashCode(); 104 105 EJBUtils.loadGeneratedRemoteBusinessClasses(businessInterface_); 106 107 stub_ = (Remote ) ois.readObject(); 108 109 } catch(Exception e) { 110 IOException ioe = new IOException ("RemoteBusinessWrapper.readObj " 111 + " error"); 112 ioe.initCause(e); 113 throw ioe; 114 } 115 } 116 117 public Object readResolve() throws ObjectStreamException { 118 119 try { 120 121 return EJBUtils.createRemoteBusinessObject(businessInterface_, 122 stub_); 123 } catch(Exception e) { 124 WriteAbortedException wae = new WriteAbortedException 125 ("RemoteBusinessWrapper.readResolve error", e); 126 wae.initCause(e); 127 throw wae; 128 } 129 130 } 131 132 133 134 135 } 136 137 | Popular Tags |