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