Source Code Cross Referenced for ThrowCut.java in  » Byte-Code » PROSE » ch » ethz » prose » crosscut » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Byte Code » PROSE » ch.ethz.prose.crosscut 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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: ThrowCut.java,v 1.2 2003/07/29 17:04:14 anicoara Exp $
022:        // =====================================================================
023:        //
024:        // (history at end)
025:        //
026:
027:        package ch.ethz.prose.crosscut;
028:
029:        // used packages
030:        import ch.ethz.jvmai.ExceptionJoinPoint;
031:
032:        /**
033:         * Class ThrowCut is a crosscut which cuts exception throws
034:         *
035:         *
036:         *
037:         * The advice method is <code>THROW_ARGS</code>. The
038:         * only argument of THROW_ARGS is the thrown exception (or none).
039:         * The join-point
040:         * where the advice method is  executted depend on:
041:         * <ol>
042:         *  <li> the signature of <code>THROW_ARGS</code>
043:         * <li>  the value returned by <code>pointCutter</code>.
044:         * </ol>
045:         *
046:         * Within an advice method, the <code>thisJoinPoint()</code> method
047:         * can  be called to obtain a reference to the currently executing
048:         * join-point.
049:         *
050:         *
051:         * @version	$Revision: 1.2 $
052:         * @author	Andrei Popovici
053:         */
054:        public abstract class ThrowCut extends AbstractCrosscut implements 
055:                java.io.Serializable {
056:
057:            private transient ThrowHandleSignaturePattern advicePattern;
058:
059:            // Caching variable for Class Object Throwable
060:            private static Class throwableClass;
061:
062:            /**
063:             * Constructor
064:             */
065:            protected ThrowCut() {
066:                initState();
067:            }
068:
069:            public void insertionAction(boolean isBeforeInsertion) {
070:                if (isBeforeInsertion)
071:                    initState();
072:            }
073:
074:            private void initState() {
075:                if (advicePattern == null) {
076:                    advicePattern = new ThrowHandleSignaturePattern(this );
077:                }
078:            }
079:
080:            /** This method must be defined by subclasses. It will be called
081:             *  each time one of the selected exceptions is thrown.
082:             */
083:            public void THROW_ARGS() {
084:            }
085:
086:            /** Advice action of Exceptions*/
087:            protected void joinPointAction(ExceptionJoinPoint etjp)
088:                    throws IllegalAccessException {
089:
090:                try {
091:                    switch (advicePattern.signatureCathegory
092:                            & (SignaturePattern.WILDCARD_1
093:                                    | SignaturePattern.CONCRETE_1 | SignaturePattern.SIGNATURE__EMPTY)) {
094:                    case SignaturePattern.SIGNATURE__EMPTY:
095:                        THROW_ARGS();
096:                        break;
097:                    case SignaturePattern.WILDCARD_1:
098:                        ANY x = new ANY();
099:                        x.setObject(etjp.getException());
100:                        advicePattern.methodObj
101:                                .invoke(this , new Object[] { x });
102:                        break;
103:                    case SignaturePattern.CONCRETE_1:
104:                        advicePattern.methodObj.invoke(this ,
105:                                new Object[] { etjp.getException() });
106:                        break;
107:                    default:
108:                        throw new Error(
109:                                "ThrowCut.joinPointAction: illegal signature pattern");
110:                    }
111:                } catch (java.lang.reflect.InvocationTargetException e) {
112:                    throw new Error(
113:                            "ThrowCut.joinPointAction: wrong arguments; static check failure:"
114:                                    + e);
115:                }
116:
117:            }
118:
119:            /**
120:             * Only a class of supertype 'Throwable' is a potential Exception Crosscut Class
121:             */
122:            protected boolean isPotentialCrosscutClass(Class c) {
123:                return Throwable.class.isAssignableFrom(c);
124:            }
125:
126:            /**
127:             * Create a new CrosscutRequest consisting of ExceptionThrowRequests
128:             * for each thrown exception in each method declared in class <code>cls</code>.
129:             * Only one ExceptionThrowRequest per exception class is
130:             * generated for a specific ThrowCut.
131:             */
132:            protected CrosscutRequest doCreateRequest(Class cls) {
133:                CrosscutRequest result = new CrosscutRequest();
134:                if ((advicePattern.signatureCathegory & (SignaturePattern.CONCRETE_1)) != 0
135:                        && (!advicePattern.signature[0].isAssignableFrom(cls)))
136:                    return result;
137:
138:                result.add(requestFactory.createJoinPointRequest(
139:                        ExceptionJoinPoint.KIND, cls));
140:
141:                return result;
142:            }
143:
144:            /**
145:             *
146:             */
147:            public String toString() {
148:                return " Crosscut: 'ThrowCut' \n" + " Advice:"
149:                        + advicePattern.toString() + "\n" + " PointCutter: "
150:                        + getSpecializer() + "\n";
151:            }
152:
153:        }
154:
155:        //======================================================================
156:        //
157:        // $Log: ThrowCut.java,v $
158:        // Revision 1.2  2003/07/29 17:04:14  anicoara
159:        // Bug fix: ThrowCut used to create problems during serialization (null pointer exception)
160:        //
161:        // Revision 1.1.1.1  2003/07/02 15:30:51  apopovic
162:        // Imported from ETH Zurich
163:        //
164:        // Revision 1.4  2003/05/26 13:28:53  popovici
165:        // Documentation Improvements
166:        //
167:        // Revision 1.3  2003/05/25 11:46:46  popovici
168:        // Improved 'toString' presentation of aspects
169:        //
170:        // Revision 1.2  2003/05/06 15:51:31  popovici
171:        // Mozilla-ification
172:        //
173:        // Revision 1.1  2003/05/05 13:58:09  popovici
174:        // renaming from runes to prose
175:        //
176:        // Revision 1.2  2003/04/26 18:51:34  popovici
177:        // 1 Bug fix which lead to a refactoring step:
178:        //    1. the bug: 'JoinPointRequests' used to write to a static list, which survived a startup/teardown;
179:        //                now this list belongs to the JoinPointManager;
180:        //    2. the refactoring: the JoinPointManager now creates (and shares state) with join-points.
181:        //
182:        // Revision 1.1  2003/04/17 12:49:20  popovici
183:        // Refactoring of the crosscut package
184:        //  ExceptionCut renamed to ThrowCut
185:        //  McutSignature is now SignaturePattern
186:        //
187:        // Revision 1.6  2003/04/17 08:47:19  popovici
188:        // Important functionality additions
189:        //  - Cflow specializers
190:        //  - Restructuring of the MethodCut, SetCut, ThrowCut, and GetCut (they are much smaller)
191:        //  - Transactional capabilities
192:        //  - Total refactoring of Specializer evaluation, which permits fine-grained distinction
193:        //    between static and dynamic specializers.
194:        //  - Functionality pulled up in abstract classes
195:        //  - Uniformization of advice methods patterns and names
196:        //
197:        // Revision 1.5  2003/04/07 13:17:25  popovici
198:        // Bug fix in serialization: Local hash maps were not static.
199:        // > Deserialized join-points used to hit on a null when looking for their 'threadLocalJoinPoint'
200:        //
201:        // Revision 1.4  2003/03/04 18:36:34  popovici
202:        // Organization of imprts
203:        //
204:        // Revision 1.3  2003/03/04 11:27:18  popovici
205:        // Important refactorization step (march):
206:        // - removal of 'JoinPointEvents'; JoinPoints now have the same function as events
207:        // - reimplementation of the JVMAIDebuggerAspectInterface (better performance, coding conventions, removal of ProseVM
208:        //   structures
209:        //
210:        // Revision 1.2  2003/01/27 12:51:12  pschoch
211:        // new toString() implementation; advice-Method now without parameter
212:        //
213:        // Revision 1.1  2002/10/31 18:26:52  pschoch
214:        // Capability of crosscutting Exceptions added to prose.
215:        //
216:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.