Skip to content

Commit

Permalink
Revert merge to d70f025
Browse files Browse the repository at this point in the history
  • Loading branch information
dbmeneses committed Jun 23, 2015
1 parent 8b38a0e commit 299cecc
Show file tree
Hide file tree
Showing 41 changed files with 413 additions and 1,601 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -1091,9 +1091,9 @@
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.sonarsource</groupId>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-persistit</artifactId>
<version>3.3.2</version>
<version>3.3.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
Expand Down
Expand Up @@ -44,4 +44,5 @@ public TempFolder provide(ServerFileSystem fs) {
}
return tempFolder;
}

}
2 changes: 1 addition & 1 deletion sonar-batch/pom.xml
Expand Up @@ -25,7 +25,7 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource</groupId>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-persistit</artifactId>
</dependency>
<dependency>
Expand Down
Expand Up @@ -19,16 +19,14 @@
*/
package org.sonar.batch.bootstrap;

import org.sonar.batch.index.CachesManager;

import java.util.List;
import java.util.Map;

import org.sonar.api.CoreProperties;
import org.sonar.api.Plugin;
import org.sonar.api.utils.Durations;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.UriReader;
import org.sonar.api.utils.internal.TempFolderCleaner;
import org.sonar.batch.components.PastSnapshotFinder;
import org.sonar.batch.deprecated.components.PastSnapshotFinderByDate;
import org.sonar.batch.deprecated.components.PastSnapshotFinderByDays;
Expand Down Expand Up @@ -66,14 +64,13 @@
public class GlobalContainer extends ComponentContainer {

private final Map<String, String> bootstrapProperties;
private PersistentCacheProvider persistentCacheProvider;

private GlobalContainer(Map<String, String> bootstrapProperties) {
super();
this.bootstrapProperties = bootstrapProperties;
}

public static GlobalContainer create(Map<String, String> bootstrapProperties, List<?> extensions) {
public static GlobalContainer create(Map<String, String> bootstrapProperties, List extensions) {
GlobalContainer container = new GlobalContainer(bootstrapProperties);
container.add(extensions);
return container;
Expand All @@ -92,8 +89,6 @@ protected void doBeforeStart() {
}

private void addBootstrapComponents() {
persistentCacheProvider = new PersistentCacheProvider();

add(
// plugins
BatchPluginRepository.class,
Expand All @@ -103,16 +98,16 @@ private void addBootstrapComponents() {
BatchPluginPredicate.class,
ExtensionInstaller.class,

CachesManager.class,
GlobalSettings.class,
ServerClient.class,
Logback.class,
DefaultServer.class,
new TempFolderProvider(),
TempFolderCleaner.class,
DefaultHttpDownloader.class,
UriReader.class,
new FileCacheProvider(),
persistentCacheProvider,
new PersistentCacheProvider(),
System2.INSTANCE,
DefaultI18n.class,
Durations.class,
Expand All @@ -125,7 +120,7 @@ private void addBootstrapComponents() {
addIfMissing(DefaultServerLineHashesLoader.class, ServerLineHashesLoader.class);
}

public void addIfMissing(Object object, Class<?> objectType) {
public void addIfMissing(Object object, Class objectType) {
if (getComponentByType(objectType) == null) {
add(object);
}
Expand Down Expand Up @@ -167,7 +162,7 @@ private void installPlugins() {

public void executeAnalysis(Map<String, String> analysisProperties, Object... components) {
AnalysisProperties props = new AnalysisProperties(analysisProperties, this.getComponentByType(BootstrapProperties.class).property(CoreProperties.ENCRYPTION_SECRET_KEY_PATH));
persistentCacheProvider.reconfigure(props);
new ProjectScanContainer(this, props, components).execute();
}

}

This file was deleted.

Expand Up @@ -20,23 +20,27 @@
package org.sonar.batch.bootstrap;

import org.sonar.home.log.Slf4jLog;

import org.sonar.home.cache.PersistentCacheBuilder;
import org.picocontainer.injectors.ProviderAdapter;

import java.nio.file.Paths;
import java.util.Map;

import org.sonar.home.cache.PersistentCache;

public class PersistentCacheProvider extends ProviderAdapter {
private PersistentCache cache;

public PersistentCache provide(UserProperties props) {
public PersistentCache provide(BootstrapProperties props) {
if (cache == null) {
PersistentCacheBuilder builder = new PersistentCacheBuilder();

builder.setLog(new Slf4jLog(PersistentCache.class));
builder.forceUpdate(isForceUpdate(props.properties()));
String enableCache = props.property("sonar.enableHttpCache");

if (!"true".equals(enableCache)) {
builder.forceUpdate(true);
}

String home = props.property("sonar.userHome");
if (home != null) {
Expand All @@ -47,15 +51,4 @@ public PersistentCache provide(UserProperties props) {
}
return cache;
}

public void reconfigure(UserProperties props) {
if (cache != null) {
cache.reconfigure(isForceUpdate(props.properties()));
}
}

private static boolean isForceUpdate(Map<String, String> props) {
String enableCache = props.get("sonar.enableHttpCache");
return !"true".equals(enableCache);
}
}

This file was deleted.

0 comments on commit 299cecc

Please sign in to comment.