KickJava   Java API By Example, From Geeks To Geeks.

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


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: TargetSF.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  * Stateful Session
44  * @author Philippe Durieux, Philippe Coq
45  */

46 public class TargetSF extends TargetSL {
47
48     public String JavaDoc string;
49     public int number;
50     public boolean createdViaCreateXX;
51     public boolean createdViaCreateYY;
52     
53     /**
54      * The Session bean must define 1 or more ejbCreate methods.
55      *
56      * @throws CreateException Failure to create a session EJB object.
57      */

58     public void ejbCreate() throws CreateException JavaDoc {
59         // logger.log(BasicLevel.DEBUG, "");
60
string = "";
61         number = 0;
62         createdViaCreateXX = false;
63         createdViaCreateYY = false;
64     }
65
66     
67     /**
68      * ejbCreate methods with parameter
69      *
70      * @throws CreateException Failure to create a session EJB object.
71      */

72     public void ejbCreate(String JavaDoc s, int n) throws CreateException JavaDoc {
73         // logger.log(BasicLevel.DEBUG, "");
74
string = s;
75         number = n;
76         createdViaCreateXX = false;
77         createdViaCreateYY = false;
78     }
79
80         
81     /**
82      * ejbCreate methods for a create<METHOD>
83      *
84      * @throws CreateException Failure to create a session EJB object.
85      */

86     public void ejbCreateXX(String JavaDoc s, int n) throws CreateException JavaDoc {
87         //logger.log(BasicLevel.DEBUG, "");
88
string = s;
89         number = n;
90         createdViaCreateXX = true;
91         createdViaCreateYY = false;
92     }
93
94     /**
95      * ejbCreate methods for a Local create<METHOD>
96      *
97      * @throws CreateException Failure to create a session EJB object.
98      */

99     public void ejbCreateYY(String JavaDoc s, int n) throws CreateException JavaDoc {
100         //logger.log(BasicLevel.DEBUG, "");
101
string = s;
102         number = n;
103         createdViaCreateXX = false;
104         createdViaCreateYY = true;
105     }
106
107
108     // ------------------------------------------------------------------
109
// Target implementation
110
// ------------------------------------------------------------------
111

112     /**
113      * getNumber
114      */

115     public int getNumber() {
116         //logger.log(BasicLevel.DEBUG, "");
117
return number;
118     }
119
120    /**
121      * getString
122      */

123     public String JavaDoc getString() {
124         //logger.log(BasicLevel.DEBUG, "");
125
return string;
126     }
127
128     /**
129      * isCreatedViaCreateXX
130      */

131     public boolean isCreatedViaCreateXX() {
132         //logger.log(BasicLevel.DEBUG, "");
133
return createdViaCreateXX;
134     }
135
136     // ------------------------------------------------------------------
137
// TargetLocal implementation
138
// ------------------------------------------------------------------
139

140     /**
141      * isCreatedViaCreateYY
142      */

143     public boolean isCreatedViaCreateYY() {
144         //logger.log(BasicLevel.DEBUG, "");
145
return createdViaCreateYY;
146     }
147 }
148
Popular Tags