001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether.collection; 020 021import org.eclipse.aether.RepositoryException; 022import org.eclipse.aether.graph.DependencyNode; 023 024/** 025 * Transforms a given dependency graph. 026 * <p> 027 * <strong>Note:</strong> Implementations must be stateless. 028 * <p> 029 * <em>Warning:</em> Dependency graphs may generally contain cycles. As such a graph transformer that cannot assume for 030 * sure that cycles have already been eliminated must gracefully handle cyclic graphs, e.g. guard against infinite 031 * recursion. 032 * 033 * @see org.eclipse.aether.RepositorySystemSession#getDependencyGraphTransformer() 034 */ 035public interface DependencyGraphTransformer { 036 037 /** 038 * Transforms the dependency graph denoted by the specified root node. The transformer may directly change the 039 * provided input graph or create a new graph, the former is recommended for performance reasons. 040 * 041 * @param node The root node of the (possibly cyclic!) graph to transform, must not be {@code null}. 042 * @param context The graph transformation context, must not be {@code null}. 043 * @return The result graph of the transformation, never {@code null}. 044 * @throws RepositoryException If the transformation failed. 045 */ 046 DependencyNode transformGraph(DependencyNode node, DependencyGraphTransformationContext context) 047 throws RepositoryException; 048}