aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2013-01-29 09:51:25 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2013-01-29 09:51:25 +0100
commit62806519276a867d5f243f18fc5e8b12e34f5b69 (patch)
tree6a7678d560052c5043f189c48cdc21957cc2f50f /sonar-batch
parentcc8788c9ea25a29e55aadab81d3468c9ee74c9aa (diff)
downloadsonarqube-62806519276a867d5f243f18fc5e8b12e34f5b69.tar.gz
sonarqube-62806519276a867d5f243f18fc5e8b12e34f5b69.zip
SONAR-2501 refactor BeanGraph layer
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskModule.java12
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java8
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java4
4 files changed, 16 insertions, 16 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskModule.java
index 76f1df54be8..28d31500a82 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskModule.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/TaskModule.java
@@ -48,9 +48,9 @@ import org.sonar.batch.index.MemoryOptimizer;
import org.sonar.batch.index.SourcePersister;
import org.sonar.batch.tasks.InspectionTask;
import org.sonar.batch.tasks.ListTasksTask;
-import org.sonar.core.component.ComponentGraph;
-import org.sonar.core.component.GraphStorage;
-import org.sonar.core.component.PerspectiveBuilders;
+import org.sonar.core.component.ScanGraph;
+import org.sonar.core.component.ScanGraphStore;
+import org.sonar.core.component.ScanPerspectives;
import org.sonar.core.i18n.I18nManager;
import org.sonar.core.i18n.RuleI18nManager;
import org.sonar.core.metric.CacheMetricFinder;
@@ -165,11 +165,11 @@ public class TaskModule extends Module {
container.addSingleton(DryRunDatabase.class);
// graphs
- container.addSingleton(ComponentGraph.class);
+ container.addSingleton(ScanGraph.create());
container.addSingleton(TestPlanBuilder.class);
container.addSingleton(TestableBuilder.class);
- container.addSingleton(PerspectiveBuilders.class);
- container.addSingleton(GraphStorage.class);
+ container.addSingleton(ScanPerspectives.class);
+ container.addSingleton(ScanGraphStore.class);
}
private void logSettings() {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java
index 2ad5f8a493d..26ac1277c22 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java
@@ -51,7 +51,7 @@ import org.sonar.batch.DefaultResourceCreationLock;
import org.sonar.batch.ProjectTree;
import org.sonar.batch.ResourceFilters;
import org.sonar.batch.ViolationFilters;
-import org.sonar.core.component.ComponentGraph;
+import org.sonar.core.component.ScanGraph;
import java.util.Collection;
import java.util.Collections;
@@ -70,7 +70,7 @@ public class DefaultIndex extends SonarIndex {
private PersistenceManager persistence;
private DefaultResourceCreationLock lock;
private MetricFinder metricFinder;
- private ComponentGraph graph;
+ private ScanGraph graph;
// filters
private ViolationFilters violationFilters;
@@ -84,7 +84,7 @@ public class DefaultIndex extends SonarIndex {
private Map<Resource, Map<Resource, Dependency>> incomingDependenciesByResource = Maps.newHashMap();
private ProjectTree projectTree;
- public DefaultIndex(PersistenceManager persistence, DefaultResourceCreationLock lock, ProjectTree projectTree, MetricFinder metricFinder, ComponentGraph graph) {
+ public DefaultIndex(PersistenceManager persistence, DefaultResourceCreationLock lock, ProjectTree projectTree, MetricFinder metricFinder, ScanGraph graph) {
this.persistence = persistence;
this.lock = lock;
this.projectTree = projectTree;
@@ -558,7 +558,7 @@ public class DefaultIndex extends SonarIndex {
if (!excluded) {
Snapshot snapshot = persistence.saveResource(currentProject, resource, (parentBucket != null ? parentBucket.getResource() : null));
if (ResourceUtils.isPersistable(resource) && !Qualifiers.LIBRARY.equals(resource.getQualifier())) {
- graph.createComponent(resource, snapshot);
+ graph.addComponent(resource, snapshot);
}
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java b/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java
index 080542eb5fe..489cdd075bd 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/phases/Phases.java
@@ -25,7 +25,7 @@ import org.sonar.api.resources.Project;
import org.sonar.batch.events.EventBus;
import org.sonar.batch.index.DefaultIndex;
import org.sonar.batch.index.PersistenceManager;
-import org.sonar.core.component.GraphStorage;
+import org.sonar.core.component.ScanGraphStore;
import java.util.Collection;
@@ -49,14 +49,14 @@ public final class Phases {
private SensorContext sensorContext;
private DefaultIndex index;
private ProjectInitializer pi;
- private GraphStorage graphStorage;
+ private ScanGraphStore graphStorage;
public Phases(DecoratorsExecutor decoratorsExecutor, MavenPhaseExecutor mavenPhaseExecutor,
MavenPluginsConfigurator mavenPluginsConfigurator, InitializersExecutor initializersExecutor,
PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor,
PersistenceManager persistenceManager, SensorContext sensorContext, DefaultIndex index,
EventBus eventBus, UpdateStatusJob updateStatusJob, ProjectInitializer pi,
- GraphStorage graphStorage) {
+ ScanGraphStore graphStorage) {
this.decoratorsExecutor = decoratorsExecutor;
this.mavenPhaseExecutor = mavenPhaseExecutor;
this.mavenPluginsConfigurator = mavenPluginsConfigurator;
@@ -76,7 +76,7 @@ public final class Phases {
MavenPluginsConfigurator mavenPluginsConfigurator, InitializersExecutor initializersExecutor,
PostJobsExecutor postJobsExecutor, SensorsExecutor sensorsExecutor,
PersistenceManager persistenceManager, SensorContext sensorContext, DefaultIndex index,
- EventBus eventBus, ProjectInitializer pi, GraphStorage graphStorage) {
+ EventBus eventBus, ProjectInitializer pi, ScanGraphStore graphStorage) {
this(decoratorsExecutor, mavenPhaseExecutor, mavenPluginsConfigurator, initializersExecutor, postJobsExecutor,
sensorsExecutor, persistenceManager, sensorContext, index, eventBus, null, pi, graphStorage);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java
index 75b06ac0fb9..87cb9361e11 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/DefaultIndexTest.java
@@ -52,7 +52,7 @@ import org.sonar.batch.DefaultResourceCreationLock;
import org.sonar.batch.ProjectTree;
import org.sonar.batch.ResourceFilters;
import org.sonar.batch.ViolationFilters;
-import org.sonar.core.component.ComponentGraph;
+import org.sonar.core.component.ScanGraph;
public class DefaultIndexTest {
@@ -66,7 +66,7 @@ public class DefaultIndexTest {
MetricFinder metricFinder = mock(MetricFinder.class);
when(metricFinder.findByKey("ncloc")).thenReturn(CoreMetrics.NCLOC);
- index = new DefaultIndex(mock(PersistenceManager.class), lock, mock(ProjectTree.class), metricFinder, mock(ComponentGraph.class));
+ index = new DefaultIndex(mock(PersistenceManager.class), lock, mock(ProjectTree.class), metricFinder, mock(ScanGraph.class));
Project project = new Project("project");
ResourceFilter filter = new ResourceFilter() {