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