org.sonar.batch.index
Class DefaultIndex

java.lang.Object
  extended by org.sonar.api.batch.SonarIndex
      extended by org.sonar.batch.index.DefaultIndex
All Implemented Interfaces:
org.sonar.graph.DirectedGraphAccessor<Resource,Dependency>

public class DefaultIndex
extends SonarIndex


Constructor Summary
DefaultIndex(PersistenceManager persistence, ProjectTree projectTree, MetricFinder metricFinder, ScanGraph graph, DeprecatedViolations deprecatedViolations, ResourceKeyMigration migration, MeasureCache measureCache)
           
 
Method Summary
 Dependency addDependency(Dependency dependency)
           
 Event addEvent(Resource resource, String name, String description, String category, Date date)
           
 void addLink(ProjectLink link)
           
 Measure addMeasure(Resource resource, Measure measure)
           
 Resource addResource(Resource resource)
          Does nothing if the resource is already registered.
 void addViolation(Violation violation, boolean force)
           
 void clear()
          Keep only project stuff
 void deleteEvent(Event event)
           
 void deleteLink(String key)
           
 List<Resource> getChildren(Resource resource)
           
 Set<Dependency> getDependencies()
           
 Dependency getEdge(Resource from, Resource to)
           
 List<Event> getEvents(Resource resource)
           
 Collection<Dependency> getIncomingEdges(Resource to)
           
 Measure getMeasure(Resource resource, Metric<?> metric)
           
<M> M
getMeasures(Resource resource, MeasuresFilter<M> filter)
           
 Collection<Dependency> getOutgoingEdges(Resource from)
           
 Resource getParent(Resource resource)
           
 Project getProject()
           
<R extends Resource>
R
getResource(R reference)
           
 String getSource(Resource resource)
           
 Set<Resource> getVertices()
           
 List<Violation> getViolations(ViolationQuery violationQuery)
          
 boolean hasEdge(Resource from, Resource to)
           
 boolean index(Resource resource)
           
 boolean index(Resource resource, Resource parentReference)
           
 boolean isExcluded(Resource reference)
           
 boolean isIndexed(Resource reference, boolean acceptExcluded)
           
 void setCurrentProject(Project project, ModuleIssues moduleIssues)
           
 void setSource(Resource reference, String source)
           
 void start()
           
 
Methods inherited from class org.sonar.api.batch.SonarIndex
addViolation, getIncomingDependencies, getOutgoingDependencies, getResources, getViolations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIndex

public DefaultIndex(PersistenceManager persistence,
                    ProjectTree projectTree,
                    MetricFinder metricFinder,
                    ScanGraph graph,
                    DeprecatedViolations deprecatedViolations,
                    ResourceKeyMigration migration,
                    MeasureCache measureCache)
Method Detail

start

public void start()

getProject

public Project getProject()
Specified by:
getProject in class SonarIndex

setCurrentProject

public void setCurrentProject(Project project,
                              ModuleIssues moduleIssues)

clear

public void clear()
Keep only project stuff


getMeasure

@CheckForNull
public Measure getMeasure(Resource resource,
                                       Metric<?> metric)
Specified by:
getMeasure in class SonarIndex

getMeasures

@CheckForNull
public <M> M getMeasures(Resource resource,
                                      MeasuresFilter<M> filter)
Specified by:
getMeasures in class SonarIndex

addMeasure

public Measure addMeasure(Resource resource,
                          Measure measure)
Specified by:
addMeasure in class SonarIndex

addDependency

public Dependency addDependency(Dependency dependency)
Specified by:
addDependency in class SonarIndex

getDependencies

public Set<Dependency> getDependencies()
Specified by:
getDependencies in class SonarIndex

getEdge

public Dependency getEdge(Resource from,
                          Resource to)

hasEdge

public boolean hasEdge(Resource from,
                       Resource to)

getVertices

public Set<Resource> getVertices()

getOutgoingEdges

public Collection<Dependency> getOutgoingEdges(Resource from)

getIncomingEdges

public Collection<Dependency> getIncomingEdges(Resource to)

getViolations

public List<Violation> getViolations(ViolationQuery violationQuery)

Specified by:
getViolations in class SonarIndex

addViolation

public void addViolation(Violation violation,
                         boolean force)
Specified by:
addViolation in class SonarIndex

addLink

public void addLink(ProjectLink link)
Specified by:
addLink in class SonarIndex

deleteLink

public void deleteLink(String key)
Specified by:
deleteLink in class SonarIndex

getEvents

public List<Event> getEvents(Resource resource)
Specified by:
getEvents in class SonarIndex

deleteEvent

public void deleteEvent(Event event)
Specified by:
deleteEvent in class SonarIndex

addEvent

public Event addEvent(Resource resource,
                      String name,
                      String description,
                      String category,
                      Date date)
Specified by:
addEvent in class SonarIndex

setSource

public void setSource(Resource reference,
                      String source)
Specified by:
setSource in class SonarIndex

getSource

public String getSource(Resource resource)
Specified by:
getSource in class SonarIndex

addResource

public Resource addResource(Resource resource)
Does nothing if the resource is already registered.

Specified by:
addResource in class SonarIndex

getResource

@CheckForNull
public <R extends Resource> R getResource(@Nullable
                                                       R reference)
Specified by:
getResource in class SonarIndex

getChildren

public List<Resource> getChildren(Resource resource)
Specified by:
getChildren in class SonarIndex

getParent

public Resource getParent(Resource resource)
Specified by:
getParent in class SonarIndex

index

public boolean index(Resource resource)
Specified by:
index in class SonarIndex

index

public boolean index(Resource resource,
                     Resource parentReference)
Specified by:
index in class SonarIndex

isExcluded

public boolean isExcluded(@Nullable
                          Resource reference)
Specified by:
isExcluded in class SonarIndex

isIndexed

public boolean isIndexed(@Nullable
                         Resource reference,
                         boolean acceptExcluded)
Specified by:
isIndexed in class SonarIndex


Copyright © 2009–2015 SonarSource. All rights reserved.