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.eclipse.aether; 20 21 /** 22 * The keys and defaults for common configuration properties. 23 * 24 * @see RepositorySystemSession#getConfigProperties() 25 */ 26 public final class ConfigurationProperties { 27 28 /** 29 * Prefix for all configurations. <em>For internal use only.</em> 30 * 31 * @since 2.0.0 32 */ 33 public static final String PREFIX_AETHER = "aether."; 34 35 /** 36 * Prefix for repository system related configurations. <em>For internal use only.</em> 37 * 38 * @since 2.0.0 39 */ 40 public static final String PREFIX_SYSTEM = PREFIX_AETHER + "system."; 41 42 /** 43 * Prefix for sync context related configurations. <em>For internal use only.</em> 44 * 45 * @since 2.0.0 46 */ 47 public static final String PREFIX_SYNC_CONTEXT = PREFIX_AETHER + "syncContext."; 48 49 /** 50 * Prefix for connector related configurations. <em>For internal use only.</em> 51 * 52 * @since 2.0.0 53 */ 54 public static final String PREFIX_CONNECTOR = PREFIX_AETHER + "connector."; 55 56 /** 57 * Prefix for layout related configurations. <em>For internal use only.</em> 58 * 59 * @since 2.0.0 60 */ 61 public static final String PREFIX_LAYOUT = PREFIX_AETHER + "layout."; 62 63 /** 64 * Prefix for checksum related configurations. <em>For internal use only.</em> 65 * 66 * @since 2.0.0 67 */ 68 public static final String PREFIX_CHECKSUMS = PREFIX_AETHER + "checksums."; 69 70 /** 71 * Prefix for local repository manager related configurations. <em>For internal use only.</em> 72 * 73 * @since 2.0.0 74 */ 75 public static final String PREFIX_LRM = PREFIX_AETHER + "lrm."; 76 77 /** 78 * Prefix for generator related configurations. <em>For internal use only.</em> 79 * 80 * @since 2.0.0 81 */ 82 public static final String PREFIX_GENERATOR = PREFIX_AETHER + "generator."; 83 84 /** 85 * Prefix for transport related configurations. <em>For internal use only.</em> 86 * 87 * @since 2.0.0 88 */ 89 public static final String PREFIX_TRANSPORT = PREFIX_AETHER + "transport."; 90 91 /** 92 * Prefix for HTTP protocol related configurations. <em>For internal use only.</em> 93 * 94 * @since 2.0.0 95 */ 96 public static final String PREFIX_TRANSPORT_HTTP = PREFIX_TRANSPORT + "http."; 97 98 /** 99 * Prefix for HTTPS protocol related configurations. <em>For internal use only.</em> 100 * 101 * @since 2.0.0 102 */ 103 public static final String PREFIX_TRANSPORT_HTTPS = PREFIX_TRANSPORT + "https."; 104 105 /** 106 * The prefix for properties that control the priority of pluggable extensions like transporters. For example, for 107 * an extension with the fully qualified class name "org.eclipse.MyExtensionFactory", the configuration properties 108 * "aether.priority.org.eclipse.MyExtensionFactory", "aether.priority.MyExtensionFactory" and 109 * "aether.priority.MyExtension" will be consulted for the priority, in that order (obviously, the last key is only 110 * tried if the class name ends with "Factory"). The corresponding value is a float and the special value 111 * {@link Float#NaN} or "NaN" (case-sensitive) can be used to disable the extension. 112 */ 113 public static final String PREFIX_PRIORITY = PREFIX_AETHER + "priority."; 114 115 /** 116 * A flag indicating whether the priorities of pluggable extensions are implicitly given by their iteration order 117 * such that the first extension has the highest priority. If set, an extension's built-in priority as well as any 118 * corresponding {@code aether.priority.*} configuration properties are ignored when searching for a suitable 119 * implementation among the available extensions. This priority mode is meant for cases where the application will 120 * present/inject extensions in the desired search order. 121 * 122 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 123 * @configurationType {@link java.lang.Boolean} 124 * @configurationDefaultValue {@link #DEFAULT_IMPLICIT_PRIORITIES} 125 * @configurationRepoIdSuffix No 126 */ 127 public static final String IMPLICIT_PRIORITIES = PREFIX_PRIORITY + "implicit"; 128 129 /** 130 * The default extension priority mode if {@link #IMPLICIT_PRIORITIES} isn't set. 131 */ 132 public static final boolean DEFAULT_IMPLICIT_PRIORITIES = false; 133 134 /** 135 * A flag indicating whether the created ordered components should be cached in session. 136 * 137 * @since 2.0.0 138 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 139 * @configurationType {@link java.lang.Boolean} 140 * @configurationDefaultValue {@link #DEFAULT_CACHED_PRIORITIES} 141 * @configurationRepoIdSuffix No 142 */ 143 public static final String CACHED_PRIORITIES = PREFIX_PRIORITY + "cached"; 144 145 /** 146 * The default caching of priority components if {@link #CACHED_PRIORITIES} isn't set. Default value is {@code true}. 147 * 148 * @since 2.0.0 149 */ 150 public static final boolean DEFAULT_CACHED_PRIORITIES = true; 151 152 /** 153 * A flag indicating whether interaction with the user is allowed. 154 * 155 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 156 * @configurationType {@link java.lang.Boolean} 157 * @configurationDefaultValue {@link #DEFAULT_INTERACTIVE} 158 * @configurationRepoIdSuffix No 159 */ 160 public static final String INTERACTIVE = PREFIX_AETHER + "interactive"; 161 162 /** 163 * The default interactive mode if {@link #INTERACTIVE} isn't set. 164 */ 165 public static final boolean DEFAULT_INTERACTIVE = false; 166 167 /** 168 * The user agent that repository connectors should report to servers. 169 * 170 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 171 * @configurationType {@link java.lang.String} 172 * @configurationDefaultValue {@link #DEFAULT_USER_AGENT} 173 * @configurationRepoIdSuffix No 174 */ 175 public static final String USER_AGENT = PREFIX_TRANSPORT_HTTP + "userAgent"; 176 177 /** 178 * The default user agent to use if {@link #USER_AGENT} isn't set. 179 */ 180 public static final String DEFAULT_USER_AGENT = "Aether"; 181 182 /** 183 * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive 184 * values indicate no timeout. 185 * 186 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 187 * @configurationType {@link java.lang.Integer} 188 * @configurationDefaultValue {@link #DEFAULT_CONNECT_TIMEOUT} 189 * @configurationRepoIdSuffix Yes 190 */ 191 public static final String CONNECT_TIMEOUT = PREFIX_TRANSPORT_HTTP + "connectTimeout"; 192 193 /** 194 * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set. 195 */ 196 public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000; 197 198 /** 199 * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that 200 * this timeout does not restrict the overall duration of a request, it only restricts the duration of inactivity 201 * between consecutive data packets. Non-positive values indicate no timeout. 202 * 203 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 204 * @configurationType {@link java.lang.Integer} 205 * @configurationDefaultValue {@link #DEFAULT_REQUEST_TIMEOUT} 206 * @configurationRepoIdSuffix Yes 207 */ 208 public static final String REQUEST_TIMEOUT = PREFIX_TRANSPORT_HTTP + "requestTimeout"; 209 210 /** 211 * The default request timeout to use if {@link #REQUEST_TIMEOUT} isn't set. 212 */ 213 public static final int DEFAULT_REQUEST_TIMEOUT = 1800 * 1000; 214 215 /** 216 * The request headers to use for HTTP-based repository connectors. The headers are specified using a 217 * {@code Map<String, String>}, mapping a header name to its value. Besides this general key, clients may also 218 * specify headers for a specific remote repository by appending the suffix {@code .<repoId>} to this key when 219 * storing the headers map. The repository-specific headers map is supposed to be complete, i.e. is not merged with 220 * the general headers map. 221 * 222 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 223 * @configurationType {@link java.util.Map} 224 * @configurationRepoIdSuffix Yes 225 */ 226 public static final String HTTP_HEADERS = PREFIX_TRANSPORT_HTTP + "headers"; 227 228 /** 229 * The encoding/charset to use when exchanging credentials with HTTP servers. Besides this general key, clients may 230 * also specify the encoding for a specific remote repository by appending the suffix {@code .<repoId>} to this key 231 * when storing the charset name. 232 * 233 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 234 * @configurationType {@link java.lang.String} 235 * @configurationDefaultValue {@link #DEFAULT_HTTP_CREDENTIAL_ENCODING} 236 * @configurationRepoIdSuffix Yes 237 */ 238 public static final String HTTP_CREDENTIAL_ENCODING = PREFIX_TRANSPORT_HTTP + "credentialEncoding"; 239 240 /** 241 * The default encoding/charset to use if {@link #HTTP_CREDENTIAL_ENCODING} isn't set. 242 */ 243 public static final String DEFAULT_HTTP_CREDENTIAL_ENCODING = "ISO-8859-1"; 244 245 /** 246 * The maximum number of times a request to a remote server should be retried in case of an error. 247 * 248 * @since 1.9.6 249 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 250 * @configurationType {@link java.lang.Integer} 251 * @configurationDefaultValue {@link #DEFAULT_HTTP_RETRY_HANDLER_COUNT} 252 * @configurationRepoIdSuffix Yes 253 */ 254 public static final String HTTP_RETRY_HANDLER_COUNT = PREFIX_TRANSPORT_HTTP + "retryHandler.count"; 255 256 /** 257 * The default number of retries to use if {@link #HTTP_RETRY_HANDLER_COUNT} isn't set. 258 * 259 * @since 1.9.6 260 */ 261 public static final int DEFAULT_HTTP_RETRY_HANDLER_COUNT = 3; 262 263 /** 264 * The initial retry interval in millis of request to a remote server should be waited in case of 265 * "too many requests" (HTTP codes 429 and 503). Accepts long as milliseconds. This value is used if remote server 266 * does not use {@code Retry-After} header, in which case Server value is obeyed. 267 * 268 * @since 1.9.16 269 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 270 * @configurationType {@link java.lang.Long} 271 * @configurationDefaultValue {@link #DEFAULT_HTTP_RETRY_HANDLER_INTERVAL} 272 * @configurationRepoIdSuffix Yes 273 */ 274 public static final String HTTP_RETRY_HANDLER_INTERVAL = PREFIX_TRANSPORT_HTTP + "retryHandler.interval"; 275 276 /** 277 * The default initial retry interval to use if {@link #HTTP_RETRY_HANDLER_INTERVAL} isn't set. 278 * Default value 5000ms. 279 * 280 * @since 1.9.16 281 */ 282 public static final long DEFAULT_HTTP_RETRY_HANDLER_INTERVAL = 5000L; 283 284 /** 285 * The maximum retry interval in millis of request to a remote server above which the request should be aborted 286 * instead. In theory, a malicious server could tell Maven "come back after 100 years" that would stall the build 287 * for some. Using this parameter Maven will fail the request instead, if interval is above this value. 288 * 289 * @since 1.9.16 290 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 291 * @configurationType {@link java.lang.Long} 292 * @configurationDefaultValue {@link #DEFAULT_HTTP_RETRY_HANDLER_INTERVAL_MAX} 293 * @configurationRepoIdSuffix Yes 294 */ 295 public static final String HTTP_RETRY_HANDLER_INTERVAL_MAX = PREFIX_TRANSPORT_HTTP + "retryHandler.intervalMax"; 296 297 /** 298 * The default retry interval maximum to use if {@link #HTTP_RETRY_HANDLER_INTERVAL_MAX} isn't set. 299 * Default value 5 minutes. 300 * 301 * @since 1.9.16 302 */ 303 public static final long DEFAULT_HTTP_RETRY_HANDLER_INTERVAL_MAX = 300_000L; 304 305 /** 306 * The HTTP codes of remote server responses that should be handled as "too many requests" 307 * (examples: HTTP codes 429 and 503). Accepts comma separated list of HTTP response codes. 308 * 309 * @since 1.9.16 310 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 311 * @configurationType {@link java.lang.String} 312 * @configurationDefaultValue {@link #DEFAULT_HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE} 313 * @configurationRepoIdSuffix Yes 314 */ 315 public static final String HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE = 316 PREFIX_TRANSPORT_HTTP + "retryHandler.serviceUnavailable"; 317 318 /** 319 * The default HTTP codes of remote server responses that should be handled as "too many requests". 320 * Default value: "429,503". 321 * 322 * @since 1.9.16 323 */ 324 public static final String DEFAULT_HTTP_RETRY_HANDLER_SERVICE_UNAVAILABLE = "429,503"; 325 326 /** 327 * Should HTTP client use preemptive-authentication for all HTTP verbs (works only w/ BASIC). By default, is 328 * disabled, as it is considered less secure. 329 * 330 * @since 1.9.6 331 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 332 * @configurationType {@link java.lang.Boolean} 333 * @configurationDefaultValue {@link #DEFAULT_HTTP_PREEMPTIVE_AUTH} 334 * @configurationRepoIdSuffix Yes 335 */ 336 public static final String HTTP_PREEMPTIVE_AUTH = PREFIX_TRANSPORT_HTTP + "preemptiveAuth"; 337 338 /** 339 * The default value to use if {@link #HTTP_PREEMPTIVE_AUTH} isn't set (false). 340 * 341 * @since 1.9.6 342 */ 343 public static final boolean DEFAULT_HTTP_PREEMPTIVE_AUTH = false; 344 345 /** 346 * Should HTTP client reuse connections (in other words, pool connections) or not? 347 * 348 * @since 1.9.8 349 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 350 * @configurationType {@link java.lang.Boolean} 351 * @configurationDefaultValue {@link #DEFAULT_HTTP_REUSE_CONNECTIONS} 352 * @configurationRepoIdSuffix Yes 353 */ 354 public static final String HTTP_REUSE_CONNECTIONS = PREFIX_TRANSPORT_HTTP + "reuseConnections"; 355 356 /** 357 * The default value to use if {@link #HTTP_REUSE_CONNECTIONS} isn't set (true). 358 * 359 * @since 1.9.8 360 */ 361 public static final boolean DEFAULT_HTTP_REUSE_CONNECTIONS = true; 362 363 /** 364 * Total time to live in seconds for an HTTP connection, after that time, the connection will be dropped 365 * (no matter for how long it was idle). 366 * 367 * @since 1.9.8 368 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 369 * @configurationType {@link java.lang.Integer} 370 * @configurationDefaultValue {@link #DEFAULT_HTTP_CONNECTION_MAX_TTL} 371 * @configurationRepoIdSuffix Yes 372 */ 373 public static final String HTTP_CONNECTION_MAX_TTL = PREFIX_TRANSPORT_HTTP + "connectionMaxTtl"; 374 375 /** 376 * The default value to use if {@link #HTTP_CONNECTION_MAX_TTL} isn't set (300 seconds). 377 * 378 * @since 1.9.8 379 */ 380 public static final int DEFAULT_HTTP_CONNECTION_MAX_TTL = 300; 381 382 /** 383 * The maximum concurrent connections per route HTTP client is allowed to use. 384 * 385 * @since 1.9.8 386 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 387 * @configurationType {@link java.lang.Integer} 388 * @configurationDefaultValue {@link #DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE} 389 * @configurationRepoIdSuffix Yes 390 */ 391 public static final String HTTP_MAX_CONNECTIONS_PER_ROUTE = PREFIX_TRANSPORT_HTTP + "maxConnectionsPerRoute"; 392 393 /** 394 * The default value to use if {@link #HTTP_MAX_CONNECTIONS_PER_ROUTE} isn't set (50 connections). 395 * 396 * @since 1.9.8 397 */ 398 public static final int DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE = 50; 399 400 /** 401 * The local address (interface) to use with HTTP transport. Not all transport supports this option. 402 * 403 * @since 2.0.0 404 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 405 * @configurationType {@link java.lang.String} 406 * @configurationRepoIdSuffix Yes 407 */ 408 public static final String HTTP_LOCAL_ADDRESS = PREFIX_TRANSPORT_HTTP + "localAddress"; 409 410 /** 411 * Boolean flag should the HTTP transport support WebDAV remote. Not all transport support this option. 412 * 413 * @since 2.0.0 (moved out from maven-resolver-transport-http). 414 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 415 * @configurationType {@link java.lang.Boolean} 416 * @configurationDefaultValue {@link #DEFAULT_HTTP_SUPPORT_WEBDAV} 417 * @configurationRepoIdSuffix Yes 418 */ 419 public static final String HTTP_SUPPORT_WEBDAV = PREFIX_TRANSPORT_HTTP + "supportWebDav"; 420 421 /** 422 * Default value to use if {@link #HTTP_SUPPORT_WEBDAV} is not set: {@code false}. 423 * 424 * @since 2.0.0 425 */ 426 public static final boolean DEFAULT_HTTP_SUPPORT_WEBDAV = false; 427 428 /** 429 * Boolean flag should the HTTP transport use preemptive-auth for PUT requests. Not all transport support this 430 * option. 431 * 432 * @since 2.0.0 (moved out from maven-resolver-transport-http). 433 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 434 * @configurationType {@link java.lang.Boolean} 435 * @configurationDefaultValue {@link #DEFAULT_HTTP_PREEMPTIVE_PUT_AUTH} 436 * @configurationRepoIdSuffix Yes 437 */ 438 public static final String HTTP_PREEMPTIVE_PUT_AUTH = PREFIX_TRANSPORT_HTTP + "preemptivePutAuth"; 439 440 /** 441 * Default value if {@link #HTTP_PREEMPTIVE_PUT_AUTH} is not set: {@code true}. 442 * 443 * @since 2.0.0 444 */ 445 public static final boolean DEFAULT_HTTP_PREEMPTIVE_PUT_AUTH = true; 446 447 /** 448 * Boolean flag should the HTTP transport use expect-continue handshake for PUT requests. Not all transport support 449 * this option. This option may be needed for some broken HTTP servers. Default value corresponds to given 450 * transport default one (resolver does not override those), but if configuration IS given, it will replace 451 * given transport own default value. 452 * 453 * @since 1.9.17 454 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 455 * @configurationType {@link java.lang.Boolean} 456 * @configurationRepoIdSuffix Yes 457 */ 458 public static final String HTTP_EXPECT_CONTINUE = PREFIX_TRANSPORT_HTTP + "expectContinue"; 459 460 /** 461 * The mode that sets HTTPS transport "security mode": to ignore any SSL errors (certificate validity checks, 462 * hostname verification). The default value is {@link #HTTPS_SECURITY_MODE_DEFAULT}. 463 * 464 * @see #HTTPS_SECURITY_MODE_DEFAULT 465 * @see #HTTPS_SECURITY_MODE_INSECURE 466 * @since 1.9.6 467 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 468 * @configurationType {@link java.lang.String} 469 * @configurationDefaultValue {@link #HTTPS_SECURITY_MODE_DEFAULT} 470 * @configurationRepoIdSuffix Yes 471 */ 472 public static final String HTTPS_SECURITY_MODE = PREFIX_TRANSPORT_HTTPS + "securityMode"; 473 474 /** 475 * The default HTTPS security mode. 476 * 477 * @since 1.9.6 478 */ 479 public static final String HTTPS_SECURITY_MODE_DEFAULT = "default"; 480 481 /** 482 * The insecure HTTPS security mode (certificate validation, hostname verification are all ignored). 483 * 484 * @since 1.9.6 485 */ 486 public static final String HTTPS_SECURITY_MODE_INSECURE = "insecure"; 487 488 /** 489 * A flag indicating which visitor should be used to "flatten" the dependency graph into list. Default is 490 * same as in older resolver versions "preOrder", while it can accept values like "postOrder" and "levelOrder". 491 * 492 * @see #REPOSITORY_SYSTEM_DEPENDENCY_VISITOR_PREORDER 493 * @see #REPOSITORY_SYSTEM_DEPENDENCY_VISITOR_POSTORDER 494 * @see #REPOSITORY_SYSTEM_DEPENDENCY_VISITOR_LEVELORDER 495 * @since 2.0.0 496 * @configurationSource {@link RepositorySystemSession#getConfigProperties()} 497 * @configurationType {@link java.lang.String} 498 * @configurationDefaultValue {@link #REPOSITORY_SYSTEM_DEPENDENCY_VISITOR_PREORDER} 499 * @configurationRepoIdSuffix No 500 */ 501 public static final String REPOSITORY_SYSTEM_DEPENDENCY_VISITOR = PREFIX_SYSTEM + "dependencyVisitor"; 502 503 /** 504 * The visitor strategy "preOrder". 505 * 506 * @since 2.0.0 507 */ 508 public static final String REPOSITORY_SYSTEM_DEPENDENCY_VISITOR_PREORDER = "preOrder"; 509 510 /** 511 * The visitor strategy "postOrder". This was the only one supported in Resolver 1.x and is hence the 512 * default as well. 513 * 514 * @since 2.0.0 515 */ 516 public static final String REPOSITORY_SYSTEM_DEPENDENCY_VISITOR_POSTORDER = "postOrder"; 517 518 /** 519 * The visitor strategy "levelOrder". 520 * 521 * @since 2.0.0 522 */ 523 public static final String REPOSITORY_SYSTEM_DEPENDENCY_VISITOR_LEVELORDER = "levelOrder"; 524 525 private ConfigurationProperties() { 526 // hide constructor 527 } 528 }