Source Code Cross Referenced for CflowAspectExpressionVisitor.java in  » Net » Terracotta » com » tc » 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 » Net » Terracotta » com.tc.aspectwerkz.cflow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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