1 45 package org.openejb.client; 46 47 import java.io.IOException ; 48 import java.io.ObjectInput ; 49 import java.io.ObjectOutput ; 50 import java.rmi.RemoteException ; 51 52 import javax.ejb.EJBHome ; 53 54 59 public class EJBHomeHandle implements java.io.Externalizable , javax.ejb.HomeHandle { 60 61 62 protected transient EJBHomeProxy ejbHomeProxy; 63 protected transient EJBHomeHandler handler; 64 65 66 public EJBHomeHandle() {} 67 68 public EJBHomeHandle(EJBHomeProxy proxy) { 69 this.ejbHomeProxy = proxy; 70 this.handler = ejbHomeProxy.getEJBHomeHandler(); 71 } 72 73 74 protected void setEJBHomeProxy(EJBHomeProxy ejbHomeProxy) { 75 this.ejbHomeProxy = ejbHomeProxy; 76 this.handler = ejbHomeProxy.getEJBHomeHandler(); 77 } 78 79 85 public EJBHome getEJBHome() throws RemoteException { 86 return ejbHomeProxy; 87 } 88 89 public void writeExternal(ObjectOutput out) throws IOException { 93 94 handler.client.writeExternal( out ); 96 97 EJBMetaDataImpl ejb = handler.ejb; 98 out.writeObject( ejb.homeClass ); 99 out.writeObject( ejb.remoteClass ); 100 out.writeObject( ejb.keyClass ); 101 out.writeByte( ejb.type ); 102 out.writeUTF( ejb.deploymentID ); 103 out.writeShort( ejb.deploymentCode ); 104 handler.server.writeExternal( out ); 105 } 106 107 113 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 114 ClientMetaData client = new ClientMetaData(); 115 EJBMetaDataImpl ejb = new EJBMetaDataImpl(); 116 ServerMetaData server = new ServerMetaData(); 117 118 client.readExternal( in ); 119 120 ejb.homeClass = (Class ) in.readObject(); 121 ejb.remoteClass = (Class ) in.readObject(); 122 ejb.keyClass = (Class ) in.readObject(); 123 ejb.type = in.readByte(); 124 ejb.deploymentID = in.readUTF(); 125 ejb.deploymentCode = in.readShort(); 126 127 server.readExternal( in ); 128 129 handler = EJBHomeHandler.createEJBHomeHandler(ejb, server, client); 130 ejbHomeProxy = handler.createEJBHomeProxy(); 131 } 132 133 } 134 | Popular Tags |