1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.maven.api.services; 20 21 import java.nio.file.Path; 22 23 import org.apache.maven.api.Service; 24 import org.apache.maven.api.Session; 25 import org.apache.maven.api.annotations.Nonnull; 26 27 /** 28 * Builds the effective settings from a user settings file and/or a global settings file. 29 */ 30 public interface SettingsBuilder extends Service { 31 32 /** 33 * Builds the effective settings of the specified settings files. 34 * 35 * @param request the settings building request that holds the parameters, must not be {@code null} 36 * @return the result of the settings building, never {@code null} 37 * @throws SettingsBuilderException if the effective settings could not be built 38 */ 39 @Nonnull 40 SettingsBuilderResult build(@Nonnull SettingsBuilderRequest request); 41 42 /** 43 * Builds the effective settings of the specified settings sources. 44 * 45 * @return the result of the settings building, never {@code null} 46 * @throws SettingsBuilderException if the effective settings could not be built 47 */ 48 @Nonnull 49 default SettingsBuilderResult build( 50 @Nonnull Session session, @Nonnull Source globalSettingsSource, @Nonnull Source userSettingsSource) { 51 return build(SettingsBuilderRequest.build(session, globalSettingsSource, userSettingsSource)); 52 } 53 54 /** 55 * Builds the effective settings of the specified settings paths. 56 * 57 * @return the result of the settings building, never {@code null} 58 * @throws SettingsBuilderException if the effective settings could not be built 59 */ 60 @Nonnull 61 default SettingsBuilderResult build( 62 @Nonnull Session session, @Nonnull Path globalSettingsPath, @Nonnull Path userSettingsPath) { 63 return build(SettingsBuilderRequest.build(session, globalSettingsPath, userSettingsPath)); 64 } 65 }