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: package javax.ejb;
037:
038: import java.rmi.RemoteException;
039:
040: /**
041: * The SessionBean interface is implemented by every session enterprise Bean
042: * class. The container uses the SessionBean methods to notify the enterprise
043: * Bean instances of the instance's life cycle events.
044: */
045: public interface SessionBean extends EnterpriseBean {
046: /**
047: * Set the associated session context. The container calls this method
048: * after the instance creation.
049: *
050: * <p> The enterprise Bean instance should store the reference to the
051: * context object in an instance variable.
052: *
053: * <p> This method is called with no transaction context.
054: *
055: * @param ctx A SessionContext interface for the instance.
056: *
057: * @exception EJBException Thrown by the method to indicate a failure
058: * caused by a system-level error.
059: *
060: * @exception RemoteException This exception is defined in the method
061: * signature to provide backward compatibility for applications written
062: * for the EJB 1.0 specification. Enterprise beans written for the
063: * EJB 1.1 specification should throw the
064: * javax.ejb.EJBException instead of this exception.
065: * Enterprise beans written for the EJB2.0 and higher specifications
066: * must throw the javax.ejb.EJBException instead of this exception.
067: */
068: void setSessionContext(SessionContext ctx) throws EJBException,
069: RemoteException;
070:
071: /**
072: * A container invokes this method before it ends the life of the session
073: * object. This happens as a result of a client's invoking a remove
074: * operation, or when a container decides to terminate the session object
075: * after a timeout.
076: *
077: * <p> This method is called with no transaction context.
078: *
079: * @exception EJBException Thrown by the method to indicate a failure
080: * caused by a system-level error.
081: *
082: * @exception RemoteException This exception is defined in the method
083: * signature to provide backward compatibility for enterprise beans
084: * written for the EJB 1.0 specification. Enterprise beans written
085: * for the EJB 1.1 specification should throw the
086: * javax.ejb.EJBException instead of this exception.
087: * Enterprise beans written for the EJB2.0 and higher specifications
088: * must throw the javax.ejb.EJBException instead of this exception.
089: */
090: void ejbRemove() throws EJBException, RemoteException;
091:
092: /**
093: * The activate method is called when the instance is activated
094: * from its "passive" state. The instance should acquire any resource
095: * that it has released earlier in the ejbPassivate() method.
096: *
097: * <p> This method is called with no transaction context.
098: *
099: * @exception EJBException Thrown by the method to indicate a failure
100: * caused by a system-level error.
101: *
102: * @exception RemoteException This exception is defined in the method
103: * signature to provide backward compatibility for enterprise beans
104: * written for the EJB 1.0 specification. Enterprise beans written
105: * for the EJB 1.1 specification should throw the
106: * javax.ejb.EJBException instead of this exception.
107: * Enterprise beans written for the EJB2.0 and higher specifications
108: * must throw the javax.ejb.EJBException instead of this exception.
109: */
110: void ejbActivate() throws EJBException, RemoteException;
111:
112: /**
113: * The passivate method is called before the instance enters
114: * the "passive" state. The instance should release any resources that
115: * it can re-acquire later in the ejbActivate() method.
116: *
117: * <p> After the passivate method completes, the instance must be
118: * in a state that allows the container to use the Java Serialization
119: * protocol to externalize and store away the instance's state.
120: *
121: * <p> This method is called with no transaction context.
122: *
123: * @exception EJBException Thrown by the method to indicate a failure
124: * caused by a system-level error.
125: *
126: * @exception RemoteException This exception is defined in the method
127: * signature to provide backward compatibility for enterprise beans
128: * written for the EJB 1.0 specification. Enterprise beans written
129: * for the EJB 1.1 specification should throw the
130: * javax.ejb.EJBException instead of this exception.
131: * Enterprise beans written for the EJB2.0 and higher specifications
132: * must throw the javax.ejb.EJBException instead of this exception.
133: */
134: void ejbPassivate() throws EJBException, RemoteException;
135: }
|