KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > flocal > 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.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
47  */

48 public class SimpleSessionSL implements SessionBean JavaDoc {
49
50  
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
75     ejbContext = ctx;
76     }
77     
78     /**
79      * A container invokes this method before it ends the life of the session object.
80      * This happens as a result of a client's invoking a remove operation, or when a
81      * container decides to terminate the session object after a timeout.
82      * This method is called with no transaction context.
83      *
84      * @throws EJBException Thrown by the method to indicate a failure caused by
85      * a system-level error.
86      */

87     public void ejbRemove() {
88
89     }
90     
91     /**
92      * The Session bean must define 1 or more ejbCreate methods.
93      *
94      * @throws CreateException Failure to create a session EJB object.
95      */

96     public void ejbCreate() throws CreateException JavaDoc {
97
98     }
99
100     /**
101      * A container invokes this method on an instance before the instance
102      * becomes disassociated with a specific EJB object.
103      */

104     public void ejbPassivate() {
105
106     }
107
108     /**
109      * A container invokes this method when the instance is taken out of
110      * the pool of available instances to become associated with a specific
111      * EJB object.
112      */

113     public void ejbActivate() {
114
115     }
116     
117     // ------------------------------------------------------------------
118
// Target implementation
119
// ------------------------------------------------------------------
120

121     /**
122      * getTen
123      */

124     public int getTen() {
125
126         return 10;
127     }
128
129     /**
130      * method2
131      */

132     public void method2(java.lang.String JavaDoc s) {
133
134     }
135
136     /**
137      * getNumber
138      * Not called
139      */

140     public int getNumber() {
141
142         return 0;
143     }
144
145    /**
146      * getString
147      * Not called
148      */

149     public String JavaDoc getString() {
150
151         return null;
152     }
153
154     /**
155      * isCreatedViaCreateXX
156      * Not called
157      */

158     public boolean isCreatedViaCreateXX() {
159
160         return false;
161     }
162
163
164 }
165
Popular Tags