KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > prose > crosscut > Crosscut


1 //
2
// This file is part of the prose package.
3
//
4
// The contents of this file are subject to the Mozilla Public License
5
// Version 1.1 (the "License"); you may not use this file except in
6
// compliance with the License. You may obtain a copy of the License at
7
// http://www.mozilla.org/MPL/
8
//
9
// Software distributed under the License is distributed on an "AS IS" basis,
10
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
// for the specific language governing rights and limitations under the
12
// License.
13
//
14
// The Original Code is prose.
15
//
16
// The Initial Developer of the Original Code is Andrei Popovici. Portions
17
// created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
18
// All Rights Reserved.
19
//
20
// Contributor(s):
21
// $Id: Crosscut.java,v 1.1.1.1 2003/07/02 15:30:51 apopovic Exp $
22
// =====================================================================
23
//
24
// (history at end)
25
//
26

27 package ch.ethz.prose.crosscut;
28
29 import java.io.Serializable JavaDoc;
30
31 import ch.ethz.prose.Insertable;
32 import ch.ethz.prose.Aspect;
33 import ch.ethz.prose.engine.JoinPointListener;
34
35 /**
36  * <h3>User perspective</H3>
37  * If you want to use crosscuts, than you have to understand two things:
38  * <ul>
39  * <li> how to write advices
40  * <li> how to use point-cutters.
41  * </ul>
42  * Read the documentation for <code>MethodCut</code>, <code>GetCut</code> etc
43  * to understand these issues.
44  *
45  * <h3>Developer perspective </h3>
46  * Class Crosscut defines an object which can create <code>CrosscutRequests</code>.
47  * A crosscut request defines a crosscut as a set of join point requests together with
48  * actions to be performed when the events corresponding to the crosscut it defines are
49  * triggered.
50  * <p>
51  * A crosscut is also a <code>JointPointListener</code>. According to
52  * the contract provided by <code>JoinPointManager</code>
53  * an crosscut expects to be notified only for those events
54  * which correspond to the requests it has created itself.
55  * Crossscut objects are expected to be used in two modes:
56  * <ul>
57  * <li> when first defining a crosscuting action for the current state
58  * of the VM
59  * <li> when a new class is loaded in the current VM
60  * </ul>
61  *
62  * @version $Revision: 1.1.1.1 $
63  * @author Andrei Popovici
64  */

