KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > base > simpleentry > EBaseSimpleEnvEntry00


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@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: EBaseSimpleEnvEntry00.java 821 2006-07-04 13:28:52Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.base.simpleentry;
26
27 import static org.objectweb.easybeans.tests.common.helper.ContextHelper.checkSimpleEntry;
28
29 import javax.annotation.Resource;
30 import javax.ejb.SessionContext JavaDoc;
31
32 import org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry;
33
34 /**
35  * This class is used to test inheritance and the annotation Resource.
36  * @author Eduardo Studzinski Estima de Castro
37  * @author Gisele Pinheiro Souza
38  */

39 public class EBaseSimpleEnvEntry00 implements ItfSimpleEnvEntry {
40
41     /**
42      * SessionContext.
43      */

44     @Resource
45     private SessionContext JavaDoc sessionContext;
46
47     /**
48      * The default value must be injected by the container.
49      */

50     @Resource(name = "str00")
51     private String JavaDoc strInjection;
52
53     /**
54      * The default value must be injected by the container.
55      */

56     @Resource(name = "chr00")
57     public char chrInjection;
58
59     /**
60      * The default value must be injected by the container.
61      */

62     @Resource(name = "int00")
63     private int intInjection;
64
65     /**
66      * Boolean with FALSE value.
67      */

68     public boolean bolInjection = false;
69
70     /**
71      * Property inicialized by an injection.
72      */

73     private double dblInjection;
74
75     /**
76      * Property inicialized by an injection.
77      */

78     private byte bteInjection;
79
80     /**
81      * Property inicialized by an injection.
82      */

83     private short shrInjection;
84
85     /**
86      * Property inicialized by an injection.
87      */

88     private long lngInjection;
89
90     /**
91      * Property inicialized by an injection.
92      */

93     private float fltInjection;
94
95     /**
96      * The default value must be injected by the container.
97      * @param value information value
98      */

99     @Resource(name = "dbl00")
100     public void setDblInjection(final double value) {
101         dblInjection = value;
102     }
103
104     /**
105      * The default value must be injected by the container.
106      * @param value information value
107      */

108     @Resource(name = "bte00")
109     private void setBteInjection(final byte value) {
110         bteInjection = value;
111     }
112
113     /**
114      * The default value must be injected by the container.
115      * @param value information value
116      */

117     @Resource(name = "shr00")
118     private void setShrInjection(final short value) {
119         shrInjection = value;
120     }
121
122     /**
123      * The default value must be injected by the container.
124      * @param value information value
125      */

126     @Resource(name = "lng00")
127     protected void setLngInjection(final long value) {
128         lngInjection = value;
129     }
130
131     /**
132      * The default value must be injected by the container. The name must be
133      * generated by the container: class name/field name.
134      * @param value information value
135      */

136     @Resource
137     void setFltInjection(final float value) {
138         fltInjection = value;
139     }
140
141     /**
142      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry
143      */

144     public void checkString00() {
145         checkSimpleEntry(sessionContext, "str00", strInjection, ENTRY_STRING);
146     }
147
148     /**
149      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry
150      */

151     @SuppressWarnings JavaDoc("boxing")
152     public void checkCharacter00() {
153         checkSimpleEntry(sessionContext, "chr00", chrInjection, ENTRY_CHARACTER);
154     }
155
156     /**
157      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry
158      */

159     @SuppressWarnings JavaDoc("boxing")
160     public void checkInteger00() {
161         checkSimpleEntry(sessionContext, "int00", intInjection, ENTRY_INTEGER);
162     }
163
164     /**
165      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry
166      */

167     @SuppressWarnings JavaDoc("boxing")
168     public void checkBoolean00() {
169         if (bolInjection) {
170             throw new IllegalStateException JavaDoc("The value should be false.");
171         }
172     }
173
174     /**
175      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry
176      */

177     @SuppressWarnings JavaDoc("boxing")
178     public void checkDouble00() {
179         checkSimpleEntry(sessionContext, "dbl00", dblInjection, ENTRY_DOUBLE);
180     }
181
182     /**
183      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry
184      */

185     @SuppressWarnings JavaDoc("boxing")
186     public void checkByte00() {
187         checkSimpleEntry(sessionContext, "bte00", bteInjection, ENTRY_BYTE);
188     }
189
190     /**
191      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry
192      */

193     @SuppressWarnings JavaDoc("boxing")
194     public void checkShort00() {
195         checkSimpleEntry(sessionContext, "shr00", shrInjection, ENTRY_SHORT);
196     }
197
198     /**
199      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry The
200      * setter method has protected modifier.
201      */

202     @SuppressWarnings JavaDoc("boxing")
203     public void checkLong00() {
204         checkSimpleEntry(sessionContext, "lng00", lngInjection, ENTRY_LONG);
205     }
206
207     /**
208      * @see org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry The
209      * setter method has package modifier.
210      */

211     @SuppressWarnings JavaDoc("boxing")
212     public void checkFloat00() {
213         checkSimpleEntry(sessionContext, EBaseSimpleEnvEntry00.class.getName().toString() + "/" + "fltInjection",
214                 fltInjection, ENTRY_FLOAT);
215     }
216
217 }
218
Popular Tags