View Javadoc
1   /*******************************************************************************
2    * Copyright (c) 2010, 2014 Sonatype, Inc.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *    Sonatype, Inc. - initial API and implementation
10   *******************************************************************************/
11  package org.eclipse.aether.collection;
12  
13  import org.eclipse.aether.RepositoryException;
14  import org.eclipse.aether.graph.DependencyNode;
15  
16  /**
17   * Transforms a given dependency graph.
18   * <p>
19   * <strong>Note:</strong> Implementations must be stateless.
20   * <p>
21   * <em>Warning:</em> Dependency graphs may generally contain cycles. As such a graph transformer that cannot assume for
22   * sure that cycles have already been eliminated must gracefully handle cyclic graphs, e.g. guard against infinite
23   * recursion.
24   * 
25   * @see org.eclipse.aether.RepositorySystemSession#getDependencyGraphTransformer()
26   */
27  public interface DependencyGraphTransformer
28  {
29  
30      /**
31       * Transforms the dependency graph denoted by the specified root node. The transformer may directly change the
32       * provided input graph or create a new graph, the former is recommended for performance reasons.
33       * 
34       * @param node The root node of the (possibly cyclic!) graph to transform, must not be {@code null}.
35       * @param context The graph transformation context, must not be {@code null}.
36       * @return The result graph of the transformation, never {@code null}.
37       * @throws RepositoryException If the transformation failed.
38       */
39      DependencyNode transformGraph( DependencyNode node, DependencyGraphTransformationContext context )
40          throws RepositoryException;
41  
42  }