Save This Page
Home » glassfish-v2ur2-b04-src » javax » ejb » [javadoc | source]
    1   /*
    2    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    3    * 
    4    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    5    * 
    6    * The contents of this file are subject to the terms of either the GNU
    7    * General Public License Version 2 only ("GPL") or the Common Development
    8    * and Distribution License("CDDL") (collectively, the "License").  You
    9    * may not use this file except in compliance with the License. You can obtain
   10    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   11    * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
   12    * language governing permissions and limitations under the License.
   13    * 
   14    * When distributing the software, include this License Header Notice in each
   15    * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
   16    * Sun designates this particular file as subject to the "Classpath" exception
   17    * as provided by Sun in the GPL Version 2 section of the License file that
   18    * accompanied this code.  If applicable, add the following below the License
   19    * Header, with the fields enclosed by brackets [] replaced by your own
   20    * identifying information: "Portions Copyrighted [year]
   21    * [name of copyright owner]"
   22    * 
   23    * Contributor(s):
   24    * 
   25    * If you wish your version of this file to be governed by only the CDDL or
   26    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   27    * elects to include this software in this distribution under the [CDDL or GPL
   28    * Version 2] license."  If you don't indicate a single choice of license, a
   29    * recipient has the option to distribute your version of this file under
   30    * either the CDDL, the GPL Version 2 or to extend the choice of license to
   31    * its licensees as provided above.  However, if you add GPL Version 2 code
   32    * and therefore, elected the GPL Version 2 license, then the option applies
   33    * only if the new code is made subject to such option by the copyright
   34    * holder.
   35    */
   36   package javax.ejb;
   37   
   38   import java.rmi.RemoteException;
   39   
   40   /**
   41    * The SessionBean interface is implemented by every session enterprise Bean 
   42    * class. The container uses the SessionBean methods to notify the enterprise
   43    * Bean instances of the instance's life cycle events.
   44    */
   45   public interface SessionBean extends EnterpriseBean {
   46       /**
   47        * Set the associated session context. The container calls this method
   48        * after the instance creation.
   49        *
   50        * <p> The enterprise Bean instance should store the reference to the
   51        * context object in an instance variable.
   52        *
   53        * <p> This method is called with no transaction context.
   54        *
   55        * @param ctx A SessionContext interface for the instance.
   56        *
   57        * @exception EJBException Thrown by the method to indicate a failure
   58        *    caused by a system-level error.
   59        *
   60        * @exception RemoteException This exception is defined in the method
   61        *    signature to provide backward compatibility for applications written
   62        *    for the EJB 1.0 specification. Enterprise beans written for the 
   63        *    EJB 1.1 specification should throw the
   64        *    javax.ejb.EJBException instead of this exception.
   65        *    Enterprise beans written for the EJB2.0 and higher specifications
   66        *    must throw the javax.ejb.EJBException instead of this exception.
   67        */
   68       void setSessionContext(SessionContext ctx) throws EJBException,
   69   	    RemoteException;
   70   
   71       /**
   72        * A container invokes this method before it ends the life of the session
   73        * object. This happens as a result of a client's invoking a remove
   74        * operation, or when a container decides to terminate the session object
   75        * after a timeout.
   76        * 
   77        * <p> This method is called with no transaction context.
   78        *
   79        * @exception EJBException Thrown by the method to indicate a failure
   80        *    caused by a system-level error.
   81        *
   82        * @exception RemoteException This exception is defined in the method
   83        *    signature to provide backward compatibility for enterprise beans 
   84        *    written for the EJB 1.0 specification. Enterprise beans written 
   85        *    for the EJB 1.1 specification should throw the
   86        *    javax.ejb.EJBException instead of this exception.
   87        *    Enterprise beans written for the EJB2.0 and higher specifications
   88        *    must throw the javax.ejb.EJBException instead of this exception.
   89        */
   90        void ejbRemove() throws EJBException, RemoteException;    
   91   
   92       /**
   93        * The activate method is called when the instance is activated
   94        * from its "passive" state. The instance should acquire any resource
   95        * that it has released earlier in the ejbPassivate() method.
   96        *
   97        * <p> This method is called with no transaction context.
   98        *
   99        * @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   }

Save This Page
Home » glassfish-v2ur2-b04-src » javax » ejb » [javadoc | source]