001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.ejb.spi;
023:
024: import javax.ejb.EJBHome;
025: import javax.ejb.EJBObject;
026:
027: /**
028: * <P>The HandleDelegate interface is implemented by the EJB container.
029: * It is used by portable implementations of javax.ejb.Handle and
030: * javax.ejb.HomeHandle. It is not used by EJB components or by client components.
031: * It provides methods to serialize and deserialize EJBObject and EJBHome
032: * references to streams.</P>
033: *
034: * <P>The HandleDelegate object is obtained by JNDI lookup at the reserved name
035: * "java:comp/HandleDelegate".</P>
036: */
037: public interface HandleDelegate {
038:
039: /**
040: * <P>Serialize the EJBObject reference corresponding to a Handle.</P>
041: *
042: * <P>This method is called from the writeObject method of portable
043: * Handle implementation classes. The ostream object is the same
044: * object that was passed in to the Handle class's writeObject.</P>
045: *
046: * @param ejbObject - The EJBObject reference to be serialized.
047: * @param ostream - The output stream.
048: * @exception java.io.IOException - The EJBObject could not be serialized
049: * because of a system-level failure.
050: */
051: public void writeEJBObject(EJBObject ejbObject,
052: java.io.ObjectOutputStream ostream)
053: throws java.io.IOException;
054:
055: /**
056: * <P>Deserialize the EJBObject reference corresponding to a Handle.</P>
057: *
058: * <P>readEJBObject is called from the readObject method of portable
059: * Handle implementation classes. The istream object is the same object
060: * that was passed in to the Handle class's readObject. When readEJBObject
061: * is called, istream must point to the location in the stream at which
062: * the EJBObject reference can be read. The container must ensure that
063: * the EJBObject reference is capable of performing invocations immediately
064: * after deserialization.</P>
065: *
066: * @param istream - The input stream.
067: * @return The deserialized EJBObject reference.
068: * @exception java.io.IOException - The EJBObject could not be deserialized
069: * because of a system-level failure.
070: * @exception java.lang.ClassNotFoundException - The EJBObject could not be
071: * deserialized because some
072: * class could not be found.
073: */
074: public EJBObject readEJBObject(java.io.ObjectInputStream istream)
075: throws java.io.IOException,
076: java.lang.ClassNotFoundException;
077:
078: /**
079: * <P>Serialize the EJBHome reference corresponding to a HomeHandle.</P>
080: *
081: * <P>This method is called from the writeObject method of portable HomeHandle
082: * implementation classes. The ostream object is the same object that was
083: * passed in to the Handle class's writeObject.</P>
084: *
085: * @param ejbHome - The EJBHome reference to be serialized.
086: * @param ostream - The output stream.
087: * @exception java.io.IOException - The EJBObject could not be serialized
088: * because of a system-level failure.
089: */
090: public void writeEJBHome(EJBHome ejbHome,
091: java.io.ObjectOutputStream ostream)
092: throws java.io.IOException;
093:
094: /**
095: * <P>Deserialize the EJBHome reference corresponding to a HomeHandle.</P>
096: *
097: * <P>readEJBHome is called from the readObject method of portable HomeHandle
098: * implementation classes. The istream object is the same object that was
099: * passed in to the HomeHandle class's readObject. When readEJBHome is called,
100: * istream must point to the location in the stream at which the EJBHome reference
101: * can be read. The container must ensure that the EJBHome reference is capable
102: * of performing invocations immediately after deserialization.</P>
103: *
104: * @param istream - The input stream.
105: * @return The deserialized EJBHome reference.
106: * @exception java.io.IOException - The EJBHome could not be deserialized because
107: * of a system-level failure.
108: * @exception java.lang.ClassNotFoundException - The EJBHome could not be deserialized
109: * because some class could not be found.
110: */
111: public EJBHome readEJBHome(java.io.ObjectInputStream istream)
112: throws java.io.IOException,
113: java.lang.ClassNotFoundException;
114: }
|