Source Code Cross Referenced for ArgAspect.java in  » Aspect-oriented » aspectwerkz-2.0 » examples » logging » 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 » Aspect oriented » aspectwerkz 2.0 » examples.logging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**************************************************************************************
002:         * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved.                 *
003:         * http://aspectwerkz.codehaus.org                                                    *
004:         * ---------------------------------------------------------------------------------- *
005:         * The software in this package is published under the terms of the LGPL license      *
006:         * a copy of which has been included with this distribution in the license.txt file.  *
007:         **************************************************************************************/package examples.logging;
008:
009:        import org.codehaus.aspectwerkz.annotation.Annotation;
010:        import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
011:        import org.codehaus.aspectwerkz.joinpoint.MethodSignature;
012:        import org.codehaus.aspectwerkz.definition.Pointcut;
013:        import org.codehaus.aspectwerkz.definition.Pointcut;
014:
015:        /**
016:         * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
017:         * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
018:         */
019:        public class ArgAspect {
020:
021:            private int m_level = 0;
022:
023:            /**
024:             * @Around pc1(ai, as)
025:             */
026:            public Object around1(final JoinPoint joinPoint, int ai, String as)
027:                    throws Throwable {
028:                indent();
029:                m_level++;
030:                System.out.println(" ==> around1 -- pre " + ai + ", " + as);
031:                Object result = joinPoint.proceed();
032:                m_level--;
033:                indent();
034:                System.out.println(" ==> around1 -- post " + ai + ", " + as);
035:                return result;
036:            }
037:
038:            /**
039:             * @Before pc1(ai, as)
040:             */
041:            public void before1(final JoinPoint joinPoint, int ai, String as)
042:                    throws Throwable {
043:                indent();
044:                m_level++;
045:                System.out.println(" ==> before1: " + ai + ", " + as);
046:            }
047:
048:            /**
049:             * @After pc1(ai, as)
050:             */
051:            public void after1(final JoinPoint joinPoint, int ai, String as)
052:                    throws Throwable {
053:                m_level--;
054:                indent();
055:                System.out.println(" ==> after1: " + ai + ", " + as);
056:            }
057:
058:            /**
059:             * @Before pc1(ai, as)
060:             */
061:            public void before2(final JoinPoint joinPoint, String as, int ai)
062:                    throws Throwable {
063:                indent();
064:                m_level++;
065:                System.out.println(" ==> before2: " + as + ", " + ai);
066:            }
067:
068:            /**
069:             * @After pc1(ai, as)
070:             */
071:            public void after2(final JoinPoint joinPoint, String as, int ai)
072:                    throws Throwable {
073:                m_level--;
074:                indent();
075:                System.out.println(" ==> after2: " + as + ", " + ai);
076:            }
077:
078:            /**
079:             * @Around pc2(sarr)
080:             */
081:            public Object around3(final JoinPoint joinPoint, String[] sarr)
082:                    throws Throwable {
083:                indent();
084:                m_level++;
085:                System.out.println("==> around3 -- pre " + sarr);
086:                Object result = joinPoint.proceed();
087:                m_level--;
088:                indent();
089:                System.out.println("==> around3 -- post " + sarr);
090:                return result;
091:            }
092:
093:            /**
094:             * @Before pc2(sarr)
095:             */
096:            public void before3(final JoinPoint joinPoint, String[] sarr)
097:                    throws Throwable {
098:                indent();
099:                m_level++;
100:                System.out.println("==> before3: " + sarr);
101:            }
102:
103:            /**
104:             * @After pc2(sarr)
105:             */
106:            public void after3(final JoinPoint joinPoint, String[] sarr)
107:                    throws Throwable {
108:                m_level--;
109:                indent();
110:                System.out.println("==> after3: " + sarr);
111:            }
112:
113:            /**
114:             * @Around pcSet || pcGet
115:             */
116:            public Object aroundField(final JoinPoint joinPoint)
117:                    throws Throwable {
118:                indent();
119:                m_level++;
120:                System.out.println("==> aroundField -- pre");
121:                Object result = joinPoint.proceed();
122:                m_level--;
123:                indent();
124:                System.out.println("==> aroundField -- post");
125:                return result;
126:            }
127:
128:            /**
129:             * @Before pcSet || pcGet
130:             */
131:            public void beforeField(final JoinPoint joinPoint) throws Throwable {
132:                indent();
133:                m_level++;
134:                System.out.println("==> beforeField");
135:            }
136:
137:            /**
138:             * @After pcSet || pcGet
139:             */
140:            public void after3(final JoinPoint joinPoint) throws Throwable {
141:                m_level--;
142:                indent();
143:                System.out.println("==> beforeField");
144:            }
145:
146:            /**
147:             * @Expression execution(* ..ArgLoggingTarget.toLog*(..)) && args(int, s, i)
148:             */
149:            Pointcut pc1(int i, String s) {
150:                return null;
151:            }
152:
153:            /**
154:             * @Expression execution(* ..ArgLoggingTarget.toLog*(..)) && args(int, sarr)
155:             */
156:            Pointcut pc2(String[] sarr) {
157:                return null;
158:            }
159:
160:            /**
161:             * @Expression execution(* ..ArgLoggingTarget.toLog*(..))
162:             */
163:            Pointcut pc3() {
164:                return null;
165:            }
166:
167:            /**
168:             * @Expression set(* ..ArgLoggingTarget.*)
169:             */
170:            Pointcut pcSet() {
171:                return null;
172:            }
173:
174:            /**
175:             * @Expression get(* ..ArgLoggingTarget.*)
176:             */
177:            Pointcut pcGet() {
178:                return null;
179:            }
180:
181:            private void indent() {
182:                for (int i = 0; i < m_level; i++) {
183:                    System.out.print("  ");
184:                }
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.