Search in sources :

Example 1 with MavenIndicesProcessor

use of org.jetbrains.idea.maven.server.MavenIndicesProcessor in project intellij-community by JetBrains.

the class MavenIndex method doUpdateIndexData.

private void doUpdateIndexData(IndexData data, MavenProgressIndicator progress) throws IOException, MavenServerIndexerException {
    final Map<String, Set<String>> groupToArtifactMap = new THashMap<>();
    final Map<String, Set<String>> groupWithArtifactToVersionMap = new THashMap<>();
    final StringBuilder builder = new StringBuilder();
    progress.pushState();
    progress.setIndeterminate(true);
    try {
        myIndexer.processArtifacts(data.indexId, new MavenIndicesProcessor() {

            @Override
            public void processArtifacts(Collection<MavenId> artifacts) {
                for (MavenId each : artifacts) {
                    String groupId = each.getGroupId();
                    String artifactId = each.getArtifactId();
                    String version = each.getVersion();
                    builder.setLength(0);
                    builder.append(groupId).append(":").append(artifactId);
                    String ga = builder.toString();
                    getOrCreate(groupToArtifactMap, groupId).add(artifactId);
                    getOrCreate(groupWithArtifactToVersionMap, ga).add(version);
                }
            }
        });
        persist(groupToArtifactMap, data.groupToArtifactMap);
        persist(groupWithArtifactToVersionMap, data.groupWithArtifactToVersionMap);
    } finally {
        progress.popState();
    }
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) THashSet(gnu.trove.THashSet) MavenIndicesProcessor(org.jetbrains.idea.maven.server.MavenIndicesProcessor) THashMap(gnu.trove.THashMap)

Aggregations

THashMap (gnu.trove.THashMap)1 THashSet (gnu.trove.THashSet)1 MavenId (org.jetbrains.idea.maven.model.MavenId)1 MavenIndicesProcessor (org.jetbrains.idea.maven.server.MavenIndicesProcessor)1