KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > interceptor > InvocationContext


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: InvocationContext.java 1100 2006-08-16 13:05:31Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package javax.interceptor;
27
28 import java.lang.reflect.Method JavaDoc;
29 import java.util.Map JavaDoc;
30
31 /**
32  * Context that is given to all interceptors (business or lifecycle) and that
33  * allow to get information on the current invocation.
34  * @see <a HREF="http://www.jcp.org/en/jsr/detail?id=220">EJB 3.0 specification</a>
35  * @author Florent Benoit
36  * @since EJB 3.0 version.
37  */

38 public interface InvocationContext {
39
40     /**
41      * @return the object on which the intercepted method is called.
42      */

43     Object JavaDoc getTarget();
44
45     /**
46      * @return the method that is intercepted (null for lifecycle interceptors).
47      */

48     Method JavaDoc getMethod();
49
50     /**
51      * @return the parameters of the intercepted method (if any)
52      */

53     Object JavaDoc[] getParameters();
54
55     /**
56      * Sets the parameters of the method that is intercepted.
57      * @param params the array of parameters.
58      */

59     void setParameters(Object JavaDoc[] params);
60
61     /**
62      * @return a Map that is shared by all interceptors for a given method.
63      */

64     Map JavaDoc<String JavaDoc, Object JavaDoc> getContextData();
65
66     /**
67      * Call the next interceptor in the chain (and at the end it is the intercepted method that is called).
68      * @return the result of the invocation on the intercepted method.
69      * @throws Exception if method invocation fails.
70      */

71     Object JavaDoc proceed() throws Exception JavaDoc;
72
73
74 }
75
Popular Tags