Source Code Cross Referenced for CflowAspectExpressionVisitor.java in  » Aspect-oriented » aspectwerkz-2.0 » org » codehaus » aspectwerkz » cflow » 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 » org.codehaus.aspectwerkz.cflow 
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 org.codehaus.aspectwerkz.cflow;
008:
009:        import org.codehaus.aspectwerkz.expression.ast.ExpressionParserVisitor;
010:        import org.codehaus.aspectwerkz.expression.ast.SimpleNode;
011:        import org.codehaus.aspectwerkz.expression.ast.ASTRoot;
012:        import org.codehaus.aspectwerkz.expression.ast.ASTExpression;
013:        import org.codehaus.aspectwerkz.expression.ast.ASTAnd;
014:        import org.codehaus.aspectwerkz.expression.ast.ASTOr;
015:        import org.codehaus.aspectwerkz.expression.ast.ASTNot;
016:        import org.codehaus.aspectwerkz.expression.ast.ASTPointcutReference;
017:        import org.codehaus.aspectwerkz.expression.ast.ASTExecution;
018:        import org.codehaus.aspectwerkz.expression.ast.ASTCall;
019:        import org.codehaus.aspectwerkz.expression.ast.ASTSet;
020:        import org.codehaus.aspectwerkz.expression.ast.ASTGet;
021:        import org.codehaus.aspectwerkz.expression.ast.ASTHandler;
022:        import org.codehaus.aspectwerkz.expression.ast.ASTWithin;
023:        import org.codehaus.aspectwerkz.expression.ast.ASTWithinCode;
024:        import org.codehaus.aspectwerkz.expression.ast.ASTStaticInitialization;
025:        import org.codehaus.aspectwerkz.expression.ast.ASTCflow;
026:        import org.codehaus.aspectwerkz.expression.ast.ASTCflowBelow;
027:        import org.codehaus.aspectwerkz.expression.ast.ASTArgs;
028:        import org.codehaus.aspectwerkz.expression.ast.ASTHasMethod;
029:        import org.codehaus.aspectwerkz.expression.ast.ASTHasField;
030:        import org.codehaus.aspectwerkz.expression.ast.ASTTarget;
031:        import org.codehaus.aspectwerkz.expression.ast.ASTThis;
032:        import org.codehaus.aspectwerkz.expression.ast.ASTClassPattern;
033:        import org.codehaus.aspectwerkz.expression.ast.ASTMethodPattern;
034:        import org.codehaus.aspectwerkz.expression.ast.ASTConstructorPattern;
035:        import org.codehaus.aspectwerkz.expression.ast.ASTFieldPattern;
036:        import org.codehaus.aspectwerkz.expression.ast.ASTParameter;
037:        import org.codehaus.aspectwerkz.expression.ast.ASTArgParameter;
038:        import org.codehaus.aspectwerkz.expression.ast.ASTAttribute;
039:        import org.codehaus.aspectwerkz.expression.ast.ASTModifier;
040:        import org.codehaus.aspectwerkz.expression.ast.Node;
041:        import org.codehaus.aspectwerkz.expression.ExpressionNamespace;
042:        import org.codehaus.aspectwerkz.expression.ExpressionInfo;
043:
044:        import java.util.List;
045:
046:        /**
047:         * A visitor to create the bindings between cflow aspect and cflow subexpression.
048:         * For each visited cflow / cflowbelow node, one CflowBinding is created
049:         * with the cflow(below) subexpression as expressionInfo.
050:         *
051:         * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
052:         */
053:        public class CflowAspectExpressionVisitor implements 
054:                ExpressionParserVisitor {
055:
056:            private ExpressionInfo m_expressionInfo;
057:            private Node m_root;
058:            private String m_namespace;
059:
060:            public CflowAspectExpressionVisitor(ExpressionInfo expressionInfo,
061:                    Node root, String namespace) {
062:                m_expressionInfo = expressionInfo;
063:                m_root = root;
064:                m_namespace = namespace;
065:            }
066:
067:            /**
068:             * Visit the expression and populate the list with CflowBinding for each cflow() or cflowbelow()
069:             * subexpression encountered (including thru pointcut references)
070:             *
071:             * @param bindings
072:             * @return the list of bindings
073:             */
074:            public List populateCflowAspectBindings(List bindings) {
075:                visit(m_root, bindings);
076:                return bindings;
077:            }
078:
079:            public Object visit(Node node, Object data) {
080:                return node.jjtGetChild(0).jjtAccept(this , data);
081:            }
082:
083:            public Object visit(SimpleNode node, Object data) {
084:                return node.jjtGetChild(0).jjtAccept(this , data);
085:            }
086:
087:            public Object visit(ASTRoot node, Object data) {
088:                return node.jjtGetChild(0).jjtAccept(this , data);
089:            }
090:
091:            public Object visit(ASTExpression node, Object data) {
092:                return node.jjtGetChild(0).jjtAccept(this , data);
093:            }
094:
095:            public Object visit(ASTAnd node, Object data) {
096:                // the AND and OR can have more than 2 nodes [see jjt grammar]
097:                for (int i = 0; i < node.jjtGetNumChildren(); i++) {
098:                    node.jjtGetChild(i).jjtAccept(this , data);
099:                }
100:                return data;
101:            }
102:
103:            public Object visit(ASTOr node, Object data) {
104:                // the AND and OR can have more than 2 nodes [see jjt grammar]
105:                for (int i = 0; i < node.jjtGetNumChildren(); i++) {
106:                    node.jjtGetChild(i).jjtAccept(this , data);
107:                }
108:                return data;
109:            }
110:
111:            public Object visit(ASTNot node, Object data) {
112:                return node.jjtGetChild(0).jjtAccept(this , data);
113:            }
114:
115:            /**
116:             * Resolve pointcut references
117:             *
118:             * @param node
119:             * @param data
120:             * @return
121:             */
122:            public Object visit(ASTPointcutReference node, Object data) {
123:                ExpressionNamespace namespace = ExpressionNamespace
124:                        .getNamespace(m_namespace);
125:                CflowAspectExpressionVisitor expression = namespace
126:                        .getExpressionInfo(node.getName())
127:                        .getCflowAspectExpression();
128:                return expression.populateCflowAspectBindings((List) data);
129:            }
130:
131:            public Object visit(ASTExecution node, Object data) {
132:                return data;
133:            }
134:
135:            public Object visit(ASTCall node, Object data) {
136:                return data;
137:            }
138:
139:            public Object visit(ASTSet node, Object data) {
140:                return data;
141:            }
142:
143:            public Object visit(ASTGet node, Object data) {
144:                return data;
145:            }
146:
147:            public Object visit(ASTHandler node, Object data) {
148:                return data;
149:            }
150:
151:            public Object visit(ASTWithin node, Object data) {
152:                return data;
153:            }
154:
155:            public Object visit(ASTWithinCode node, Object data) {
156:                return data;
157:            }
158:
159:            public Object visit(ASTStaticInitialization node, Object data) {
160:                return data;
161:            }
162:
163:            /**
164:             * build a cflow binding with the cflow sub expression
165:             *
166:             * @param node
167:             * @param data
168:             * @return
169:             */
170:            public Object visit(ASTCflow node, Object data) {
171:                int cflowID = node.hashCode();
172:                Node subNode = node.jjtGetChild(0);
173:                ExpressionInfo subExpression = new ExpressionInfo(subNode,
174:                        m_namespace);
175:                subExpression.inheritPossibleArgumentFrom(m_expressionInfo);
176:                ((List) data).add(new CflowBinding(cflowID, subExpression,
177:                        m_expressionInfo, false));
178:                return data;
179:            }
180:
181:            /**
182:             * build a cflowbelow binding with the cflowbelow sub expression
183:             *
184:             * @param node
185:             * @param data
186:             * @return
187:             */
188:            public Object visit(ASTCflowBelow node, Object data) {
189:                int cflowID = node.hashCode();
190:                Node subNode = node.jjtGetChild(0);
191:                ExpressionInfo subExpression = new ExpressionInfo(subNode,
192:                        m_namespace);
193:                subExpression.inheritPossibleArgumentFrom(m_expressionInfo);
194:                ((List) data).add(new CflowBinding(cflowID, subExpression,
195:                        m_expressionInfo, true));
196:                return data;
197:            }
198:
199:            public Object visit(ASTArgs node, Object data) {
200:                return data;
201:            }
202:
203:            public Object visit(ASTHasMethod node, Object data) {
204:                return data;
205:            }
206:
207:            public Object visit(ASTHasField node, Object data) {
208:                return data;
209:            }
210:
211:            public Object visit(ASTTarget node, Object data) {
212:                return data;
213:            }
214:
215:            public Object visit(ASTThis node, Object data) {
216:                return data;
217:            }
218:
219:            public Object visit(ASTClassPattern node, Object data) {
220:                throw new UnsupportedOperationException("Should not be reached");
221:            }
222:
223:            public Object visit(ASTMethodPattern node, Object data) {
224:                throw new UnsupportedOperationException("Should not be reached");
225:            }
226:
227:            public Object visit(ASTConstructorPattern node, Object data) {
228:                throw new UnsupportedOperationException("Should not be reached");
229:            }
230:
231:            public Object visit(ASTFieldPattern node, Object data) {
232:                throw new UnsupportedOperationException("Should not be reached");
233:            }
234:
235:            public Object visit(ASTParameter node, Object data) {
236:                throw new UnsupportedOperationException("Should not be reached");
237:            }
238:
239:            public Object visit(ASTArgParameter node, Object data) {
240:                throw new UnsupportedOperationException("Should not be reached");
241:            }
242:
243:            public Object visit(ASTAttribute node, Object data) {
244:                throw new UnsupportedOperationException("Should not be reached");
245:            }
246:
247:            public Object visit(ASTModifier node, Object data) {
248:                throw new UnsupportedOperationException("Should not be reached");
249:            }
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.