View Javadoc

    1   package net.sourceforge.pmd.lang.jsp;
    2
    3   import java.io.Writer;
    4
    5   import net.sf.saxon.sxpath.IndependentContext;
    6   import net.sourceforge.pmd.lang.AbstractLanguageVersionHandler;
    7   import net.sourceforge.pmd.lang.Parser;
    8   import net.sourceforge.pmd.lang.ParserOptions;
    9   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 extends AbstractLanguageVersionHandler {
    24
    25      @Override
    26      public XPathHandler getXPathHandler() {
    27  	return new AbstractASTXPathHandler() {
    28  	    public void initialize() {
    29  	    }
    30
    31  	    public void initialize(IndependentContext context) {
    32  	    }
    33  	};
    34      }
    35
    36      public RuleViolationFactory getRuleViolationFactory() {
    37  	return JspRuleViolationFactory.INSTANCE;
    38      }
    39
    40      public Parser getParser(ParserOptions parserOptions) {
    41  	return new JspParser(parserOptions);
    42      }
    43
    44      @Override
    45      public VisitorStarter getDumpFacade(final Writer writer, final String prefix, final boolean recurse) {
    46  	return new VisitorStarter() {
    47  	    public void start(Node rootNode) {
    48  		new DumpFacade().initializeWith(writer, prefix, recurse, (JspNode) rootNode);
    49  	    }
    50  	};
    51      }
    52  }