View Javadoc
1   package org.eclipse.aether;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   * 
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   * 
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * The keys and defaults for common configuration properties.
24   * 
25   * @see RepositorySystemSession#getConfigProperties()
26   */
27  public final class ConfigurationProperties
28  {
29  
30      private static final String PREFIX_AETHER = "aether.";
31  
32      private static final String PREFIX_CONNECTOR = PREFIX_AETHER + "connector.";
33  
34      /**
35       * The prefix for properties that control the priority of pluggable extensions like transporters. For example, for
36       * an extension with the fully qualified class name "org.eclipse.MyExtensionFactory", the configuration properties
37       * "aether.priority.org.eclipse.MyExtensionFactory", "aether.priority.MyExtensionFactory" and
38       * "aether.priority.MyExtension" will be consulted for the priority, in that order (obviously, the last key is only
39       * tried if the class name ends with "Factory"). The corresponding value is a float and the special value
40       * {@link Float#NaN} or "NaN" (case-sensitive) can be used to disable the extension.
41       */
42      public static final String PREFIX_PRIORITY = PREFIX_AETHER + "priority.";
43  
44      /**
45       * A flag indicating whether the priorities of pluggable extensions are implicitly given by their iteration order
46       * such that the first extension has the highest priority. If set, an extension's built-in priority as well as any
47       * corresponding {@code aether.priority.*} configuration properties are ignored when searching for a suitable
48       * implementation among the available extensions. This priority mode is meant for cases where the application will
49       * present/inject extensions in the desired search order.
50       * 
51       * @see #DEFAULT_IMPLICIT_PRIORITIES
52       */
53      public static final String IMPLICIT_PRIORITIES = PREFIX_PRIORITY + "implicit";
54  
55      /**
56       * The default extension priority mode if {@link #IMPLICIT_PRIORITIES} isn't set.
57       */
58      public static final boolean DEFAULT_IMPLICIT_PRIORITIES = false;
59  
60      /**
61       * A flag indicating whether interaction with the user is allowed.
62       * 
63       * @see #DEFAULT_INTERACTIVE
64       */
65      public static final String INTERACTIVE = PREFIX_AETHER + "interactive";
66  
67      /**
68       * The default interactive mode if {@link #INTERACTIVE} isn't set.
69       */
70      public static final boolean DEFAULT_INTERACTIVE = false;
71  
72      /**
73       * The user agent that repository connectors should report to servers.
74       * 
75       * @see #DEFAULT_USER_AGENT
76       */
77      public static final String USER_AGENT = PREFIX_CONNECTOR + "userAgent";
78  
79      /**
80       * The default user agent to use if {@link #USER_AGENT} isn't set.
81       */
82      public static final String DEFAULT_USER_AGENT = "Aether";
83  
84      /**
85       * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive
86       * values indicate no timeout.
87       * 
88       * @see #DEFAULT_CONNECT_TIMEOUT
89       */
90      public static final String CONNECT_TIMEOUT = PREFIX_CONNECTOR + "connectTimeout";
91  
92      /**
93       * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set.
94       */
95      public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000;
96  
97      /**
98       * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that
99       * 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 }