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 interaction with the user is allowed. 060 * 061 * @see #DEFAULT_INTERACTIVE 062 */ 063 public static final String INTERACTIVE = PREFIX_AETHER + "interactive"; 064 065 /** 066 * The default interactive mode if {@link #INTERACTIVE} isn't set. 067 */ 068 public static final boolean DEFAULT_INTERACTIVE = false; 069 070 /** 071 * The user agent that repository connectors should report to servers. 072 * 073 * @see #DEFAULT_USER_AGENT 074 */ 075 public static final String USER_AGENT = PREFIX_CONNECTOR + "userAgent"; 076 077 /** 078 * The default user agent to use if {@link #USER_AGENT} isn't set. 079 */ 080 public static final String DEFAULT_USER_AGENT = "Aether"; 081 082 /** 083 * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive 084 * values indicate no timeout. 085 * 086 * @see #DEFAULT_CONNECT_TIMEOUT 087 */ 088 public static final String CONNECT_TIMEOUT = PREFIX_CONNECTOR + "connectTimeout"; 089 090 /** 091 * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set. 092 */ 093 public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000; 094 095 /** 096 * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that 097 * this timeout does not restrict the overall duration of a request, it only restricts the duration of inactivity 098 * between consecutive data packets. Non-positive values indicate no timeout. 099 * 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 * Total time to live in seconds for an HTTP connection, after that time, the connection will be dropped 179 * (no matter for how long it was idle). 180 * 181 * @see #DEFAULT_HTTP_CONNECTION_MAX_TTL 182 * @since 1.9.8 183 */ 184 public static final String HTTP_CONNECTION_MAX_TTL = PREFIX_CONNECTOR + "http.connectionMaxTtl"; 185 186 /** 187 * The default value to use if {@link #HTTP_CONNECTION_MAX_TTL} isn't set (300 seconds). 188 * 189 * @since 1.9.8 190 */ 191 public static final int DEFAULT_HTTP_CONNECTION_MAX_TTL = 300; 192 193 /** 194 * The maximum concurrent connections per route HTTP client is allowed to use. 195 * 196 * @see #DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE 197 * @since 1.9.8 198 */ 199 public static final String HTTP_MAX_CONNECTIONS_PER_ROUTE = PREFIX_CONNECTOR + "http.maxConnectionsPerRoute"; 200 201 /** 202 * The default value to use if {@link #HTTP_MAX_CONNECTIONS_PER_ROUTE} isn't set (50 connections). 203 * 204 * @since 1.9.8 205 */ 206 public static final int DEFAULT_HTTP_MAX_CONNECTIONS_PER_ROUTE = 50; 207 208 /** 209 * The mode that sets HTTPS transport "security mode": to ignore any SSL errors (certificate validity checks, 210 * hostname verification). The default value is {@link #HTTPS_SECURITY_MODE_DEFAULT}. 211 * 212 * @see #HTTPS_SECURITY_MODE_DEFAULT 213 * @see #HTTPS_SECURITY_MODE_INSECURE 214 * @since 1.9.6 215 */ 216 public static final String HTTPS_SECURITY_MODE = PREFIX_CONNECTOR + "https.securityMode"; 217 218 /** 219 * The default HTTPS security mode. 220 * 221 * @since 1.9.6 222 */ 223 public static final String HTTPS_SECURITY_MODE_DEFAULT = "default"; 224 225 /** 226 * The insecure HTTPS security mode (certificate validation, hostname verification are all ignored). 227 * 228 * @since 1.9.6 229 */ 230 public static final String HTTPS_SECURITY_MODE_INSECURE = "insecure"; 231 232 /** 233 * A flag indicating whether checksums which are retrieved during checksum validation should be persisted in the 234 * local filesystem next to the file they provide the checksum for. 235 * 236 * @see #DEFAULT_PERSISTED_CHECKSUMS 237 */ 238 public static final String PERSISTED_CHECKSUMS = PREFIX_CONNECTOR + "persistedChecksums"; 239 240 /** 241 * The default checksum persistence mode if {@link #PERSISTED_CHECKSUMS} isn't set. 242 */ 243 public static final boolean DEFAULT_PERSISTED_CHECKSUMS = true; 244 245 private ConfigurationProperties() { 246 // hide constructor 247 } 248}