KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateless > containermanaged > interceptororder > SLSBClassInterceptorTest01


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: SLSBClassInterceptorTest01.java 820 2006-07-04 12:37:48Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder;
26
27 import java.util.List JavaDoc;
28
29 import javax.ejb.Remote JavaDoc;
30 import javax.ejb.Stateless JavaDoc;
31 import javax.interceptor.ExcludeClassInterceptors;
32 import javax.interceptor.ExcludeDefaultInterceptors;
33 import javax.interceptor.Interceptors;
34
35 import org.objectweb.easybeans.tests.common.ejbs.base.ItfClassInterceptor;
36 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder01Interceptor;
37 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder02Interceptor;
38 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder03Interceptor;
39 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder04Interceptor;
40 import org.objectweb.easybeans.tests.common.interceptors.business.order.PrintOrder06Interceptor;
41
42 /**
43  * Is used to test if the container call the class interceptors in order.Each method
44  * in appends 0 in the array, the difference amog them is the way that the interceptors
45  * are called.
46  * This class has only one class interceptor.
47  * @author Gisele Pinheiro Souza
48  * @author Eduardo Studzinski E. de Castro
49  */

50 @Stateless JavaDoc(name="SLSBClassInterceptorTest01")
51 @Remote JavaDoc(ItfClassInterceptor.class)
52 @Interceptors({PrintOrder06Interceptor.class})
53 public class SLSBClassInterceptorTest01 implements ItfClassInterceptor<Integer JavaDoc>{
54
55     /**
56      * Appends an Integer with the value 0 in the par.
57      * This method has only class interceptors that must be call in order.
58      * @param par list used to append the value
59      * @return the list with modified
60      */

61     public List JavaDoc<Integer JavaDoc> withoutMethodInterceptor(final List JavaDoc<Integer JavaDoc> par) {
62         par.add(ORDER);
63         return par;
64     }
65
66     /**
67      * Appends an Integer with the value 0 in the par. This method has only
68      * class interceptors that must be call in order and the default
69      * interceptor(defined in the xml file) must not be executed
70      * @param par list used to append the value
71      * @return the list with modified
72      */

73     @ExcludeDefaultInterceptors
74     public List JavaDoc<Integer JavaDoc> withExcludeDefaultInterceptor(final List JavaDoc<Integer JavaDoc> par) {
75         par.add(ORDER);
76         return par;
77     }
78
79     /**
80      * Appends an Integer with the value 0 in the par.
81      * This method has the annotation ExcludeClassInterceptor, so the interceptors
82      * must not be executed.
83      * @param par list used to append the value
84      * @return the list with modified
85      */

86     @ExcludeClassInterceptors
87     public List JavaDoc<Integer JavaDoc> withExcludeClassInterceptor(final List JavaDoc<Integer JavaDoc> par) {
88         par.add(ORDER);
89         return par;
90     }
91
92     /**
93      * Appends an Integer with the value 0 in the par.
94      * This method has the annotation ExcludeClassInterceptor, so only the method
95      * interceptor must not be executed.
96      * @param par list used to append the value
97      * @return the list with modified
98      */

99     @ExcludeClassInterceptors
100     @Interceptors({PrintOrder01Interceptor.class})
101     public List JavaDoc<Integer JavaDoc> excludeClassAndOneMtd(final List JavaDoc<Integer JavaDoc> par) {
102         par.add(ORDER);
103         return par;
104     }
105
106     /**
107      * Appends an Integer with the value 0 in the par. This method has the
108      * annotations ExcludeClassInterceptor and ExcludeDefaultInterceptor , so
109      * only the method interceptor must not be executed.
110      * @param par list used to append the value
111      * @return the list with modified
112      */

113     @ExcludeClassInterceptors
114     @ExcludeDefaultInterceptors
115     @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class, PrintOrder03Interceptor.class,
116             PrintOrder04Interceptor.class})
117     public List JavaDoc<Integer JavaDoc> excludeClassDefAndFourMtd(final List JavaDoc<Integer JavaDoc> par) {
118         par.add(ORDER);
119         return par;
120     }
121
122     /**
123      * Appends an Integer with the value 0 in the par.
124      * This method has the class interceptors and the method interceptor,
125      * so all interceptors must not be executed in order.
126      * @param par list used to append the value
127      * @return the list with modified
128      */

129     @Interceptors({PrintOrder01Interceptor.class})
130     public List JavaDoc<Integer JavaDoc> withOneMethodInterceptor(final List JavaDoc<Integer JavaDoc> par) {
131         par.add(ORDER);
132         return par;
133     }
134
135     /**
136      * Appends an Integer with the value 0 in the par.
137      * This method has the class interceptors and the method interceptors,
138      * so all interceptors must not be executed in order.
139      * @param par list used to append the value
140      * @return the list with modified
141      */

142     @Interceptors({PrintOrder01Interceptor.class, PrintOrder02Interceptor.class, PrintOrder03Interceptor.class})
143     public List JavaDoc<Integer JavaDoc> withThreeMethodInterceptor(final List JavaDoc<Integer JavaDoc> par) {
144         par.add(ORDER);
145         return par;
146     }
147
148 }
149
Popular Tags