1 /* 2 * JBoss, Home of Professional Open Source 3 * Copyright 2005, JBoss Inc., and individual contributors as indicated 4 * by the @authors tag. See the copyright.txt in the distribution for a 5 * full listing of individual contributors. 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as 9 * published by the Free Software Foundation; either version 2.1 of 10 * the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this software; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 */ 22 package org.jboss.ejb; 23 24 import java.rmi.RemoteException; 25 26 import javax.ejb.RemoveException; 27 28 /** 29 * The interface for persisting stateful session beans. 30 * 31 * @version <tt>$Revision: 37459 $</tt> 32 * @author <a HREF="mailto:rickard.oberg@telkel.com">Rickard Öberg</a> 33 * @author <a HREF="mailto:jason@planet57.com">Jason Dillon</a> 34 */ 35 public interface StatefulSessionPersistenceManager 36 extends ContainerPlugin 37 { 38 /** 39 * Create a unique identifier for the given SFSB context. 40 * 41 * @param ctx The context of the SFSB to create an unique identifier for. 42 * @return A unique identifier. 43 * 44 * @throws Exception Failed to create unique identifier. 45 */ 46 Object createId(StatefulSessionEnterpriseContext ctx) 47 throws Exception; 48 49 /** 50 * Called after the SFSB's ejbCreate method has been successfully 51 * invoked to allow the PM to perform an post creation setup. 52 * 53 * @param ctx The context of the SFSB which was created. 54 */ 55 void createdSession(StatefulSessionEnterpriseContext ctx) 56 throws Exception; 57 58 /** 59 * Activate the SFSB for the given context. 60 * 61 * <p> 62 * Implementation is responsible for invoking the bean's 63 * {@link javax.ejb.SessionBean#ejbActivate} method. 64 * 65 * @param ctx The context of the SFSB to activate. 66 * 67 * @throws RemoteException 68 */ 69 void activateSession(StatefulSessionEnterpriseContext ctx) 70 throws RemoteException; 71 72 /** 73 * Passivate the SFSB for the given context. 74 * 75 * <p> 76 * Implementation is responsible for invoking the bean's 77 * {@link javax.ejb.SessionBean#ejbPassivate} method. 78 * 79 * @param ctx The context of the SFSB to passivate. 80 * 81 * @throws RemoteException 82 */ 83 void passivateSession(StatefulSessionEnterpriseContext ctx) 84 throws RemoteException; 85 86 /** 87 * Remove the SFSB for the given context. 88 * 89 * <p> 90 * Implementation is responsible for invoking the bean's 91 * {@link javax.ejb.SessionBean#ejbRemove} method. 92 * 93 * @param ctx The context of the SFSB to remove. 94 * 95 * @throws RemoteException 96 */ 97 void removeSession(StatefulSessionEnterpriseContext ctx) 98 throws RemoteException, RemoveException; 99 100 /** 101 * Remove any passivated state for the given SFSB identifier. 102 * 103 * <p> 104 * This is called by the instance cache impl to clean up 105 * the state for an old session. 106 * 107 * @param id The identifier of the SFSB to remove passivate state for. 108 */ 109 void removePassivated(Object id); 110 } 111