Source Code Cross Referenced for CatchCut.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 Angela Nicoara. Portions
017:        //  created by Angela Nicoara are Copyright (C) 2002 Angela Nicoara.
018:        //  All Rights Reserved.
019:        //
020:        //  Contributor(s):
021:        //  $Id$
022:        //  =====================================================================
023:        //
024:        //  (history at end)
025:        //
026:
027:        package ch.ethz.prose.crosscut;
028:
029:        // used packages
030:        import ch.ethz.jvmai.ExceptionCatchJoinPoint;
031:
032:        /**
033:         * Class CatchCut represents a crosscut which cuts across <em>all</em>
034:         * points belonging to <em>all</em> classes in the local VM where exceptions
035:         * are catch.
036:         *
037:         * There are two ways of using this crosscut:
038:         * <ol>
039:         *  <li> override the <em>convenience</em> methods <code>exceptionThrowAdvice</code>
040:         *  and <code>exceptionCatchAdvice</code> if you do not want to deal with the
041:         * reflective part of join-points.
042:         * <li> override the <code>joinPointAdvice</code> methods and define void-bodies
043:         * for <code>exceptionThrowAdvice</code> and <code>exceptionCatchAdvice</code>.
044:         * This second case is recomended only if you need the last bit of speed out
045:         * of the system.
046:         * </ol>
047:         *
048:         * @version	$Revision: 1.1.1.1 $
049:         * @author	Philippe Schoch
050:         */
051:        public abstract class CatchCut extends AbstractCrosscut implements 
052:                java.io.Serializable {
053:
054:            private transient CatchHandleSignaturePattern advicePattern;
055:
056:            // Caching variable for Class Object Throwable
057:            private static Class throwableClass;
058:
059:            /**
060:             * Constructor
061:             */
062:            protected CatchCut() {
063:                initState();
064:            }
065:
066:            public void insertionAction(boolean isBeforeInsertion) {
067:                if (isBeforeInsertion)
068:                    initState();
069:            }
070:
071:            private void initState() {
072:                if (advicePattern == null) {
073:                    advicePattern = new CatchHandleSignaturePattern(this );
074:                }
075:            }
076:
077:            /** This method must be defined by subclasses. It will be called
078:             *  each time one of the selected exceptions is catch.
079:             */
080:            public void CATCH_ARGS() {
081:            }
082:
083:            /** Advice action of Exceptions*/
084:            protected void joinPointAction(ExceptionCatchJoinPoint ecjp)
085:                    throws IllegalAccessException {
086:
087:                try {
088:                    switch (advicePattern.signatureCathegory
089:                            & (SignaturePattern.WILDCARD_1
090:                                    | SignaturePattern.CONCRETE_1 | SignaturePattern.SIGNATURE__EMPTY)) {
091:                    case SignaturePattern.SIGNATURE__EMPTY:
092:                        CATCH_ARGS();
093:                        break;
094:                    case SignaturePattern.WILDCARD_1:
095:                        ANY x = new ANY();
096:                        x.setObject(ecjp.getException());
097:                        advicePattern.methodObj
098:                                .invoke(this , new Object[] { x });
099:                        break;
100:                    case SignaturePattern.CONCRETE_1:
101:                        advicePattern.methodObj.invoke(this ,
102:                                new Object[] { ecjp.getException() });
103:                        break;
104:                    default:
105:                        throw new Error(
106:                                "CatchCut.joinPointAction: illegal signature pattern");
107:                    }
108:                } catch (java.lang.reflect.InvocationTargetException e) {
109:                    throw new Error(
110:                            "CatchCut.joinPointAction: wrong arguments; static check failure:"
111:                                    + e);
112:                }
113:
114:            }
115:
116:            /**
117:             * Only a class of supertype 'Throwable' is a potential Exception Catch Crosscut Class
118:             */
119:            protected boolean isPotentialCrosscutClass(Class c) {
120:                return Throwable.class.isAssignableFrom(c);
121:            }
122:
123:            /**
124:             * Create a new CrosscutRequest consisting of ExceptionCatchRequests
125:             * for each catch exception in each method declared in class <code>cls</code>.
126:             * Only one ExceptionCatchRequest per exception class is
127:             * generated for a specific CatchCut.
128:             */
129:            protected CrosscutRequest doCreateRequest(Class cls) {
130:                CrosscutRequest result = new CrosscutRequest();
131:                if ((advicePattern.signatureCathegory & (SignaturePattern.CONCRETE_1)) != 0
132:                        && (!advicePattern.signature[0].isAssignableFrom(cls)))
133:                    return result;
134:
135:                result.add(requestFactory.createJoinPointRequest(
136:                        ExceptionCatchJoinPoint.KIND, cls));
137:
138:                return result;
139:            }
140:
141:            /**
142:             *
143:             */
144:            public String toString() {
145:                return "Crosscut 'CatchCut' [class '" + getClass().getName()
146:                        + "'] specialized with [" + getSpecializer() + "]";
147:            }
148:
149:        }
150:
151:        //======================================================================
152:        //
153:        // $Log$
154:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.