diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-04 10:42:21 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-02-04 10:42:21 +0100 |
commit | a14a0644c2a27ddec22f23925578a40aa6fa8302 (patch) | |
tree | aa5c078cc8ec7c4e2020960ad9a343fb7e79a16c /sonar-server/src/main/java | |
parent | 0f44a42b85093a3dcef64b52f6e15337b119ec88 (diff) | |
download | sonarqube-a14a0644c2a27ddec22f23925578a40aa6fa8302.tar.gz sonarqube-a14a0644c2a27ddec22f23925578a40aa6fa8302.zip |
Upgrade copyright headers
Diffstat (limited to 'sonar-server/src/main/java')
81 files changed, 1142 insertions, 1142 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java b/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java index bb24effd0d0..bf515efe8b7 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/ChartFactory.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java b/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java index 047c89b7fd4..f54967ee5a7 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/ChartsServlet.java @@ -1,159 +1,159 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.charts;
-
-import org.apache.commons.io.IOUtils;
-import org.jfree.chart.encoders.KeypointPNGEncoderAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonar.api.charts.Chart;
-import org.sonar.api.charts.ChartParameters;
-import org.sonar.server.charts.deprecated.*;
-import org.sonar.server.platform.Platform;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ChartsServlet extends HttpServlet {
-
- private static final Logger LOG = LoggerFactory.getLogger(ChartsServlet.class);
-
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- if (isDeprecatedChart(request)) {
- deprecatedDoGet(request, response);
-
- } else {
- ChartFactory chartFactory = Platform.getInstance().getContainer().getComponent(ChartFactory.class);
- Chart chart = chartFactory.getChart(request.getParameter("ck"));
- if (chart != null) {
- BufferedImage image = chart.generateImage(getParams(request));
- OutputStream out = response.getOutputStream();
- try {
- response.setContentType("image/png");
- exportAsPNG(image, out);
-
- } catch (Exception e) {
- LOG.error("Generating chart " + chart.getClass().getName(), e);
-
- } finally {
- out.close();
- }
- }
- }
- }
-
- private ChartParameters getParams(HttpServletRequest request) {
- Map<String, String> map = new HashMap<String, String>();
- Enumeration keys = request.getParameterNames();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- String value = request.getParameter(key);
- map.put(key, value);
- }
- return new ChartParameters(map);
- }
-
- private void exportAsPNG(BufferedImage image, OutputStream out) throws IOException {
- KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter();
- encoder.setEncodingAlpha(true);
- encoder.encode(image, out);
- }
-
- public boolean isDeprecatedChart(HttpServletRequest request) {
- String chartType = request.getParameter(BaseChartWeb.CHART_PARAM_TYPE);
- if (BaseChartWeb.BAR_CHART_HORIZONTAL.equals(chartType) || BaseChartWeb.BAR_CHART_VERTICAL.equals(chartType) || BaseChartWeb.STACKED_BAR_CHART.equals(chartType)) {
- return true;
- }
- if (BaseChartWeb.BAR_CHART_VERTICAL_CUSTOM.equals(chartType)) {
- return true;
- }
- if (BaseChartWeb.PIE_CHART.equals(chartType)) {
- return true;
- }
- if (BaseChartWeb.SPARKLINES_CHART.equals(chartType)) {
- return true;
- }
- return false;
- }
-
- public void deprecatedDoGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- Map<String, String> params = new HashMap<String, String>();
- params.put(BaseChartWeb.CHART_PARAM_TYPE, request.getParameter(BaseChartWeb.CHART_PARAM_TYPE));
- params.put(BaseChartWeb.CHART_PARAM_VALUES, request.getParameter(BaseChartWeb.CHART_PARAM_VALUES));
- params.put(BaseChartWeb.CHART_PARAM_COLORS, request.getParameter(BaseChartWeb.CHART_PARAM_COLORS));
- params.put(BaseChartWeb.CHART_PARAM_RANGEMAX, request.getParameter(BaseChartWeb.CHART_PARAM_RANGEMAX));
- params.put(BaseChartWeb.CHART_PARAM_TITLE, request.getParameter(BaseChartWeb.CHART_PARAM_TITLE));
- params.put(BaseChartWeb.CHART_PARAM_DIMENSIONS, request.getParameter(BaseChartWeb.CHART_PARAM_DIMENSIONS));
- params.put(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_VISIBLE));
- params.put(BaseChartWeb.CHART_PARAM_RANGEAXIS_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_RANGEAXIS_VISIBLE));
- params.put(BaseChartWeb.CHART_PARAM_SERIES, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES));
- params.put(BaseChartWeb.CHART_PARAM_CATEGORIES, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES));
- params.put(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_LOWER, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_LOWER));
- params.put(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_UPPER, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_UPPER));
- params.put(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_LOWER, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_LOWER));
- params.put(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_UPPER, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_UPPER));
- params.put(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_TICKUNIT, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_TICKUNIT));
- params.put(BaseChartWeb.CHART_PARAM_INSETS, request.getParameter(BaseChartWeb.CHART_PARAM_INSETS));
- params.put(BaseChartWeb.CHART_PARAM_OUTLINE_RANGEGRIDLINES_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_OUTLINE_RANGEGRIDLINES_VISIBLE));
- params.put(BaseChartWeb.CHART_PARAM_OUTLINE_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_OUTLINE_VISIBLE));
-
- String chartType = params.get(BaseChartWeb.CHART_PARAM_TYPE);
-
- DeprecatedChart chart = null;
-
- if (BaseChartWeb.BAR_CHART_HORIZONTAL.equals(chartType) || BaseChartWeb.BAR_CHART_VERTICAL.equals(chartType) || BaseChartWeb.STACKED_BAR_CHART.equals(chartType)) {
- chart = new BarChart(params);
- } else if (BaseChartWeb.BAR_CHART_VERTICAL_CUSTOM.equals(chartType)) {
- chart = new CustomBarChart(params);
- } else if (BaseChartWeb.PIE_CHART.equals(chartType)) {
- chart = new PieChart(params);
- } else if (BaseChartWeb.SPARKLINES_CHART.equals(chartType)) {
- chart = new SparkLinesChart(params);
- }
-
- OutputStream out = null;
- try {
- if (chart != null) {
- out = response.getOutputStream();
- response.setContentType("image/png");
- chart.exportChartAsPNG(out);
- }
-
- } catch (Exception e) {
- LOG.error("Generating chart " + chart.getClass().getName(), e);
-
- } finally {
- IOUtils.closeQuietly(out);
- }
- }
-
-}
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.charts; + +import org.apache.commons.io.IOUtils; +import org.jfree.chart.encoders.KeypointPNGEncoderAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sonar.api.charts.Chart; +import org.sonar.api.charts.ChartParameters; +import org.sonar.server.charts.deprecated.*; +import org.sonar.server.platform.Platform; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + +public class ChartsServlet extends HttpServlet { + + private static final Logger LOG = LoggerFactory.getLogger(ChartsServlet.class); + + @Override + public void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + if (isDeprecatedChart(request)) { + deprecatedDoGet(request, response); + + } else { + ChartFactory chartFactory = Platform.getInstance().getContainer().getComponent(ChartFactory.class); + Chart chart = chartFactory.getChart(request.getParameter("ck")); + if (chart != null) { + BufferedImage image = chart.generateImage(getParams(request)); + OutputStream out = response.getOutputStream(); + try { + response.setContentType("image/png"); + exportAsPNG(image, out); + + } catch (Exception e) { + LOG.error("Generating chart " + chart.getClass().getName(), e); + + } finally { + out.close(); + } + } + } + } + + private ChartParameters getParams(HttpServletRequest request) { + Map<String, String> map = new HashMap<String, String>(); + Enumeration keys = request.getParameterNames(); + while (keys.hasMoreElements()) { + String key = (String) keys.nextElement(); + String value = request.getParameter(key); + map.put(key, value); + } + return new ChartParameters(map); + } + + private void exportAsPNG(BufferedImage image, OutputStream out) throws IOException { + KeypointPNGEncoderAdapter encoder = new KeypointPNGEncoderAdapter(); + encoder.setEncodingAlpha(true); + encoder.encode(image, out); + } + + public boolean isDeprecatedChart(HttpServletRequest request) { + String chartType = request.getParameter(BaseChartWeb.CHART_PARAM_TYPE); + if (BaseChartWeb.BAR_CHART_HORIZONTAL.equals(chartType) || BaseChartWeb.BAR_CHART_VERTICAL.equals(chartType) || BaseChartWeb.STACKED_BAR_CHART.equals(chartType)) { + return true; + } + if (BaseChartWeb.BAR_CHART_VERTICAL_CUSTOM.equals(chartType)) { + return true; + } + if (BaseChartWeb.PIE_CHART.equals(chartType)) { + return true; + } + if (BaseChartWeb.SPARKLINES_CHART.equals(chartType)) { + return true; + } + return false; + } + + public void deprecatedDoGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + Map<String, String> params = new HashMap<String, String>(); + params.put(BaseChartWeb.CHART_PARAM_TYPE, request.getParameter(BaseChartWeb.CHART_PARAM_TYPE)); + params.put(BaseChartWeb.CHART_PARAM_VALUES, request.getParameter(BaseChartWeb.CHART_PARAM_VALUES)); + params.put(BaseChartWeb.CHART_PARAM_COLORS, request.getParameter(BaseChartWeb.CHART_PARAM_COLORS)); + params.put(BaseChartWeb.CHART_PARAM_RANGEMAX, request.getParameter(BaseChartWeb.CHART_PARAM_RANGEMAX)); + params.put(BaseChartWeb.CHART_PARAM_TITLE, request.getParameter(BaseChartWeb.CHART_PARAM_TITLE)); + params.put(BaseChartWeb.CHART_PARAM_DIMENSIONS, request.getParameter(BaseChartWeb.CHART_PARAM_DIMENSIONS)); + params.put(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_VISIBLE)); + params.put(BaseChartWeb.CHART_PARAM_RANGEAXIS_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_RANGEAXIS_VISIBLE)); + params.put(BaseChartWeb.CHART_PARAM_SERIES, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES)); + params.put(BaseChartWeb.CHART_PARAM_CATEGORIES, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES)); + params.put(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_LOWER, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_LOWER)); + params.put(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_UPPER, request.getParameter(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_UPPER)); + params.put(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_LOWER, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_LOWER)); + params.put(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_UPPER, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_UPPER)); + params.put(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_TICKUNIT, request.getParameter(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_TICKUNIT)); + params.put(BaseChartWeb.CHART_PARAM_INSETS, request.getParameter(BaseChartWeb.CHART_PARAM_INSETS)); + params.put(BaseChartWeb.CHART_PARAM_OUTLINE_RANGEGRIDLINES_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_OUTLINE_RANGEGRIDLINES_VISIBLE)); + params.put(BaseChartWeb.CHART_PARAM_OUTLINE_VISIBLE, request.getParameter(BaseChartWeb.CHART_PARAM_OUTLINE_VISIBLE)); + + String chartType = params.get(BaseChartWeb.CHART_PARAM_TYPE); + + DeprecatedChart chart = null; + + if (BaseChartWeb.BAR_CHART_HORIZONTAL.equals(chartType) || BaseChartWeb.BAR_CHART_VERTICAL.equals(chartType) || BaseChartWeb.STACKED_BAR_CHART.equals(chartType)) { + chart = new BarChart(params); + } else if (BaseChartWeb.BAR_CHART_VERTICAL_CUSTOM.equals(chartType)) { + chart = new CustomBarChart(params); + } else if (BaseChartWeb.PIE_CHART.equals(chartType)) { + chart = new PieChart(params); + } else if (BaseChartWeb.SPARKLINES_CHART.equals(chartType)) { + chart = new SparkLinesChart(params); + } + + OutputStream out = null; + try { + if (chart != null) { + out = response.getOutputStream(); + response.setContentType("image/png"); + chart.exportChartAsPNG(out); + } + + } catch (Exception e) { + LOG.error("Generating chart " + chart.getClass().getName(), e); + + } finally { + IOUtils.closeQuietly(out); + } + } + +} diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java index 6ccbf1af2dc..d3194d5d873 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BarChart.java @@ -1,209 +1,209 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.charts.deprecated;
-
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.NumberTickUnit;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.BarRenderer;
-import org.jfree.chart.renderer.category.StackedBarRenderer;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.ui.RectangleInsets;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-public class BarChart extends BaseChartWeb implements DeprecatedChart {
-
- private BarRenderer renderer = null;
- protected DefaultCategoryDataset dataset = null;
- protected CategoryAxis categoryAxis = null;
- protected NumberAxis numberAxis = null;
-
- public BarChart(Map<String, String> params) {
- super(params);
- jfreechart = new JFreeChart(null, TextTitle.DEFAULT_FONT, new CategoryPlot(), false);
- }
-
- @Override
- protected BufferedImage getChartImage() throws IOException {
- configure();
- return getBufferedImage(jfreechart);
- }
-
- protected void configure() {
- configureChart(jfreechart, false);
- configureCategoryDataset();
- configureCategoryAxis();
- configureRenderer();
- configureRangeAxis();
- configureCategoryPlot();
- applyParams();
- }
-
- protected void configureCategoryPlot() {
- CategoryPlot plot = jfreechart.getCategoryPlot();
- plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA);
- plot.setInsets(RectangleInsets.ZERO_INSETS); // To remove inner space around chart
- plot.setDataset(dataset);
- plot.setDomainAxis(categoryAxis);
- plot.setRenderer(renderer);
- plot.setRangeAxis(numberAxis);
- }
-
- protected void configureCategoryDataset() {
- dataset = new DefaultCategoryDataset();
- }
-
- protected void configureCategoryAxis() {
- categoryAxis = new CategoryAxis();
- categoryAxis.setLabelFont(DEFAULT_FONT);
- categoryAxis.setLabelPaint(BASE_COLOR);
- categoryAxis.setTickLabelFont(DEFAULT_FONT);
- categoryAxis.setTickLabelPaint(BASE_COLOR);
- categoryAxis.setVisible(false);
- }
-
- protected void configureRenderer() {
- if (params.get(BaseChartWeb.CHART_PARAM_TYPE).equals(BaseChartWeb.STACKED_BAR_CHART)) {
- renderer = new StackedBarRenderer();
- } else {
- renderer = new BarRenderer();
- }
- renderer.setItemMargin(0.0);
- renderer.setDrawBarOutline(false);
- }
-
- protected void configureRangeAxis() {
- numberAxis = new NumberAxis();
- numberAxis.setLabelFont(DEFAULT_FONT);
- numberAxis.setLabelPaint(BASE_COLOR);
- numberAxis.setTickLabelFont(DEFAULT_FONT);
- numberAxis.setTickLabelPaint(BASE_COLOR);
- numberAxis.setTickMarksVisible(true);
- numberAxis.setVisible(false);
- numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
- }
-
- protected void applyCommomParamsBar() {
- // -- Plot
- CategoryPlot plot = jfreechart.getCategoryPlot();
- plot.setOrientation(BaseChartWeb.BAR_CHART_VERTICAL.equals(params.get(BaseChartWeb.CHART_PARAM_TYPE)) || BaseChartWeb.BAR_CHART_VERTICAL_CUSTOM.equals(params.get(BaseChartWeb.CHART_PARAM_TYPE)) ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL);
- plot.setOutlineVisible("y".equals(params.get(BaseChartWeb.CHART_PARAM_OUTLINE_VISIBLE)));
- plot.setRangeGridlinesVisible("y".equals(params.get(BaseChartWeb.CHART_PARAM_OUTLINE_RANGEGRIDLINES_VISIBLE)));
- String insetsParam = params.get(CHART_PARAM_INSETS);
- if (isParamValueValid(insetsParam)) {
- double insets = convertParamToDouble(insetsParam);
- RectangleInsets rectangleInsets = new RectangleInsets(insets, insets, insets, insets);
- plot.setInsets(rectangleInsets);
- }
-
- // -- Category Axis
- boolean categoryAxisIsVisible = "y".equals(params.get(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_VISIBLE));
- double categoryAxisUpperMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_UPPER), DEFAULT_CATEGORIES_AXISMARGIN);
- double categoryAxisLowerMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_LOWER), DEFAULT_CATEGORIES_AXISMARGIN);
- categoryAxis.setVisible(categoryAxisIsVisible);
- categoryAxis.setTickLabelsVisible(categoryAxisIsVisible);
- categoryAxis.setLowerMargin(categoryAxisLowerMargin);
- categoryAxis.setUpperMargin(categoryAxisUpperMargin);
-
- // -- Range Axis
- boolean rangeAxisIsVisible = "y".equals(params.get(BaseChartWeb.CHART_PARAM_RANGEAXIS_VISIBLE));
- double rangeAxisUpperMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_UPPER), DEFAULT_SERIES_AXISMARGIN);
- double rangeAxisLowerMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_LOWER), DEFAULT_SERIES_AXISMARGIN);
- numberAxis.setTickLabelsVisible(rangeAxisIsVisible);
- numberAxis.setVisible(rangeAxisIsVisible);
- numberAxis.setLowerMargin(rangeAxisLowerMargin);
- numberAxis.setUpperMargin(rangeAxisUpperMargin);
- String rangeMax = params.get(BaseChartWeb.CHART_PARAM_RANGEMAX);
- if (isParamValueValid(rangeMax)) {
- double iRangeMax = Double.parseDouble(rangeMax);
- numberAxis.setRange(0.0, iRangeMax);
- }
- String tickUnit = params.get(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_TICKUNIT);
- if (isParamValueValid(tickUnit)) {
- numberAxis.setTickUnit(new NumberTickUnit(convertParamToDouble(tickUnit)));
- }
- }
-
- private void applyParams() {
- applyCommonParams();
- applyCommomParamsBar();
-
- configureColors(params.get(BaseChartWeb.CHART_PARAM_COLORS), renderer);
- addMeasures(params.get(BaseChartWeb.CHART_PARAM_VALUES));
- }
-
- private void addMeasures(String values) {
- if (values != null && values.length() > 0) {
- // Values
- StringTokenizer stValues = new StringTokenizer(values, ",");
- int nbValues = stValues.countTokens();
-
- // Categories
- String categoriesParam = params.get(BaseChartWeb.CHART_PARAM_CATEGORIES);
- boolean categoriesPresent = categoriesParam != null && categoriesParam.length() > 0;
- String[] categoriesSplit = null;
- if (categoriesPresent) {
- categoriesSplit = categoriesParam.split(",");
- } else {
- categoriesSplit = new String[1];
- categoriesSplit[0] = BaseChartWeb.DEFAULT_NAME_CATEGORY;
- }
- int nbCategories = categoriesSplit.length;
-
- // Series
- String seriesParam = params.get(BaseChartWeb.CHART_PARAM_SERIES);
- boolean seriesPresent = seriesParam != null && seriesParam.length() > 0;
- String[] seriesSplit = null;
- if (seriesPresent) {
- seriesSplit = seriesParam.split(",");
- } else {
- seriesSplit = new String[nbValues];
- for (int i = 0; i < nbValues; i++) {
- seriesSplit[i] = BaseChartWeb.DEFAULT_NAME_SERIE + i;
- }
- }
- int nbSeries = seriesSplit.length;
-
- for (int iCategories = 0; iCategories < nbCategories; iCategories++) {
- String currentCategory = categoriesSplit[iCategories];
- for (int iSeries = 0; iSeries < nbSeries; iSeries++) {
- String currentSerie = seriesSplit[iSeries];
- double currentValue = 0.0;
- if (stValues.hasMoreTokens()) {
- try {
- currentValue = Double.parseDouble(stValues.nextToken());
- } catch (NumberFormatException e) {
- }
- }
- dataset.addValue(currentValue, currentSerie, currentCategory);
- }
- }
- }
- }
-
-}
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.charts.deprecated; + +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.CategoryAxis; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.axis.NumberTickUnit; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.renderer.category.BarRenderer; +import org.jfree.chart.renderer.category.StackedBarRenderer; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.ui.RectangleInsets; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Map; +import java.util.StringTokenizer; + +public class BarChart extends BaseChartWeb implements DeprecatedChart { + + private BarRenderer renderer = null; + protected DefaultCategoryDataset dataset = null; + protected CategoryAxis categoryAxis = null; + protected NumberAxis numberAxis = null; + + public BarChart(Map<String, String> params) { + super(params); + jfreechart = new JFreeChart(null, TextTitle.DEFAULT_FONT, new CategoryPlot(), false); + } + + @Override + protected BufferedImage getChartImage() throws IOException { + configure(); + return getBufferedImage(jfreechart); + } + + protected void configure() { + configureChart(jfreechart, false); + configureCategoryDataset(); + configureCategoryAxis(); + configureRenderer(); + configureRangeAxis(); + configureCategoryPlot(); + applyParams(); + } + + protected void configureCategoryPlot() { + CategoryPlot plot = jfreechart.getCategoryPlot(); + plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); + plot.setInsets(RectangleInsets.ZERO_INSETS); // To remove inner space around chart + plot.setDataset(dataset); + plot.setDomainAxis(categoryAxis); + plot.setRenderer(renderer); + plot.setRangeAxis(numberAxis); + } + + protected void configureCategoryDataset() { + dataset = new DefaultCategoryDataset(); + } + + protected void configureCategoryAxis() { + categoryAxis = new CategoryAxis(); + categoryAxis.setLabelFont(DEFAULT_FONT); + categoryAxis.setLabelPaint(BASE_COLOR); + categoryAxis.setTickLabelFont(DEFAULT_FONT); + categoryAxis.setTickLabelPaint(BASE_COLOR); + categoryAxis.setVisible(false); + } + + protected void configureRenderer() { + if (params.get(BaseChartWeb.CHART_PARAM_TYPE).equals(BaseChartWeb.STACKED_BAR_CHART)) { + renderer = new StackedBarRenderer(); + } else { + renderer = new BarRenderer(); + } + renderer.setItemMargin(0.0); + renderer.setDrawBarOutline(false); + } + + protected void configureRangeAxis() { + numberAxis = new NumberAxis(); + numberAxis.setLabelFont(DEFAULT_FONT); + numberAxis.setLabelPaint(BASE_COLOR); + numberAxis.setTickLabelFont(DEFAULT_FONT); + numberAxis.setTickLabelPaint(BASE_COLOR); + numberAxis.setTickMarksVisible(true); + numberAxis.setVisible(false); + numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); + } + + protected void applyCommomParamsBar() { + // -- Plot + CategoryPlot plot = jfreechart.getCategoryPlot(); + plot.setOrientation(BaseChartWeb.BAR_CHART_VERTICAL.equals(params.get(BaseChartWeb.CHART_PARAM_TYPE)) || BaseChartWeb.BAR_CHART_VERTICAL_CUSTOM.equals(params.get(BaseChartWeb.CHART_PARAM_TYPE)) ? PlotOrientation.VERTICAL : PlotOrientation.HORIZONTAL); + plot.setOutlineVisible("y".equals(params.get(BaseChartWeb.CHART_PARAM_OUTLINE_VISIBLE))); + plot.setRangeGridlinesVisible("y".equals(params.get(BaseChartWeb.CHART_PARAM_OUTLINE_RANGEGRIDLINES_VISIBLE))); + String insetsParam = params.get(CHART_PARAM_INSETS); + if (isParamValueValid(insetsParam)) { + double insets = convertParamToDouble(insetsParam); + RectangleInsets rectangleInsets = new RectangleInsets(insets, insets, insets, insets); + plot.setInsets(rectangleInsets); + } + + // -- Category Axis + boolean categoryAxisIsVisible = "y".equals(params.get(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_VISIBLE)); + double categoryAxisUpperMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_UPPER), DEFAULT_CATEGORIES_AXISMARGIN); + double categoryAxisLowerMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_CATEGORIES_AXISMARGIN_LOWER), DEFAULT_CATEGORIES_AXISMARGIN); + categoryAxis.setVisible(categoryAxisIsVisible); + categoryAxis.setTickLabelsVisible(categoryAxisIsVisible); + categoryAxis.setLowerMargin(categoryAxisLowerMargin); + categoryAxis.setUpperMargin(categoryAxisUpperMargin); + + // -- Range Axis + boolean rangeAxisIsVisible = "y".equals(params.get(BaseChartWeb.CHART_PARAM_RANGEAXIS_VISIBLE)); + double rangeAxisUpperMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_UPPER), DEFAULT_SERIES_AXISMARGIN); + double rangeAxisLowerMargin = convertParamToDouble(params.get(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_LOWER), DEFAULT_SERIES_AXISMARGIN); + numberAxis.setTickLabelsVisible(rangeAxisIsVisible); + numberAxis.setVisible(rangeAxisIsVisible); + numberAxis.setLowerMargin(rangeAxisLowerMargin); + numberAxis.setUpperMargin(rangeAxisUpperMargin); + String rangeMax = params.get(BaseChartWeb.CHART_PARAM_RANGEMAX); + if (isParamValueValid(rangeMax)) { + double iRangeMax = Double.parseDouble(rangeMax); + numberAxis.setRange(0.0, iRangeMax); + } + String tickUnit = params.get(BaseChartWeb.CHART_PARAM_SERIES_AXISMARGIN_TICKUNIT); + if (isParamValueValid(tickUnit)) { + numberAxis.setTickUnit(new NumberTickUnit(convertParamToDouble(tickUnit))); + } + } + + private void applyParams() { + applyCommonParams(); + applyCommomParamsBar(); + + configureColors(params.get(BaseChartWeb.CHART_PARAM_COLORS), renderer); + addMeasures(params.get(BaseChartWeb.CHART_PARAM_VALUES)); + } + + private void addMeasures(String values) { + if (values != null && values.length() > 0) { + // Values + StringTokenizer stValues = new StringTokenizer(values, ","); + int nbValues = stValues.countTokens(); + + // Categories + String categoriesParam = params.get(BaseChartWeb.CHART_PARAM_CATEGORIES); + boolean categoriesPresent = categoriesParam != null && categoriesParam.length() > 0; + String[] categoriesSplit = null; + if (categoriesPresent) { + categoriesSplit = categoriesParam.split(","); + } else { + categoriesSplit = new String[1]; + categoriesSplit[0] = BaseChartWeb.DEFAULT_NAME_CATEGORY; + } + int nbCategories = categoriesSplit.length; + + // Series + String seriesParam = params.get(BaseChartWeb.CHART_PARAM_SERIES); + boolean seriesPresent = seriesParam != null && seriesParam.length() > 0; + String[] seriesSplit = null; + if (seriesPresent) { + seriesSplit = seriesParam.split(","); + } else { + seriesSplit = new String[nbValues]; + for (int i = 0; i < nbValues; i++) { + seriesSplit[i] = BaseChartWeb.DEFAULT_NAME_SERIE + i; + } + } + int nbSeries = seriesSplit.length; + + for (int iCategories = 0; iCategories < nbCategories; iCategories++) { + String currentCategory = categoriesSplit[iCategories]; + for (int iSeries = 0; iSeries < nbSeries; iSeries++) { + String currentSerie = seriesSplit[iSeries]; + double currentValue = 0.0; + if (stValues.hasMoreTokens()) { + try { + currentValue = Double.parseDouble(stValues.nextToken()); + } catch (NumberFormatException e) { + } + } + dataset.addValue(currentValue, currentSerie, currentCategory); + } + } + } + } + +} diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChart.java index f139bf07143..d1776177fc0 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChart.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChart.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java index c401fc32518..8cef9b3b296 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/BaseChartWeb.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java index c0b8c1fb645..bf60669ac0e 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarChart.java @@ -1,145 +1,145 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.charts.deprecated;
-
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.data.category.DefaultCategoryDataset;
-import org.jfree.ui.RectangleInsets;
-
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-public class CustomBarChart extends BarChart {
-
- private CustomBarRenderer renderer = null;
-
- public CustomBarChart(Map<String, String> params) {
- super(params);
- }
-
- @Override
- protected BufferedImage getChartImage() throws IOException {
- configure();
- return getBufferedImage(jfreechart);
- }
-
- @Override
- protected void configure() {
- configureChart(jfreechart, false);
- configureCategoryDataset();
- configureCategoryAxis();
- configureRenderer();
- configureRangeAxis();
- configureCategoryPlot();
- applyParams();
- }
-
- @Override
- protected void configureCategoryDataset() {
- dataset = new DefaultCategoryDataset();
- }
-
- @Override
- protected void configureRenderer() {
- renderer = new CustomBarRenderer(null);
- renderer.setItemMargin(0.0);
- renderer.setDrawBarOutline(false);
- }
-
- @Override
- protected void configureCategoryPlot() {
- CategoryPlot plot = jfreechart.getCategoryPlot();
- plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA);
- plot.setInsets(RectangleInsets.ZERO_INSETS); // To remove inner space around chart
- plot.setDataset(dataset);
- plot.setDomainAxis(categoryAxis);
- plot.setRenderer(renderer);
- plot.setRangeAxis(numberAxis);
- }
-
- protected void applyParams() {
- applyCommonParams();
- applyCommomParamsBar();
-
- configureColors(params.get(CHART_PARAM_COLORS));
- addMeasures(params.get(CHART_PARAM_VALUES));
- }
-
- private void configureColors(String colorsParam) {
- Paint[] colors = CustomBarRenderer.COLORS;
- if (colorsParam != null && colorsParam.length() > 0) {
- StringTokenizer stColors = new StringTokenizer(colorsParam, ",");
- colors = new Paint[stColors.countTokens()];
- int i = 0;
- while (stColors.hasMoreTokens()) {
- colors[i] = Color.decode("0x" + stColors.nextToken());
- i++;
- }
- }
-
- renderer.setColors(colors);
- }
-
- private void addMeasures(String values) {
- if (values != null && values.length() > 0) {
- // Values
- StringTokenizer stValues = new StringTokenizer(values, ",");
- int nbValues = stValues.countTokens();
-
- // Categories
- String categoriesParam = params.get(CHART_PARAM_CATEGORIES);
- boolean categoriesPresent = categoriesParam != null && categoriesParam.length() > 0;
- String[] categoriesSplit = null;
- if (categoriesPresent) {
- categoriesSplit = categoriesParam.split(",");
- } else {
- categoriesSplit = new String[nbValues];
- for (int i = 0; i < nbValues; i++) {
- categoriesSplit[i] = DEFAULT_NAME_CATEGORY + i;
- }
- }
- int nbCategories = categoriesSplit.length;
-
- // Series
- String[] seriesSplit = {DEFAULT_NAME_SERIE};
- int nbSeries = 1;
-
- //
- for (int iCategories = 0; iCategories < nbCategories; iCategories++) {
- String currentCategory = categoriesSplit[iCategories];
- for (int iSeries = 0; iSeries < nbSeries; iSeries++) {
- String currentSerie = seriesSplit[iSeries];
- double currentValue = 0.0;
- if (stValues.hasMoreTokens()) {
- try {
- currentValue = Double.parseDouble(stValues.nextToken());
- } catch (NumberFormatException e) {
- }
- }
- dataset.addValue(currentValue, currentSerie, currentCategory);
- }
- }
- }
- }
-
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.charts.deprecated; + +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.data.category.DefaultCategoryDataset; +import org.jfree.ui.RectangleInsets; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Map; +import java.util.StringTokenizer; + +public class CustomBarChart extends BarChart { + + private CustomBarRenderer renderer = null; + + public CustomBarChart(Map<String, String> params) { + super(params); + } + + @Override + protected BufferedImage getChartImage() throws IOException { + configure(); + return getBufferedImage(jfreechart); + } + + @Override + protected void configure() { + configureChart(jfreechart, false); + configureCategoryDataset(); + configureCategoryAxis(); + configureRenderer(); + configureRangeAxis(); + configureCategoryPlot(); + applyParams(); + } + + @Override + protected void configureCategoryDataset() { + dataset = new DefaultCategoryDataset(); + } + + @Override + protected void configureRenderer() { + renderer = new CustomBarRenderer(null); + renderer.setItemMargin(0.0); + renderer.setDrawBarOutline(false); + } + + @Override + protected void configureCategoryPlot() { + CategoryPlot plot = jfreechart.getCategoryPlot(); + plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); + plot.setInsets(RectangleInsets.ZERO_INSETS); // To remove inner space around chart + plot.setDataset(dataset); + plot.setDomainAxis(categoryAxis); + plot.setRenderer(renderer); + plot.setRangeAxis(numberAxis); + } + + protected void applyParams() { + applyCommonParams(); + applyCommomParamsBar(); + + configureColors(params.get(CHART_PARAM_COLORS)); + addMeasures(params.get(CHART_PARAM_VALUES)); + } + + private void configureColors(String colorsParam) { + Paint[] colors = CustomBarRenderer.COLORS; + if (colorsParam != null && colorsParam.length() > 0) { + StringTokenizer stColors = new StringTokenizer(colorsParam, ","); + colors = new Paint[stColors.countTokens()]; + int i = 0; + while (stColors.hasMoreTokens()) { + colors[i] = Color.decode("0x" + stColors.nextToken()); + i++; + } + } + + renderer.setColors(colors); + } + + private void addMeasures(String values) { + if (values != null && values.length() > 0) { + // Values + StringTokenizer stValues = new StringTokenizer(values, ","); + int nbValues = stValues.countTokens(); + + // Categories + String categoriesParam = params.get(CHART_PARAM_CATEGORIES); + boolean categoriesPresent = categoriesParam != null && categoriesParam.length() > 0; + String[] categoriesSplit = null; + if (categoriesPresent) { + categoriesSplit = categoriesParam.split(","); + } else { + categoriesSplit = new String[nbValues]; + for (int i = 0; i < nbValues; i++) { + categoriesSplit[i] = DEFAULT_NAME_CATEGORY + i; + } + } + int nbCategories = categoriesSplit.length; + + // Series + String[] seriesSplit = {DEFAULT_NAME_SERIE}; + int nbSeries = 1; + + // + for (int iCategories = 0; iCategories < nbCategories; iCategories++) { + String currentCategory = categoriesSplit[iCategories]; + for (int iSeries = 0; iSeries < nbSeries; iSeries++) { + String currentSerie = seriesSplit[iSeries]; + double currentValue = 0.0; + if (stValues.hasMoreTokens()) { + try { + currentValue = Double.parseDouble(stValues.nextToken()); + } catch (NumberFormatException e) { + } + } + dataset.addValue(currentValue, currentSerie, currentCategory); + } + } + } + } + }
\ No newline at end of file diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java index 75991330b39..7bc2e1fa0dc 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/CustomBarRenderer.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/DeprecatedChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/DeprecatedChart.java index 1918f366134..d8cfe05fd2e 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/DeprecatedChart.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/DeprecatedChart.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java index ad09729b7c6..83d22a15e51 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/PieChart.java @@ -1,129 +1,129 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.charts.deprecated;
-
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.PiePlot;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.general.DefaultPieDataset;
-import org.jfree.ui.RectangleInsets;
-
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-public class PieChart extends BaseChartWeb implements DeprecatedChart {
-
- private DefaultPieDataset dataset = null;
-
- public PieChart(Map<String, String> params) {
- super(params);
- jfreechart = new JFreeChart(null, TextTitle.DEFAULT_FONT, new PiePlot(), false);
- }
-
- @Override
- protected BufferedImage getChartImage() throws IOException {
- configure();
- return getBufferedImage(jfreechart);
- }
-
- private void configure() {
- configureChart(jfreechart, false);
- configureDataset();
- configurePlot();
- applyParams();
- }
-
- private void configureDataset() {
- dataset = new DefaultPieDataset();
- }
-
- private void configurePlot() {
- PiePlot plot = (PiePlot) jfreechart.getPlot();
- plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA);
- plot.setInsets(RectangleInsets.ZERO_INSETS);
- plot.setDataset(dataset);
- plot.setBackgroundAlpha(0.0f);
- plot.setCircular(true);
- plot.setLabelGenerator(null);
- plot.setIgnoreNullValues(true);
- plot.setIgnoreZeroValues(true);
- plot.setShadowPaint(null);
- plot.setLabelLinkMargin(0.0);
- plot.setInteriorGap(0.02);
- plot.setMaximumLabelWidth(0.10);
- }
-
- private void configureColors(String colors) {
- try {
- if (colors != null && colors.length() > 0) {
- StringTokenizer stringTokenizer = new StringTokenizer(colors, ",");
- int i = 0;
- while (stringTokenizer.hasMoreTokens()) {
- ((PiePlot) jfreechart.getPlot()).setSectionPaint(Integer.toString(i), Color.decode("0x" + stringTokenizer.nextToken()));
- i++;
- }
- } else {
- configureDefaultColors();
- }
- }
- catch (Exception e) {
- configureDefaultColors();
- }
- }
-
- private void configureDefaultColors() {
- PiePlot plot = (PiePlot) jfreechart.getPlot();
- for (int i=0 ; i<COLORS.length ; i++) {
- plot.setSectionPaint("" + i, COLORS[i]);
- }
- }
-
- private void applyParams() {
- applyCommonParams();
-
- configureColors(params.get(CHART_PARAM_COLORS));
- addMeasures(params.get(CHART_PARAM_VALUES));
-
- // -- Plot
- PiePlot plot = (PiePlot) jfreechart.getPlot();
- plot.setOutlineVisible(isParamValueValid(params.get(CHART_PARAM_OUTLINE_VISIBLE)) && Boolean.getBoolean(params.get(CHART_PARAM_OUTLINE_VISIBLE)));
- }
-
- private void addMeasures(String values) {
- if (values != null && values.length() > 0) {
- StringTokenizer st = new StringTokenizer(values, ",");
- int i = 0;
- while (st.hasMoreTokens()) {
- double measure = 0;
- try {
- measure = Double.parseDouble(st.nextToken());
- }
- catch (NumberFormatException e) {
- }
- dataset.setValue(Integer.toString(i), measure);
- i++;
- }
- }
- }
-
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.charts.deprecated; + +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.PiePlot; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.general.DefaultPieDataset; +import org.jfree.ui.RectangleInsets; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Map; +import java.util.StringTokenizer; + +public class PieChart extends BaseChartWeb implements DeprecatedChart { + + private DefaultPieDataset dataset = null; + + public PieChart(Map<String, String> params) { + super(params); + jfreechart = new JFreeChart(null, TextTitle.DEFAULT_FONT, new PiePlot(), false); + } + + @Override + protected BufferedImage getChartImage() throws IOException { + configure(); + return getBufferedImage(jfreechart); + } + + private void configure() { + configureChart(jfreechart, false); + configureDataset(); + configurePlot(); + applyParams(); + } + + private void configureDataset() { + dataset = new DefaultPieDataset(); + } + + private void configurePlot() { + PiePlot plot = (PiePlot) jfreechart.getPlot(); + plot.setNoDataMessage(DEFAULT_MESSAGE_NODATA); + plot.setInsets(RectangleInsets.ZERO_INSETS); + plot.setDataset(dataset); + plot.setBackgroundAlpha(0.0f); + plot.setCircular(true); + plot.setLabelGenerator(null); + plot.setIgnoreNullValues(true); + plot.setIgnoreZeroValues(true); + plot.setShadowPaint(null); + plot.setLabelLinkMargin(0.0); + plot.setInteriorGap(0.02); + plot.setMaximumLabelWidth(0.10); + } + + private void configureColors(String colors) { + try { + if (colors != null && colors.length() > 0) { + StringTokenizer stringTokenizer = new StringTokenizer(colors, ","); + int i = 0; + while (stringTokenizer.hasMoreTokens()) { + ((PiePlot) jfreechart.getPlot()).setSectionPaint(Integer.toString(i), Color.decode("0x" + stringTokenizer.nextToken())); + i++; + } + } else { + configureDefaultColors(); + } + } + catch (Exception e) { + configureDefaultColors(); + } + } + + private void configureDefaultColors() { + PiePlot plot = (PiePlot) jfreechart.getPlot(); + for (int i=0 ; i<COLORS.length ; i++) { + plot.setSectionPaint("" + i, COLORS[i]); + } + } + + private void applyParams() { + applyCommonParams(); + + configureColors(params.get(CHART_PARAM_COLORS)); + addMeasures(params.get(CHART_PARAM_VALUES)); + + // -- Plot + PiePlot plot = (PiePlot) jfreechart.getPlot(); + plot.setOutlineVisible(isParamValueValid(params.get(CHART_PARAM_OUTLINE_VISIBLE)) && Boolean.getBoolean(params.get(CHART_PARAM_OUTLINE_VISIBLE))); + } + + private void addMeasures(String values) { + if (values != null && values.length() > 0) { + StringTokenizer st = new StringTokenizer(values, ","); + int i = 0; + while (st.hasMoreTokens()) { + double measure = 0; + try { + measure = Double.parseDouble(st.nextToken()); + } + catch (NumberFormatException e) { + } + dataset.setValue(Integer.toString(i), measure); + i++; + } + } + } + }
\ No newline at end of file diff --git a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/SparkLinesChart.java b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/SparkLinesChart.java index 202353846a8..d46790c0244 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/deprecated/SparkLinesChart.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/deprecated/SparkLinesChart.java @@ -1,142 +1,142 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.charts.deprecated;
-
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.DateAxis;
-import org.jfree.chart.axis.DateTickUnit;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-import org.jfree.ui.RectangleInsets;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-public class SparkLinesChart extends BaseChartWeb implements DeprecatedChart {
-
- private XYSeriesCollection dataset = null;
- private DateAxis x = null;
- private NumberAxis y = null;
- private StandardXYItemRenderer renderer = null;
-
- public SparkLinesChart(Map<String, String> params) {
- super(params);
- jfreechart = new JFreeChart(null, TextTitle.DEFAULT_FONT, new XYPlot(), false);
- }
-
- @Override
- protected BufferedImage getChartImage() throws IOException {
- configure();
- return getBufferedImage(jfreechart);
- }
-
- private void configure() {
- configureChart(jfreechart, false);
- configureXAxis();
- configureYAxis();
- configureRenderer();
- configureDataset();
- configurePlot();
- applyParams();
- }
-
- private void configureRenderer() {
- renderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES);
- }
-
- private void configureYAxis() {
- y = new NumberAxis();
- y.setTickLabelsVisible(false);
- y.setTickMarksVisible(false);
- y.setAxisLineVisible(false);
- y.setNegativeArrowVisible(false);
- y.setPositiveArrowVisible(false);
- y.setVisible(false);
- }
-
- private void configureXAxis() {
- x = new DateAxis();
- x.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1));
- x.setTickLabelsVisible(false);
- x.setTickMarksVisible(false);
- x.setAxisLineVisible(false);
- x.setNegativeArrowVisible(false);
- x.setPositiveArrowVisible(false);
- x.setVisible(false);
- }
-
- private void configureDataset() {
- dataset = new XYSeriesCollection();
- }
-
- private void configurePlot() {
- XYPlot plot = (XYPlot) jfreechart.getPlot();
- plot.setInsets(RectangleInsets.ZERO_INSETS);
- plot.setDataset(dataset);
- plot.setDomainAxis(x);
- plot.setDomainGridlinesVisible(false);
- plot.setDomainCrosshairVisible(false);
- plot.setRangeGridlinesVisible(false);
- plot.setRangeCrosshairVisible(false);
- plot.setRangeAxis(y);
- plot.setRenderer(renderer);
- plot.setBackgroundAlpha(0.0f);
- }
-
- private void applyParams() {
- applyCommonParams();
-
- configureColors(params.get(CHART_PARAM_COLORS), renderer);
- addMeasures(params.get(CHART_PARAM_VALUES));
-
- // -- Plot
- XYPlot plot = (XYPlot) jfreechart.getPlot();
- plot.setOutlineVisible(isParamValueValid(params.get(CHART_PARAM_OUTLINE_VISIBLE)) && Boolean.getBoolean(params.get(CHART_PARAM_OUTLINE_VISIBLE)));
- }
-
- private void addMeasures(String values) {
- double min = Double.MAX_VALUE;
- double max = Double.MIN_VALUE;
- XYSeries series1 = new XYSeries("");
- if (values != null && values.length() > 0) {
- StringTokenizer st = new StringTokenizer(values, ",");
- while (st.hasMoreTokens()) {
- double v_x = convertParamToDouble(st.nextToken());
- double v_y = 0.0;
- if (st.hasMoreTokens()) {
- v_y = convertParamToDouble(st.nextToken());
- }
- series1.add(v_x, v_y);
-
- min = (v_y < min ? v_y : min);
- max = (v_y > max ? v_y : max);
- }
- dataset.addSeries(series1);
- y.setRange(min-1, max+1);
- }
- }
-
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.charts.deprecated; + +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.axis.DateTickUnit; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.StandardXYItemRenderer; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.xy.XYSeries; +import org.jfree.data.xy.XYSeriesCollection; +import org.jfree.ui.RectangleInsets; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Map; +import java.util.StringTokenizer; + +public class SparkLinesChart extends BaseChartWeb implements DeprecatedChart { + + private XYSeriesCollection dataset = null; + private DateAxis x = null; + private NumberAxis y = null; + private StandardXYItemRenderer renderer = null; + + public SparkLinesChart(Map<String, String> params) { + super(params); + jfreechart = new JFreeChart(null, TextTitle.DEFAULT_FONT, new XYPlot(), false); + } + + @Override + protected BufferedImage getChartImage() throws IOException { + configure(); + return getBufferedImage(jfreechart); + } + + private void configure() { + configureChart(jfreechart, false); + configureXAxis(); + configureYAxis(); + configureRenderer(); + configureDataset(); + configurePlot(); + applyParams(); + } + + private void configureRenderer() { + renderer = new StandardXYItemRenderer(StandardXYItemRenderer.LINES); + } + + private void configureYAxis() { + y = new NumberAxis(); + y.setTickLabelsVisible(false); + y.setTickMarksVisible(false); + y.setAxisLineVisible(false); + y.setNegativeArrowVisible(false); + y.setPositiveArrowVisible(false); + y.setVisible(false); + } + + private void configureXAxis() { + x = new DateAxis(); + x.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1)); + x.setTickLabelsVisible(false); + x.setTickMarksVisible(false); + x.setAxisLineVisible(false); + x.setNegativeArrowVisible(false); + x.setPositiveArrowVisible(false); + x.setVisible(false); + } + + private void configureDataset() { + dataset = new XYSeriesCollection(); + } + + private void configurePlot() { + XYPlot plot = (XYPlot) jfreechart.getPlot(); + plot.setInsets(RectangleInsets.ZERO_INSETS); + plot.setDataset(dataset); + plot.setDomainAxis(x); + plot.setDomainGridlinesVisible(false); + plot.setDomainCrosshairVisible(false); + plot.setRangeGridlinesVisible(false); + plot.setRangeCrosshairVisible(false); + plot.setRangeAxis(y); + plot.setRenderer(renderer); + plot.setBackgroundAlpha(0.0f); + } + + private void applyParams() { + applyCommonParams(); + + configureColors(params.get(CHART_PARAM_COLORS), renderer); + addMeasures(params.get(CHART_PARAM_VALUES)); + + // -- Plot + XYPlot plot = (XYPlot) jfreechart.getPlot(); + plot.setOutlineVisible(isParamValueValid(params.get(CHART_PARAM_OUTLINE_VISIBLE)) && Boolean.getBoolean(params.get(CHART_PARAM_OUTLINE_VISIBLE))); + } + + private void addMeasures(String values) { + double min = Double.MAX_VALUE; + double max = Double.MIN_VALUE; + XYSeries series1 = new XYSeries(""); + if (values != null && values.length() > 0) { + StringTokenizer st = new StringTokenizer(values, ","); + while (st.hasMoreTokens()) { + double v_x = convertParamToDouble(st.nextToken()); + double v_y = 0.0; + if (st.hasMoreTokens()) { + v_y = convertParamToDouble(st.nextToken()); + } + series1.add(v_x, v_y); + + min = (v_y < min ? v_y : min); + max = (v_y > max ? v_y : max); + } + dataset.addSeries(series1); + y.setRange(min-1, max+1); + } + } + }
\ No newline at end of file diff --git a/sonar-server/src/main/java/org/sonar/server/charts/jruby/TrendsChart.java b/sonar-server/src/main/java/org/sonar/server/charts/jruby/TrendsChart.java index bb5037f9440..e8f62192a6f 100644 --- a/sonar-server/src/main/java/org/sonar/server/charts/jruby/TrendsChart.java +++ b/sonar-server/src/main/java/org/sonar/server/charts/jruby/TrendsChart.java @@ -1,140 +1,140 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.charts.jruby;
-
-import org.apache.commons.lang.LocaleUtils;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.AxisLocation;
-import org.jfree.chart.axis.DateAxis;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.plot.Marker;
-import org.jfree.chart.plot.ValueMarker;
-import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.time.Day;
-import org.jfree.data.time.TimeSeries;
-import org.jfree.data.time.TimeSeriesCollection;
-import org.jfree.ui.RectangleAnchor;
-import org.jfree.ui.RectangleEdge;
-import org.jfree.ui.RectangleInsets;
-import org.jfree.ui.TextAnchor;
-import org.sonar.server.charts.deprecated.BaseChart;
-
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.ParseException;
-import java.util.Date;
-import java.util.TreeMap;
-
-public class TrendsChart extends BaseChart {
-
- private XYPlot plot;
- private TreeMap<Long, TimeSeries> seriesById;
- private int percentAxisId = -1;
- private boolean displayLegend;
-
- public TrendsChart(int width, int height, String localeKey, boolean displayLegend) {
- super(width, height);
- this.displayLegend = displayLegend;
- seriesById = new TreeMap<Long, TimeSeries>();
- plot = new XYPlot();
- DateAxis dateAxis = new DateAxis();
- dateAxis.setDateFormatOverride(DateFormat.getDateInstance(DateFormat.SHORT, LocaleUtils.toLocale(localeKey)));
- plot.setDomainAxis(dateAxis);
- }
-
- public void initSerie(Long serieId, String legend, boolean isPercent) {
- TimeSeries series = new TimeSeries(legend);
-
- int index=seriesById.size();
- seriesById.put(serieId, series);
-
- TimeSeriesCollection timeSeriesColl = new TimeSeriesCollection();
- timeSeriesColl.addSeries(series);
- plot.setDataset(index, timeSeriesColl);
-
- if (isPercent) {
- if (percentAxisId == -1) {
- NumberAxis rangeAxis = new NumberAxis();
- rangeAxis.setNumberFormatOverride(new DecimalFormat("0'%'"));
- rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
- rangeAxis.setUpperBound(100.0);
- rangeAxis.setLowerBound(0.0);
- plot.setRangeAxisLocation(index, AxisLocation.TOP_OR_LEFT);
- plot.setRangeAxis(index, rangeAxis);
- plot.mapDatasetToRangeAxis(index, index);
- percentAxisId = index;
-
- } else {
- plot.mapDatasetToRangeAxis(index, percentAxisId);
- }
- } else {
- NumberAxis rangeAxis = new NumberAxis(displayLegend ? legend : null);
- rangeAxis.setAutoRangeIncludesZero(false);
- rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
- rangeAxis.setAutoRangeMinimumSize(2.0);
- plot.setRangeAxisLocation(index, AxisLocation.TOP_OR_RIGHT);
- plot.setRangeAxis(index, rangeAxis);
- plot.mapDatasetToRangeAxis(index, index);
- }
-
- XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
- renderer.setBaseShapesVisible(false);
- renderer.setSeriesStroke(0, new BasicStroke(2.0f));
- renderer.setSeriesPaint(0, COLORS[index % COLORS.length]);
- plot.setRenderer(index, renderer);
- }
-
- public void addMeasure(Double value, Date date, Long serieId) {
- seriesById.get(serieId).addOrUpdate(new Day(date), value);
- }
-
- public void addLabel(Date date, String label) throws ParseException {
- addLabel(date, label, false);
- }
-
- public void addLabel(Date date, String label, boolean lower) throws ParseException {
- Day d = new Day(date);
- double millis = d.getFirstMillisecond();
- Marker marker = new ValueMarker(millis);
- marker.setLabel(label);
- marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
- marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
- Color c = new Color(17, 40, 95);
- marker.setLabelPaint(c);
- marker.setPaint(c);
- marker.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3.0f, new float[]{5f, 5f, 5f, 5f}, 2.0f));
- if (lower) {
- marker.setLabelOffset(new RectangleInsets(18, 0, 0, 5));
- }
- plot.addDomainMarker(marker);
- }
-
- @Override
- protected BufferedImage getChartImage() throws IOException {
- JFreeChart chart = new JFreeChart(null, TextTitle.DEFAULT_FONT, plot, true);
- configureChart(chart, displayLegend ? RectangleEdge.BOTTOM : null);
- return super.getBufferedImage(chart);
- }
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.charts.jruby; + +import org.apache.commons.lang.LocaleUtils; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.AxisLocation; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.plot.Marker; +import org.jfree.chart.plot.ValueMarker; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; +import org.jfree.chart.title.TextTitle; +import org.jfree.data.time.Day; +import org.jfree.data.time.TimeSeries; +import org.jfree.data.time.TimeSeriesCollection; +import org.jfree.ui.RectangleAnchor; +import org.jfree.ui.RectangleEdge; +import org.jfree.ui.RectangleInsets; +import org.jfree.ui.TextAnchor; +import org.sonar.server.charts.deprecated.BaseChart; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.util.Date; +import java.util.TreeMap; + +public class TrendsChart extends BaseChart { + + private XYPlot plot; + private TreeMap<Long, TimeSeries> seriesById; + private int percentAxisId = -1; + private boolean displayLegend; + + public TrendsChart(int width, int height, String localeKey, boolean displayLegend) { + super(width, height); + this.displayLegend = displayLegend; + seriesById = new TreeMap<Long, TimeSeries>(); + plot = new XYPlot(); + DateAxis dateAxis = new DateAxis(); + dateAxis.setDateFormatOverride(DateFormat.getDateInstance(DateFormat.SHORT, LocaleUtils.toLocale(localeKey))); + plot.setDomainAxis(dateAxis); + } + + public void initSerie(Long serieId, String legend, boolean isPercent) { + TimeSeries series = new TimeSeries(legend); + + int index=seriesById.size(); + seriesById.put(serieId, series); + + TimeSeriesCollection timeSeriesColl = new TimeSeriesCollection(); + timeSeriesColl.addSeries(series); + plot.setDataset(index, timeSeriesColl); + + if (isPercent) { + if (percentAxisId == -1) { + NumberAxis rangeAxis = new NumberAxis(); + rangeAxis.setNumberFormatOverride(new DecimalFormat("0'%'")); + rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); + rangeAxis.setUpperBound(100.0); + rangeAxis.setLowerBound(0.0); + plot.setRangeAxisLocation(index, AxisLocation.TOP_OR_LEFT); + plot.setRangeAxis(index, rangeAxis); + plot.mapDatasetToRangeAxis(index, index); + percentAxisId = index; + + } else { + plot.mapDatasetToRangeAxis(index, percentAxisId); + } + } else { + NumberAxis rangeAxis = new NumberAxis(displayLegend ? legend : null); + rangeAxis.setAutoRangeIncludesZero(false); + rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); + rangeAxis.setAutoRangeMinimumSize(2.0); + plot.setRangeAxisLocation(index, AxisLocation.TOP_OR_RIGHT); + plot.setRangeAxis(index, rangeAxis); + plot.mapDatasetToRangeAxis(index, index); + } + + XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); + renderer.setBaseShapesVisible(false); + renderer.setSeriesStroke(0, new BasicStroke(2.0f)); + renderer.setSeriesPaint(0, COLORS[index % COLORS.length]); + plot.setRenderer(index, renderer); + } + + public void addMeasure(Double value, Date date, Long serieId) { + seriesById.get(serieId).addOrUpdate(new Day(date), value); + } + + public void addLabel(Date date, String label) throws ParseException { + addLabel(date, label, false); + } + + public void addLabel(Date date, String label, boolean lower) throws ParseException { + Day d = new Day(date); + double millis = d.getFirstMillisecond(); + Marker marker = new ValueMarker(millis); + marker.setLabel(label); + marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT); + marker.setLabelTextAnchor(TextAnchor.TOP_LEFT); + Color c = new Color(17, 40, 95); + marker.setLabelPaint(c); + marker.setPaint(c); + marker.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3.0f, new float[]{5f, 5f, 5f, 5f}, 2.0f)); + if (lower) { + marker.setLabelOffset(new RectangleInsets(18, 0, 0, 5)); + } + plot.addDomainMarker(marker); + } + + @Override + protected BufferedImage getChartImage() throws IOException { + JFreeChart chart = new JFreeChart(null, TextTitle.DEFAULT_FONT, plot, true); + configureChart(chart, displayLegend ? RectangleEdge.BOTTOM : null); + return super.getBufferedImage(chart); + } }
\ No newline at end of file diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java b/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java index c610f065535..635f256bb79 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/Backupable.java b/sonar-server/src/main/java/org/sonar/server/configuration/Backupable.java index 5636e5bc151..2079f4c66ae 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/Backupable.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/Backupable.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationException.java b/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationException.java index 7f67320aec2..827f77cbc85 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationException.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationException.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationFactory.java b/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationFactory.java index 342515a1c7a..e4d3b9d0586 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationFactory.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationLogger.java b/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationLogger.java index f9a8287052f..b63d156e787 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationLogger.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ConfigurationLogger.java @@ -1,52 +1,52 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.configuration;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-
-public final class ConfigurationLogger {
-
- private ConfigurationLogger() {
- // only static methods
- }
-
- public static void log(Configuration configuration) {
- Logger log = LoggerFactory.getLogger(ConfigurationLogger.class);
- if (log.isDebugEnabled()) {
- Iterator<String> keys = configuration.getKeys();
- while (keys.hasNext()) {
- String key = keys.next();
- String property = getTruncatedProperty(configuration, key);
- log.debug("Property: " + key + " is: '" + property + "'");
- }
- }
- }
-
- static String getTruncatedProperty(Configuration configuration, String key) {
- String property = StringUtils.join(configuration.getStringArray(key), ",");
- return StringUtils.abbreviate(property, 100);
- }
-
-}
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.configuration; + +import org.apache.commons.configuration.Configuration; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Iterator; + +public final class ConfigurationLogger { + + private ConfigurationLogger() { + // only static methods + } + + public static void log(Configuration configuration) { + Logger log = LoggerFactory.getLogger(ConfigurationLogger.class); + if (log.isDebugEnabled()) { + Iterator<String> keys = configuration.getKeys(); + while (keys.hasNext()) { + String key = keys.next(); + String property = getTruncatedProperty(configuration, key); + log.debug("Property: " + key + " is: '" + property + "'"); + } + } + } + + static String getTruncatedProperty(Configuration configuration, String key) { + String property = StringUtils.join(configuration.getStringArray(key), ","); + return StringUtils.abbreviate(property, 100); + } + +} diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/CoreConfiguration.java b/sonar-server/src/main/java/org/sonar/server/configuration/CoreConfiguration.java index c550a0d692b..8e018e52af0 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/CoreConfiguration.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/CoreConfiguration.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java index 1fc7fd5c24b..d4859c546d3 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java index 4067d83d37a..143427d6457 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java index 02564ab0475..4734352e979 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java index 374f04fc867..5b8dbc943f3 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java index 5a9112237d9..d82f76cb8fd 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/SonarConfig.java b/sonar-server/src/main/java/org/sonar/server/configuration/SonarConfig.java index 123fc534b54..688a6d30ce4 100644 --- a/sonar-server/src/main/java/org/sonar/server/configuration/SonarConfig.java +++ b/sonar-server/src/main/java/org/sonar/server/configuration/SonarConfig.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabase.java b/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabase.java index c9a5a7da3df..16b907b3592 100644 --- a/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabase.java +++ b/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabase.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabaseFactory.java b/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabaseFactory.java index d700a493c88..92787dee792 100644 --- a/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabaseFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/database/EmbeddedDatabaseFactory.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/database/JndiDatabaseConnector.java b/sonar-server/src/main/java/org/sonar/server/database/JndiDatabaseConnector.java index 47fe6be9b73..1d235ef0cf1 100644 --- a/sonar-server/src/main/java/org/sonar/server/database/JndiDatabaseConnector.java +++ b/sonar-server/src/main/java/org/sonar/server/database/JndiDatabaseConnector.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/database/JndiException.java b/sonar-server/src/main/java/org/sonar/server/database/JndiException.java index e92d266104b..3f7a0887b04 100644 --- a/sonar-server/src/main/java/org/sonar/server/database/JndiException.java +++ b/sonar-server/src/main/java/org/sonar/server/database/JndiException.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/database/UniqueDatasourceFactory.java b/sonar-server/src/main/java/org/sonar/server/database/UniqueDatasourceFactory.java index 1bb4722ae50..58f8e515f7b 100644 --- a/sonar-server/src/main/java/org/sonar/server/database/UniqueDatasourceFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/database/UniqueDatasourceFactory.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/filters/DateCriterion.java b/sonar-server/src/main/java/org/sonar/server/filters/DateCriterion.java index 6b26e55a0a9..04a6ee12b43 100644 --- a/sonar-server/src/main/java/org/sonar/server/filters/DateCriterion.java +++ b/sonar-server/src/main/java/org/sonar/server/filters/DateCriterion.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/filters/Filter.java b/sonar-server/src/main/java/org/sonar/server/filters/Filter.java index d2c864ff181..070c360c94d 100644 --- a/sonar-server/src/main/java/org/sonar/server/filters/Filter.java +++ b/sonar-server/src/main/java/org/sonar/server/filters/Filter.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java b/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java index 27ad79fe382..5015f4ac326 100644 --- a/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java +++ b/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java b/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java index 5408eff8497..c0b54e1c8ad 100644 --- a/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java +++ b/sonar-server/src/main/java/org/sonar/server/filters/FilterResult.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/filters/MeasureCriterion.java b/sonar-server/src/main/java/org/sonar/server/filters/MeasureCriterion.java index 810b24d0c03..5e0d352fbb8 100644 --- a/sonar-server/src/main/java/org/sonar/server/filters/MeasureCriterion.java +++ b/sonar-server/src/main/java/org/sonar/server/filters/MeasureCriterion.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java index f1e8501f1ae..cf1793dd085 100644 --- a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java +++ b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Artifact.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java b/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java index f5b99fc183a..8dbd3e57d59 100644 --- a/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java +++ b/sonar-server/src/main/java/org/sonar/server/mavendeployer/MavenRepository.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java index 154a512fc5b..bd90adea321 100644 --- a/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java +++ b/sonar-server/src/main/java/org/sonar/server/mavendeployer/Mojo.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java b/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java index 2962289e48a..1810d8e5d89 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerFileSystem.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java b/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java index 0230b53708e..69bc39280cf 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java index 1d0ab614b67..aaa69ba8047 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java b/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java index 954e96575cb..31bb8bf0f09 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java index 6a8f10ea2fd..5267fbcc8eb 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerImpl.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java index 42d6bc229c6..4edc5db0428 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerLifecycleNotifier.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerStartException.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerStartException.java index 5638bfd0bf8..828c80505e2 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/ServerStartException.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerStartException.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java b/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java index b47258bb802..bf83fa6961b 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/BatchResourcesServlet.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginClassLoaders.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginClassLoaders.java index d76f3dcfa7d..eee0237bf3e 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginClassLoaders.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/PluginClassLoaders.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java index 6da8ea3fd49..2c5406cdf5e 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java index f3d9c23c631..aa58429eac5 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginMetadata.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginMetadata.java index 58410f2cbd8..b4e0fbad137 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginMetadata.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/PluginMetadata.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java b/sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java index 2effefe822d..0d65664b4c1 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/PluginUpdate.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java b/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java index 5cc2def52d2..a5cc852215b 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java b/sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java index e79ec2e8602..e9d8612a55a 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/SonarUpdate.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java b/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java index 0481fcbae90..9d1a60a01df 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/StaticResourcesServlet.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java index a85570f1a01..7dbcc8543d1 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterClient.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrix.java b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrix.java index 82c1cc773c1..c37e99eb447 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrix.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrix.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java index 6e33ace2d42..fb29dfe807b 100644 --- a/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/plugins/UpdateCenterMatrixFactory.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/qualitymodel/DefaultModelManager.java b/sonar-server/src/main/java/org/sonar/server/qualitymodel/DefaultModelManager.java index 0e5290a0012..9f2a3e06741 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualitymodel/DefaultModelManager.java +++ b/sonar-server/src/main/java/org/sonar/server/qualitymodel/DefaultModelManager.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/qualitymodel/ModelManager.java b/sonar-server/src/main/java/org/sonar/server/qualitymodel/ModelManager.java index 8bd0f005e9e..213051e6cbc 100644 --- a/sonar-server/src/main/java/org/sonar/server/qualitymodel/ModelManager.java +++ b/sonar-server/src/main/java/org/sonar/server/qualitymodel/ModelManager.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileExporters.java b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileExporters.java index 623f6c0abf6..dbb7f2eac44 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileExporters.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileExporters.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileImporters.java b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileImporters.java index c55ec758f1c..4d49738ca50 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileImporters.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfileImporters.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java index ee0628f76dc..40ed1877b07 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedProfiles.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedRuleRepositories.java b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedRuleRepositories.java index 55de2e4efb5..0a0bfa5705b 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedRuleRepositories.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/DeprecatedRuleRepositories.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java b/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java index 8217194761a..e70f785c438 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/ProfilesConsole.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/rules/RulesConsole.java b/sonar-server/src/main/java/org/sonar/server/rules/RulesConsole.java index 62bd8867a73..a7ed65b5e7c 100644 --- a/sonar-server/src/main/java/org/sonar/server/rules/RulesConsole.java +++ b/sonar-server/src/main/java/org/sonar/server/rules/RulesConsole.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/ActivateDefaultProfiles.java b/sonar-server/src/main/java/org/sonar/server/startup/ActivateDefaultProfiles.java index b608d35cbf0..c780c14e719 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/ActivateDefaultProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/ActivateDefaultProfiles.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/DeleteDeprecatedMeasures.java b/sonar-server/src/main/java/org/sonar/server/startup/DeleteDeprecatedMeasures.java index eed02cc31b4..cce7eeae5b4 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/DeleteDeprecatedMeasures.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/DeleteDeprecatedMeasures.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/EnableProfiles.java b/sonar-server/src/main/java/org/sonar/server/startup/EnableProfiles.java index 9dc2fcccf81..2ae0845dd02 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/EnableProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/EnableProfiles.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java b/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java index 2b54debd20d..fd7fb4a501d 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/GwtPublisher.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/JdbcDriverDeployer.java b/sonar-server/src/main/java/org/sonar/server/startup/JdbcDriverDeployer.java index 941be544f2e..e22e66ea861 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/JdbcDriverDeployer.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/JdbcDriverDeployer.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java index 769371519e6..7d25cc57208 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterMetrics.java @@ -1,97 +1,97 @@ -/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2009 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.server.startup;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.measures.CoreMetrics;
-import org.sonar.api.measures.Metric;
-import org.sonar.api.measures.Metrics;
-import org.sonar.api.profiles.Alert;
-import org.sonar.api.utils.Logs;
-import org.sonar.api.utils.TimeProfiler;
-import org.sonar.jpa.dao.MeasuresDao;
-import org.sonar.server.platform.ServerStartException;
-
-import javax.persistence.Query;
-
-import java.util.List;
-import java.util.Map;
-
-public class RegisterMetrics {
-
- private MeasuresDao measuresDao;
- private Metrics[] metricsRepositories = null;
- private DatabaseSession session;
-
- public RegisterMetrics(DatabaseSession session, MeasuresDao measuresDao, Metrics[] metricsRepositories) {
- this.session = session;
- this.measuresDao = measuresDao;
- this.metricsRepositories = metricsRepositories;
- }
-
- public void start() {
- TimeProfiler profiler = new TimeProfiler().start("Load metrics");
- measuresDao.disableAutomaticMetrics();
-
- List<Metric> metricsToRegister = Lists.newArrayList();
- metricsToRegister.addAll(CoreMetrics.getMetrics());
-
- Map<String, Metrics> metricsByRepository = Maps.newHashMap();
- if (metricsRepositories != null) {
- for (Metrics metrics : metricsRepositories) {
- checkMetrics(metricsByRepository, metrics);
- metricsToRegister.addAll(metrics.getMetrics());
- }
- }
- register(metricsToRegister);
- cleanAlerts();
- profiler.stop();
- }
-
- private void checkMetrics(Map<String, Metrics> metricsByRepository, Metrics metrics) {
- for (Metric metric : metrics.getMetrics()) {
- String metricKey = metric.getKey();
- if (CoreMetrics.metrics.contains(metric)) {
- throw new ServerStartException("The following metric is already defined in sonar: " + metricKey);
- }
- Metrics anotherRepository = metricsByRepository.get(metricKey);
- if (anotherRepository != null) {
- throw new ServerStartException("The metric '" + metricKey + "' is already defined in the extension: " + anotherRepository);
- }
- metricsByRepository.put(metricKey, metrics);
- }
- }
-
- protected void cleanAlerts() {
- Logs.INFO.info("cleaning alert thresholds...");
- Query query = session.createQuery("delete from " + Alert.class.getSimpleName() + " a where NOT EXISTS(FROM Metric m WHERE m=a.metric))");
- query.executeUpdate();
-
- query = session.createQuery("delete from " + Alert.class.getSimpleName() + " a where NOT EXISTS(FROM Metric m WHERE m=a.metric and m.enabled=true))");
- query.executeUpdate();
- session.commit();
- }
-
- protected void register(List<Metric> metrics) {
- measuresDao.registerMetrics(metrics);
- }
-}
+/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2011 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.startup; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import org.sonar.api.database.DatabaseSession; +import org.sonar.api.measures.CoreMetrics; +import org.sonar.api.measures.Metric; +import org.sonar.api.measures.Metrics; +import org.sonar.api.profiles.Alert; +import org.sonar.api.utils.Logs; +import org.sonar.api.utils.TimeProfiler; +import org.sonar.jpa.dao.MeasuresDao; +import org.sonar.server.platform.ServerStartException; + +import javax.persistence.Query; + +import java.util.List; +import java.util.Map; + +public class RegisterMetrics { + + private MeasuresDao measuresDao; + private Metrics[] metricsRepositories = null; + private DatabaseSession session; + + public RegisterMetrics(DatabaseSession session, MeasuresDao measuresDao, Metrics[] metricsRepositories) { + this.session = session; + this.measuresDao = measuresDao; + this.metricsRepositories = metricsRepositories; + } + + public void start() { + TimeProfiler profiler = new TimeProfiler().start("Load metrics"); + measuresDao.disableAutomaticMetrics(); + + List<Metric> metricsToRegister = Lists.newArrayList(); + metricsToRegister.addAll(CoreMetrics.getMetrics()); + + Map<String, Metrics> metricsByRepository = Maps.newHashMap(); + if (metricsRepositories != null) { + for (Metrics metrics : metricsRepositories) { + checkMetrics(metricsByRepository, metrics); + metricsToRegister.addAll(metrics.getMetrics()); + } + } + register(metricsToRegister); + cleanAlerts(); + profiler.stop(); + } + + private void checkMetrics(Map<String, Metrics> metricsByRepository, Metrics metrics) { + for (Metric metric : metrics.getMetrics()) { + String metricKey = metric.getKey(); + if (CoreMetrics.metrics.contains(metric)) { + throw new ServerStartException("The following metric is already defined in sonar: " + metricKey); + } + Metrics anotherRepository = metricsByRepository.get(metricKey); + if (anotherRepository != null) { + throw new ServerStartException("The metric '" + metricKey + "' is already defined in the extension: " + anotherRepository); + } + metricsByRepository.put(metricKey, metrics); + } + } + + protected void cleanAlerts() { + Logs.INFO.info("cleaning alert thresholds..."); + Query query = session.createQuery("delete from " + Alert.class.getSimpleName() + " a where NOT EXISTS(FROM Metric m WHERE m=a.metric))"); + query.executeUpdate(); + + query = session.createQuery("delete from " + Alert.class.getSimpleName() + " a where NOT EXISTS(FROM Metric m WHERE m=a.metric and m.enabled=true))"); + query.executeUpdate(); + session.commit(); + } + + protected void register(List<Metric> metrics) { + measuresDao.registerMetrics(metrics); + } +} diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java index 99af8cfc275..5f36e4b84b2 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java index 424bd7378bc..bc9cc902396 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java index 2e2d31defed..3ad4ae210c9 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/startup/ServerMetadataPersister.java b/sonar-server/src/main/java/org/sonar/server/startup/ServerMetadataPersister.java index 2159465e877..6a6e4092c52 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/ServerMetadataPersister.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/ServerMetadataPersister.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorFactory.java b/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorFactory.java index 8f4a8404811..ed42799fd97 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorFactory.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorFactory.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorNotFoundException.java b/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorNotFoundException.java index 1e0c17f2cab..0e57e6bbfc5 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorNotFoundException.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/AuthenticatorNotFoundException.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java b/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java index 87e5ca667ce..f6f346fdd44 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/CodeColorizers.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/DatabaseSessionFilter.java b/sonar-server/src/main/java/org/sonar/server/ui/DatabaseSessionFilter.java index c0ac1d62cd8..1c7d6f43123 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/DatabaseSessionFilter.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/DatabaseSessionFilter.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index 60a792f5cc3..f540eda5a93 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/SonarRackFilter.java b/sonar-server/src/main/java/org/sonar/server/ui/SonarRackFilter.java index 52a67f10ec9..e29fd9cd442 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/SonarRackFilter.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/SonarRackFilter.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java b/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java index 59fae3ac6a5..d36e9562dab 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/ViewProxy.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or diff --git a/sonar-server/src/main/java/org/sonar/server/ui/Views.java b/sonar-server/src/main/java/org/sonar/server/ui/Views.java index 69e4c8ee643..94b789eda46 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/Views.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/Views.java @@ -1,6 +1,6 @@ /* * Sonar, open source software quality management tool. - * Copyright (C) 2009 SonarSource SA + * Copyright (C) 2008-2011 SonarSource * mailto:contact AT sonarsource DOT com * * Sonar is free software; you can redistribute it and/or |