65 public
66 abstract class Crosscut extends JoinPointListener implements Insertable, Serializable JavaDoc {
67
68   /** Create a <code>CrosscutRequest</code> for the specified class in the local
69    * virtual machine. This method should be used by first use of this crosscut. It
70    * analyses either all classes of the virtual machine or a definite subset of it,
71    * specific for this <code>Crosscut</code>.
72    * <p>
73    * The <code>JoinPointRequest</code>s in the result of this method are created
74    * using the factory specified with <code>setRequestFactorye</code>.
75    *
76    * @result the CrosscutRequest corresponding to the join-points defined by this
77    * crosscut with respect to the current state of the local VM
78    */

79   public abstract CrosscutRequest createRequest();
80
81   /** Create a <code>CrosscutRequest</code> for the local virtual machine, but containing
82    * requests for joinpoints only inside the class <code>crtCls</code>. This method
83    * is expected to be used upon loading of new classes.
84    *
85    * <p>
86    * The <code>JoinPointRequests</code> in the result of this method are created
87    * using the factory specified with <code>setRequestFactorye</code>.
88    */

89    public abstract CrosscutRequest createRequest(Class JavaDoc crtCls);
90
91    /**
92     * Associated this crosscut to the group <code>grp</code>.
93     * By associating a crosscut to a group, the advice of
94     * this crosscut are executed depending on the state of the
95     * group.
96     * (see <code>CrosscutGroup.setExecuteAdvice</code>)
97     *
98     */

99     public abstract void associateToGroup(CrosscutGroup grp);
100
101
102     /** Return the Aspect that owns this crosscut.
103      */

104     public abstract Aspect getOwner();
105
106   /** Set the Aspect that owns this crosscut. This method cannot be
107    * executed twice (crosscut cannot change owners).
108    */

109   public abstract void setOwner(Aspect x);
110
111
112 }
113
114 //======================================================================
115
//
116
// $Log: Crosscut.java,v $
117
// Revision 1.1.1.1 2003/07/02 15:30:51 apopovic
118
// Imported from ETH Zurich
119
//
120
// Revision 1.2 2003/05/26 13:28:51 popovici
121
// Documentation Improvements
122
//
123
// Revision 1.1 2003/05/05 13:58:17 popovici
124
// renaming from runes to prose
125
//
126
// Revision 1.10 2003/04/29 12:41:06 popovici
127
// Feature added:
128
// - the 'setPriority' in class insertable allows now Aspects and Crosscuts to have a priority.
129
// Notitification is done from low int priorities to high int priorities.
130
// - the 'setAspectID' introduced to replace constuctor; used to be cumberstone for subclasses
131
//
132
// Revision 1.9 2003/04/17 15:15:19 popovici
133
// Extension->Aspect renaming
134
//
135
// Revision 1.8 2003/04/17 12:49:24 popovici
136
// Refactoring of the crosscut package
137
// ExceptionCut renamed to ThrowCut
138
// McutSignature is now SignaturePattern
139
//
140
// Revision 1.7 2003/04/17 08:47:17 popovici
141
// Important functionality additions
142
// - Cflow specializers
143
// - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
144
// - Transactional capabilities
145
// - Total refactoring of Specializer evaluation, which permits fine-grained distinction
146
// between static and dynamic specializers.
147
// - Functionality pulled up in abstract classes
148
// - Uniformization of advice methods patterns and names
149
//
150
// Revision 1.6 2003/03/04 18:36:35 popovici
151
// Organization of imprts
152
//
153
// Revision 1.5 2002/03/28 13:48:42 popovici
154
// Mozilla-ified
155
//
156
// Revision 1.4 2002/03/12 09:49:32 popovici
157
// Join Point listener now abstract class (performance reasons)
158
//
159
// Revision 1.3 2002/02/21 12:36:48 popovici
160
// Interface 'Insertable' added. Extensions and crosscuts
161
// are now insertable objects.
162
//
163
// Revision 1.2 2002/02/05 09:46:51 smarkwal
164
// JVMDI-specific code replaced by JVMAI. Prose-implementation classes and reflection package removed.
165
//
166
// Revision 1.1.1.1 2001/11/29 18:13:17 popovici
167
// Sources from runes
168
//
169
// Revision 1.1.2.3 2001/11/21 11:56:26 popovici
170
//
171
// -The sun.tools.agent and ch.ethz.inf.util.JVMDIUtil functionality
172
// replaced with the iks.jvmdi package. References to this old
173
// functionality replaced throughout the code.
174
// -Partial reimplementation of the ch.ethz.inf.iks.runes classes,
175
// part of their functionality moved to the ch.ethz.prose.reflect
176
// abstract classes. New classes and functionality added to the
177
// ch.ethz.prose.reflect package, partially to reflect the
178
// more stable features taken from the iks.runes packages, partially
179
// to reflect the structure of the VM (constant pool, etc). Functionality in
180
// ch.ethz.prose.crosscut and the junit classes adapted to use the
181
// new form of the ch.ethz.prose.reflect package
182
//
183
// Revision 1.1.2.2 2001/02/05 13:26:44 mrmuller
184
// needs to implement Serializable, so that Extensions can be passed by value
185
//
186
// Revision 1.1.2.1 2000/10/23 18:31:27 popovici
187
// Moved from ch.ethz.prose to ch.ethz.prose.crosscut;
188
// It is now an interface usable by Extensions
189
//
190
Popular Tags