Source Code Cross Referenced for AbstractJspRule.java in  » Code-Analyzer » pmd-4.2rc1 » net » sourceforge » pmd » jsp » rules » 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 » Code Analyzer » pmd 4.2rc1 » net.sourceforge.pmd.jsp.rules 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
003:         */package net.sourceforge.pmd.jsp.rules;
004:
005:        import java.text.MessageFormat;
006:        import java.util.Iterator;
007:        import java.util.List;
008:
009:        import net.sourceforge.pmd.CommonAbstractRule;
010:        import net.sourceforge.pmd.RuleContext;
011:        import net.sourceforge.pmd.RuleViolation;
012:        import net.sourceforge.pmd.ast.Node;
013:        import net.sourceforge.pmd.jsp.ast.ASTAttribute;
014:        import net.sourceforge.pmd.jsp.ast.ASTAttributeValue;
015:        import net.sourceforge.pmd.jsp.ast.ASTCData;
016:        import net.sourceforge.pmd.jsp.ast.ASTCommentTag;
017:        import net.sourceforge.pmd.jsp.ast.ASTCompilationUnit;
018:        import net.sourceforge.pmd.jsp.ast.ASTContent;
019:        import net.sourceforge.pmd.jsp.ast.ASTDeclaration;
020:        import net.sourceforge.pmd.jsp.ast.ASTDoctypeDeclaration;
021:        import net.sourceforge.pmd.jsp.ast.ASTDoctypeExternalId;
022:        import net.sourceforge.pmd.jsp.ast.ASTElExpression;
023:        import net.sourceforge.pmd.jsp.ast.ASTElement;
024:        import net.sourceforge.pmd.jsp.ast.ASTJspComment;
025:        import net.sourceforge.pmd.jsp.ast.ASTJspDeclaration;
026:        import net.sourceforge.pmd.jsp.ast.ASTJspDirective;
027:        import net.sourceforge.pmd.jsp.ast.ASTJspDirectiveAttribute;
028:        import net.sourceforge.pmd.jsp.ast.ASTJspExpression;
029:        import net.sourceforge.pmd.jsp.ast.ASTJspExpressionInAttribute;
030:        import net.sourceforge.pmd.jsp.ast.ASTJspScriptlet;
031:        import net.sourceforge.pmd.jsp.ast.ASTText;
032:        import net.sourceforge.pmd.jsp.ast.ASTUnparsedText;
033:        import net.sourceforge.pmd.jsp.ast.ASTValueBinding;
034:        import net.sourceforge.pmd.jsp.ast.JspParserVisitor;
035:        import net.sourceforge.pmd.jsp.ast.SimpleNode;
036:
037:        public abstract class AbstractJspRule extends CommonAbstractRule
038:                implements  JspParserVisitor {
039:
040:            @Override
041:            public void setUsesTypeResolution() {
042:                // No Type resolution for JSP rules?
043:            }
044:
045:            /**
046:             * Adds a violation to the report.
047:             * 
048:             * @param data
049:             *            the RuleContext
050:             * @param node
051:             *            the node that produces the violation
052:             */
053:            protected final void addViolation(Object data, SimpleNode node) {
054:                RuleContext ctx = (RuleContext) data;
055:                ctx.getReport().addRuleViolation(
056:                        new RuleViolation(this , ctx, node));
057:            }
058:
059:            /**
060:             * Adds a violation to the report.
061:             * 
062:             * @param data
063:             *            the RuleContext
064:             * @param node
065:             *            the node that produces the violation
066:             * @param msg
067:             *            specific message to put in the report
068:             */
069:            protected final void addViolationWithMessage(Object data,
070:                    SimpleNode node, String msg) {
071:                RuleContext ctx = (RuleContext) data;
072:                ctx.getReport().addRuleViolation(
073:                        new RuleViolation(this , ctx, node, msg));
074:            }
075:
076:            /**
077:             * Adds a violation to the report.
078:             * 
079:             * @param data
080:             *            the RuleContext
081:             * @param node
082:             *            the node that produces the violation
083:             * @param embed
084:             *            a variable to embed in the rule violation message
085:             */
086:            protected final void addViolation(Object data, SimpleNode node,
087:                    String embed) {
088:                RuleContext ctx = (RuleContext) data;
089:                ctx.getReport().addRuleViolation(
090:                        new RuleViolation(this , ctx, node, MessageFormat
091:                                .format(getMessage(), embed)));
092:            }
093:
094:            /**
095:             * Adds a violation to the report.
096:             * 
097:             * @param data
098:             *            the RuleContext
099:             * @param node
100:             *            the node that produces the violation, may be null, in which
101:             *            case all line and column info will be set to zero
102:             * @param args
103:             *            objects to embed in the rule violation message
104:             */
105:            protected final void addViolation(Object data, Node node,
106:                    Object[] args) {
107:                RuleContext ctx = (RuleContext) data;
108:                ctx.getReport().addRuleViolation(
109:                        new RuleViolation(this , ctx, (SimpleNode) node,
110:                                MessageFormat.format(getMessage(), args)));
111:            }
112:
113:            public void apply(List acus, RuleContext ctx) {
114:                visitAll(acus, ctx);
115:            }
116:
117:            protected void visitAll(List acus, RuleContext ctx) {
118:                for (Iterator i = acus.iterator(); i.hasNext();) {
119:                    SimpleNode node = (SimpleNode) i.next();
120:                    visit(node, ctx);
121:                }
122:            }
123:
124:            //
125:            // The following APIs are identical to those in JspParserVisitorAdapter.
126:            // Due to Java single inheritance, it preferred to extend from the more
127:            // complex Rule base class instead of from relatively simple Visitor.
128:            //
129:
130:            public Object visit(SimpleNode node, Object data) {
131:                node.childrenAccept(this , data);
132:                return null;
133:            }
134:
135:            public Object visit(ASTCompilationUnit node, Object data) {
136:                return visit((SimpleNode) node, data);
137:            }
138:
139:            public Object visit(ASTContent node, Object data) {
140:                return visit((SimpleNode) node, data);
141:            }
142:
143:            public Object visit(ASTJspDirective node, Object data) {
144:                return visit((SimpleNode) node, data);
145:            }
146:
147:            public Object visit(ASTJspDirectiveAttribute node, Object data) {
148:                return visit((SimpleNode) node, data);
149:            }
150:
151:            public Object visit(ASTJspScriptlet node, Object data) {
152:                return visit((SimpleNode) node, data);
153:            }
154:
155:            public Object visit(ASTJspExpression node, Object data) {
156:                return visit((SimpleNode) node, data);
157:            }
158:
159:            public Object visit(ASTJspDeclaration node, Object data) {
160:                return visit((SimpleNode) node, data);
161:            }
162:
163:            public Object visit(ASTJspComment node, Object data) {
164:                return visit((SimpleNode) node, data);
165:            }
166:
167:            public Object visit(ASTText node, Object data) {
168:                return visit((SimpleNode) node, data);
169:            }
170:
171:            public Object visit(ASTUnparsedText node, Object data) {
172:                return visit((SimpleNode) node, data);
173:            }
174:
175:            public Object visit(ASTElExpression node, Object data) {
176:                return visit((SimpleNode) node, data);
177:            }
178:
179:            public Object visit(ASTValueBinding node, Object data) {
180:                return visit((SimpleNode) node, data);
181:            }
182:
183:            public Object visit(ASTCData node, Object data) {
184:                return visit((SimpleNode) node, data);
185:            }
186:
187:            public Object visit(ASTElement node, Object data) {
188:                return visit((SimpleNode) node, data);
189:            }
190:
191:            public Object visit(ASTAttribute node, Object data) {
192:                return visit((SimpleNode) node, data);
193:            }
194:
195:            public Object visit(ASTAttributeValue node, Object data) {
196:                return visit((SimpleNode) node, data);
197:            }
198:
199:            public Object visit(ASTJspExpressionInAttribute node, Object data) {
200:                return visit((SimpleNode) node, data);
201:            }
202:
203:            public Object visit(ASTCommentTag node, Object data) {
204:                return visit((SimpleNode) node, data);
205:            }
206:
207:            public Object visit(ASTDeclaration node, Object data) {
208:                return visit((SimpleNode) node, data);
209:            }
210:
211:            public Object visit(ASTDoctypeDeclaration node, Object data) {
212:                return visit((SimpleNode) node, data);
213:            }
214:
215:            public Object visit(ASTDoctypeExternalId node, Object data) {
216:                return visit((SimpleNode) node, data);
217:            }
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.