diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-06-10 11:31:50 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-06-10 11:31:50 +0200 |
commit | e9957c5d4049a2f8f39c83a6ff6a09e5fa333f7f (patch) | |
tree | 7d32bdda00aefce6f23684ab0b4f6bfaf6987017 | |
parent | d574f6dd70fefa9b2e9818c71ae58a51e934697c (diff) | |
download | sonarqube-e9957c5d4049a2f8f39c83a6ff6a09e5fa333f7f.tar.gz sonarqube-e9957c5d4049a2f8f39c83a6ff6a09e5fa333f7f.zip |
SONAR-2507 remove the tables PLUGINS and PLUGIN_FILES
11 files changed, 70 insertions, 110 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java index 25351acce12..b0251fe3da3 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java +++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java @@ -40,7 +40,7 @@ public class SchemaMigration { - complete the Derby DDL file used for unit tests : sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl */ - public static final int LAST_VERSION = 202; + public static final int LAST_VERSION = 203; public final static String TABLE_NAME = "schema_migrations"; diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb index 329d681338c..f1238105afb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/updatecenter_controller.rb @@ -28,12 +28,14 @@ class Api::UpdatecenterController < Api::ApiController # def installed_plugins respond_to do |format| - format.json { render :json => jsonp(plugins_to_json(Plugin.user_plugins)) } - format.xml { render :xml => plugins_to_xml(Plugin.user_plugins) } + format.json { render :json => jsonp(plugins_to_json(user_plugins())) } + format.xml { render :xml => plugins_to_xml(user_plugins()) } format.text { render :text => text_not_supported } end end + private + def plugins_to_json(plugins=[]) json=[] plugins.each do |p| @@ -44,9 +46,9 @@ class Api::UpdatecenterController < Api::ApiController def plugin_to_json(plugin) hash={} - hash['key']=plugin.plugin_key - hash['name']=plugin.name - hash['version']=plugin.version || '-' + hash['key']=plugin.getKey() + hash['name']=plugin.getName() + hash['version']=plugin.getVersion() || '-' hash end @@ -54,11 +56,15 @@ class Api::UpdatecenterController < Api::ApiController xml.plugins do plugins.each do |plugin| xml.plugin do - xml.key(plugin.plugin_key) - xml.name(plugin.name) - xml.version(plugin.version || '-') + xml.key(plugin.getKey()) + xml.name(plugin.getName()) + xml.version(plugin.getVersion() || '-') end end end end + + def user_plugins + java_facade.getPluginsMetadata().select{|plugin| !plugin.isCore()}.sort + end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb index 6a185e26f5e..e74eb71b56d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/updatecenter_controller.rb @@ -29,8 +29,8 @@ class UpdatecenterController < ApplicationController @uninstalls=java_facade.getPluginUninstalls() @downloads=java_facade.getPluginDownloads() - @user_plugins=Plugin.user_plugins - @core_plugins=Plugin.core_plugins + @user_plugins=user_plugins() + @core_plugins=core_plugins() end def updates @@ -43,8 +43,8 @@ class UpdatecenterController < ApplicationController @user_plugins={} @last_compatible={} - Plugin.user_plugins.each do |plugin| - @user_plugins[plugin.plugin_key]=plugin.version + user_plugins.each do |plugin| + @user_plugins[plugin.getKey()]=plugin.getVersion() end load_matrix() @@ -142,4 +142,12 @@ class UpdatecenterController < ApplicationController redirect_to home_url end end + + def user_plugins + java_facade.getPluginsMetadata().select{|plugin| !plugin.isCore()}.sort + end + + def core_plugins + java_facade.getPluginsMetadata().select{|plugin| plugin.isCore()}.sort + end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/plugin.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/plugin.rb deleted file mode 100644 index ec7bd9d7ff3..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/plugin.rb +++ /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 -# -class Plugin < ActiveRecord::Base - - has_many :files, :class_name => 'PluginFile' - - def self.plugins - find(:all, :order => 'name') - end - - def self.user_plugins - find(:all, :conditions => {:core => false}, :order => 'name') - end - - def self.core_plugins - find(:all, :conditions => {:core => true}, :order => 'name') - end -end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/system/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/system/index.html.erb index 4b8ebcd9cad..8d99bb71e55 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/system/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/system/index.html.erb @@ -14,7 +14,6 @@ <% @server.system_info.each do |data| %> <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'system' } %> <% end %> -</thead> <tbody> </table> @@ -30,7 +29,6 @@ <% @server.sonar_info.each do |data| %> <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'sonar' } %> <% end %> -</thead> <tbody> </table> @@ -46,7 +44,6 @@ <% @server.system_statistics.each do |data| %> <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'memory' } %> <% end %> -</thead> <tbody> </table> @@ -59,10 +56,16 @@ </tr> </thead> <tbody> - <% @server.sonar_plugins.each do |data| %> - <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'plugins' } %> - <% end %> -</thead> + <% + user_plugins=@server.sonar_plugins + if user_plugins.empty? + %> + <tr><td colspan="2" class="even">None</td></tr> + <% else %> + <% user_plugins.each do |data| %> + <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'plugins' } %> + <% end %> + <% end %> <tbody> </table> @@ -78,6 +81,5 @@ <% @server.system_properties.each do |data| %> <%= render :partial => 'row', :locals => {:title => data[0], :value => data[1], :name => 'system_properties' } %> <% end %> -</thead> <tbody> </table> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb index d82ea22a0c1..add8e887402 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/updatecenter/index.html.erb @@ -19,31 +19,31 @@ <% else @user_plugins.each do |plugin| %> - <tr class="select <%= cycle('even', 'odd', :name => 'user') -%>" id="select_<%= plugin.plugin_key -%>"> - <td width="1%" nowrap><b><a href="#plugin" onclick="showPlugin('<%= plugin.plugin_key -%>')"><%= h(plugin.name) -%></a></b></td> - <td><%= plugin.version || '-' -%></td> + <tr class="select <%= cycle('even', 'odd', :name => 'user') -%>" id="select_<%= plugin.getKey() -%>"> + <td width="1%" nowrap><b><a href="#plugin" onclick="showPlugin('<%= plugin.getKey() -%>')"><%= h(plugin.getName()) -%></a></b></td> + <td><%= plugin.getVersion() || '-' -%></td> <td> - <%= plugin.description -%> + <%= plugin.getDescription() -%> - <div id="detail-<%= plugin.plugin_key -%>" style="display:none"> + <div id="detail-<%= plugin.getKey() -%>" style="display:none"> <table class="spaced width100"> - <% if plugin.license %><tr><td class="thin nowrap"><b>License:</b> </td><td><%= plugin.license -%></td></tr><% end %> - <% if plugin.organization %> + <% if plugin.getLicense() %><tr><td class="thin nowrap"><b>License:</b> </td><td><%= plugin.getLicense() -%></td></tr><% end %> + <% if plugin.getOrganization() %> <tr><td class="thin nowrap"><b>Author:</b> </td> - <td><%= link_to_if plugin.organization_url, plugin.organization, plugin.organization_url, :class=>'external' -%></td> + <td><%= link_to_if plugin.getOrganizationUrl(), plugin.getOrganization(), plugin.getOrganizationUrl(), :class=>'external' -%></td> </tr> <% end %> - <% if plugin.homepage %> + <% if plugin.getHomepage() %> <tr> <td colspan="2"> - <%= link_to 'Homepage', plugin.homepage, :class => 'external' -%> + <%= link_to 'Homepage', plugin.getHomepage(), :class => 'external' -%> </td> </tr> <% end %> <tr> <td colspan="2"> - <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/uninstall?key=<%= plugin.plugin_key -%>" style="display: inline-block"> + <form method="post" action="<%= ApplicationController.root_context -%>/updatecenter/uninstall?key=<%= plugin.getKey() -%>" style="display: inline-block"> <input type="submit" value="Uninstall"></input> </form> </td> @@ -67,9 +67,9 @@ <% @core_plugins.each do |plugin| %> - <tr class="<%= cycle('even','odd', :name => 'core') -%>" id="<%= u plugin.plugin_key -%>"> - <td width="1%" nowrap><b><%= plugin.name -%></b></td> - <td><%= plugin.description %></td> + <tr class="<%= cycle('even','odd', :name => 'core') -%>" id="<%= u plugin.getKey() -%>"> + <td width="1%" nowrap><b><%= plugin.getName() -%></b></td> + <td><%= plugin.getDescription() -%></td> </tr> <% end %> </tbody> diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/150_add_plugins_child_first_classloader_column.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/150_add_plugins_child_first_classloader_column.rb index 7fa69e9f69f..da82d3df44b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/150_add_plugins_child_first_classloader_column.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/150_add_plugins_child_first_classloader_column.rb @@ -24,9 +24,10 @@ class AddPluginsChildFirstClassloaderColumn < ActiveRecord::Migration def self.up - add_column 'plugins', 'child_first_classloader', :boolean, :null => true - Plugin.reset_column_information - Plugin.update_all(Plugin.sanitize_sql_for_assignment({:child_first_classloader=>false})) + # this table has been removed in 2.9 (see migration 203) + #add_column 'plugins', 'child_first_classloader', :boolean, :null => true + #Plugin.reset_column_information + #Plugin.update_all(Plugin.sanitize_sql_for_assignment({:child_first_classloader=>false})) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/181_add_plugin_base.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/181_add_plugin_base.rb index 14a9eab96ab..e2f925d0101 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/181_add_plugin_base.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/181_add_plugin_base.rb @@ -24,8 +24,9 @@ class AddPluginBase < ActiveRecord::Migration def self.up - add_column 'plugins', 'base_plugin', :string, :limit => 100, :null => true - Plugin.reset_column_information + # this table has been removed in 2.9 (see migration 203) + #add_column 'plugins', 'base_plugin', :string, :limit => 100, :null => true + #Plugin.reset_column_information end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/plugin_file.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/203_drop_plugin_tables.rb index e4104850b13..2164b934387 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/plugin_file.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/203_drop_plugin_tables.rb @@ -1,5 +1,5 @@ # -# Sonar, open source software quality management tool. +# Sonar, entreprise quality control tool. # Copyright (C) 2008-2011 SonarSource # mailto:contact AT sonarsource DOT com # @@ -17,6 +17,15 @@ # License along with Sonar; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 # -class PluginFile < ActiveRecord::Base - belongs_to :plugin + +# +# Sonar 2.9 +# +class DropPluginTables < ActiveRecord::Migration + + def self.up + drop_table('plugins') + drop_table('plugin_files') + end + end diff --git a/sonar-server/src/test/resources/org/sonar/server/plugins/PluginDeployerTest/shared.xml b/sonar-server/src/test/resources/org/sonar/server/plugins/PluginDeployerTest/shared.xml deleted file mode 100644 index 4da07d4db48..00000000000 --- a/sonar-server/src/test/resources/org/sonar/server/plugins/PluginDeployerTest/shared.xml +++ /dev/null @@ -1,7 +0,0 @@ -<dataset> - <plugins id="1" name="Checkstyle" plugin_key="checkstyle" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]" - description="[null]" installation_date="[null]" plugin_class="[null]" core="true" version="2.2" /> - - <plugin_files id="1" plugin_id="1" filename="checkstyle-plugin.jar"/> - -</dataset>
\ No newline at end of file diff --git a/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl b/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl index d27879bd1aa..b90fec13f8e 100644 --- a/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl +++ b/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl @@ -253,31 +253,6 @@ create table PARAMETERS ( primary key (id) ); -create table PLUGINS ( - ID INTEGER not null, - PLUGIN_KEY VARCHAR(100), - VERSION VARCHAR(100), - NAME VARCHAR(100), - DESCRIPTION VARCHAR(3000), - ORGANIZATION VARCHAR(100), - ORGANIZATION_URL VARCHAR(500), - LICENSE VARCHAR(50), - INSTALLATION_DATE TIMESTAMP, - PLUGIN_CLASS VARCHAR(100), - HOMEPAGE VARCHAR(500), - CORE SMALLINT, - CHILD_FIRST_CLASSLOADER SMALLINT, - BASE_PLUGIN VARCHAR(100), - primary key (id) -); - -create table PLUGIN_FILES ( - ID INTEGER not null, - PLUGIN_ID INTEGER, - FILENAME VARCHAR(100), - primary key (id) -); - create table PROJECTS ( ID INTEGER not null, NAME VARCHAR(256), |