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
021import java.io.Closeable;
022import java.io.File;
023import java.util.List;
024import java.util.Map;
025import java.util.function.Supplier;
026
027import org.eclipse.aether.artifact.ArtifactTypeRegistry;
028import org.eclipse.aether.collection.DependencyGraphTransformer;
029import org.eclipse.aether.collection.DependencyManager;
030import org.eclipse.aether.collection.DependencySelector;
031import org.eclipse.aether.collection.DependencyTraverser;
032import org.eclipse.aether.collection.VersionFilter;
033import org.eclipse.aether.repository.AuthenticationSelector;
034import org.eclipse.aether.repository.LocalRepository;
035import org.eclipse.aether.repository.LocalRepositoryManager;
036import org.eclipse.aether.repository.MirrorSelector;
037import org.eclipse.aether.repository.ProxySelector;
038import org.eclipse.aether.repository.RemoteRepository;
039import org.eclipse.aether.repository.RepositoryPolicy;
040import org.eclipse.aether.repository.WorkspaceReader;
041import org.eclipse.aether.resolution.ArtifactDescriptorPolicy;
042import org.eclipse.aether.resolution.ResolutionErrorPolicy;
043import org.eclipse.aether.transfer.TransferListener;
044
045/**
046 * Defines settings and components that control the repository system. Once initialized, the session object itself is
047 * supposed to be immutable and hence can safely be shared across an entire application and any concurrent threads
048 * reading it. Components that wish to tweak some aspects of an existing session should use the copy constructor of
049 * {@link DefaultRepositorySystemSession} and its mutators to derive a custom session.
050 *
051 * @noimplement This interface is not intended to be implemented by clients.
052 * @noextend This interface is not intended to be extended by clients.
053 */
054public interface RepositorySystemSession {
055
056    /**
057     * Immutable session that is closeable, should be handled as a resource. These session instances can be
058     * created with {@link SessionBuilder}.
059     *
060     * @noimplement This interface is not intended to be implemented by clients.
061     * @noextend This interface is not intended to be extended by clients.
062     *
063     * @since 2.0.0
064     */
065    interface CloseableSession extends RepositorySystemSession, Closeable {
066        /**
067         * Returns the ID of this closeable session instance. Each closeable session has different ID, unique within
068         * repository system they were created with.
069         *
070         * @return The session ID that is never {@code null}.
071         */
072        String sessionId();
073
074        /**
075         * Closes the session. The session should be closed by its creator. A closed session should not be used anymore.
076         * This method may be invoked multiple times, but close will act only once (first time).
077         */
078        @Override
079        void close();
080    }
081
082    /**
083     * Builder for building {@link CloseableSession} instances. Builder instances can be created with
084     * {@link RepositorySystem#createSessionBuilder()} method. Instances are not thread-safe nor immutable.
085     * <p>
086     * Important: if you set a stateful member on builder (for example {@link SessionData} or {@link RepositoryCache}),
087     * the builder will create session instances using same provided stateful members, that may lead to unexpected side
088     * effects. Solution for these cases is to not reuse builder instances, or, keep reconfiguring it, or ultimately
089     * provide suppliers that create new instance per each call.
090     *
091     * @noimplement This interface is not intended to be implemented by clients.
092     * @noextend This interface is not intended to be extended by clients.
093     *
094     * @since 2.0.0
095     */
096    interface SessionBuilder {
097        /**
098         * Controls whether the repository system operates in offline mode and avoids/refuses any access to remote
099         * repositories.
100         *
101         * @param offline {@code true} if the repository system is in offline mode, {@code false} otherwise.
102         * @return This session for chaining, never {@code null}.
103         */
104        SessionBuilder setOffline(boolean offline);
105
106        /**
107         * Controls whether repositories declared in artifact descriptors should be ignored during transitive dependency
108         * collection. If enabled, only the repositories originally provided with the collect request will be considered.
109         *
110         * @param ignoreArtifactDescriptorRepositories {@code true} to ignore additional repositories from artifact
111         *                                             descriptors, {@code false} to merge those with the originally
112         *                                             specified repositories.
113         * @return This session for chaining, never {@code null}.
114         */
115        SessionBuilder setIgnoreArtifactDescriptorRepositories(boolean ignoreArtifactDescriptorRepositories);
116
117        /**
118         * Sets the policy which controls whether resolutions errors from remote repositories should be cached.
119         *
120         * @param resolutionErrorPolicy The resolution error policy for this session, may be {@code null} if resolution
121         *                              errors should generally not be cached.
122         * @return This session for chaining, never {@code null}.
123         */
124        SessionBuilder setResolutionErrorPolicy(ResolutionErrorPolicy resolutionErrorPolicy);
125
126        /**
127         * Sets the policy which controls how errors related to reading artifact descriptors should be handled.
128         *
129         * @param artifactDescriptorPolicy The descriptor error policy for this session, may be {@code null} if descriptor
130         *                                 errors should generally not be tolerated.
131         * @return This session for chaining, never {@code null}.
132         */
133        SessionBuilder setArtifactDescriptorPolicy(ArtifactDescriptorPolicy artifactDescriptorPolicy);
134
135        /**
136         * Sets the global checksum policy. If set, the global checksum policy overrides the checksum policies of the remote
137         * repositories being used for resolution.
138         *
139         * @param checksumPolicy The global checksum policy, may be {@code null}/empty to apply the per-repository policies.
140         * @return This session for chaining, never {@code null}.
141         * @see RepositoryPolicy#CHECKSUM_POLICY_FAIL
142         * @see RepositoryPolicy#CHECKSUM_POLICY_IGNORE
143         * @see RepositoryPolicy#CHECKSUM_POLICY_WARN
144         */
145        SessionBuilder setChecksumPolicy(String checksumPolicy);
146
147        /**
148         * Sets the global update policy. If set, the global update policy overrides the update policies of the remote
149         * repositories being used for resolution.
150         * <p>
151         * This method is meant for code that does not want to distinguish between artifact and metadata policies.
152         * Note: applications should either use get/set updatePolicy (this method and
153         * {@link RepositorySystemSession#getUpdatePolicy()}) or also distinguish between artifact and
154         * metadata update policies (and use other methods), but <em>should not mix the two!</em>
155         *
156         * @param updatePolicy The global update policy, may be {@code null}/empty to apply the per-repository policies.
157         * @return This session for chaining, never {@code null}.
158         * @see RepositoryPolicy#UPDATE_POLICY_ALWAYS
159         * @see RepositoryPolicy#UPDATE_POLICY_DAILY
160         * @see RepositoryPolicy#UPDATE_POLICY_NEVER
161         * @see #setArtifactUpdatePolicy(String)
162         * @see #setMetadataUpdatePolicy(String)
163         */
164        SessionBuilder setUpdatePolicy(String updatePolicy);
165
166        /**
167         * Sets the global artifact update policy. If set, the global update policy overrides the artifact update policies
168         * of the remote repositories being used for resolution.
169         *
170         * @param artifactUpdatePolicy The global update policy, may be {@code null}/empty to apply the per-repository policies.
171         * @return This session for chaining, never {@code null}.
172         * @see RepositoryPolicy#UPDATE_POLICY_ALWAYS
173         * @see RepositoryPolicy#UPDATE_POLICY_DAILY
174         * @see RepositoryPolicy#UPDATE_POLICY_NEVER
175         * @since 2.0.0
176         */
177        SessionBuilder setArtifactUpdatePolicy(String artifactUpdatePolicy);
178
179        /**
180         * Sets the global metadata update policy. If set, the global update policy overrides the metadata update policies
181         * of the remote repositories being used for resolution.
182         *
183         * @param metadataUpdatePolicy The global update policy, may be {@code null}/empty to apply the per-repository policies.
184         * @return This session for chaining, never {@code null}.
185         * @see RepositoryPolicy#UPDATE_POLICY_ALWAYS
186         * @see RepositoryPolicy#UPDATE_POLICY_DAILY
187         * @see RepositoryPolicy#UPDATE_POLICY_NEVER
188         * @since 2.0.0
189         */
190        SessionBuilder setMetadataUpdatePolicy(String metadataUpdatePolicy);
191
192        /**
193         * Sets the local repository manager used during this session. <em>Note:</em> Eventually, a valid session must have
194         * a local repository manager set.
195         *
196         * @param localRepositoryManager The local repository manager used during this session, may be {@code null}.
197         * @return This session for chaining, never {@code null}.
198         */
199        SessionBuilder setLocalRepositoryManager(LocalRepositoryManager localRepositoryManager);
200
201        /**
202         * Sets the workspace reader used during this session. If set, the workspace reader will usually be consulted first
203         * to resolve artifacts.
204         *
205         * @param workspaceReader The workspace reader for this session, may be {@code null} if none.
206         * @return This session for chaining, never {@code null}.
207         */
208        SessionBuilder setWorkspaceReader(WorkspaceReader workspaceReader);
209
210        /**
211         * Sets the listener being notified of actions in the repository system.
212         *
213         * @param repositoryListener The repository listener, may be {@code null} if none.
214         * @return This session for chaining, never {@code null}.
215         */
216        SessionBuilder setRepositoryListener(RepositoryListener repositoryListener);
217
218        /**
219         * Sets the listener being notified of uploads/downloads by the repository system.
220         *
221         * @param transferListener The transfer listener, may be {@code null} if none.
222         * @return This session for chaining, never {@code null}.
223         */
224        SessionBuilder setTransferListener(TransferListener transferListener);
225
226        /**
227         * Sets the system properties to use, e.g. for processing of artifact descriptors. System properties are usually
228         * collected from the runtime environment like {@link System#getProperties()} and environment variables.
229         * <p>
230         * <em>Note:</em> System properties are of type {@code Map<String, String>} and any key-value pair in the input map
231         * that doesn't match this type will be silently ignored.
232         *
233         * @param systemProperties The system properties, may be {@code null} or empty if none.
234         * @return This session for chaining, never {@code null}.
235         */
236        SessionBuilder setSystemProperties(Map<?, ?> systemProperties);
237
238        /**
239         * Sets the specified system property.
240         *
241         * @param key   The property key, must not be {@code null}.
242         * @param value The property value, may be {@code null} to remove/unset the property.
243         * @return This session for chaining, never {@code null}.
244         */
245        SessionBuilder setSystemProperty(String key, String value);
246
247        /**
248         * Sets the user properties to use, e.g. for processing of artifact descriptors. User properties are similar to
249         * system properties but are set on the discretion of the user and hence are considered of higher priority than
250         * system properties in case of conflicts.
251         * <p>
252         * <em>Note:</em> User properties are of type {@code Map<String, String>} and any key-value pair in the input map
253         * that doesn't match this type will be silently ignored.
254         *
255         * @param userProperties The user properties, may be {@code null} or empty if none.
256         * @return This session for chaining, never {@code null}.
257         */
258        SessionBuilder setUserProperties(Map<?, ?> userProperties);
259
260        /**
261         * Sets the specified user property.
262         *
263         * @param key   The property key, must not be {@code null}.
264         * @param value The property value, may be {@code null} to remove/unset the property.
265         * @return This session for chaining, never {@code null}.
266         */
267        SessionBuilder setUserProperty(String key, String value);
268
269        /**
270         * Sets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling,
271         * connector-specific behavior, etc.).
272         * <p>
273         * <em>Note:</em> Configuration properties are of type {@code Map<String, Object>} and any key-value pair in the
274         * input map that doesn't match this type will be silently ignored.
275         *
276         * @param configProperties The configuration properties, may be {@code null} or empty if none.
277         * @return This session for chaining, never {@code null}.
278         */
279        SessionBuilder setConfigProperties(Map<?, ?> configProperties);
280
281        /**
282         * Sets the specified configuration property.
283         *
284         * @param key   The property key, must not be {@code null}.
285         * @param value The property value, may be {@code null} to remove/unset the property.
286         * @return This session for chaining, never {@code null}.
287         */
288        SessionBuilder setConfigProperty(String key, Object value);
289
290        /**
291         * Sets the mirror selector to use for repositories discovered in artifact descriptors. Note that this selector is
292         * not used for remote repositories which are passed as request parameters to the repository system, those
293         * repositories are supposed to denote the effective repositories.
294         *
295         * @param mirrorSelector The mirror selector to use, may be {@code null}.
296         * @return This session for chaining, never {@code null}.
297         */
298        SessionBuilder setMirrorSelector(MirrorSelector mirrorSelector);
299
300        /**
301         * Sets the proxy selector to use for repositories discovered in artifact descriptors. Note that this selector is
302         * not used for remote repositories which are passed as request parameters to the repository system, those
303         * repositories are supposed to have their proxy (if any) already set.
304         *
305         * @param proxySelector The proxy selector to use, may be {@code null}.
306         * @return This session for chaining, never {@code null}.
307         * @see RemoteRepository#getProxy()
308         */
309        SessionBuilder setProxySelector(ProxySelector proxySelector);
310
311        /**
312         * Sets the authentication selector to use for repositories discovered in artifact descriptors. Note that this
313         * selector is not used for remote repositories which are passed as request parameters to the repository system,
314         * those repositories are supposed to have their authentication (if any) already set.
315         *
316         * @param authenticationSelector The authentication selector to use, may be {@code null}.
317         * @return This session for chaining, never {@code null}.
318         * @see RemoteRepository#getAuthentication()
319         */
320        SessionBuilder setAuthenticationSelector(AuthenticationSelector authenticationSelector);
321
322        /**
323         * Sets the registry of artifact types recognized by this session.
324         *
325         * @param artifactTypeRegistry The artifact type registry, may be {@code null}.
326         * @return This session for chaining, never {@code null}.
327         */
328        SessionBuilder setArtifactTypeRegistry(ArtifactTypeRegistry artifactTypeRegistry);
329
330        /**
331         * Sets the dependency traverser to use for building dependency graphs.
332         *
333         * @param dependencyTraverser The dependency traverser to use for building dependency graphs, may be {@code null}.
334         * @return This session for chaining, never {@code null}.
335         */
336        SessionBuilder setDependencyTraverser(DependencyTraverser dependencyTraverser);
337
338        /**
339         * Sets the dependency manager to use for building dependency graphs.
340         *
341         * @param dependencyManager The dependency manager to use for building dependency graphs, may be {@code null}.
342         * @return This session for chaining, never {@code null}.
343         */
344        SessionBuilder setDependencyManager(DependencyManager dependencyManager);
345
346        /**
347         * Sets the dependency selector to use for building dependency graphs.
348         *
349         * @param dependencySelector The dependency selector to use for building dependency graphs, may be {@code null}.
350         * @return This session for chaining, never {@code null}.
351         */
352        SessionBuilder setDependencySelector(DependencySelector dependencySelector);
353
354        /**
355         * Sets the version filter to use for building dependency graphs.
356         *
357         * @param versionFilter The version filter to use for building dependency graphs, may be {@code null} to not filter
358         *                      versions.
359         * @return This session for chaining, never {@code null}.
360         */
361        SessionBuilder setVersionFilter(VersionFilter versionFilter);
362
363        /**
364         * Sets the dependency graph transformer to use for building dependency graphs.
365         *
366         * @param dependencyGraphTransformer The dependency graph transformer to use for building dependency graphs, may be
367         *                                   {@code null}.
368         * @return This session for chaining, never {@code null}.
369         */
370        SessionBuilder setDependencyGraphTransformer(DependencyGraphTransformer dependencyGraphTransformer);
371
372        /**
373         * Sets the custom data associated with this session.
374         * Note: When this method used to set instance, same passed instance will be used for every built session out
375         * of this builder instance, hence the built sessions will share these instances as well!
376         *
377         * @param data The session data, may be {@code null}.
378         * @return This session for chaining, never {@code null}.
379         */
380        SessionBuilder setData(SessionData data);
381
382        /**
383         * Sets the cache the repository system may use to save data for future reuse during the session.
384         * Note: When this method used to set instance, same passed instance will be used for every built session out
385         * of this builder instance, hence the built sessions will share these instances as well!
386         *
387         * @param cache The repository cache, may be {@code null} if none.
388         * @return This session for chaining, never {@code null}.
389         */
390        SessionBuilder setCache(RepositoryCache cache);
391
392        /**
393         * Sets the custom session data supplier associated with this session.
394         * Note: The supplier will be used for every built session out of this builder instance, so if supplier supplies
395         * <em>same instance</em> the built sessions will share these instances as well!
396         *
397         * @param dataSupplier The session data supplier, may not be {@code null}.
398         * @return This session for chaining, never {@code null}.
399         */
400        SessionBuilder setSessionDataSupplier(Supplier<SessionData> dataSupplier);
401
402        /**
403         * Sets the cache supplier for the repository system may use to save data for future reuse during the session.
404         * Note: The supplier will be used for every built session out of this builder instance, so if supplier supplies
405         * <em>same instance</em> the built sessions will share these instances as well!
406         *
407         * @param cacheSupplier The repository cache supplier, may not be {@code null}.
408         * @return This session for chaining, never {@code null}.
409         */
410        SessionBuilder setRepositoryCacheSupplier(Supplier<RepositoryCache> cacheSupplier);
411
412        /**
413         * Shortcut method to set up local repository manager directly onto builder. There must be at least one non-null
414         * {@link File} passed in this method. In case multiple files, session builder will use chained local repository
415         * manager.
416         *
417         * @param baseDirectories The local repository base directories.
418         * @return This session for chaining, never {@code null}.
419         * @see #withLocalRepositories(LocalRepository...)
420         */
421        SessionBuilder withLocalRepositoryBaseDirectories(File... baseDirectories);
422
423        /**
424         * Shortcut method to set up local repository manager directly onto builder. There must be at least one non-null
425         * {@link File} present in passed in list. In case multiple files, session builder will use chained local
426         * repository manager.
427         *
428         * @param baseDirectories The local repository base directories.
429         * @return This session for chaining, never {@code null}.
430         * @see #withLocalRepositories(List)
431         */
432        SessionBuilder withLocalRepositoryBaseDirectories(List<File> baseDirectories);
433
434        /**
435         * Shortcut method to set up local repository manager directly onto builder. There must be at least one non-null
436         * {@link LocalRepository} passed in this method. In case multiple local repositories, session builder will
437         * use chained local repository manager.
438         *
439         * @param localRepositories The local repositories.
440         * @return This session for chaining, never {@code null}.
441         */
442        SessionBuilder withLocalRepositories(LocalRepository... localRepositories);
443
444        /**
445         * Shortcut method to set up local repository manager directly onto builder. There must be at least one non-null
446         * {@link LocalRepository} present in passed in list. In case multiple local repositories, session builder will
447         * use chained local repository manager.
448         *
449         * @param localRepositories The local repositories.
450         * @return This session for chaining, never {@code null}.
451         */
452        SessionBuilder withLocalRepositories(List<LocalRepository> localRepositories);
453
454        /**
455         * Shortcut method to shallow-copy passed in session into current builder.
456         *
457         * @param session The session to shallow-copy from.
458         * @return This session for chaining, never {@code null}.
459         */
460        SessionBuilder withRepositorySystemSession(RepositorySystemSession session);
461
462        /**
463         * Creates immutable closeable session out this builder instance.
464         *
465         * @return Immutable closeable session, never {@code null}.
466         */
467        CloseableSession build();
468    }
469
470    /**
471     * Indicates whether the repository system operates in offline mode and avoids/refuses any access to remote
472     * repositories.
473     *
474     * @return {@code true} if the repository system is in offline mode, {@code false} otherwise.
475     */
476    boolean isOffline();
477
478    /**
479     * Indicates whether repositories declared in artifact descriptors should be ignored during transitive dependency
480     * collection. If enabled, only the repositories originally provided with the collect request will be considered.
481     *
482     * @return {@code true} if additional repositories from artifact descriptors are ignored, {@code false} to merge
483     *         those with the originally specified repositories.
484     */
485    boolean isIgnoreArtifactDescriptorRepositories();
486
487    /**
488     * Gets the policy which controls whether resolutions errors from remote repositories should be cached.
489     *
490     * @return The resolution error policy for this session or {@code null} if resolution errors should generally not be
491     *         cached.
492     */
493    ResolutionErrorPolicy getResolutionErrorPolicy();
494
495    /**
496     * Gets the policy which controls how errors related to reading artifact descriptors should be handled.
497     *
498     * @return The descriptor error policy for this session or {@code null} if descriptor errors should generally not be
499     *         tolerated.
500     */
501    ArtifactDescriptorPolicy getArtifactDescriptorPolicy();
502
503    /**
504     * Gets the global checksum policy. If set, the global checksum policy overrides the checksum policies of the remote
505     * repositories being used for resolution.
506     *
507     * @return The global checksum policy or {@code null}/empty if not set and the per-repository policies apply.
508     * @see RepositoryPolicy#CHECKSUM_POLICY_FAIL
509     * @see RepositoryPolicy#CHECKSUM_POLICY_IGNORE
510     * @see RepositoryPolicy#CHECKSUM_POLICY_WARN
511     */
512    String getChecksumPolicy();
513
514    /**
515     * Gets the global update policy, or {@code null} if not set.
516     * <p>
517     * This method is meant for code that does not want to distinguish between artifact and metadata policies.
518     * Note: applications should either use get/set updatePolicy (this method and
519     * {@link DefaultRepositorySystemSession#setUpdatePolicy(String)}) or also distinguish between artifact and
520     * metadata update policies (and use other methods), but <em>should not mix the two!</em>
521     *
522     * @see #getArtifactUpdatePolicy()
523     * @see #getMetadataUpdatePolicy()
524     */
525    String getUpdatePolicy();
526
527    /**
528     * Gets the global artifact update policy. If set, the global update policy overrides the update policies of the
529     * remote repositories being used for resolution.
530     *
531     * @return The global update policy or {@code null}/empty if not set and the per-repository policies apply.
532     * @see RepositoryPolicy#UPDATE_POLICY_ALWAYS
533     * @see RepositoryPolicy#UPDATE_POLICY_DAILY
534     * @see RepositoryPolicy#UPDATE_POLICY_NEVER
535     * @since 2.0.0
536     */
537    String getArtifactUpdatePolicy();
538
539    /**
540     * Gets the global metadata update policy. If set, the global update policy overrides the update policies of the remote
541     * repositories being used for resolution.
542     *
543     * @return The global update policy or {@code null}/empty if not set and the per-repository policies apply.
544     * @see RepositoryPolicy#UPDATE_POLICY_ALWAYS
545     * @see RepositoryPolicy#UPDATE_POLICY_DAILY
546     * @see RepositoryPolicy#UPDATE_POLICY_NEVER
547     * @since 2.0.0
548     */
549    String getMetadataUpdatePolicy();
550
551    /**
552     * Gets the local repository used during this session. This is a convenience method for
553     * {@link LocalRepositoryManager#getRepository()}.
554     *
555     * @return The local repository being during this session, never {@code null}.
556     */
557    LocalRepository getLocalRepository();
558
559    /**
560     * Gets the local repository manager used during this session.
561     *
562     * @return The local repository manager used during this session, never {@code null}.
563     */
564    LocalRepositoryManager getLocalRepositoryManager();
565
566    /**
567     * Gets the workspace reader used during this session. If set, the workspace reader will usually be consulted first
568     * to resolve artifacts.
569     *
570     * @return The workspace reader for this session or {@code null} if none.
571     */
572    WorkspaceReader getWorkspaceReader();
573
574    /**
575     * Gets the listener being notified of actions in the repository system.
576     *
577     * @return The repository listener or {@code null} if none.
578     */
579    RepositoryListener getRepositoryListener();
580
581    /**
582     * Gets the listener being notified of uploads/downloads by the repository system.
583     *
584     * @return The transfer listener or {@code null} if none.
585     */
586    TransferListener getTransferListener();
587
588    /**
589     * Gets the system properties to use, e.g. for processing of artifact descriptors. System properties are usually
590     * collected from the runtime environment like {@link System#getProperties()} and environment variables.
591     *
592     * @return The (read-only) system properties, never {@code null}.
593     */
594    Map<String, String> getSystemProperties();
595
596    /**
597     * Gets the user properties to use, e.g. for processing of artifact descriptors. User properties are similar to
598     * system properties but are set on the discretion of the user and hence are considered of higher priority than
599     * system properties.
600     *
601     * @return The (read-only) user properties, never {@code null}.
602     */
603    Map<String, String> getUserProperties();
604
605    /**
606     * Gets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling,
607     * connector-specific behavior, etc.)
608     *
609     * @return The (read-only) configuration properties, never {@code null}.
610     * @see ConfigurationProperties
611     */
612    Map<String, Object> getConfigProperties();
613
614    /**
615     * Gets the mirror selector to use for repositories discovered in artifact descriptors. Note that this selector is
616     * not used for remote repositories which are passed as request parameters to the repository system, those
617     * repositories are supposed to denote the effective repositories.
618     *
619     * @return The mirror selector to use, never {@code null}.
620     * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List)
621     */
622    MirrorSelector getMirrorSelector();
623
624    /**
625     * Gets the proxy selector to use for repositories discovered in artifact descriptors. Note that this selector is
626     * not used for remote repositories which are passed as request parameters to the repository system, those
627     * repositories are supposed to have their proxy (if any) already set.
628     *
629     * @return The proxy selector to use, never {@code null}.
630     * @see org.eclipse.aether.repository.RemoteRepository#getProxy()
631     * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List)
632     */
633    ProxySelector getProxySelector();
634
635    /**
636     * Gets the authentication selector to use for repositories discovered in artifact descriptors. Note that this
637     * selector is not used for remote repositories which are passed as request parameters to the repository system,
638     * those repositories are supposed to have their authentication (if any) already set.
639     *
640     * @return The authentication selector to use, never {@code null}.
641     * @see org.eclipse.aether.repository.RemoteRepository#getAuthentication()
642     * @see RepositorySystem#newResolutionRepositories(RepositorySystemSession, java.util.List)
643     */
644    AuthenticationSelector getAuthenticationSelector();
645
646    /**
647     * Gets the registry of artifact types recognized by this session, for instance when processing artifact
648     * descriptors.
649     *
650     * @return The artifact type registry, never {@code null}.
651     */
652    ArtifactTypeRegistry getArtifactTypeRegistry();
653
654    /**
655     * Gets the dependency traverser to use for building dependency graphs.
656     *
657     * @return The dependency traverser to use for building dependency graphs or {@code null} if dependencies are
658     *         unconditionally traversed.
659     */
660    DependencyTraverser getDependencyTraverser();
661
662    /**
663     * Gets the dependency manager to use for building dependency graphs.
664     *
665     * @return The dependency manager to use for building dependency graphs or {@code null} if dependency management is
666     *         not performed.
667     */
668    DependencyManager getDependencyManager();
669
670    /**
671     * Gets the dependency selector to use for building dependency graphs.
672     *
673     * @return The dependency selector to use for building dependency graphs or {@code null} if dependencies are
674     *         unconditionally included.
675     */
676    DependencySelector getDependencySelector();
677
678    /**
679     * Gets the version filter to use for building dependency graphs.
680     *
681     * @return The version filter to use for building dependency graphs or {@code null} if versions aren't filtered.
682     */
683    VersionFilter getVersionFilter();
684
685    /**
686     * Gets the dependency graph transformer to use for building dependency graphs.
687     *
688     * @return The dependency graph transformer to use for building dependency graphs or {@code null} if none.
689     */
690    DependencyGraphTransformer getDependencyGraphTransformer();
691
692    /**
693     * Gets the custom data associated with this session.
694     *
695     * @return The session data, never {@code null}.
696     */
697    SessionData getData();
698
699    /**
700     * Gets the cache the repository system may use to save data for future reuse during the session.
701     *
702     * @return The repository cache or {@code null} if none.
703     */
704    RepositoryCache getCache();
705
706    /**
707     * Registers a handler to execute when this session closed.
708     * <p>
709     * Note: Resolver 1.x sessions will not be able to register handlers. Migrate to Resolver 2.x way of handling
710     * sessions to make full use of new features. New features (like HTTP/2 transport) depend on this functionality.
711     * While they will function with Resolver 1.x sessions, they may produce resource leaks.
712     *
713     * @param handler the handler, never {@code null}.
714     * @return {@code true} if handler successfully registered, {@code false} otherwise.
715     * @since 2.0.0
716     */
717    boolean addOnSessionEndedHandler(Runnable handler);
718}