KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateless > containermanaged > simpleentry > SLSBSimpleEnvEntryInheritance


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: SLSBSimpleEnvEntryInheritance.java 821 2006-07-04 13:28:52Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.simpleentry;
26
27 import static org.objectweb.easybeans.tests.common.helper.ContextHelper.checkSimpleEntry;
28
29 import javax.annotation.Resource;
30 import javax.ejb.Remote JavaDoc;
31 import javax.ejb.SessionContext JavaDoc;
32 import javax.ejb.Stateless JavaDoc;
33
34 import org.objectweb.easybeans.tests.common.ejbs.base.ItfSimpleEnvEntry;
35 import org.objectweb.easybeans.tests.common.ejbs.base.simpleentry.EBaseSimpleEnvEntry00;
36
37
38 /**
39  * This bean is used to test annotation resource with inheritance.
40  * @author Eduardo Studzinski Estima de Castro
41  * @author Gisele Pinheiro Souza
42  *
43  */

44 @Stateless JavaDoc(name="SLSBSimpleEnvEntryInheritance")
45 @Remote JavaDoc(ItfSimpleEnvEntry.class)
46 public class SLSBSimpleEnvEntryInheritance extends EBaseSimpleEnvEntry00{
47
48     /**
49      * SessionContext.
50      */

51     @Resource
52     private SessionContext JavaDoc sessionContext;
53
54     /**
55      * The default value must be injected by the container.
56      */

57     @Resource(name = "str01")
58     private String JavaDoc strInjection;
59
60     /**
61      * This value overrides the inherited field.
62      */

63     @Resource(name = "chr01")
64     public char chrInjection;
65
66     /**
67      * The default value must be injected by the container.
68      */

69     @Resource(name = "bol00")
70     public boolean bolInjection;
71
72     /**
73      * Property inicialized by an injection.
74      */

75     private byte bteInjection;
76
77     /**
78      * Property inicialized by an injection.
79      */

80     private short shrInjection;
81
82     /**
83      * The default value must be injected by the container.
84      * @param value information value
85      */

86     @Resource(name = "bte01")
87     private void setBteInjection(final byte value){
88         bteInjection = value;
89     }
90
91     /**
92      * The default value must be injected by the container.
93      * @param value information value
94      */

95     @Resource(name = "shr01")
96     protected void setShrInjection(final short value){
97         shrInjection = value;
98     }
99
100     /**
101      * Checks if the injection is working in this class and in the superclass.
102      */

103     @Override JavaDoc
104     public void checkString00() {
105         checkSimpleEntry(sessionContext, "str01", strInjection, ENTRY_STRING_1);
106         super.checkString00();
107     }
108
109     /**
110      * Tests if the overriding is working. The value must be the ENTRY_CHARACTER_1 value.
111      */

112     @SuppressWarnings JavaDoc("boxing")
113     @Override JavaDoc
114     public void checkCharacter00(){
115         checkSimpleEntry(sessionContext, "chr01", chrInjection, ENTRY_CHARACTER_1);
116         super.checkCharacter00();
117     }
118
119     /**
120      * Tests if the resource annotation is working in the superclass.
121      */

122     @SuppressWarnings JavaDoc("boxing")
123     @Override JavaDoc
124     public void checkInteger00(){
125         super.checkInteger00();
126     }
127
128     /**
129      * Tests if the resource annotation is working in this class and if the value is not overridded in the superclass.
130      */

131     @SuppressWarnings JavaDoc("boxing")
132     @Override JavaDoc
133     public void checkBoolean00(){
134         checkSimpleEntry(sessionContext, "bol00", bolInjection, ENTRY_BOOLEAN);
135         super.checkBoolean00();
136     }
137
138     /**
139      * Tests if the resource annotation is working in the superclass.
140      */

141     @SuppressWarnings JavaDoc("boxing")
142     @Override JavaDoc
143     public void checkDouble00(){
144         super.checkDouble00();
145     }
146
147     /**
148      * Tests if the resource annotation is working in this class and if the value is not overridded in the superclass.
149      */

150     @SuppressWarnings JavaDoc("boxing")
151     @Override JavaDoc
152     public void checkByte00(){
153         checkSimpleEntry(sessionContext, "bte01", bteInjection, ENTRY_BYTE_1);
154         super.checkByte00();
155     }
156
157     /**
158      * Tests if the resource annotation is working in this class and if the value is not overridded in the superclass.
159      */

160     @SuppressWarnings JavaDoc("boxing")
161     @Override JavaDoc
162     public void checkShort00(){
163         checkSimpleEntry(sessionContext, "shr01", shrInjection, ENTRY_SHORT_1);
164         super.checkShort00();
165     }
166
167 }
168
Popular Tags