01: /*
02: * JFox - The most lightweight Java EE Application Server!
03: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
04: *
05: * JFox is licenced and re-distributable under GNU LGPL.
06: */
07: package org.jfox.ejb3.interceptor;
08:
09: import java.lang.reflect.InvocationTargetException;
10: import java.lang.reflect.Method;
11: import javax.interceptor.InvocationContext;
12:
13: /**
14: * Business Method to invoke
15: *
16: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
17: */
18: public class BusinessInterceptorMethod implements InterceptorMethod {
19:
20: private Method businessMethod;
21:
22: public BusinessInterceptorMethod(Method businessMethod) {
23: this .businessMethod = businessMethod;
24: }
25:
26: public Object invoke(InvocationContext invocationContext)
27: throws Exception {
28: try {
29: return businessMethod.invoke(invocationContext.getTarget(),
30: invocationContext.getParameters());
31: } catch (InvocationTargetException e) {
32: throw (Exception) e.getTargetException();
33: }
34: }
35:
36: public static void main(String[] args) {
37:
38: }
39: }
|