KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > prose > AspectManager


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: AspectManager.java,v 1.1.1.1 2003/07/02 15:30:50 apopovic Exp $
22
// =====================================================================
23
//
24
// (history at end)
25
//
26

27 package ch.ethz.prose;
28
29 import java.util.List JavaDoc;
30
31 import ch.ethz.prose.engine.JoinPointManager;
32
33 /**
34  * Interface AspectManager allows weaving and unweaving of aspects.
35  * An aspect manager can be obtained as a singleton from <code>ProseSystem</code>
36  * In the whole ProseSystem there are exactly two ExtensionManagers.
37  * <ul>
38  * <li>the extension manager or current extension manager</li>
39  * <li>the test extension manager</li>
40  * </ul>
41  *
42  * The test aspect manager is not attached to the VM (aspect woven do not
43  * execute advice).
44  * The test aspect manager behaves like the normal aspect manager
45  * but no events are reported to it, so i.e. it can be used to test an aspect
46  * before the insertion with the real aspect manager.
47  *
48  *
49  * @version $Revision: 1.1.1.1 $
50  * @author Andrei Popovici
51  */

52 public
53 interface AspectManager {
54
55   /**
56    * This method has to be called before an <code>AspectManager</code> is used.
57    */

58   public void startup();
59
60   /**
61    * This method has to be called before an <code>AspectManager</code> is destroyed.
62    */

63   public void teardown();
64
65   /** Insert the aspect <code>asp</code> into this <em>AspectManager</em>
66    * The insertion
67    * of the crosscuts belonging to the specified aspect
68    * is done in the proper order (first crosscut is registered as
69    * first). If several aspects extend the same join-points, the
70    * oder in which advices are called corresponds to the priority of
71    * the
72    */

73   abstract public void insert(Aspect asp) throws AspectManagerException;
74
75
76   /** Insert the aspect ext within the boundaries of the transaction txId.
77    * The advice corresponding to this aspects will come into effect only
78    * after commiting txId. Two transactions are the same if the txId objects
79    * are equal and their hashCode generate the same values.
80    */

81   abstract public void insert(Aspect ext,Object JavaDoc txId) throws AspectManagerException;
82
83   /** Withdraw the aspect <code>ext</code> from this
84    * <code>AspectManager</code>. Note that the specified extension has to be the
85    * same object as the one to be withdrawn. Because an extension usually
86    * has its own state, the application layer <em>using</em> an extension
87    * manager has to find out which extension object to withdraw, by inspecting
88    * the <code>getAllAspects()</code> set.
89    */

90   abstract public void withdraw(Aspect ext) throws AspectManagerException;
91
92   /** Withdraw the aspect ext within the boundaries of the transaction txId.
93    * The advice corresponding to this aspects will remain into effect only
94    * until commiting txId. Two transactions are the same if the txId objects
95    * are equal and their hashCode generate the same values.
96    */

97   abstract public void withdraw(Aspect ext,Object JavaDoc txId) throws AspectManagerException;
98
99   /** Commit the transaction txId. All woven aspects start executing
100    * advice, all unwoven (withdrawn) aspects cease executing advice.
101    */

102   abstract public void commit(Object JavaDoc txId);
103
104   /** Abort the transaction txId. This implies that all aspects
105    * withdraw during this transction remain woven, while all aspects
106    * inserted during this transaction are never activated.
107    */

108   abstract public void abort(Object JavaDoc txId);
109
110   /**
111    * Return a list of the current inserted extensions.
112    */

113   public List JavaDoc getAllAspects();
114
115   /**
116    * Return the <code>JoinPointManager</code> registered in this extension manager.
117    */

118   public JoinPointManager getJoinPointManager();
119 }
120
121
122
123 //======================================================================
124
//
125
// $Log: AspectManager.java,v $
126
// Revision 1.1.1.1 2003/07/02 15:30:50 apopovic
127
// Imported from ETH Zurich
128
//
129
// Revision 1.3 2003/05/26 13:28:49 popovici
130
// Documentation Improvements
131
//
132
// Revision 1.2 2003/05/20 16:05:01 popovici
133
//
134
// New QueryManager replaces functionality in AspectManager (better Soc)
135
// New 'Surrogate' classes for usage in the QueryManager
136
// The 'RemoteAspectManager' and tools modified to use the Surrogates and the QueryManager
137
//
138
// Revision 1.1 2003/05/05 13:58:35 popovici
139
// renaming from runes to prose
140
//
141
// Revision 1.1 2003/04/17 15:15:06 popovici
142
// Extension->Aspect renaming
143
//
144
// Revision 1.8 2003/04/17 12:49:40 popovici
145
// Refactoring of the crosscut package
146
// ExceptionCut renamed to ThrowCut
147
// McutSignature is now SignaturePattern
148
//
149
// Revision 1.7 2003/04/17 08:47:13 popovici
150
// Important functionality additions
151
// - Cflow specializers
152
// - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
153
// - Transactional capabilities
154
// - Total refactoring of Specializer evaluation, which permits fine-grained distinction
155
// between static and dynamic specializers.
156
// - Functionality pulled up in abstract classes
157
// - Uniformization of advice methods patterns and names
158
//
159
// Revision 1.6 2003/03/04 18:36:36 popovici
160
// Organization of imprts
161
//
162
// Revision 1.5 2003/02/17 09:27:16 popovici
163
// Small inconsistency: LocalAspectManager used to have a public method
164
// 'getAllJoinpoints' wich was not present in the AspectManager interface
165
//
166
// Revision 1.4 2003/01/17 14:45:48 pschoch
167
// Introduction of 'query' methods in the AspectManager and its
168
// subclasses. The result set is given back in form of surrogates; 4 new tests added to ExtensionManagerTest
169
// ExtensionSystemTest
170
//
171
// Revision 1.3 2002/11/26 17:14:30 pschoch
172
// RootComponent now added (replaces RootComponent now added (replaces old ProseSystem)
173
// ProseSystem now owns and starts the Aspect interface.
174
// ProseSystem now containes a 'test' AspectManager
175
// AspectManager now owns the JoinPointManager.
176
// ExtensionManger can be 'connected' to the JVM, or disconnected. The
177
// JoinPointManager of a connected Ext.Mgr enables joinpoints; the
178
// JoinPointManger of a disconnected Ext.Mgr never enables join-points
179
// Documentation updated accordingly.
180
//
181
// Revision 1.2 2002/03/28 13:48:34 popovici
182
// Mozilla-ified
183
//
184
// Revision 1.1.1.1 2001/11/29 18:13:15 popovici
185
// Sources from runes
186
//
187
// Revision 1.1.2.5 2001/07/12 09:24:53 popovici
188
// Documentation on crosscut registration order.
189
//
190
// Revision 1.1.2.4 2001/02/20 09:26:52 popovici
191
// Documentation refined. The fact that withdrawn extensions have to be
192
// the same object as those inserted explictitely specified
193
//
194
// Revision 1.1.2.3 2001/02/07 11:48:32 popovici
195
// 'insertExtension' and 'withdrawExtension' now throw an 'AspectManagerException'
196
//
197
// Revision 1.1.2.2 2001/01/23 09:28:08 popovici
198
// extensions() now returns a set of Exensions
199
//
200
// Revision 1.1.2.1 2000/10/24 17:45:54 popovici
201
// 'addExtension' renamed to 'insertExtension'
202
// 'removeExtension' renamed to 'withdrawExtension'
203
// method 'extensions' added
204
//
205
// Revision 1.1 2000/10/16 11:53:25 popovici
206
// Initial Revision
207
//
208
Popular Tags