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: SLSBClassInterceptorTest02.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: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder06Interceptor;
040: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder07Interceptor;
041: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder08Interceptor;
042: import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder09Interceptor;
043:
044: /**
045: * Is used to test if the container call the class interceptors in order.Each method
046: * in appends 0 in the array, the difference amog them is the way that the interceptors
047: * are called.
048: * This class has four class interceptors.
049: * @author Gisele Pinheiro Souza
050: * @author Eduardo Studzinski E. de Castro
051: */
052: @Stateless(name="SLSBClassInterceptorTest02")
053: @Remote(ItfClassInterceptor.class)
054: @Interceptors({PrintOrder06Interceptor.class,PrintOrder07Interceptor.class,PrintOrder08Interceptor.class,PrintOrder09Interceptor.class})
055: public class SLSBClassInterceptorTest02 implements
056: ItfClassInterceptor<Integer> {
057:
058: /**
059: * Appends an Integer with the value 0 in the par.
060: * This method has only class interceptors that must be call in order.
061: * @param par array used to append the value
062: * @return the array with modified
063: */
064: public List<Integer> withoutMethodInterceptor(
065: final List<Integer> par) {
066: par.add(ORDER);
067: return par;
068: }
069:
070: /**
071: * Appends an Integer with the value 0 in the par. This method has only
072: * class interceptors that must be call in order and the default
073: * interceptor(defined in the xml file) must not be executed
074: * @param par array used to append the value
075: * @return the array with modified
076: */
077: @ExcludeDefaultInterceptors
078: public List<Integer> withExcludeDefaultInterceptor(
079: final List<Integer> par) {
080: par.add(ORDER);
081: return par;
082: }
083:
084: /**
085: * Appends an Integer with the value 0 in the par.
086: * This method has the annotation ExcludeClassInterceptor, so the interceptors
087: * must not be executed.
088: * @param par array used to append the value
089: * @return the array with modified
090: */
091: @ExcludeClassInterceptors
092: public List<Integer> withExcludeClassInterceptor(
093: final List<Integer> par) {
094: par.add(ORDER);
095: return par;
096: }
097:
098: /**
099: * Appends an Integer with the value 0 in the par.
100: * This method has the annotation ExcludeClassInterceptor, so only the method
101: * interceptor must not be executed.
102: * @param par array used to append the value
103: * @return the array with modified
104: */
105: @ExcludeClassInterceptors
106: @Interceptors({PrintOrder01Interceptor.class})
107: public List<Integer> excludeClassAndOneMtd(final List<Integer> par) {
108: par.add(ORDER);
109: return par;
110: }
111:
112: /**
113: * Appends an Integer with the value 0 in the par. This method has the
114: * annotations ExcludeClassInterceptor and ExcludeDefaultInterceptor , so
115: * only the method interceptor must not be executed.
116: * @param par array used to append the value
117: * @return the array with modified
118: */
119: @ExcludeClassInterceptors
120: @ExcludeDefaultInterceptors
121: @Interceptors({PrintOrder01Interceptor.class,PrintOrder02Interceptor.class,PrintOrder03Interceptor.class,PrintOrder04Interceptor.class})
122: public List<Integer> excludeClassDefAndFourMtd(
123: final List<Integer> par) {
124: par.add(ORDER);
125: return par;
126: }
127:
128: /**
129: * Appends an Integer with the value 0 in the par.
130: * This method has the class interceptors and the method interceptor,
131: * so all interceptors must not be executed in order.
132: * @param par array used to append the value
133: * @return the array with modified
134: */
135: @Interceptors({PrintOrder01Interceptor.class})
136: public List<Integer> withOneMethodInterceptor(
137: final List<Integer> par) {
138: par.add(ORDER);
139: return par;
140: }
141:
142: /**
143: * Appends an Integer with the value 0 in the par.
144: * This method has the class interceptors and the method interceptors,
145: * so all interceptors must not be executed in order.
146: * @param par array used to append the value
147: * @return the array with modified
148: */
149: @Interceptors({PrintOrder01Interceptor.class,PrintOrder02Interceptor.class,PrintOrder03Interceptor.class})
150: public List<Integer> withThreeMethodInterceptor(
151: final List<Integer> par) {
152: par.add(ORDER);
153: return par;
154: }
155:
156: }
|