01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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;
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
35: implements SmartSessionBean {
36:
37: /** The SessionContext passed to this object */
38: private SessionContext sessionContext;
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 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 getSessionContext() {
56: return this.sessionContext;
57: }
58:
59: }
|