001package org.apache.maven.settings.building;
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 java.io.File;
023import java.util.Properties;
024
025/**
026 * Collects settings that control the building of effective settings.
027 *
028 * @author Benjamin Bentmann
029 */
030public interface SettingsBuildingRequest
031{
032
033    /**
034     * Gets the global settings file.
035     *
036     * @return The global settings file or {@code null} if none.
037     */
038    File getGlobalSettingsFile();
039
040    /**
041     * Sets the global settings file. A non-existent settings file is equivalent to empty settings. If both user
042     * settings and global settings are given, the user settings take precedence.
043     *
044     * @param globalSettingsFile The global settings file, may be {@code null} to disable global settings.
045     * @return This request, never {@code null}.
046     */
047    SettingsBuildingRequest setGlobalSettingsFile( File globalSettingsFile );
048
049    /**
050     * Gets the global settings source.
051     *
052     * @return The global settings source or {@code null} if none.
053     */
054    SettingsSource getGlobalSettingsSource();
055
056    /**
057     * Sets the global settings source. If both user settings and a global settings are given, the user settings take
058     * precedence.
059     *
060     * @param globalSettingsSource The global settings source, may be {@code null} to disable global settings.
061     * @return This request, never {@code null}.
062     */
063    SettingsBuildingRequest setGlobalSettingsSource( SettingsSource globalSettingsSource );
064
065    /**
066     * Gets the user settings file.
067     *
068     * @return The user settings file or {@code null} if none.
069     */
070    File getUserSettingsFile();
071
072    /**
073     * Sets the user settings file. A non-existent settings file is equivalent to empty settings. If both a user
074     * settings file and a global settings file are given, the user settings take precedence.
075     *
076     * @param userSettingsFile The user settings file, may be {@code null} to disable user settings.
077     * @return This request, never {@code null}.
078     */
079    SettingsBuildingRequest setUserSettingsFile( File userSettingsFile );
080
081    /**
082     * Gets the user settings source.
083     *
084     * @return The user settings source or {@code null} if none.
085     */
086    SettingsSource getUserSettingsSource();
087
088    /**
089     * Sets the user settings source. If both user settings and a global settings are given, the user settings take
090     * precedence.
091     *
092     * @param userSettingsSource The user settings source, may be {@code null} to disable user settings.
093     * @return This request, never {@code null}.
094     */
095    SettingsBuildingRequest setUserSettingsSource( SettingsSource userSettingsSource );
096
097    /**
098     * Gets the system properties to use for interpolation. The system properties are collected from the runtime
099     * environment like {@link System#getProperties()} and environment variables.
100     *
101     * @return The system properties, never {@code null}.
102     */
103    Properties getSystemProperties();
104
105    /**
106     * Sets the system properties to use for interpolation. The system properties are collected from the runtime
107     * environment like {@link System#getProperties()} and environment variables.
108     *
109     * @param systemProperties The system properties, may be {@code null}.
110     * @return This request, never {@code null}.
111     */
112    SettingsBuildingRequest setSystemProperties( Properties systemProperties );
113
114    /**
115     * Gets the user properties to use for interpolation. The user properties have been configured directly by the user
116     * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line.
117     *
118     * @return The user properties, never {@code null}.
119     */
120    Properties getUserProperties();
121
122    /**
123     * Sets the user properties to use for interpolation. The user properties have been configured directly by the user
124     * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line.
125     *
126     * @param userProperties The user properties, may be {@code null}.
127     * @return This request, never {@code null}.
128     */
129    SettingsBuildingRequest setUserProperties( Properties userProperties );
130
131}