001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: SLSBClassInterceptorTest00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder;
025:
026: import java.util.List;
027:
028: import javax.ejb.Remote;
029: import javax.ejb.Stateless;
030: import javax.interceptor.ExcludeClassInterceptors;
031: import javax.interceptor.ExcludeDefaultInterceptors;
032: import javax.interceptor.Interceptors;
033:
034: import org.ow2.easybeans.tests.common.ejbs.base.ItfClassInterceptor;
035: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder01Interceptor;
036: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder02Interceptor;
037: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder03Interceptor;
038: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder04Interceptor;
039:
040: /**
041: * Is used to test if the container call the class interceptors in order.Each
042: * method in appends 0 in the array, the difference amog them is the way that
043: * the interceptors are called. This class has not class interceptors.
044: * @author Gisele Pinheiro Souza
045: * @author Eduardo Studzinski E. de Castro
046: */
047: @Stateless(name="SLSBClassInterceptorTest00")
048: @Remote(ItfClassInterceptor.class)
049: public class SLSBClassInterceptorTest00 implements
050: ItfClassInterceptor<Integer> {
051:
052: /**
053: * Appends an Integer with the value 0 in the par. This method has only
054: * class interceptors that must be call in order.
055: * @param par list used to append the value
056: * @return the list with modified
057: */
058: public List<Integer> withoutMethodInterceptor(
059: final List<Integer> par) {
060: par.add(ORDER);
061: return par;
062: }
063:
064: /**
065: * Appends an Integer with the value 0 in the par. This method has only
066: * class interceptors that must be call in order and the default
067: * interceptor(defined in the xml file) must not be executed
068: * @param par array used to append the value
069: * @return the array with modified
070: */
071: @ExcludeDefaultInterceptors
072: public List<Integer> withExcludeDefaultInterceptor(
073: final List<Integer> par) {
074: par.add(ORDER);
075: return par;
076: }
077:
078: /**
079: * Appends an Integer with the value 0 in the par. This method has the
080: * annotation ExcludeClassInterceptor, so the interceptors must not be
081: * executed.
082: * @param par array used to append the value
083: * @return the array with modified
084: */
085: @ExcludeClassInterceptors
086: public List<Integer> withExcludeClassInterceptor(
087: final List<Integer> par) {
088: par.add(ORDER);
089: return par;
090: }
091:
092: /**
093: * Appends an Integer with the value 0 in the par. This method has the
094: * annotation ExcludeClassInterceptor, so only the method interceptor must
095: * not be executed.
096: * @param par array used to append the value
097: * @return the array with modified
098: */
099: @ExcludeClassInterceptors
100: @Interceptors({PrintOrder01Interceptor.class})
101: public List<Integer> excludeClassAndOneMtd(final List<Integer> 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 array used to append the value
111: * @return the array with modified
112: */
113: @ExcludeClassInterceptors
114: @ExcludeDefaultInterceptors
115: @Interceptors({PrintOrder01Interceptor.class,PrintOrder02Interceptor.class,PrintOrder03Interceptor.class,PrintOrder04Interceptor.class})
116: public List<Integer> excludeClassDefAndFourMtd(
117: final List<Integer> par) {
118: par.add(ORDER);
119: return par;
120: }
121:
122: /**
123: * Appends an Integer with the value 0 in the par. This method has the class
124: * interceptors and the method interceptor, so all interceptors must not be
125: * executed in order.
126: * @param par array used to append the value
127: * @return the array with modified
128: */
129: @Interceptors({PrintOrder01Interceptor.class})
130: public List<Integer> withOneMethodInterceptor(
131: final List<Integer> par) {
132: par.add(ORDER);
133: return par;
134: }
135:
136: /**
137: * Appends an Integer with the value 0 in the par. This method has the class
138: * interceptors and the method interceptors, so all interceptors must not be
139: * executed in order.
140: * @param par array used to append the value
141: * @return the array with modified
142: */
143: @Interceptors({PrintOrder01Interceptor.class,PrintOrder02Interceptor.class,PrintOrder03Interceptor.class})
144: public List<Integer> withThreeMethodInterceptor(
145: final List<Integer> par) {
146: par.add(ORDER);
147: return par;
148: }
149:
150: }
|