diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2019-05-16 12:36:17 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-05-21 20:21:07 +0200 |
commit | dfcb1c01a430cf3317d12ff4448fc700b9979d4f (patch) | |
tree | 07a32c098cc59661abf85ff15bdff909e2cfd4b0 /sonar-core/src/main | |
parent | 42aa152b7b174ce55796b8b00758d1fe63643cb7 (diff) | |
download | sonarqube-dfcb1c01a430cf3317d12ff4448fc700b9979d4f.tar.gz sonarqube-dfcb1c01a430cf3317d12ff4448fc700b9979d4f.zip |
SONAR-11720 Set different memory defaults for EE+
Diffstat (limited to 'sonar-core/src/main')
3 files changed, 46 insertions, 9 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtension.java b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtension.java index 16541f4122d..1be315494cf 100644 --- a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtension.java +++ b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtension.java @@ -19,7 +19,9 @@ */ package org.sonar.core.extension; +import com.google.common.collect.ImmutableMap; import java.util.Collection; +import java.util.Map; import org.sonar.api.SonarRuntime; import org.sonar.api.config.Configuration; @@ -51,4 +53,12 @@ public interface CoreExtension { } void load(Context context); + + /** + * Properties with (optionally) default values defined by the extension. + * @return map of property names as keys and property default value as values + */ + default Map<String, String> getExtensionProperties() { + return ImmutableMap.of(); + } } diff --git a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java index 41866c16a34..c571b349fab 100644 --- a/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java +++ b/sonar-core/src/main/java/org/sonar/core/extension/CoreExtensionsLoader.java @@ -19,9 +19,7 @@ */ package org.sonar.core.extension; -import com.google.common.collect.ImmutableSet; import java.util.Map; -import java.util.ServiceLoader; import java.util.Set; import java.util.stream.Collectors; import org.sonar.api.utils.log.Logger; @@ -70,11 +68,4 @@ public class CoreExtensionsLoader { "Multiple core extensions declare the following names: %s", duplicatedNames.stream().sorted().collect(Collectors.joining(", "))); } - - static class ServiceLoaderWrapper { - Set<CoreExtension> load(ClassLoader classLoader) { - ServiceLoader<CoreExtension> loader = ServiceLoader.load(CoreExtension.class, classLoader); - return ImmutableSet.copyOf(loader.iterator()); - } - } } diff --git a/sonar-core/src/main/java/org/sonar/core/extension/ServiceLoaderWrapper.java b/sonar-core/src/main/java/org/sonar/core/extension/ServiceLoaderWrapper.java new file mode 100644 index 00000000000..f2770a9d68c --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/extension/ServiceLoaderWrapper.java @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program 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. + * + * This program 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. + */ +package org.sonar.core.extension; + +import com.google.common.collect.ImmutableSet; +import java.util.ServiceLoader; +import java.util.Set; +import javax.annotation.Nullable; + +public class ServiceLoaderWrapper { + public Set<CoreExtension> load(@Nullable ClassLoader classLoader) { + ServiceLoader<CoreExtension> loader = ServiceLoader.load(CoreExtension.class, classLoader); + return ImmutableSet.copyOf(loader.iterator()); + } + + public Set<CoreExtension> load() { + return load(null); + } +} |