01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.test;
17:
18: import javax.annotation.PostConstruct;
19: import javax.annotation.PreDestroy;
20: import javax.interceptor.AroundInvoke;
21: import javax.interceptor.InvocationContext;
22:
23: import org.apache.openejb.test.interceptor.Interceptor;
24:
25: /**
26: * @author <a href="mailto:goyathlay.geronimo@gmail.com">Prasad Kashyap</a>
27: *
28: * @version $Rev: 607077 $ $Date: 2007-12-27 06:55:23 -0800 $
29: */
30: public class SuperInterceptedBean {
31:
32: /**
33: *
34: */
35: public SuperInterceptedBean() {
36: super ();
37: }
38:
39: /**
40: * The interceptor method.
41: * This should intercept all business methods in this bean class.
42: * It cannot exclude even those annotated with <code>@ExcludeClassInterceptors</code>
43: *
44: * @param ctx - InvocationContext
45: *
46: * @return - the result of the next method invoked. If a method returns void, proceed returns null.
47: * For lifecycle callback interceptor methods, if there is no callback method defined on the bean class,
48: * the invocation of proceed in the last interceptor method in the chain is a no-op, and null is returned.
49: * If there is more than one such interceptor method, the invocation of proceed causes the container to execute those methods in order.
50: *
51: * @throws runtime exceptions or application exceptions that are allowed in the throws clause of the business method.
52: */
53: @AroundInvoke
54: public Object super BeanInterceptor(InvocationContext ctx)
55: throws Exception {
56: Interceptor.profile(ctx, "superBeanInterceptor");
57: return ctx.proceed();
58: }
59:
60: /**
61: * The interceptor method.
62: * This should intercept postConstruct of the bean
63: *
64: * @throws runtime exceptions.
65: */
66: @PostConstruct
67: public void super BeanInterceptorPostConstruct() throws Exception {
68: Interceptor.profile(this , "superBeanInterceptorPostConstruct");
69: return;
70: }
71:
72: /**
73: * The interceptor method.
74: * This should intercept preDestroy of the bean.
75: *
76: * @throws runtime exceptions.
77: */
78: @PreDestroy
79: public void super BeanInterceptorPreDestroy() throws Exception {
80: Interceptor.profile(this , "superBeanInterceptorPreDestroy");
81: return;
82: }
83:
84: }
|