]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10288 move ConfigurationProvider from sonar-core to sonar-server
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 16 Jan 2018 09:12:25 +0000 (10:12 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Thu, 25 Jan 2018 16:23:10 +0000 (17:23 +0100)
because this class is server and ce specific

server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
server/sonar-server/src/main/java/org/sonar/server/config/ConfigurationProvider.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/config/package-info.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
server/sonar-server/src/test/java/org/sonar/server/es/EsTester.java
sonar-core/src/main/java/org/sonar/core/config/ConfigurationProvider.java [deleted file]

index 8c0b8822e7fa835fafebc8c38171a65e332a6a74..8bfa11684ca707d9b01a5a4fc4a5ce1fd495cac9 100644 (file)
@@ -59,7 +59,7 @@ import org.sonar.ce.taskprocessor.CeProcessingScheduler;
 import org.sonar.ce.taskprocessor.CeTaskProcessorModule;
 import org.sonar.ce.user.CeUserSession;
 import org.sonar.core.component.DefaultResourceTypes;
-import org.sonar.core.config.ConfigurationProvider;
+import org.sonar.server.config.ConfigurationProvider;
 import org.sonar.core.config.CorePropertyDefinitions;
 import org.sonar.core.i18n.DefaultI18n;
 import org.sonar.core.i18n.RuleI18nManager;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/config/ConfigurationProvider.java b/server/sonar-server/src/main/java/org/sonar/server/config/ConfigurationProvider.java
new file mode 100644 (file)
index 0000000..f91bcdf
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.server.config;
+
+import java.util.Optional;
+import org.picocontainer.injectors.ProviderAdapter;
+import org.sonar.api.config.Configuration;
+import org.sonar.api.config.Settings;
+
+public class ConfigurationProvider extends ProviderAdapter {
+
+  private Configuration configuration;
+
+  public Configuration provide(Settings settings) {
+    if (configuration == null) {
+      configuration = new ServerConfigurationAdapter(settings);
+    }
+    return configuration;
+  }
+
+  private static class ServerConfigurationAdapter implements Configuration {
+    private final Settings settings;
+
+    private ServerConfigurationAdapter(Settings settings) {
+      this.settings = settings;
+    }
+
+    @Override
+    public Optional<String> get(String key) {
+      return Optional.ofNullable(settings.getString(key));
+    }
+
+    @Override
+    public boolean hasKey(String key) {
+      return settings.hasKey(key);
+    }
+
+    @Override
+    public String[] getStringArray(String key) {
+      return settings.getStringArray(key);
+    }
+
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/config/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/config/package-info.java
new file mode 100644 (file)
index 0000000..9197d0f
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.server.config;
+
+import javax.annotation.ParametersAreNonnullByDefault;
index d361e65f216109dd24b0d30b4009f735a80ff7b4..f86edc0e288a05fd9b5be9a2e0682b2d61890813 100644 (file)
@@ -29,7 +29,7 @@ import org.sonar.api.internal.SonarRuntimeImpl;
 import org.sonar.api.utils.System2;
 import org.sonar.api.utils.Version;
 import org.sonar.api.utils.internal.TempFolderCleaner;
-import org.sonar.core.config.ConfigurationProvider;
+import org.sonar.server.config.ConfigurationProvider;
 import org.sonar.core.config.CorePropertyDefinitions;
 import org.sonar.core.util.UuidFactoryImpl;
 import org.sonar.db.DBSessionsImpl;
index 5fb911aa508b0ddeb7802b63eeb703939085f021..de37c71955f7ef022e6ed62b135ec718b814eb84 100644 (file)
@@ -59,7 +59,7 @@ import org.sonar.api.config.internal.MapSettings;
 import org.sonar.api.utils.log.Logger;
 import org.sonar.api.utils.log.LoggerLevel;
 import org.sonar.api.utils.log.Loggers;
-import org.sonar.core.config.ConfigurationProvider;
+import org.sonar.server.config.ConfigurationProvider;
 import org.sonar.core.platform.ComponentContainer;
 import org.sonar.elasticsearch.test.EsTestCluster;
 import org.sonar.server.es.metadata.MetadataIndex;
diff --git a/sonar-core/src/main/java/org/sonar/core/config/ConfigurationProvider.java b/sonar-core/src/main/java/org/sonar/core/config/ConfigurationProvider.java
deleted file mode 100644 (file)
index 7605333..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2018 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.config;
-
-import org.picocontainer.injectors.ProviderAdapter;
-import org.sonar.api.config.Configuration;
-import org.sonar.api.config.Settings;
-import org.sonar.api.config.internal.ConfigurationBridge;
-
-public class ConfigurationProvider extends ProviderAdapter {
-
-  private Configuration configuration;
-
-  public Configuration provide(Settings settings) {
-    if (configuration == null) {
-      configuration = new ConfigurationBridge(settings);
-    }
-    return configuration;
-  }
-
-}