001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.eclipse.aether; 020 021/** 022 * The keys and defaults for common configuration properties. 023 * 024 * @see RepositorySystemSession#getConfigProperties() 025 */ 026public final class ConfigurationProperties { 027 028 private static final String PREFIX_AETHER = "aether."; 029 030 private static final String PREFIX_CONNECTOR = PREFIX_AETHER + "connector."; 031 032 /** 033 * The prefix for properties that control the priority of pluggable extensions like transporters. For example, for 034 * an extension with the fully qualified class name "org.eclipse.MyExtensionFactory", the configuration properties 035 * "aether.priority.org.eclipse.MyExtensionFactory", "aether.priority.MyExtensionFactory" and 036 * "aether.priority.MyExtension" will be consulted for the priority, in that order (obviously, the last key is only 037 * tried if the class name ends with "Factory"). The corresponding value is a float and the special value 038 * {@link Float#NaN} or "NaN" (case-sensitive) can be used to disable the extension. 039 */ 040 public static final String PREFIX_PRIORITY = PREFIX_AETHER + "priority."; 041 042 /** 043 * A flag indicating whether the priorities of pluggable extensions are implicitly given by their iteration order 044 * such that the first extension has the highest priority. If set, an extension's built-in priority as well as any 045 * corresponding {@code aether.priority.*} configuration properties are ignored when searching for a suitable 046 * implementation among the available extensions. This priority mode is meant for cases where the application will 047 * present/inject extensions in the desired search order. 048 * 049 * @see #DEFAULT_IMPLICIT_PRIORITIES 050 */ 051 public static final String IMPLICIT_PRIORITIES = PREFIX_PRIORITY + "implicit"; 052 053 /** 054 * The default extension priority mode if {@link #IMPLICIT_PRIORITIES} isn't set. 055 */ 056 public static final boolean DEFAULT_IMPLICIT_PRIORITIES = false; 057 058 /** 059 * A flag indicating whether interaction with the user is allowed. 060 * 061 * @see #DEFAULT_INTERACTIVE 062 */ 063 public static final String INTERACTIVE = PREFIX_AETHER + "interactive"; 064 065 /** 066 * The default interactive mode if {@link #INTERACTIVE} isn't set. 067 */ 068 public static final boolean DEFAULT_INTERACTIVE = false; 069 070 /** 071 * The user agent that repository connectors should report to servers. 072 * 073 * @see #DEFAULT_USER_AGENT 074 */ 075 public static final String USER_AGENT = PREFIX_CONNECTOR + "userAgent"; 076 077 /** 078 * The default user agent to use if {@link #USER_AGENT} isn't set. 079 */ 080 public static final String DEFAULT_USER_AGENT = "Aether"; 081 082 /** 083 * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive 084 * values indicate no timeout. 085 * 086 * @see #DEFAULT_CONNECT_TIMEOUT 087 */ 088 public static final String CONNECT_TIMEOUT = PREFIX_CONNECTOR + "connectTimeout"; 089 090 /** 091 * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set. 092 */ 093 public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000; 094 095 /** 096 * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that 097 * this timeout does not restrict the overall duration of a request, it only restricts the duration of inactivity 098 * between consecutive data packets. Non-positive values indicate no timeout. 099 * 100 * @see #DEFAULT_REQUEST_TIMEOUT 101 */ 102 public static final String REQUEST_TIMEOUT = PREFIX_CONNECTOR + "requestTimeout"; 103 104 /** 105 * The default request timeout to use if {@link #REQUEST_TIMEOUT} isn't set. 106 */ 107 public static final int DEFAULT_REQUEST_TIMEOUT = 1800 * 1000; 108 109 /** 110 * The request headers to use for HTTP-based repository connectors. The headers are specified using a 111 * {@code Map<String, String>}, mapping a header name to its value. Besides this general key, clients may also 112 * specify headers for a specific remote repository by appending the suffix {@code .<repoId>} to this key when 113 * storing the headers map. The repository-specific headers map is supposed to be complete, i.e. is not merged with 114 * the general headers map. 115 */ 116 public static final String HTTP_HEADERS = PREFIX_CONNECTOR + "http.headers"; 117 118 /** 119 * The encoding/charset to use when exchanging credentials with HTTP servers. Besides this general key, clients may 120 * also specify the encoding for a specific remote repository by appending the suffix {@code .<repoId>} to this key 121 * when storing the charset name. 122 * 123 * @see #DEFAULT_HTTP_CREDENTIAL_ENCODING 124 */ 125 public static final String HTTP_CREDENTIAL_ENCODING = PREFIX_CONNECTOR + "http.credentialEncoding"; 126 127 /** 128 * The default encoding/charset to use if {@link #HTTP_CREDENTIAL_ENCODING} isn't set. 129 */ 130 public static final String DEFAULT_HTTP_CREDENTIAL_ENCODING = "ISO-8859-1"; 131 132 /** 133 * The maximum number of times a request to a remote server should be retried in case of an error. 134 * 135 * @see #DEFAULT_HTTP_RETRY_HANDLER_COUNT 136 * @since 1.9.6 137 */ 138 public static final String HTTP_RETRY_HANDLER_COUNT = PREFIX_CONNECTOR + "http.retryHandler.count"; 139 140 /** 141 * The default number of retries to use if {@link #HTTP_RETRY_HANDLER_COUNT} isn't set. 142 * 143 * @since 1.9.6 144 */ 145 public static final int DEFAULT_HTTP_RETRY_HANDLER_COUNT = 3; 146 147 /** 148 * The initial retry interval of request to a remote server should be waited in case of "too many requests" 149 * (HTTP codes 429 and 503). Accepts long as milliseconds. This value is used if remote server does not use 150 * {@code Retry-After} header, in which case Server value is obeyed. 151 * 152 * @see #DEFAULT_HTTP_RETRY_HANDLER_INTERVAL 153 * @since 1.9.16 154 */ 155 public static final String HTTP_RETRY_HANDLER_INTERVAL = PREFIX_CONNECTOR + "http.retryHandler.interval"; 156 157 /** 158 * The default initial retry interval to use if {@link #HTTP_RETRY_HANDLER_INTERVAL} isn't set. 159 * Default value 5000ms. 160 * 161 * @since 1.9.16 162 */ 163 public static final long DEFAULT_HTTP_RETRY_HANDLER_INTERVAL = 5000L; 164 165 /** 166 * The maximum retry interval of request to a remote server above which the request should be aborted instead. 167 * In theory, a malicious server could tell Maven "come back after 100 years" that would stall the build for 168 * some. Using this parameter Maven will fail the request instead, if interval is above this value. 169 * 170 * @see #DEFAULT_HTTP_RETRY_HANDLER_INTERVAL_MAX 171 * @since 1.9.16 172 */ 173 public static final String HTTP_RETRY_HANDLER_INTERVAL_MAX = PREFIX_CONNECTOR + "http.retryHandler.intervalMax"; 174 175 /** 176 * The default retry interval maximum to use if {@link #HTTP_RETRY_HANDLER_INTERVAL_MAX} isn't set. 177 * Default value 5 minutes. 178 * 179 * @since 1.9.16 180 */ 181 public static final long DEFAULT_HTTP_RETRY_HANDLER_INTERVAL_MAX = 300_000L; 182 183 /** 184 * The HTTP codes of remote server responses that should be handled as "too many requests" 185 * (examples: HTTP codes 429 and 503). Accepts comma separated list of HTTP response codes. 186 * 187 * @see #DEFAULT_HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE 188 * @since 1.9.16 189 */ 190 public static final String HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE = 191 PREFIX_CONNECTOR + "http.retryHandler.serviceUnavailable"; 192 193 /** 194 * The default HTTP codes of remote server responses that should be handled as "too many requests". 195 * Default value: "429,503". 196 * 197 * @since 1.9.16 198 */ 199 public static final String DEFAULT_HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE = "429,503"; 200 201 /** 202 * Should HTTP client use preemptive auth (w/ BASIC) or not? 203 * 204 * @see #DEFAULT_HTTP_PREEMPTIVE_AUTH 205 * @since 1.9.6 206 */ 207 public static final String HTTP_PREEMPTIVE_AUTH = PREFIX_CONNECTOR + "http.preemptiveAuth"; 208 209 /** 210 * The default value to use if {@link #HTTP_PREEMPTIVE_AUTH} isn't set (false). 211 * 212 * @since 1.9.6 213 */ 214 public static final boolean DEFAULT_HTTP_PREEMPTIVE_AUTH = false; 215 216 /** 217 * Should HTTP client reuse connections (in other words, pool connections) or not? 218 * 219 * @see #DEFAULT_HTTP_REUSE_CONNECTIONS 220 * @since 1.9.8 221 */ 222 public static final String HTTP_REUSE_CONNECTIONS = PREFIX_CONNECTOR + "http.reuseConnections"; 223 224 /** 225 * The default value to use if {@link #HTTP_REUSE_CONNECTIONS} isn't set (true). 226 * 227 * @since 1.9.8 228 */ 229 public static final boolean DEFAULT_HTTP_REUSE_CONNECTIONS = true; 230 231 /** 232 * Total time to live in seconds for an HTTP connection, after that time, the connection will be dropped 233 * (no matter for how long it was idle). 234 * 235 * @see #DEFAULT_HTTP_CONNECTION_MAX_TTL 236 * @since 1.9.8 237 */ 238 public static final String HTTP_CONNECTION_MAX_TTL = PREFIX_CONNECTOR + "http.connectionMaxTtl"; 239 240 /** 241 * The default value to use if {@link #HTTP_CONNECTION_MAX_TTL} isn't set (300 seconds). 242 * 243 * @since 1.9.8 244 */ 245 public static final int DEFAULT_HTTP_CONNECTION_MAX_TTL = 300; 246 247 /** 248 * The maximum concurrent connections per route HTTP client is allowed to use. 249 * 250 * @see #DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE 251 * @since 1.9.8 252 */ 253 public static final String HTTP_MAX_CONNECTIONS_PER_ROUTE = PREFIX_CONNECTOR + "http.maxConnectionsPerRoute"; 254 255 /** 256 * The default value to use if {@link #HTTP_MAX_CONNECTIONS_PER_ROUTE} isn't set (50 connections). 257 * 258 * @since 1.9.8 259 */ 260 public static final int DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE = 50; 261 262 /** 263 * Boolean flag should the HTTP transport use expect-continue handshake for PUT requests. Not all transport support 264 * this option. This option may be needed for some broken HTTP servers. Default value corresponds to given 265 * transport default one (resolver does not override those), but if configuration IS given, it will replace 266 * given transport own default value. 267 * 268 * @since 1.9.17 269 */ 270 public static final String HTTP_EXPECT_CONTINUE = PREFIX_CONNECTOR + "http.expectContinue"; 271 272 /** 273 * The mode that sets HTTPS transport "security mode": to ignore any SSL errors (certificate validity checks, 274 * hostname verification). The default value is {@link #HTTPS_SECURITY_MODE_DEFAULT}. 275 * 276 * @see #HTTPS_SECURITY_MODE_DEFAULT 277 * @see #HTTPS_SECURITY_MODE_INSECURE 278 * @since 1.9.6 279 */ 280 public static final String HTTPS_SECURITY_MODE = PREFIX_CONNECTOR + "https.securityMode"; 281 282 /** 283 * The default HTTPS security mode. 284 * 285 * @since 1.9.6 286 */ 287 public static final String HTTPS_SECURITY_MODE_DEFAULT = "default"; 288 289 /** 290 * The insecure HTTPS security mode (certificate validation, hostname verification are all ignored). 291 * 292 * @since 1.9.6 293 */ 294 public static final String HTTPS_SECURITY_MODE_INSECURE = "insecure"; 295 296 /** 297 * A flag indicating whether checksums which are retrieved during checksum validation should be persisted in the 298 * local filesystem next to the file they provide the checksum for. 299 * 300 * @see #DEFAULT_PERSISTED_CHECKSUMS 301 */ 302 public static final String PERSISTED_CHECKSUMS = PREFIX_CONNECTOR + "persistedChecksums"; 303 304 /** 305 * The default checksum persistence mode if {@link #PERSISTED_CHECKSUMS} isn't set. 306 */ 307 public static final boolean DEFAULT_PERSISTED_CHECKSUMS = true; 308 309 private ConfigurationProperties() { 310 // hide constructor 311 } 312}