KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > local > SimpleSessionSL


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: SimpleSessionSL.java,v 1.2 2004/03/19 11:57:19 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.beans.local;
27
28 import javax.ejb.CreateException JavaDoc;
29 import javax.ejb.SessionBean JavaDoc;
30 import javax.ejb.SessionContext JavaDoc;
31
32 import org.objectweb.jonas.common.Log;
33 import org.objectweb.util.monolog.api.BasicLevel;
34 import org.objectweb.util.monolog.api.Logger;
35
36
37 /**
38  * Stateless Session
39  * @author Philippe Durieux
40  */

41 public class SimpleSessionSL implements SessionBean JavaDoc {
42
43     static protected Logger logger = null;
44     SessionContext JavaDoc ejbContext;
45
46     public String JavaDoc string;
47     public int number;
48     public boolean createdViaCreateXX;
49     public boolean createdViaCreateYY;
50
51     // ------------------------------------------------------------------
52
// SessionBean implementation
53
// ------------------------------------------------------------------
54

55     /**
56      * Set the associated session context. The container calls this method
57      * after the instance creation.
58      * The enterprise Bean instance should store the reference to the context
59      * object in an instance variable.
60      * This method is called with no transaction context.
61      *
62      * @param sessionContext A SessionContext interface for the instance.
63      * @throws EJBException Thrown by the method to indicate a failure caused by
64      * a system-level error.
65      */

66     public void setSessionContext(SessionContext JavaDoc ctx) {
67     if (logger == null)
68         logger = Log.getLogger(Log.JONAS_TESTS_PREFIX);
69     logger.log(BasicLevel.DEBUG, "");
70     ejbContext = ctx;
71     }
72     
73     /**
74      * A container invokes this method before it ends the life of the session object.
75      * This happens as a result of a client's invoking a remove operation, or when a
76      * container decides to terminate the session object after a timeout.
77      * This method is called with no transaction context.
78      *
79      * @throws EJBException Thrown by the method to indicate a failure caused by
80      * a system-level error.
81      */

82     public void ejbRemove() {
83     logger.log(BasicLevel.DEBUG, "");
84     }
85     
86     /**
87      * The Session bean must define 1 or more ejbCreate methods.
88      *
89      * @throws CreateException Failure to create a session EJB object.
90      */

91     public void ejbCreate() throws CreateException JavaDoc {
92     logger.log(BasicLevel.DEBUG, "");
93     }
94
95     /**
96      * A container invokes this method on an instance before the instance
97      * becomes disassociated with a specific EJB object.
98      */

99     public void ejbPassivate() {
100     logger.log(BasicLevel.DEBUG, "");
101     }
102
103     /**
104      * A container invokes this method when the instance is taken out of
105      * the pool of available instances to become associated with a specific
106      * EJB object.
107      */

108     public void ejbActivate() {
109     logger.log(BasicLevel.DEBUG, "");
110     }
111     
112     // ------------------------------------------------------------------
113
// Target implementation
114
// ------------------------------------------------------------------
115

116     /**
117      * getTen
118      */

119     public int getTen() {
120     logger.log(BasicLevel.DEBUG, "");
121         return 10;
122     }
123
124     /**
125      * method2
126      */

127     public void method2(java.lang.String JavaDoc s) {
128     logger.log(BasicLevel.DEBUG, "");
129     }
130
131     /**
132      * getNumber
133      * Not called
134      */

135     public int getNumber() {
136     logger.log(BasicLevel.DEBUG, "");
137         return 0;
138     }
139
140    /**
141      * getString
142      * Not called
143      */

144     public String JavaDoc getString() {
145     logger.log(BasicLevel.DEBUG, "");
146         return null;
147     }
148
149     /**
150      * isCreatedViaCreateXX
151      * Not called
152      */

153     public boolean isCreatedViaCreateXX() {
154     logger.log(BasicLevel.DEBUG, "");
155         return false;
156     }
157
158
159 }
160
Popular Tags