KickJava   Java API By Example, From Geeks To Geeks.

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


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 javassist.CtClass;
25
26 import org.jboss.aop.instrument.DynamicTransformationObserver;
27 import org.jboss.aop.instrument.JoinpointClassifier;
28
29
30 /**
31  * Strategy for dealing with dynamic aop related operations.
32  * Decides what must be done when a dynamic operation changes an
33  * interceptor chain.
34  * For dynamic operation we mean the addition or removal of:<ul>
35  * <li> an <code>org.jboss.aop.advice.AdviceBinding</code>
36  * to <code>org.jboss.aop.AspectManager</code>. </li>
37  * <li> an interceptor or interceptor stack to <code>
38  * org.jboss.aop.InstanceAdvisor</code>.</li>
39  * </ul>
40  *
41  * @author Flavia Rainone
42  */

43 public interface DynamicAOPStrategy
44 {
45
46    /**
47     * Return an interceptor chain observer for <code>clazz</code>.
48     * This observer is notified of any changes to an interceptor chain
49     * related to <code>clazz</code>.
50     * @param clazz the <code>clazz</code> whose interceptor chains will
51     * be observed by the observer returned.
52     * @return the interceptor chain observer for <code>clazz</code>. May
53     * return null if the strategy doesn't require an observer at all.
54     */

55    InterceptorChainObserver getInterceptorChainObserver(Class JavaDoc clazz);
56    
57    /**
58     * Notifies the strategy that one or more interceptor chains in the
59     * system may have been updated. It is up to this method to take
60     * appropriate actions when this situation occurs.
61     */

62    void interceptorChainsUpdated();
63    
64    /**
65     * Returns a joinpoint classifier compatible to the strategy.
66     * This joinpoint classifier is the one that should be used by
67     * <code>org.jboss.aop.instrument.Instrumentor</code> instances
68     * to classify joinpoints. This classification is fundamental to
69     * instrumentation algorithm to decide what to do to a joinpoint:
70     * prepare for future interception instrumentation or
71     * instrument for interception.
72     * @return an instance of <code>org.jboss.aop.instrument.JoinpointClassifier</code>.
73     */

74    JoinpointClassifier getJoinpointClassifier();
75    
76    /**
77     * Returns a dynamic transformation observer to be notified of the dynamic
78     * events during the <code>clazz</code> transformation.
79     * @param clazz the clazz whose transformation must be observed.
80     * @see DynamicTransformationObserver
81     */

82     DynamicTransformationObserver getDynamicTransformationObserver(CtClass clazz);
83 }
Popular Tags