Class DefaultCloseableSession
java.lang.Object
org.eclipse.aether.internal.impl.session.DefaultCloseableSession
- All Implemented Interfaces:
Closeable
,AutoCloseable
,RepositorySystemSession
,RepositorySystemSession.CloseableSession
public final class DefaultCloseableSession
extends Object
implements RepositorySystemSession.CloseableSession
A default implementation of repository system session that is immutable and thread-safe.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.aether.RepositorySystemSession
RepositorySystemSession.CloseableSession, RepositorySystemSession.SessionBuilder
-
Constructor Summary
ConstructorDescriptionDefaultCloseableSession
(String sessionId, boolean offline, boolean ignoreArtifactDescriptorRepositories, ResolutionErrorPolicy resolutionErrorPolicy, ArtifactDescriptorPolicy artifactDescriptorPolicy, String checksumPolicy, String artifactUpdatePolicy, String metadataUpdatePolicy, LocalRepositoryManager localRepositoryManager, List<LocalRepository> localRepositories, WorkspaceReader workspaceReader, RepositoryListener repositoryListener, TransferListener transferListener, Map<String, String> systemProperties, Map<String, String> userProperties, Map<String, Object> configProperties, MirrorSelector mirrorSelector, ProxySelector proxySelector, AuthenticationSelector authenticationSelector, ArtifactTypeRegistry artifactTypeRegistry, DependencyTraverser dependencyTraverser, DependencyManager dependencyManager, DependencySelector dependencySelector, VersionFilter versionFilter, DependencyGraphTransformer dependencyGraphTransformer, SessionData data, RepositoryCache cache, RepositorySystem repositorySystem, RepositorySystemLifecycle repositorySystemLifecycle) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addOnSessionEndedHandler
(Runnable handler) Registers a handler to execute when this session closed.void
close()
Closes the session.Gets the policy which controls how errors related to reading artifact descriptors should be handled.Gets the registry of artifact types recognized by this session, for instance when processing artifact descriptors.Gets the global artifact update policy.Gets the authentication selector to use for repositories discovered in artifact descriptors.getCache()
Gets the cache the repository system may use to save data for future reuse during the session.Gets the global checksum policy.Gets the configuration properties used to tweak internal aspects of the repository system (e.g.getData()
Gets the custom data associated with this session.Gets the dependency graph transformer to use for building dependency graphs.Gets the dependency manager to use for building dependency graphs.Gets the dependency selector to use for building dependency graphs.Gets the dependency traverser to use for building dependency graphs.Gets the local repository used during this session.Gets the local repository manager used during this session.Gets the global metadata update policy.Gets the mirror selector to use for repositories discovered in artifact descriptors.Gets the proxy selector to use for repositories discovered in artifact descriptors.Gets the listener being notified of actions in the repository system.Gets the policy which controls whether resolutions errors from remote repositories should be cached.Gets the system properties to use, e.g.Gets the listener being notified of uploads/downloads by the repository system.Gets the global update policy, ornull
if not set.Gets the user properties to use, e.g.Gets the version filter to use for building dependency graphs.Gets the workspace reader used during this session.boolean
Indicates whether repositories declared in artifact descriptors should be ignored during transitive dependency collection.boolean
Indicates whether the repository system operates in offline mode and avoids/refuses any access to remote repositories.Returns the ID of this closeable session instance.
-
Constructor Details
-
DefaultCloseableSession
public DefaultCloseableSession(String sessionId, boolean offline, boolean ignoreArtifactDescriptorRepositories, ResolutionErrorPolicy resolutionErrorPolicy, ArtifactDescriptorPolicy artifactDescriptorPolicy, String checksumPolicy, String artifactUpdatePolicy, String metadataUpdatePolicy, LocalRepositoryManager localRepositoryManager, List<LocalRepository> localRepositories, WorkspaceReader workspaceReader, RepositoryListener repositoryListener, TransferListener transferListener, Map<String, String> systemProperties, Map<String, String> userProperties, Map<String, Object> configProperties, MirrorSelector mirrorSelector, ProxySelector proxySelector, AuthenticationSelector authenticationSelector, ArtifactTypeRegistry artifactTypeRegistry, DependencyTraverser dependencyTraverser, DependencyManager dependencyManager, DependencySelector dependencySelector, VersionFilter versionFilter, DependencyGraphTransformer dependencyGraphTransformer, SessionData data, RepositoryCache cache, RepositorySystem repositorySystem, RepositorySystemLifecycle repositorySystemLifecycle)
-
-
Method Details
-
sessionId
Description copied from interface:RepositorySystemSession.CloseableSession
Returns the ID of this closeable session instance. Each closeable session has different ID, unique within repository system they were created with.- Specified by:
sessionId
in interfaceRepositorySystemSession.CloseableSession
- Returns:
- The session ID that is never
null
.
-
isOffline
Description copied from interface:RepositorySystemSession
Indicates whether the repository system operates in offline mode and avoids/refuses any access to remote repositories.- Specified by:
isOffline
in interfaceRepositorySystemSession
- Returns:
true
if the repository system is in offline mode,false
otherwise.
-
isIgnoreArtifactDescriptorRepositories
Description copied from interface:RepositorySystemSession
Indicates whether repositories declared in artifact descriptors should be ignored during transitive dependency collection. If enabled, only the repositories originally provided with the collect request will be considered.- Specified by:
isIgnoreArtifactDescriptorRepositories
in interfaceRepositorySystemSession
- Returns:
true
if additional repositories from artifact descriptors are ignored,false
to merge those with the originally specified repositories.
-
getResolutionErrorPolicy
Description copied from interface:RepositorySystemSession
Gets the policy which controls whether resolutions errors from remote repositories should be cached.- Specified by:
getResolutionErrorPolicy
in interfaceRepositorySystemSession
- Returns:
- The resolution error policy for this session or
null
if resolution errors should generally not be cached.
-
getArtifactDescriptorPolicy
Description copied from interface:RepositorySystemSession
Gets the policy which controls how errors related to reading artifact descriptors should be handled.- Specified by:
getArtifactDescriptorPolicy
in interfaceRepositorySystemSession
- Returns:
- The descriptor error policy for this session or
null
if descriptor errors should generally not be tolerated.
-
getChecksumPolicy
Description copied from interface:RepositorySystemSession
Gets the global checksum policy. If set, the global checksum policy overrides the checksum policies of the remote repositories being used for resolution.- Specified by:
getChecksumPolicy
in interfaceRepositorySystemSession
- Returns:
- The global checksum policy or
null
/empty if not set and the per-repository policies apply. - See Also:
-
getUpdatePolicy
Description copied from interface:RepositorySystemSession
Gets the global update policy, ornull
if not set.This method is meant for code that does not want to distinguish between artifact and metadata policies. Note: applications should either use get/set updatePolicy (this method and
DefaultRepositorySystemSession.setUpdatePolicy(String)
) or also distinguish between artifact and metadata update policies (and use other methods), but should not mix the two!- Specified by:
getUpdatePolicy
in interfaceRepositorySystemSession
- See Also:
-
getArtifactUpdatePolicy
Description copied from interface:RepositorySystemSession
Gets the global artifact update policy. If set, the global update policy overrides the update policies of the remote repositories being used for resolution.- Specified by:
getArtifactUpdatePolicy
in interfaceRepositorySystemSession
- Returns:
- The global update policy or
null
/empty if not set and the per-repository policies apply. - See Also:
-
getMetadataUpdatePolicy
Description copied from interface:RepositorySystemSession
Gets the global metadata update policy. If set, the global update policy overrides the update policies of the remote repositories being used for resolution.- Specified by:
getMetadataUpdatePolicy
in interfaceRepositorySystemSession
- Returns:
- The global update policy or
null
/empty if not set and the per-repository policies apply. - See Also:
-
getLocalRepository
Description copied from interface:RepositorySystemSession
Gets the local repository used during this session. This is a convenience method forLocalRepositoryManager.getRepository()
.- Specified by:
getLocalRepository
in interfaceRepositorySystemSession
- Returns:
- The local repository being during this session, never
null
.
-
getLocalRepositoryManager
Description copied from interface:RepositorySystemSession
Gets the local repository manager used during this session.- Specified by:
getLocalRepositoryManager
in interfaceRepositorySystemSession
- Returns:
- The local repository manager used during this session, never
null
.
-
getWorkspaceReader
Description copied from interface:RepositorySystemSession
Gets the workspace reader used during this session. If set, the workspace reader will usually be consulted first to resolve artifacts.- Specified by:
getWorkspaceReader
in interfaceRepositorySystemSession
- Returns:
- The workspace reader for this session or
null
if none.
-
getRepositoryListener
Description copied from interface:RepositorySystemSession
Gets the listener being notified of actions in the repository system.- Specified by:
getRepositoryListener
in interfaceRepositorySystemSession
- Returns:
- The repository listener or
null
if none.
-
getTransferListener
Description copied from interface:RepositorySystemSession
Gets the listener being notified of uploads/downloads by the repository system.- Specified by:
getTransferListener
in interfaceRepositorySystemSession
- Returns:
- The transfer listener or
null
if none.
-
getSystemProperties
Description copied from interface:RepositorySystemSession
Gets the system properties to use, e.g. for processing of artifact descriptors. System properties are usually collected from the runtime environment likeSystem.getProperties()
and environment variables.- Specified by:
getSystemProperties
in interfaceRepositorySystemSession
- Returns:
- The (read-only) system properties, never
null
.
-
getUserProperties
Description copied from interface:RepositorySystemSession
Gets the user properties to use, e.g. for processing of artifact descriptors. User properties are similar to system properties but are set on the discretion of the user and hence are considered of higher priority than system properties.- Specified by:
getUserProperties
in interfaceRepositorySystemSession
- Returns:
- The (read-only) user properties, never
null
.
-
getConfigProperties
Description copied from interface:RepositorySystemSession
Gets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling, connector-specific behavior, etc.)- Specified by:
getConfigProperties
in interfaceRepositorySystemSession
- Returns:
- The (read-only) configuration properties, never
null
. - See Also:
-
getMirrorSelector
Description copied from interface:RepositorySystemSession
Gets the mirror selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to denote the effective repositories.- Specified by:
getMirrorSelector
in interfaceRepositorySystemSession
- Returns:
- The mirror selector to use, never
null
. - See Also:
-
getProxySelector
Description copied from interface:RepositorySystemSession
Gets the proxy selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to have their proxy (if any) already set.- Specified by:
getProxySelector
in interfaceRepositorySystemSession
- Returns:
- The proxy selector to use, never
null
. - See Also:
-
getAuthenticationSelector
Description copied from interface:RepositorySystemSession
Gets the authentication selector to use for repositories discovered in artifact descriptors. Note that this selector is not used for remote repositories which are passed as request parameters to the repository system, those repositories are supposed to have their authentication (if any) already set.- Specified by:
getAuthenticationSelector
in interfaceRepositorySystemSession
- Returns:
- The authentication selector to use, never
null
. - See Also:
-
getArtifactTypeRegistry
Description copied from interface:RepositorySystemSession
Gets the registry of artifact types recognized by this session, for instance when processing artifact descriptors.- Specified by:
getArtifactTypeRegistry
in interfaceRepositorySystemSession
- Returns:
- The artifact type registry, never
null
.
-
getDependencyTraverser
Description copied from interface:RepositorySystemSession
Gets the dependency traverser to use for building dependency graphs.- Specified by:
getDependencyTraverser
in interfaceRepositorySystemSession
- Returns:
- The dependency traverser to use for building dependency graphs or
null
if dependencies are unconditionally traversed.
-
getDependencyManager
Description copied from interface:RepositorySystemSession
Gets the dependency manager to use for building dependency graphs.- Specified by:
getDependencyManager
in interfaceRepositorySystemSession
- Returns:
- The dependency manager to use for building dependency graphs or
null
if dependency management is not performed.
-
getDependencySelector
Description copied from interface:RepositorySystemSession
Gets the dependency selector to use for building dependency graphs.- Specified by:
getDependencySelector
in interfaceRepositorySystemSession
- Returns:
- The dependency selector to use for building dependency graphs or
null
if dependencies are unconditionally included.
-
getVersionFilter
Description copied from interface:RepositorySystemSession
Gets the version filter to use for building dependency graphs.- Specified by:
getVersionFilter
in interfaceRepositorySystemSession
- Returns:
- The version filter to use for building dependency graphs or
null
if versions aren't filtered.
-
getDependencyGraphTransformer
Description copied from interface:RepositorySystemSession
Gets the dependency graph transformer to use for building dependency graphs.- Specified by:
getDependencyGraphTransformer
in interfaceRepositorySystemSession
- Returns:
- The dependency graph transformer to use for building dependency graphs or
null
if none.
-
getData
Description copied from interface:RepositorySystemSession
Gets the custom data associated with this session.- Specified by:
getData
in interfaceRepositorySystemSession
- Returns:
- The session data, never
null
.
-
getCache
Description copied from interface:RepositorySystemSession
Gets the cache the repository system may use to save data for future reuse during the session.- Specified by:
getCache
in interfaceRepositorySystemSession
- Returns:
- The repository cache or
null
if none.
-
addOnSessionEndedHandler
Description copied from interface:RepositorySystemSession
Registers a handler to execute when this session closed.Note: Resolver 1.x sessions will not be able to register handlers. Migrate to Resolver 2.x way of handling sessions to make full use of new features. New features (like HTTP/2 transport) depend on this functionality. While they will function with Resolver 1.x sessions, they may produce resource leaks.
- Specified by:
addOnSessionEndedHandler
in interfaceRepositorySystemSession
- Parameters:
handler
- the handler, nevernull
.- Returns:
true
if handler successfully registered,false
otherwise.
-
close
Description copied from interface:RepositorySystemSession.CloseableSession
Closes the session. The session should be closed by its creator. A closed session should not be used anymore. This method may be invoked multiple times, but close will act only once (first time).- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceRepositorySystemSession.CloseableSession
-