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