Skip to content

Provide Iterator implementations for analyses#43

Merged
jachiaram merged 7 commits into
developfrom
feature/analysis-as-iterator
Dec 19, 2025
Merged

Provide Iterator implementations for analyses#43
jachiaram merged 7 commits into
developfrom
feature/analysis-as-iterator

Conversation

@johannesduesing

@johannesduesing johannesduesing commented Dec 12, 2025

Copy link
Copy Markdown
Member

This PR introduces Iterator implementations that correspond to the current MavenCentralArtifactAnalysis and MavenCentralLibraryAnalysis, respectively. The idea is to provide the same kind of data without forcing users to extend any specific base class.

Specifically, this PR adds:

  • ArtifactAnalysisConfigBuilder and LibraryAnalysisConfigBuilder classes to programmatically build configuration objects. This is necessary as iterators will not necessarily be used in main methods, and we therefore need a way to build configurations without CLI argument parsing, see Rework configuration system #42

  • MavenCentralArtifactIterator as an equivalent to the MavenCentralArtifactAnalysis. This iterator produces Artifact objects and supports all configuration options except multithreading.

  • MavenCentralLibraryIterator as an equivalent to the MavenCentralLibraryAnalysis. This iterator produces LibraryResolutionContext objects to encapsulate all releases of a library. It supports all configuration options except multithreading.

  • Custom input files are, for all analysis modes, now being validated syntactically before being processed. This ensures that only lists with valid G:A:V triples or G:A tuples, respectively, are processed any further.

With these changes, the following is now possible:

ArtifactAnalysisConfig config = new ArtifactAnalysisConfigBuilder()
                .withInputList(gavInputList)
                .withSkip(2)
                .withTake(5)
                .build();

MavenCentralArtifactIterator iterator = new MavenCentralArtifactIterator(true, true, false, config);

while(iterator.hasNext()){
    Artifact current = iterator.next();
    // Process artifact
}

What's left to do

  • We need to update the README to reflect this new usage scenario
  • We want to have multithreaded implementations - Sources are likely the best concept to do this. Should probably be a separate PR, but i am open to discussion

Closes #41 (for now, see follow-up #44)
Closes #42

@johannesduesing

johannesduesing commented Dec 16, 2025

Copy link
Copy Markdown
Member Author

This PR will only deal with single threaded iterators. Multithreaded sources will be added as part of #44 .

@johannesduesing johannesduesing marked this pull request as ready for review December 16, 2025 11:48
@jachiaram jachiaram merged commit b40a80a into develop Dec 19, 2025
1 check passed
@johannesduesing johannesduesing deleted the feature/analysis-as-iterator branch January 6, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rework configuration system Provide analysis implementations as iterators and sources

2 participants