KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > ejb > support > AbstractSessionBean


1 /*
2  * Copyright 2002-2007 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.ejb.support;
18
19 import javax.ejb.SessionContext JavaDoc;
20
21 /**
22  * Superclass for all session beans. Not intended for direct client subclassing;
23  * derive from {@link AbstractStatelessSessionBean} or {@link AbstractStatefulSessionBean}
24  * instead.
25  *
26  * <p>This class saves the session context provided by the EJB container in an
27  * instance variable and exposes it through the {@link SmartSessionBean} interface.
28  *
29  * @author Rod Johnson
30  * @author Juergen Hoeller
31  * @see AbstractStatelessSessionBean
32  * @see AbstractStatefulSessionBean
33  */

34 abstract class AbstractSessionBean extends AbstractEnterpriseBean implements SmartSessionBean {
35
36     /** The SessionContext passed to this object */
37     private SessionContext JavaDoc sessionContext;
38
39
40     /**
41      * Set the session context.
42      * <p><b>If overriding this method, be sure to invoke this form of it first.</b>
43      * @param sessionContext the SessionContext for this EJB
44      */

45     public void setSessionContext(SessionContext JavaDoc sessionContext) {
46         this.sessionContext = sessionContext;
47     }
48
49     /**
50      * Convenience method for subclasses.
51      * Return the EJB context saved on initialization.
52      * @return the SessionContext saved on initialization by this class's
53      * implementation of the <code>setSessionContext</code> method
54      */

55     public final SessionContext JavaDoc getSessionContext() {
56         return this.sessionContext;
57     }
58
59 }
60
Popular Tags