1 package org.openejb.spi; 2 3 import javax.ejb.EJBHome; 4 import javax.ejb.EJBMetaData; 5 import javax.ejb.EJBObject; 6 import javax.ejb.Handle; 7 import javax.ejb.HomeHandle; 8 9 import org.openejb.ProxyInfo; 10 11 /** 12 * <h2><b>LOCAL to REMOTE SERIALIZATION</b></h2> <p> 13 * 14 * <i>Definition:</i><p> 15 * This is a serialization that initiates in the local vm, but 16 * is outside the scope of a marked IntraVM local serialization. 17 * <p> 18 * <i>Circumstances:</i><p> 19 * When an IntraVM implementation of a javax.ejb.* interface is 20 * serialized outside the scope of the IntraVM Server 21 * <p> 22 * These serializations happen when objects are sent from a 23 * local bean to a remote client as part of a return value, or 24 * when a stateful session bean is passified. 25 * <p> 26 * <i>Action:</i><p> 27 * Don't serialize the IntraVM javax.ejb.* interface 28 * implementation, instead ask the ApplicationServer to nominate 29 * its own implementation as a replacement. This is done via 30 * the org.openejb.spi.ApplicationServer interface. 31 * <p> 32 * <i>Example Scenario:</i><p> 33 * SERIALIZATION<br> 34 * <br>1. ObjectOutputStream encounters an IntraVmMetaData instance 35 * in the object graph and calls its writeReplace method. 36 * <br>2. The IntraVmMetaData instance determines it is being 37 * serialized outside the scope of an IntraVM serialization 38 * by calling IntraVmCopyMonitor.isIntraVmCopyOperation(). 39 * <br>3. The IntraVmMetaData instance calls the getEJBMetaData 40 * method on the ApplicationServer. 41 * <br>4. The IntraVmMetaData instance returns the 42 * ApplicationServer's EJBMetaData instance from the 43 * writeReplace method. 44 * <br>5. The ObjectOutputStream serializes the ApplicationServer's 45 * EJBMetaData instance in place of the IntraVmMetaData 46 * instance. 47 * <p> 48 * Note: The ApplicationServer's EJBMetaData instance can 49 * be any object that implements the javax.ejb.EJBMetaData 50 * interface and can also implement any serialization 51 * methods, such as the writeReplace method, to nominate a 52 * replacement or implement protocol specific logic or 53 * otherwise gain control over the serialization of 54 * EJBMetaData instances destined for its remote clients. 55 * <p> 56 * DESERIALIZATION<p> 57 * The deserialization of the Application Server's 58 * javax.ejb.* implementations is implementation specific. 59 * <p> 60 * 61 * @author <a HREF="mailto=david.blevins@visi.com">David Blevins</a> 62 * @version $Revision: 1096 $ $Date: 2004-03-26 13:41:16 -0800 (Fri, 26 Mar 2004) $ 63 */ 64 public interface ApplicationServer { 65 66 public EJBMetaData getEJBMetaData(ProxyInfo proxyInfo); 67 68 public Handle getHandle(ProxyInfo proxyInfo); 69 70 public HomeHandle getHomeHandle(ProxyInfo proxyInfo); 71 72 public EJBObject getEJBObject(ProxyInfo proxyInfo); 73 74 public EJBHome getEJBHome(ProxyInfo proxyInfo); 75 76 }