KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ExampleAspect


1 // $Id: ExampleAspect.java,v 1.1.1.1 2003/07/02 15:30:42 apopovic Exp $
2
// =====================================================================
3
//
4
// (history at end)
5
//
6

7
8
9 // used packages
10
import ch.ethz.prose.DefaultAspect;
11 import ch.ethz.prose.crosscut.Crosscut;
12 import ch.ethz.prose.crosscut.MethodCut;
13 import ch.ethz.prose.crosscut.REST;
14 import ch.ethz.prose.crosscut.ANY;
15 import ch.ethz.prose.filter.Executions;
16 import ch.ethz.prose.filter.Within;
17 import ch.ethz.prose.filter.PointCutter;
18 import ch.ethz.prose.crosscut.MissingInformationException;
19
20 /**
21  * Class ExampleAspect
22  *
23  * @version $Revision: 1.1.1.1 $
24  * @author Andrei Popovici
25  */

26 public
27 class ExampleAspect extends DefaultAspect
28 {
29
30     public Crosscut c1 = new MethodCut()
31     {
32         // execute advice on executions of the form *.*(String..)
33
public void METHOD_ARGS(ANY x, String JavaDoc arg1,REST y)
34         {
35           System.err.println(" ->advice: before "+ x.getObject() + ".'bar*'("+ arg1 +",..) called");
36         }
37
38       // .. && calls(* bar(..))
39
protected PointCutter pointCutter()
40         {return ( (Executions.before()) . AND
41                (Within.method("bar.*")) . AND
42                    (Within.type("Foo")) );}
43     };
44
45 }
46
47
48 //======================================================================
49
//
50
// $Log: ExampleAspect.java,v $
51
// Revision 1.1.1.1 2003/07/02 15:30:42 apopovic
52
// Imported from ETH Zurich
53
//
54
// Revision 1.1 2003/06/10 16:43:33 popovici
55
// New basic local and remote examples; old GUI von pschoch obsolete
56
//
57
// Revision 1.13 2003/05/05 14:03:14 popovici
58
// renaming from runes to prose
59
//
60
// Revision 1.12 2003/04/27 13:09:03 popovici
61
// Specializers renamed to PointCutter
62
//
63
// Revision 1.11 2003/04/17 15:15:00 popovici
64
// Extension->Aspect renaming
65
//
66
// Revision 1.10 2003/04/17 14:51:16 popovici
67
// ExceptionS renamed to Exception; method renamings
68
//
69
// Revision 1.9 2003/04/17 13:54:33 popovici
70
// Refactorization of 'ExecutionS' into 'Within' and 'Executions'.
71
// Method names refer now to 'types'
72
//
73
// Revision 1.8 2003/04/17 12:49:31 popovici
74
// Refactoring of the crosscut package
75
// ExceptionCut renamed to ThrowCut
76
// McutSignature is now SignaturePattern
77
//
78
// Revision 1.7 2003/04/17 12:31:00 popovici
79
// Fixed problems after refactoring; examples/gui
80
// still used the old style advices/pointcuts
81
//
82
// Revision 1.6 2003/04/17 08:46:40 popovici
83
// Important functionality additions
84
// - Cflow specializers
85
// - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
86
// - Transactional capabilities
87
// - Total refactoring of Specializer evaluation, which permits fine-grained distinction
88
// between static and dynamic specializers.
89
// - Functionality pulled up in abstract classes
90
// - Uniformization of advice methods patterns and names
91
//
92
// Revision 1.5 2003/03/13 14:20:25 popovici
93
// Tools and modifications for a demo with remote clients
94
//
95
// Revision 1.4 2003/03/05 12:08:40 popovici
96
// Deobfuscation of exception filters. They are now
97
// top level classes. This is just an intermediate refactoring
98
// step. Many Exceptions. predicate will be eliminated
99
// by more powerful Specializers like 'Within'
100
//
101
// Revision 1.3 2002/06/07 07:40:23 popovici
102
// Adapted to the ClasseS/DeclarationS, MethodCut, etc.. refactorization
103
//
104
// Revision 1.1 2002/03/27 13:56:39 popovici
105
// Legal and realease changes:
106
// added LEGAL & licenses
107
// added profiles/release
108
// added programs/* scripts for installation
109
// modified project/* files for installation
110
//
111
Popular Tags