1
2
3
4 package net.sourceforge.pmd.lang.plsql;
5
6 import java.io.Writer;
7 import net.sf.saxon.sxpath.IndependentContext;
8
9 import net.sourceforge.pmd.lang.AbstractLanguageVersionHandler;
10 import net.sourceforge.pmd.lang.DataFlowHandler;
11 import net.sourceforge.pmd.lang.Parser;
12 import net.sourceforge.pmd.lang.ParserOptions;
13 import net.sourceforge.pmd.lang.VisitorStarter;
14 import net.sourceforge.pmd.lang.XPathHandler;
15 import net.sourceforge.pmd.lang.ast.Node;
16 import net.sourceforge.pmd.lang.ast.xpath.DocumentNavigator;
17 import net.sourceforge.pmd.lang.dfa.DFAGraphRule;
18 import net.sourceforge.pmd.lang.plsql.ast.ASTInput;
19 import net.sourceforge.pmd.lang.plsql.ast.DumpFacade;
20 import net.sourceforge.pmd.lang.plsql.ast.PLSQLNode;
21 import net.sourceforge.pmd.lang.plsql.dfa.DFAPLSQLGraphRule;
22 import net.sourceforge.pmd.lang.plsql.dfa.DataFlowFacade;
23 import net.sourceforge.pmd.lang.plsql.rule.PLSQLRuleViolationFactory;
24 import net.sourceforge.pmd.lang.plsql.symboltable.SymbolFacade;
25 import net.sourceforge.pmd.lang.rule.RuleViolationFactory;
26 import org.jaxen.Navigator;
27
28
29
30
31
32
33
34 public class PLSQLHandler extends AbstractLanguageVersionHandler {
35
36
37 public Parser getParser(ParserOptions parserOptions) {
38 return new PLSQLParser(parserOptions);
39 }
40
41 public RuleViolationFactory getRuleViolationFactory() {
42 return PLSQLRuleViolationFactory.INSTANCE;
43 }
44
45 @Override
46 public DFAGraphRule getDFAGraphRule() {
47 return new DFAPLSQLGraphRule();
48 }
49
50 @Override
51 public DataFlowHandler getDataFlowHandler() {
52 return new PLSQLDataFlowHandler();
53 }
54
55 @Override
56 public VisitorStarter getDataFlowFacade() {
57 return new VisitorStarter() {
58 public void start(Node rootNode) {
59 new DataFlowFacade().initializeWith(getDataFlowHandler(), (ASTInput) rootNode);
60 }
61 };
62 }
63
64 @Override
65 public VisitorStarter getSymbolFacade() {
66 return new VisitorStarter() {
67 public void start(Node rootNode) {
68 new SymbolFacade().initializeWith((ASTInput) rootNode);
69 }
70 };
71 }
72
73 @Override
74 public VisitorStarter getDumpFacade(final Writer writer, final String prefix, final boolean recurse) {
75 return new VisitorStarter() {
76 public void start(Node rootNode) {
77 new DumpFacade().initializeWith(writer, prefix, recurse, (PLSQLNode) rootNode);
78 }
79 };
80 }
81
82
83 @Override
84
85
86
87 public XPathHandler getXPathHandler() {
88 return new XPathHandler() {
89 public void initialize() {
90 }
91
92 public void initialize(IndependentContext context) {
93 }
94
95 public Navigator getNavigator() {
96 return new DocumentNavigator();
97 }
98 };
99 }
100 }