Interface RepositorySystemSession
-
- All Known Subinterfaces:
RepositorySystemSession.CloseableSession
- All Known Implementing Classes:
AbstractForwardingRepositorySystemSession,DefaultRepositorySystemSession
public interface RepositorySystemSession
Defines settings and components that control the repository system. Once initialized, the session object itself is supposed to be immutable and hence can safely be shared across an entire application and any concurrent threads reading it. Components that wish to tweak some aspects of an existing session should use the copy constructor ofDefaultRepositorySystemSessionand its mutators to derive a custom session.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceRepositorySystemSession.CloseableSessionImmutable session that is closeable, should be handled as a resource.static interfaceRepositorySystemSession.SessionBuilderBuilder for buildingRepositorySystemSession.CloseableSessioninstances.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddOnSessionEndedHandler(java.lang.Runnable handler)Registers a handler to execute when this session closed.ArtifactDescriptorPolicygetArtifactDescriptorPolicy()Gets the policy which controls how errors related to reading artifact descriptors should be handled.ArtifactTypeRegistrygetArtifactTypeRegistry()Gets the registry of artifact types recognized by this session, for instance when processing artifact descriptors.java.lang.StringgetArtifactUpdatePolicy()Gets the global artifact update policy.AuthenticationSelectorgetAuthenticationSelector()Gets the authentication selector to use for repositories discovered in artifact descriptors.RepositoryCachegetCache()Gets the cache the repository system may use to save data for future reuse during the session.java.lang.StringgetChecksumPolicy()Gets the global checksum policy.java.util.Map<java.lang.String,java.lang.Object>getConfigProperties()Gets the configuration properties used to tweak internal aspects of the repository system (e.g.SessionDatagetData()Gets the custom data associated with this session.DependencyCollectionCheckergetDependencyCollectionChecker()Returns the dependency collector checker, may benull.DependencyGraphTransformergetDependencyGraphTransformer()Gets the dependency graph transformer to use for building dependency graphs.DependencyManagergetDependencyManager()Gets the dependency manager to use for building dependency graphs.DependencySelectorgetDependencySelector()Gets the dependency selector to use for building dependency graphs.DependencyTraversergetDependencyTraverser()Gets the dependency traverser to use for building dependency graphs.LocalRepositorygetLocalRepository()Gets the local repository used during this session.LocalRepositoryManagergetLocalRepositoryManager()Gets the local repository manager used during this session.java.lang.StringgetMetadataUpdatePolicy()Gets the global metadata update policy.MirrorSelectorgetMirrorSelector()Gets the mirror selector to use for repositories discovered in artifact descriptors.ProxySelectorgetProxySelector()Gets the proxy selector to use for repositories discovered in artifact descriptors.RepositoryListenergetRepositoryListener()Gets the listener being notified of actions in the repository system.ResolutionErrorPolicygetResolutionErrorPolicy()Gets the policy which controls whether resolutions errors from remote repositories should be cached.ScopeManagergetScopeManager()Returns the scope manager to be used in this session, may benullif not set.SystemDependencyScopegetSystemDependencyScope()Returns the system dependency scope.java.util.Map<java.lang.String,java.lang.String>getSystemProperties()Gets the system properties to use, e.g.TransferListenergetTransferListener()Gets the listener being notified of uploads/downloads by the repository system.java.lang.StringgetUpdatePolicy()Gets the global update policy, ornullif not set.java.util.Map<java.lang.String,java.lang.String>getUserProperties()Gets the user properties to use, e.g.VersionFiltergetVersionFilter()Gets the version filter to use for building dependency graphs.WorkspaceReadergetWorkspaceReader()Gets the workspace reader used during this session.booleanisIgnoreArtifactDescriptorRepositories()Indicates whether repositories declared in artifact descriptors should be ignored during transitive dependency collection.booleanisOffline()Indicates whether the repository system operates in offline mode and avoids/refuses any access to remote repositories.
-
-
-
Method Detail
-
isOffline
boolean isOffline()
Indicates whether the repository system operates in offline mode and avoids/refuses any access to remote repositories.- Returns:
trueif the repository system is in offline mode,falseotherwise.
-
isIgnoreArtifactDescriptorRepositories
boolean isIgnoreArtifactDescriptorRepositories()
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.- Returns:
trueif additional repositories from artifact descriptors are ignored,falseto merge those with the originally specified repositories.
-
getResolutionErrorPolicy
ResolutionErrorPolicy getResolutionErrorPolicy()
Gets the policy which controls whether resolutions errors from remote repositories should be cached.- Returns:
- The resolution error policy for this session or
nullif resolution errors should generally not be cached.
-
getArtifactDescriptorPolicy
ArtifactDescriptorPolicy getArtifactDescriptorPolicy()
Gets the policy which controls how errors related to reading artifact descriptors should be handled.- Returns:
- The descriptor error policy for this session or
nullif descriptor errors should generally not be tolerated.
-
getChecksumPolicy
java.lang.String getChecksumPolicy()
Gets the global checksum policy. If set, the global checksum policy overrides the checksum policies of the remote repositories being used for resolution.- Returns:
- The global checksum policy or
null/empty if not set and the per-repository policies apply. - See Also:
RepositoryPolicy.CHECKSUM_POLICY_FAIL,RepositoryPolicy.CHECKSUM_POLICY_IGNORE,RepositoryPolicy.CHECKSUM_POLICY_WARN
-
getUpdatePolicy
java.lang.String getUpdatePolicy()
Gets the global update policy, ornullif 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!
-
getArtifactUpdatePolicy
java.lang.String getArtifactUpdatePolicy()
Gets the global artifact update policy. If set, the global update policy overrides the update policies of the remote repositories being used for resolution.- Returns:
- The global update policy or
null/empty if not set and the per-repository policies apply. - Since:
- 2.0.0
- See Also:
RepositoryPolicy.UPDATE_POLICY_ALWAYS,RepositoryPolicy.UPDATE_POLICY_DAILY,RepositoryPolicy.UPDATE_POLICY_NEVER
-
getMetadataUpdatePolicy
java.lang.String getMetadataUpdatePolicy()
Gets the global metadata update policy. If set, the global update policy overrides the update policies of the remote repositories being used for resolution.- Returns:
- The global update policy or
null/empty if not set and the per-repository policies apply. - Since:
- 2.0.0
- See Also:
RepositoryPolicy.UPDATE_POLICY_ALWAYS,RepositoryPolicy.UPDATE_POLICY_DAILY,RepositoryPolicy.UPDATE_POLICY_NEVER
-
getLocalRepository
LocalRepository getLocalRepository()
Gets the local repository used during this session. This is a convenience method forLocalRepositoryManager.getRepository().- Returns:
- The local repository being during this session, never
null.
-
getLocalRepositoryManager
LocalRepositoryManager getLocalRepositoryManager()
Gets the local repository manager used during this session.- Returns:
- The local repository manager used during this session, never
null.
-
getWorkspaceReader
WorkspaceReader getWorkspaceReader()
Gets the workspace reader used during this session. If set, the workspace reader will usually be consulted first to resolve artifacts.- Returns:
- The workspace reader for this session or
nullif none.
-
getRepositoryListener
RepositoryListener getRepositoryListener()
Gets the listener being notified of actions in the repository system.- Returns:
- The repository listener or
nullif none.
-
getTransferListener
TransferListener getTransferListener()
Gets the listener being notified of uploads/downloads by the repository system.- Returns:
- The transfer listener or
nullif none.
-
getSystemProperties
java.util.Map<java.lang.String,java.lang.String> getSystemProperties()
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.- Returns:
- The (read-only) system properties, never
null.
-
getUserProperties
java.util.Map<java.lang.String,java.lang.String> getUserProperties()
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.- Returns:
- The (read-only) user properties, never
null.
-
getConfigProperties
java.util.Map<java.lang.String,java.lang.Object> getConfigProperties()
Gets the configuration properties used to tweak internal aspects of the repository system (e.g. thread pooling, connector-specific behavior, etc.)- Returns:
- The (read-only) configuration properties, never
null. - See Also:
ConfigurationProperties
-
getMirrorSelector
MirrorSelector getMirrorSelector()
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.- Returns:
- The mirror selector to use, never
null. - See Also:
RepositorySystem.newResolutionRepositories(RepositorySystemSession, java.util.List)
-
getProxySelector
ProxySelector getProxySelector()
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.- Returns:
- The proxy selector to use, never
null. - See Also:
RemoteRepository.getProxy(),RepositorySystem.newResolutionRepositories(RepositorySystemSession, java.util.List)
-
getAuthenticationSelector
AuthenticationSelector getAuthenticationSelector()
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.- Returns:
- The authentication selector to use, never
null. - See Also:
RemoteRepository.getAuthentication(),RepositorySystem.newResolutionRepositories(RepositorySystemSession, java.util.List)
-
getArtifactTypeRegistry
ArtifactTypeRegistry getArtifactTypeRegistry()
Gets the registry of artifact types recognized by this session, for instance when processing artifact descriptors.- Returns:
- The artifact type registry, never
null.
-
getDependencyTraverser
DependencyTraverser getDependencyTraverser()
Gets the dependency traverser to use for building dependency graphs.- Returns:
- The dependency traverser to use for building dependency graphs or
nullif dependencies are unconditionally traversed.
-
getDependencyManager
DependencyManager getDependencyManager()
Gets the dependency manager to use for building dependency graphs.- Returns:
- The dependency manager to use for building dependency graphs or
nullif dependency management is not performed.
-
getDependencySelector
DependencySelector getDependencySelector()
Gets the dependency selector to use for building dependency graphs.- Returns:
- The dependency selector to use for building dependency graphs or
nullif dependencies are unconditionally included.
-
getVersionFilter
VersionFilter getVersionFilter()
Gets the version filter to use for building dependency graphs.- Returns:
- The version filter to use for building dependency graphs or
nullif versions aren't filtered.
-
getDependencyGraphTransformer
DependencyGraphTransformer getDependencyGraphTransformer()
Gets the dependency graph transformer to use for building dependency graphs.- Returns:
- The dependency graph transformer to use for building dependency graphs or
nullif none.
-
getData
SessionData getData()
Gets the custom data associated with this session.- Returns:
- The session data, never
null.
-
getCache
RepositoryCache getCache()
Gets the cache the repository system may use to save data for future reuse during the session.- Returns:
- The repository cache or
nullif none.
-
getScopeManager
ScopeManager getScopeManager()
Returns the scope manager to be used in this session, may benullif not set.- Returns:
- The scope manager or
nullif not set. - Since:
- 2.0.0
-
getSystemDependencyScope
SystemDependencyScope getSystemDependencyScope()
Returns the system dependency scope.Shorthand method for
ScopeManager.getSystemDependencyScope().If
ScopeManageris set,getScopeManager()returns non-null value, the result ofScopeManager.getSystemDependencyScope()is returned (that may benull). If noScopeManagerif set, thenSystemDependencyScope.LEGACYinstance is returned, as lack of scope manager means that resolver operates in "legacy" mode (Maven3 compatible mode).- Returns:
- The system dependency scope or
nullif no such scope. - Since:
- 2.0.0
-
getDependencyCollectionChecker
DependencyCollectionChecker getDependencyCollectionChecker()
Returns the dependency collector checker, may benull.- Returns:
- The effective
DependencyCollectionCheckerinstance, may benull. - Since:
- 2.0.19
-
addOnSessionEndedHandler
boolean addOnSessionEndedHandler(java.lang.Runnable handler)
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.
- Parameters:
handler- the handler, nevernull.- Returns:
trueif handler successfully registered,falseotherwise.- Since:
- 2.0.0
-
-