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.graph.Dependency;
14  
15  /**
16   * Applies dependency management to the dependencies of a dependency node.
17   * <p>
18   * <strong>Note:</strong> Implementations must be stateless.
19   * <p>
20   * <em>Warning:</em> This hook is called from a hot spot and therefore implementations should pay attention to
21   * performance. Among others, implementations should provide a semantic {@link Object#equals(Object) equals()} method.
22   * 
23   * @see org.eclipse.aether.RepositorySystemSession#getDependencyManager()
24   * @see org.eclipse.aether.RepositorySystem#collectDependencies(org.eclipse.aether.RepositorySystemSession,
25   *      CollectRequest)
26   */
27  public interface DependencyManager
28  {
29  
30      /**
31       * Applies dependency management to the specified dependency.
32       * 
33       * @param dependency The dependency to manage, must not be {@code null}.
34       * @return The management update to apply to the dependency or {@code null} if the dependency is not managed at all.
35       */
36      DependencyManagement manageDependency( Dependency dependency );
37  
38      /**
39       * Derives a dependency manager for the specified collection context. When calculating the child manager,
40       * implementors are strongly advised to simply return the current instance if nothing changed to help save memory.
41       * 
42       * @param context The dependency collection context, must not be {@code null}.
43       * @return The dependency manager for the dependencies of the target node or {@code null} if dependency management
44       *         should no longer be applied.
45       */
46      DependencyManager deriveChildManager( DependencyCollectionContext context );
47  
48  }