JspHandler.java
01 package net.sourceforge.pmd.lang.jsp;
02 
03 import java.io.Writer;
04 
05 import net.sf.saxon.sxpath.IndependentContext;
06 import net.sourceforge.pmd.lang.DataFlowHandler;
07 import net.sourceforge.pmd.lang.LanguageVersionHandler;
08 import net.sourceforge.pmd.lang.Parser;
09 import net.sourceforge.pmd.lang.VisitorStarter;
10 import net.sourceforge.pmd.lang.XPathHandler;
11 import net.sourceforge.pmd.lang.ast.Node;
12 import net.sourceforge.pmd.lang.ast.xpath.AbstractASTXPathHandler;
13 import net.sourceforge.pmd.lang.jsp.ast.DumpFacade;
14 import net.sourceforge.pmd.lang.jsp.ast.JspNode;
15 import net.sourceforge.pmd.lang.jsp.rule.JspRuleViolationFactory;
16 import net.sourceforge.pmd.lang.rule.RuleViolationFactory;
17 
18 /**
19  * Implementation of LanguageVersionHandler for the JSP parser.
20  *
21  @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
22  */
23 public class JspHandler implements LanguageVersionHandler {
24 
25     public DataFlowHandler getDataFlowHandler() {
26   return DataFlowHandler.DUMMY;
27     }
28 
29     public XPathHandler getXPathHandler() {
30   return new AbstractASTXPathHandler() {
31       public void initialize() {
32       }
33 
34       public void initialize(IndependentContext context) {
35       }
36   };
37     }
38 
39     public RuleViolationFactory getRuleViolationFactory() {
40   return JspRuleViolationFactory.INSTANCE;
41     }
42 
43     public Parser getParser() {
44   return new JspParser();
45     }
46 
47     public VisitorStarter getDataFlowFacade() {
48   return VisitorStarter.DUMMY;
49     }
50 
51     public VisitorStarter getSymbolFacade() {
52   return VisitorStarter.DUMMY;
53     }
54 
55     public VisitorStarter getTypeResolutionFacade(ClassLoader classLoader) {
56   return VisitorStarter.DUMMY;
57     }
58 
59     public VisitorStarter getDumpFacade(final Writer writer, final String prefix, final boolean recurse) {
60   return new VisitorStarter() {
61       public void start(Node rootNode) {
62     new DumpFacade().initializeWith(writer, prefix, recurse, (JspNoderootNode);
63       }
64   };
65     }
66 }