KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > flocal > TargetSL


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: TargetSL.java,v 1.1 2003/12/05 14:16:53 legrasi Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.beans.flocal;
27
28 import java.sql.Connection JavaDoc;
29 import java.sql.SQLException JavaDoc;
30 import java.sql.Statement JavaDoc;
31 import javax.ejb.CreateException JavaDoc;
32 import javax.ejb.EJBException JavaDoc;
33 import javax.ejb.RemoveException JavaDoc;
34 import javax.ejb.EJBObject JavaDoc;
35 import javax.ejb.SessionBean JavaDoc;
36 import javax.ejb.SessionContext JavaDoc;
37 import javax.naming.Context JavaDoc;
38 import javax.naming.InitialContext JavaDoc;
39 import javax.naming.NamingException JavaDoc;
40
41
42
43
44 /**
45  * Stateless Session
46  * @author Philippe Durieux, Philippe Coq
47  */

48 public class TargetSL implements SessionBean JavaDoc {
49
50     // static protected Logger logger = null;
51
SessionContext JavaDoc ejbContext;
52
53     public String JavaDoc string;
54     public int number;
55     public boolean createdViaCreateXX;
56     public boolean createdViaCreateYY;
57
58     // ------------------------------------------------------------------
59
// SessionBean implementation
60
// ------------------------------------------------------------------
61

62     /**
63      * Set the associated session context. The container calls this method
64      * after the instance creation.
65      * The enterprise Bean instance should store the reference to the context
66      * object in an instance variable.
67      * This method is called with no transaction context.
68      *
69      * @param sessionContext A SessionContext interface for the instance.
70      * @throws EJBException Thrown by the method to indicate a failure caused by
71      * a system-level error.
72      */

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

89     public void ejbRemove() {
90         //logger.log(BasicLevel.DEBUG, "");
91
}
92     
93     /**
94      * The Session bean must define 1 or more ejbCreate methods.
95      *
96      * @throws CreateException Failure to create a session EJB object.
97      */

98     public void ejbCreate() throws CreateException JavaDoc {
99         //logger.log(BasicLevel.DEBUG, "");
100
}
101
102     /**
103      * A container invokes this method on an instance before the instance
104      * becomes disassociated with a specific EJB object.
105      */

106     public void ejbPassivate() {
107         //logger.log(BasicLevel.DEBUG, "");
108
}
109
110     /**
111      * A container invokes this method when the instance is taken out of
112      * the pool of available instances to become associated with a specific
113      * EJB object.
114      */

115     public void ejbActivate() {
116         //logger.log(BasicLevel.DEBUG, "");
117
}
118     
119     // ------------------------------------------------------------------
120
// LocalInterface implementation
121
// ------------------------------------------------------------------
122

123     /**
124      * getTwenty
125      */

126     public int getTwenty() {
127         //logger.log(BasicLevel.DEBUG, "");
128
return 20;
129     }
130
131     /**
132      * lmethod2
133      */

134     public void lmethod2(java.lang.String JavaDoc s) {
135         //logger.log(BasicLevel.DEBUG, "");
136
}
137
138     // ------------------------------------------------------------------
139
// Target implementation
140
// ------------------------------------------------------------------
141

142     /**
143      * getTen
144      */

145     public int getTen() {
146         //logger.log(BasicLevel.DEBUG, "");
147
return 10;
148     }
149
150     /**
151      * method2
152      */

153     public void method2(java.lang.String JavaDoc s) {
154         //logger.log(BasicLevel.DEBUG, "");
155
}
156
157     /**
158      * getNumber
159      * Not called
160      */

161     public int getNumber() {
162         //logger.log(BasicLevel.DEBUG, "");
163
return 0;
164     }
165
166    /**
167      * getString
168      * Not called
169      */

170     public String JavaDoc getString() {
171         //logger.log(BasicLevel.DEBUG, "");
172
return null;
173     }
174
175     /**
176      * isCreatedViaCreateXX
177      * Not called
178      */

179     public boolean isCreatedViaCreateXX() {
180         //logger.log(BasicLevel.DEBUG, "");
181
return false;
182     }
183
184
185 }
186
Popular Tags