001package org.apache.maven.execution;
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.apache.maven.settings.Settings;
023
024/**
025 * Assists in populating an execution request for invocation of Maven.
026 * 
027 * @author Benjamin Bentmann
028 */
029public interface MavenExecutionRequestPopulator
030{
031
032    /**
033     * Copies the values from the given settings into the specified execution request. This method will replace any
034     * existing values in the execution request that are controlled by the settings. Hence, it is expected that this
035     * method is called on a new/empty execution request before the caller mutates it to fit its needs.
036     * 
037     * @param request The execution request to populate, must not be {@code null}.
038     * @param settings The settings to copy into the execution request, may be {@code null}.
039     * @return The populated execution request, never {@code null}.
040     * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
041     */
042    MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
043        throws MavenExecutionRequestPopulationException;
044
045    /**
046     * Injects default values like plugin groups or repositories into the specified execution request.
047     * 
048     * @param request The execution request to populate, must not be {@code null}.
049     * @return The populated execution request, never {@code null}.
050     * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
051     */
052    MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
053        throws MavenExecutionRequestPopulationException;
054
055}