KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateless > containermanaged > invocationcontext > SLSBInvocationContext00


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: SLSBInvocationContext00.java 880 2006-07-17 11:51:17Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.invocationcontext;
26
27 import javax.ejb.Remote JavaDoc;
28 import javax.ejb.Stateless JavaDoc;
29 import javax.interceptor.ExcludeClassInterceptors;
30 import javax.interceptor.Interceptors;
31
32 import org.objectweb.easybeans.tests.common.ejbs.base.invocationcontext.ItfInvocation00;
33 import org.objectweb.easybeans.tests.common.interceptors.invocationcontext.InvocationInterceptor00;
34
35 /**
36  * This bean is used to manipulate the invocation context object.
37  * @author Eduardo Studzinski E. de Castro
38  * @author Gisele Pinheiro Souza
39  */

40 @Stateless JavaDoc
41 @Remote JavaDoc
42 @Interceptors({InvocationInterceptor00.class})
43 public class SLSBInvocationContext00 implements ItfInvocation00 {
44
45     /**
46      * Information from interceptor.
47      */

48     private Integer JavaDoc interceptorInfo = new Integer JavaDoc(0);
49
50     /**
51      * Verifies if the Interceptor.getTarget() returns an object with the same
52      * hashcode of the bean instance.
53      */

54     public void check() {
55         if (interceptorInfo.intValue() != this.hashCode()) {
56             throw new IllegalStateException JavaDoc("The referenced bean is not equal as the invocation context reference.");
57         }
58     }
59
60     /**
61      * Allows the interceptor to store an information in the bean.
62      * @param o information
63      */

64     @ExcludeClassInterceptors
65     public void setInterceptorInfo(final Object JavaDoc o) {
66         interceptorInfo = (Integer JavaDoc) o;
67     }
68 }
69
Popular Tags