├── README.md ├── aopalliance ├── build.xml └── src │ └── main │ └── org │ └── aopalliance │ ├── aop │ ├── Advice.java │ ├── AspectException.java │ └── package.html │ ├── instrument │ ├── Instrumentation.java │ ├── InstrumentationError.java │ ├── Instrumentor.java │ ├── UndoNotSupportedException.java │ └── package.html │ ├── intercept │ ├── ConstructorInterceptor.java │ ├── ConstructorInvocation.java │ ├── FieldAccess.java │ ├── FieldInterceptor.java │ ├── Interceptor.java │ ├── Invocation.java │ ├── Joinpoint.java │ ├── MethodInterceptor.java │ ├── MethodInvocation.java │ └── package.html │ └── reflect │ ├── Class.java │ ├── ClassLocator.java │ ├── Code.java │ ├── CodeLocator.java │ ├── Field.java │ ├── Locator.java │ ├── Member.java │ ├── Metadata.java │ ├── Method.java │ ├── ProgramUnit.java │ ├── UnitLocator.java │ └── package.html ├── aopi-pre-spec ├── doc │ ├── figures │ │ ├── aop-model.fig │ │ └── packages.fig │ └── gendoc └── src │ └── aopi │ ├── conf │ ├── ConfigurationParser.java │ └── package.html │ ├── modif │ ├── Modification.java │ ├── ProgramModifier.java │ └── package.html │ ├── package.html │ ├── reflect │ ├── Class.java │ ├── ClassLocator.java │ ├── Code.java │ ├── CodeLocator.java │ ├── Field.java │ ├── Locator.java │ ├── Member.java │ ├── Metadata.java │ ├── Method.java │ ├── ProgramUnit.java │ ├── UnitLocator.java │ └── package.html │ └── weaving │ ├── DynamicWeaver.java │ ├── Weaver.java │ └── package.html └── www ├── basic.css ├── index.html ├── members.html └── motivations.html /README.md: -------------------------------------------------------------------------------- 1 | AOP Alliance source code 2 | ======================== 3 | 4 | Download from http://aopalliance.cvs.sourceforge.net/viewvc/aopalliance/ 5 | -------------------------------------------------------------------------------- /aopalliance/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 40 | 41 | 46 | 47 | 48 | 49 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/aop/Advice.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.aop; 3 | 4 | /** 5 | * Tag interface for Advice. Implementations can be any type 6 | * of advice, such as Interceptors. 7 | * @author Rod Johnson 8 | * @version $Id: Advice.java,v 1.1 2004/03/19 17:02:16 johnsonr Exp $ 9 | */ 10 | public interface Advice { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/aop/AspectException.java: -------------------------------------------------------------------------------- 1 | package org.aopalliance.aop; 2 | 3 | import java.io.PrintStream; 4 | import java.io.PrintWriter; 5 | import java.io.StringWriter; 6 | 7 | /** 8 | * Superclass for all AOP infrastructure exceptions. 9 | * Unchecked, as such exceptions are fatal and end user 10 | * code shouldn't be forced to catch them. 11 | * 12 | * @author Rod Johnson 13 | * @author Bob Lee 14 | */ 15 | public class AspectException extends RuntimeException { 16 | 17 | private String message; 18 | 19 | private String stackTrace; 20 | 21 | private Throwable t; 22 | 23 | /** 24 | * Constructor for AspectException. 25 | * @param s 26 | */ 27 | public AspectException(String s) { 28 | super(s); 29 | this.message = s; 30 | this.stackTrace = s; 31 | } 32 | 33 | /** 34 | * Constructor for AspectException. 35 | * @param s 36 | * @param t 37 | */ 38 | public AspectException(String s, Throwable t) { 39 | super(s + "; nested exception is " + t.getMessage()); 40 | this.t = t; 41 | StringWriter out = new StringWriter(); 42 | t.printStackTrace(new PrintWriter(out)); 43 | this.stackTrace = out.toString(); 44 | } 45 | 46 | /** 47 | * Return the root cause of this exception. 48 | * May be null 49 | * @return Throwable 50 | */ 51 | public Throwable getCause() { 52 | return t; 53 | } 54 | 55 | public String toString() { 56 | return this.getMessage(); 57 | } 58 | 59 | public String getMessage() { 60 | return this.message; 61 | } 62 | 63 | public void printStackTrace() { 64 | System.err.print(this.stackTrace); 65 | } 66 | 67 | public void printStackTrace(PrintStream out) { 68 | printStackTrace(new PrintWriter(out)); 69 | } 70 | 71 | public void printStackTrace(PrintWriter out) { 72 | out.print(this.stackTrace); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/aop/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

This package provides the most generic and common interfaces for AOP.

