From dc30e55e56000ad1b44ef6c387e1370885f68c4b Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 30 Sep 2011 13:30:22 +0200 Subject: [PATCH] SONAR-2797 end of support of maven archetypes --- archetypes/sonar-basic-plugin/README.txt | 8 -- archetypes/sonar-basic-plugin/pom.xml | 52 -------- archetypes/sonar-basic-plugin/project/pom.xml | 59 --------- .../plugins/sample/SampleDashboardWidget.java | 38 ------ .../sonar/plugins/sample/SampleMetrics.java | 26 ---- .../sonar/plugins/sample/SamplePlugin.java | 43 ------ .../sonar/plugins/sample/SampleSensor.java | 30 ----- .../sample_dashboard_widget.html.erb | 40 ------ .../META-INF/maven/archetype-metadata.xml | 16 --- .../resources/META-INF/maven/archetype.xml | 12 -- .../resources/archetype-resources/pom.xml | 58 --------- .../src/main/java/SampleDashboardWidget.java | 41 ------ .../src/main/java/SampleMetrics.java | 29 ----- .../src/main/java/SamplePlugin.java | 46 ------- .../src/main/java/SampleSensor.java | 33 ----- .../sample_dashboard_widget.html.erb | 40 ------ archetypes/sonar-gwt-plugin/pom.xml | 59 --------- archetypes/sonar-gwt-plugin/project/pom.xml | 123 ------------------ .../plugins/gwtsample/GwtSamplePlugin.java | 40 ------ .../plugins/gwtsample/page/GwtSamplePage.java | 18 --- .../plugins/gwtsample/page/SamplePage.gwt.xml | 13 -- .../gwtsample/page/client/I18nConstants.java | 11 -- .../page/client/I18nConstants_fr.properties | 2 - .../gwtsample/page/client/SamplePage.java | 18 --- .../plugins/gwtsample/page/public/test.html | 32 ----- .../resourcetab/GwtSampleResourceTab.java | 17 --- .../resourcetab/SampleResourceTab.gwt.xml | 10 -- .../resourcetab/client/SampleResourceTab.java | 14 -- .../META-INF/maven/archetype-metadata.xml | 13 -- .../resources/META-INF/maven/archetype.xml | 15 --- .../resources/archetype-resources/pom.xml | 121 ----------------- .../src/main/java/GwtSamplePlugin.java | 43 ------ .../src/main/java/page/GwtSamplePage.java | 21 --- .../src/main/java/page/SamplePage.gwt.xml | 16 --- .../main/java/page/client/I18nConstants.java | 14 -- .../page/client/I18nConstants_fr.properties | 5 - .../src/main/java/page/client/SamplePage.java | 21 --- .../src/main/java/page/public/test.html | 35 ----- .../resourcetab/GwtSampleResourceTab.java | 20 --- .../resourcetab/SampleResourceTab.gwt.xml | 13 -- .../resourcetab/client/SampleResourceTab.java | 17 --- pom.xml | 19 +-- samples/README.txt | 15 --- samples/assembly.xml | 50 ------- samples/checkstyle-extensions-plugin/pom.xml | 71 ---------- .../CheckstyleExtensionRepository.java | 35 ----- .../CheckstyleExtensionsPlugin.java | 14 -- .../sonar/checkstyle/MethodsCountCheck.java | 43 ------ .../mycompany/sonar/checkstyle/extensions.xml | 13 -- samples/gwt-plugin/pom.xml | 101 -------------- .../com/mycompany/sonar/gwt/GwtPlugin.java | 19 --- .../mycompany/sonar/gwt/page/SamplePage.java | 18 --- .../sonar/gwt/page/client/I18nConstants.java | 11 -- .../gwt/page/client/SamplePagePanel.java | 18 --- .../sonar/gwt/viewer/SampleViewer.java | 17 --- .../gwt/viewer/client/SampleViewerPanel.java | 38 ------ .../sonar/gwt/page/SamplePage.gwt.xml | 13 -- .../page/client/I18nConstants_fr.properties | 2 - .../mycompany/sonar/gwt/page/public/test.html | 32 ----- .../sonar/gwt/viewer/SampleViewer.gwt.xml | 10 -- samples/pmd-extensions-plugin/pom.xml | 58 --------- .../sonar/pmd/MaximumMethodsCountCheck.java | 25 ---- .../sonar/pmd/PmdExtensionRepository.java | 35 ----- .../sonar/pmd/PmdExtensionsPlugin.java | 14 -- .../com/mycompany/sonar/pmd/extensions.xml | 56 -------- .../com/mycompany/sonar/pmd/rulesets.xml | 53 -------- samples/pom.xml | 52 -------- samples/standard-plugin/pom.xml | 57 -------- .../sonar/standard/SampleMetrics.java | 31 ----- .../sonar/standard/SamplePlugin.java | 29 ----- .../sonar/standard/batch/RandomDecorator.java | 36 ----- .../sonar/standard/batch/SampleSensor.java | 20 --- .../sonar/standard/ui/SampleFooter.java | 9 -- .../sonar/standard/ui/SampleRubyWidget.java | 39 ------ .../resources/sample_ruby_widget.html.erb | 40 ------ 75 files changed, 1 insertion(+), 2374 deletions(-) delete mode 100644 archetypes/sonar-basic-plugin/README.txt delete mode 100644 archetypes/sonar-basic-plugin/pom.xml delete mode 100644 archetypes/sonar-basic-plugin/project/pom.xml delete mode 100644 archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleDashboardWidget.java delete mode 100644 archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleMetrics.java delete mode 100644 archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SamplePlugin.java delete mode 100644 archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleSensor.java delete mode 100644 archetypes/sonar-basic-plugin/project/src/main/resources/sample_dashboard_widget.html.erb delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype.xml delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/pom.xml delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleDashboardWidget.java delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleMetrics.java delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SamplePlugin.java delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleSensor.java delete mode 100644 archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/resources/sample_dashboard_widget.html.erb delete mode 100644 archetypes/sonar-gwt-plugin/pom.xml delete mode 100644 archetypes/sonar-gwt-plugin/project/pom.xml delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/GwtSamplePlugin.java delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/GwtSamplePage.java delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/SamplePage.gwt.xml delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants.java delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants_fr.properties delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/SamplePage.java delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/public/test.html delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/GwtSampleResourceTab.java delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/SampleResourceTab.gwt.xml delete mode 100644 archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/client/SampleResourceTab.java delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype.xml delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/pom.xml delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/GwtSamplePlugin.java delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/GwtSamplePage.java delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/SamplePage.gwt.xml delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants.java delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants_fr.properties delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/SamplePage.java delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/public/test.html delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/GwtSampleResourceTab.java delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/SampleResourceTab.gwt.xml delete mode 100644 archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/client/SampleResourceTab.java delete mode 100644 samples/README.txt delete mode 100644 samples/assembly.xml delete mode 100644 samples/checkstyle-extensions-plugin/pom.xml delete mode 100644 samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionRepository.java delete mode 100644 samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionsPlugin.java delete mode 100644 samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/MethodsCountCheck.java delete mode 100644 samples/checkstyle-extensions-plugin/src/main/resources/com/mycompany/sonar/checkstyle/extensions.xml delete mode 100644 samples/gwt-plugin/pom.xml delete mode 100644 samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/GwtPlugin.java delete mode 100644 samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/SamplePage.java delete mode 100644 samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/I18nConstants.java delete mode 100644 samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/SamplePagePanel.java delete mode 100644 samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/SampleViewer.java delete mode 100644 samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/client/SampleViewerPanel.java delete mode 100644 samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/SamplePage.gwt.xml delete mode 100644 samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/client/I18nConstants_fr.properties delete mode 100644 samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/public/test.html delete mode 100644 samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/viewer/SampleViewer.gwt.xml delete mode 100644 samples/pmd-extensions-plugin/pom.xml delete mode 100644 samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/MaximumMethodsCountCheck.java delete mode 100644 samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionRepository.java delete mode 100644 samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionsPlugin.java delete mode 100644 samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/extensions.xml delete mode 100644 samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/rulesets.xml delete mode 100644 samples/pom.xml delete mode 100644 samples/standard-plugin/pom.xml delete mode 100644 samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SampleMetrics.java delete mode 100644 samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SamplePlugin.java delete mode 100644 samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/RandomDecorator.java delete mode 100644 samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/SampleSensor.java delete mode 100644 samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleFooter.java delete mode 100644 samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleRubyWidget.java delete mode 100644 samples/standard-plugin/src/main/resources/sample_ruby_widget.html.erb diff --git a/archetypes/sonar-basic-plugin/README.txt b/archetypes/sonar-basic-plugin/README.txt deleted file mode 100644 index a4dca475c74..00000000000 --- a/archetypes/sonar-basic-plugin/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -To update the archetype project : - -1. update sources of the initial project (/project directory) -2. /project$ mvn install -DsonarTargetVersion= -3. copy the content of /project/target/generated-sources/archetype/src/main/resources to src/main/resources. Be careful with .svn files ! - -To execute the archetype : -mvn archetype:generate -B -DarchetypeGroupId=org.codehaus.sonar.archetypes -DarchetypeArtifactId=sonar-basic-plugin-archetype -DarchetypeVersion= -DgroupId=com.mycompany.sonar -DartifactId=sonar-basic-sample-plugin -Dversion=0.1-SNAPSHOT \ No newline at end of file diff --git a/archetypes/sonar-basic-plugin/pom.xml b/archetypes/sonar-basic-plugin/pom.xml deleted file mode 100644 index 0b8e3aee9e5..00000000000 --- a/archetypes/sonar-basic-plugin/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - - org.codehaus.sonar - sonar - 2.12-SNAPSHOT - ../.. - - - org.codehaus.sonar.archetypes - sonar-basic-plugin-archetype - maven-archetype - Sonar :: Archetypes :: Basic - Maven archetype to create a basic Sonar plugin - - - ${project.version} - - - - - org.codehaus.sonar - sonar-plugin-api - ${project.version} - - - - - - - true - ${basedir}/src/main/resources - - - - - org.apache.maven.archetype - archetype-packaging - 2.0-alpha-4 - - - - - maven-archetype-plugin - 2.0-alpha-4 - true - - - - diff --git a/archetypes/sonar-basic-plugin/project/pom.xml b/archetypes/sonar-basic-plugin/project/pom.xml deleted file mode 100644 index 15fc124de96..00000000000 --- a/archetypes/sonar-basic-plugin/project/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - org.codehaus.sonar.archetypes - sonar-basic-plugin - sonar-plugin - 1.0-SNAPSHOT - My Sonar plugin - plugin description - - - - My company - http://www.mycompany.com - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonarTargetVersion} - - - - - - - org.codehaus.sonar - sonar-testing-harness - ${sonarTargetVersion} - test - - - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.0 - true - - ${package}.SamplePlugin - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - - diff --git a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleDashboardWidget.java b/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleDashboardWidget.java deleted file mode 100644 index 1b5d5e2f2b9..00000000000 --- a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleDashboardWidget.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.sonar.plugins.sample; - -import org.sonar.api.web.*; - -@UserRole(UserRole.USER) -@Description("Show how to use Ruby Widget API") -@WidgetProperties({ - @WidgetProperty(key="param1", - description="This is a mandatory parameter", - optional=false - ), - @WidgetProperty(key="max", - description="max threshold", - type=WidgetPropertyType.INTEGER, - defaultValue="80" - ), - @WidgetProperty(key="param2", - description="This is an optional parameter" - ), - @WidgetProperty(key="floatprop", - description="test description" - ) -}) -public class SampleDashboardWidget extends AbstractRubyTemplate implements RubyRailsWidget { - - public String getId() { - return "sample"; - } - - public String getTitle() { - return "Sample"; - } - - @Override - protected String getTemplatePath() { - return "/sample_dashboard_widget.html.erb"; - } -} \ No newline at end of file diff --git a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleMetrics.java b/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleMetrics.java deleted file mode 100644 index 294bc5c8548..00000000000 --- a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleMetrics.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.sonar.plugins.sample; - -import org.sonar.api.measures.Metrics; -import org.sonar.api.measures.Metric; -import org.sonar.api.measures.CoreMetrics; - -import java.util.List; -import java.util.Arrays; - -public class SampleMetrics implements Metrics { - - public static final Metric MESSAGE = new Metric("message_key", "Message", - "This is a metric to store a well known message", Metric.ValueType.STRING, -1, false, - CoreMetrics.DOMAIN_GENERAL); - - - public static final Metric RANDOM = new Metric("random", "Random", - "Random value", Metric.ValueType.FLOAT, Metric.DIRECTION_BETTER, false, - CoreMetrics.DOMAIN_GENERAL); - - // getMetrics() method is defined in the Metrics interface and is used by - // Sonar to retrieve the list of new Metric - public List getMetrics() { - return Arrays.asList(MESSAGE, RANDOM); - } -} diff --git a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SamplePlugin.java b/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SamplePlugin.java deleted file mode 100644 index 5856d414c97..00000000000 --- a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SamplePlugin.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.sonar.plugins.sample; - -import org.sonar.api.Plugin; - -import java.util.ArrayList; -import java.util.List; - -/** - * This class is the entry point for all extensions - */ -public class SamplePlugin implements Plugin { - - /** - * @deprecated this is not used anymore - */ - public String getKey() { - return "sample"; - } - - /** - * @deprecated this is not used anymore - */ - public String getName() { - return "My Sonar plugin"; - } - - /** - * @deprecated this is not used anymore - */ - public String getDescription() { - return "You shouldn't expect too much from this plugin except displaying the Hello World message."; - } - - // This is where you're going to declare all your Sonar extensions - public List getExtensions() { - return Arrays.asList(SampleMetrics.class, SampleSensor.class, SampleDashboardWidget.class); - } - - @Override - public String toString() { - return getClass().getSimpleName(); - } -} \ No newline at end of file diff --git a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleSensor.java b/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleSensor.java deleted file mode 100644 index 6e0deb74656..00000000000 --- a/archetypes/sonar-basic-plugin/project/src/main/java/org/sonar/plugins/sample/SampleSensor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.sonar.plugins.sample; - -import org.apache.commons.lang.math.RandomUtils; -import org.sonar.api.batch.Sensor; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Project; - -public class SampleSensor implements Sensor { - - public boolean shouldExecuteOnProject(Project project) { - // this sensor is executed on any type of project - return true; - } - - public void analyse(Project project, SensorContext sensorContext) { - saveLabelMeasure(sensorContext); - saveNumericMeasure(sensorContext); - } - - private void saveNumericMeasure(SensorContext context) { - // Sonar API includes many libraries like commons-lang and google-collections - context.saveMeasure(SampleMetrics.RANDOM, RandomUtils.nextDouble()); - } - - private void saveLabelMeasure(SensorContext context) { - Measure measure = new Measure(SampleMetrics.MESSAGE, "Hello World!"); - context.saveMeasure(measure); - } -} diff --git a/archetypes/sonar-basic-plugin/project/src/main/resources/sample_dashboard_widget.html.erb b/archetypes/sonar-basic-plugin/project/src/main/resources/sample_dashboard_widget.html.erb deleted file mode 100644 index d52038ffe25..00000000000 --- a/archetypes/sonar-basic-plugin/project/src/main/resources/sample_dashboard_widget.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -
-

