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           * Closes the session. The session should be closed by its creator. A closed session should not be used anymore.
76           * This method may be invoked multiple times, but close will act only once (first time).
77           */
78          @Override
79          void close();
80      }
81  
82      /**
83       * Builder for building {@link CloseableSession} instances. Builder instances can be created with
84       * {@link RepositorySystem#createSessionBuilder()} method. Instances are not thread-safe nor immutable.
85       * <p>
86       * Important: if you set a stateful member on builder (for example {@link SessionData} or {@link RepositoryCache}),
87       * the builder will create session instances using same provided stateful members, that may lead to unexpected side
88       * effects. Solution for these cases is to not reuse builder instances, or, keep reconfiguring it, or ultimately
89       * provide suppliers that create new instance per each call.
90       *
91       * @noimplement This interface is not intended to be implemented by clients.
92       * @noextend This interface is not intended to be extended by clients.
93       *
94       * @since 2.0.0
95       */
96      interface SessionBuilder {
97          /**
98           * Controls whether the repository system operates in offline mode and avoids/refuses any access to remote
99           * 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 }