001package org.eclipse.aether;
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
022/**
023 * The keys and defaults for common configuration properties.
024 * 
025 * @see RepositorySystemSession#getConfigProperties()
026 */
027public final class ConfigurationProperties
028{
029
030    private static final String PREFIX_AETHER = "aether.";
031
032    private static final String PREFIX_CONNECTOR = PREFIX_AETHER + "connector.";
033
034    /**
035     * The prefix for properties that control the priority of pluggable extensions like transporters. For example, for
036     * an extension with the fully qualified class name "org.eclipse.MyExtensionFactory", the configuration properties
037     * "aether.priority.org.eclipse.MyExtensionFactory", "aether.priority.MyExtensionFactory" and
038     * "aether.priority.MyExtension" will be consulted for the priority, in that order (obviously, the last key is only
039     * tried if the class name ends with "Factory"). The corresponding value is a float and the special value
040     * {@link Float#NaN} or "NaN" (case-sensitive) can be used to disable the extension.
041     */
042    public static final String PREFIX_PRIORITY = PREFIX_AETHER + "priority.";
043
044    /**
045     * A flag indicating whether the priorities of pluggable extensions are implicitly given by their iteration order
046     * such that the first extension has the highest priority. If set, an extension's built-in priority as well as any
047     * corresponding {@code aether.priority.*} configuration properties are ignored when searching for a suitable
048     * implementation among the available extensions. This priority mode is meant for cases where the application will
049     * present/inject extensions in the desired search order.
050     * 
051     * @see #DEFAULT_IMPLICIT_PRIORITIES
052     */
053    public static final String IMPLICIT_PRIORITIES = PREFIX_PRIORITY + "implicit";
054
055    /**
056     * The default extension priority mode if {@link #IMPLICIT_PRIORITIES} isn't set.
057     */
058    public static final boolean DEFAULT_IMPLICIT_PRIORITIES = false;
059
060    /**
061     * A flag indicating whether interaction with the user is allowed.
062     * 
063     * @see #DEFAULT_INTERACTIVE
064     */
065    public static final String INTERACTIVE = PREFIX_AETHER + "interactive";
066
067    /**
068     * The default interactive mode if {@link #INTERACTIVE} isn't set.
069     */
070    public static final boolean DEFAULT_INTERACTIVE = false;
071
072    /**
073     * The user agent that repository connectors should report to servers.
074     * 
075     * @see #DEFAULT_USER_AGENT
076     */
077    public static final String USER_AGENT = PREFIX_CONNECTOR + "userAgent";
078
079    /**
080     * The default user agent to use if {@link #USER_AGENT} isn't set.
081     */
082    public static final String DEFAULT_USER_AGENT = "Aether";
083
084    /**
085     * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive
086     * values indicate no timeout.
087     * 
088     * @see #DEFAULT_CONNECT_TIMEOUT
089     */
090    public static final String CONNECT_TIMEOUT = PREFIX_CONNECTOR + "connectTimeout";
091
092    /**
093     * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set.
094     */
095    public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000;
096
097    /**
098     * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that
099     * this timeout does not restrict the overall duration of a request, it only restricts the duration of inactivity
100     * between consecutive data packets. Non-positive values indicate no timeout.
101     * 
102     * @see #DEFAULT_REQUEST_TIMEOUT
103     */
104    public static final String REQUEST_TIMEOUT = PREFIX_CONNECTOR + "requestTimeout";
105
106    /**
107     * The default request timeout to use if {@link #REQUEST_TIMEOUT} isn't set.
108     */
109    public static final int DEFAULT_REQUEST_TIMEOUT = 1800 * 1000;
110
111    /**
112     * The request headers to use for HTTP-based repository connectors. The headers are specified using a
113     * {@code Map<String, String>}, mapping a header name to its value. Besides this general key, clients may also
114     * specify headers for a specific remote repository by appending the suffix {@code .<repoId>} to this key when
115     * storing the headers map. The repository-specific headers map is supposed to be complete, i.e. is not merged with
116     * the general headers map.
117     */
118    public static final String HTTP_HEADERS = PREFIX_CONNECTOR + "http.headers";
119
120    /**
121     * The encoding/charset to use when exchanging credentials with HTTP servers. Besides this general key, clients may
122     * also specify the encoding for a specific remote repository by appending the suffix {@code .<repoId>} to this key
123     * when storing the charset name.
124     * 
125     * @see #DEFAULT_HTTP_CREDENTIAL_ENCODING
126     */
127    public static final String HTTP_CREDENTIAL_ENCODING = PREFIX_CONNECTOR + "http.credentialEncoding";
128
129    /**
130     * The default encoding/charset to use if {@link #HTTP_CREDENTIAL_ENCODING} isn't set.
131     */
132    public static final String DEFAULT_HTTP_CREDENTIAL_ENCODING = "ISO-8859-1";
133
134    /**
135     * A flag indicating whether checksums which are retrieved during checksum validation should be persisted in the
136     * local filesystem next to the file they provide the checksum for.
137     * 
138     * @see #DEFAULT_PERSISTED_CHECKSUMS
139     */
140    public static final String PERSISTED_CHECKSUMS = PREFIX_CONNECTOR + "persistedChecksums";
141
142    /**
143     * The default checksum persistence mode if {@link #PERSISTED_CHECKSUMS} isn't set.
144     */
145    public static final boolean DEFAULT_PERSISTED_CHECKSUMS = true;
146
147    private ConfigurationProperties()
148    {
149        // hide constructor
150    }
151
152}