From 5b627f797640455ed3fc4a6a075d278ed5dd9372 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 21 Jun 2011 18:12:51 +0200 Subject: [PATCH] SONAR-75 Fix /i18n/unknown_keys and remove unused i18n maven module --- plugins/sonar-i18n-plugin/pom.xml | 70 ------------------- .../sonar/plugins/i18n/I18nWebService.java | 35 ---------- .../plugins/i18n/i18n_manager_controller.rb | 66 ----------------- .../app/controllers/i18n_controller.rb | 35 ++++------ 4 files changed, 13 insertions(+), 193 deletions(-) delete mode 100644 plugins/sonar-i18n-plugin/pom.xml delete mode 100644 plugins/sonar-i18n-plugin/src/main/java/org/sonar/plugins/i18n/I18nWebService.java delete mode 100644 plugins/sonar-i18n-plugin/src/main/resources/org/sonar/plugins/i18n/i18n_manager_controller.rb diff --git a/plugins/sonar-i18n-plugin/pom.xml b/plugins/sonar-i18n-plugin/pom.xml deleted file mode 100644 index c9390e6571c..00000000000 --- a/plugins/sonar-i18n-plugin/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - 4.0.0 - - sonar - org.codehaus.sonar - 2.9-SNAPSHOT - ../.. - - org.codehaus.sonar.plugins - sonar-i18n-plugin - sonar-plugin - 2.9-SNAPSHOT - Sonar :: Plugins :: I18n - Sonar I18n plugin - - - - org.codehaus.sonar - sonar-plugin-api - provided - - - org.codehaus.sonar - sonar-core - provided - - - - - org.codehaus.sonar - sonar-testing-harness - test - - - junit - junit - test - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - UTF-8 - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - 1.1 - true - - i18n - org.sonar.plugins.i18n.I18nPlugin - I18n - - - - - - - diff --git a/plugins/sonar-i18n-plugin/src/main/java/org/sonar/plugins/i18n/I18nWebService.java b/plugins/sonar-i18n-plugin/src/main/java/org/sonar/plugins/i18n/I18nWebService.java deleted file mode 100644 index 3584e67e4c5..00000000000 --- a/plugins/sonar-i18n-plugin/src/main/java/org/sonar/plugins/i18n/I18nWebService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.plugins.i18n; - -import org.sonar.api.web.AbstractRubyTemplate; -import org.sonar.api.web.RubyRailsWebservice; - -public class I18nWebService extends AbstractRubyTemplate implements RubyRailsWebservice { - - public String getId() { - return "i18n_manager"; - } - - @Override - protected String getTemplatePath() { - return "i18n_manager_controller.rb"; - } -} diff --git a/plugins/sonar-i18n-plugin/src/main/resources/org/sonar/plugins/i18n/i18n_manager_controller.rb b/plugins/sonar-i18n-plugin/src/main/resources/org/sonar/plugins/i18n/i18n_manager_controller.rb deleted file mode 100644 index e3f7ee50a96..00000000000 --- a/plugins/sonar-i18n-plugin/src/main/resources/org/sonar/plugins/i18n/i18n_manager_controller.rb +++ /dev/null @@ -1,66 +0,0 @@ -# -# Sonar, entreprise quality control 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 -# - -require "json" - -class Api::I18nManagerController < Api::ApiController - - def index - render :text => "Use one of the following:
" - end - - # GET /api/plugins/i18n_manager/unknown_keys - # Examples : - # curl -v http://localhost:9000/api/plugins/i18n_manager -u admin:admin - # - - def unknown_keys - begin - output = "" - properties = i18n_manager.unknown_keys - - properties.keys.sort.each {|key| output += "#{key}=#{properties[key]}\n" } - - output = "# No unknown keys" if output.empty? - - respond_to do |format| - format.json { render :json => JSON(properties) } - format.xml { render :xml => xml_not_supported } - format.text { render :text => output } - end - - rescue ApiException => e - render_error(e.msg, e.code) - - rescue Exception => e - logger.error("Fails to execute #{request.url} : #{e.message}") - render_error(e.message) - end - end - - private - - def i18n_manager - java_facade.getComponentByClassname('i18n', 'org.sonar.plugins.i18n.I18nManager') - end - -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb index 30ba45178db..c5ec6fd0702 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb @@ -20,45 +20,36 @@ require "json" -class I18nController < Api::ApiController +class I18nController < ApplicationController def index - render :text => "Use one of the following:
" + render :text => "Use one of the following:
" end # # GET /i18n/unknown_keys # def unknown_keys - begin - output = "" - properties = i18n_manager.unknown_keys + output = "" + properties = i18n_manager.unknown_keys - properties.keys.sort.each {|key| output += "#{key}=#{properties[key]}\n" } + properties.keys.sort.each { |key| output += "#{key}=#{properties[key]}\n" } - output = "# No unknown keys" if output.empty? + output = "# No unknown keys" if output.empty? - respond_to do |format| - format.json { render :json => JSON(properties) } - format.xml { render :xml => xml_not_supported } - format.text { render :text => output } - end - - rescue ApiException => e - render_error(e.msg, e.code) - - rescue Exception => e - logger.error("Fails to execute #{request.url} : #{e.message}") - render_error(e.message) + respond_to do |format| + format.json { render :json => JSON(properties) } + format.xml { render :xml => xml_not_supported } + format.text { render :text => output } end end private def i18n_manager - java_facade.getComponentByClassname('i18n', 'org.sonar.plugins.core.i18n.I18nManager') + java_facade.getComponentByClassname('core', 'org.sonar.plugins.core.i18n.I18nManager') end end \ No newline at end of file -- 2.39.5