From ef7f70f77006c3650e5e6268ea62ffd42a1132d7 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 18 Jan 2017 20:40:48 +0100 Subject: [PATCH] Remove dead code in JRubyFacade --- .../java/org/sonar/server/ui/JRubyFacade.java | 35 ------------------- .../main/webapp/WEB-INF/app/models/issue.rb | 23 ------------ .../main/webapp/WEB-INF/app/models/project.rb | 7 ---- 3 files changed, 65 deletions(-) delete mode 100644 server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index c0b91fffef6..2bf2e38e9af 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -23,17 +23,14 @@ import java.sql.Connection; import java.util.Collection; import java.util.Date; import java.util.List; -import java.util.Map; import java.util.Optional; import javax.annotation.Nullable; import org.sonar.api.Plugin; import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; -import org.sonar.api.platform.NewUserHandler; import org.sonar.api.resources.Language; import org.sonar.api.resources.ResourceType; import org.sonar.api.resources.ResourceTypes; -import org.sonar.api.server.authentication.IdentityProvider; import org.sonar.api.utils.log.Loggers; import org.sonar.api.web.RubyRailsWebservice; import org.sonar.core.platform.ComponentContainer; @@ -46,14 +43,12 @@ import org.sonar.db.DbSession; import org.sonar.db.property.PropertiesDao; import org.sonar.db.property.PropertyDto; import org.sonar.process.ProcessProperties; -import org.sonar.server.authentication.IdentityProviderRepository; import org.sonar.server.component.ComponentCleanerService; import org.sonar.server.platform.PersistentSettings; import org.sonar.server.platform.Platform; import org.sonar.server.platform.db.migration.DatabaseMigrationState; import org.sonar.server.platform.db.migration.version.DatabaseVersion; import org.sonar.server.platform.ws.UpgradesAction; -import org.sonar.server.user.NewUserNotifier; import static com.google.common.collect.Lists.newArrayList; import static org.sonar.server.platform.db.migration.DatabaseMigrationState.Status; @@ -74,10 +69,6 @@ public final class JRubyFacade { return get(ResourceTypes.class).getAllOrdered(); } - public Collection getResourceRootTypes() { - return get(ResourceTypes.class).getRoots(); - } - public ResourceType getResourceType(String qualifier) { return get(ResourceTypes.class).get(qualifier); } @@ -161,15 +152,6 @@ public final class JRubyFacade { } } - public Object getCoreComponentByClassname(String className) { - try { - return get(Class.forName(className)); - } catch (ClassNotFoundException e) { - Loggers.get(getClass()).error("Component not found: " + className, e); - return null; - } - } - public Object getComponentByClassname(String pluginKey, String className) { Plugin plugin = get(PluginRepository.class).getPluginInstance(pluginKey); try { @@ -212,19 +194,6 @@ public final class JRubyFacade { return Platform.getInstance().getContainer(); } - // USERS - public void onNewUser(Map fields) { - NewUserNotifier notifier = get(NewUserNotifier.class); - // notifier is null when creating the administrator in the migration script 011. - if (notifier != null) { - notifier.onNewUser(NewUserHandler.Context.builder() - .setLogin(fields.get("login")) - .setName(fields.get("name")) - .setEmail(fields.get("email")) - .build()); - } - } - public String getPeriodLabel(int periodIndex) { return get(Periods.class).label(periodIndex); } @@ -275,8 +244,4 @@ public final class JRubyFacade { return !database.getDialect().supportsMigration(); } - public List getIdentityProviders() { - return get(IdentityProviderRepository.class).getAllEnabledAndSorted(); - } - } diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb deleted file mode 100644 index a763d0fdedc..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/issue.rb +++ /dev/null @@ -1,23 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2016 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube 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. -# -# SonarQube 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 this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - -class Issue - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb index 1714fd28d42..f395c802aa5 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb @@ -47,13 +47,6 @@ class Project < ActiveRecord::Base end end - def self.root_qualifiers() - @root_types ||= - begin - Java::OrgSonarServerUi::JRubyFacade.getInstance().getResourceRootTypes().map {|type| type.getQualifier()} - end - end - def project root||self end -- 2.39.5