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 the created ordered components should be cached or not. 060 * 061 * @see #DEFAULT_CACHED_PRIORITIES 062 * @since TBD 063 */ 064 public static final String CACHED_PRIORITIES = PREFIX_PRIORITY + "cached"; 065 066 /** 067 * The default caching of priority components if {@link #CACHED_PRIORITIES} isn't set. Default value is {@code true}. 068 * 069 * @since TBD 070 */ 071 public static final boolean DEFAULT_CACHED_PRIORITIES = true; 072 073 /** 074 * A flag indicating whether interaction with the user is allowed. 075 * 076 * @see #DEFAULT_INTERACTIVE 077 */ 078 public static final String INTERACTIVE = PREFIX_AETHER + "interactive"; 079 080 /** 081 * The default interactive mode if {@link #INTERACTIVE} isn't set. 082 */ 083 public static final boolean DEFAULT_INTERACTIVE = false; 084 085 /** 086 * The user agent that repository connectors should report to servers. 087 * 088 * @see #DEFAULT_USER_AGENT 089 */ 090 public static final String USER_AGENT = PREFIX_CONNECTOR + "userAgent"; 091 092 /** 093 * The default user agent to use if {@link #USER_AGENT} isn't set. 094 */ 095 public static final String DEFAULT_USER_AGENT = "Aether"; 096 097 /** 098 * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive 099 * values indicate no timeout. 100 * 101 * @see #DEFAULT_CONNECT_TIMEOUT 102 */ 103 public static final String CONNECT_TIMEOUT = PREFIX_CONNECTOR + "connectTimeout"; 104 105 /** 106 * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set. 107 */ 108 public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000; 109 110 /** 111 * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that 112 * this timeout does not restrict the overall duration of a request, it only restricts the duration of inactivity 113 * between consecutive data packets. Non-positive values indicate no timeout. 114 * 115 * @see #DEFAULT_REQUEST_TIMEOUT 116 */ 117 public static final String REQUEST_TIMEOUT = PREFIX_CONNECTOR + "requestTimeout"; 118 119 /** 120 * The default request timeout to use if {@link #REQUEST_TIMEOUT} isn't set. 121 */ 122 public static final int DEFAULT_REQUEST_TIMEOUT = 1800 * 1000; 123 124 /** 125 * The request headers to use for HTTP-based repository connectors. The headers are specified using a 126 * {@code Map<String, String>}, mapping a header name to its value. Besides this general key, clients may also 127 * specify headers for a specific remote repository by appending the suffix {@code .<repoId>} to this key when 128 * storing the headers map. The repository-specific headers map is supposed to be complete, i.e. is not merged with 129 * the general headers map. 130 */ 131 public static final String HTTP_HEADERS = PREFIX_CONNECTOR + "http.headers"; 132 133 /** 134 * The encoding/charset to use when exchanging credentials with HTTP servers. Besides this general key, clients may 135 * also specify the encoding for a specific remote repository by appending the suffix {@code .<repoId>} to this key 136 * when storing the charset name. 137 * 138 * @see #DEFAULT_HTTP_CREDENTIAL_ENCODING 139 */ 140 public static final String HTTP_CREDENTIAL_ENCODING = PREFIX_CONNECTOR + "http.credentialEncoding"; 141 142 /** 143 * The default encoding/charset to use if {@link #HTTP_CREDENTIAL_ENCODING} isn't set. 144 */ 145 public static final String DEFAULT_HTTP_CREDENTIAL_ENCODING = "ISO-8859-1"; 146 147 /** 148 * The maximum number of times a request to a remote server should be retried in case of an error. 149 * 150 * @see #DEFAULT_HTTP_RETRY_HANDLER_COUNT 151 * @since 1.9.6 152 */ 153 public static final String HTTP_RETRY_HANDLER_COUNT = PREFIX_CONNECTOR + "http.retryHandler.count"; 154 155 /** 156 * The default number of retries to use if {@link #HTTP_RETRY_HANDLER_COUNT} isn't set. 157 * 158 * @since 1.9.6 159 */ 160 public static final int DEFAULT_HTTP_RETRY_HANDLER_COUNT = 3; 161 162 /** 163 * The initial retry interval of request to a remote server should be waited in case of "too many requests" 164 * (HTTP codes 429 and 503). Accepts long as milliseconds. This value is used if remote server does not use 165 * {@code Retry-After} header, in which case Server value is obeyed. 166 * 167 * @see #DEFAULT_HTTP_RETRY_HANDLER_INTERVAL 168 * @since 1.9.16 169 */ 170 public static final String HTTP_RETRY_HANDLER_INTERVAL = PREFIX_CONNECTOR + "http.retryHandler.interval"; 171 172 /** 173 * The default initial retry interval to use if {@link #HTTP_RETRY_HANDLER_INTERVAL} isn't set. 174 * Default value 5000ms. 175 * 176 * @since 1.9.16 177 */ 178 public static final long DEFAULT_HTTP_RETRY_HANDLER_INTERVAL = 5000L; 179 180 /** 181 * The maximum retry interval of request to a remote server above which the request should be aborted instead. 182 * In theory, a malicious server could tell Maven "come back after 100 years" that would stall the build for 183 * some. Using this parameter Maven will fail the request instead, if interval is above this value. 184 * 185 * @see #DEFAULT_HTTP_RETRY_HANDLER_INTERVAL_MAX 186 * @since 1.9.16 187 */ 188 public static final String HTTP_RETRY_HANDLER_INTERVAL_MAX = PREFIX_CONNECTOR + "http.retryHandler.intervalMax"; 189 190 /** 191 * The default retry interval maximum to use if {@link #HTTP_RETRY_HANDLER_INTERVAL_MAX} isn't set. 192 * Default value 5 minutes. 193 * 194 * @since 1.9.16 195 */ 196 public static final long DEFAULT_HTTP_RETRY_HANDLER_INTERVAL_MAX = 300_000L; 197 198 /** 199 * The HTTP codes of remote server responses that should be handled as "too many requests" 200 * (examples: HTTP codes 429 and 503). Accepts comma separated list of HTTP response codes. 201 * 202 * @see #DEFAULT_HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE 203 * @since 1.9.16 204 */ 205 public static final String HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE = 206 PREFIX_CONNECTOR + "http.retryHandler.serviceUnavailable"; 207 208 /** 209 * The default HTTP codes of remote server responses that should be handled as "too many requests". 210 * Default value: "429,503". 211 * 212 * @since 1.9.16 213 */ 214 public static final String DEFAULT_HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE = "429,503"; 215 216 /** 217 * Should HTTP client use preemptive auth (w/ BASIC) or not? 218 * 219 * @see #DEFAULT_HTTP_PREEMPTIVE_AUTH 220 * @since 1.9.6 221 */ 222 public static final String HTTP_PREEMPTIVE_AUTH = PREFIX_CONNECTOR + "http.preemptiveAuth"; 223 224 /** 225 * The default value to use if {@link #HTTP_PREEMPTIVE_AUTH} isn't set (false). 226 * 227 * @since 1.9.6 228 */ 229 public static final boolean DEFAULT_HTTP_PREEMPTIVE_AUTH = false; 230 231 /** 232 * Should HTTP client reuse connections (in other words, pool connections) or not? 233 * 234 * @see #DEFAULT_HTTP_REUSE_CONNECTIONS 235 * @since 1.9.8 236 */ 237 public static final String HTTP_REUSE_CONNECTIONS = PREFIX_CONNECTOR + "http.reuseConnections"; 238 239 /** 240 * The default value to use if {@link #HTTP_REUSE_CONNECTIONS} isn't set (true). 241 * 242 * @since 1.9.8 243 */ 244 public static final boolean DEFAULT_HTTP_REUSE_CONNECTIONS = true; 245 246 /** 247 * Total time to live in seconds for an HTTP connection, after that time, the connection will be dropped 248 * (no matter for how long it was idle). 249 * 250 * @see #DEFAULT_HTTP_CONNECTION_MAX_TTL 251 * @since 1.9.8 252 */ 253 public static final String HTTP_CONNECTION_MAX_TTL = PREFIX_CONNECTOR + "http.connectionMaxTtl"; 254 255 /** 256 * The default value to use if {@link #HTTP_CONNECTION_MAX_TTL} isn't set (300 seconds). 257 * 258 * @since 1.9.8 259 */ 260 public static final int DEFAULT_HTTP_CONNECTION_MAX_TTL = 300; 261 262 /** 263 * The maximum concurrent connections per route HTTP client is allowed to use. 264 * 265 * @see #DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE 266 * @since 1.9.8 267 */ 268 public static final String HTTP_MAX_CONNECTIONS_PER_ROUTE = PREFIX_CONNECTOR + "http.maxConnectionsPerRoute"; 269 270 /** 271 * The default value to use if {@link #HTTP_MAX_CONNECTIONS_PER_ROUTE} isn't set (50 connections). 272 * 273 * @since 1.9.8 274 */ 275 public static final int DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE = 50; 276 277 /** 278 * The mode that sets HTTPS transport "security mode": to ignore any SSL errors (certificate validity checks, 279 * hostname verification). The default value is {@link #HTTPS_SECURITY_MODE_DEFAULT}. 280 * 281 * @see #HTTPS_SECURITY_MODE_DEFAULT 282 * @see #HTTPS_SECURITY_MODE_INSECURE 283 * @since 1.9.6 284 */ 285 public static final String HTTPS_SECURITY_MODE = PREFIX_CONNECTOR + "https.securityMode"; 286 287 /** 288 * The default HTTPS security mode. 289 * 290 * @since 1.9.6 291 */ 292 public static final String HTTPS_SECURITY_MODE_DEFAULT = "default"; 293 294 /** 295 * The insecure HTTPS security mode (certificate validation, hostname verification are all ignored). 296 * 297 * @since 1.9.6 298 */ 299 public static final String HTTPS_SECURITY_MODE_INSECURE = "insecure"; 300 301 /** 302 * A flag indicating whether checksums which are retrieved during checksum validation should be persisted in the 303 * local filesystem next to the file they provide the checksum for. 304 * 305 * @see #DEFAULT_PERSISTED_CHECKSUMS 306 */ 307 public static final String PERSISTED_CHECKSUMS = PREFIX_CONNECTOR + "persistedChecksums"; 308 309 /** 310 * The default checksum persistence mode if {@link #PERSISTED_CHECKSUMS} isn't set. 311 */ 312 public static final boolean DEFAULT_PERSISTED_CHECKSUMS = true; 313 314 /** 315 * A flag indicating which visitor should be used to "flatten" the dependency graph into list. Default is 316 * same as in older resolver versions "preOrder", while it can accept values like "postOrder" and "levelOrder". 317 * 318 * @see #DEFAULT_REPOSITORY_SYSTEM_RESOLVER_DEPENDENCIES_VISITOR 319 * @since TBD 320 */ 321 public static final String REPOSITORY_SYSTEM_RESOLVER_DEPENDENCIES_VISITOR = 322 PREFIX_AETHER + "system.resolveDependencies.visitor"; 323 324 /** 325 * The default visitor strategy "preOrder". 326 * 327 * @since TBD 328 */ 329 public static final String DEFAULT_REPOSITORY_SYSTEM_RESOLVER_DEPENDENCIES_VISITOR = "preOrder"; 330 331 private ConfigurationProperties() { 332 // hide constructor 333 } 334}