KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aop > InterceptorChainObserver


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.aop;
23
24 import gnu.trove.TLongObjectHashMap;
25
26 import org.jboss.aop.advice.Interceptor;
27
28 /**
29  * Observes all the interceptor chains related to a class.
30  * There is only one <code>InterceptorChainObserver</code>
31  * per advisor.
32  * @author Flavia Rainone
33  */

34 interface InterceptorChainObserver
35 {
36    /**
37     * This method must be called before any other notification method is invoked.
38     * It notifies the initial state of the interceptor chains.
39     * @param fieldReadInterceptors interceptor chains to be applied at fields' reads.
40     * @param fieldWriteInterceptors interceptor chains to be applied at fields' writes.
41     * @param constructorInterceptors interceptor chains to be applied at constructors' executions.
42     * @param methodInterceptors interceptor chains to be applied at methods' executions.
43     * @param clazz the reflection class whose joinpoints the interceptor chains will be applied to.
44     */

45    public void initialInterceptorChains(Class JavaDoc clazz, Interceptor[][] fieldReadInterceptors, Interceptor[][] fieldWriteInterceptors,
46          Interceptor[][] constructorInterceptors, TLongObjectHashMap methodInterceptors);
47
48    /**
49     * Notifies the observer that the class interceptor chains were updated.
50     * @param newFieldReadInterceptors new interceptor chains to be applied at fields' reads.
51     * @param newFieldWriteInterceptors new interceptor chains to be applied at fields' writes.
52     * @param newConstructorInterceptors new interceptor chains to be applied at constructors' executions.
53     * @param newMethodInterceptors new interceptor chains to be applied at methods' executions.
54     */

55    public void interceptorChainsUpdated(Interceptor[][] newFieldReadInterceptors, Interceptor[][] newFieldWriteInterceptors,
56          Interceptor[][] newConstructorInterceptors, TLongObjectHashMap newMethodInterceptors);
57    
58    /**
59     * Notifies that an interceptor was added to an instance of
60     * the class associated to this observer.
61     * @param instanceAdvisor <code>org.jboss.aop.InstanceAdvisor</code> of the intercepted instance.
62     */

63    public void instanceInterceptorAdded(InstanceAdvisor instanceAdvisor);
64
65    /**
66     * Notifies that <code>howMany</code> interceptors were added to an instance of
67     * the class associated to this observer.
68     * @param instanceAdvisor <code>org.jboss.aop.InstanceAdvisor</code> of the intercepted instance.
69     * @param howMany the number of added interceptors.
70     */

71    public void instanceInterceptorsAdded(InstanceAdvisor instanceAdvisor, int howMany);
72    
73    /**
74     * Notifies that an interceptor was removed from an instance of
75     * the class associated to this observer.
76     * @param instanceAdvisor <code>org.jboss.aop.InstanceAdvisor</code> of the intercepted instance.
77     */

78    public void instanceInterceptorRemoved(InstanceAdvisor instanceAdvisor);
79    
80    /**
81     * Notifies that <code>howMany</code> interceptors were removed from an instance of
82     * the class associated to this observer.
83     * @param instanceAdvisor <code>org.jboss.aop.InstanceAdvisor</code> of the intercepted instance.
84     * @param howMany the number of removed interceptors
85     */

86    public void instanceInterceptorsRemoved(InstanceAdvisor instanceAdvisor, int howMany);
87    
88    /**
89     * Notifies that all interceptors of an instance of
90     * the class associated to this observer were removed.
91     * @param instanceAdvisor <code>org.jboss.aop.InstanceAdvisor</code> of the intercepted instance.
92     */

93    public void allInstanceInterceptorsRemoved(InstanceAdvisor instanceAdvisor);
94 }
Popular Tags