KickJava   Java API By Example, From Geeks To Geeks.

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


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: SLSBClassInterceptorTest00.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
41 /**
42  * Is used to test if the container call the class interceptors in order.Each
43  * method in appends 0 in the array, the difference amog them is the way that
44  * the interceptors are called. This class has not class interceptors.
45  * @author Gisele Pinheiro Souza
46  * @author Eduardo Studzinski E. de Castro
47  */

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

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

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

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

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

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

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

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