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 org.jboss.ejb;
023:
024: import java.rmi.RemoteException;
025:
026: import javax.ejb.RemoveException;
027:
028: /**
029: * The interface for persisting stateful session beans.
030: *
031: * @version <tt>$Revision: 57209 $</tt>
032: * @author <a href="mailto:rickard.oberg@telkel.com">Rickard Öberg</a>
033: * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
034: */
035: public interface StatefulSessionPersistenceManager extends
036: ContainerPlugin {
037: /**
038: * Create a unique identifier for the given SFSB context.
039: *
040: * @param ctx The context of the SFSB to create an unique identifier for.
041: * @return A unique identifier.
042: *
043: * @throws Exception Failed to create unique identifier.
044: */
045: Object createId(StatefulSessionEnterpriseContext ctx)
046: throws Exception;
047:
048: /**
049: * Called after the SFSB's ejbCreate method has been successfully
050: * invoked to allow the PM to perform an post creation setup.
051: *
052: * @param ctx The context of the SFSB which was created.
053: */
054: void createdSession(StatefulSessionEnterpriseContext ctx)
055: throws Exception;
056:
057: /**
058: * Activate the SFSB for the given context.
059: *
060: * <p>
061: * Implementation is responsible for invoking the bean's
062: * {@link javax.ejb.SessionBean#ejbActivate} method.
063: *
064: * @param ctx The context of the SFSB to activate.
065: *
066: * @throws RemoteException
067: */
068: void activateSession(StatefulSessionEnterpriseContext ctx)
069: throws RemoteException;
070:
071: /**
072: * Passivate the SFSB for the given context.
073: *
074: * <p>
075: * Implementation is responsible for invoking the bean's
076: * {@link javax.ejb.SessionBean#ejbPassivate} method.
077: *
078: * @param ctx The context of the SFSB to passivate.
079: *
080: * @throws RemoteException
081: */
082: void passivateSession(StatefulSessionEnterpriseContext ctx)
083: throws RemoteException;
084:
085: /**
086: * Remove the SFSB for the given context.
087: *
088: * <p>
089: * Implementation is responsible for invoking the bean's
090: * {@link javax.ejb.SessionBean#ejbRemove} method.
091: *
092: * @param ctx The context of the SFSB to remove.
093: *
094: * @throws RemoteException
095: */
096: void removeSession(StatefulSessionEnterpriseContext ctx)
097: throws RemoteException, RemoveException;
098:
099: /**
100: * Remove any passivated state for the given SFSB identifier.
101: *
102: * <p>
103: * This is called by the instance cache impl to clean up
104: * the state for an old session.
105: *
106: * @param id The identifier of the SFSB to remove passivate state for.
107: */
108: void removePassivated(Object id);
109: }
|