01: /**
02: * EasyBeans
03: * Copyright (C) 2006 Bull S.A.S.
04: * Contact: easybeans@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * 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: */package javax.interceptor;
25:
26: import java.lang.reflect.Method;
27: import java.util.Map;
28:
29: /**
30: * Context that is given to all interceptors (business or lifecycle) and that
31: * allow to get information on the current invocation.
32: * @see <a href="http://www.jcp.org/en/jsr/detail?id=220">EJB 3.0 specification</a>
33: * @author Florent Benoit
34: * @since EJB 3.0 version.
35: */
36: public interface InvocationContext {
37:
38: /**
39: * @return the object on which the intercepted method is called.
40: */
41: Object getTarget();
42:
43: /**
44: * @return the method that is intercepted (null for lifecycle interceptors).
45: */
46: Method getMethod();
47:
48: /**
49: * @return the parameters of the intercepted method (if any)
50: */
51: Object[] getParameters();
52:
53: /**
54: * Sets the parameters of the method that is intercepted.
55: * @param params the array of parameters.
56: */
57: void setParameters(Object[] params);
58:
59: /**
60: * @return a Map that is shared by all interceptors for a given method.
61: */
62: Map<String, Object> getContextData();
63:
64: /**
65: * Call the next interceptor in the chain (and at the end it is the intercepted method that is called).
66: * @return the result of the invocation on the intercepted method.
67: * @throws Exception if method invocation fails.
68: */
69: Object proceed() throws Exception;
70:
71: }
|