Search in sources :

Example 1 with FilteringDependencyNodeVisitor

use of org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor in project maven-plugins by apache.

the class DependencyConvergenceReport method serializeDependencyTree.

/**
     * Serializes the specified dependency tree to a string.
     *
     * @param rootNode the dependency tree root node to serialize
     * @return the serialized dependency tree
     */
private void serializeDependencyTree(DependencyNode rootNode, String key, Sink sink) {
    DependencyNodeVisitor visitor = getSerializingDependencyNodeVisitor(sink);
    visitor = new BuildingDependencyNodeVisitor(visitor);
    DependencyNodeFilter filter = createDependencyNodeFilter(key);
    if (filter != null) {
        CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
        DependencyNodeVisitor firstPassVisitor = new FilteringDependencyNodeVisitor(collectingVisitor, filter);
        rootNode.accept(firstPassVisitor);
        DependencyNodeFilter secondPassFilter = new AncestorOrSelfDependencyNodeFilter(collectingVisitor.getNodes());
        visitor = new FilteringDependencyNodeVisitor(visitor, secondPassFilter);
    }
    rootNode.accept(visitor);
}
Also used : FilteringDependencyNodeVisitor(org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor) CollectingDependencyNodeVisitor(org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor) BuildingDependencyNodeVisitor(org.apache.maven.shared.dependency.tree.traversal.BuildingDependencyNodeVisitor) AncestorOrSelfDependencyNodeFilter(org.apache.maven.shared.dependency.tree.filter.AncestorOrSelfDependencyNodeFilter) ArtifactDependencyNodeFilter(org.apache.maven.shared.dependency.tree.filter.ArtifactDependencyNodeFilter) AncestorOrSelfDependencyNodeFilter(org.apache.maven.shared.dependency.tree.filter.AncestorOrSelfDependencyNodeFilter) AndDependencyNodeFilter(org.apache.maven.shared.dependency.tree.filter.AndDependencyNodeFilter) DependencyNodeFilter(org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter) SinkSerializingDependencyNodeVisitor(org.apache.maven.report.projectinfo.dependencies.SinkSerializingDependencyNodeVisitor) DependencyNodeVisitor(org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor) FilteringDependencyNodeVisitor(org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor) CollectingDependencyNodeVisitor(org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor) BuildingDependencyNodeVisitor(org.apache.maven.shared.dependency.tree.traversal.BuildingDependencyNodeVisitor)

Aggregations

SinkSerializingDependencyNodeVisitor (org.apache.maven.report.projectinfo.dependencies.SinkSerializingDependencyNodeVisitor)1 AncestorOrSelfDependencyNodeFilter (org.apache.maven.shared.dependency.tree.filter.AncestorOrSelfDependencyNodeFilter)1 AndDependencyNodeFilter (org.apache.maven.shared.dependency.tree.filter.AndDependencyNodeFilter)1 ArtifactDependencyNodeFilter (org.apache.maven.shared.dependency.tree.filter.ArtifactDependencyNodeFilter)1 DependencyNodeFilter (org.apache.maven.shared.dependency.tree.filter.DependencyNodeFilter)1 BuildingDependencyNodeVisitor (org.apache.maven.shared.dependency.tree.traversal.BuildingDependencyNodeVisitor)1 CollectingDependencyNodeVisitor (org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor)1 DependencyNodeVisitor (org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor)1 FilteringDependencyNodeVisitor (org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor)1