001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.test.interceptor;
017:
018: import javax.interceptor.InvocationContext;
019:
020: /**
021: * @author <a href="mailto:goyathlay.geronimo@gmail.com">Prasad Kashyap</a>
022: *
023: * @version $Rev: 607077 $ $Date: 2007-12-27 06:55:23 -0800 $
024: */
025: public class DDInterceptor {
026:
027: /**
028: * The interceptor method.
029: * This should intercept all business methods in this bean class
030: * except those annotated with <code>@ExcludeddInterceptors</code>
031: *
032: * @param ctx - InvocationContext
033: *
034: * @return - the result of the next method invoked. If a method returns void, proceed returns null.
035: * For lifecycle callback interceptor methods, if there is no callback method defined on the bean class,
036: * the invocation of proceed in the last interceptor method in the chain is a no-op, and null is returned.
037: * If there is more than one such interceptor method, the invocation of proceed causes the container to execute those methods in order.
038: *
039: * @throws runtime exceptions or application exceptions that are allowed in the throws clause of the business method.
040: */
041: public Object ddInterceptor(InvocationContext ctx) throws Exception {
042: Interceptor.profile(ctx, "ddInterceptor");
043: return ctx.proceed();
044: }
045:
046: /**
047: * The interceptor method.
048: * This should intercept postConstruct of the bean
049: *
050: * @param ctx - InvocationContext
051: *
052: * @throws runtime exceptions.
053: */
054: public void ddInterceptorPostConstruct(InvocationContext ctx)
055: throws Exception {
056: Interceptor.profile(ctx, "ddInterceptorPostConstruct");
057: ctx.proceed();
058: return;
059: }
060:
061: /**
062: * The interceptor method.
063: * This should intercept postActivate of the bean
064: *
065: * @param ctx - InvocationContext
066: *
067: * @throws runtime exceptions.
068: */
069: public void ddInterceptorPostActivate(InvocationContext ctx)
070: throws Exception {
071: Interceptor.profile(ctx, "ddInterceptorPostActivate");
072: ctx.proceed();
073: return;
074: }
075:
076: /**
077: * The interceptor method.
078: * This should intercept prePassivate of the bean.
079: *
080: * @param ctx - InvocationContext
081: *
082: * @throws runtime exceptions.
083: */
084: public void ddInterceptorPrePassivate(InvocationContext ctx)
085: throws Exception {
086: Interceptor.profile(ctx, "ddInterceptorPrePassivate");
087: ctx.proceed();
088: return;
089: }
090:
091: /**
092: * The interceptor method.
093: * This should intercept preDestroy of the bean.
094: *
095: * @param ctx - InvocationContext
096: *
097: * @throws runtime exceptions.
098: */
099: public void ddInterceptorPreDestroy(InvocationContext ctx)
100: throws Exception {
101: Interceptor.profile(ctx, "ddInterceptorPreDestroy");
102: ctx.proceed();
103: return;
104: }
105:
106: }
|