1 45 package org.openejb.client; 46 47 import java.io.Externalizable ; 48 import java.io.IOException ; 49 import java.io.ObjectInput ; 50 import java.io.ObjectOutput ; 51 import java.io.ObjectStreamException ; 52 53 54 public class EJBHomeProxyHandle implements Externalizable { 55 56 EJBHomeHandler handler; 57 58 public EJBHomeProxyHandle(){ 59 } 60 61 public EJBHomeProxyHandle(EJBHomeHandler handler){ 62 this.handler = handler; 63 } 64 65 71 public void writeExternal(ObjectOutput out) throws IOException { 72 handler.client.writeExternal( out ); 74 75 EJBMetaDataImpl ejb = handler.ejb; 76 out.writeObject( ejb.homeClass ); 77 out.writeObject( ejb.remoteClass ); 78 out.writeObject( ejb.keyClass ); 79 out.writeByte( ejb.type ); 80 out.writeUTF( ejb.deploymentID ); 81 out.writeShort( ejb.deploymentCode ); 82 handler.server.writeExternal( out ); 83 } 85 86 92 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 93 ClientMetaData client = new ClientMetaData(); 94 EJBMetaDataImpl ejb = new EJBMetaDataImpl(); 95 ServerMetaData server = new ServerMetaData(); 96 97 client.readExternal( in ); 98 99 ejb.homeClass = (Class ) in.readObject(); 100 ejb.remoteClass = (Class ) in.readObject(); 101 ejb.keyClass = (Class ) in.readObject(); 102 ejb.type = in.readByte(); 103 ejb.deploymentID = in.readUTF(); 104 ejb.deploymentCode = in.readShort(); 105 106 server.readExternal( in ); 107 108 handler = EJBHomeHandler.createEJBHomeHandler(ejb, server, client); 109 111 handler.ejb.ejbHomeProxy = handler.createEJBHomeProxy(); 112 } 113 114 115 120 private Object readResolve() throws ObjectStreamException { 121 return handler.ejb.ejbHomeProxy; 122 } 123 124 } 125 | Popular Tags |