-

- - <%= format_measure('random') -%> <%= tendency_icon(measure('random')) %> - -

-

<%= format_measure('message') -%>

-

- <%= format_measure('ncloc', :suffix => ' lines', :url => url_for_drilldown('ncloc')) -%> -

-
-
-

Help

-

- Read configuration : <%= configuration('sonar.jdbc.username') -%> -

- -

- Sample of Jfree Eastwood chart :
- <%= gchart('cht=bhs&chco=FF0000,00FF00,0000FF&chs=200x125&chd=s:FOE,THE,Bar&chxt=x,y&chxl=1:|Dec|Nov|Oct|0:||20K||60K||100K|') -%> -

-

- Widget properties: - - - - - - - - - - - - - -
max:<%= widget_properties['max'] -%>
param1:<%= widget_properties['param1'] -%>
param2:<%= widget_properties['param2'] -%>
-

-
diff --git a/archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 4333c924715..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - src/main/java - - **/*.java - - - - src/main/resources - - **/*.erb - - - - \ No newline at end of file diff --git a/archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype.xml b/archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype.xml deleted file mode 100644 index 4c51c1ced5f..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/META-INF/maven/archetype.xml +++ /dev/null @@ -1,12 +0,0 @@ - - sonar-basic-plugin - - src/main/java/SampleDashboardWidget.java - src/main/java/SampleMetrics.java - src/main/java/SamplePlugin.java - src/main/java/SampleSensor.java - - - src/main/resources/sample_dashboard_widget.html.erb - - \ No newline at end of file diff --git a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/pom.xml b/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index 9d8f2a1be26..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - $groupId - $artifactId - sonar-plugin - $version - My Sonar plugin - plugin description - - - - My company - http://www.mycompany.com - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonarTargetVersion} - - - - - - - org.codehaus.sonar - sonar-testing-harness - ${sonarTargetVersion} - test - - - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.0 - true - - ${package}.SamplePlugin - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - - diff --git a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleDashboardWidget.java b/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleDashboardWidget.java deleted file mode 100644 index f368bdadae9..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleDashboardWidget.java +++ /dev/null @@ -1,41 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}; - -import org.sonar.api.web.*; - -@UserRole(UserRole.USER) -@Description("Show how to use Ruby Widget API") -@WidgetProperties({ - @WidgetProperty(key="param1", - description="This is a mandatory parameter", - optional=false - ), - @WidgetProperty(key="max", - description="max threshold", - type=WidgetPropertyType.INTEGER, - defaultValue="80" - ), - @WidgetProperty(key="param2", - description="This is an optional parameter" - ), - @WidgetProperty(key="floatprop", - description="test description" - ) -}) -public class SampleDashboardWidget extends AbstractRubyTemplate implements RubyRailsWidget { - - public String getId() { - return "sample"; - } - - public String getTitle() { - return "Sample"; - } - - @Override - protected String getTemplatePath() { - return "/sample_dashboard_widget.html.erb"; - } -} \ No newline at end of file diff --git a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleMetrics.java b/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleMetrics.java deleted file mode 100644 index 0f675d66db3..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleMetrics.java +++ /dev/null @@ -1,29 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}; - -import org.sonar.api.measures.Metrics; -import org.sonar.api.measures.Metric; -import org.sonar.api.measures.CoreMetrics; - -import java.util.List; -import java.util.Arrays; - -public class SampleMetrics implements Metrics { - - public static final Metric MESSAGE = new Metric("message_key", "Message", - "This is a metric to store a well known message", Metric.ValueType.STRING, -1, false, - CoreMetrics.DOMAIN_GENERAL); - - - public static final Metric RANDOM = new Metric("random", "Random", - "Random value", Metric.ValueType.FLOAT, Metric.DIRECTION_BETTER, false, - CoreMetrics.DOMAIN_GENERAL); - - // getMetrics() method is defined in the Metrics interface and is used by - // Sonar to retrieve the list of new Metric - public List getMetrics() { - return Arrays.asList(MESSAGE, RANDOM); - } -} diff --git a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SamplePlugin.java b/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SamplePlugin.java deleted file mode 100644 index 79c4b32b0aa..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SamplePlugin.java +++ /dev/null @@ -1,46 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}; - -import org.sonar.api.Plugin; - -import java.util.Arrays; -import java.util.List; - -/** - * This class is the entry point for all extensions - */ -public class SamplePlugin implements Plugin { - - /** - * @deprecated this is not used anymore - */ - public String getKey() { - return "sample"; - } - - /** - * @deprecated this is not used anymore - */ - public String getName() { - return "My Sonar plugin"; - } - - /** - * @deprecated this is not used anymore - */ - public String getDescription() { - return "You shouldn't expect too much from this plugin except displaying the Hello World message."; - } - - // This is where you're going to declare all your Sonar extensions - public List getExtensions() { - return Arrays.asList(SampleMetrics.class, SampleSensor.class, SampleDashboardWidget.class); - } - - @Override - public String toString() { - return getClass().getSimpleName(); - } -} diff --git a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleSensor.java b/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleSensor.java deleted file mode 100644 index d28f80c8a2e..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/java/SampleSensor.java +++ /dev/null @@ -1,33 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}; - -import org.apache.commons.lang.math.RandomUtils; -import org.sonar.api.batch.Sensor; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Project; - -public class SampleSensor implements Sensor { - - public boolean shouldExecuteOnProject(Project project) { - // this sensor is executed on any type of project - return true; - } - - public void analyse(Project project, SensorContext sensorContext) { - saveLabelMeasure(sensorContext); - saveNumericMeasure(sensorContext); - } - - private void saveNumericMeasure(SensorContext context) { - // Sonar API includes many libraries like commons-lang and google-collections - context.saveMeasure(SampleMetrics.RANDOM, RandomUtils.nextDouble()); - } - - private void saveLabelMeasure(SensorContext context) { - Measure measure = new Measure(SampleMetrics.MESSAGE, "Hello World!"); - context.saveMeasure(measure); - } -} diff --git a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/resources/sample_dashboard_widget.html.erb b/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/resources/sample_dashboard_widget.html.erb deleted file mode 100644 index d52038ffe25..00000000000 --- a/archetypes/sonar-basic-plugin/src/main/resources/archetype-resources/src/main/resources/sample_dashboard_widget.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -
-

