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 private static final String PREFIX_AETHER = "aether."; 29 30 private static final String PREFIX_CONNECTOR = PREFIX_AETHER + "connector."; 31 32 /** 33 * The prefix for properties that control the priority of pluggable extensions like transporters. For example, for 34 * an extension with the fully qualified class name "org.eclipse.MyExtensionFactory", the configuration properties 35 * "aether.priority.org.eclipse.MyExtensionFactory", "aether.priority.MyExtensionFactory" and 36 * "aether.priority.MyExtension" will be consulted for the priority, in that order (obviously, the last key is only 37 * tried if the class name ends with "Factory"). The corresponding value is a float and the special value 38 * {@link Float#NaN} or "NaN" (case-sensitive) can be used to disable the extension. 39 */ 40 public static final String PREFIX_PRIORITY = PREFIX_AETHER + "priority."; 41 42 /** 43 * A flag indicating whether the priorities of pluggable extensions are implicitly given by their iteration order 44 * such that the first extension has the highest priority. If set, an extension's built-in priority as well as any 45 * corresponding {@code aether.priority.*} configuration properties are ignored when searching for a suitable 46 * implementation among the available extensions. This priority mode is meant for cases where the application will 47 * present/inject extensions in the desired search order. 48 * 49 * @see #DEFAULT_IMPLICIT_PRIORITIES 50 */ 51 public static final String IMPLICIT_PRIORITIES = PREFIX_PRIORITY + "implicit"; 52 53 /** 54 * The default extension priority mode if {@link #IMPLICIT_PRIORITIES} isn't set. 55 */ 56 public static final boolean DEFAULT_IMPLICIT_PRIORITIES = false; 57 58 /** 59 * A flag indicating whether interaction with the user is allowed. 60 * 61 * @see #DEFAULT_INTERACTIVE 62 */ 63 public static final String INTERACTIVE = PREFIX_AETHER + "interactive"; 64 65 /** 66 * The default interactive mode if {@link #INTERACTIVE} isn't set. 67 */ 68 public static final boolean DEFAULT_INTERACTIVE = false; 69 70 /** 71 * The user agent that repository connectors should report to servers. 72 * 73 * @see #DEFAULT_USER_AGENT 74 */ 75 public static final String USER_AGENT = PREFIX_CONNECTOR + "userAgent"; 76 77 /** 78 * The default user agent to use if {@link #USER_AGENT} isn't set. 79 */ 80 public static final String DEFAULT_USER_AGENT = "Aether"; 81 82 /** 83 * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive 84 * values indicate no timeout. 85 * 86 * @see #DEFAULT_CONNECT_TIMEOUT 87 */ 88 public static final String CONNECT_TIMEOUT = PREFIX_CONNECTOR + "connectTimeout"; 89 90 /** 91 * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set. 92 */ 93 public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000; 94 95 /** 96 * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that 97 * this timeout does not restrict the overall duration of a request, it only restricts the duration of inactivity 98 * between consecutive data packets. Non-positive values indicate no timeout. 99 * 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 * Should HTTP client use preemptive auth (w/ BASIC) or not? 149 * 150 * @see #DEFAULT_HTTP_PREEMPTIVE_AUTH 151 * @since 1.9.6 152 */ 153 public static final String HTTP_PREEMPTIVE_AUTH = PREFIX_CONNECTOR + "http.preemptiveAuth"; 154 155 /** 156 * The default value to use if {@link #HTTP_PREEMPTIVE_AUTH} isn't set (false). 157 * 158 * @since 1.9.6 159 */ 160 public static final boolean DEFAULT_HTTP_PREEMPTIVE_AUTH = false; 161 162 /** 163 * Should HTTP client reuse connections (in other words, pool connections) or not? 164 * 165 * @see #DEFAULT_HTTP_REUSE_CONNECTIONS 166 * @since 1.9.8 167 */ 168 public static final String HTTP_REUSE_CONNECTIONS = PREFIX_CONNECTOR + "http.reuseConnections"; 169 170 /** 171 * The default value to use if {@link #HTTP_REUSE_CONNECTIONS} isn't set (true). 172 * 173 * @since 1.9.8 174 */ 175 public static final boolean DEFAULT_HTTP_REUSE_CONNECTIONS = true; 176 177 /** 178 * Time to live in seconds for an HTTP connection, after that time, the connection will be dropped. 179 * 180 * @see #DEFAULT_HTTP_CONNECTION_MAX_TTL 181 * @since 1.9.8 182 */ 183 public static final String HTTP_CONNECTION_MAX_TTL = PREFIX_CONNECTOR + "http.connectionMaxTtl"; 184 185 /** 186 * The default value to use if {@link #HTTP_CONNECTION_MAX_TTL} isn't set (600 seconds). 187 * 188 * @since 1.9.8 189 */ 190 public static final int DEFAULT_HTTP_CONNECTION_MAX_TTL = 600; 191 192 /** 193 * The maximum concurrent connections per route HTTP client is allowed to use. 194 * 195 * @see #DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE 196 * @since 1.9.8 197 */ 198 public static final String HTTP_MAX_CONNECTIONS_PER_ROUTE = PREFIX_CONNECTOR + "http.maxConnectionsPerRoute"; 199 200 /** 201 * The default value to use if {@link #HTTP_MAX_CONNECTIONS_PER_ROUTE} isn't set (50 connections). 202 * 203 * @since 1.9.8 204 */ 205 public static final int DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE = 50; 206 207 /** 208 * The mode that sets HTTPS transport "security mode": to ignore any SSL errors (certificate validity checks, 209 * hostname verification). The default value is {@link #HTTPS_SECURITY_MODE_DEFAULT}. 210 * 211 * @see #HTTPS_SECURITY_MODE_DEFAULT 212 * @see #HTTPS_SECURITY_MODE_INSECURE 213 * @since 1.9.6 214 */ 215 public static final String HTTPS_SECURITY_MODE = PREFIX_CONNECTOR + "https.securityMode"; 216 217 /** 218 * The default HTTPS security mode. 219 * 220 * @since 1.9.6 221 */ 222 public static final String HTTPS_SECURITY_MODE_DEFAULT = "default"; 223 224 /** 225 * The insecure HTTPS security mode (certificate validation, hostname verification are all ignored). 226 * 227 * @since 1.9.6 228 */ 229 public static final String HTTPS_SECURITY_MODE_INSECURE = "insecure"; 230 231 /** 232 * A flag indicating whether checksums which are retrieved during checksum validation should be persisted in the 233 * local filesystem next to the file they provide the checksum for. 234 * 235 * @see #DEFAULT_PERSISTED_CHECKSUMS 236 */ 237 public static final String PERSISTED_CHECKSUMS = PREFIX_CONNECTOR + "persistedChecksums"; 238 239 /** 240 * The default checksum persistence mode if {@link #PERSISTED_CHECKSUMS} isn't set. 241 */ 242 public static final boolean DEFAULT_PERSISTED_CHECKSUMS = true; 243 244 private ConfigurationProperties() { 245 // hide constructor 246 } 247 }