summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/Backup.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java7
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java2
5 files changed, 13 insertions, 2 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java b/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java
index b1cc6b5502b..cc2c6f15209 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/Backup.java
@@ -28,6 +28,7 @@ import com.thoughtworks.xstream.io.xml.XppDriver;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.CharEncoding;
import org.apache.commons.lang.StringUtils;
+import org.slf4j.LoggerFactory;
import org.sonar.api.database.DatabaseSession;
import org.sonar.jpa.entity.SchemaMigration;
@@ -107,6 +108,7 @@ public class Backup {
try {
startDb();
doImportXml(xml);
+ LoggerFactory.getLogger(getClass()).info("Backup restored");
} finally {
stopDb();
}
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java
index d4859c546d3..7e16923a48b 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/MetricsBackup.java
@@ -25,6 +25,7 @@ import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.converters.UnmarshallingContext;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import org.slf4j.LoggerFactory;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.measures.Metric;
import org.sonar.jpa.dao.MeasuresDao;
@@ -52,16 +53,18 @@ public class MetricsBackup implements Backupable {
}
public void importXml(SonarConfig sonarConfig) {
- disabledUserDefinedMetrics();
+ disableUserDefinedMetrics();
registerMetrics(sonarConfig);
}
- protected void disabledUserDefinedMetrics() {
+ protected void disableUserDefinedMetrics() {
+ LoggerFactory.getLogger(getClass()).info("Disable user-defined metrics");
Collection<Metric> dbMetrics = measuresDao.getUserDefinedMetrics();
measuresDao.disabledMetrics(dbMetrics);
}
protected void registerMetrics(SonarConfig sonarConfig) {
+ LoggerFactory.getLogger(getClass()).info("Restore metrics");
Collection<Metric> newMetrics = sonarConfig.getMetrics();
measuresDao.registerMetrics(newMetrics);
}
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java
index daea84804a5..2e5493f70a8 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java
@@ -77,11 +77,13 @@ public class ProfilesBackup implements Backupable {
public void importXml(SonarConfig sonarConfig) {
if (CollectionUtils.isNotEmpty(sonarConfig.getProfiles())) {
+ LoggerFactory.getLogger(getClass()).info("Delete profiles");
ProfilesManager profilesManager = new ProfilesManager(session, null);
profilesManager.deleteAllProfiles();
RulesDao rulesDao = new RulesDao(session);
for (RulesProfile profile : sonarConfig.getProfiles()) {
+ LoggerFactory.getLogger(getClass()).info("Restore profile " + profile.getName());
importProfile(rulesDao, profile);
}
}
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java
index 5b8dbc943f3..d73d3b46151 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/PropertiesBackup.java
@@ -21,6 +21,7 @@ package org.sonar.server.configuration;
import com.thoughtworks.xstream.XStream;
import org.apache.commons.collections.CollectionUtils;
+import org.slf4j.LoggerFactory;
import org.sonar.api.database.DatabaseSession;
import org.sonar.api.database.configuration.Property;
@@ -49,6 +50,7 @@ public class PropertiesBackup implements Backupable {
}
public void importXml(SonarConfig sonarConfig) {
+ LoggerFactory.getLogger(getClass()).info("Restore properties");
clearProperties();
if (CollectionUtils.isNotEmpty(sonarConfig.getProperties())) {
diff --git a/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java b/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java
index 955ceeca8bb..8e1423a881e 100644
--- a/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java
+++ b/sonar-server/src/main/java/org/sonar/server/configuration/RulesBackup.java
@@ -78,6 +78,7 @@ public class RulesBackup implements Backupable {
}
private void disableUserRules() {
+ LoggerFactory.getLogger(getClass()).info("Disable rules created by user");
for (Rule rule : getUserRules()) {
rule.setEnabled(false);
session.save(rule);
@@ -85,6 +86,7 @@ public class RulesBackup implements Backupable {
}
private void registerUserRules(Collection<Rule> rules) {
+ LoggerFactory.getLogger(getClass()).info("Restore rules");
for (Rule rule : rules) {
Rule parent = rule.getParent();
Rule matchingParentRuleInDb = rulesDao.getRuleByKey(parent.getRepositoryKey(), parent.getKey());