001: //
002: // This file is part of the prose package.
003: //
004: // The contents of this file are subject to the Mozilla Public License
005: // Version 1.1 (the "License"); you may not use this file except in
006: // compliance with the License. You may obtain a copy of the License at
007: // http://www.mozilla.org/MPL/
008: //
009: // Software distributed under the License is distributed on an "AS IS" basis,
010: // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011: // for the specific language governing rights and limitations under the
012: // License.
013: //
014: // The Original Code is prose.
015: //
016: // The Initial Developer of the Original Code is Andrei Popovici. Portions
017: // created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
018: // All Rights Reserved.
019: //
020: // Contributor(s):
021: // $Id: AspectManager.java,v 1.1.1.1 2003/07/02 15:30:50 apopovic Exp $
022: // =====================================================================
023: //
024: // (history at end)
025: //
026:
027: package ch.ethz.prose;
028:
029: import java.util.List;
030:
031: import ch.ethz.prose.engine.JoinPointManager;
032:
033: /**
034: * Interface AspectManager allows weaving and unweaving of aspects.
035: * An aspect manager can be obtained as a singleton from <code>ProseSystem</code>
036: * In the whole ProseSystem there are exactly two ExtensionManagers.
037: * <ul>
038: * <li>the extension manager or current extension manager</li>
039: * <li>the test extension manager</li>
040: * </ul>
041: *
042: * The test aspect manager is not attached to the VM (aspect woven do not
043: * execute advice).
044: * The test aspect manager behaves like the normal aspect manager
045: * but no events are reported to it, so i.e. it can be used to test an aspect
046: * before the insertion with the real aspect manager.
047: *
048: *
049: * @version $Revision: 1.1.1.1 $
050: * @author Andrei Popovici
051: */
052: public interface AspectManager {
053:
054: /**
055: * This method has to be called before an <code>AspectManager</code> is used.
056: */
057: public void startup();
058:
059: /**
060: * This method has to be called before an <code>AspectManager</code> is destroyed.
061: */
062: public void teardown();
063:
064: /** Insert the aspect <code>asp</code> into this <em>AspectManager</em>
065: * The insertion
066: * of the crosscuts belonging to the specified aspect
067: * is done in the proper order (first crosscut is registered as
068: * first). If several aspects extend the same join-points, the
069: * oder in which advices are called corresponds to the priority of
070: * the
071: */
072: abstract public void insert(Aspect asp)
073: throws AspectManagerException;
074:
075: /** Insert the aspect ext within the boundaries of the transaction txId.
076: * The advice corresponding to this aspects will come into effect only
077: * after commiting txId. Two transactions are the same if the txId objects
078: * are equal and their hashCode generate the same values.
079: */
080: abstract public void insert(Aspect ext, Object txId)
081: throws AspectManagerException;
082:
083: /** Withdraw the aspect <code>ext</code> from this
084: * <code>AspectManager</code>. Note that the specified extension has to be the
085: * same object as the one to be withdrawn. Because an extension usually
086: * has its own state, the application layer <em>using</em> an extension
087: * manager has to find out which extension object to withdraw, by inspecting
088: * the <code>getAllAspects()</code> set.
089: */
090: abstract public void withdraw(Aspect ext)
091: throws AspectManagerException;
092:
093: /** Withdraw the aspect ext within the boundaries of the transaction txId.
094: * The advice corresponding to this aspects will remain into effect only
095: * until commiting txId. Two transactions are the same if the txId objects
096: * are equal and their hashCode generate the same values.
097: */
098: abstract public void withdraw(Aspect ext, Object txId)
099: throws AspectManagerException;
100:
101: /** Commit the transaction txId. All woven aspects start executing
102: * advice, all unwoven (withdrawn) aspects cease executing advice.
103: */
104: abstract public void commit(Object txId);
105:
106: /** Abort the transaction txId. This implies that all aspects
107: * withdraw during this transction remain woven, while all aspects
108: * inserted during this transaction are never activated.
109: */
110: abstract public void abort(Object txId);
111:
112: /**
113: * Return a list of the current inserted extensions.
114: */
115: public List getAllAspects();
116:
117: /**
118: * Return the <code>JoinPointManager</code> registered in this extension manager.
119: */
120: public JoinPointManager getJoinPointManager();
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: //
|