diff options
author | David Gageot <david@gageot.net> | 2012-09-24 13:38:18 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-09-24 13:49:03 +0200 |
commit | 7a0aa306e3971891f9e3bbb8bd1037d8d02f3516 (patch) | |
tree | 202d1eb9fefbbb96a97b7ceece8b48dda2094414 /sonar-server/src/main/java | |
parent | 58d867edbfa4c93538355237d1937b046c053e9a (diff) | |
download | sonarqube-7a0aa306e3971891f9e3bbb8bd1037d8d02f3516.tar.gz sonarqube-7a0aa306e3971891f9e3bbb8bd1037d8d02f3516.zip |
SONAR-3529 API: ability to define property sets
Diffstat (limited to 'sonar-server/src/main/java')
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/platform/Platform.java | 1 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/startup/RegisterPropertySets.java | 50 |
2 files changed, 51 insertions, 0 deletions
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 ed12de72e04..5f369ba3454 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 @@ -246,6 +246,7 @@ public final class Platform { startupContainer.addSingleton(GeneratePluginIndex.class); startupContainer.addSingleton(RegisterNewFilters.class); startupContainer.addSingleton(RegisterNewDashboards.class); + startupContainer.addSingleton(RegisterPropertySets.class); startupContainer.startComponents(); startupContainer.getComponentByType(ServerLifecycleNotifier.class).notifyStart(); diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterPropertySets.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterPropertySets.java new file mode 100644 index 00000000000..a3a19951391 --- /dev/null +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterPropertySets.java @@ -0,0 +1,50 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 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.ImmutableList; +import org.sonar.api.config.PropertySetDefinitions; +import org.sonar.api.config.PropertySetTemplate; +import org.sonar.api.utils.TimeProfiler; + +import java.util.List; + +/** + * @since 3.3 + */ +public final class RegisterPropertySets { + private final List<PropertySetTemplate> propertySetTemplates; + private final PropertySetDefinitions propertySetDefinitions; + + public RegisterPropertySets(PropertySetTemplate[] propertySetTemplates, PropertySetDefinitions propertySetDefinitions) { + this.propertySetTemplates = ImmutableList.copyOf(propertySetTemplates); + this.propertySetDefinitions = propertySetDefinitions; + } + + public void start() { + TimeProfiler profiler = new TimeProfiler().start("Register dashboards"); + + for (PropertySetTemplate template : propertySetTemplates) { + propertySetDefinitions.register(template.getName(), template.createPropertySet()); + } + + profiler.stop(); + } +} |