From fc24fe199eb5968ab7adb26fd23f650e4a8f8a9e Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Fri, 8 Oct 2010 15:48:07 +0000 Subject: API: apply the same pattern between rules and profiles API. The extension point to define rules is org.sonar.api.rules.RuleRepository. The classes AnnotationRuleParser and XMLRuleParser are components that can be used but not extended. --- .../org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins/sonar-checkstyle-plugin/src/main') diff --git a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java index ee533a1cffa..02dd0ad885c 100644 --- a/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java +++ b/plugins/sonar-checkstyle-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleRuleRepository.java @@ -33,19 +33,21 @@ public final class CheckstyleRuleRepository extends RuleRepository { // for user extensions private ServerFileSystem fileSystem; + private XMLRuleParser xmlRuleParser; - public CheckstyleRuleRepository(ServerFileSystem fileSystem) { + public CheckstyleRuleRepository(ServerFileSystem fileSystem, XMLRuleParser xmlRuleParser) { super(CheckstyleConstants.REPOSITORY_KEY, Java.KEY); setName(CheckstyleConstants.REPOSITORY_NAME); this.fileSystem = fileSystem; + this.xmlRuleParser = xmlRuleParser; } @Override public List createRules() { List rules = new ArrayList(); - rules.addAll(XMLRuleParser.parseXML(getClass().getResourceAsStream("/org/sonar/plugins/checkstyle/rules.xml"))); + rules.addAll(xmlRuleParser.parse(getClass().getResourceAsStream("/org/sonar/plugins/checkstyle/rules.xml"))); for (File userExtensionXml : fileSystem.getExtensions(CheckstyleConstants.REPOSITORY_KEY, "xml")) { - rules.addAll(XMLRuleParser.parseXML(userExtensionXml)); + rules.addAll(xmlRuleParser.parse(userExtensionXml)); } return rules; } -- cgit v1.2.3