01: package org.mockejb.interceptor;
02:
03: import java.lang.reflect.Method;
04: import java.util.List;
05:
06: /**
07: * Keeps the global list of aspects.
08: * Identifies the relevant aspects and interceptors
09: * for the given jointpoint.
10: *
11: * @author Alexander Ananiev
12: */
13: public interface AspectSystem {
14:
15: /**
16: * Adds the given aspect to the end of the global list of aspects.
17: *
18: * @param aspect aspect to add
19: */
20: void add(Aspect aspect);
21:
22: /**
23: * Inserts the given aspect in the beginning of the list of aspects.
24: *
25: * If you want an interceptor for a given pointcut to be called
26: * before other interceptors for the same pointcut, you can use this method.
27: *
28: * @param aspect aspect to add
29: */
30: void addFirst(Aspect aspect);
31:
32: /**
33: * Creates the new aspect and adds it to the end of the list of aspects.
34: *
35: * @param pointcut pointcut of the aspect
36: * @param interceptor interceptor of the aspect
37: */
38: void add(Pointcut pointcut, Interceptor interceptor);
39:
40: /**
41: * Creates the new aspect from the given pointcut and the interceptor
42: * and inserts it in the beginning of the list of aspects.
43: *
44: * If you want an interceptor for a given pointcut to be called
45: * before other interceptors for the same pointcut, you can use this method.
46: *
47: * @param pointcut pointcut of the aspect
48: * @param interceptor interceptor of the aspect
49: */
50: void addFirst(Pointcut pointcut, Interceptor interceptor);
51:
52: /**
53: * Returns the list of aspects to the client. Clients can
54: * manipulate the list.
55: *
56: * @return the list of aspects
57: */
58: List getAspectList();
59:
60: /**
61: * Identifiesaspects whose pointcut matches the given source method or
62: * target method. Returns the list of the interceptors for the matching
63: * pointcuts.
64: *
65: * @param proxyMethod method invoked by the client on the proxy (interface method)
66: * @param targetMethod target method which will be called as the result of the proxy method
67: *
68: * @return list of the interceptors for the matching pointcuts
69: */
70: List findInterceptors(Method proxyMethod, Method targetMethod);
71:
72: /**
73: * Clears the aspect list
74: */
75: void clear();
76:
77: }
|