01: package org.mockejb.test;
02:
03: import javax.ejb.*;
04: import org.apache.commons.logging.*;
05:
06: /**
07: * Base class for our session beans.
08: * Provides implementation of the standard EJb methods.
09: * Most methods simply logs the entry point.
10: *
11: * @author Alexander Ananiev
12: */
13: public class BaseSessionBean implements SessionBean {
14:
15: // logger for this class
16: private static Log logger = LogFactory.getLog(BaseSessionBean.class
17: .getName());
18:
19: protected SessionContext sessionCtx;
20:
21: protected void log(String message) {
22: logger.debug(message);
23: }
24:
25: /**
26: * Logs the activation of the bean
27: */
28: public void ejbActivate() {
29: log("ejbActivate called");
30: }
31:
32: /**
33: * Logs the removal of the bean
34: */
35: public void ejbRemove() {
36: log("ejbRemove called");
37: }
38:
39: /**
40: * Logs the passivation of the bean
41: */
42: public void ejbPassivate() {
43: log("ejbPassivate called");
44: }
45:
46: /**
47: * Sets the session context.
48: *
49: * @param sessionCtx SessionContext Context for session
50: */
51: public void setSessionContext(SessionContext sessionCtx) {
52: log("setSessionContext called");
53: this .sessionCtx = sessionCtx;
54: }
55:
56: /**
57: * Logs the creation of the bean
58: */
59: public void ejbCreate() throws CreateException {
60: log("ejbCreate called");
61: }
62:
63: }
|