-

- - <%= format_measure('random') -%> <%= tendency_icon(measure('random')) %> - -

-

<%= format_measure('message') -%>

-

- <%= format_measure('ncloc', :suffix => ' lines', :url => url_for_drilldown('ncloc')) -%> -

-
-
-

Help

-

- Read configuration : <%= configuration('sonar.jdbc.username') -%> -

- -

- Sample of Jfree Eastwood chart :
- <%= gchart('cht=bhs&chco=FF0000,00FF00,0000FF&chs=200x125&chd=s:FOE,THE,Bar&chxt=x,y&chxl=1:|Dec|Nov|Oct|0:||20K||60K||100K|') -%> -

-

- Widget properties: - - - - - - - - - - - - - -
max:<%= widget_properties['max'] -%>
param1:<%= widget_properties['param1'] -%>
param2:<%= widget_properties['param2'] -%>
-

-
diff --git a/archetypes/sonar-gwt-plugin/pom.xml b/archetypes/sonar-gwt-plugin/pom.xml deleted file mode 100644 index 283cd647280..00000000000 --- a/archetypes/sonar-gwt-plugin/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - 4.0.0 - - - org.codehaus.sonar - sonar - 2.12-SNAPSHOT - ../.. - - - org.codehaus.sonar.archetypes - sonar-gwt-plugin-archetype - maven-archetype - Sonar :: Archetypes :: GWT - Maven archetype to create a Sonar plugin including GWT pages - - - ${project.version} - $ - - - - - org.codehaus.sonar - sonar-plugin-api - ${project.version} - - - org.codehaus.sonar - sonar-gwt-api - ${project.version} - - - - - - - true - ${basedir}/src/main/resources - - - - - - org.apache.maven.archetype - archetype-packaging - 2.0-alpha-4 - - - - - maven-archetype-plugin - 2.0-alpha-4 - true - - - - diff --git a/archetypes/sonar-gwt-plugin/project/pom.xml b/archetypes/sonar-gwt-plugin/project/pom.xml deleted file mode 100644 index 5111399d131..00000000000 --- a/archetypes/sonar-gwt-plugin/project/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - 4.0.0 - - org.codehaus.sonar.archetypes - sonar-gwt-plugin - sonar-plugin - 1.0-SNAPSHOT - My Sonar GWT plugin - GWT Sample description - - - - My company - http://www.mycompany.com - - - - - - sonar - Sonar - http://repository.sonarsource.org/content/repositories/sonar - - true - - - false - - - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonarTargetVersion} - - - org.codehaus.sonar - sonar-gwt-api - ${sonarTargetVersion} - provided - - - com.google.gwt - gwt-user - 2.0.3 - provided - - - com.google.gwt - gwt-incubator - 2.0.1 - provided - - - - - org.codehaus.sonar - sonar-testing-harness - ${sonarTargetVersion} - test - - - junit - junit - 4.7 - test - - - - - - - src/main/java - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.0 - true - - ${package}.GwtSamplePlugin - - - - org.codehaus.mojo - gwt-maven-plugin - 1.2 - - - - - ${package}.resourcetab.SampleResourceTab - ${package}.page.SamplePage - - ${project.build.directory}/classes - - -Xmx512m -Dgwt.jjs.permutationWorkerFactory=com.google.gwt.dev.ThreadedPermutationWorkerFactory - - - compile - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - - diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/GwtSamplePlugin.java b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/GwtSamplePlugin.java deleted file mode 100644 index 6bb19504428..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/GwtSamplePlugin.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.sonar.plugins.gwtsample; - -import org.sonar.api.Plugin; -import org.sonar.plugins.gwtsample.page.GwtSamplePage; -import org.sonar.plugins.gwtsample.resourcetab.GwtSampleResourceTab; - -import java.util.Arrays; -import java.util.List; - -public class GwtSamplePlugin implements Plugin { - - /** - * @deprecated this is not used anymore - */ - public String getKey() { - return "gwt-sample"; - } - - /** - * @deprecated this is not used anymore - */ - public String getName() { - return "GWT Sample"; - } - - /** - * @deprecated this is not used anymore - */ - public String getDescription() { - return "GWT Sample description"; - } - - public List getExtensions() { - return Arrays.asList(GwtSampleResourceTab.class, GwtSamplePage.class); - } - - public String toString() { - return getKey(); - } -} diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/GwtSamplePage.java b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/GwtSamplePage.java deleted file mode 100644 index 1313737551a..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/GwtSamplePage.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.sonar.plugins.gwtsample.page; - -import org.sonar.api.web.GwtPage; -import org.sonar.api.web.NavigationSection; -import org.sonar.api.web.UserRole; - -@NavigationSection(NavigationSection.RESOURCE) -@UserRole(UserRole.USER) -public class GwtSamplePage extends GwtPage { - - public String getGwtId() { - return "org.sonar.plugins.gwtsample.page.SamplePage"; - } - - public String getTitle() { - return "Sample"; - } -} diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/SamplePage.gwt.xml b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/SamplePage.gwt.xml deleted file mode 100644 index 5fcbdcdc538..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/SamplePage.gwt.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants.java b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants.java deleted file mode 100644 index d4b387946de..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.sonar.plugins.gwtsample.page.client; - -import com.google.gwt.core.client.GWT; - -public interface I18nConstants extends com.google.gwt.i18n.client.Constants { - - static I18nConstants INSTANCE = GWT.create(I18nConstants.class); - - @DefaultStringValue("This is a sample") - String sample(); -} diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants_fr.properties b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants_fr.properties deleted file mode 100644 index aa92d17b38b..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/I18nConstants_fr.properties +++ /dev/null @@ -1,2 +0,0 @@ -# This file must use UTF-8 encoding -sample=Ceci est un exemple \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/SamplePage.java b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/SamplePage.java deleted file mode 100644 index c7a2235ae4f..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/client/SamplePage.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.sonar.plugins.gwtsample.page.client; - -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.services.Resource; - -public class SamplePage extends Page { - - @Override - protected Widget doOnResourceLoad(Resource resource) { - VerticalPanel panel = new VerticalPanel(); - panel.add(new Label(resource.getName(true))); - panel.add(new Label(I18nConstants.INSTANCE.sample())); - return panel; - } -} diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/public/test.html b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/public/test.html deleted file mode 100644 index 04371e3acb1..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/page/public/test.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - GWT Smaple - - - - - - - - - - - - - - -
-
- - - - \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/GwtSampleResourceTab.java b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/GwtSampleResourceTab.java deleted file mode 100644 index 34c84b8eb79..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/GwtSampleResourceTab.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.sonar.plugins.gwtsample.resourcetab; - -import org.sonar.api.web.GwtPage; -import org.sonar.api.web.NavigationSection; -import org.sonar.api.web.UserRole; - -@NavigationSection(NavigationSection.RESOURCE_TAB) -@UserRole(UserRole.USER) -public class GwtSampleResourceTab extends GwtPage { - public String getTitle() { - return "Sample"; - } - - public String getGwtId() { - return "org.sonar.plugins.gwtsample.resourcetab.SampleResourceTab"; - } -} \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/SampleResourceTab.gwt.xml b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/SampleResourceTab.gwt.xml deleted file mode 100644 index cf665cdabf3..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/SampleResourceTab.gwt.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/client/SampleResourceTab.java b/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/client/SampleResourceTab.java deleted file mode 100644 index 9315b835b60..00000000000 --- a/archetypes/sonar-gwt-plugin/project/src/main/java/org/sonar/plugins/gwtsample/resourcetab/client/SampleResourceTab.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.sonar.plugins.gwtsample.resourcetab.client; - -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.services.Resource; - -public class SampleResourceTab extends Page { - - @Override - protected Widget doOnResourceLoad(Resource resource) { - return new Label("This is a sample"); - } -} \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index f0aa4ec4676..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - src/main/java - - **/*.xml - **/*.html - **/*.java - **/*.properties - - - - \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype.xml b/archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype.xml deleted file mode 100644 index e60be8b35fd..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/META-INF/maven/archetype.xml +++ /dev/null @@ -1,15 +0,0 @@ - - sonar-gwt-plugin - - src/main/java/GwtSamplePlugin.java - src/main/java/page/client/I18nConstants.java - src/main/java/page/client/I18nConstants_fr.properties - src/main/java/page/client/SamplePage.java - src/main/java/page/GwtSamplePage.java - src/main/java/page/public/test.html - src/main/java/page/SamplePage.gwt.xml - src/main/java/resourcetab/client/SampleResourceTab.java - src/main/java/resourcetab/GwtSampleResourceTab.java - src/main/java/resourcetab/SampleResourceTab.gwt.xml - - \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/pom.xml b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index cad5e845a9b..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - 4.0.0 - - $groupId - $artifactId - sonar-plugin - 1.0-SNAPSHOT - My Sonar GWT plugin - GWT Sample description - - - - My company - http://www.mycompany.com - - - - - - sonar - Sonar - http://repository.sonarsource.org/content/repositories/sonar - - - - false - - - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonarTargetVersion} - - - org.codehaus.sonar - sonar-gwt-api - ${sonarTargetVersion} - provided - - - com.google.gwt - gwt-user - 2.0.3 - provided - - - com.google.gwt - gwt-incubator - 2.0.1 - provided - - - - - org.codehaus.sonar - sonar-testing-harness - ${sonarTargetVersion} - test - - - junit - junit - 4.7 - test - - - - - - - src/main/java - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.0 - true - - ${package}.GwtSamplePlugin - - - - org.codehaus.mojo - gwt-maven-plugin - 1.2 - - - - - ${package}.resourcetab.SampleResourceTab - ${package}.page.SamplePage - - target/classes - - -Xmx512m -Dgwt.jjs.permutationWorkerFactory=com.google.gwt.dev.ThreadedPermutationWorkerFactory - - - compile - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - - diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/GwtSamplePlugin.java b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/GwtSamplePlugin.java deleted file mode 100644 index deab27bb70d..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/GwtSamplePlugin.java +++ /dev/null @@ -1,43 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}; - -import org.sonar.api.Plugin; -import ${package}.page.GwtSamplePage; -import ${package}.resourcetab.GwtSampleResourceTab; - -import java.util.Arrays; -import java.util.List; - -public class GwtSamplePlugin implements Plugin { - - /** - * @deprecated this is not used anymore - */ - public String getKey() { - return "gwt-sample"; - } - - /** - * @deprecated this is not used anymore - */ - public String getName() { - return "GWT Sample"; - } - - /** - * @deprecated this is not used anymore - */ - public String getDescription() { - return "GWT Sample description"; - } - - public List getExtensions() { - return Arrays.asList(GwtSampleResourceTab.class, GwtSamplePage.class); - } - - public String toString() { - return getKey(); - } -} diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/GwtSamplePage.java b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/GwtSamplePage.java deleted file mode 100644 index 3dea837efdf..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/GwtSamplePage.java +++ /dev/null @@ -1,21 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.page; - -import org.sonar.api.web.GwtPage; -import org.sonar.api.web.NavigationSection; -import org.sonar.api.web.UserRole; - -@NavigationSection(NavigationSection.RESOURCE) -@UserRole(UserRole.USER) -public class GwtSamplePage extends GwtPage { - - public String getGwtId() { - return "${package}.page.SamplePage"; - } - - public String getTitle() { - return "Sample"; - } -} diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/SamplePage.gwt.xml b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/SamplePage.gwt.xml deleted file mode 100644 index 89a0800f0c5..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/SamplePage.gwt.xml +++ /dev/null @@ -1,16 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - - - - - - - - - - - - - diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants.java b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants.java deleted file mode 100644 index 1c34bd10240..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants.java +++ /dev/null @@ -1,14 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.page.client; - -import com.google.gwt.core.client.GWT; - -public interface I18nConstants extends com.google.gwt.i18n.client.Constants { - - static I18nConstants INSTANCE = GWT.create(I18nConstants.class); - - @DefaultStringValue("This is a sample") - String sample(); -} diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants_fr.properties b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants_fr.properties deleted file mode 100644 index 89a9d6fe129..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/I18nConstants_fr.properties +++ /dev/null @@ -1,5 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -${symbol_pound} This file must use UTF-8 encoding -sample=Ceci est un exemple \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/SamplePage.java b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/SamplePage.java deleted file mode 100644 index bb9b716f634..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/client/SamplePage.java +++ /dev/null @@ -1,21 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.page.client; - -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.services.Resource; - -public class SamplePage extends Page { - - @Override - protected Widget doOnResourceLoad(Resource resource) { - VerticalPanel panel = new VerticalPanel(); - panel.add(new Label(resource.getName(true))); - panel.add(new Label(I18nConstants.INSTANCE.sample())); - return panel; - } -} diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/public/test.html b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/public/test.html deleted file mode 100644 index 5d26e9ab834..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/page/public/test.html +++ /dev/null @@ -1,35 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - - - - - - GWT Smaple - - - - - - - - - - - - - - -
-
- - - - \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/GwtSampleResourceTab.java b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/GwtSampleResourceTab.java deleted file mode 100644 index a5253b46940..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/GwtSampleResourceTab.java +++ /dev/null @@ -1,20 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.resourcetab; - -import org.sonar.api.web.GwtPage; -import org.sonar.api.web.NavigationSection; -import org.sonar.api.web.UserRole; - -@NavigationSection(NavigationSection.RESOURCE_TAB) -@UserRole(UserRole.USER) -public class GwtSampleResourceTab extends GwtPage { - public String getTitle() { - return "Sample"; - } - - public String getGwtId() { - return "${package}.resourcetab.SampleResourceTab"; - } -} \ No newline at end of file diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/SampleResourceTab.gwt.xml b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/SampleResourceTab.gwt.xml deleted file mode 100644 index 079fb36bdaa..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/SampleResourceTab.gwt.xml +++ /dev/null @@ -1,13 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) - - - - - - - - - - diff --git a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/client/SampleResourceTab.java b/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/client/SampleResourceTab.java deleted file mode 100644 index c75748daed6..00000000000 --- a/archetypes/sonar-gwt-plugin/src/main/resources/archetype-resources/src/main/java/resourcetab/client/SampleResourceTab.java +++ /dev/null @@ -1,17 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.resourcetab.client; - -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.services.Resource; - -public class SampleResourceTab extends Page { - - @Override - protected Widget doOnResourceLoad(Resource resource) { - return new Label("This is a sample"); - } -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index bffcfc986bb..43fa0542cb4 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,6 @@ - archetypes/sonar-basic-plugin - archetypes/sonar-gwt-plugin sonar-application sonar-batch sonar-batch-bootstrapper @@ -120,7 +118,7 @@ - + org.codehaus.mojo @@ -132,12 +130,6 @@ maven-antrun-plugin 1.6 - - - org.apache.maven.plugins - maven-archetype-plugin - 2.0-alpha-4 - org.apache.maven.plugins maven-assembly-plugin @@ -1046,15 +1038,6 @@ - - all - - true - - - samples - - dev diff --git a/samples/README.txt b/samples/README.txt deleted file mode 100644 index 82c059c840a..00000000000 --- a/samples/README.txt +++ /dev/null @@ -1,15 +0,0 @@ -=== How to install a plugin - -1. Build plugin with Maven : mvn clean install -2. Copy the JAR file generated into target/ to the directory extensions/plugins/ of the Sonar server -3. Restart the Sonar server - - -=== How to activate Checkstyle extensions - -Install the plugin "checkstyle-extensions-plugin" then search for the rule "Methods count" in the administration console of Quality profiles. - - -=== How to activate PMD extensions - -Install the plugin "pmd-extensions-plugin" then search for the rules "MaximumMethodsCountCheck", "AvoidIfWithoutBrace" and "PreventUseOfEmptyClass" in the administration console of Quality profiles. \ No newline at end of file diff --git a/samples/assembly.xml b/samples/assembly.xml deleted file mode 100644 index 9508d3a84f2..00000000000 --- a/samples/assembly.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - distribution - - zip - - true - - - - standard-plugin - standard-plugin - - src/**/* - pom.xml - - - - gwt-plugin - gwt-plugin - - src/**/* - pom.xml - - - - checkstyle-extensions-plugin - checkstyle-extensions-plugin - - src/**/* - pom.xml - - - - pmd-extensions-plugin - pmd-extensions-plugin - - src/**/* - pom.xml - - - - ${project.basedir} - / - - *.txt - - - - diff --git a/samples/checkstyle-extensions-plugin/pom.xml b/samples/checkstyle-extensions-plugin/pom.xml deleted file mode 100644 index 74801b1c481..00000000000 --- a/samples/checkstyle-extensions-plugin/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - 4.0.0 - - com.mycompany.sonar - sonar-checkstyle-extensions-plugin - sonar-plugin - 0.1-SNAPSHOT - Sonar :: Samples :: Checkstyle extensions - Checkstyle extensions for Sonar - - - 2.8 - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonar.buildVersion} - provided - - - checkstyle - checkstyle - 5.1 - provided - - - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.1 - true - - com.mycompany.sonar.checkstyle.CheckstyleExtensionsPlugin - checkstyle - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.5 - 1.5 - - - - - - - - - sonarsource - SonarSource - http://repository.sonarsource.org/content/repositories/sonar - - true - - - false - - - - \ No newline at end of file diff --git a/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionRepository.java b/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionRepository.java deleted file mode 100644 index 51329595709..00000000000 --- a/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.mycompany.sonar.checkstyle; - -import org.apache.commons.io.IOUtils; -import org.sonar.api.resources.Java; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleRepository; -import org.sonar.api.rules.XMLRuleParser; - -import java.io.InputStream; -import java.util.List; - -public class CheckstyleExtensionRepository extends RuleRepository { - - // Must be the same than the Checkstyle plugin - private static final String REPOSITORY_KEY = "checkstyle"; - private XMLRuleParser ruleParser; - - public CheckstyleExtensionRepository(XMLRuleParser ruleParser) { - super(REPOSITORY_KEY, Java.KEY); - this.ruleParser = ruleParser; - } - - @Override - public List createRules() { - // In this example, new rules are declared in a XML file - InputStream input = getClass().getResourceAsStream("/com/mycompany/sonar/checkstyle/extensions.xml"); - try { - return ruleParser.parse(input); - - } finally { - IOUtils.closeQuietly(input); - } - } - -} diff --git a/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionsPlugin.java b/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionsPlugin.java deleted file mode 100644 index 44413883245..00000000000 --- a/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/CheckstyleExtensionsPlugin.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mycompany.sonar.checkstyle; - -import org.sonar.api.SonarPlugin; - -import java.util.Arrays; -import java.util.List; - -public class CheckstyleExtensionsPlugin extends SonarPlugin { - - public List getExtensions() { - return Arrays.asList(CheckstyleExtensionRepository.class); - } - -} diff --git a/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/MethodsCountCheck.java b/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/MethodsCountCheck.java deleted file mode 100644 index dcfa1244385..00000000000 --- a/samples/checkstyle-extensions-plugin/src/main/java/com/mycompany/sonar/checkstyle/MethodsCountCheck.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.mycompany.sonar.checkstyle; - -import com.puppycrawl.tools.checkstyle.api.Check; -import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.TokenTypes; - -public class MethodsCountCheck extends Check { - - private int minMethodsCount = 1; - - private int methodsCount = 0; - private DetailAST classAST = null; - - public void setMinMethodsCount(int minMethodsCount) { - this.minMethodsCount = minMethodsCount; - } - - public int[] getDefaultTokens() { - return new int[]{TokenTypes.CLASS_DEF, TokenTypes.METHOD_DEF}; - } - - public void beginTree(DetailAST rootAST) { - methodsCount = 0; - classAST = null; - } - - public void visitToken(DetailAST ast) { - //ensure this is an unit test. - if ( ast.getType() == TokenTypes.CLASS_DEF ) { - classAST = ast; - - } else if ( ast.getType() == TokenTypes.METHOD_DEF ) { - methodsCount++; - } - } - - public void finishTree(DetailAST rootAST) { - super.finishTree(rootAST); - if (classAST != null && methodsCount < minMethodsCount) { - log(classAST.getLineNo(), classAST.getColumnNo(), "Too few methods (" + methodsCount + ") in class" ); - } - } -} diff --git a/samples/checkstyle-extensions-plugin/src/main/resources/com/mycompany/sonar/checkstyle/extensions.xml b/samples/checkstyle-extensions-plugin/src/main/resources/com/mycompany/sonar/checkstyle/extensions.xml deleted file mode 100644 index c5d0a707071..00000000000 --- a/samples/checkstyle-extensions-plugin/src/main/resources/com/mycompany/sonar/checkstyle/extensions.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - com.mycompany.sonar.checkstyle.MethodsCountCheck - Methods Count - Checker/TreeWalker/com.mycompany.sonar.checkstyle.MethodsCountCheck - Count methods - - minMethodsCount - Mimimun threshold - 10 - - - \ No newline at end of file diff --git a/samples/gwt-plugin/pom.xml b/samples/gwt-plugin/pom.xml deleted file mode 100644 index 5882e577e84..00000000000 --- a/samples/gwt-plugin/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - 4.0.0 - - com.mycompany.sonar - sonar-gwt-plugin - sonar-plugin - 0.1-SNAPSHOT - Sonar :: Samples :: GWT plugin - Description of plugin with GWT extensions - - - 2.8 - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonar.buildVersion} - provided - - - org.codehaus.sonar - sonar-gwt-api - ${sonar.buildVersion} - provided - - - com.google.gwt - gwt-user - 2.0.3 - provided - - - com.google.gwt - gwt-incubator - 2.0.1 - provided - - - - - org.codehaus.sonar - sonar-testing-harness - ${sonar.buildVersion} - test - - - junit - junit - 4.8.2 - test - - - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.1 - true - - com.mycompany.sonar.gwt.GwtPlugin - - - - org.codehaus.mojo - gwt-maven-plugin - 1.2 - - - - - com.mycompany.sonar.gwt.viewer.SampleViewer - com.mycompany.sonar.gwt.page.SamplePage - - ${project.build.directory}/classes - -Xmx512m - - - compile - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - - diff --git a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/GwtPlugin.java b/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/GwtPlugin.java deleted file mode 100644 index 40d78ca7cfa..00000000000 --- a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/GwtPlugin.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.mycompany.sonar.gwt; - -import com.mycompany.sonar.gwt.page.SamplePage; -import com.mycompany.sonar.gwt.viewer.SampleViewer; -import org.sonar.api.SonarPlugin; - -import java.util.Arrays; -import java.util.List; - -public final class GwtPlugin extends SonarPlugin { - - public List getExtensions() { - return Arrays.asList(SampleViewer.class, SamplePage.class); - } - - public String toString() { - return getKey(); - } -} \ No newline at end of file diff --git a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/SamplePage.java b/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/SamplePage.java deleted file mode 100644 index dc2dd743502..00000000000 --- a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/SamplePage.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mycompany.sonar.gwt.page; - -import org.sonar.api.web.GwtPage; -import org.sonar.api.web.NavigationSection; -import org.sonar.api.web.UserRole; - -@NavigationSection(NavigationSection.RESOURCE) -@UserRole(UserRole.USER) -public class SamplePage extends GwtPage { - - public String getGwtId() { - return "com.mycompany.sonar.gwt.page.SamplePage"; - } - - public String getTitle() { - return "Sample"; - } -} diff --git a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/I18nConstants.java b/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/I18nConstants.java deleted file mode 100644 index 4dde01ebff5..00000000000 --- a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/I18nConstants.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.mycompany.sonar.gwt.page.client; - -import com.google.gwt.core.client.GWT; - -public interface I18nConstants extends com.google.gwt.i18n.client.Constants { - - static I18nConstants INSTANCE = GWT.create(I18nConstants.class); - - @DefaultStringValue("This is a sample") - String sample(); -} diff --git a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/SamplePagePanel.java b/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/SamplePagePanel.java deleted file mode 100644 index c0d16edbc19..00000000000 --- a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/page/client/SamplePagePanel.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.mycompany.sonar.gwt.page.client; - -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.services.Resource; - -public class SamplePagePanel extends Page { - - @Override - protected Widget doOnResourceLoad(Resource resource) { - VerticalPanel panel = new VerticalPanel(); - panel.add(new Label(resource.getName(true))); - panel.add(new Label(I18nConstants.INSTANCE.sample())); - return panel; - } -} diff --git a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/SampleViewer.java b/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/SampleViewer.java deleted file mode 100644 index 53ca2a45590..00000000000 --- a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/SampleViewer.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mycompany.sonar.gwt.viewer; - -import org.sonar.api.web.GwtPage; -import org.sonar.api.web.NavigationSection; -import org.sonar.api.web.UserRole; - -@NavigationSection(NavigationSection.RESOURCE_TAB) -@UserRole(UserRole.USER) -public class SampleViewer extends GwtPage { - public String getTitle() { - return "Sample"; - } - - public String getGwtId() { - return "com.mycompany.sonar.gwt.viewer.SampleViewer"; - } -} \ No newline at end of file diff --git a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/client/SampleViewerPanel.java b/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/client/SampleViewerPanel.java deleted file mode 100644 index 823dae78c7f..00000000000 --- a/samples/gwt-plugin/src/main/java/com/mycompany/sonar/gwt/viewer/client/SampleViewerPanel.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.mycompany.sonar.gwt.viewer.client; - -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.Widget; -import org.sonar.gwt.ui.Page; -import org.sonar.wsclient.gwt.AbstractCallback; -import org.sonar.wsclient.gwt.Sonar; -import org.sonar.wsclient.services.Measure; -import org.sonar.wsclient.services.Resource; -import org.sonar.wsclient.services.ResourceQuery; - -public class SampleViewerPanel extends Page { - - private Label label; - - @Override - protected Widget doOnResourceLoad(Resource resource) { - label = new Label("Loading value"); - loadMeasureFromServer(resource); - return label; - } - - // Ajax call to web service - private void loadMeasureFromServer(Resource resource) { - ResourceQuery query = ResourceQuery.createForResource(resource, "random"); - Sonar.getInstance().find(query, new AbstractCallback() { - @Override - protected void doOnResponse(Resource result) { - Measure measure = result.getMeasure("random"); - if (measure==null || measure.getValue()==null) { - label.setText("No random value"); - } else { - label.setText("Random value inserted during analysis: " + measure.getValue()); - } - } - }); - } -} \ No newline at end of file diff --git a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/SamplePage.gwt.xml b/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/SamplePage.gwt.xml deleted file mode 100644 index 8f95c2e2ca1..00000000000 --- a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/SamplePage.gwt.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/client/I18nConstants_fr.properties b/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/client/I18nConstants_fr.properties deleted file mode 100644 index aa92d17b38b..00000000000 --- a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/client/I18nConstants_fr.properties +++ /dev/null @@ -1,2 +0,0 @@ -# This file must use UTF-8 encoding -sample=Ceci est un exemple \ No newline at end of file diff --git a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/public/test.html b/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/public/test.html deleted file mode 100644 index 04371e3acb1..00000000000 --- a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/page/public/test.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - GWT Smaple - - - - - - - - - - - - - - -
-
- - - - \ No newline at end of file diff --git a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/viewer/SampleViewer.gwt.xml b/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/viewer/SampleViewer.gwt.xml deleted file mode 100644 index af900e8d883..00000000000 --- a/samples/gwt-plugin/src/main/resources/com/mycompany/sonar/gwt/viewer/SampleViewer.gwt.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/samples/pmd-extensions-plugin/pom.xml b/samples/pmd-extensions-plugin/pom.xml deleted file mode 100644 index c773e7dfd92..00000000000 --- a/samples/pmd-extensions-plugin/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - com.mycompany.sonar - sonar-pmd-extensions-plugin - sonar-plugin - 0.1-SNAPSHOT - Sonar :: Samples :: PMD extensions - PMD extensions for Sonar - - - 2.8 - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonar.buildVersion} - provided - - - pmd - pmd - 4.2.5 - provided - - - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.1 - true - - com.mycompany.sonar.pmd.PmdExtensionsPlugin - - - pmd - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.5 - 1.5 - - - - - \ No newline at end of file diff --git a/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/MaximumMethodsCountCheck.java b/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/MaximumMethodsCountCheck.java deleted file mode 100644 index 90e9b1cc041..00000000000 --- a/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/MaximumMethodsCountCheck.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.mycompany.sonar.pmd; - -import java.util.ArrayList; -import java.util.List; -import net.sourceforge.pmd.AbstractRule; -import net.sourceforge.pmd.ast.ASTClassOrInterfaceBody; -import net.sourceforge.pmd.ast.ASTMethodDeclaration; -import net.sourceforge.pmd.properties.IntegerProperty; - -public class MaximumMethodsCountCheck extends AbstractRule { - - private static final IntegerProperty propertyDescriptor = new IntegerProperty( - "maxAuthorisedMethodsCount", "Maximum number of methods authorised", 2, 1.0f); - - public Object visit(ASTClassOrInterfaceBody node, Object data) { - List methods = new ArrayList(); - methods = (List)node.findChildrenOfType(ASTMethodDeclaration.class); - - if (methods.size() > getIntProperty(propertyDescriptor)) { - addViolation(data, node); - } - return super.visit(node,data); - } - -} diff --git a/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionRepository.java b/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionRepository.java deleted file mode 100644 index 2ad40acd593..00000000000 --- a/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.mycompany.sonar.pmd; - -import org.apache.commons.io.IOUtils; -import org.sonar.api.resources.Java; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleRepository; -import org.sonar.api.rules.XMLRuleParser; - -import java.io.InputStream; -import java.util.List; - -public class PmdExtensionRepository extends RuleRepository { - - // Must be the same than the PMD plugin - private static final String REPOSITORY_KEY = "pmd"; - private XMLRuleParser ruleParser; - - public PmdExtensionRepository(XMLRuleParser ruleParser) { - super(REPOSITORY_KEY, Java.KEY); - this.ruleParser = ruleParser; - } - - @Override - public List createRules() { - // In this example, new rules are declared in a XML file - InputStream input = getClass().getResourceAsStream("/com/mycompany/sonar/pmd/extensions.xml"); - try { - return ruleParser.parse(input); - - } finally { - IOUtils.closeQuietly(input); - } - } - -} diff --git a/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionsPlugin.java b/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionsPlugin.java deleted file mode 100644 index 646cd12255a..00000000000 --- a/samples/pmd-extensions-plugin/src/main/java/com/mycompany/sonar/pmd/PmdExtensionsPlugin.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.mycompany.sonar.pmd; - -import org.sonar.api.SonarPlugin; - -import java.util.Arrays; -import java.util.List; - -public class PmdExtensionsPlugin extends SonarPlugin { - - public List getExtensions() { - return Arrays.asList(PmdExtensionRepository.class); - } - -} diff --git a/samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/extensions.xml b/samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/extensions.xml deleted file mode 100644 index 808974b038d..00000000000 --- a/samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/extensions.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - MaximumMethodsCountCheck - Maximum Methods Count Check - Maximum number of methods authorised - - - com/mycompany/sonar/pmd/rulesets.xml/MaximumMethodsCountCheck - - - - - - - - maxAuthorisedMethodsCount - Maximum number of methods authorised - - - 2 - - - - - - - AvoidIfWithoutBrace - Avoid if without using brace - com/mycompany/sonar/pmd/rulesets.xml/AvoidIfWithoutBrace - CRITICAL - - - - - - PreventUseOfEmptyClass - MAJOR - - - MINOR - - xpath - - //VariableDeclarator[../Type/ReferenceType/ClassOrInterfaceType[@Image='EmptyClass']] - - - message - - Prevent use of EmptyClass class - - - \ No newline at end of file diff --git a/samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/rulesets.xml b/samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/rulesets.xml deleted file mode 100644 index 6922cd62da2..00000000000 --- a/samples/pmd-extensions-plugin/src/main/resources/com/mycompany/sonar/pmd/rulesets.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - Avoid too many methods - - 3 - - - - - - - - - - - Avoid if without using brace - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/pom.xml b/samples/pom.xml deleted file mode 100644 index 34fb225ace1..00000000000 --- a/samples/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - org.codehaus.sonar - sonar - 2.12-SNAPSHOT - .. - - org.codehaus.sonar.samples - sonar-samples - pom - Sonar :: Samples - - - standard-plugin - gwt-plugin - checkstyle-extensions-plugin - pmd-extensions-plugin - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - maven-assembly-plugin - - - package - - single - - - false - sonar-samples-${project.version} - - assembly.xml - - - - - - - - diff --git a/samples/standard-plugin/pom.xml b/samples/standard-plugin/pom.xml deleted file mode 100644 index 65cf9311728..00000000000 --- a/samples/standard-plugin/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - 4.0.0 - - com.mycompany.sonar - sonar-standard-plugin - sonar-plugin - 0.1-SNAPSHOT - Sonar :: Samples :: Standard plugin - Description of standard plugin - - - 2.8 - - - - - org.codehaus.sonar - sonar-plugin-api - ${sonar.buildVersion} - provided - - - - - org.codehaus.sonar - sonar-testing-harness - ${sonar.buildVersion} - test - - - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.1 - true - - com.mycompany.sonar.standard.SamplePlugin - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - - diff --git a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SampleMetrics.java b/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SampleMetrics.java deleted file mode 100644 index 6d493bcee5e..00000000000 --- a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SampleMetrics.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.mycompany.sonar.standard; - -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.measures.Metric; -import org.sonar.api.measures.Metrics; - -import java.util.Arrays; -import java.util.List; - -public final class SampleMetrics implements Metrics { - - public static final Metric MESSAGE = new Metric.Builder("message_key", "Message", Metric.ValueType.STRING) - .setDescription("This is a metric to store a well known message") - .setDirection(Metric.DIRECTION_WORST) - .setQualitative(false) - .setDomain(CoreMetrics.DOMAIN_GENERAL) - .create(); - - public static final Metric RANDOM = new Metric.Builder("random", "Random", Metric.ValueType.FLOAT) - .setDescription("Random value") - .setDirection(Metric.DIRECTION_BETTER) - .setQualitative(false) - .setDomain(CoreMetrics.DOMAIN_GENERAL) - .create(); - - // getMetrics() method is defined in the Metrics interface and is used by - // Sonar to retrieve the list of new Metric - public List getMetrics() { - return Arrays.asList(MESSAGE, RANDOM); - } -} diff --git a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SamplePlugin.java b/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SamplePlugin.java deleted file mode 100644 index 7622e032bd0..00000000000 --- a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/SamplePlugin.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.mycompany.sonar.standard; - -import com.mycompany.sonar.standard.batch.RandomDecorator; -import com.mycompany.sonar.standard.batch.SampleSensor; -import com.mycompany.sonar.standard.ui.SampleFooter; -import com.mycompany.sonar.standard.ui.SampleRubyWidget; -import org.sonar.api.SonarPlugin; - -import java.util.Arrays; -import java.util.List; - -/** - * This class is the entry point for all extensions - */ -public final class SamplePlugin extends SonarPlugin { - - // This is where you're going to declare all your Sonar extensions - public List getExtensions() { - return Arrays.asList( - // Definitions - SampleMetrics.class, - - // Batch - SampleSensor.class, RandomDecorator.class, - - // UI - SampleFooter.class, SampleRubyWidget.class); - } -} \ No newline at end of file diff --git a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/RandomDecorator.java b/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/RandomDecorator.java deleted file mode 100644 index de2b7026bb6..00000000000 --- a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/RandomDecorator.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.mycompany.sonar.standard.batch; - -import com.mycompany.sonar.standard.SampleMetrics; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.RandomUtils; -import org.sonar.api.batch.Decorator; -import org.sonar.api.batch.DecoratorContext; -import org.sonar.api.measures.MeasureUtils; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.Resource; -import org.sonar.api.resources.Scopes; - -public class RandomDecorator implements Decorator { - - public boolean shouldExecuteOnProject(Project project) { - // Execute only on Java projects - return StringUtils.equals(project.getLanguageKey(), Java.KEY); - } - - public void decorate(Resource resource, DecoratorContext context) { - // This method is executed on the whole tree of resources. - // Bottom-up navigation : Java methods -> Java classes -> files -> packages -> modules -> project - if (Scopes.isBlockUnit(resource)) { - // Sonar API includes many libraries like commons-lang and google-collections - double value = RandomUtils.nextDouble(); - - // Add a measure to the current Java method - context.saveMeasure(SampleMetrics.RANDOM, value); - - } else { - // we sum random values on resources different than method - context.saveMeasure(SampleMetrics.RANDOM, MeasureUtils.sum(true, context.getChildrenMeasures(SampleMetrics.RANDOM))); - } - } -} diff --git a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/SampleSensor.java b/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/SampleSensor.java deleted file mode 100644 index eade5e73ad7..00000000000 --- a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/batch/SampleSensor.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.mycompany.sonar.standard.batch; - -import com.mycompany.sonar.standard.SampleMetrics; -import org.sonar.api.batch.Sensor; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Project; - -public class SampleSensor implements Sensor { - - public boolean shouldExecuteOnProject(Project project) { - // This sensor is executed on any type of projects - return true; - } - - public void analyse(Project project, SensorContext sensorContext) { - Measure measure = new Measure(SampleMetrics.MESSAGE, "Hello World!"); - sensorContext.saveMeasure(measure); - } -} diff --git a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleFooter.java b/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleFooter.java deleted file mode 100644 index 6ed59896e9b..00000000000 --- a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleFooter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.mycompany.sonar.standard.ui; - -import org.sonar.api.web.Footer; - -public final class SampleFooter implements Footer { - public String getHtml() { - return "

Sample footer - This is static HTML

"; - } -} diff --git a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleRubyWidget.java b/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleRubyWidget.java deleted file mode 100644 index a6e723bf3ed..00000000000 --- a/samples/standard-plugin/src/main/java/com/mycompany/sonar/standard/ui/SampleRubyWidget.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.mycompany.sonar.standard.ui; - -import org.sonar.api.web.*; - -@UserRole(UserRole.USER) -@Description("Show how to use Ruby Widget API") -@WidgetCategory("Sample") -@WidgetProperties({ - @WidgetProperty(key="param1", - description="This is a mandatory parameter", - optional=false - ), - @WidgetProperty(key="max", - description="max threshold", - type=WidgetPropertyType.INTEGER, - defaultValue="80" - ), - @WidgetProperty(key="param2", - description="This is an optional parameter" - ), - @WidgetProperty(key="floatprop", - description="test description" - ) -}) -public class SampleRubyWidget extends AbstractRubyTemplate implements RubyRailsWidget { - - public String getId() { - return "sample"; - } - - public String getTitle() { - return "Sample"; - } - - @Override - protected String getTemplatePath() { - return "/sample_ruby_widget.html.erb"; - } -} \ No newline at end of file diff --git a/samples/standard-plugin/src/main/resources/sample_ruby_widget.html.erb b/samples/standard-plugin/src/main/resources/sample_ruby_widget.html.erb deleted file mode 100644 index c2602c49646..00000000000 --- a/samples/standard-plugin/src/main/resources/sample_ruby_widget.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -
-

-

- - <%= format_measure('random') -%> <%= trend_icon(measure('random')) %> - -

-

<%= format_measure('message') -%>

-

- <%= format_measure('ncloc', :suffix => ' lines', :url => url_for_drilldown('ncloc')) -%> -

-
-
-

Help

-

- Read configuration : <%= configuration('sonar.jdbc.username') -%> -

- -

- Sample of Jfree Eastwood chart :
- <%= gchart('cht=bhs&chco=FF0000,00FF00,0000FF&chs=200x125&chd=s:FOE,THE,Bar&chxt=x,y&chxl=1:|Dec|Nov|Oct|0:||20K||60K||100K|') -%> -

-

- Widget properties: - - - - - - - - - - - - - -
max:<%= widget_properties['max'] -%>
param1:<%= widget_properties['param1'] -%>
param2:<%= widget_properties['param2'] -%>
-

-
-- 2.39.5