KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > controls > spi > svc > Interceptor


1 package org.apache.beehive.controls.spi.svc;
2 /*
3  * Copyright 2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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  *
17  * $Header:$
18  */

19
20 import org.apache.beehive.controls.api.bean.ControlBean;
21
22 import java.lang.reflect.Method JavaDoc;
23
24 /**
25  * The controls implementation architecture has a interceptor model for
26  * adding annotation-based features. This model provides the ability to
27  * associate a JavaBeans service interface with an annotation to define
28  * its runtime feature behaviour. Such interfaces must extend this
29  * Interceptor interface, which defines the contract that the controls runtime
30  * has with interceptors.
31  *
32  * The controls runtime will automatically instantiate and execute
33  * implementations of interceptors at the appropriate execution points
34  * (pre/post invocation of a control operation, etc).
35  *
36  * A return value of "true" from each Interceptor method indicates to the runtime
37  * that it should continue execution through the normal flow of control (ie, subsequent
38  * interceptors and operation/event execution). "false" indicates that the interceptor
39  * has fully processed the operation and the runtime should "pivot" out.
40  */

41 public interface Interceptor
42 {
43     /** Called before a control operation is invoked */
44     public void preInvoke( ControlBean cb, Method JavaDoc m, Object JavaDoc [] args)
45         throws InterceptorPivotException;
46     /** Called after a control operation is invoked */
47     public void postInvoke( ControlBean cb, Method JavaDoc m, Object JavaDoc [] args, Object JavaDoc retval, Throwable JavaDoc t );
48
49     /** Called before a control event is fired (through a client proxy) */
50     public void preEvent( ControlBean cb, Class JavaDoc eventSet, Method JavaDoc m, Object JavaDoc [] args )
51         throws InterceptorPivotException;
52     /** Called after a control event is fired (through a client proxy) */
53     public void postEvent( ControlBean cb, Class JavaDoc eventSet, Method JavaDoc m, Object JavaDoc [] args);
54 }
55
Popular Tags