aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-11-03 17:18:06 +0000
committerGodin <mandrikov@gmail.com>2010-11-03 17:18:06 +0000
commit085e24b66e703f5609a974329603fe863d377f41 (patch)
treed1fe25f85e9a7bcf77e9b6929e130fee790cf062 /sonar-server
parent72864ce12eeb02dc9d199ee0edb4d62a4bb33240 (diff)
downloadsonarqube-085e24b66e703f5609a974329603fe863d377f41.tar.gz
sonarqube-085e24b66e703f5609a974329603fe863d377f41.zip
SONAR-1898: Instead of Plugin use PluginMetadata in ruby code
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/plugins/PluginDeployer.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java34
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb2
4 files changed, 19 insertions, 23 deletions
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 38030582443..afe8c52387b 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
@@ -298,4 +298,8 @@ public final class PluginDeployer implements ServerComponent {
throw new ServerStartException("Found plugin with empty key: " + plugin.getFilename());
}
}
+
+ public Collection<PluginMetadata> getPluginsMetadata() {
+ return pluginByKeys.values();
+ }
}
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 883f5e34b63..bba95c8fdc7 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
@@ -22,7 +22,6 @@ package org.sonar.server.ui;
import org.apache.commons.configuration.Configuration;
import org.picocontainer.PicoContainer;
import org.slf4j.LoggerFactory;
-import org.sonar.api.Plugin;
import org.sonar.api.Plugins;
import org.sonar.api.Property;
import org.sonar.api.ServerComponent;
@@ -32,11 +31,7 @@ import org.sonar.api.resources.Language;
import org.sonar.api.rules.DefaultRulesManager;
import org.sonar.api.rules.RuleRepository;
import org.sonar.api.utils.ValidationMessages;
-import org.sonar.api.web.Footer;
-import org.sonar.api.web.NavigationSection;
-import org.sonar.api.web.Page;
-import org.sonar.api.web.RubyRailsWebservice;
-import org.sonar.api.web.Widget;
+import org.sonar.api.web.*;
import org.sonar.jpa.dao.AsyncMeasuresService;
import org.sonar.jpa.dialect.Dialect;
import org.sonar.jpa.session.DatabaseConnector;
@@ -48,7 +43,6 @@ import org.sonar.server.filters.FilterExecutor;
import org.sonar.server.filters.FilterResult;
import org.sonar.server.platform.Platform;
import org.sonar.server.plugins.*;
-import org.sonar.server.plugins.UpdateCenterMatrix;
import org.sonar.server.rules.ProfilesConsole;
import org.sonar.server.rules.RulesConsole;
import org.sonar.updatecenter.common.Version;
@@ -63,7 +57,7 @@ public final class JRubyFacade implements ServerComponent {
}
/* UPDATE CENTER */
-
+
public void downloadPlugin(String pluginKey, String pluginVersion) {
getContainer().getComponent(PluginDownloader.class).download(pluginKey, Version.create(pluginVersion));
}
@@ -92,9 +86,20 @@ public final class JRubyFacade implements ServerComponent {
return getContainer().getComponent(UpdateCenterMatrixFactory.class).getMatrix(forceReload);
}
+ /* PLUGINS */
+ public Property[] getPluginProperties(PluginMetadata metadata) {
+ Plugins plugins = getContainer().getComponent(Plugins.class);
+ return plugins.getProperties(plugins.getPlugin(metadata.getKey()));
+ }
+ public boolean hasPlugin(String key) {
+ return getContainer().getComponent(Plugins.class).getPlugin(key) != null;
+ }
+ public Collection<PluginMetadata> getPluginsMetadata() {
+ return getContainer().getComponent(PluginDeployer.class).getPluginsMetadata();
+ }
public String colorizeCode(String code, String language) {
try {
@@ -118,7 +123,6 @@ public final class JRubyFacade implements ServerComponent {
return getContainer().getComponent(Views.class).getWidget(id);
}
-
public List<ViewProxy<Page>> getPages(String section, String resourceScope, String resourceQualifier, String resourceLanguage) {
return getContainer().getComponent(Views.class).getPages(section, resourceScope, resourceQualifier, resourceLanguage);
}
@@ -143,14 +147,6 @@ public final class JRubyFacade implements ServerComponent {
return getContainer().getComponent(DatabaseConnector.class).getDialect();
}
- public boolean hasPlugin(String key) {
- return getContainer().getComponent(Plugins.class).getPlugin(key) != null;
- }
-
- public Collection<Plugin> getPlugins() {
- return getContainer().getComponent(Plugins.class).getPlugins();
- }
-
/* PROFILES CONSOLE : RULES AND METRIC THRESHOLDS */
public List<RuleRepository> getRuleRepositories() {
@@ -217,10 +213,6 @@ public final class JRubyFacade implements ServerComponent {
getAsyncMeasuresService().deleteMeasure(asyncMeasureId);
}
- public Property[] getPluginProperties(Plugin plugin) {
- return getContainer().getComponent(Plugins.class).getProperties(plugin);
- }
-
private DefaultRulesManager getRulesManager() {
return getContainer().getComponent(DefaultRulesManager.class);
}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
index 766eb5135b0..42d98aaf49f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
@@ -34,7 +34,7 @@ class SettingsController < ApplicationController
resource_id=project.id
end
- plugins = java_facade.getPlugins()
+ plugins = java_facade.getPluginsMetadata()
plugins.each do |plugin|
properties=java_facade.getPluginProperties(plugin)
properties.each do |property|
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
index f47ce1da745..e4bc30eb961 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
@@ -21,7 +21,7 @@
</style>
<div id="plugins">
<% form_tag :controller => :settings, :action => :update do
- plugins = controller.java_facade.getPlugins().sort {|p1,p2| p1.getName() <=> p2.getName()}
+ plugins = controller.java_facade.getPluginsMetadata().sort {|p1,p2| p1.getName() <=> p2.getName()}
plugin_properties={}
plugins.each do |plugin|
properties = controller.java_facade.getPluginProperties(plugin).select do |property|