aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-10-05 00:44:37 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-10-07 13:36:25 +0200
commitef5bf7fdece84e5a52c8d478c8a733ecdf4d57f1 (patch)
treec64a8a041183379e92fbc81becc77af07c9b38e3 /sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java
parent3174a29201e922db758b51f4b693ca131e7037ec (diff)
downloadsonarqube-ef5bf7fdece84e5a52c8d478c8a733ecdf4d57f1.tar.gz
sonarqube-ef5bf7fdece84e5a52c8d478c8a733ecdf4d57f1.zip
SONAR-2861 New Configuration API
The component org.apache.commons.Configuration is still available but plugins should use org.sonar.api.config.Settings. It also implies the following issues : SONAR-2870 do not rebuild the WAR file when editing sonar.properties SONAR-2869 allow to use the annotations @Properties/@Property on extensions
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java b/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java
index 97dae9df62f..fcd0951dd52 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/ServerMetadata.java
@@ -19,10 +19,10 @@
*/
package org.sonar.batch;
-import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
+import org.sonar.api.config.Settings;
import org.sonar.api.platform.Server;
import java.text.ParseException;
@@ -31,22 +31,22 @@ import java.util.Date;
public class ServerMetadata extends Server {
- private Configuration conf;
+ private Settings settings;
- public ServerMetadata(Configuration conf) {
- this.conf = conf;
+ public ServerMetadata(Settings settings) {
+ this.settings = settings;
}
public String getId() {
- return conf.getString(CoreProperties.SERVER_ID);
+ return settings.getString(CoreProperties.SERVER_ID);
}
public String getVersion() {
- return conf.getString(CoreProperties.SERVER_VERSION);
+ return settings.getString(CoreProperties.SERVER_VERSION);
}
public Date getStartedAt() {
- String dateString = conf.getString(CoreProperties.SERVER_STARTTIME);
+ String dateString = settings.getString(CoreProperties.SERVER_STARTTIME);
if (dateString != null) {
try {
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse(dateString);
@@ -59,11 +59,11 @@ public class ServerMetadata extends Server {
}
public String getURL() {
- return StringUtils.removeEnd(conf.getString("sonar.host.url", "http://localhost:9000"), "/");
+ return StringUtils.removeEnd(StringUtils.defaultIfBlank(settings.getString("sonar.host.url"), "http://localhost:9000"), "/");
}
@Override
public String getPermanentServerId() {
- return conf.getString(CoreProperties.PERMANENT_SERVER_ID);
+ return settings.getString(CoreProperties.PERMANENT_SERVER_ID);
}
}