1 /******************************************************************************* 2 * Copyright (c) 2010, 2013 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 import java.util.Map; 14 15 import org.eclipse.aether.artifact.ArtifactTypeRegistry; 16 import org.eclipse.aether.collection.DependencyGraphTransformer; 17 import org.eclipse.aether.collection.DependencyManager; 18 import org.eclipse.aether.collection.DependencySelector; 19 import org.eclipse.aether.collection.DependencyTraverser; 20 import org.eclipse.aether.collection.VersionFilter; 21 import org.eclipse.aether.repository.AuthenticationSelector; 22 import org.eclipse.aether.repository.LocalRepository; 23 import org.eclipse.aether.repository.LocalRepositoryManager; 24 import org.eclipse.aether.repository.MirrorSelector; 25 import org.eclipse.aether.repository.ProxySelector; 26 import org.eclipse.aether.repository.RepositoryPolicy; 27 import org.eclipse.aether.repository.WorkspaceReader; 28 import org.eclipse.aether.resolution.ArtifactDescriptorPolicy; 29 import org.eclipse.aether.resolution.ResolutionErrorPolicy; 30 import org.eclipse.aether.transfer.TransferListener; 31 32 /** 33 * Defines settings and components that control the repository system. Once initialized, the session object itself is 34 * supposed to be immutable and hence can safely be shared across an entire application and any concurrent threads 35 * reading it. Components that wish to tweak some aspects of an existing session should use the copy constructor of 36 * {@link DefaultRepositorySystemSession} and its mutators to derive a custom session. 37 * 38 * @noimplement This interface is not intended to be implemented by clients. 39 * @noextend This interface is not intended to be extended by clients. 40 */ 41 public interface RepositorySystemSession 42 { 43 44 /** 45 * Indicates whether the repository system operates in offline mode and avoids/refuses any access to remote 46 * repositories. 47 * 48 * @return {@code true} if the repository system is in offline mode, {@code false} otherwise. 49 */ 50 boolean isOffline(); 51 52 /** 53 * Indicates whether repositories declared in artifact descriptors should be ignored during transitive dependency 54 * collection. If enabled, only the repositories originally provided with the collect request will be considered. 55 * 56 * @return {@code true} if additional repositories from artifact descriptors are ignored, {@code false} to merge 57 * those with the originally specified repositories. 58 */ 59 boolean isIgnoreArtifactDescriptorRepositories(); 60 61 /** 62 * Gets the policy which controls whether resolutions errors from remote repositories should be cached. 63 * 64 * @return The resolution error policy for this session or {@code null} if resolution errors should generally not be 65 * cached. 66 */ 67 ResolutionErrorPolicy getResolutionErrorPolicy(); 68 69 /** 70 * Gets the policy which controls how errors related to reading artifact descriptors should be handled. 71 * 72 * @return The descriptor error policy for this session or {@code null} if descriptor errors should generally not be 73 * tolerated. 74 */ 75 ArtifactDescriptorPolicy getArtifactDescriptorPolicy(); 76 77 /** 78 * Gets the global checksum policy. If set, the global checksum policy overrides the checksum policies of the remote 79 * repositories being used for resolution. 80 * 81 * @return The global checksum policy or {@code null}/empty if not set and the per-repository policies apply. 82 * @see RepositoryPolicy#CHECKSUM_POLICY_FAIL 83 * @see RepositoryPolicy#CHECKSUM_POLICY_IGNORE 84 * @see RepositoryPolicy#CHECKSUM_POLICY_WARN 85 */ 86 String getChecksumPolicy(); 87 88 /** 89 * Gets the global update policy. If set, the global update policy overrides the update policies of the remote 90 * repositories being used for resolution. 91 * 92 * @return The global update policy or {@code null}/empty if not set and the per-repository policies apply. 93 * @see RepositoryPolicy#UPDATE_POLICY_ALWAYS 94 * @see RepositoryPolicy#UPDATE_POLICY_DAILY 95 * @see RepositoryPolicy#UPDATE_POLICY_NEVER 96 */ 97 String getUpdatePolicy(); 98 99 /** 100 * Gets the local repository used during this session. This is a convenience method for 101 * {@link LocalRepositoryManager#getRepository()}. 102 * 103 * @return The local repository being during this session, never {@code null}. 104 */ 105 LocalRepository getLocalRepository(); 106 107 /** 108 * Gets the local repository manager used during this session. 109 * 110 * @return The local repository manager used during this session, never {@code null}. 111 */ 112 LocalRepositoryManager getLocalRepositoryManager(); 113 114 /** 115 * Gets the workspace reader used during this session. If set, the workspace reader will usually be consulted first 116 * to resolve artifacts. 117 * 118 * @return The workspace reader for this session or {@code null} if none. 119 */ 120 WorkspaceReader getWorkspaceReader(); 121 122 /** 123 * Gets the listener being notified of actions in the repository system. 124 * 125 * @return The repository listener or {@code null} if none. 126 */ 127 RepositoryListener getRepositoryListener(); 128 129 /** 130 * Gets the listener being notified of uploads/downloads by the repository system. 131 * 132 * @return The transfer listener or {@code null} if none. 133 */ 134 TransferListener getTransferListener(); 135 136 /** 137 * Gets the system properties to use, e.g. for processing of artifact descriptors. System properties are usually 138 * collected from the runtime environment like {@link System#getProperties()} and environment variables. 139 * 140 * @return The (read-only) system properties, never {@code null}. 141 */ 142 Map<String, String> getSystemProperties(); 143 144 /** 145 * Gets the user properties to use, e.g. for processing of artifact descriptors. User properties are similar to 146 * system properties but are set on the discretion of the user and hence are considered of higher priority than 147 * system properties. 148 * 149 * @return The (read-only) user properties, never {@code null}. 150 */ 151 Map<String, String> getUserProperties(); 152 153 /** 154 * Gets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling, 155 * connector-specific behavior, etc.) 156 * 157 * @return The (read-only) configuration properties, never {@code null}. 158 * @see ConfigurationProperties 159 */ 160 Map<String, Object> getConfigProperties(); 161 162 /** 163 * Gets the mirror selector to use for repositories discovered in artifact descriptors. Note that this selector is 164 * not used for remote repositories which are passed as request parameters to the repository system, those 165 * repositories are supposed to denote the effective repositories. 166 * 167 * @return The mirror selector to use, never {@code null}. 168 * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List) 169 */ 170 MirrorSelector getMirrorSelector(); 171 172 /** 173 * Gets the proxy selector to use for repositories discovered in artifact descriptors. Note that this selector is 174 * not used for remote repositories which are passed as request parameters to the repository system, those 175 * repositories are supposed to have their proxy (if any) already set. 176 * 177 * @return The proxy selector to use, never {@code null}. 178 * @see org.eclipse.aether.repository.RemoteRepository#getProxy() 179 * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List) 180 */ 181 ProxySelector getProxySelector(); 182 183 /** 184 * Gets the authentication selector to use for repositories discovered in artifact descriptors. Note that this 185 * selector is not used for remote repositories which are passed as request parameters to the repository system, 186 * those repositories are supposed to have their authentication (if any) already set. 187 * 188 * @return The authentication selector to use, never {@code null}. 189 * @see org.eclipse.aether.repository.RemoteRepository#getAuthentication() 190 * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List) 191 */ 192 AuthenticationSelector getAuthenticationSelector(); 193 194 /** 195 * Gets the registry of artifact types recognized by this session, for instance when processing artifact 196 * descriptors. 197 * 198 * @return The artifact type registry, never {@code null}. 199 */ 200 ArtifactTypeRegistry getArtifactTypeRegistry(); 201 202 /** 203 * Gets the dependency traverser to use for building dependency graphs. 204 * 205 * @return The dependency traverser to use for building dependency graphs or {@code null} if dependencies are 206 * unconditionally traversed. 207 */ 208 DependencyTraverser getDependencyTraverser(); 209 210 /** 211 * Gets the dependency manager to use for building dependency graphs. 212 * 213 * @return The dependency manager to use for building dependency graphs or {@code null} if dependency management is 214 * not performed. 215 */ 216 DependencyManager getDependencyManager(); 217 218 /** 219 * Gets the dependency selector to use for building dependency graphs. 220 * 221 * @return The dependency selector to use for building dependency graphs or {@code null} if dependencies are 222 * unconditionally included. 223 */ 224 DependencySelector getDependencySelector(); 225 226 /** 227 * Gets the version filter to use for building dependency graphs. 228 * 229 * @return The version filter to use for building dependency graphs or {@code null} if versions aren't filtered. 230 */ 231 VersionFilter getVersionFilter(); 232 233 /** 234 * Gets the dependency graph transformer to use for building dependency graphs. 235 * 236 * @return The dependency graph transformer to use for building dependency graphs or {@code null} if none. 237 */ 238 DependencyGraphTransformer getDependencyGraphTransformer(); 239 240 /** 241 * Gets the custom data associated with this session. 242 * 243 * @return The session data, never {@code null}. 244 */ 245 SessionData getData(); 246 247 /** 248 * Gets the cache the repository system may use to save data for future reuse during the session. 249 * 250 * @return The repository cache or {@code null} if none. 251 */ 252 RepositoryCache getCache(); 253 254 }