8 | 9 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/instrument/Instrumentation.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.instrument; 3 | 4 | import org.aopalliance.reflect.Locator; 5 | 6 | /** 7 | * This interface represents an instrumentation on the base program. 8 | * 9 | *

The program instrumentor implementation should return an 10 | * intrumentation instance for each intrumentation which is performed. 11 | * 12 | * @see Instrumentor */ 13 | 14 | public interface Instrumentation { 15 | 16 | /** Interface adding instrumentation type. */ 17 | int ADD_INTERFACE=0; 18 | /** Superclass setting instrumentation type. */ 19 | int SET_SUPERCLASS=1; 20 | /** Class adding instrumentation type. */ 21 | int ADD_CLASS=2; 22 | /** Before code instrumentation type. */ 23 | int ADD_BEFORE_CODE=3; 24 | /** After code adding instrumentation type. */ 25 | int ADD_AFTER_CODE=4; 26 | /** Metadata adding instrumentation type. */ 27 | int ADD_METADATA=5; 28 | 29 | /** 30 | * Returns the location of this instrumentation. */ 31 | Locator getLocation(); 32 | 33 | /** 34 | * Gets the instrumentation type. 35 | * 36 | * @return ADD_INTERFACE | SET_SUPERCLASS | ADD_CLASS | 37 | * ADD_AFTER_CODE | ADD_BEFORE_CODE | ADD_AROUND_CODE | 38 | * ADD_METADATA */ 39 | int getType(); 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/instrument/InstrumentationError.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.instrument; 3 | 4 | /** 5 | * The error that is raised when an error occurs during an instrumentation. 6 | * 7 | * @see Instrumentor */ 8 | 9 | public class InstrumentationError extends Error { 10 | 11 | /** 12 | * Sets a generic error message for an instrumentation error. */ 13 | public InstrumentationError(Instrumentation instrumentation, 14 | Throwable cause) { 15 | super("Error while instrumenting " + instrumentation,cause); 16 | } 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/instrument/Instrumentor.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.instrument; 3 | 4 | import org.aopalliance.reflect.Code; 5 | import org.aopalliance.reflect.Class; 6 | import org.aopalliance.reflect.CodeLocator; 7 | import org.aopalliance.reflect.ClassLocator; 8 | import org.aopalliance.reflect.UnitLocator; 9 | 10 | /** 11 | * This interface defines all the methods that perform program 12 | * instrumentations that are useful for AOP. 13 | * 14 | *

The modifications definitions rely on an abstract representation 15 | * of locators, as defined in the {@link org.aopalliance.reflect} 16 | * package. 17 | * 18 | * @see org.aopalliance.reflect.Locator 19 | * @see org.aopalliance.reflect.ClassLocator 20 | * @see org.aopalliance.reflect.CodeLocator */ 21 | 22 | public interface Instrumentor { 23 | 24 | /** 25 | * Creates a new class. 26 | * 27 | * @return the locator that corresponds to the newly created class 28 | */ 29 | ClassLocator createClass(String name) throws InstrumentationError; 30 | 31 | /** 32 | * Adds a new implemented interface to a given class location. 33 | * 34 | * @return the object that corresponds to this instrumentation 35 | * @throws InstrumentationError if something went wrong with this 36 | * instrumentation 37 | * @see #undo(Instrumentation) */ 38 | Instrumentation addInterface(ClassLocator location, 39 | String newInterfaceName) 40 | throws InstrumentationError; 41 | 42 | /** 43 | * Sets or replaces the current superclass of a class location. 44 | * 45 | *

The new superclass should be a subtype of the replaced one in 46 | * order to maintain backward compatibility. 47 | * 48 | * @return the object that corresponds to this instrumentation 49 | * @throws InstrumentationError if something went wrong with this 50 | * instrumentation 51 | * @see #undo(Instrumentation) */ 52 | Instrumentation setSuperClass(ClassLocator location, 53 | String newSuperClassName) 54 | throws InstrumentationError; 55 | 56 | /** 57 | * Introduces a class into the class location (mixin). 58 | * 59 | *

Similarely to a mixin, the whole set of fields and methods 60 | * are introduced into the location's class, all the implemented 61 | * interface of the introduced class are also added as interfaces 62 | * of the location's class. 63 | * 64 | * @return the object that corresponds to this instrumentation 65 | * @throws InstrumentationError if something went wrong with this 66 | * instrumentation 67 | * @see #undo(Instrumentation) */ 68 | Instrumentation addClass(ClassLocator location,String className) 69 | throws InstrumentationError; 70 | 71 | /** 72 | * Adds a new method to the class location. 73 | * 74 | * @return the object that corresponds to this instrumentation 75 | * @throws InstrumentationError if something went wrong with this 76 | * instrumentation 77 | * @see #undo(Instrumentation) */ 78 | Instrumentation addMethod(ClassLocator location, 79 | String name, 80 | String[] parameterTypeNames, 81 | String[] parameterNames, 82 | Code body) 83 | throws InstrumentationError; 84 | 85 | /** 86 | * Adds a new field to the target class. 87 | * 88 | * @return the object that corresponds to this instrumentation 89 | * @throws InstrumentationError if something went wrong with this 90 | * instrumentation 91 | * @see #undo(Instrumentation) */ 92 | Instrumentation addField(ClassLocator location, 93 | String name, 94 | String typeName, 95 | Code initializator) 96 | throws InstrumentationError; 97 | 98 | /** 99 | * Adds some code before a given method code body. 100 | * 101 | * @param location the modification locator that can represent a 102 | * method invocation, a field set/get, or a constructor (at callee 103 | * or caller side) 104 | * @param beforeCode the code to be added before 105 | * @param before the modification that must stay before this 106 | * before code 107 | * @param after the modification that must stay after this 108 | * before code 109 | * @return the object that corresponds to this instrumentation 110 | * @throws InstrumentationError if something went wrong with this 111 | * instrumentation 112 | * @see #undo(Instrumentation) */ 113 | Instrumentation addBeforeCode(CodeLocator location, 114 | Code beforeCode, 115 | Instrumentation before, 116 | Instrumentation after) 117 | throws InstrumentationError; 118 | 119 | /** 120 | * Adds some code after a given method code body. 121 | * 122 | * @param location the modification locator that can represent a 123 | * method invocation, a field set/get, or a constructor (at callee 124 | * or caller side) 125 | * @param afterCode the code to be added after 126 | * @param before the modification that must stay before this 127 | * after code 128 | * @param after the modification that must stay after this 129 | * after code 130 | * @return the object that corresponds to this instrumentation 131 | * @throws InstrumentationError if something went wrong with this 132 | * instrumentation 133 | * @see #undo(Instrumentation) */ 134 | Instrumentation addAfterCode(CodeLocator location, 135 | Code afterCode, 136 | Instrumentation before, 137 | Instrumentation after) 138 | throws InstrumentationError; 139 | 140 | /** 141 | * Adds some code around a given method code body. 142 | * 143 | *

An around code is a code that calls a proceed method 144 | * one or several times. When the proceed method is invoked, the 145 | * location is executed (for compile approched, the proceed method 146 | * call is subsituted by the location). 147 | * 148 | *

The proceed method name is parameterized by the 149 | * proceedMethodName argument (can be 150 | * proceed, invokeNext, 151 | * runNext, etc). 152 | * 153 | *

Note that if the around code does not call the proceed 154 | * method, then the around instrumentation is similar to a 155 | * replacement of the location. This is not aspect-safe but can be 156 | * useful in some instrumentation process to build AO systems. 157 | * 158 | * @param location the modification locator that can represent a 159 | * method invocation, a field set/get, or a constructor (at callee 160 | * or caller side) 161 | * @param aroundCode the code to be added after 162 | * @param proceedMethodName the name of the proceed method 163 | * @param before the modification that must stay before this 164 | * after code 165 | * @param after the modification that must stay after this 166 | * after code 167 | * @return the object that corresponds to this instrumentation 168 | * @throws InstrumentationError if something went wrong with this 169 | * instrumentation 170 | * @see #undo(Instrumentation) */ 171 | Instrumentation addAroundCode(CodeLocator location, 172 | Code aroundCode, 173 | String proceedMethodName, 174 | Instrumentation before, 175 | Instrumentation after) 176 | throws InstrumentationError; 177 | 178 | /** 179 | * Cancels an instrumentation. 180 | * 181 | * @param instrumentation the instrumentation to cancel 182 | * 183 | * @throws UndoNotSupportedException when the implementation does 184 | * not support instrumentation cancellation for the given 185 | * instrumentation */ 186 | void undo(Instrumentation instrumentation) 187 | throws UndoNotSupportedException; 188 | 189 | } 190 | 191 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/instrument/UndoNotSupportedException.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.instrument; 3 | 4 | /** 5 | * The exception that is raised when the client program tries to undo 6 | * an instrumentation and when current implementation does not support 7 | * it. 8 | * 9 | *

Undoing is implemented by the {@link 10 | * Instrumentor#undo(Instrumentation)} method. 11 | * 12 | * @see Instrumentor */ 13 | 14 | public class UndoNotSupportedException extends Exception { 15 | 16 | /** 17 | * Sets a generic exception message for an instrumentation. */ 18 | public UndoNotSupportedException(Instrumentation instrumentation) { 19 | super("Undo not supported for instrumentation: " + instrumentation); 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/instrument/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

This package provides an API for program instrumentation.

8 | 9 |

This package provides a set of interfaces for applying 10 | intrumentations on a program, i.e. a program modification which 11 | adds some feature (methods, classes, code) to the original 12 | program. These instrumentations are abstractly defined and can 13 | occur at compile-time, load-time, or runtime depending on the 14 | {@link org.aopalliance.instrument.Instrumentor} 15 | implementation. Moreover, since it uses the {@link 16 | org.aopalliance.reflect} package which provides an abstract 17 | representation of the program, the instrumentations can be 18 | implemented at a source-code level or at a bytecode level, 19 | depending on the implementation. 20 | 21 |

This API is specific to AOP. This means that the set of program 22 | instrumentations that is allowed is a restricted set compared to a 23 | general-purpose API. However, general-purpose transformation 24 | tools should provide an implementation of this API in order to be 25 | easily used by several AO systems. 26 | 27 |

Dependencies

28 | 29 |

This package requires the {@link org.aopalliance.reflect} package. 30 | 31 | 33 | 34 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/ConstructorInterceptor.java: -------------------------------------------------------------------------------- 1 | package org.aopalliance.intercept; 2 | 3 | /** 4 | * Intercepts the construction of a new object. 5 | * 6 | *

The user should implement the {@link 7 | * #construct(ConstructorInvocation)} method to modify the original 8 | * behavior. E.g. the following class implements a singleton 9 | * interceptor (allows only one unique instance for the intercepted 10 | * class): 11 | * 12 | *

13 |  * class DebuggingInterceptor implements ConstructorInterceptor {
14 |  *   Object instance=null;
15 |  *
16 |  *   Object construct(ConstructorInvocation i) throws Throwable {
17 |  *     if(instance==null) {
18 |  *       return instance=i.proceed();
19 |  *     } else {
20 |  *       throw new Exception("singleton does not allow multiple instance");
21 |  *     }
22 |  *   }
23 |  * }
24 |  * 
*/ 25 | 26 | public interface ConstructorInterceptor extends Interceptor 27 | { 28 | /** 29 | * Implement this method to perform extra treatments before and 30 | * after the consrution of a new object. Polite implementations 31 | * would certainly like to invoke {@link Joinpoint#proceed()}. 32 | * 33 | * @param invocation the construction joinpoint 34 | * @return the newly created object, which is also the result of 35 | * the call to {@link Joinpoint#proceed()}, might be replaced by 36 | * the interceptor. 37 | * 38 | * @throws Throwable if the interceptors or the 39 | * target-object throws an exception. */ 40 | Object construct(ConstructorInvocation invocation) throws Throwable; 41 | } 42 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/ConstructorInvocation.java: -------------------------------------------------------------------------------- 1 | package org.aopalliance.intercept; 2 | 3 | import java.lang.reflect.Constructor; 4 | 5 | /** 6 | * Description of an invocation to a constuctor, given to an 7 | * interceptor upon construtor-call. 8 | * 9 | *

A constructor invocation is a joinpoint and can be intercepted 10 | * by a constructor interceptor. 11 | * 12 | * @see ConstructorInterceptor */ 13 | public interface ConstructorInvocation extends Invocation { 14 | 15 | /** 16 | * Gets the constructor being called. 17 | * 18 | *

This method is a frienly implementation of the {@link 19 | * Joinpoint#getStaticPart()} method (same result). 20 | * 21 | * @return the constructor being called. */ 22 | Constructor getConstructor(); 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/FieldAccess.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.intercept; 3 | 4 | import java.lang.reflect.Field; 5 | 6 | /** 7 | * This interface represents a field access in the program. 8 | * 9 | *

A field access is a joinpoint and can be intercepted by a field 10 | * interceptor. 11 | * 12 | * @see FieldInterceptor */ 13 | 14 | public interface FieldAccess extends Joinpoint { 15 | 16 | /** The read access type (see {@link #getAccessType()}). */ 17 | int READ=0; 18 | /** The write access type (see {@link #getAccessType()}). */ 19 | int WRITE=1; 20 | 21 | /** 22 | * Gets the field being accessed. 23 | * 24 | *

This method is a frienly implementation of the {@link 25 | * Joinpoint#getStaticPart()} method (same result). 26 | * 27 | * @return the field being accessed. */ 28 | Field getField(); 29 | 30 | /** 31 | * Gets the value that must be set to the field. 32 | * 33 | *

This value can be intercepted and changed by a field 34 | * interceptor. */ 35 | Object getValueToSet(); 36 | 37 | /** 38 | * Returns the access type. 39 | * 40 | * @return FieldAccess.READ || FieldAccess.WRITE */ 41 | int getAccessType(); 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/FieldInterceptor.java: -------------------------------------------------------------------------------- 1 | package org.aopalliance.intercept; 2 | 3 | /** 4 | * Intercepts field access on a target object. 5 | * 6 | *

The user should implement the {@link #set(FieldAccess)} and 7 | * {@link #get(FieldAccess)} methods to modify the original 8 | * behavior. E.g. the following class implements a tracing interceptor 9 | * (traces the accesses to the intercepted field(s)): 10 | * 11 | *

12 |  * class TracingInterceptor implements FieldInterceptor {
13 |  *
14 |  *   Object set(FieldAccess fa) throws Throwable {
15 |  *     System.out.println("field "+fa.getField()+" is set with value "+
16 |  *                        fa.getValueToSet());
17 |  *     Object ret=fa.proceed();
18 |  *     System.out.println("field "+fa.getField()+" was set to value "+ret);
19 |  *     return ret;
20 |  *   }
21 |  *
22 |  *   Object get(FieldAccess fa) throws Throwable {
23 |  *     System.out.println("field "+fa.getField()+" is about to be read");
24 |  *     Object ret=fa.proceed();
25 |  *     System.out.println("field "+fa.getField()+" was read; value is "+ret);
26 |  *     return ret;
27 |  *   }
28 |  * }
29 |  * 
*/ 30 | 31 | public interface FieldInterceptor extends Interceptor 32 | { 33 | /** 34 | * Do the stuff you want to do before and after the 35 | * field is getted. 36 | * 37 | *

Polite implementations would certainly like to call 38 | * {@link Joinpoint#proceed()}. 39 | * 40 | * @param fieldRead the joinpoint that corresponds to the field 41 | * read 42 | * @return the result of the field read {@link 43 | * Joinpoint#proceed()}, might be intercepted by the 44 | * interceptor. 45 | * 46 | * @throws Throwable if the interceptors or the 47 | * target-object throws an exception. */ 48 | Object get(FieldAccess fieldRead) throws Throwable; 49 | 50 | /** 51 | * Do the stuff you want to do before and after the 52 | * field is setted. 53 | * 54 | *

Polite implementations would certainly like to implement 55 | * {@link Joinpoint#proceed()}. 56 | * 57 | * @param fieldWrite the joinpoint that corresponds to the field 58 | * write 59 | * @return the result of the field set {@link 60 | * Joinpoint#proceed()}, might be intercepted by the 61 | * interceptor. 62 | * 63 | * @throws Throwable if the interceptors or the 64 | * target-object throws an exception. */ 65 | Object set(FieldAccess fieldWrite) throws Throwable; 66 | 67 | } 68 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/Interceptor.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.intercept; 3 | 4 | import org.aopalliance.aop.Advice; 5 | 6 | /** 7 | * This interface represents a generic interceptor. 8 | * 9 | *

A generic interceptor can intercept runtime events that occur 10 | * within a base program. Those events are materialized by (reified 11 | * in) joinpoints. Runtime joinpoints can be invocations, field 12 | * access, exceptions... 13 | * 14 | *

This interface is not used directly. Use the the sub-interfaces 15 | * to intercept specific events. For instance, the following class 16 | * implements some specific interceptors in order to implement a 17 | * debugger: 18 | * 19 | *

20 |  * class DebuggingInterceptor implements MethodInterceptor, 
21 |  *     ConstructorInterceptor, FieldInterceptor {
22 |  *
23 |  *   Object invoke(MethodInvocation i) throws Throwable {
24 |  *     debug(i.getMethod(), i.getThis(), i.getArgs());
25 |  *     return i.proceed();
26 |  *   }
27 |  *
28 |  *   Object construct(ConstructorInvocation i) throws Throwable {
29 |  *     debug(i.getConstructor(), i.getThis(), i.getArgs());
30 |  *     return i.proceed();
31 |  *   }
32 |  * 
33 |  *   Object get(FieldAccess fa) throws Throwable {
34 |  *     debug(fa.getField(), fa.getThis(), null);
35 |  *     return fa.proceed();
36 |  *   }
37 |  *
38 |  *   Object set(FieldAccess fa) throws Throwable {
39 |  *     debug(fa.getField(), fa.getThis(), fa.getValueToSet());
40 |  *     return fa.proceed();
41 |  *   }
42 |  *
43 |  *   void debug(AccessibleObject ao, Object this, Object value) {
44 |  *     ...
45 |  *   }
46 |  * }
47 |  * 
48 | * 49 | * @see Joinpoint */ 50 | 51 | public interface Interceptor extends Advice { 52 | } 53 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/Invocation.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.intercept; 3 | 4 | /** 5 | * This interface represents an invocation in the program. 6 | * 7 | *

An invocation is a joinpoint and can be intercepted by an 8 | * interceptor. 9 | * 10 | * @author Rod Johnson */ 11 | 12 | public interface Invocation extends Joinpoint { 13 | 14 | /** 15 | * Get the arguments as an array object. 16 | * It is possible to change element values within this 17 | * array to change the arguments. 18 | * 19 | * @return the argument of the invocation */ 20 | Object[] getArguments(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/Joinpoint.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.intercept; 3 | 4 | import java.lang.reflect.AccessibleObject; 5 | 6 | /** 7 | * This interface represents a generic runtime joinpoint (in the AOP 8 | * terminology). 9 | * 10 | *

A runtime joinpoint is an event that occurs on a static 11 | * joinpoint (i.e. a location in a the program). For instance, an 12 | * invocation is the runtime joinpoint on a method (static joinpoint). 13 | * The static part of a given joinpoint can be generically retrieved 14 | * using the {@link #getStaticPart()} method. 15 | * 16 | *

In the context of an interception framework, a runtime joinpoint 17 | * is then the reification of an access to an accessible object (a 18 | * method, a constructor, a field), i.e. the static part of the 19 | * joinpoint. It is passed to the interceptors that are installed on 20 | * the static joinpoint. 21 | * 22 | * @see Interceptor */ 23 | 24 | public interface Joinpoint { 25 | 26 | /** 27 | * Proceeds to the next interceptor in the chain. 28 | * 29 | *

The implementation and the semantics of this method depends 30 | * on the actual joinpoint type (see the children interfaces). 31 | * 32 | * @return see the children interfaces' proceed definition. 33 | * 34 | * @throws Throwable if the joinpoint throws an exception. */ 35 | Object proceed() throws Throwable; 36 | 37 | /** 38 | * Returns the object that holds the current joinpoint's static 39 | * part. 40 | * 41 | *

For instance, the target object for an invocation. 42 | * 43 | * @return the object (can be null if the accessible object is 44 | * static). */ 45 | Object getThis(); 46 | 47 | /** 48 | * Returns the static part of this joinpoint. 49 | * 50 | *

The static part is an accessible object on which a chain of 51 | * interceptors are installed. */ 52 | AccessibleObject getStaticPart(); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/MethodInterceptor.java: -------------------------------------------------------------------------------- 1 | package org.aopalliance.intercept; 2 | 3 | /** 4 | * Intercepts calls on an interface on its way to the target. These 5 | * are nested "on top" of the target. 6 | * 7 | *

The user should implement the {@link #invoke(MethodInvocation)} 8 | * method to modify the original behavior. E.g. the following class 9 | * implements a tracing interceptor (traces all the calls on the 10 | * intercepted method(s)): 11 | * 12 | *

13 |  * class TracingInterceptor implements MethodInterceptor {
14 |  *   Object invoke(MethodInvocation i) throws Throwable {
15 |  *     System.out.println("method "+i.getMethod()+" is called on "+
16 |  *                        i.getThis()+" with args "+i.getArguments());
17 |  *     Object ret=i.proceed();
18 |  *     System.out.println("method "+i.getMethod()+" returns "+ret);
19 |  *     return ret;
20 |  *   }
21 |  * }
22 |  * 
*/ 23 | 24 | public interface MethodInterceptor extends Interceptor { 25 | 26 | /** 27 | * Implement this method to perform extra treatments before and 28 | * after the invocation. Polite implementations would certainly 29 | * like to invoke {@link Joinpoint#proceed()}. 30 | * 31 | * @param invocation the method invocation joinpoint 32 | * @return the result of the call to {@link 33 | * Joinpoint#proceed()}, might be intercepted by the 34 | * interceptor. 35 | * 36 | * @throws Throwable if the interceptors or the 37 | * target-object throws an exception. */ 38 | Object invoke(MethodInvocation invocation) throws Throwable; 39 | } 40 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/MethodInvocation.java: -------------------------------------------------------------------------------- 1 | package org.aopalliance.intercept; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | /** 6 | * Description of an invocation to a method, given to an interceptor 7 | * upon method-call. 8 | * 9 | *

A method invocation is a joinpoint and can be intercepted by a method 10 | * interceptor. 11 | * 12 | * @see MethodInterceptor */ 13 | public interface MethodInvocation extends Invocation 14 | { 15 | 16 | /** 17 | * Gets the method being called. 18 | * 19 | *

This method is a frienly implementation of the {@link 20 | * Joinpoint#getStaticPart()} method (same result). 21 | * 22 | * @return the method being called. 23 | */ 24 | Method getMethod(); 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/intercept/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

This package provides a set of interfaces for interception 8 | mechanisms.

9 | 10 |

Interception is a basic mechanism to implement AOP. This is 11 | widely used in middlewares and modern application servers, 12 | including J2EE ones. 13 | 14 |

This package provides an {@link 15 | org.aopalliance.intercept.Interceptor} interface that will 16 | intercept different runtime joinpoints (e.g. method calls, field 17 | access, ...). Thus, interceptors are able to add some behavior 18 | around the joinpoints actual executions. Several interceptors can 19 | be applied on a given joinpoint since they are chained. The AO 20 | system implementor should provide means to install and order these 21 | chains of interceptors. 22 | 23 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/Class.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This element represents classes in the base program. */ 6 | 7 | public interface Class extends ProgramUnit { 8 | 9 | /** 10 | * Returns the class locator that corresponds to this class. 11 | * 12 | *

This method returns exactly the same result as 13 | * ProgramUnit.getLocator() but with a more precise 14 | * type (ClassLocator instead of 15 | * UnitLocator). 16 | * 17 | * @see ProgramUnit#getLocator() */ 18 | ClassLocator getClassLocator(); 19 | 20 | /** 21 | * Gets the class's full name. */ 22 | String getName(); 23 | 24 | /** 25 | * Gets the fields of this class (including superclass fields). */ 26 | Field[] getFields(); 27 | 28 | /** 29 | * Gets the fields declared by this class. */ 30 | Field[] getDeclaredFields(); 31 | 32 | /** 33 | * Gets the methods of this class (including superclass 34 | * methods). */ 35 | Method[] getMethods(); 36 | 37 | /** 38 | * Gets the methods declared by this class. */ 39 | Method[] getDeclaredMethods(); 40 | 41 | /** 42 | * Gets the superclass of this class. */ 43 | Class getSuperclass(); 44 | 45 | /** 46 | * Gets all the interfaces implemented by this class. */ 47 | Class[] getInterfaces(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/ClassLocator.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This interface represents a specific unit locator for base program 6 | * classes. 7 | * 8 | *

For instance, this locator can represent a given class, or a 9 | * given classes set (e.g. all the classes of a given package or all 10 | * the classes that implement a given interface). 11 | * 12 | * @see ProgramUnit#getLocator() 13 | * @see Class#getClassLocator() */ 14 | 15 | public interface ClassLocator extends UnitLocator { 16 | } 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/Code.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This represents a piece of code in the program. 6 | * 7 | *

It is formed of a set of instructions and can be implemented at 8 | * bytecode or source-code level. 9 | * 10 | *

Typically, a code in the program comes from method bodies (it 11 | * can be init methods (instance or static) or regular methods 12 | * (instance or static) with any kind of visibility modifiers (public, 13 | * protected, private). 14 | * 15 | *

So, this class allows the client to retrieve code locators on 16 | * instructions within this code. This locators shall be used 17 | * conjointly whith an {@link org.aopalliance.instrument.Instrumentor} 18 | * implementation in order to perform aspetual transformations of the 19 | * program (before/after/around type). 20 | * 21 | *

The {@link #getLocator} method returns the locator for the whole 22 | * method and can be used to implement callee-side transformations 23 | * before/after/around the callee method. 24 | * 25 | *

The other set of locating methods returns locators that allows 26 | * the client to implement caller-side transformations (e.g. when the 27 | * code accesses a field or calls a method). 28 | * 29 | * @see org.aopalliance.instrument.Instrumentor 30 | * @see CodeLocator 31 | * @see Method#getBody() */ 32 | 33 | public interface Code { 34 | 35 | /** 36 | * Returns the code locator that corresponds to this code. 37 | * 38 | *

For instance, if a code is a set of instructions called 39 | * code, then the locator will designate 40 | * <code>. 41 | * 42 | *

This locator is typically used to locate a whole method body. 43 | * 44 | * @see Method#getBody() */ 45 | CodeLocator getLocator(); 46 | 47 | /** 48 | * Returns a call locator for the given callee method. 49 | * 50 | *

For instance, a call locator for method m() 51 | * designates the parts between <> in the 52 | * following code. 53 | * 54 | *

 55 |     * [...]
 56 |     * aLocalVariable.<m()>;
 57 |     * [...]
 58 |     * aMethodParameter.<m()>;
 59 |     * [...]
 60 |     * aField.<m()>;
 61 |     * [...]
 62 |     * <m()> // when m is a method of the class the current code belongs to
 63 |     * [...]
 64 |     * 
65 | * 66 | *

If the given method is a static method, the locator follows 67 | * the same principles, as for constructors. For instance if the 68 | * current method is the init method of class 69 | * C: 70 | * 71 | *

 72 |     * [...]
 73 |     * aVar = <new C()>;
 74 |     * [...]
 75 |     * 
76 | * 77 | * @param calleeMethod the method that is called from the current 78 | * code */ 79 | CodeLocator getCallLocator(Method calleeMethod); 80 | 81 | /** 82 | * Returns a field reading locator in the current body. 83 | * 84 | *

For instance, a field read locator for field f 85 | * designates the parts between <> in the 86 | * following code. 87 | * 88 | *

 89 |     * [...]
 90 |     * <f>.m();
 91 |     * [...]
 92 |     * aVarOrFieldOrParam = <f>;
 93 |     * [...]
 94 |     * 
95 | * 96 | * @param readField the field that is read from the current code */ 97 | CodeLocator getReadLocator(Field readField); 98 | 99 | /** 100 | * Returns a field writing locator in the current body. 101 | * 102 | *

For instance, a field write locator for field f 103 | * designates the parts between <> in the 104 | * following code. 105 | * 106 | *

107 |     * [...]
108 |     * <f=> aVarOrFieldOrParam;
109 |     * [...]
110 |     * 
111 | * 112 | * @param writtenField the field that is written from the current 113 | * code */ 114 | CodeLocator getWriteLocator(Field writtenField); 115 | 116 | /** 117 | * Returns a exception throwing locator in the current body. 118 | * 119 | *

For instance, an exception throw locator for exception of 120 | * type E designates the parts between 121 | * <> in the following code. 122 | * 123 | *

124 |     * [...]
125 |     * <throw> new E();
126 |     * [...]
127 |     * throw new AnotherExceptionType();
128 |     * [...]
129 |     * 
130 | * 131 | * @param exceptionType the type of the throwed exception */ 132 | CodeLocator getThrowLocator(Class exceptionType); 133 | 134 | /** 135 | * Returns a exception catching locator in the current body. 136 | * 137 | *

For instance, an exception catch locator for exception of 138 | * type E designates the parts between 139 | * <> in the following code. 140 | * 141 | *

142 |     * [...]
143 |     * try {
144 |     *   [...]
145 |     * } catch(E e1) {
146 |     *   <[...]>
147 |     * } catch(AnotherExceptionType e2) { [...] };
148 |     * [...]
149 |     * 
150 | * 151 | * @param exceptionType the type of the throwed exception */ 152 | CodeLocator getCatchLocator(Class exceptionType); 153 | 154 | } 155 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/CodeLocator.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This interface represents a locator on a base program piece of 6 | * code. 7 | * 8 | *

The AOP Alliance implementation provider should provide code 9 | * locators implementations in order to support several kinds of code 10 | * locators (e.g. as the ones used in the Code 11 | * interface). 12 | * 13 | *

The AOP Alliance client program gets the locator by navigating 14 | * the base program metamodel (using the 15 | * {@link org.aopalliance.reflect} package) and using the 16 | * get...Locator(...) methods. 17 | * 18 | *

Code locators are quite different from unit locators. 19 | * 20 | * @see Code 21 | * @see Code#getLocator() 22 | * @see Code#getCallLocator(Method) 23 | * @see Code#getReadLocator(Field) 24 | * @see Code#getWriteLocator(Field) 25 | * @see Code#getThrowLocator(Class) 26 | * @see Code#getCatchLocator(Class) 27 | * @see Method#getCallLocator() 28 | * @see UnitLocator */ 29 | 30 | public interface CodeLocator extends Locator { 31 | } 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/Field.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This represents a field of a class. */ 6 | 7 | public interface Field extends Member { 8 | 9 | /** 10 | * Same as getReadLocator(USER_SIDE). 11 | * 12 | * @see #getReadLocator(int) */ 13 | CodeLocator getReadLocator(); 14 | 15 | /** 16 | * This methods returns the points where the current field is read. 17 | * 18 | *

There are two different behaviors for this method depending 19 | * on the side of the locator. At the user side, the locator 20 | * designates all the points in methods bodies where the field is 21 | * read (similarly to Code.getReadLocator(Field)). At 22 | * the provider side, it really may depend on the implementor 23 | * choice (e.g. it can return a locator on the body of the field's 24 | * getter). 25 | * 26 | *

In Java, the user side is most of the time used so that you 27 | * can use the method getReadLocator(). 28 | * 29 | * @param side USER_SIDE || PROVIDER_SIDE 30 | * @see #getReadLocator() */ 31 | CodeLocator getReadLocator(int side); 32 | 33 | /** 34 | * Same as getWriteLocator(USER_SIDE). 35 | * 36 | * @see #getWriteLocator(int) */ 37 | CodeLocator getWriteLocator(); 38 | 39 | /** 40 | * This methods returns the points where the current field is 41 | * written. 42 | * 43 | *

There are two different behaviors for this method depending 44 | * on the side of the locator. At the user side, the locator 45 | * designates all the points in methods bodies where the field is 46 | * written (similarly to Code.getWriteLocator(Field)). At 47 | * the provider side, it really may depend on the implementor 48 | * choice (e.g. it can return a locator on the body of the field's 49 | * setter). 50 | * 51 | *

In Java, the user side is most of the time used so that you 52 | * can use the method getWriteLocator(). 53 | * 54 | * @param side USER_SIDE || PROVIDER_SIDE 55 | * @see #getWriteLocator() */ 56 | CodeLocator getWriteLocator(int side); 57 | 58 | } 59 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/Locator.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This interface represents a locator on the base program. 6 | * 7 | *

The locators are used by the reflection API client to identify 8 | * point(s) in the program. The client can retrieve locators by using 9 | * the get...Locator(...) methods on the reflection API 10 | * elements. For futher details, see the subinterfaces of this 11 | * interface. */ 12 | 13 | public interface Locator { 14 | } 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/Member.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This interface represents a class member. 6 | * 7 | *

A member can be a field, a method, or a constructor. */ 8 | 9 | public interface Member extends ProgramUnit { 10 | 11 | /** 12 | * A constant to denote the program side that uses this member. */ 13 | int USER_SIDE=0; 14 | /** 15 | * A constant to denote the program side that provides this 16 | * member. */ 17 | int PROVIDER_SIDE=1; 18 | 19 | /** 20 | * Gets the class that declares this member. */ 21 | Class getDeclaringClass(); 22 | 23 | /** 24 | * The member's name. */ 25 | String getName(); 26 | 27 | /** 28 | * The modifiers value. */ 29 | int getModifiers(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/Metadata.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * A metadata is a pair of values (key,data) that can be associated to 6 | * a program unit. 7 | * 8 | * @see ProgramUnit 9 | * @see ProgramUnit#addMetadata(Metadata) */ 10 | 11 | public interface Metadata { 12 | 13 | /** 14 | * Gets the key of this metadata. */ 15 | Object getKey(); 16 | 17 | /** 18 | * Gets the value of this metadata. */ 19 | Object getValue(); 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/Method.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This represents a method of a class. */ 6 | 7 | public interface Method extends Member { 8 | 9 | /** 10 | * This locator contains all the points in the program that call 11 | * this method. 12 | * 13 | *

Note that this code locator corresponds to the client-side 14 | * call event (equiv. to 15 | * this.getLocator(USER_SIDE). To get the server-side 16 | * equivalent locator, one must write 17 | * this.getBody().getLocator() or 18 | * this.getLocator(PROVIDER_SIDE). 19 | * 20 | *

It is a very invasive feature since it designates all the 21 | * calling points in all the classes of the application. To only 22 | * designate the calling points in a given client method, one 23 | * should write 24 | * aClientMethod.getBody().getCallLocator(this). 25 | * 26 | * @see Code#getLocator() 27 | * @see Code#getCallLocator(Method) */ 28 | CodeLocator getCallLocator(); 29 | 30 | /** 31 | * A full version of {@link #getCallLocator()}. 32 | * 33 | * @param side USER_SIDE || PROVIDER_SIDE 34 | * @see #getCallLocator() */ 35 | CodeLocator getCallLocator(int side); 36 | 37 | 38 | /** 39 | * Returns the body of the current method. */ 40 | Code getBody(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/ProgramUnit.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * An abstract program unit. 6 | * 7 | *

Any structural unit of a base program (class, member, 8 | * ...). Units exclude the code. 9 | * 10 | *

When referencing a program unit, the client can retrieve unit 11 | * locators using {@link #getLocator()} or more specific methods. This 12 | * locators shall be used conjointly whith an {@link 13 | * org.aopalliance.instrument.Instrumentor} implementation in order to 14 | * perform aspetual transformations of the program (e.g. type merging, 15 | * parameters adding,...). 16 | * 17 | *

Program units also supports metadatas, i.e. the ability to add 18 | * extra information on the base program so that the client can 19 | * extends its meaning very easily. 20 | * 21 | * @see org.aopalliance.instrument.Instrumentor 22 | * @see UnitLocator 23 | * @see Class 24 | * @see Method 25 | * @see Field */ 26 | 27 | public interface ProgramUnit { 28 | 29 | /** 30 | * Returns the locator that corresponds to this unit. 31 | */ 32 | UnitLocator getLocator(); 33 | 34 | /** 35 | * Returns the metadata that is associated to this unit from its 36 | * key. */ 37 | Metadata getMetadata(Object key); 38 | 39 | /** 40 | * Returns all the metadatas that are associated to the current 41 | * unit. */ 42 | Metadata[] getMetadatas(); 43 | 44 | /** 45 | * Associates a metadata to the current unit. 46 | * 47 | *

If a metadata already exists with the same key, then its 48 | * value is replaced by the newly given one. */ 49 | void addMetadata(Metadata metadata); 50 | 51 | /** 52 | * Removes a metadata from its key. 53 | * 54 | *

If none metadata having the given key exists, then this method 55 | * has no effect. */ 56 | void removeMetadata(Object key); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/UnitLocator.java: -------------------------------------------------------------------------------- 1 | 2 | package org.aopalliance.reflect; 3 | 4 | /** 5 | * This interface represents a locator on a base program structural unit. 6 | * 7 | *

A program unit represents any structural part of the program 8 | * (i.e. any part excepting code) such as a class, a method, a 9 | * field... 10 | * 11 | *

Unit locators are quite different from code locators. 12 | * 13 | * @see ProgramUnit 14 | * @see ProgramUnit#getLocator() 15 | * @see CodeLocator */ 16 | 17 | public interface UnitLocator extends Locator { 18 | } 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /aopalliance/src/main/org/aopalliance/reflect/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

This package provides a set of interfaces for implementing a 8 | generic reflection API.

9 | 10 |

The motivations of this package are to have a generic 11 | reflection API with interfaces so that any AO system provider can 12 | implement its own base program introspection package. In general, 13 | we cannot use java.lang.reflect since in most of the 14 | AOP systems, this representation is not available (e.g. in 15 | load-time systems or compile-time systems). 16 | 17 |

The implementor can implement this API for compile-time purpose 18 | (for instance based on a source-code analysis implementation), for a 19 | load-time purpose (mostly based on a bytecode-level 20 | implementation), or for a run-time purpose. 21 | 22 |

This package has be rougthly specified and really needs further 23 | investigations. 24 | 25 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /aopi-pre-spec/doc/figures/aop-model.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 2 | Landscape 3 | Center 4 | Metric 5 | A4 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 6 3915 585 5895 1305 11 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 12 | 3915 900 5895 900 13 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 14 | 3915 585 5895 585 5895 1305 3915 1305 3915 585 15 | 4 0 0 50 0 0 12 0.0000 4 180 555 4545 810 Aspect\001 16 | 4 0 0 50 0 0 12 0.0000 4 180 1335 4005 1170 getName():String\001 17 | -6 18 | 6 3915 2340 5940 3060 19 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 20 | 3915 2655 5940 2655 21 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 22 | 3915 2340 5940 2340 5940 3060 3915 3060 3915 2340 23 | 4 0 0 50 0 0 12 0.0000 4 135 630 4500 2565 Pointcut\001 24 | 4 0 0 50 0 0 12 0.0000 4 180 1755 4005 2925 getDescriptor():Object\001 25 | -6 26 | 6 4185 4095 5670 4680 27 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 28 | 4185 4095 5670 4095 5670 4500 4185 4500 4185 4095 29 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 30 | 4905 4500 4770 4680 5040 4680 4905 4500 31 | 4 0 0 50 0 0 12 0.0000 4 180 1185 4365 4365 AspectElement\001 32 | -6 33 | 6 1980 5265 4590 6930 34 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 35 | 1980 5625 4590 5625 36 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 37 | 1980 6390 4590 6390 38 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 39 | 1980 5265 4590 5265 4590 6930 1980 6930 1980 5265 40 | 4 0 0 50 0 0 12 0.0000 4 180 1215 2070 5850 getCode():Code\001 41 | 4 0 0 50 0 0 12 0.0000 4 180 1005 2070 6075 getType():int\001 42 | 4 0 0 50 0 0 12 0.0000 4 135 540 2925 5535 Advice\001 43 | 4 0 0 50 0 0 12 0.0000 4 180 1950 2070 6615 type=AFTER, AROUND,\001 44 | 4 0 0 50 0 0 12 0.0000 4 135 720 2070 6840 BEFORE\001 45 | 4 0 0 50 0 0 12 0.0000 4 180 2445 2070 6300 getContextPassingInfo():Object\001 46 | -6 47 | 6 5265 5265 8100 6750 48 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 49 | 5265 6165 8100 6165 50 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 51 | 5265 5265 8100 5265 8100 6750 5265 6750 5265 5265 52 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 53 | 5265 5625 8100 5625 54 | 4 0 0 50 0 0 12 0.0000 4 180 2325 5355 5850 getElement():ProgramElement\001 55 | 4 0 0 50 0 0 12 0.0000 4 180 1005 5355 6075 getType():int\001 56 | 4 0 0 50 0 0 12 0.0000 4 180 2115 5355 6390 type=FIELD, INTERFACE \001 57 | 4 0 0 50 0 0 12 0.0000 4 165 2685 5355 6615 METHOD, MIXIN, SUPERCLASS\001 58 | 4 0 0 50 0 0 12 0.0000 4 135 915 6165 5535 Introduction\001 59 | -6 60 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 61 | 4905 4680 4905 4995 3285 4995 3285 5265 62 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 63 | 4905 3060 4905 4095 64 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 65 | 4905 1305 4905 2340 66 | 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 67 | 4905 4680 4905 4995 6525 4995 6525 5265 68 | 4 0 0 50 0 0 12 0.0000 4 135 90 4995 1575 1\001 69 | 4 0 0 50 0 0 12 0.0000 4 135 240 4995 2295 0-*\001 70 | 4 0 0 50 0 0 12 0.0000 4 135 240 4995 4050 1-*\001 71 | 4 0 0 50 0 0 12 0.0000 4 135 240 4995 3285 0-*\001 72 | -------------------------------------------------------------------------------- /aopi-pre-spec/doc/figures/packages.fig: -------------------------------------------------------------------------------- 1 | #FIG 3.2 2 | Landscape 3 | Center 4 | Metric 5 | A4 6 | 100.00 7 | Single 8 | -2 9 | 1200 2 10 | 6 4050 1665 5355 2655 11 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 12 | 4050 1890 5355 1890 5355 2655 4050 2655 4050 1890 13 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 14 | 4050 1665 4590 1665 4590 1890 4050 1890 4050 1665 15 | 4 0 0 50 0 0 12 0.0000 4 180 855 4230 2340 aopi.reflect\001 16 | -6 17 | 6 4095 3555 5400 4545 18 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 19 | 4095 3780 5400 3780 5400 4545 4095 4545 4095 3780 20 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 21 | 4095 3555 4635 3555 4635 3780 4095 3780 4095 3555 22 | 4 0 0 50 0 0 12 0.0000 4 180 780 4275 4230 aopi.modif\001 23 | -6 24 | 6 4095 5400 5400 6390 25 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 26 | 4095 5625 5400 5625 5400 6390 4095 6390 4095 5625 27 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 28 | 4095 5400 4635 5400 4635 5625 4095 5625 4095 5400 29 | 4 0 0 50 0 0 12 0.0000 4 180 690 4365 6075 aopi.core\001 30 | -6 31 | 6 4140 7290 5445 8280 32 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 33 | 4140 7515 5445 7515 5445 8280 4140 8280 4140 7515 34 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 35 | 4140 7290 4680 7290 4680 7515 4140 7515 4140 7290 36 | 4 0 0 50 0 0 12 0.0000 4 180 690 4410 7965 aopi.conf\001 37 | -6 38 | 6 6570 3555 7875 4545 39 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 40 | 6570 3780 7875 3780 7875 4545 6570 4545 6570 3780 41 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 42 | 6570 3555 7110 3555 7110 3780 6570 3780 6570 3555 43 | 4 0 0 50 0 0 12 0.0000 4 180 990 6750 4230 aopi.analysis\001 44 | -6 45 | 6 6570 5400 7875 6390 46 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 47 | 6570 5625 7875 5625 7875 6390 6570 6390 6570 5625 48 | 2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 49 | 6570 5400 7110 5400 7110 5625 6570 5625 6570 5400 50 | 4 0 0 50 0 0 12 0.0000 4 180 990 6750 6075 aopi.weaving\001 51 | -6 52 | 2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 53 | 0 0 1.00 60.00 120.00 54 | 4860 3780 4860 2655 55 | 2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 56 | 0 0 1.00 60.00 120.00 57 | 4860 5625 4860 4545 58 | 2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 4 59 | 0 0 1.00 60.00 120.00 60 | 4095 5985 3690 5985 3690 2250 4050 2250 61 | 2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 62 | 0 0 1.00 60.00 120.00 63 | 4905 7515 4905 6390 64 | 2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 3 65 | 0 0 1.00 60.00 120.00 66 | 7245 3780 7245 2295 5355 2295 67 | 2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 68 | 0 0 1.00 60.00 120.00 69 | 6570 5985 5400 5985 70 | 2 1 1 1 0 7 50 0 -1 4.000 0 0 -1 1 0 2 71 | 0 0 1.00 60.00 120.00 72 | 7290 5625 7290 4545 73 | 4 0 0 50 0 0 12 0.0000 4 180 810 4995 7065 \001 74 | 4 0 0 50 0 0 12 0.0000 4 180 810 7380 5175 \001 75 | 4 0 0 50 0 0 12 0.0000 4 180 810 4950 5175 \001 76 | -------------------------------------------------------------------------------- /aopi-pre-spec/doc/gendoc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | javadoc -sourcepath ../src -classpath ../classes -d . aopi aopi.reflect aopi.modif aopi.core aopi.conf aopi.weaving 4 | 5 | 6 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/conf/ConfigurationParser.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.conf; 3 | 4 | import aopi.core.Aspect; 5 | 6 | /** 7 | * This interface represents an aspect configuration parser. 8 | */ 9 | 10 | public interface ConfigurationParser { 11 | 12 | /** 13 | * Parses the configuration descriptor for a given aspect. */ 14 | void parse(Object configurationDescriptor,Aspect aspect); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/conf/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Provides some generic interfaces for configuration of aspects 8 | when allowed by the AO system.

9 | 10 |

It is still to be investigated (not a priority at this stage). 11 | 12 |

Dependencies

13 | 14 |

This package requires the aopi.core package. 15 | 16 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/modif/Modification.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.modif; 3 | 4 | import aopi.reflect.Locator; 5 | 6 | /** 7 | * This interface represents a modification on the base program. 8 | * 9 | *

The program modifier implementation should return a modification 10 | * instance for each modification which is performed. 11 | * 12 | * @see ProgramModifier */ 13 | 14 | public interface Modification { 15 | 16 | /** Interface adding modification type. */ 17 | int ADD_INTERFACE=0; 18 | /** Superclass setting modification type. */ 19 | int SET_SUPERCLASS=1; 20 | /** Class adding modification type. */ 21 | int ADD_CLASS=2; 22 | /** Before code modification type. */ 23 | int ADD_BEFORE_CODE=3; 24 | /** After code adding modification type. */ 25 | int ADD_AFTER_CODE=4; 26 | /** Metadata adding modification type. */ 27 | int ADD_METADATA=5; 28 | 29 | /** 30 | * Returns the location of this modification. */ 31 | Locator getLocation(); 32 | 33 | /** 34 | * Gets the modification type. 35 | * 36 | * @return ADD_INTERFACE | SET_SUPERCLASS | ADD_CLASS | 37 | * ADD_AFTER_CODE | ADD_BEFORE_CODE | ADD_AROUND_CODE | 38 | * ADD_METADATA */ 39 | int getType(); 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/modif/ProgramModifier.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.modif; 3 | 4 | import aopi.reflect.Code; 5 | import aopi.reflect.CodeLocator; 6 | import aopi.reflect.ClassLocator; 7 | import aopi.reflect.UnitLocator; 8 | 9 | /** 10 | * This interface defines all the methods that perform program 11 | * modification that are useful for AOP. 12 | * 13 | *

The modifications definitions rely on an abstract representation 14 | * of locators, as defined in the aopi.reflect package. 15 | * 16 | * @see aopi.reflect.Locator 17 | * @see aopi.reflect.ClassLocator 18 | * @see aopi.reflect.CodeLocator 19 | */ 20 | 21 | public interface ProgramModifier { 22 | 23 | /** 24 | * Adds a new implemented interface to a given class location. */ 25 | Modification addInterface(ClassLocator location, 26 | String newInterfaceName); 27 | 28 | /** 29 | * Sets or replaces the current superclass of a class location. 30 | * 31 | *

The new superclass should be a subtype of the replaced one in 32 | * order to maintain backward compatibility. */ 33 | Modification setSuperClass(ClassLocator location, 34 | String newSuperClassName); 35 | 36 | /** 37 | * Introduces a class to the class location. 38 | * 39 | *

The whole set of fields and methods are introduced into the 40 | * location's class, all the implemented interface of the 41 | * introduced class are also added as interfaces of the location's 42 | * class. */ 43 | Modification addClass(ClassLocator location,String className); 44 | 45 | /** 46 | * Adds a new method to the class location. */ 47 | Modification addMethod(ClassLocator location, 48 | String name, 49 | String[] parameterTypeNames, 50 | String[] parameterNames, 51 | Code body); 52 | 53 | /** 54 | * Adds a new field to the target class. */ 55 | Modification addField(ClassLocator location, 56 | String name, 57 | String typeName, 58 | Code initializator); 59 | 60 | /** 61 | * Adds some code before a given method code body. 62 | * 63 | * @param location the modification locator that can represent a 64 | * method invocation, a field set/get, or a constructor (at callee 65 | * or caller side) 66 | * @param beforeCode the code to be added before 67 | * @param before the modification that must stay before this 68 | * before code 69 | * @param after the modification that must stay after this 70 | * before code 71 | * @return the modification (can be used to place the 72 | * next modifications relatively to this one) */ 73 | Modification addBeforeCode(CodeLocator location, 74 | Code beforeCode, 75 | Modification before, Modification after); 76 | 77 | /** 78 | * Adds some code after a given method code body. 79 | * 80 | * @param location the modification locator that can represent a 81 | * method invocation, a field set/get, or a constructor (at callee 82 | * or caller side) 83 | * @param afterCode the code to be added after 84 | * @param before the modification that must stay before this 85 | * after code 86 | * @param after the modification that must stay after this 87 | * after code 88 | * @return this modification (can be used to place the 89 | * next modifications relatively to this one) */ 90 | Modification addAfterCode(CodeLocator location, 91 | Code afterCode, 92 | Modification before, Modification after); 93 | 94 | /** 95 | * Adds some code around a given method code body. 96 | * 97 | * @param location the modification locator that can represent a 98 | * method invocation, a field set/get, or a constructor (at callee 99 | * or caller side) 100 | * @param aroundCode the code to be added after 101 | * @param before the modification that must stay before this 102 | * after code 103 | * @param after the modification that must stay after this 104 | * after code 105 | * @return this modification (can be used to place the 106 | * next modifications relatively to this one) */ 107 | Modification addAroundCode(CodeLocator location, 108 | Code aroundCode, 109 | Modification before, Modification after); 110 | 111 | } 112 | 113 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/modif/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Provides an API for program modification.

8 | 9 |

This package provides a set of interfaces for applying 10 | modifications on a program. These modifications are abstractly 11 | defined and can occur at compile-time, load-time, or runtime 12 | depending on the ProgramModifier 13 | implementation. Moreover, since it uses the 14 | aopi.reflect package which provides an abstract 15 | representation of the program, the transformations can be 16 | implemented at a source-code level or at a bytecode level, 17 | depending on the implementation. 18 | 19 |

This API is specific to AOP. This means that the set of program 20 | modifications that is allowed is a restricted set compared to a 21 | general-purpose API. However, general-purpose transformation 22 | tools should provide an implementation of this API in order to be 23 | easily used by several AO systems. 24 | 25 |

Dependencies

26 | 27 |

This package requires the aopi.reflect package. 28 | 29 |

It is typically used by aopi.core package (but in 30 | an optional mode). 31 | 32 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

AOPI (AOP Interfaces) are a standard specification of a set of 8 | useful or mandatory componants for aspect-oriented systems. 9 | 10 |

The idea is to have a common set of abstract components 11 | specifications, distributed under a Public Domain licence, that 12 | will help all the projets to communicate and reuse components 13 | coming from other projects. 14 | 15 |

The AOPI project is a joint project between several software 16 | engineering people who are interested in AOP or some other 17 | related projects. 18 | 19 | 20 |

Overview

21 | 22 |

23 | 24 |

25 | 26 |

Motiviations

27 | 28 |

AOP is a new programming paradigm and set of techniques that 29 | allows better separation and modularization of concerns. 30 | 31 |

Several projects now provide AOP-related techniques such as 32 | generic proxies, interceptors, or bytecode translators. Thus, we 33 | can see a lot of new components or systems arising to perform 34 | AOP or AOP-releated stuffs: 35 | 36 |

71 | 72 |

All these projects have their onw goals and 73 | speficities. However, several common basic components are still 74 | usefull (and sometimes required) to build a full AO system. For 75 | instance, a component that is able to add metadata on the base 76 | components, a component that is able to perform code translation 77 | in order to advice the classes, a weaver component, a 78 | configuration component, and so on. 79 | 80 |

To us, it would be great to be able to reuse different 81 | components coming from different projects to build a full AO 82 | system, and for three main reasons.

83 | 84 | 110 | 111 |

For these reasons, we think that a standarization of the 112 | interfaces of the aspect-oriented components would be great and 113 | will bring great simplifications for the entire AOSD community, 114 | but also for all the communities that will to use AOP in a close 115 | future (e.g. JBoss). 116 | 117 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/Class.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This element represents classes in the base program. */ 6 | 7 | public interface Class extends ProgramUnit { 8 | 9 | /** 10 | * Returns the class locator that corresponds to this class. 11 | * 12 | *

This method returns exactly the same result as 13 | * ProgramUnit.getLocator() but with a more precise 14 | * type (ClassLocator instead of 15 | * UnitLocator). 16 | * 17 | * @see ProgramUnit#getLocator() */ 18 | ClassLocator getClassLocator(); 19 | 20 | /** 21 | * Gets the class's full name. */ 22 | String getName(); 23 | 24 | /** 25 | * Gets the fields of this class (including superclass fields). */ 26 | Field[] getFields(); 27 | 28 | /** 29 | * Gets the fields declared by this class. */ 30 | Field[] getDeclaredFields(); 31 | 32 | /** 33 | * Gets the methods of this class (including superclass 34 | * methods). */ 35 | Method[] getMethods(); 36 | 37 | /** 38 | * Gets the methods declared by this class. */ 39 | Method[] getDeclaredMethods(); 40 | 41 | /** 42 | * Gets the superclass of this class. */ 43 | Class getSuperclass(); 44 | 45 | /** 46 | * Gets all the interfaces implemented by this class. */ 47 | Class[] getInterfaces(); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/ClassLocator.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This interface represents a specific unit locator for base program classes. 6 | * 7 | *

For instance, this locator can represent a given class, or a 8 | * given classes set (e.g. all the classes of a given package or all 9 | * the classes that implement a given interface). 10 | * 11 | * @see ProgramUnit#getLocator() 12 | * @see Class#getClassLocator() */ 13 | 14 | public interface ClassLocator extends UnitLocator { 15 | } 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/Code.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This represents a piece of code in the program. 6 | * 7 | *

It is formed of a set of instructions and can be implemented at 8 | * bytecode or source-code level. 9 | * 10 | *

Typically, a code in the program comes from method bodies (it 11 | * can be init methods (instance or static) or regular methods 12 | * (instance or static) with any kind of visibility modifiers (public, 13 | * protected, private). 14 | * 15 | *

So, this class allows the client to retrieve code locators on 16 | * instructions within this code. This locators shall be used 17 | * conjointly whith an aopi.modif.ProgramModifier 18 | * implementation in order to perform aspetual transformations of the 19 | * program (before/after/around type). 20 | * 21 | *

The getLocator method returns the locator for the 22 | * whole method and can be used to implement callee-side 23 | * transformations before/after/around the callee method. 24 | * 25 | *

The other set of locating methods returns locators that allows 26 | * the client to implement caller-side transformations (e.g. when the 27 | * code accesses a field or calls a method). 28 | * 29 | * @see aopi.modif.ProgramModifier 30 | * @see CodeLocator 31 | * @see Method#getBody() */ 32 | 33 | public interface Code { 34 | 35 | /** 36 | * Returns the code locator that corresponds to this code. 37 | * 38 | *

For instance, if a code is a set of instructions called 39 | * code, then the locator will designate 40 | * <code>. 41 | * 42 | *

This locator is typically used to locate a whole method body. 43 | * 44 | * @see Method#getBody() */ 45 | CodeLocator getLocator(); 46 | 47 | /** 48 | * Returns a call locator for the given callee method. 49 | * 50 | *

For instance, a call locator for method m() 51 | * designates the parts between <> in the 52 | * following code. 53 | * 54 | *

 55 |     * [...]
 56 |     * aLocalVariable.<m()>;
 57 |     * [...]
 58 |     * aMethodParameter.<m()>;
 59 |     * [...]
 60 |     * aField.<m()>;
 61 |     * [...]
 62 |     * <m()> // when m is a method of the class the current code belongs to
 63 |     * [...]
 64 |     * 
65 | * 66 | *

If the given method is a static method, the locator follows 67 | * the same principles, as for constructors. For instance if the 68 | * current method is the init method of class 69 | * C: 70 | * 71 | *

 72 |     * [...]
 73 |     * aVar = <new C()>;
 74 |     * [...]
 75 |     * 
76 | * 77 | * @param calleeMethod the method that is called from the current 78 | * code */ 79 | CodeLocator getCallLocator(Method calleeMethod); 80 | 81 | /** 82 | * Returns a field reading locator in the current body. 83 | * 84 | *

For instance, a field read locator for field f 85 | * designates the parts between <> in the 86 | * following code. 87 | * 88 | *

 89 |     * [...]
 90 |     * <f>.m();
 91 |     * [...]
 92 |     * aVarOrFieldOrParam = <f>;
 93 |     * [...]
 94 |     * 
95 | * 96 | * @param readField the field that is read from the current code */ 97 | CodeLocator getReadLocator(Field readField); 98 | 99 | /** 100 | * Returns a field writing locator in the current body. 101 | * 102 | *

For instance, a field write locator for field f 103 | * designates the parts between <> in the 104 | * following code. 105 | * 106 | *

107 |     * [...]
108 |     * <f=> aVarOrFieldOrParam;
109 |     * [...]
110 |     * 
111 | * 112 | * @param writtenField the field that is written from the current 113 | * code */ 114 | CodeLocator getWriteLocator(Field writtenField); 115 | 116 | /** 117 | * Returns a exception throwing locator in the current body. 118 | * 119 | *

For instance, an exception throw locator for exception of 120 | * type E designates the parts between 121 | * <> in the following code. 122 | * 123 | *

124 |     * [...]
125 |     * <throw> new E();
126 |     * [...]
127 |     * throw new AnotherExceptionType();
128 |     * [...]
129 |     * 
130 | * 131 | * @param exeptionType the type of the throwed exception */ 132 | CodeLocator getThrowLocator(Class exceptionType); 133 | 134 | /** 135 | * Returns a exception catching locator in the current body. 136 | * 137 | *

For instance, an exception catch locator for exception of 138 | * type E designates the parts between 139 | * <> in the following code. 140 | * 141 | *

142 |     * [...]
143 |     * try {
144 |     *   [...]
145 |     * } catch(E e1) {
146 |     *   <[...]>
147 |     * } catch(AnotherExceptionType e2) { [...] };
148 |     * [...]
149 |     * 
150 | * 151 | * @param exeptionType the type of the throwed exception */ 152 | CodeLocator getCatchLocator(Class exceptionType); 153 | 154 | } 155 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/CodeLocator.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This interface represents a locator on a base program piece of 6 | * code. 7 | * 8 | *

The AOPI implementation provider should provide code locators 9 | * implementations in order to support several kinds of code locators 10 | * (e.g. as the ones used in the Code interface). 11 | * 12 | *

The AOPI client program gets the locator by navigating the base 13 | * program metamodel (using the aopi.reflect package) and 14 | * using the get...Locator(...) methods. 15 | * 16 | *

Code locators are quite different from unit locators. 17 | * 18 | * @see Code 19 | * @see Code#getLocator() 20 | * @see Code#getCallLocator(Method) 21 | * @see Code#getReadLocator(Field) 22 | * @see Code#getWriteLocator(Field) 23 | * @see Code#getThrowLocator(Class) 24 | * @see Code#getCatchLocator(Class) 25 | * @see Method#getCallLocator() 26 | * @see UnitLocator */ 27 | 28 | public interface CodeLocator extends Locator { 29 | } 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/Field.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This represents a field of a class. */ 6 | 7 | public interface Field extends Member { 8 | 9 | /** 10 | * Same as getReadLocator(USER_SIDE). 11 | * 12 | * @see #getReadLocator(int) */ 13 | CodeLocator getReadLocator(); 14 | 15 | /** 16 | * This methods returns the points where the current field is read. 17 | * 18 | *

There are two different behaviors for this method depending 19 | * on the side of the locator. At the user side, the locator 20 | * designates all the points in methods bodies where the field is 21 | * read (similarly to Code.getReadLocator(Field)). At 22 | * the provider side, it really may depend on the implementor 23 | * choice (e.g. it can return a locator on the body of the field's 24 | * getter). 25 | * 26 | *

In Java, the user side is most of the time used so that you 27 | * can use the method getReadLocator(). 28 | * 29 | * @param side USER_SIDE || PROVIDER_SIDE 30 | * @see #getReadLocator() */ 31 | CodeLocator getReadLocator(int side); 32 | 33 | /** 34 | * Same as getWriteLocator(USER_SIDE). 35 | * 36 | * @see #getWriteLocator(int) */ 37 | CodeLocator getWriteLocator(); 38 | 39 | /** 40 | * This methods returns the points where the current field is 41 | * written. 42 | * 43 | *

There are two different behaviors for this method depending 44 | * on the side of the locator. At the user side, the locator 45 | * designates all the points in methods bodies where the field is 46 | * written (similarly to Code.getWriteLocator(Field)). At 47 | * the provider side, it really may depend on the implementor 48 | * choice (e.g. it can return a locator on the body of the field's 49 | * setter). 50 | * 51 | *

In Java, the user side is most of the time used so that you 52 | * can use the method getWriteLocator(). 53 | * 54 | * @param side USER_SIDE || PROVIDER_SIDE 55 | * @see #getWriteLocator() */ 56 | CodeLocator getWriteLocator(int side); 57 | 58 | } 59 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/Locator.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This interface represents a locator on the base program. 6 | * 7 | *

The locators are used by the reflection API client to identify 8 | * point(s) in the program. The client can retrieve locators by using 9 | * the get...Locator(...) methods on the reflection API 10 | * elements. For futher details, see the subinterfaces of this 11 | * interface. */ 12 | 13 | public interface Locator { 14 | } 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/Member.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This interface represents a class member. 6 | * 7 | *

A member can be a field, a method, or a constructor. */ 8 | 9 | public interface Member extends ProgramUnit { 10 | 11 | /** 12 | * A constant to denote the program side that uses this member. */ 13 | int USER_SIDE=0; 14 | /** 15 | * A constant to denote the program side that provides this 16 | * member. */ 17 | int PROVIDER_SIDE=1; 18 | 19 | /** 20 | * Gets the class that declares this member. */ 21 | Class getDeclaringClass(); 22 | 23 | /** 24 | * The member's name. */ 25 | String getName(); 26 | 27 | /** 28 | * The modifiers value. */ 29 | int getModifiers(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/Metadata.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * A metadata is a pair of values (key,data) that can be associated to 6 | * a program unit. 7 | * 8 | * @see ProgramUnit 9 | * @see ProgramUnit#addMetadata(Metadata) */ 10 | 11 | public interface Metadata { 12 | 13 | /** 14 | * Gets the key of this metadata. */ 15 | Object getKey(); 16 | 17 | /** 18 | * Gets the value of this metadata. */ 19 | Object getValue(); 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/Method.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This represents a method of a class. */ 6 | 7 | public interface Method extends Member { 8 | 9 | /** 10 | * This locator contains all the points in the program that call 11 | * this method. 12 | * 13 | *

Note that this code locator corresponds to the client-side 14 | * call event (equiv. to 15 | * this.getLocator(USER_SIDE). To get the server-side 16 | * equivalent locator, one must write 17 | * this.getBody().getLocator() or 18 | * this.getLocator(PROVIDER_SIDE). 19 | * 20 | *

It is a very invasive feature since it designates all the 21 | * calling points in all the classes of the application. To only 22 | * designate the calling points in a given client method, one 23 | * should write 24 | * aClientMethod.getBody().getCallLocator(this). 25 | * 26 | * @see Code#getLocator() 27 | * @see Code#getCallLocator(Method) */ 28 | CodeLocator getCallLocator(); 29 | 30 | /** 31 | * A full version of getCallLocator(). 32 | * 33 | * @param side USER_SIDE || PROVIDER_SIDE 34 | * @see #getCallLocator() */ 35 | CodeLocator getCallLocator(int side); 36 | 37 | 38 | /** 39 | * Returns the body of the current method. */ 40 | Code getBody(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/ProgramUnit.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * An abstract program unit. 6 | * 7 | *

Any structural unit of a base program (class, member, 8 | * ...). Units exclude the code. 9 | * 10 | *

When referencing a program unit, the client can retrieve unit 11 | * locators using getLocator() or more specific 12 | * methods. This locators shall be used conjointly whith an 13 | * aopi.modif.ProgramModifier implementation in order to 14 | * perform aspetual transformations of the program (e.g. type merging, 15 | * parameters adding,...). 16 | * 17 | *

Program units also supports metadatas, i.e. the ability to add 18 | * extra information on the base program so that the client can 19 | * extends its meaning very easily. 20 | * 21 | * @see aopi.modif.ProgramModifier 22 | * @see UnitLocator 23 | * @see Class 24 | * @see Method 25 | * @see Field */ 26 | 27 | public interface ProgramUnit { 28 | 29 | /** 30 | * Returns the locator that corresponds to this unit. 31 | */ 32 | UnitLocator getLocator(); 33 | 34 | /** 35 | * Returns the metadata that is associated to this unit from its 36 | * key. */ 37 | Metadata getMetadata(Object key); 38 | 39 | /** 40 | * Returns all the metadatas that are associated to the current 41 | * unit. */ 42 | Metadata[] getMetadatas(); 43 | 44 | /** 45 | * Associates a metadata to the current unit. 46 | * 47 | *

If a metadata already exists with the same key, then its 48 | * value is replaced by the newly given one. */ 49 | void addMetadata(Metadata metadata); 50 | 51 | /** 52 | * Removes a metadata from its key. 53 | * 54 | *

If none metadata having the given key exists, then this method 55 | * has no effect. */ 56 | void removeMetadata(Object key); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/UnitLocator.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.reflect; 3 | 4 | /** 5 | * This interface represents a locator on a base program structural unit. 6 | * 7 | *

A program unit represents any structural part of the program 8 | * (i.e. any part excepting code) such as a class, a method, a 9 | * field... 10 | * 11 | *

Unit locators are quite different from code locators. 12 | * 13 | * @see ProgramUnit 14 | * @see ProgramUnit#getLocator() 15 | * @see CodeLocator */ 16 | 17 | public interface UnitLocator extends Locator { 18 | } 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/reflect/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Provides a set of interfaces for implementing a generic 8 | reflection API.

9 | 10 |

The motivations of this package are to have a generic 11 | reflection API with interfaces so that any AO system provider can 12 | implement its own base program introspection package. In general, 13 | we cannot use java.lang.reflect since in most of the 14 | AOP systems, this representation is not available (e.g. in 15 | load-time systems or compile-time systems). 16 | 17 |

The implementor can implement this API for compile-time purpose 18 | (for instance based on a source-code analysis implementation), for a 19 | load-time purpose (mostly based on a bytecode-level 20 | implementation), or for a run-time purpose. 21 | 22 |

This package has be rougthly specified and really needs further 23 | investigations. 24 | 25 |

Dependencies

26 | 27 |

This package is used by most of the AOPI packages (as soon as a 28 | reference on a class or a member is requiered in the API). 29 | 30 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/weaving/DynamicWeaver.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.weaving; 3 | 4 | import aopi.core.Aspect; 5 | import aopi.core.AspectElement; 6 | 7 | /** 8 | * This interface represents a dynamic weaver for dynamic AOP. 9 | * 10 | *

In dynamic AOP, aspects can be removed or reconfigured at 11 | * runtime. */ 12 | 13 | public interface DynamicWeaver extends Weaver { 14 | 15 | /** 16 | * Unweaves a currently woven aspect. */ 17 | void unweave(Aspect aspect); 18 | 19 | /** 20 | * Unweaves a currently applied aspect element. 21 | * 22 | *

This feature allows finer grained unweaving. */ 23 | void unweave(AspectElement aspectElement); 24 | 25 | /** 26 | * Reloads a given aspect (its definition and/or configuration 27 | * might have changed since it has been last woven or reloaded). */ 28 | void reload(Aspect aspect); 29 | 30 | /** 31 | * Reloads a given aspect element. */ 32 | void reload(AspectElement aspectElement); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/weaving/Weaver.java: -------------------------------------------------------------------------------- 1 | 2 | package aopi.weaving; 3 | 4 | import aopi.core.Aspect; 5 | import aopi.core.WeavingRule; 6 | 7 | /** 8 | * This interface represents a weaver in an AO system. 9 | * 10 | *

A weaver is the sofware component which is responsible for 11 | * taking all the aspects and composing then to the base program. To 12 | * be AOPI-compliant, this weaver should use the 13 | * aopi.modif.ProgramModifier interface. 14 | * 15 | * @see aopi.modif.ProgramModifier */ 16 | 17 | public interface Weaver { 18 | 19 | /** 20 | * Weaves a given aspect to the program. */ 21 | void weave(Aspect aspect); 22 | 23 | /** 24 | * Get all the aspects handled by this weaver. */ 25 | Aspect getAspects(); 26 | 27 | /** 28 | * Returns the list of all the global weaving rules. 29 | * 30 | *

This has to be further investigated and specified. */ 31 | WeavingRule[] getWeavingRules(); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /aopi-pre-spec/src/aopi/weaving/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Provides the standard weaving components interfaces in an AOP 8 | system.

9 | 10 |

Dependencies

11 | 12 |

This package requires the aopi.core package. 13 | 14 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /www/basic.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: helvetica, sans-serif; 3 | background-color: white; 4 | padding-left: 1em; 5 | padding-right: 1em; 6 | } 7 | .title { 8 | font-family: helvetica, sans-serif; 9 | font-weight:bold; 10 | background-color: white; 11 | text-align:center; 12 | font-size: large; 13 | } 14 | p, ul, ol, dl { 15 | margin-left: 4em; 16 | margin-right: 4em; 17 | } 18 | h2, h3, h4 { 19 | margin-right: 2em; 20 | } 21 | ul,ol,dl { 22 | padding-left: 0; 23 | } 24 | li { 25 | margin-left: 3em; 26 | } 27 | li ul { 28 | margin-right: 0; 29 | } 30 | li .code { 31 | margin-left: 1em; 32 | } 33 | li p { 34 | margin-left: 0; 35 | } 36 | dt { 37 | font-weight: bold; 38 | display: compact; 39 | } 40 | dd { 41 | display: block; 42 | } 43 | h1 { 44 | color: #FFFFFF; 45 | border: 1px solid #444488; 46 | background-color: #222244; 47 | padding: 0.1em 0.2em 0.1em 0.3em; 48 | font-weight: bold; 49 | font-size: large; 50 | } 51 | h1, h2, h3, h4 { 52 | margin-top: 1em; 53 | margin-bottom: 0.3em; 54 | } 55 | h2, h3, h4 { 56 | color: #A00000; 57 | font-weight: normal; 58 | font-size: large; 59 | } 60 | h4 { 61 | font-style: italic; 62 | } 63 | .example { 64 | margin-left: 2em; 65 | color: black; 66 | font-weight: bold; 67 | font-style: normal; 68 | } 69 | .abstract { 70 | margin-left: 4em; 71 | margin-right: 4em; 72 | } 73 | .question { 74 | color: black; 75 | border: 1px solid #A0A0FF; 76 | background-color: #A0A0FF; 77 | padding: 0.1em 0.2em 0.1em 0.3em; 78 | font-weight: bold; 79 | font-style: normal; 80 | } 81 | .normal th { 82 | background-color: #6677aa; 83 | } 84 | .normal td { 85 | background-color: #E0E0FF; 86 | } 87 | .subtitle { 88 | color: #AA0000; 89 | text-align: center; 90 | margin-top: 1em; 91 | margin-bottom: 1em; 92 | } 93 | pre { 94 | margin-left: 5em; 95 | } 96 | A:link { color: blue} 97 | A:visited { color: purple} 98 | A:active { color: red} 99 | 100 | DIV.screenshot, DIV.figure { 101 | text-align: center; 102 | margin-top: 1ex; 103 | } 104 | .netscapeonly { 105 | display: none; 106 | } 107 | img { 108 | vertical-align: middle; 109 | } 110 | .screenshot IMG, .figure IMG { 111 | text-align: center; 112 | float: none; 113 | padding: 6px; 114 | } 115 | .figure IMG { 116 | border: 2px solid #AA0000; 117 | } 118 | .footer { 119 | border: 1px solid #0000AA; 120 | color: #666666; 121 | font-size: smaller; 122 | margin-top: 2em; 123 | padding: 0.5em; 124 | background-color: #DDDDEE; 125 | } 126 | .selected { 127 | font-weight: bold; 128 | background-color: #AA0000; 129 | padding: 0.5em; 130 | color: white; 131 | border-style: none; 132 | letter-spacing: 1px; 133 | } 134 | .unselected { 135 | padding: 0.5em; 136 | } 137 | .menu { 138 | background-color: #FFEEEE; 139 | border: 1px solid #AA0000; 140 | padding: 0.5em 0 0.5em 0; 141 | text-align: center; 142 | } 143 | .menu A:link { 144 | color: #DD0000; 145 | } 146 | .menu A:visited { 147 | color: #990000; 148 | } 149 | .menu tr td, .menu tr, .menu p, .menu tbody { 150 | padding: 0; 151 | margin: 0; 152 | border-style: none; 153 | } 154 | .code, .output { 155 | background-color: #DDDDEE; 156 | border: 1px solid #DDDDEE; 157 | white-space: pre; 158 | margin-left: 3em; 159 | margin-right: 3em; 160 | padding: 1em; 161 | } 162 | .code { 163 | background-color: #DDDDEE; 164 | } 165 | .output { 166 | background-color: #DDFFDD; 167 | } 168 | .class, .method { 169 | font-family: Courrier, monospace; 170 | } 171 | .news { 172 | float: right; 173 | width: 25%; 174 | background-color: #fff; 175 | border: 1px solid #444488; 176 | padding: 0.3em; 177 | font-size: smaller; 178 | margin-top: 1em; 179 | margin-bottom: 1em; 180 | margin-left: 1em; 181 | } 182 | .news p, .news ul, .news ol { 183 | margin: 0; 184 | padding: 0; 185 | } 186 | .news h1 { 187 | font-size: larger; 188 | font-weight: bold; 189 | margin: 0 0 0.4em 0; 190 | } 191 | .news img { 192 | border-style: none; 193 | vertical-align: middle; 194 | margin-top: 5px; 195 | margin-bottom: 5px; 196 | } 197 | .news li { 198 | margin-left: 1em; 199 | } 200 | .main { 201 | padding-top: 0.2em; 202 | } 203 | .flag { 204 | vertical-align: middle; 205 | margin-right: 0.2em; 206 | height: 1em; 207 | } 208 | .note { 209 | font-style: italic; 210 | margin-left: 3em; 211 | margin-right: 3em; 212 | } 213 | .warning { 214 | font-weight: bold; 215 | } 216 | .toupdate { 217 | font-weight: bold; 218 | color: red; 219 | } 220 | .important { 221 | font-weight: bold; 222 | color: red; 223 | text-transform: uppercase; 224 | } 225 | .file { 226 | } 227 | 228 | .valid img { 229 | border-style: none; 230 | } 231 | .valid a { 232 | border-style: none; 233 | } 234 | -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AOP Alliance 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 |

AOP Alliance (Java/J2EE AOP standards)
14 | 15 |

AOP Alliance, presentation

16 | 17 |

The AOP Alliance project is a joint open-source project between 18 | several software engineering people who are interested in AOP and 19 | Java. 20 | 21 |

LICENCE: all the source code provided by AOP Alliance is Public Domain. 22 | 23 |

view the members' list....

24 | 25 |

We believe that Aspect-Oriented Programming (AOP) offers a 26 | better solution to many problems than do existing technologies 27 | such as EJB. AOP Alliance intends to facilitate and standardize 28 | the use of AOP to enhance existing middleware environments (such 29 | as J2EE), or development environements (e.g. JBuilder, Eclipse). 30 | The AOP Alliance also aims to ensure interoperability between 31 | Java/J2EE AOP implementations to build a larger AOP community. 32 | 33 |

read more details...

34 | 35 | 39 |

Materials

40 | 41 | 73 | 74 |
75 | 76 | 77 | -------------------------------------------------------------------------------- /www/members.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hoverruan/aopalliance/0d7757ae204e5876f69431421fe9bc2a4f01e8a0/www/members.html -------------------------------------------------------------------------------- /www/motivations.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AOP Alliance 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 |
AOP Alliance (Java/J2EE AOP standards)
14 | 15 |

Motiviations

16 | 17 |

Aspect-Oriented Programming (AOP) is a programming technique 18 | that will be able to enhance several existing middleware 19 | environments (such as J2EE), or development environements 20 | (e.g. JBuilder, Eclipse). 21 | 22 |

Several projects now provide AOP-related techniques such as 23 | generic proxies, interceptors, or bytecode translators. 24 | 25 |

66 | 67 |

All these projects have their onw goals and 68 | speficities. However, several common basic components are still 69 | usefull (and sometimes required) to build a full AO system. For 70 | instance, a component that is able to add metadata on the base 71 | components, an interception framework, a component that is able 72 | to perform code translation in order to advice the classes, a 73 | weaver component, a configuration component, and so on. 74 | 75 |

To us, it would be great to be able to reuse different 76 | components coming from different projects to build a full AO 77 | system, and for three main reasons.

78 | 79 | 103 | 104 |

For these reasons, we think that a standarization of the 105 | interfaces of the aspect-oriented components would be great and 106 | will bring great simplifications for the entire AOSD community, 107 | but also for all the communities that will to use AOP in a close 108 | future. 109 | 110 | 111 |


112 | 113 | 114 | --------------------------------------------------------------------------------