1 /******************************************************************************* 2 * Copyright (c) 2010, 2014 Sonatype, Inc. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * Sonatype, Inc. - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.aether; 12 13 /** 14 * The keys and defaults for common configuration properties. 15 * 16 * @see RepositorySystemSession#getConfigProperties() 17 */ 18 public final class ConfigurationProperties 19 { 20 21 private static final String PREFIX_AETHER = "aether."; 22 23 private static final String PREFIX_CONNECTOR = PREFIX_AETHER + "connector."; 24 25 /** 26 * The prefix for properties that control the priority of pluggable extensions like transporters. For example, for 27 * an extension with the fully qualified class name "org.eclipse.MyExtensionFactory", the configuration properties 28 * "aether.priority.org.eclipse.MyExtensionFactory", "aether.priority.MyExtensionFactory" and 29 * "aether.priority.MyExtension" will be consulted for the priority, in that order (obviously, the last key is only 30 * tried if the class name ends with "Factory"). The corresponding value is a float and the special value 31 * {@link Float#NaN} or "NaN" (case-sensitive) can be used to disable the extension. 32 */ 33 public static final String PREFIX_PRIORITY = PREFIX_AETHER + "priority."; 34 35 /** 36 * A flag indicating whether the priorities of pluggable extensions are implicitly given by their iteration order 37 * such that the first extension has the highest priority. If set, an extension's built-in priority as well as any 38 * corresponding {@code aether.priority.*} configuration properties are ignored when searching for a suitable 39 * implementation among the available extensions. This priority mode is meant for cases where the application will 40 * present/inject extensions in the desired search order. 41 * 42 * @see #DEFAULT_IMPLICIT_PRIORITIES 43 */ 44 public static final String IMPLICIT_PRIORITIES = PREFIX_PRIORITY + "implicit"; 45 46 /** 47 * The default extension priority mode if {@link #IMPLICIT_PRIORITIES} isn't set. 48 */ 49 public static final boolean DEFAULT_IMPLICIT_PRIORITIES = false; 50 51 /** 52 * A flag indicating whether interaction with the user is allowed. 53 * 54 * @see #DEFAULT_INTERACTIVE 55 */ 56 public static final String INTERACTIVE = PREFIX_AETHER + "interactive"; 57 58 /** 59 * The default interactive mode if {@link #INTERACTIVE} isn't set. 60 */ 61 public static final boolean DEFAULT_INTERACTIVE = false; 62 63 /** 64 * The user agent that repository connectors should report to servers. 65 * 66 * @see #DEFAULT_USER_AGENT 67 */ 68 public static final String USER_AGENT = PREFIX_CONNECTOR + "userAgent"; 69 70 /** 71 * The default user agent to use if {@link #USER_AGENT} isn't set. 72 */ 73 public static final String DEFAULT_USER_AGENT = "Aether"; 74 75 /** 76 * The maximum amount of time (in milliseconds) to wait for a successful connection to a remote server. Non-positive 77 * values indicate no timeout. 78 * 79 * @see #DEFAULT_CONNECT_TIMEOUT 80 */ 81 public static final String CONNECT_TIMEOUT = PREFIX_CONNECTOR + "connectTimeout"; 82 83 /** 84 * The default connect timeout to use if {@link #CONNECT_TIMEOUT} isn't set. 85 */ 86 public static final int DEFAULT_CONNECT_TIMEOUT = 10 * 1000; 87 88 /** 89 * The maximum amount of time (in milliseconds) to wait for remaining data to arrive from a remote server. Note that 90 * this timeout does not restrict the overall duration of a request, it only restricts the duration of inactivity 91 * between consecutive data packets. Non-positive values indicate no timeout. 92 * 93 * @see #DEFAULT_REQUEST_TIMEOUT 94 */ 95 public static final String REQUEST_TIMEOUT = PREFIX_CONNECTOR + "requestTimeout"; 96 97 /** 98 * The default request timeout to use if {@link #REQUEST_TIMEOUT} isn't set. 99 */ 100 public static final int DEFAULT_REQUEST_TIMEOUT = 1800 * 1000; 101 102 /** 103 * The request headers to use for HTTP-based repository connectors. The headers are specified using a 104 * {@code Map<String, String>}, mapping a header name to its value. Besides this general key, clients may also 105 * specify headers for a specific remote repository by appending the suffix {@code .<repoId>} to this key when 106 * storing the headers map. The repository-specific headers map is supposed to be complete, i.e. is not merged with 107 * the general headers map. 108 */ 109 public static final String HTTP_HEADERS = PREFIX_CONNECTOR + "http.headers"; 110 111 /** 112 * The encoding/charset to use when exchanging credentials with HTTP servers. Besides this general key, clients may 113 * also specify the encoding for a specific remote repository by appending the suffix {@code .<repoId>} to this key 114 * when storing the charset name. 115 * 116 * @see #DEFAULT_HTTP_CREDENTIAL_ENCODING 117 */ 118 public static final String HTTP_CREDENTIAL_ENCODING = PREFIX_CONNECTOR + "http.credentialEncoding"; 119 120 /** 121 * The default encoding/charset to use if {@link #HTTP_CREDENTIAL_ENCODING} isn't set. 122 */ 123 public static final String DEFAULT_HTTP_CREDENTIAL_ENCODING = "ISO-8859-1"; 124 125 /** 126 * An option indicating whether authentication configured for a HTTP repository should also be used with any host 127 * that the original server might redirect requests to. Unless enabled, credentials are only exchanged with the 128 * original host from the repository URL and not supplied to different hosts encountered during redirects. The 129 * option value can either be a boolean flag or a comma-separated list of host names denoting the whitelist of 130 * original hosts whose redirects can be trusted and should use the configured authentication no matter the 131 * destination host(s). Alternatively, the suffix {@code .<repoId>} can be appended to this configuration key to 132 * control the behavior for a specific repository id. 133 * 134 * @see #DEFAULT_HTTP_REDIRECTED_AUTHENTICATION 135 * @since 1.1.0 136 */ 137 public static final String HTTP_REDIRECTED_AUTHENTICATION = PREFIX_CONNECTOR + "http.redirectedAuthentication"; 138 139 /** 140 * The default handling of authentication during HTTP redirects if {@link #HTTP_REDIRECTED_AUTHENTICATION} isn't 141 * set. 142 * 143 * @since 1.1.0 144 */ 145 public static final String DEFAULT_HTTP_REDIRECTED_AUTHENTICATION = "false"; 146 147 /** 148 * A flag indicating whether checksums which are retrieved during checksum validation should be persisted in the 149 * local filesystem next to the file they provide the checksum for. 150 * 151 * @see #DEFAULT_PERSISTED_CHECKSUMS 152 */ 153 public static final String PERSISTED_CHECKSUMS = PREFIX_CONNECTOR + "persistedChecksums"; 154 155 /** 156 * The default checksum persistence mode if {@link #PERSISTED_CHECKSUMS} isn't set. 157 */ 158 public static final boolean DEFAULT_PERSISTED_CHECKSUMS = true; 159 160 private ConfigurationProperties() 161 { 162 // hide constructor 163 } 164 165 }