001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package javax.ejb.spi;
038:
039: import java.io.IOException;
040: import java.io.ObjectOutputStream;
041: import java.io.ObjectInputStream;
042:
043: import javax.ejb.EJBObject;
044: import javax.ejb.EJBHome;
045:
046: /**
047: * The HandleDelegate interface is implemented by the EJB container.
048: * It is used by portable implementations of javax.ejb.Handle and
049: * javax.ejb.HomeHandle.
050: * It is not used by EJB components or by client components.
051: * It provides methods to serialize and deserialize EJBObject and
052: * EJBHome references to streams.
053: *
054: * <p> The HandleDelegate object is obtained by JNDI lookup at the
055: * reserved name "java:comp/HandleDelegate".
056: */
057:
058: public interface HandleDelegate {
059: /**
060: * Serialize the EJBObject reference corresponding to a Handle.
061: *
062: * <p> This method is called from the writeObject method of
063: * portable Handle implementation classes. The ostream object is the
064: * same object that was passed in to the Handle class's writeObject.
065: *
066: * @param ejbObject The EJBObject reference to be serialized.
067: *
068: * @param ostream The output stream.
069: *
070: * @exception IOException The EJBObject could not be serialized
071: * because of a system-level failure.
072: */
073: public void writeEJBObject(EJBObject ejbObject,
074: ObjectOutputStream ostream) throws IOException;
075:
076: /**
077: * Deserialize the EJBObject reference corresponding to a Handle.
078: *
079: * <p> readEJBObject is called from the readObject method of
080: * portable Handle implementation classes. The istream object is the
081: * same object that was passed in to the Handle class's readObject.
082: * When readEJBObject is called, istream must point to the location
083: * in the stream at which the EJBObject reference can be read.
084: * The container must ensure that the EJBObject reference is
085: * capable of performing invocations immediately after deserialization.
086: *
087: * @param istream The input stream.
088: *
089: * @return The deserialized EJBObject reference.
090: *
091: * @exception IOException The EJBObject could not be deserialized
092: * because of a system-level failure.
093: * @exception ClassNotFoundException The EJBObject could not be deserialized
094: * because some class could not be found.
095: */
096: public javax.ejb.EJBObject readEJBObject(ObjectInputStream istream)
097: throws IOException, ClassNotFoundException;
098:
099: /**
100: * Serialize the EJBHome reference corresponding to a HomeHandle.
101: *
102: * <p> This method is called from the writeObject method of
103: * portable HomeHandle implementation classes. The ostream object is the
104: * same object that was passed in to the Handle class's writeObject.
105: *
106: * @param ejbHome The EJBHome reference to be serialized.
107: *
108: * @param ostream The output stream.
109: *
110: * @exception IOException The EJBObject could not be serialized
111: * because of a system-level failure.
112: */
113: public void writeEJBHome(EJBHome ejbHome, ObjectOutputStream ostream)
114: throws IOException;
115:
116: /**
117: * Deserialize the EJBHome reference corresponding to a HomeHandle.
118: *
119: * <p> readEJBHome is called from the readObject method of
120: * portable HomeHandle implementation classes. The istream object is the
121: * same object that was passed in to the HomeHandle class's readObject.
122: * When readEJBHome is called, istream must point to the location
123: * in the stream at which the EJBHome reference can be read.
124: * The container must ensure that the EJBHome reference is
125: * capable of performing invocations immediately after deserialization.
126: *
127: * @param istream The input stream.
128: *
129: * @return The deserialized EJBHome reference.
130: *
131: * @exception IOException The EJBHome could not be deserialized
132: * because of a system-level failure.
133: * @exception ClassNotFoundException The EJBHome could not be deserialized
134: * because some class could not be found.
135: */
136: public javax.ejb.EJBHome readEJBHome(ObjectInputStream istream)
137: throws IOException, ClassNotFoundException;
138: }
|